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
fnmain(){#[allow(unused)]letmut x = 1;#[allow(unused)]
x = 1;}
There's an error generated about the x = 1; line, but not the let mut x = 1; line. I would expect that either a) neither of these are errors (since they're both statements, not expressions) or, b) both of these are errors.
I suspect the attribute is binding tightly to the place expression, instead of the entire statement. Attributes on statements are stable, but attributes on expressions are limited. This is partially documented here: https://doc.rust-lang.org/nightly/reference/expressions.html#expression-attributes. I'm curious if that precedence is intended. It makes sense to me, but I see how it is confusing. A work around is to wrap the assignment expression in {} or ().
Given the following code:
There's an error generated about the
x = 1;
line, but not thelet mut x = 1;
line. I would expect that either a) neither of these are errors (since they're both statements, not expressions) or, b) both of these are errors.(cc @cramertj )
The text was updated successfully, but these errors were encountered: