File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,17 @@ pub struct Foo {
2222 pub x : u8
2323}
2424
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+
2536#[ allow_internal_unstable]
2637#[ macro_export]
2738macro_rules! call_unstable_allow {
@@ -36,6 +47,18 @@ macro_rules! construct_unstable_allow {
3647 }
3748}
3849
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+
3962#[ allow_internal_unstable]
4063#[ macro_export]
4164macro_rules! pass_through_allow {
@@ -54,6 +77,16 @@ macro_rules! construct_unstable_noallow {
5477 }
5578}
5679
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+
5790#[ macro_export]
5891macro_rules! pass_through_noallow {
5992 ( $e: expr) => { $e }
Original file line number Diff line number Diff line change 1616// aux-build:internal_unstable.rs
1717// error-pattern:use of unstable library feature 'function'
1818// 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'
1921
2022#[ macro_use]
2123extern crate internal_unstable;
@@ -24,4 +26,8 @@ fn main() {
2426 call_unstable_noallow ! ( ) ;
2527
2628 construct_unstable_noallow ! ( 0 ) ;
29+
30+ |x : internal_unstable:: Foo | { call_method_noallow ! ( x) } ;
31+
32+ |x : internal_unstable:: Bar | { access_field_noallow ! ( x) } ;
2733}
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ fn main() {
3636 // ok, the instability is contained.
3737 call_unstable_allow ! ( ) ;
3838 construct_unstable_allow ! ( 0 ) ;
39+ |x : internal_unstable:: Foo | { call_method_allow ! ( x) } ;
40+ |x : internal_unstable:: Bar | { access_field_allow ! ( x) } ;
3941
4042 // bad.
4143 pass_through_allow ! ( internal_unstable:: unstable( ) ) ; //~ ERROR use of unstable
You can’t perform that action at this time.
0 commit comments