Rollup merge of #40556 - cramertj:stabilize-pub-restricted, r=petrochenkov

Stabilize pub(restricted)

Fix https://github.com/rust-lang/rust/issues/32409
This commit is contained in:
Corey Farwell 2017-03-20 23:44:59 -04:00 committed by GitHub
commit 17656ab328
28 changed files with 78 additions and 107 deletions

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
pub mod m {
pub struct S(u8);

View file

@ -10,8 +10,6 @@
// aux-build:privacy-struct-ctor.rs
#![feature(pub_restricted)]
extern crate privacy_struct_ctor as xcrate;
mod m {

View file

@ -1,7 +1,7 @@
error[E0423]: expected value, found struct `Z`
--> $DIR/privacy-struct-ctor.rs:28:9
--> $DIR/privacy-struct-ctor.rs:26:9
|
28 | Z;
26 | Z;
| ^
| |
| did you mean `Z { /* fields */ }`?
@ -11,9 +11,9 @@ error[E0423]: expected value, found struct `Z`
`use m::n::Z;`
error[E0423]: expected value, found struct `S`
--> $DIR/privacy-struct-ctor.rs:38:5
--> $DIR/privacy-struct-ctor.rs:36:5
|
38 | S;
36 | S;
| ^
| |
| did you mean `S { /* fields */ }`?
@ -23,9 +23,9 @@ error[E0423]: expected value, found struct `S`
`use m::S;`
error[E0423]: expected value, found struct `xcrate::S`
--> $DIR/privacy-struct-ctor.rs:44:5
--> $DIR/privacy-struct-ctor.rs:42:5
|
44 | xcrate::S;
42 | xcrate::S;
| ^^^^^^^^^
| |
| did you mean `xcrate::S { /* fields */ }`?
@ -35,33 +35,33 @@ error[E0423]: expected value, found struct `xcrate::S`
`use m::S;`
error: tuple struct `Z` is private
--> $DIR/privacy-struct-ctor.rs:27:9
--> $DIR/privacy-struct-ctor.rs:25:9
|
27 | n::Z; //~ ERROR tuple struct `Z` is private
25 | n::Z; //~ ERROR tuple struct `Z` is private
| ^^^^
error: tuple struct `S` is private
--> $DIR/privacy-struct-ctor.rs:37:5
--> $DIR/privacy-struct-ctor.rs:35:5
|
37 | m::S; //~ ERROR tuple struct `S` is private
35 | m::S; //~ ERROR tuple struct `S` is private
| ^^^^
error: tuple struct `Z` is private
--> $DIR/privacy-struct-ctor.rs:41:5
--> $DIR/privacy-struct-ctor.rs:39:5
|
41 | m::n::Z; //~ ERROR tuple struct `Z` is private
39 | m::n::Z; //~ ERROR tuple struct `Z` is private
| ^^^^^^^
error: tuple struct `S` is private
--> $DIR/privacy-struct-ctor.rs:43:5
--> $DIR/privacy-struct-ctor.rs:41:5
|
43 | xcrate::m::S; //~ ERROR tuple struct `S` is private
41 | xcrate::m::S; //~ ERROR tuple struct `S` is private
| ^^^^^^^^^^^^
error: tuple struct `Z` is private
--> $DIR/privacy-struct-ctor.rs:47:5
--> $DIR/privacy-struct-ctor.rs:45:5
|
47 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
45 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
| ^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors

View file

@ -11,8 +11,6 @@
// Regression test for issue #26083 and #35435
// Test that span for public struct fields start at `pub`
#![feature(pub_restricted)]
struct Foo {
bar: u8,
pub bar: u8,

View file

@ -1,18 +1,18 @@
error[E0124]: field `bar` is already declared
--> $DIR/pub-struct-field.rs:18:5
--> $DIR/pub-struct-field.rs:16:5
|
17 | bar: u8,
15 | bar: u8,
| ------- `bar` first declared here
18 | pub bar: u8,
16 | pub bar: u8,
| ^^^^^^^^^^^ field already declared
error[E0124]: field `bar` is already declared
--> $DIR/pub-struct-field.rs:19:5
--> $DIR/pub-struct-field.rs:17:5
|
17 | bar: u8,
15 | bar: u8,
| ------- `bar` first declared here
18 | pub bar: u8,
19 | pub(crate) bar: u8,
16 | pub bar: u8,
17 | pub(crate) bar: u8,
| ^^^^^^^^^^^^^^^^^^ field already declared
error: aborting due to 2 previous errors