@@ -1013,13 +1013,28 @@ pub fn allow_internal_unstable<'a>(
10131013 sess : & ' a Session ,
10141014 attrs : & ' a [ Attribute ] ,
10151015) -> Option < impl Iterator < Item = Symbol > + ' a > {
1016- let attrs = sess. filter_by_name ( attrs, sym:: allow_internal_unstable) ;
1016+ allow_unstable ( sess, attrs, sym:: allow_internal_unstable)
1017+ }
1018+
1019+ pub fn rustc_allow_const_fn_unstable < ' a > (
1020+ sess : & ' a Session ,
1021+ attrs : & ' a [ Attribute ] ,
1022+ ) -> Option < impl Iterator < Item = Symbol > + ' a > {
1023+ allow_unstable ( sess, attrs, sym:: rustc_allow_const_fn_unstable)
1024+ }
1025+
1026+ fn allow_unstable < ' a > (
1027+ sess : & ' a Session ,
1028+ attrs : & ' a [ Attribute ] ,
1029+ symbol : Symbol ,
1030+ ) -> Option < impl Iterator < Item = Symbol > + ' a > {
1031+ let attrs = sess. filter_by_name ( attrs, symbol) ;
10171032 let list = attrs
10181033 . filter_map ( move |attr| {
10191034 attr. meta_item_list ( ) . or_else ( || {
10201035 sess. diagnostic ( ) . span_err (
10211036 attr. span ,
1022- "`allow_internal_unstable ` expects a list of feature names",
1037+ & format ! ( "`{} ` expects a list of feature names", symbol . to_ident_string ( ) ) ,
10231038 ) ;
10241039 None
10251040 } )
@@ -1029,8 +1044,10 @@ pub fn allow_internal_unstable<'a>(
10291044 Some ( list. into_iter ( ) . filter_map ( move |it| {
10301045 let name = it. ident ( ) . map ( |ident| ident. name ) ;
10311046 if name. is_none ( ) {
1032- sess. diagnostic ( )
1033- . span_err ( it. span ( ) , "`allow_internal_unstable` expects feature names" ) ;
1047+ sess. diagnostic ( ) . span_err (
1048+ it. span ( ) ,
1049+ & format ! ( "`{}` expects feature names" , symbol. to_ident_string( ) ) ,
1050+ ) ;
10341051 }
10351052 name
10361053 } ) )
0 commit comments