File tree 4 files changed +28
-11
lines changed
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(
1022
1022
1023
1023
pub fn allow_internal_unstable < ' a > (
1024
1024
sess : & ' a Session ,
1025
- attrs : & [ Attribute ] ,
1025
+ attrs : & ' a [ Attribute ] ,
1026
1026
) -> 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
+
1033
1040
Some ( list. into_iter ( ) . filter_map ( move |it| {
1034
1041
let name = it. ident ( ) . map ( |ident| ident. name ) ;
1035
1042
if name. is_none ( ) {
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ macro_rules! access_field_allow {
52
52
( $e: expr) => { $e. x }
53
53
}
54
54
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
+
55
64
#[ stable( feature = "stable" , since = "1.0.0" ) ]
56
65
#[ allow_internal_unstable( ) ]
57
66
#[ macro_export]
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ fn main() {
28
28
construct_unstable_allow ! ( 0 ) ;
29
29
|x : internal_unstable:: Foo | { call_method_allow ! ( x) } ;
30
30
|x : internal_unstable:: Bar | { access_field_allow ! ( x) } ;
31
+ |x : internal_unstable:: Bar | { access_field_allow2 ! ( x) } ; // regression test for #77088
31
32
32
33
// bad.
33
34
pass_through_allow ! ( internal_unstable:: unstable( ) ) ; //~ ERROR use of unstable
Original file line number Diff line number Diff line change 1
1
error[E0658]: use of unstable library feature 'function'
2
- --> $DIR/internal-unstable.rs:33 :25
2
+ --> $DIR/internal-unstable.rs:34 :25
3
3
|
4
4
LL | pass_through_allow!(internal_unstable::unstable());
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= help: add `#![feature(function)]` to the crate attributes to enable
8
8
9
9
error[E0658]: use of unstable library feature 'function'
10
- --> $DIR/internal-unstable.rs:35 :27
10
+ --> $DIR/internal-unstable.rs:36 :27
11
11
|
12
12
LL | pass_through_noallow!(internal_unstable::unstable());
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
14
|
15
15
= help: add `#![feature(function)]` to the crate attributes to enable
16
16
17
17
error[E0658]: use of unstable library feature 'function'
18
- --> $DIR/internal-unstable.rs:39 :22
18
+ --> $DIR/internal-unstable.rs:40 :22
19
19
|
20
20
LL | println!("{:?}", internal_unstable::unstable());
21
21
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
22
|
23
23
= help: add `#![feature(function)]` to the crate attributes to enable
24
24
25
25
error[E0658]: use of unstable library feature 'function'
26
- --> $DIR/internal-unstable.rs:41 :10
26
+ --> $DIR/internal-unstable.rs:42 :10
27
27
|
28
28
LL | bar!(internal_unstable::unstable());
29
29
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments