Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use a ty::Error instead of patching up a type after erroring
  • Loading branch information
oli-obk committed Jan 10, 2024
commit ba27e22f671f6b2a56519e61a75fe070b0e96bf9
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