@@ -664,6 +664,7 @@ where
664
664
{
665
665
let mut depr: Option < ( Deprecation , Span ) > = None ;
666
666
let diagnostic = & sess. parse_sess . span_diagnostic ;
667
+ let is_rustc = sess. features_untracked ( ) . staged_api ;
667
668
668
669
' outer: for attr in attrs_iter {
669
670
if !( attr. has_name ( sym:: deprecated) || attr. has_name ( sym:: rustc_deprecated) ) {
@@ -728,17 +729,31 @@ where
728
729
continue ' outer;
729
730
}
730
731
}
731
- sym:: note if attr . has_name ( sym :: deprecated ) => {
732
+ sym:: note => {
732
733
if !get ( mi, & mut note) {
733
734
continue ' outer;
734
735
}
735
736
}
737
+ // FIXME(jhpratt) remove this after a bootstrap occurs. Emitting an
738
+ // error specific to the renaming would be a good idea as well.
736
739
sym:: reason if attr. has_name ( sym:: rustc_deprecated) => {
737
740
if !get ( mi, & mut note) {
738
741
continue ' outer;
739
742
}
740
743
}
741
- sym:: suggestion if attr. has_name ( sym:: rustc_deprecated) => {
744
+ sym:: suggestion => {
745
+ if !sess. features_untracked ( ) . deprecated_suggestion {
746
+ let mut diag = sess. struct_span_err (
747
+ mi. span ,
748
+ "suggestions on deprecated items are unstable" ,
749
+ ) ;
750
+ if sess. is_nightly_build ( ) {
751
+ diag. help ( "add `#![feature(deprecated_suggestion)]` to the crate root" ) ;
752
+ }
753
+ // FIXME(jhpratt) change this to an actual tracking issue
754
+ diag. note ( "see #XXX for more details" ) . emit ( ) ;
755
+ }
756
+
742
757
if !get ( mi, & mut suggestion) {
743
758
continue ' outer;
744
759
}
@@ -752,7 +767,7 @@ where
752
767
if attr. has_name ( sym:: deprecated) {
753
768
& [ "since" , "note" ]
754
769
} else {
755
- & [ "since" , "reason " , "suggestion" ]
770
+ & [ "since" , "note " , "suggestion" ]
756
771
} ,
757
772
) ,
758
773
) ;
@@ -775,24 +790,22 @@ where
775
790
}
776
791
}
777
792
778
- if suggestion. is_some ( ) && attr. has_name ( sym:: deprecated) {
779
- unreachable ! ( "only allowed on rustc_deprecated" )
780
- }
781
-
782
- if attr. has_name ( sym:: rustc_deprecated) {
793
+ if is_rustc {
783
794
if since. is_none ( ) {
784
795
handle_errors ( & sess. parse_sess , attr. span , AttrError :: MissingSince ) ;
785
796
continue ;
786
797
}
787
798
788
799
if note. is_none ( ) {
789
- struct_span_err ! ( diagnostic, attr. span, E0543 , "missing 'reason '" ) . emit ( ) ;
800
+ struct_span_err ! ( diagnostic, attr. span, E0543 , "missing 'note '" ) . emit ( ) ;
790
801
continue ;
791
802
}
792
803
}
793
804
794
- let is_since_rustc_version = attr. has_name ( sym:: rustc_deprecated) ;
795
- depr = Some ( ( Deprecation { since, note, suggestion, is_since_rustc_version } , attr. span ) ) ;
805
+ depr = Some ( (
806
+ Deprecation { since, note, suggestion, is_since_rustc_version : is_rustc } ,
807
+ attr. span ,
808
+ ) ) ;
796
809
}
797
810
798
811
depr
0 commit comments