From 6ce7842dafcda41c9149116f854f719440adf193 Mon Sep 17 00:00:00 2001 From: "Tim (Theemathas Chirananthavat)" Date: Wed, 12 Aug 2026 17:48:07 +0700 Subject: [PATCH] Remove `MutatingUseContext::Retag` This variant was never constructed anywhere. --- compiler/rustc_borrowck/src/def_use.rs | 3 +-- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 3 +-- compiler/rustc_middle/src/mir/visit.rs | 2 -- compiler/rustc_mir_dataflow/src/impls/liveness.rs | 3 +-- compiler/rustc_mir_transform/src/deduce_param_attrs.rs | 3 +-- compiler/rustc_mir_transform/src/known_panics_lint.rs | 1 - compiler/rustc_mir_transform/src/liveness.rs | 3 +-- 7 files changed, 5 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_borrowck/src/def_use.rs b/compiler/rustc_borrowck/src/def_use.rs index 8813ef5249262..df20eb0e49c62 100644 --- a/compiler/rustc_borrowck/src/def_use.rs +++ b/compiler/rustc_borrowck/src/def_use.rs @@ -59,8 +59,7 @@ pub(crate) fn categorize(context: PlaceContext) -> Option { PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow) | PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect) | PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) | - PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) | - PlaceContext::MutatingUse(MutatingUseContext::Retag) => Some(DefUse::Use), + PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => Some(DefUse::Use), /////////////////////////////////////////////////////////////////////////// // DROP USES diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index 45a9e04986c74..5bf6b44c41ebc 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -211,8 +211,7 @@ impl<'a, 'b, 'tcx, Bx: BuilderMethods<'b, 'tcx>> Visitor<'tcx> for LocalAnalyzer } PlaceContext::NonUse(_) - | PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) - | PlaceContext::MutatingUse(MutatingUseContext::Retag) => {} + | PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) => {} PlaceContext::NonMutatingUse( NonMutatingUseContext::Copy diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 429ab7d928fc5..0ae59e99c2b5a 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1354,8 +1354,6 @@ pub enum MutatingUseContext { /// f(&mut x.y); /// ``` Projection, - /// Retagging, a "Stacked Borrows" shadow state operation - Retag, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs index 5c77827a67165..2787365c17be1 100644 --- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs @@ -180,8 +180,7 @@ impl DefUse { PlaceContext::MutatingUse( MutatingUseContext::RawBorrow | MutatingUseContext::Borrow - | MutatingUseContext::Drop - | MutatingUseContext::Retag, + | MutatingUseContext::Drop, ) | PlaceContext::NonMutatingUse( NonMutatingUseContext::RawBorrow diff --git a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs index bcd43bc40d8bc..5bba125aefc58 100644 --- a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs +++ b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs @@ -74,8 +74,7 @@ impl<'tcx> Visitor<'tcx> for DeduceParamAttrs { MutatingUseContext::Store | MutatingUseContext::SetDiscriminant | MutatingUseContext::AsmOutput - | MutatingUseContext::Projection - | MutatingUseContext::Retag) => { + | MutatingUseContext::Projection) => { self.usage[i] |= UsageSummary::MUTATE; } | PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow) => { diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs index 1a2d47f4cc258..a2f2f8fa063c2 100644 --- a/compiler/rustc_mir_transform/src/known_panics_lint.rs +++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs @@ -975,7 +975,6 @@ impl<'tcx> Visitor<'tcx> for CanConstProp { // whether they'd be fine right now. MutatingUse(MutatingUseContext::Yield) | MutatingUse(MutatingUseContext::Drop) - | MutatingUse(MutatingUseContext::Retag) // These can't ever be propagated under any scheme, as we can't reason about indirect // mutation. | NonMutatingUse(NonMutatingUseContext::SharedBorrow) diff --git a/compiler/rustc_mir_transform/src/liveness.rs b/compiler/rustc_mir_transform/src/liveness.rs index c895819a9f8cc..4da8ca0760257 100644 --- a/compiler/rustc_mir_transform/src/liveness.rs +++ b/compiler/rustc_mir_transform/src/liveness.rs @@ -1548,8 +1548,7 @@ impl DefUse { PlaceContext::MutatingUse( MutatingUseContext::RawBorrow | MutatingUseContext::Borrow - | MutatingUseContext::Drop - | MutatingUseContext::Retag, + | MutatingUseContext::Drop, ) | PlaceContext::NonMutatingUse( NonMutatingUseContext::RawBorrow