File tree 1 file changed +4
-5
lines changed
compiler/rustc_ty_utils/src
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,10 @@ pub(crate) fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
42
42
DefKind :: TyAlias { ..} | DefKind :: AssocTy |
43
43
// Walk over the type of the item
44
44
DefKind :: Static ( _) | DefKind :: Const | DefKind :: AssocConst | DefKind :: AnonConst => {
45
- let span = match tcx. hir_node_by_def_id ( item) . ty ( ) {
46
- Some ( ty) => ty. span ,
47
- _ => tcx. def_span ( item) ,
48
- } ;
49
- visitor. visit ( span, tcx. type_of ( item) . instantiate_identity ( ) ) ;
45
+ if let Some ( ty) = tcx. hir_node_by_def_id ( item) . ty ( ) {
46
+ // Associated types in traits don't necessarily have a type that we can visit
47
+ visitor. visit ( ty. span , tcx. type_of ( item) . instantiate_identity ( ) ) ?;
48
+ }
50
49
for ( pred, span) in tcx. predicates_of ( item) . instantiate_identity ( tcx) {
51
50
visitor. visit ( span, pred) ?;
52
51
}
You can’t perform that action at this time.
0 commit comments