1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // aux-build:pub_and_stability.rs
13 #![feature(staged_api)]
14 #![feature(unused_feature)]
16 // A big point of this test is that we *declare* `unstable_declared`,
17 // but do *not* declare `unstable_undeclared`. This way we can check
18 // that the compiler is letting in uses of declared feature-gated
19 // stuff but still rejecting uses of undeclared feature-gated stuff.
20 #![feature(unstable_declared)]
22 extern crate pub_and_stability;
23 use pub_and_stability::{Record, Trait, Tuple};
27 let Record { .. } = Record::new();
28 // Okay (for now; see RFC Issue #902)
29 let Tuple(..) = Tuple::new();
32 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
36 let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
38 //~^^ ERROR use of unstable library feature 'unstable_undeclared'
40 let Tuple(_, _, _, ..) = Tuple::new(); // analogous to previous
41 //~^ ERROR use of unstable library feature 'unstable_undeclared'
43 let r = Record::new();
47 r.a_unstable_declared_pub;
48 r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
49 r.b_crate; //~ ERROR is private
50 r.c_mod; //~ ERROR is private
51 r.d_priv; //~ ERROR is private
55 t.2; //~ ERROR use of unstable library feature
56 t.3; //~ ERROR is private
57 t.4; //~ ERROR is private
58 t.5; //~ ERROR is private
60 r.stable_trait_method();
61 r.unstable_declared_trait_method();
62 r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
65 r.unstable_declared();
66 r.unstable_undeclared(); //~ ERROR use of unstable library feature
68 r.pub_crate(); //~ ERROR `pub_crate` is private
69 r.pub_mod(); //~ ERROR `pub_mod` is private
70 r.private(); //~ ERROR `private` is private
73 t.stable_trait_method();
74 t.unstable_declared_trait_method();
75 t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
78 t.unstable_declared();
79 t.unstable_undeclared(); //~ ERROR use of unstable library feature
81 t.pub_crate(); //~ ERROR `pub_crate` is private
82 t.pub_mod(); //~ ERROR `pub_mod` is private
83 t.private(); //~ ERROR `private` is private