Skip to content

Commit 71f68ba

Browse files
committed
Return Result from ensure_done().mir_borrowck(..).
1 parent b50f345 commit 71f68ba

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
10921092
if !tcx.is_typeck_child(def_id.to_def_id()) {
10931093
// Child unsafety and borrowck happens together with the parent
10941094
tcx.ensure_ok().check_unsafety(def_id);
1095-
tcx.ensure_ok().mir_borrowck(def_id);
1095+
let _ = tcx.ensure_ok().mir_borrowck(def_id);
10961096
tcx.ensure_ok().check_transmutes(def_id);
10971097
}
10981098
tcx.ensure_ok().has_ffi_unwind_calls(def_id);

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,7 @@ rustc_queries! {
12461246
/// and its children, e.g. closures, inline consts.
12471247
query mir_borrowck(key: LocalDefId) -> Result<&'tcx mir::ConcreteOpaqueTypes<'tcx>, ErrorGuaranteed> {
12481248
desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
1249+
return_result_from_ensure_ok
12491250
}
12501251

12511252
/// Gets a complete map from all types to their inherent impls.

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,18 @@ macro_rules! define_callbacks {
446446
impl<'tcx> TyCtxtEnsureDone<'tcx> {
447447
$($(#[$attr])*
448448
#[inline(always)]
449-
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
450-
query_ensure(
449+
pub fn $name(
450+
self,
451+
key: query_helper_param_ty!($($K)*),
452+
) -> ensure_ok_result!([$($modifiers)*]) {
453+
query_ensure!(
454+
[$($modifiers)*]
451455
self.tcx,
452456
self.tcx.query_system.fns.engine.$name,
453457
&self.tcx.query_system.caches.$name,
454458
key.into_query_param(),
455459
true,
456-
);
460+
)
457461
})*
458462
}
459463

compiler/rustc_mir_transform/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
498498

499499
// We only need to borrowck non-synthetic MIR.
500500
let tainted_by_errors = if !tcx.is_synthetic_mir(def) {
501-
tcx.mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()).err()
501+
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()).err()
502502
} else {
503503
None
504504
};
@@ -797,7 +797,8 @@ fn promoted_mir(tcx: TyCtxt<'_>, def: LocalDefId) -> &IndexVec<Promoted, Body<'_
797797
}
798798

799799
if !tcx.is_synthetic_mir(def) {
800-
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local());
800+
let _ =
801+
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local());
801802
}
802803
let mut promoted = tcx.mir_promoted(def).1.steal();
803804

0 commit comments

Comments
 (0)