1
Fork 0

Use return_result_from_ensure_ok a bit more

This commit is contained in:
Michael Goulet 2025-04-02 03:36:04 +00:00
parent a3e6b69471
commit 444a7eb5aa
5 changed files with 8 additions and 7 deletions

View file

@ -335,7 +335,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
self.tcx.dcx().span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
}
if let Some(def_id) = def_id.as_local()
&& let Err(guar) = self.tcx.at(span).check_well_formed(hir::OwnerId { def_id })
&& let Err(guar) = self.tcx.ensure_ok().check_well_formed(hir::OwnerId { def_id })
{
self.error_emitted = Some(guar);
}

View file

@ -976,7 +976,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
tcx.par_hir_body_owners(|def_id| {
if tcx.is_coroutine(def_id.to_def_id()) {
tcx.ensure_ok().mir_coroutine_witnesses(def_id);
tcx.ensure_ok().check_coroutine_obligations(
let _ = tcx.ensure_ok().check_coroutine_obligations(
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
);
// Eagerly check the unsubstituted layout for cycles.

View file

@ -612,6 +612,7 @@ rustc_queries! {
query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
return_result_from_ensure_ok
}
/// MIR after our optimization passes have run. This is MIR that is ready
@ -1039,7 +1040,7 @@ rustc_queries! {
/// Checks well-formedness of tail calls (`become f()`).
query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
cache_on_disk_if { true }
return_result_from_ensure_ok
}
/// Returns the types assumed to be well formed while "inside" of the given item.
@ -1308,7 +1309,7 @@ rustc_queries! {
query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
cache_on_disk_if { true }
return_result_from_ensure_ok
}
/// Performs part of the privacy check and computes effective visibilities.

View file

@ -48,11 +48,11 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
/// this directly; instead use the cached version via `mir_built`.
pub fn build_mir<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
tcx.ensure_done().thir_abstract_const(def);
if let Err(e) = tcx.check_match(def) {
if let Err(e) = tcx.ensure_ok().check_match(def) {
return construct_error(tcx, def, e);
}
if let Err(err) = tcx.check_tail_calls(def) {
if let Err(err) = tcx.ensure_ok().check_tail_calls(def) {
return construct_error(tcx, def, err);
}

View file

@ -528,7 +528,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
| DefKind::Static { .. }
| DefKind::Const
| DefKind::AssocConst => {
if let Err(guar) = tcx.check_well_formed(root.expect_local()) {
if let Err(guar) = tcx.ensure_ok().check_well_formed(root.expect_local()) {
body.tainted_by_errors = Some(guar);
}
}