@@ -161,7 +161,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
161
161
sym:: automatically_derived,
162
162
* attr_span,
163
163
target,
164
- Target :: Impl ,
164
+ Target :: Impl { of_trait : true } ,
165
165
) ,
166
166
Attribute :: Parsed (
167
167
AttributeKind :: Stability { span, .. }
@@ -492,7 +492,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
492
492
attr : & Attribute ,
493
493
item : Option < ItemLike < ' _ > > ,
494
494
) {
495
- if !matches ! ( target, Target :: Impl )
495
+ if !matches ! ( target, Target :: Impl { .. } )
496
496
|| matches ! (
497
497
item,
498
498
Some ( ItemLike :: Item ( hir:: Item { kind: hir:: ItemKind :: Impl ( _impl) , .. } ) )
@@ -596,7 +596,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
596
596
Target :: Fn
597
597
| Target :: Closure
598
598
| Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent )
599
- | Target :: Impl
599
+ | Target :: Impl { .. }
600
600
| Target :: Mod => return ,
601
601
602
602
// These are "functions", but they aren't allowed because they don't
@@ -985,9 +985,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
985
985
let span = meta. span ( ) ;
986
986
if let Some ( location) = match target {
987
987
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
+ {
991
991
Some ( "type alias in implementation block" )
992
992
} else {
993
993
None
@@ -1010,7 +1010,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1010
1010
| Target :: Arm
1011
1011
| Target :: ForeignMod
1012
1012
| Target :: Closure
1013
- | Target :: Impl
1013
+ | Target :: Impl { .. }
1014
1014
| Target :: WherePredicate => Some ( target. name ( ) ) ,
1015
1015
Target :: ExternCrate
1016
1016
| Target :: Use
@@ -1588,7 +1588,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1588
1588
let article = match target {
1589
1589
Target :: ExternCrate
1590
1590
| Target :: Enum
1591
- | Target :: Impl
1591
+ | Target :: Impl { .. }
1592
1592
| Target :: Expression
1593
1593
| Target :: Arm
1594
1594
| Target :: AssocConst
@@ -2272,7 +2272,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2272
2272
match target {
2273
2273
// FIXME(staged_api): There's no reason we can't support more targets here. We're just
2274
2274
// being conservative to begin with.
2275
- Target :: Fn | Target :: Impl => { }
2275
+ Target :: Fn | Target :: Impl { .. } => { }
2276
2276
Target :: ExternCrate
2277
2277
| Target :: Use
2278
2278
| Target :: Static
0 commit comments