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
However, this seems not to be the behaviour of rustc. rustc instead accepts only outer attributes for each field, but not inner attributes for the entire expression.
For example, this compiles in rustc:
structS{x:i64,y:i64}fnmain(){let s = S{x:1,#[deprecated]y:2};}
But not this:
structS{x:i64,y:i64}fnmain(){let s = S{#![deprecated]x:1,y:2};}
The text was updated successfully, but these errors were encountered:
YizhePKU
changed the title
Mistake on where attributes are allowed in StructExpr
Mistake on where attributes are allowed in StructExpr and TupleExpr
May 9, 2021
YizhePKU
changed the title
Mistake on where attributes are allowed in StructExpr and TupleExpr
Mistake on where attributes are allowed in StructExpr and more
May 9, 2021
They were accepted syntactically, but that was recently removed in nightly in rust-lang/rust#83312. There is discussion in rust-lang/rust#84879 about reverting that change.
According to the reference, only inner attributes are allowed in an StructExpr:
However, this seems not to be the behaviour of rustc. rustc instead accepts only outer attributes for each field, but not inner attributes for the entire expression.
For example, this compiles in rustc:
But not this:
The text was updated successfully, but these errors were encountered: