Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4262b6c

Browse files
committedJun 13, 2025
Diagnose liveness on MIR.
1 parent aedc71c commit 4262b6c

File tree

87 files changed

+2427
-2541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2427
-2541
lines changed
 

‎compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
990990
tcx.ensure_ok().mir_borrowck(def_id)
991991
}
992992
tcx.ensure_ok().has_ffi_unwind_calls(def_id);
993+
tcx.ensure_ok().check_liveness(def_id);
993994

994995
// If we need to codegen, ensure that we emit all errors from
995996
// `mir_drops_elaborated_and_const_checked` now, to avoid discovering

‎compiler/rustc_middle/src/mir/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ pub enum BindingForm<'tcx> {
937937
/// Binding for a `self`/`&self`/`&mut self` binding where the type is implicit.
938938
ImplicitSelf(ImplicitSelfKind),
939939
/// Reference used in a guard expression to ensure immutability.
940-
RefForGuard,
940+
RefForGuard(Local),
941941
}
942942

943943
mod binding_form_impl {
@@ -952,7 +952,7 @@ mod binding_form_impl {
952952
match self {
953953
Var(binding) => binding.hash_stable(hcx, hasher),
954954
ImplicitSelf(kind) => kind.hash_stable(hcx, hasher),
955-
RefForGuard => (),
955+
RefForGuard(local) => local.hash_stable(hcx, hasher),
956956
}
957957
}
958958
}
@@ -1163,7 +1163,7 @@ impl<'tcx> LocalDecl<'tcx> {
11631163
/// expression that is used to access said variable for the guard of the
11641164
/// match arm.
11651165
pub fn is_ref_for_guard(&self) -> bool {
1166-
matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard))
1166+
matches!(self.local_info(), LocalInfo::User(BindingForm::RefForGuard(_)))
11671167
}
11681168

11691169
/// Returns `Some` if this is a reference to a static item that is used to

0 commit comments

Comments
 (0)