]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/internal-unstable.rs
Imported Upstream version 1.0.0~beta
[rustc.git] / src / test / compile-fail / internal-unstable.rs
1 // Copyright 2015 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:internal_unstable.rs
12
13 #![feature(allow_internal_unstable)]
14
15 #[macro_use]
16 extern crate internal_unstable;
17
18 macro_rules! foo {
19 ($e: expr, $f: expr) => {{
20 $e;
21 $f;
22 internal_unstable::unstable(); //~ ERROR use of unstable
23 }}
24 }
25
26 #[allow_internal_unstable]
27 macro_rules! bar {
28 ($e: expr) => {{
29 foo!($e,
30 internal_unstable::unstable());
31 internal_unstable::unstable();
32 }}
33 }
34
35 fn main() {
36 // ok, the instability is contained.
37 call_unstable_allow!();
38 construct_unstable_allow!(0);
39
40 // bad.
41 pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable
42
43 pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable
44
45
46
47 println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable
48
49 bar!(internal_unstable::unstable()); //~ ERROR use of unstable
50 }