]> git.proxmox.com Git - rustc.git/blob - src/test/auxiliary/internal_unstable.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / test / auxiliary / 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 #![feature(staged_api, allow_internal_unstable)]
12 #![staged_api]
13 #![stable(feature = "stable", since = "1.0.0")]
14
15 #[unstable(feature = "function")]
16 pub fn unstable() {}
17
18
19 #[stable(feature = "stable", since = "1.0.0")]
20 pub struct Foo {
21 #[unstable(feature = "struct_field")]
22 pub x: u8
23 }
24
25 impl Foo {
26 #[unstable(feature = "method")]
27 pub fn method(&self) {}
28 }
29
30 #[stable(feature = "stable", since = "1.0.0")]
31 pub struct Bar {
32 #[unstable(feature = "struct2_field")]
33 pub x: u8
34 }
35
36 #[allow_internal_unstable]
37 #[macro_export]
38 macro_rules! call_unstable_allow {
39 () => { $crate::unstable() }
40 }
41
42 #[allow_internal_unstable]
43 #[macro_export]
44 macro_rules! construct_unstable_allow {
45 ($e: expr) => {
46 $crate::Foo { x: $e }
47 }
48 }
49
50 #[allow_internal_unstable]
51 #[macro_export]
52 macro_rules! call_method_allow {
53 ($e: expr) => { $e.method() }
54 }
55
56 #[allow_internal_unstable]
57 #[macro_export]
58 macro_rules! access_field_allow {
59 ($e: expr) => { $e.x }
60 }
61
62 #[allow_internal_unstable]
63 #[macro_export]
64 macro_rules! pass_through_allow {
65 ($e: expr) => { $e }
66 }
67
68 #[macro_export]
69 macro_rules! call_unstable_noallow {
70 () => { $crate::unstable() }
71 }
72
73 #[macro_export]
74 macro_rules! construct_unstable_noallow {
75 ($e: expr) => {
76 $crate::Foo { x: $e }
77 }
78 }
79
80 #[macro_export]
81 macro_rules! call_method_noallow {
82 ($e: expr) => { $e.method() }
83 }
84
85 #[macro_export]
86 macro_rules! access_field_noallow {
87 ($e: expr) => { $e.x }
88 }
89
90 #[macro_export]
91 macro_rules! pass_through_noallow {
92 ($e: expr) => { $e }
93 }