@@ -377,17 +377,28 @@ pub enum AttributeGate {
377
377
Ungated ,
378
378
}
379
379
380
- #[ derive( Copy , Clone , PartialEq , Eq ) ]
380
+ impl AttributeGate {
381
+ fn is_deprecated ( & self ) -> bool {
382
+ match * self {
383
+ Gated ( Stability :: Deprecated ( _) , ..) => true ,
384
+ _ => false ,
385
+ }
386
+ }
387
+ }
388
+
389
+ #[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
381
390
pub enum Stability {
382
391
Unstable ,
383
- Deprecated ,
392
+ // Argument is tracking issue link.
393
+ Deprecated ( & ' static str ) ,
384
394
}
385
395
386
396
// fn() is not Debug
387
397
impl :: std:: fmt:: Debug for AttributeGate {
388
398
fn fmt ( & self , fmt : & mut :: std:: fmt:: Formatter ) -> :: std:: fmt:: Result {
389
399
match * self {
390
- Gated ( _, ref name, ref expl, _) => write ! ( fmt, "Gated({}, {})" , name, expl) ,
400
+ Gated ( ref stab, ref name, ref expl, _) =>
401
+ write ! ( fmt, "Gated({:?}, {}, {})" , stab, name, expl) ,
391
402
Ungated => write ! ( fmt, "Ungated" )
392
403
}
393
404
}
@@ -402,6 +413,10 @@ macro_rules! cfg_fn {
402
413
} }
403
414
}
404
415
416
+ pub fn deprecated_attributes ( ) -> Vec < & ' static ( & ' static str , AttributeType , AttributeGate ) > {
417
+ KNOWN_ATTRIBUTES . iter ( ) . filter ( |a| a. 2 . is_deprecated ( ) ) . collect ( )
418
+ }
419
+
405
420
// Attributes that have a special meaning to rustc or rustdoc
406
421
pub const KNOWN_ATTRIBUTES : & ' static [ ( & ' static str , AttributeType , AttributeGate ) ] = & [
407
422
// Normal attributes
@@ -643,11 +658,11 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
643
658
( "link_section" , Whitelisted , Ungated ) ,
644
659
( "no_builtins" , Whitelisted , Ungated ) ,
645
660
( "no_mangle" , Whitelisted , Ungated ) ,
646
- ( "no_debug" , Whitelisted , Gated ( Stability :: Deprecated ,
647
- "no_debug" ,
648
- "the `#[ no_debug]` attribute \
649
- is an experimental feature",
650
- cfg_fn ! ( no_debug) ) ) ,
661
+ ( "no_debug" , Whitelisted , Gated (
662
+ Stability :: Deprecated ( "https://github.com/rust-lang/rust/issues/29721" ) ,
663
+ " no_debug" ,
664
+ "the `#[no_debug]` attribute is an experimental feature",
665
+ cfg_fn ! ( no_debug) ) ) ,
651
666
( "omit_gdb_pretty_printer_section" , Whitelisted , Gated ( Stability :: Unstable ,
652
667
"omit_gdb_pretty_printer_section" ,
653
668
"the `#[omit_gdb_pretty_printer_section]` \
0 commit comments