File tree Expand file tree Collapse file tree 5 files changed +7
-6
lines changed
compiler/rustc_attr_parsing/src/attributes Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
6161 const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
6262 Allow ( Target :: Fn ) ,
6363 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
64- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
6564 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
6665 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
6766 ] ) ;
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for ColdParser {
5757 Allow ( Target :: Fn ) ,
5858 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
5959 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
60- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
6160 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
6261 Allow ( Target :: ForeignFn ) ,
6362 Allow ( Target :: Closure ) ,
@@ -343,7 +342,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for TrackCallerParser {
343342 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
344343 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
345344 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
346- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
345+ Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) , // `#[track_caller]` is inherited from trait methods
347346 Allow ( Target :: ForeignFn ) ,
348347 Allow ( Target :: Closure ) ,
349348 Warn ( Target :: MacroDef ) ,
Original file line number Diff line number Diff line change @@ -470,7 +470,6 @@ impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
470470 Allow ( Target :: Static ) ,
471471 Allow ( Target :: Fn ) ,
472472 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
473- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
474473 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
475474 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
476475 ] ) ;
@@ -588,12 +587,12 @@ impl<S: Stage> SingleAttributeParser<S> for LinkageParser {
588587 const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
589588 Allow ( Target :: Fn ) ,
590589 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
591- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
592590 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
593591 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
594592 Allow ( Target :: Static ) ,
595593 Allow ( Target :: ForeignStatic ) ,
596594 Allow ( Target :: ForeignFn ) ,
595+ Warn ( Target :: Method ( MethodKind :: Trait { body : false } ) ) , // Not inherited
597596 ] ) ;
598597
599598 const TEMPLATE : AttributeTemplate = template ! ( NameValueStr : [
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ impl<S: Stage> AttributeParser<S> for AlignParser {
322322 Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
323323 Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
324324 Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
325- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
325+ Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) , // `#[align]` is inherited from trait methods
326326 Allow ( Target :: ForeignFn ) ,
327327 ] ) ;
328328
Original file line number Diff line number Diff line change @@ -713,6 +713,10 @@ mod link_section {
713713 //~| HELP remove the attribute
714714 trait Tr {
715715 #[ link_section = "1800" ]
716+ //~^ WARN attribute cannot be used on
717+ //~| WARN previously accepted
718+ //~| HELP can be applied to
719+ //~| HELP remove the attribute
716720 fn inside_tr_no_default ( & self ) ;
717721
718722 #[ link_section = "1800" ]
You can’t perform that action at this time.
0 commit comments