]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | // aux-build:internal_unstable.rs |
2 | ||
3 | #![feature(allow_internal_unstable)] | |
5869c6ff | 4 | #[allow(dead_code)] |
c34b1796 AL |
5 | |
6 | #[macro_use] | |
7 | extern crate internal_unstable; | |
8 | ||
5869c6ff XL |
9 | struct Baz { |
10 | #[allow_internal_unstable] | |
5869c6ff XL |
11 | baz: u8, |
12 | } | |
13 | ||
c34b1796 AL |
14 | macro_rules! foo { |
15 | ($e: expr, $f: expr) => {{ | |
16 | $e; | |
17 | $f; | |
18 | internal_unstable::unstable(); //~ ERROR use of unstable | |
19 | }} | |
20 | } | |
21 | ||
9fa01778 | 22 | #[allow_internal_unstable(function)] |
c34b1796 AL |
23 | macro_rules! bar { |
24 | ($e: expr) => {{ | |
25 | foo!($e, | |
26 | internal_unstable::unstable()); | |
27 | internal_unstable::unstable(); | |
28 | }} | |
29 | } | |
30 | ||
31 | fn main() { | |
32 | // ok, the instability is contained. | |
33 | call_unstable_allow!(); | |
34 | construct_unstable_allow!(0); | |
9346a6ac AL |
35 | |x: internal_unstable::Foo| { call_method_allow!(x) }; |
36 | |x: internal_unstable::Bar| { access_field_allow!(x) }; | |
1b1a35ee | 37 | |x: internal_unstable::Bar| { access_field_allow2!(x) }; // regression test for #77088 |
c34b1796 AL |
38 | |
39 | // bad. | |
40 | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable | |
41 | ||
42 | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable | |
43 | ||
44 | ||
45 | ||
46 | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable | |
47 | ||
48 | bar!(internal_unstable::unstable()); //~ ERROR use of unstable | |
5869c6ff XL |
49 | |
50 | match true { | |
51 | #[allow_internal_unstable] | |
5869c6ff XL |
52 | _ => {} |
53 | } | |
c34b1796 | 54 | } |