Skip to content

Commit 962d88b

Browse files
committed
Fix the fallout
1 parent 18b96cf commit 962d88b

File tree

7 files changed

+63
-100
lines changed

7 files changed

+63
-100
lines changed

src/librustc_privacy/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ E0450: r##"
119119
A tuple constructor was invoked while some of its fields are private. Erroneous
120120
code example:
121121
122-
```compile_fail,E0450
122+
```compile_fail
123123
mod Bar {
124124
pub struct Foo(isize);
125125
}

src/libsyntax/symbol.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ macro_rules! declare_keywords {(
140140
$(
141141
#[allow(non_upper_case_globals)]
142142
pub const $konst: Keyword = Keyword {
143-
ident: ast::Ident::with_empty_ctxt(ast::Name($index))
143+
ident: ast::Ident::with_empty_ctxt(super::Symbol($index))
144144
};
145145
)*
146146
}
@@ -282,25 +282,24 @@ impl Encodable for InternedString {
282282
#[cfg(test)]
283283
mod tests {
284284
use super::*;
285-
use ast::Name;
286285

287286
#[test]
288287
fn interner_tests() {
289288
let mut i: Interner = Interner::new();
290289
// first one is zero:
291-
assert_eq!(i.intern("dog"), Name(0));
290+
assert_eq!(i.intern("dog"), Symbol(0));
292291
// re-use gets the same entry:
293-
assert_eq!(i.intern ("dog"), Name(0));
292+
assert_eq!(i.intern ("dog"), Symbol(0));
294293
// different string gets a different #:
295-
assert_eq!(i.intern("cat"), Name(1));
296-
assert_eq!(i.intern("cat"), Name(1));
294+
assert_eq!(i.intern("cat"), Symbol(1));
295+
assert_eq!(i.intern("cat"), Symbol(1));
297296
// dog is still at zero
298-
assert_eq!(i.intern("dog"), Name(0));
297+
assert_eq!(i.intern("dog"), Symbol(0));
299298
// gensym gets 3
300-
assert_eq!(i.gensym("zebra"), Name(2));
299+
assert_eq!(i.gensym("zebra"), Symbol(2));
301300
// gensym of same string gets new number :
302-
assert_eq!(i.gensym("zebra"), Name(3));
301+
assert_eq!(i.gensym("zebra"), Symbol(3));
303302
// gensym of *existing* string gets new number:
304-
assert_eq!(i.gensym("dog"), Name(4));
303+
assert_eq!(i.gensym("dog"), Symbol(4));
305304
}
306305
}

src/test/compile-fail-fulldeps/explore-issue-38412.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,14 @@ use pub_and_stability::{Record, Trait, Tuple};
2525
fn main() {
2626
// Okay
2727
let Record { .. } = Record::new();
28-
// Okay (for now; see RFC Issue #902)
29-
let Tuple(..) = Tuple::new();
3028

3129
// Okay
3230
let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
33-
// Okay (for now; see RFC Issue #902)
34-
let Tuple(_, _, ..) = Tuple::new(); // analogous to above
3531

3632
let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
3733
Record::new();
3834
//~^^ ERROR use of unstable library feature 'unstable_undeclared'
3935

40-
let Tuple(_, _, _, ..) = Tuple::new(); // analogous to previous
41-
//~^ ERROR use of unstable library feature 'unstable_undeclared'
42-
4336
let r = Record::new();
4437
let t = Tuple::new();
4538

src/test/compile-fail/E0450.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/compile-fail/E0451.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ fn pat_match(foo: Bar::Foo) {
2525
//~^ NOTE field `b` is private
2626
}
2727

28-
fn pat_match_tuple(foo: Bar::FooTuple) {
29-
let Bar::FooTuple(a,b) = foo; //~ ERROR E0451
30-
//~^ NOTE field `1` is private
31-
}
32-
3328
fn main() {
3429
let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451
3530
//~^ NOTE field `b` is private

src/test/compile-fail/issue-38412.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
fn main() {
1212
let Box(a) = loop { };
13-
//~^ ERROR field `0` of struct `std::boxed::Box` is private
13+
//~^ ERROR expected tuple struct/variant, found struct `Box`
1414

1515
// (The below is a trick to allow compiler to infer a type for
1616
// variable `a` without attempting to ascribe a type to the

src/test/compile-fail/privacy5.rs

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -58,83 +58,80 @@ mod a {
5858
}
5959

6060
fn this_crate() {
61-
let a = a::A(()); //~ ERROR: cannot invoke tuple struct constructor
62-
let b = a::B(2); //~ ERROR: cannot invoke tuple struct constructor
63-
let c = a::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
61+
let a = a::A(()); //~ ERROR tuple struct `A` is private
62+
let b = a::B(2); //~ ERROR tuple struct `B` is private
63+
let c = a::C(2, 3); //~ ERROR tuple struct `C` is private
6464
let d = a::D(4);
6565

66-
let a::A(()) = a; //~ ERROR: field `0` of struct `a::A` is private
67-
let a::A(_) = a;
68-
match a { a::A(()) => {} } //~ ERROR: field `0` of struct `a::A` is private
69-
match a { a::A(_) => {} }
70-
71-
let a::B(_) = b;
72-
let a::B(_b) = b; //~ ERROR: field `0` of struct `a::B` is private
73-
match b { a::B(_) => {} }
74-
match b { a::B(_b) => {} } //~ ERROR: field `0` of struct `a::B` is private
75-
match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field `0` of struct `a::B` is private
76-
77-
let a::C(_, _) = c;
78-
let a::C(_a, _) = c;
79-
let a::C(_, _b) = c; //~ ERROR: field `1` of struct `a::C` is private
80-
let a::C(_a, _b) = c; //~ ERROR: field `1` of struct `a::C` is private
81-
match c { a::C(_, _) => {} }
82-
match c { a::C(_a, _) => {} }
83-
match c { a::C(_, _b) => {} } //~ ERROR: field `1` of struct `a::C` is private
84-
match c { a::C(_a, _b) => {} } //~ ERROR: field `1` of struct `a::C` is private
66+
let a::A(()) = a; //~ ERROR tuple struct `A` is private
67+
let a::A(_) = a; //~ ERROR tuple struct `A` is private
68+
match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private
69+
match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private
70+
71+
let a::B(_) = b; //~ ERROR tuple struct `B` is private
72+
let a::B(_b) = b; //~ ERROR tuple struct `B` is private
73+
match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private
74+
match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private
75+
match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private
76+
//~^ ERROR tuple struct `B` is private
77+
78+
let a::C(_, _) = c; //~ ERROR tuple struct `C` is private
79+
let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private
80+
let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private
81+
let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
82+
match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private
83+
match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
84+
match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
85+
match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
8586

8687
let a::D(_) = d;
8788
let a::D(_d) = d;
8889
match d { a::D(_) => {} }
8990
match d { a::D(_d) => {} }
9091
match d { a::D(1) => {} a::D(_) => {} }
9192

92-
let a2 = a::A; //~ ERROR: cannot invoke tuple struct constructor
93-
let b2 = a::B; //~ ERROR: cannot invoke tuple struct constructor
94-
let c2 = a::C; //~ ERROR: cannot invoke tuple struct constructor
93+
let a2 = a::A; //~ ERROR tuple struct `A` is private
94+
let b2 = a::B; //~ ERROR tuple struct `B` is private
95+
let c2 = a::C; //~ ERROR tuple struct `C` is private
9596
let d2 = a::D;
9697
}
9798

9899
fn xcrate() {
99-
let a = other::A(()); //~ ERROR: cannot invoke tuple struct constructor
100-
let b = other::B(2); //~ ERROR: cannot invoke tuple struct constructor
101-
let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
100+
let a = other::A(()); //~ ERROR tuple struct `A` is private
101+
let b = other::B(2); //~ ERROR tuple struct `B` is private
102+
let c = other::C(2, 3); //~ ERROR tuple struct `C` is private
102103
let d = other::D(4);
103104

104-
let other::A(()) = a; //~ ERROR: field `0` of struct `other::A` is private
105-
let other::A(_) = a;
106-
match a { other::A(()) => {} }
107-
//~^ ERROR: field `0` of struct `other::A` is private
108-
match a { other::A(_) => {} }
109-
110-
let other::B(_) = b;
111-
let other::B(_b) = b; //~ ERROR: field `0` of struct `other::B` is private
112-
match b { other::B(_) => {} }
113-
match b { other::B(_b) => {} }
114-
//~^ ERROR: field `0` of struct `other::B` is private
115-
match b { other::B(1) => {} other::B(_) => {} }
116-
//~^ ERROR: field `0` of struct `other::B` is private
117-
118-
let other::C(_, _) = c;
119-
let other::C(_a, _) = c;
120-
let other::C(_, _b) = c; //~ ERROR: field `1` of struct `other::C` is private
121-
let other::C(_a, _b) = c; //~ ERROR: field `1` of struct `other::C` is private
122-
match c { other::C(_, _) => {} }
123-
match c { other::C(_a, _) => {} }
124-
match c { other::C(_, _b) => {} }
125-
//~^ ERROR: field `1` of struct `other::C` is private
126-
match c { other::C(_a, _b) => {} }
127-
//~^ ERROR: field `1` of struct `other::C` is private
105+
let other::A(()) = a; //~ ERROR tuple struct `A` is private
106+
let other::A(_) = a; //~ ERROR tuple struct `A` is private
107+
match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private
108+
match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private
109+
110+
let other::B(_) = b; //~ ERROR tuple struct `B` is private
111+
let other::B(_b) = b; //~ ERROR tuple struct `B` is private
112+
match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private
113+
match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private
114+
match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private
115+
//~^ ERROR tuple struct `B` is private
116+
117+
let other::C(_, _) = c; //~ ERROR tuple struct `C` is private
118+
let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private
119+
let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private
120+
let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
121+
match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private
122+
match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
123+
match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
124+
match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
128125

129126
let other::D(_) = d;
130127
let other::D(_d) = d;
131128
match d { other::D(_) => {} }
132129
match d { other::D(_d) => {} }
133130
match d { other::D(1) => {} other::D(_) => {} }
134131

135-
let a2 = other::A; //~ ERROR: cannot invoke tuple struct constructor
136-
let b2 = other::B; //~ ERROR: cannot invoke tuple struct constructor
137-
let c2 = other::C; //~ ERROR: cannot invoke tuple struct constructor
132+
let a2 = other::A; //~ ERROR tuple struct `A` is private
133+
let b2 = other::B; //~ ERROR tuple struct `B` is private
134+
let c2 = other::C; //~ ERROR tuple struct `C` is private
138135
let d2 = other::D;
139136
}
140137

0 commit comments

Comments
 (0)