]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail-fulldeps/explore-issue-38412.rs
Auto merge of #38426 - vadimcn:nobundle, r=alexcrichton
[rust.git] / src / test / compile-fail-fulldeps / explore-issue-38412.rs
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.
4 //
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.
10
11 // aux-build:pub_and_stability.rs
12
13 #![feature(staged_api)]
14 #![feature(unused_feature)]
15
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)]
21
22 extern crate pub_and_stability;
23 use pub_and_stability::{Record, Trait, Tuple};
24
25 fn main() {
26     // Okay
27     let Record { .. } = Record::new();
28
29     // Okay
30     let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
31
32     let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
33         Record::new();
34     //~^^ ERROR use of unstable library feature 'unstable_undeclared'
35
36     let r = Record::new();
37     let t = Tuple::new();
38
39     r.a_stable_pub;
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
45
46     t.0;
47     t.1;
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
52
53     r.stable_trait_method();
54     r.unstable_declared_trait_method();
55     r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
56
57     r.stable();
58     r.unstable_declared();
59     r.unstable_undeclared();              //~ ERROR use of unstable library feature
60
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
64
65     let t = Tuple::new();
66     t.stable_trait_method();
67     t.unstable_declared_trait_method();
68     t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
69
70     t.stable();
71     t.unstable_declared();
72     t.unstable_undeclared();              //~ ERROR use of unstable library feature
73
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
77
78 }