Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
if !tcx.is_typeck_child(def_id.to_def_id()) {
// Child unsafety and borrowck happens together with the parent
tcx.ensure_ok().check_unsafety(def_id);
tcx.ensure_ok().mir_borrowck(def_id);
let _ = tcx.ensure_ok().mir_borrowck(def_id);
tcx.ensure_ok().check_transmutes(def_id);
}
tcx.ensure_ok().has_ffi_unwind_calls(def_id);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ rustc_queries! {
/// and its children, e.g. closures, inline consts.
query mir_borrowck(key: LocalDefId) -> Result<&'tcx mir::DefinitionSiteHiddenTypes<'tcx>, ErrorGuaranteed> {
desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
return_result_from_ensure_ok
}

/// Gets a complete map from all types to their inherent impls.
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_middle/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,18 @@ macro_rules! define_callbacks {
impl<'tcx> TyCtxtEnsureDone<'tcx> {
$($(#[$attr])*
#[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
query_ensure(
pub fn $name(
self,
key: query_helper_param_ty!($($K)*),
) -> ensure_ok_result!([$($modifiers)*]) {
query_ensure!(
[$($modifiers)*]
self.tcx,
self.tcx.query_system.fns.engine.$name,
&self.tcx.query_system.caches.$name,
key.into_query_param(),
true,
);
)
})*
}

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &

// We only need to borrowck non-synthetic MIR.
let tainted_by_errors = if !tcx.is_synthetic_mir(def) {
tcx.mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()).err()
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()).err()
} else {
None
};
Expand Down Expand Up @@ -795,7 +795,8 @@ fn promoted_mir(tcx: TyCtxt<'_>, def: LocalDefId) -> &IndexVec<Promoted, Body<'_
}

if !tcx.is_synthetic_mir(def) {
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local());
let _ =
tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local());
}
let mut promoted = tcx.mir_promoted(def).1.steal();

Expand Down
Loading