@@ -336,7 +336,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
336
336
self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Fn )
337
337
}
338
338
[ sym:: automatically_derived, ..] => {
339
- self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Impl )
339
+ self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Impl { of_trait : true } )
340
340
}
341
341
[ sym:: proc_macro, ..] => {
342
342
self . check_proc_macro ( hir_id, target, ProcMacroKind :: FunctionLike )
@@ -470,7 +470,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
470
470
attr : & Attribute ,
471
471
item : Option < ItemLike < ' _ > > ,
472
472
) {
473
- if !matches ! ( target, Target :: Impl )
473
+ if !matches ! ( target, Target :: Impl { .. } )
474
474
|| matches ! (
475
475
item,
476
476
Some ( ItemLike :: Item ( hir:: Item { kind: hir:: ItemKind :: Impl ( _impl) , .. } ) )
@@ -574,7 +574,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
574
574
Target :: Fn
575
575
| Target :: Closure
576
576
| Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent )
577
- | Target :: Impl
577
+ | Target :: Impl { .. }
578
578
| Target :: Mod => return ,
579
579
580
580
// These are "functions", but they aren't allowed because they don't
@@ -965,9 +965,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
965
965
let span = meta. span ( ) ;
966
966
if let Some ( location) = match target {
967
967
Target :: AssocTy => {
968
- let parent_def_id = self . tcx . hir_get_parent_item ( hir_id ) . def_id ;
969
- let containing_item = self . tcx . hir_expect_item ( parent_def_id ) ;
970
- if Target :: from_item ( containing_item ) == Target :: Impl {
968
+ if let DefKind :: Impl { .. } =
969
+ self . tcx . def_kind ( self . tcx . local_parent ( hir_id . owner . def_id ) )
970
+ {
971
971
Some ( "type alias in implementation block" )
972
972
} else {
973
973
None
@@ -990,7 +990,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
990
990
| Target :: Arm
991
991
| Target :: ForeignMod
992
992
| Target :: Closure
993
- | Target :: Impl
993
+ | Target :: Impl { .. }
994
994
| Target :: WherePredicate => Some ( target. name ( ) ) ,
995
995
Target :: ExternCrate
996
996
| Target :: Use
@@ -1566,7 +1566,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1566
1566
let article = match target {
1567
1567
Target :: ExternCrate
1568
1568
| Target :: Enum
1569
- | Target :: Impl
1569
+ | Target :: Impl { .. }
1570
1570
| Target :: Expression
1571
1571
| Target :: Arm
1572
1572
| Target :: AssocConst
0 commit comments