summary refs log tree commit diff
path: root/src/test/auxiliary/internal_unstable.rs
blob: a4cd487eb6515afacb7a56fd1a825f4d8a6b9bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(staged_api, allow_internal_unstable)]
#![stable(feature = "stable", since = "1.0.0")]

#[unstable(feature = "function", issue = "0")]
pub fn unstable() {}


#[stable(feature = "stable", since = "1.0.0")]
pub struct Foo {
    #[unstable(feature = "struct_field", issue = "0")]
    pub x: u8
}

impl Foo {
    #[unstable(feature = "method", issue = "0")]
    pub fn method(&self) {}
}

#[stable(feature = "stable", since = "1.0.0")]
pub struct Bar {
    #[unstable(feature = "struct2_field", issue = "0")]
    pub x: u8
}

#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable]
#[macro_export]
macro_rules! call_unstable_allow {
    () => { $crate::unstable() }
}

#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable]
#[macro_export]
macro_rules! construct_unstable_allow {
    ($e: expr) => {
        $crate::Foo { x: $e }
    }
}

#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable]
#[macro_export]
macro_rules! call_method_allow {
    ($e: expr) => { $e.method() }
}

#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable]
#[macro_export]
macro_rules! access_field_allow {
    ($e: expr) => { $e.x }
}

#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable]
#[macro_export]
macro_rules! pass_through_allow {
    ($e: expr) => { $e }
}

#[stable(feature = "stable", since = "1.0.0")]
#[macro_export]
macro_rules! call_unstable_noallow {
    () => { $crate::unstable() }
}

#[stable(feature = "stable", since = "1.0.0")]
#[macro_export]
macro_rules! construct_unstable_noallow {
    ($e: expr) => {
        $crate::Foo { x: $e }
    }
}

#[stable(feature = "stable", since = "1.0.0")]
#[macro_export]
macro_rules! call_method_noallow {
    ($e: expr) => { $e.method() }
}

#[stable(feature = "stable", since = "1.0.0")]
#[macro_export]
macro_rules! access_field_noallow {
    ($e: expr) => { $e.x }
}

#[stable(feature = "stable", since = "1.0.0")]
#[macro_export]
macro_rules! pass_through_noallow {
    ($e: expr) => { $e }
}