]> git.proxmox.com Git - rustc.git/blob - src/test/ui/explore-issue-38412.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / explore-issue-38412.rs
1 // aux-build:pub-and-stability.rs
2
3 #![feature(unused_feature)]
4
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)]
10
11 extern crate pub_and_stability;
12 use pub_and_stability::{Record, Trait, Tuple};
13
14 fn main() {
15 // Okay
16 let Record { .. } = Record::new();
17
18 // Okay
19 let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
20
21 let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
22 Record::new();
23 //~^^ ERROR use of unstable library feature 'unstable_undeclared'
24
25 let r = Record::new();
26 let t = Tuple::new();
27
28 r.a_stable_pub;
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
34
35 t.0;
36 t.1;
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
41
42 r.stable_trait_method();
43 r.unstable_declared_trait_method();
44 r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
45
46 r.stable();
47 r.unstable_declared();
48 r.unstable_undeclared(); //~ ERROR use of unstable library feature
49
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
53
54 let t = Tuple::new();
55 t.stable_trait_method();
56 t.unstable_declared_trait_method();
57 t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
58
59 t.stable();
60 t.unstable_declared();
61 t.unstable_undeclared(); //~ ERROR use of unstable library feature
62
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
66 }