@@ -338,7 +338,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
338
338
self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Fn )
339
339
}
340
340
[ sym:: automatically_derived, ..] => {
341
- self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Impl )
341
+ self . check_generic_attr_unparsed ( hir_id, attr, target, Target :: Impl { of_trait : true } )
342
342
}
343
343
[ sym:: proc_macro, ..] => {
344
344
self . check_proc_macro ( hir_id, target, ProcMacroKind :: FunctionLike )
@@ -479,7 +479,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
479
479
attr : & Attribute ,
480
480
item : Option < ItemLike < ' _ > > ,
481
481
) {
482
- if !matches ! ( target, Target :: Impl )
482
+ if !matches ! ( target, Target :: Impl { .. } )
483
483
|| matches ! (
484
484
item,
485
485
Some ( ItemLike :: Item ( hir:: Item { kind: hir:: ItemKind :: Impl ( _impl) , .. } ) )
@@ -583,7 +583,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
583
583
Target :: Fn
584
584
| Target :: Closure
585
585
| Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent )
586
- | Target :: Impl
586
+ | Target :: Impl { .. }
587
587
| Target :: Mod => return ,
588
588
589
589
// These are "functions", but they aren't allowed because they don't
@@ -974,9 +974,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
974
974
let span = meta. span ( ) ;
975
975
if let Some ( location) = match target {
976
976
Target :: AssocTy => {
977
- let parent_def_id = self . tcx . hir_get_parent_item ( hir_id ) . def_id ;
978
- let containing_item = self . tcx . hir_expect_item ( parent_def_id ) ;
979
- if Target :: from_item ( containing_item ) == Target :: Impl {
977
+ if let DefKind :: Impl { .. } =
978
+ self . tcx . def_kind ( self . tcx . local_parent ( hir_id . owner . def_id ) )
979
+ {
980
980
Some ( "type alias in implementation block" )
981
981
} else {
982
982
None
@@ -999,7 +999,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
999
999
| Target :: Arm
1000
1000
| Target :: ForeignMod
1001
1001
| Target :: Closure
1002
- | Target :: Impl
1002
+ | Target :: Impl { .. }
1003
1003
| Target :: WherePredicate => Some ( target. name ( ) ) ,
1004
1004
Target :: ExternCrate
1005
1005
| Target :: Use
@@ -1575,7 +1575,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1575
1575
let article = match target {
1576
1576
Target :: ExternCrate
1577
1577
| Target :: Enum
1578
- | Target :: Impl
1578
+ | Target :: Impl { .. }
1579
1579
| Target :: Expression
1580
1580
| Target :: Arm
1581
1581
| Target :: AssocConst
0 commit comments