Skip to content

Commit 9a0c0a9

Browse files
Use return_result_from_ensure_ok a bit more
1 parent 49c49e4 commit 9a0c0a9

File tree

4 files changed

+8
-7
lines changed
  • compiler
    • rustc_const_eval/src/check_consts
    • rustc_middle/src/query
    • rustc_mir_build/src/builder
    • rustc_mir_transform/src

4 files changed

+8
-7
lines changed

compiler/rustc_const_eval/src/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
335335
self.tcx.dcx().span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
336336
}
337337
if let Some(def_id) = def_id.as_local()
338-
&& let Err(guar) = self.tcx.at(span).check_well_formed(hir::OwnerId { def_id })
338+
&& let Err(guar) = self.tcx.ensure_ok().check_well_formed(hir::OwnerId { def_id })
339339
{
340340
self.error_emitted = Some(guar);
341341
}

compiler/rustc_middle/src/query/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ rustc_queries! {
612612

613613
query check_coroutine_obligations(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
614614
desc { |tcx| "verify auto trait bounds for coroutine interior type `{}`", tcx.def_path_str(key) }
615+
return_result_from_ensure_ok
615616
}
616617

617618
/// MIR after our optimization passes have run. This is MIR that is ready
@@ -1033,13 +1034,13 @@ rustc_queries! {
10331034
/// Unsafety-check this `LocalDefId`.
10341035
query check_unsafety(key: LocalDefId) {
10351036
desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key) }
1036-
cache_on_disk_if { true }
1037+
return_result_from_ensure_ok
10371038
}
10381039

10391040
/// Checks well-formedness of tail calls (`become f()`).
10401041
query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
10411042
desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
1042-
cache_on_disk_if { true }
1043+
return_result_from_ensure_ok
10431044
}
10441045

10451046
/// Returns the types assumed to be well formed while "inside" of the given item.
@@ -1308,7 +1309,7 @@ rustc_queries! {
13081309

13091310
query check_match(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
13101311
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
1311-
cache_on_disk_if { true }
1312+
return_result_from_ensure_ok
13121313
}
13131314

13141315
/// Performs part of the privacy check and computes effective visibilities.

compiler/rustc_mir_build/src/builder/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
4848
/// this directly; instead use the cached version via `mir_built`.
4949
pub fn build_mir<'tcx>(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Body<'tcx> {
5050
tcx.ensure_done().thir_abstract_const(def);
51-
if let Err(e) = tcx.check_match(def) {
51+
if let Err(e) = tcx.ensure_ok().check_match(def) {
5252
return construct_error(tcx, def, e);
5353
}
5454

55-
if let Err(err) = tcx.check_tail_calls(def) {
55+
if let Err(err) = tcx.ensure_ok().check_tail_calls(def) {
5656
return construct_error(tcx, def, err);
5757
}
5858

compiler/rustc_mir_transform/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
528528
| DefKind::Static { .. }
529529
| DefKind::Const
530530
| DefKind::AssocConst => {
531-
if let Err(guar) = tcx.check_well_formed(root.expect_local()) {
531+
if let Err(guar) = tcx.ensure_ok().check_well_formed(root.expect_local()) {
532532
body.tainted_by_errors = Some(guar);
533533
}
534534
}

0 commit comments

Comments
 (0)