Rollup merge of #35491 - sanxiyn:pub-restricted-span, r=nikomatsakis
Correct span for pub_restricted field Fix #35435.
This commit is contained in:
commit
c35d8dba7f
3 changed files with 37 additions and 25 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
@ -8,23 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Regression test for issue #26083
|
||||
// Test that span for public struct fields start at `pub` instead of the identifier
|
||||
// Regression test for issue #26083 and #35435
|
||||
// Test that span for public struct fields start at `pub`
|
||||
|
||||
#![feature(pub_restricted)]
|
||||
|
||||
struct Foo {
|
||||
pub bar: u8,
|
||||
|
||||
pub
|
||||
//~^ error: field `bar` is already declared [E0124]
|
||||
bar: u8,
|
||||
|
||||
pub bar:
|
||||
//~^ error: field `bar` is already declared [E0124]
|
||||
u8,
|
||||
|
||||
bar:
|
||||
//~^ error: field `bar` is already declared [E0124]
|
||||
u8,
|
||||
pub bar: u8,
|
||||
pub(crate) bar: u8,
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
fn main() {}
|
||||
19
src/test/ui/span/pub-struct-field.stderr
Normal file
19
src/test/ui/span/pub-struct-field.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0124]: field `bar` is already declared
|
||||
--> $DIR/pub-struct-field.rs:18:5
|
||||
|
|
||||
17 | bar: u8,
|
||||
| ------- `bar` first declared here
|
||||
18 | pub bar: u8,
|
||||
| ^^^^^^^^^^^ field already declared
|
||||
|
||||
error[E0124]: field `bar` is already declared
|
||||
--> $DIR/pub-struct-field.rs:19:5
|
||||
|
|
||||
17 | bar: u8,
|
||||
| ------- `bar` first declared here
|
||||
18 | pub bar: u8,
|
||||
19 | pub(crate) bar: u8,
|
||||
| ^^^^^^^^^^^^^^^^^^ field already declared
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue