@@ -161,7 +161,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
161161 sym:: automatically_derived,
162162 * attr_span,
163163 target,
164- Target :: Impl ,
164+ Target :: Impl { of_trait : true } ,
165165 ) ,
166166 Attribute :: Parsed (
167167 AttributeKind :: Stability { span, .. }
@@ -492,7 +492,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
492492 attr : & Attribute ,
493493 item : Option < ItemLike < ' _ > > ,
494494 ) {
495- if !matches ! ( target, Target :: Impl )
495+ if !matches ! ( target, Target :: Impl { .. } )
496496 || matches ! (
497497 item,
498498 Some ( ItemLike :: Item ( hir:: Item { kind: hir:: ItemKind :: Impl ( _impl) , .. } ) )
@@ -596,7 +596,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
596596 Target :: Fn
597597 | Target :: Closure
598598 | Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent )
599- | Target :: Impl
599+ | Target :: Impl { .. }
600600 | Target :: Mod => return ,
601601
602602 // These are "functions", but they aren't allowed because they don't
@@ -985,9 +985,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
985985 let span = meta. span ( ) ;
986986 if let Some ( location) = match target {
987987 Target :: AssocTy => {
988- let parent_def_id = self . tcx . hir_get_parent_item ( hir_id ) . def_id ;
989- let containing_item = self . tcx . hir_expect_item ( parent_def_id ) ;
990- if Target :: from_item ( containing_item ) == Target :: Impl {
988+ if let DefKind :: Impl { .. } =
989+ self . tcx . def_kind ( self . tcx . local_parent ( hir_id . owner . def_id ) )
990+ {
991991 Some ( "type alias in implementation block" )
992992 } else {
993993 None
@@ -1010,7 +1010,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
10101010 | Target :: Arm
10111011 | Target :: ForeignMod
10121012 | Target :: Closure
1013- | Target :: Impl
1013+ | Target :: Impl { .. }
10141014 | Target :: WherePredicate => Some ( target. name ( ) ) ,
10151015 Target :: ExternCrate
10161016 | Target :: Use
@@ -1588,7 +1588,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
15881588 let article = match target {
15891589 Target :: ExternCrate
15901590 | Target :: Enum
1591- | Target :: Impl
1591+ | Target :: Impl { .. }
15921592 | Target :: Expression
15931593 | Target :: Arm
15941594 | Target :: AssocConst
@@ -2272,7 +2272,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
22722272 match target {
22732273 // FIXME(staged_api): There's no reason we can't support more targets here. We're just
22742274 // being conservative to begin with.
2275- Target :: Fn | Target :: Impl => { }
2275+ Target :: Fn | Target :: Impl { .. } => { }
22762276 Target :: ExternCrate
22772277 | Target :: Use
22782278 | Target :: Static
0 commit comments