]> git.lizzy.rs Git - rust.git/blob - src/test/ui/internal/internal-unstable.rs
Rollup merge of #58306 - GuillaumeGomez:crate-browser-history, r=QuietMisdreavus
[rust.git] / src / test / ui / internal / internal-unstable.rs
1 // aux-build:internal_unstable.rs
2
3 #![feature(allow_internal_unstable)]
4
5 #[macro_use]
6 extern crate internal_unstable;
7
8 macro_rules! foo {
9     ($e: expr, $f: expr) => {{
10         $e;
11         $f;
12         internal_unstable::unstable(); //~ ERROR use of unstable
13     }}
14 }
15
16 #[allow_internal_unstable(function)]
17 macro_rules! bar {
18     ($e: expr) => {{
19         foo!($e,
20              internal_unstable::unstable());
21         internal_unstable::unstable();
22     }}
23 }
24
25 fn main() {
26     // ok, the instability is contained.
27     call_unstable_allow!();
28     construct_unstable_allow!(0);
29     |x: internal_unstable::Foo| { call_method_allow!(x) };
30     |x: internal_unstable::Bar| { access_field_allow!(x) };
31
32     // bad.
33     pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable
34
35     pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable
36
37
38
39     println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable
40
41     bar!(internal_unstable::unstable()); //~ ERROR use of unstable
42 }