-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
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
Meta
loon:rust cjh$ rustc --version --verbose
rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-01)
binary: rustc
commit-hash: 613e57b448c88591b6076a8cea9799f1f3876687
commit-date: 2015-06-01
build-date: 2015-06-01
host: x86_64-apple-darwin
release: 1.2.0-nightly
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints