1 // aux-build:pub-and-stability.rs
3 #![feature(unused_feature)]
5 // A big point of this test is that we *declare* `unstable_declared`,
6 // but do *not* declare `unstable_undeclared`. This way we can check
7 // that the compiler is letting in uses of declared feature-gated
8 // stuff but still rejecting uses of undeclared feature-gated stuff.
9 #![feature(unstable_declared)]
11 extern crate pub_and_stability;
12 use pub_and_stability::{Record, Trait, Tuple};
16 let Record { .. } = Record::new();
19 let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
21 let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
23 //~^^ ERROR use of unstable library feature 'unstable_undeclared'
25 let r = Record::new();
29 r.a_unstable_declared_pub;
30 r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
31 r.b_crate; //~ ERROR is private
32 r.c_mod; //~ ERROR is private
33 r.d_priv; //~ ERROR is private
37 t.2; //~ ERROR use of unstable library feature
38 t.3; //~ ERROR is private
39 t.4; //~ ERROR is private
40 t.5; //~ ERROR is private
42 r.stable_trait_method();
43 r.unstable_declared_trait_method();
44 r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
47 r.unstable_declared();
48 r.unstable_undeclared(); //~ ERROR use of unstable library feature
50 r.pub_crate(); //~ ERROR `pub_crate` is private
51 r.pub_mod(); //~ ERROR `pub_mod` is private
52 r.private(); //~ ERROR `private` is private
55 t.stable_trait_method();
56 t.unstable_declared_trait_method();
57 t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
60 t.unstable_declared();
61 t.unstable_undeclared(); //~ ERROR use of unstable library feature
63 t.pub_crate(); //~ ERROR `pub_crate` is private
64 t.pub_mod(); //~ ERROR `pub_mod` is private
65 t.private(); //~ ERROR `private` is private