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
Public StructFields spans do not cover the entire field declaration. This causes problems in tools like rustfmt that use the span to re-format the field (https://github.com/nrc/rustfmt/issues/95).
For example, a compile error to show the span:
struct Foo {
pub bar: u8,
pub bar: u8,
}
fn main() { }
I would expect to see the span start at pub:
loon:rust cjh$ rustc pub-struct-field-span.rs
pub-struct-field-span.rs:3:5: 3:16 error: field `bar` is already declared [E0124]
pub-struct-field-span.rs:3 pub bar: u8,
^~~~~~~~~~~
pub-struct-field-span.rs:2:5: 2:16 note: previously declared here
pub-struct-field-span.rs:2 pub bar: u8,
^~~~~~~~~~~
error: aborting due to previous error
Instead, I see:
loon:rust cjh$ rustc pub-struct-field-span.rs
pub-struct-field-span.rs:3:9: 3:16 error: field `bar` is already declared [E0124]
pub-struct-field-span.rs:3 pub bar: u8,
^~~~~~~
pub-struct-field-span.rs:2:9: 2:16 note: previously declared here
pub-struct-field-span.rs:2 pub bar: u8,
^~~~~~~
error: aborting due to previous error
Public StructFields spans do not cover the entire field declaration. This causes problems in tools like
rustfmt
that use the span to re-format the field (https://github.com/nrc/rustfmt/issues/95).For example, a compile error to show the span:
I would expect to see the span start at
pub
:Instead, I see:
Meta
The text was updated successfully, but these errors were encountered: