You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that default binding modes do not apply for the desugared expression.
864
864
865
+
> [!NOTE]
866
+
> Although basic assignment expressions are not [temporary scopes], the desugaring of destructuring assignments restricts the temporary scope of its assigned value operand.
867
+
> For example:
868
+
>
869
+
> ```rust
870
+
> # fntemp() {}
871
+
> usestd::convert::identity;
872
+
>
873
+
> letx;
874
+
> // In a basic assignment, `temp()` is dropped at the end of the
875
+
> // enclosing temporary scope, so `x` can be assigned and used
876
+
> // within the same temporary scope.
877
+
> (x=identity(&temp()), x);
878
+
> ```
879
+
>
880
+
> ```rust,compile_fail,E0716
881
+
> # fntemp() {}
882
+
> # usestd::convert::identity;
883
+
> letx;
884
+
> // In a destructuring assignment, `temp()` is dropped at the end of
885
+
> // the `let` statement in the desugaring, so `x` cannot be assigned.
0 commit comments