@@ -135,7 +135,10 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
135135 ( "unsafe_no_drop_flag" , "1.0.0" , Active ) ,
136136
137137 // 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 ) ,
139142] ;
140143// (changing above list without updating src/doc/reference.md makes @cmr sad)
141144
@@ -178,8 +181,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
178181 ( "repr" , Normal ) ,
179182 ( "path" , Normal ) ,
180183 ( "abi" , Normal ) ,
181- ( "rustc_move_fragments" , Normal ) ,
182- ( "rustc_variance" , Normal ) ,
183184 ( "unsafe_destructor" , Normal ) ,
184185 ( "automatically_derived" , Normal ) ,
185186 ( "no_mangle" , Normal ) ,
@@ -202,9 +203,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
202203 "no_std is experimental" ) ) ,
203204 ( "lang" , Gated ( "lang_items" ,
204205 "language items are subject to change" ) ) ,
205- ( "rustc_on_unimplemented" , Gated ( "on_unimplemented" ,
206- "the `#[rustc_on_unimplemented]` attribute \
207- is an experimental feature") ) ,
208206 ( "linkage" , Gated ( "linkage" ,
209207 "the `linkage` attribute is experimental \
210208 and not portable across platforms") ) ,
@@ -213,6 +211,19 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
213211 currently handle destructors. There is no corresponding \
214212 `#[task_local]` mapping to the task model") ) ,
215213
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+
216227 // FIXME: #14408 whitelist docs since rustdoc looks at them
217228 ( "doc" , Whitelisted ) ,
218229
@@ -243,7 +254,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
243254 ( "must_use" , Whitelisted ) ,
244255 ( "stable" , Whitelisted ) ,
245256 ( "unstable" , Whitelisted ) ,
246- ( "rustc_error" , Whitelisted ) ,
247257
248258 // FIXME: #19470 this shouldn't be needed forever
249259 ( "old_orphan_check" , Whitelisted ) ,
@@ -584,12 +594,19 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
584594 return ;
585595 }
586596 }
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+ }
593610 }
594611
595612 fn visit_pat ( & mut self , pattern : & ast:: Pat ) {
0 commit comments