@@ -135,7 +135,10 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
135
135
( "unsafe_no_drop_flag" , "1.0.0" , Active ) ,
136
136
137
137
// Allows the use of custom attributes; RFC 572
138
- ( "custom_attribute" , "1.0.0" , Active )
138
+ ( "custom_attribute" , "1.0.0" , Active ) ,
139
+
140
+ // Allows the use of rustc_* attributes; RFC 572
141
+ ( "rustc_attrs" , "1.0.0" , Active ) ,
139
142
] ;
140
143
// (changing above list without updating src/doc/reference.md makes @cmr sad)
141
144
@@ -178,8 +181,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
178
181
( "repr" , Normal ) ,
179
182
( "path" , Normal ) ,
180
183
( "abi" , Normal ) ,
181
- ( "rustc_move_fragments" , Normal ) ,
182
- ( "rustc_variance" , Normal ) ,
183
184
( "unsafe_destructor" , Normal ) ,
184
185
( "automatically_derived" , Normal ) ,
185
186
( "no_mangle" , Normal ) ,
@@ -202,9 +203,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
202
203
"no_std is experimental" ) ) ,
203
204
( "lang" , Gated ( "lang_items" ,
204
205
"language items are subject to change" ) ) ,
205
- ( "rustc_on_unimplemented" , Gated ( "on_unimplemented" ,
206
- "the `#[rustc_on_unimplemented]` attribute \
207
- is an experimental feature") ) ,
208
206
( "linkage" , Gated ( "linkage" ,
209
207
"the `linkage` attribute is experimental \
210
208
and not portable across platforms") ) ,
@@ -213,6 +211,19 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
213
211
currently handle destructors. There is no corresponding \
214
212
`#[task_local]` mapping to the task model") ) ,
215
213
214
+ ( "rustc_on_unimplemented" , Gated ( "on_unimplemented" ,
215
+ "the `#[rustc_on_unimplemented]` attribute \
216
+ is an experimental feature") ) ,
217
+ ( "rustc_variance" , Gated ( "rustc_attrs" ,
218
+ "the `#[rustc_variance]` attribute \
219
+ is an experimental feature") ) ,
220
+ ( "rustc_error" , Gated ( "rustc_attrs" ,
221
+ "the `#[rustc_error]` attribute \
222
+ is an experimental feature") ) ,
223
+ ( "rustc_move_fragments" , Gated ( "rustc_attrs" ,
224
+ "the `#[rustc_move_fragments]` attribute \
225
+ is an experimental feature") ) ,
226
+
216
227
// FIXME: #14408 whitelist docs since rustdoc looks at them
217
228
( "doc" , Whitelisted ) ,
218
229
@@ -243,7 +254,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
243
254
( "must_use" , Whitelisted ) ,
244
255
( "stable" , Whitelisted ) ,
245
256
( "unstable" , Whitelisted ) ,
246
- ( "rustc_error" , Whitelisted ) ,
247
257
248
258
// FIXME: #19470 this shouldn't be needed forever
249
259
( "old_orphan_check" , Whitelisted ) ,
@@ -584,12 +594,19 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
584
594
return ;
585
595
}
586
596
}
587
- self . gate_feature ( "custom_attribute" , attr. span ,
588
- format ! ( "The attribute `{}` is currently \
589
- unknown to the the compiler and \
590
- may have meaning \
591
- added to it in the future",
592
- name) . as_slice ( ) ) ;
597
+ if name. starts_with ( "rustc_" ) {
598
+ self . gate_feature ( "rustc_attrs" , attr. span ,
599
+ "unless otherwise specified, attributes \
600
+ with the prefix `rustc_` \
601
+ are reserved for internal compiler diagnostics") ;
602
+ } else {
603
+ self . gate_feature ( "custom_attribute" , attr. span ,
604
+ format ! ( "The attribute `{}` is currently \
605
+ unknown to the the compiler and \
606
+ may have meaning \
607
+ added to it in the future",
608
+ name) . as_slice ( ) ) ;
609
+ }
593
610
}
594
611
595
612
fn visit_pat ( & mut self , pattern : & ast:: Pat ) {
0 commit comments