@@ -664,6 +664,7 @@ where
664664{
665665 let mut depr: Option < ( Deprecation , Span ) > = None ;
666666 let diagnostic = & sess. parse_sess . span_diagnostic ;
667+ let is_rustc = sess. features_untracked ( ) . staged_api ;
667668
668669 ' outer: for attr in attrs_iter {
669670 if !( attr. has_name ( sym:: deprecated) || attr. has_name ( sym:: rustc_deprecated) ) {
@@ -728,17 +729,31 @@ where
728729 continue ' outer;
729730 }
730731 }
731- sym:: note if attr . has_name ( sym :: deprecated ) => {
732+ sym:: note => {
732733 if !get ( mi, & mut note) {
733734 continue ' outer;
734735 }
735736 }
737+ // FIXME(jhpratt) remove this after a bootstrap occurs. Emitting an
738+ // error specific to the renaming would be a good idea as well.
736739 sym:: reason if attr. has_name ( sym:: rustc_deprecated) => {
737740 if !get ( mi, & mut note) {
738741 continue ' outer;
739742 }
740743 }
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+
742757 if !get ( mi, & mut suggestion) {
743758 continue ' outer;
744759 }
@@ -752,7 +767,7 @@ where
752767 if attr. has_name ( sym:: deprecated) {
753768 & [ "since" , "note" ]
754769 } else {
755- & [ "since" , "reason " , "suggestion" ]
770+ & [ "since" , "note " , "suggestion" ]
756771 } ,
757772 ) ,
758773 ) ;
@@ -775,24 +790,22 @@ where
775790 }
776791 }
777792
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 {
783794 if since. is_none ( ) {
784795 handle_errors ( & sess. parse_sess , attr. span , AttrError :: MissingSince ) ;
785796 continue ;
786797 }
787798
788799 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 ( ) ;
790801 continue ;
791802 }
792803 }
793804
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+ ) ) ;
796809 }
797810
798811 depr
0 commit comments