]> git.proxmox.com Git - rustc.git/blame - src/test/ui/internal/internal-unstable.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / internal / internal-unstable.rs
CommitLineData
c34b1796
AL
1// aux-build:internal_unstable.rs
2
3#![feature(allow_internal_unstable)]
4
5#[macro_use]
6extern crate internal_unstable;
7
8macro_rules! foo {
9 ($e: expr, $f: expr) => {{
10 $e;
11 $f;
12 internal_unstable::unstable(); //~ ERROR use of unstable
13 }}
14}
15
9fa01778 16#[allow_internal_unstable(function)]
c34b1796
AL
17macro_rules! bar {
18 ($e: expr) => {{
19 foo!($e,
20 internal_unstable::unstable());
21 internal_unstable::unstable();
22 }}
23}
24
25fn main() {
26 // ok, the instability is contained.
27 call_unstable_allow!();
28 construct_unstable_allow!(0);
9346a6ac
AL
29 |x: internal_unstable::Foo| { call_method_allow!(x) };
30 |x: internal_unstable::Bar| { access_field_allow!(x) };
1b1a35ee 31 |x: internal_unstable::Bar| { access_field_allow2!(x) }; // regression test for #77088
c34b1796
AL
32
33 // bad.
34 pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable
35
36 pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable
37
38
39
40 println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable
41
42 bar!(internal_unstable::unstable()); //~ ERROR use of unstable
43}