Closed
Description
According to the reference, only inner attributes are allowed in an StructExpr:
StructExprStruct :
PathInExpression { InnerAttribute* (StructExprFields | StructBase)? }
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:
struct S { x: i64, y: i64 }
fn main() {
let s = S { x: 1, #[deprecated] y: 2};
}
But not this:
struct S { x: i64, y: i64 }
fn main() {
let s = S { #![deprecated] x: 1, y: 2};
}
Metadata
Metadata
Assignees
Labels
No labels