File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
compiler/rustc_ty_utils/src Expand file tree Collapse file tree 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>>(
4242 DefKind :: TyAlias { ..} | DefKind :: AssocTy |
4343 // Walk over the type of the item
4444 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+ }
5049 for ( pred, span) in tcx. predicates_of ( item) . instantiate_identity ( tcx) {
5150 visitor. visit ( span, pred) ?;
5251 }
You can’t perform that action at this time.
0 commit comments