File tree Expand file tree Collapse file tree 4 files changed +28
-11
lines changed Expand file tree Collapse file tree 4 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -1022,14 +1022,21 @@ pub fn find_transparency(
10221022
10231023pub fn allow_internal_unstable < ' a > (
10241024 sess : & ' a Session ,
1025- attrs : & [ Attribute ] ,
1025+ attrs : & ' a [ Attribute ] ,
10261026) -> Option < impl Iterator < Item = Symbol > + ' a > {
1027- let attr = sess. find_by_name ( attrs, sym:: allow_internal_unstable) ?;
1028- let list = attr. meta_item_list ( ) . or_else ( || {
1029- sess. diagnostic ( )
1030- . span_err ( attr. span , "allow_internal_unstable expects list of feature names" ) ;
1031- None
1032- } ) ?;
1027+ let attrs = sess. filter_by_name ( attrs, sym:: allow_internal_unstable) ;
1028+ let list = attrs
1029+ . filter_map ( move |attr| {
1030+ attr. meta_item_list ( ) . or_else ( || {
1031+ sess. diagnostic ( ) . span_err (
1032+ attr. span ,
1033+ "`allow_internal_unstable` expects a list of feature names" ,
1034+ ) ;
1035+ None
1036+ } )
1037+ } )
1038+ . flatten ( ) ;
1039+
10331040 Some ( list. into_iter ( ) . filter_map ( move |it| {
10341041 let name = it. ident ( ) . map ( |ident| ident. name ) ;
10351042 if name. is_none ( ) {
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ macro_rules! access_field_allow {
5252 ( $e: expr) => { $e. x }
5353}
5454
55+ // regression test for #77088
56+ #[ stable( feature = "stable" , since = "1.0.0" ) ]
57+ #[ allow_internal_unstable( struct_field) ]
58+ #[ allow_internal_unstable( struct2_field) ]
59+ #[ macro_export]
60+ macro_rules! access_field_allow2 {
61+ ( $e: expr) => { $e. x }
62+ }
63+
5564#[ stable( feature = "stable" , since = "1.0.0" ) ]
5665#[ allow_internal_unstable( ) ]
5766#[ macro_export]
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ fn main() {
2828 construct_unstable_allow ! ( 0 ) ;
2929 |x : internal_unstable:: Foo | { call_method_allow ! ( x) } ;
3030 |x : internal_unstable:: Bar | { access_field_allow ! ( x) } ;
31+ |x : internal_unstable:: Bar | { access_field_allow2 ! ( x) } ; // regression test for #77088
3132
3233 // bad.
3334 pass_through_allow ! ( internal_unstable:: unstable( ) ) ; //~ ERROR use of unstable
Original file line number Diff line number Diff line change 11error[E0658]: use of unstable library feature 'function'
2- --> $DIR/internal-unstable.rs:33 :25
2+ --> $DIR/internal-unstable.rs:34 :25
33 |
44LL | pass_through_allow!(internal_unstable::unstable());
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = help: add `#![feature(function)]` to the crate attributes to enable
88
99error[E0658]: use of unstable library feature 'function'
10- --> $DIR/internal-unstable.rs:35 :27
10+ --> $DIR/internal-unstable.rs:36 :27
1111 |
1212LL | pass_through_noallow!(internal_unstable::unstable());
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414 |
1515 = help: add `#![feature(function)]` to the crate attributes to enable
1616
1717error[E0658]: use of unstable library feature 'function'
18- --> $DIR/internal-unstable.rs:39 :22
18+ --> $DIR/internal-unstable.rs:40 :22
1919 |
2020LL | println!("{:?}", internal_unstable::unstable());
2121 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2222 |
2323 = help: add `#![feature(function)]` to the crate attributes to enable
2424
2525error[E0658]: use of unstable library feature 'function'
26- --> $DIR/internal-unstable.rs:41 :10
26+ --> $DIR/internal-unstable.rs:42 :10
2727 |
2828LL | bar!(internal_unstable::unstable());
2929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments