@@ -36,6 +36,16 @@ macro_rules! gate_alt {
36
36
feature_err( & $visitor. sess, $name, $span, $explain) . emit( ) ;
37
37
}
38
38
} } ;
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
+ } } ;
39
49
}
40
50
41
51
/// The case involving a multispan.
@@ -154,11 +164,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
154
164
let attr_info = attr. ident ( ) . and_then ( |ident| BUILTIN_ATTRIBUTE_MAP . get ( & ident. name ) ) ;
155
165
// Check feature gates for built-in attributes.
156
166
if let Some ( BuiltinAttribute {
157
- gate : AttributeGate :: Gated ( _ , name , descr , has_feature ) ,
167
+ gate : AttributeGate :: Gated { feature , message , check , notes , .. } ,
158
168
..
159
169
} ) = attr_info
160
170
{
161
- gate_alt ! ( self , has_feature ( self . features) , * name , attr. span, * descr ) ;
171
+ gate_alt ! ( self , check ( self . features) , * feature , attr. span, * message , * notes ) ;
162
172
}
163
173
// Check unstable flavors of the `#[doc]` attribute.
164
174
if attr. has_name ( sym:: doc) {
0 commit comments