@@ -36,6 +36,16 @@ macro_rules! gate_alt {
3636 feature_err( & $visitor. sess, $name, $span, $explain) . emit( ) ;
3737 }
3838 } } ;
39+ ( $visitor: expr, $has_feature: expr, $name: expr, $span: expr, $explain: expr, $notes: expr) => { {
40+ if !$has_feature && !$span. allows_unstable( $name) {
41+ #[ allow( rustc:: untranslatable_diagnostic) ] // FIXME: make this translatable
42+ let mut diag = feature_err( & $visitor. sess, $name, $span, $explain) ;
43+ for note in $notes {
44+ diag. note( * note) ;
45+ }
46+ diag. emit( ) ;
47+ }
48+ } } ;
3949}
4050
4151/// The case involving a multispan.
@@ -154,11 +164,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
154164 let attr_info = attr. ident ( ) . and_then ( |ident| BUILTIN_ATTRIBUTE_MAP . get ( & ident. name ) ) ;
155165 // Check feature gates for built-in attributes.
156166 if let Some ( BuiltinAttribute {
157- gate : AttributeGate :: Gated ( _ , name , descr , has_feature ) ,
167+ gate : AttributeGate :: Gated { feature , message , check , notes , .. } ,
158168 ..
159169 } ) = attr_info
160170 {
161- gate_alt ! ( self , has_feature ( self . features) , * name , attr. span, * descr ) ;
171+ gate_alt ! ( self , check ( self . features) , * feature , attr. span, * message , * notes ) ;
162172 }
163173 // Check unstable flavors of the `#[doc]` attribute.
164174 if attr. has_name ( sym:: doc) {
0 commit comments