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();
30 let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
32 let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
34 //~^^ ERROR use of unstable library feature 'unstable_undeclared'
36 let r = Record::new();
40 r.a_unstable_declared_pub;
41 r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
42 r.b_crate; //~ ERROR is private
43 r.c_mod; //~ ERROR is private
44 r.d_priv; //~ ERROR is private
48 t.2; //~ ERROR use of unstable library feature
49 t.3; //~ ERROR is private
50 t.4; //~ ERROR is private
51 t.5; //~ ERROR is private
53 r.stable_trait_method();
54 r.unstable_declared_trait_method();
55 r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
58 r.unstable_declared();
59 r.unstable_undeclared(); //~ ERROR use of unstable library feature
61 r.pub_crate(); //~ ERROR `pub_crate` is private
62 r.pub_mod(); //~ ERROR `pub_mod` is private
63 r.private(); //~ ERROR `private` is private
66 t.stable_trait_method();
67 t.unstable_declared_trait_method();
68 t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
71 t.unstable_declared();
72 t.unstable_undeclared(); //~ ERROR use of unstable library feature
74 t.pub_crate(); //~ ERROR `pub_crate` is private
75 t.pub_mod(); //~ ERROR `pub_mod` is private
76 t.private(); //~ ERROR `private` is private