]> git.lizzy.rs Git - rust.git/commitdiff
Fix the fallout
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 8 Jan 2017 21:34:52 +0000 (00:34 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 28 Jan 2017 23:57:14 +0000 (02:57 +0300)
src/librustc_privacy/diagnostics.rs
src/libsyntax/symbol.rs
src/test/compile-fail-fulldeps/explore-issue-38412.rs
src/test/compile-fail/E0450.rs [deleted file]
src/test/compile-fail/E0451.rs
src/test/compile-fail/issue-38412.rs
src/test/compile-fail/privacy5.rs

index 66afe5835bf6fc6f3549dfc788e7feaab720f948..8506b1d75c5b97f2f6ff7c7cffdb6db3523ab7f6 100644 (file)
@@ -119,7 +119,7 @@ pub enum Foo {
 A tuple constructor was invoked while some of its fields are private. Erroneous
 code example:
 
-```compile_fail,E0450
+```compile_fail
 mod Bar {
     pub struct Foo(isize);
 }
index c2123ea5a079803a3897053afefec54656df786e..c278171aa109a81120433777fafd9a4504dedb53 100644 (file)
@@ -140,7 +140,7 @@ impl Keyword {
         $(
             #[allow(non_upper_case_globals)]
             pub const $konst: Keyword = Keyword {
-                ident: ast::Ident::with_empty_ctxt(ast::Name($index))
+                ident: ast::Ident::with_empty_ctxt(super::Symbol($index))
             };
         )*
     }
@@ -282,25 +282,24 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use ast::Name;
 
     #[test]
     fn interner_tests() {
         let mut i: Interner = Interner::new();
         // first one is zero:
-        assert_eq!(i.intern("dog"), Name(0));
+        assert_eq!(i.intern("dog"), Symbol(0));
         // re-use gets the same entry:
-        assert_eq!(i.intern ("dog"), Name(0));
+        assert_eq!(i.intern ("dog"), Symbol(0));
         // different string gets a different #:
-        assert_eq!(i.intern("cat"), Name(1));
-        assert_eq!(i.intern("cat"), Name(1));
+        assert_eq!(i.intern("cat"), Symbol(1));
+        assert_eq!(i.intern("cat"), Symbol(1));
         // dog is still at zero
-        assert_eq!(i.intern("dog"), Name(0));
+        assert_eq!(i.intern("dog"), Symbol(0));
         // gensym gets 3
-        assert_eq!(i.gensym("zebra"), Name(2));
+        assert_eq!(i.gensym("zebra"), Symbol(2));
         // gensym of same string gets new number :
-        assert_eq!(i.gensym("zebra"), Name(3));
+        assert_eq!(i.gensym("zebra"), Symbol(3));
         // gensym of *existing* string gets new number:
-        assert_eq!(i.gensym("dog"), Name(4));
+        assert_eq!(i.gensym("dog"), Symbol(4));
     }
 }
index aab92575321e34704db011cf353753b2bf4c9c2e..b9839edea2dc4e5b4e39e6423e53525341c60b61 100644 (file)
 fn main() {
     // Okay
     let Record { .. } = Record::new();
-    // Okay (for now; see RFC Issue #902)
-    let Tuple(..) = Tuple::new();
 
     // Okay
     let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
-    // Okay (for now; see RFC Issue #902)
-    let Tuple(_, _, ..) = Tuple::new(); // analogous to above
 
     let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
         Record::new();
     //~^^ ERROR use of unstable library feature 'unstable_undeclared'
 
-    let Tuple(_, _, _, ..) = Tuple::new(); // analogous to previous
-    //~^ ERROR use of unstable library feature 'unstable_undeclared'
-
     let r = Record::new();
     let t = Tuple::new();
 
diff --git a/src/test/compile-fail/E0450.rs b/src/test/compile-fail/E0450.rs
deleted file mode 100644 (file)
index 200b58a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod Bar {
-    pub struct Foo( bool, pub i32, f32, bool);
-    //~^ NOTE private field declared here
-    //~| NOTE private field declared here
-    //~| NOTE private field declared here
-}
-
-fn main() {
-    let f = Bar::Foo(false,1,0.1, true); //~ ERROR E0450
-                         //~^ NOTE cannot construct with a private field
-}
index f7b106d160dae78d1c0fdc87997a8314d639fbbf..ace96c9983e66612097228f6a949778e797cf0f0 100644 (file)
@@ -25,11 +25,6 @@ fn pat_match(foo: Bar::Foo) {
                                   //~^ NOTE field `b` is private
 }
 
-fn pat_match_tuple(foo: Bar::FooTuple) {
-    let Bar::FooTuple(a,b) = foo; //~ ERROR E0451
-                                  //~^ NOTE field `1` is private
-}
-
 fn main() {
     let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451
                                     //~^ NOTE field `b` is private
index 00305eb2bc04bf2f3e9f7a31aacc5f4cf44a645a..b4feadbacf7404cc61d1b9cc91f54224eaa19ffd 100644 (file)
@@ -10,7 +10,7 @@
 
 fn main() {
     let Box(a) = loop { };
-    //~^ ERROR field `0` of struct `std::boxed::Box` is private
+    //~^ ERROR expected tuple struct/variant, found struct `Box`
 
     // (The below is a trick to allow compiler to infer a type for
     // variable `a` without attempting to ascribe a type to the
index 9d6ae187cd381f0aa2f9d9c5257d6b0d93772475..599c1f871604406bd3f6f99470b3078d073c2603 100644 (file)
@@ -58,30 +58,31 @@ fn test() {
 }
 
 fn this_crate() {
-    let a = a::A(()); //~ ERROR: cannot invoke tuple struct constructor
-    let b = a::B(2); //~ ERROR: cannot invoke tuple struct constructor
-    let c = a::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
+    let a = a::A(()); //~ ERROR tuple struct `A` is private
+    let b = a::B(2); //~ ERROR tuple struct `B` is private
+    let c = a::C(2, 3); //~ ERROR tuple struct `C` is private
     let d = a::D(4);
 
-    let a::A(()) = a; //~ ERROR: field `0` of struct `a::A` is private
-    let a::A(_) = a;
-    match a { a::A(()) => {} } //~ ERROR: field `0` of struct `a::A` is private
-    match a { a::A(_) => {} }
-
-    let a::B(_) = b;
-    let a::B(_b) = b; //~ ERROR: field `0` of struct `a::B` is private
-    match b { a::B(_) => {} }
-    match b { a::B(_b) => {} } //~ ERROR: field `0` of struct `a::B` is private
-    match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field `0` of struct `a::B` is private
-
-    let a::C(_, _) = c;
-    let a::C(_a, _) = c;
-    let a::C(_, _b) = c; //~ ERROR: field `1` of struct `a::C` is private
-    let a::C(_a, _b) = c; //~ ERROR: field `1` of struct `a::C` is private
-    match c { a::C(_, _) => {} }
-    match c { a::C(_a, _) => {} }
-    match c { a::C(_, _b) => {} } //~ ERROR: field `1` of struct `a::C` is private
-    match c { a::C(_a, _b) => {} } //~ ERROR: field `1` of struct `a::C` is private
+    let a::A(()) = a; //~ ERROR tuple struct `A` is private
+    let a::A(_) = a; //~ ERROR tuple struct `A` is private
+    match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private
+    match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private
+
+    let a::B(_) = b; //~ ERROR tuple struct `B` is private
+    let a::B(_b) = b; //~ ERROR tuple struct `B` is private
+    match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private
+    match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private
+    match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private
+                                            //~^ ERROR tuple struct `B` is private
+
+    let a::C(_, _) = c; //~ ERROR tuple struct `C` is private
+    let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private
+    let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private
+    let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
+    match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private
+    match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
+    match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
+    match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
 
     let a::D(_) = d;
     let a::D(_d) = d;
@@ -89,42 +90,38 @@ fn this_crate() {
     match d { a::D(_d) => {} }
     match d { a::D(1) => {} a::D(_) => {} }
 
-    let a2 = a::A; //~ ERROR: cannot invoke tuple struct constructor
-    let b2 = a::B; //~ ERROR: cannot invoke tuple struct constructor
-    let c2 = a::C; //~ ERROR: cannot invoke tuple struct constructor
+    let a2 = a::A; //~ ERROR tuple struct `A` is private
+    let b2 = a::B; //~ ERROR tuple struct `B` is private
+    let c2 = a::C; //~ ERROR tuple struct `C` is private
     let d2 = a::D;
 }
 
 fn xcrate() {
-    let a = other::A(()); //~ ERROR: cannot invoke tuple struct constructor
-    let b = other::B(2); //~ ERROR: cannot invoke tuple struct constructor
-    let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
+    let a = other::A(()); //~ ERROR tuple struct `A` is private
+    let b = other::B(2); //~ ERROR tuple struct `B` is private
+    let c = other::C(2, 3); //~ ERROR tuple struct `C` is private
     let d = other::D(4);
 
-    let other::A(()) = a; //~ ERROR: field `0` of struct `other::A` is private
-    let other::A(_) = a;
-    match a { other::A(()) => {} }
-    //~^ ERROR: field `0` of struct `other::A` is private
-    match a { other::A(_) => {} }
-
-    let other::B(_) = b;
-    let other::B(_b) = b; //~ ERROR: field `0` of struct `other::B` is private
-    match b { other::B(_) => {} }
-    match b { other::B(_b) => {} }
-    //~^ ERROR: field `0` of struct `other::B` is private
-    match b { other::B(1) => {} other::B(_) => {} }
-    //~^ ERROR: field `0` of struct `other::B` is private
-
-    let other::C(_, _) = c;
-    let other::C(_a, _) = c;
-    let other::C(_, _b) = c; //~ ERROR: field `1` of struct `other::C` is private
-    let other::C(_a, _b) = c; //~ ERROR: field `1` of struct `other::C` is private
-    match c { other::C(_, _) => {} }
-    match c { other::C(_a, _) => {} }
-    match c { other::C(_, _b) => {} }
-    //~^ ERROR: field `1` of struct `other::C` is private
-    match c { other::C(_a, _b) => {} }
-    //~^ ERROR: field `1` of struct `other::C` is private
+    let other::A(()) = a; //~ ERROR tuple struct `A` is private
+    let other::A(_) = a; //~ ERROR tuple struct `A` is private
+    match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private
+    match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private
+
+    let other::B(_) = b; //~ ERROR tuple struct `B` is private
+    let other::B(_b) = b; //~ ERROR tuple struct `B` is private
+    match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private
+    match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private
+    match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private
+                                                    //~^ ERROR tuple struct `B` is private
+
+    let other::C(_, _) = c; //~ ERROR tuple struct `C` is private
+    let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private
+    let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private
+    let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
+    match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private
+    match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
+    match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
+    match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
 
     let other::D(_) = d;
     let other::D(_d) = d;
@@ -132,9 +129,9 @@ fn xcrate() {
     match d { other::D(_d) => {} }
     match d { other::D(1) => {} other::D(_) => {} }
 
-    let a2 = other::A; //~ ERROR: cannot invoke tuple struct constructor
-    let b2 = other::B; //~ ERROR: cannot invoke tuple struct constructor
-    let c2 = other::C; //~ ERROR: cannot invoke tuple struct constructor
+    let a2 = other::A; //~ ERROR tuple struct `A` is private
+    let b2 = other::B; //~ ERROR tuple struct `B` is private
+    let c2 = other::C; //~ ERROR tuple struct `C` is private
     let d2 = other::D;
 }