Skip to content

Commit

Permalink
Use a ty::Error instead of patching up a type after erroring
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 10, 2024
1 parent 9273d63 commit ba27e22
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compiler/rustc_hir_analysis/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ fn infer_placeholder_type<'a>(
}

err.emit();
// diagnostic stashing loses the information of whether something is a hard error.
Ty::new_error_with_message(tcx, span, "ItemNoType is a hard error")
}
None => {
let mut diag = bad_placeholder(tcx, vec![span], kind);
Expand All @@ -623,15 +625,9 @@ fn infer_placeholder_type<'a>(
}
}

diag.emit();
Ty::new_error(tcx, diag.emit())
}
}

// Typeck doesn't expect erased regions to be returned from `type_of`.
tcx.fold_regions(ty, |r, _| match *r {
ty::ReErased => tcx.lifetimes.re_static,
_ => r,
})
}

fn check_feature_inherent_assoc_ty(tcx: TyCtxt<'_>, span: Span) {
Expand Down

0 comments on commit ba27e22

Please sign in to comment.