File tree 3 files changed +41
-0
lines changed
3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,17 @@ pub struct Foo {
22
22
pub x : u8
23
23
}
24
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
+
25
36
#[ allow_internal_unstable]
26
37
#[ macro_export]
27
38
macro_rules! call_unstable_allow {
@@ -36,6 +47,18 @@ macro_rules! construct_unstable_allow {
36
47
}
37
48
}
38
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
+
39
62
#[ allow_internal_unstable]
40
63
#[ macro_export]
41
64
macro_rules! pass_through_allow {
@@ -54,6 +77,16 @@ macro_rules! construct_unstable_noallow {
54
77
}
55
78
}
56
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
+
57
90
#[ macro_export]
58
91
macro_rules! pass_through_noallow {
59
92
( $e: expr) => { $e }
Original file line number Diff line number Diff line change 16
16
// aux-build:internal_unstable.rs
17
17
// error-pattern:use of unstable library feature 'function'
18
18
// error-pattern:use of unstable library feature 'struct_field'
19
+ // error-pattern:use of unstable library feature 'method'
20
+ // error-pattern:use of unstable library feature 'struct2_field'
19
21
20
22
#[ macro_use]
21
23
extern crate internal_unstable;
@@ -24,4 +26,8 @@ fn main() {
24
26
call_unstable_noallow ! ( ) ;
25
27
26
28
construct_unstable_noallow ! ( 0 ) ;
29
+
30
+ |x : internal_unstable:: Foo | { call_method_noallow ! ( x) } ;
31
+
32
+ |x : internal_unstable:: Bar | { access_field_noallow ! ( x) } ;
27
33
}
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ fn main() {
36
36
// ok, the instability is contained.
37
37
call_unstable_allow ! ( ) ;
38
38
construct_unstable_allow ! ( 0 ) ;
39
+ |x : internal_unstable:: Foo | { call_method_allow ! ( x) } ;
40
+ |x : internal_unstable:: Bar | { access_field_allow ! ( x) } ;
39
41
40
42
// bad.
41
43
pass_through_allow ! ( internal_unstable:: unstable( ) ) ; //~ ERROR use of unstable
You can’t perform that action at this time.
0 commit comments