diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-09-06 18:41:01 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-09 17:45:13 +0000 |
| commit | 4462bb54e3bbff7eecae1816836f306fcc309e05 (patch) | |
| tree | aac24138a84068a1ca3a60247704bbcddc241bd4 /compiler/rustc_borrowck/src | |
| parent | be758ef5ab570b7685c9a5eecacab65911da9e6f (diff) | |
| download | rust-4462bb54e3bbff7eecae1816836f306fcc309e05.tar.gz rust-4462bb54e3bbff7eecae1816836f306fcc309e05.zip | |
Introduce a no-op PlaceMention statement for `let _ =`.
Diffstat (limited to 'compiler/rustc_borrowck/src')
| -rw-r--r-- | compiler/rustc_borrowck/src/dataflow.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/def_use.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/invalidation.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 5 |
5 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index d2574aa58c2..0762987e229 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -390,6 +390,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> { | mir::StatementKind::Deinit(..) | mir::StatementKind::StorageLive(..) | mir::StatementKind::Retag { .. } + | mir::StatementKind::PlaceMention(..) | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Coverage(..) | mir::StatementKind::Intrinsic(..) diff --git a/compiler/rustc_borrowck/src/def_use.rs b/compiler/rustc_borrowck/src/def_use.rs index 8e62a0198be..c67411c4784 100644 --- a/compiler/rustc_borrowck/src/def_use.rs +++ b/compiler/rustc_borrowck/src/def_use.rs @@ -73,7 +73,7 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> { Some(DefUse::Drop), // Debug info is neither def nor use. - PlaceContext::NonUse(NonUseContext::VarDebugInfo) => None, + PlaceContext::NonUse(NonUseContext::PlaceMention | NonUseContext::VarDebugInfo) => None, PlaceContext::MutatingUse(MutatingUseContext::Deinit | MutatingUseContext::SetDiscriminant) => { bug!("These statements are not allowed in this MIR phase") diff --git a/compiler/rustc_borrowck/src/invalidation.rs b/compiler/rustc_borrowck/src/invalidation.rs index 1006a047cce..a71c4163286 100644 --- a/compiler/rustc_borrowck/src/invalidation.rs +++ b/compiler/rustc_borrowck/src/invalidation.rs @@ -79,6 +79,8 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> { } // Only relevant for mir typeck StatementKind::AscribeUserType(..) + // Only relevant for unsafeck + | StatementKind::PlaceMention(..) // Doesn't have any language semantics | StatementKind::Coverage(..) // Does not actually affect borrowck diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 92acd755509..f84a4691d32 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -690,6 +690,8 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx } // Only relevant for mir typeck StatementKind::AscribeUserType(..) + // Only relevant for unsafeck + | StatementKind::PlaceMention(..) // Doesn't have any language semantics | StatementKind::Coverage(..) // These do not actually affect borrowck diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index d85e058bb20..3919c4793a0 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -772,7 +772,9 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { match context { PlaceContext::MutatingUse(_) => ty::Invariant, - PlaceContext::NonUse(StorageDead | StorageLive | VarDebugInfo) => ty::Invariant, + PlaceContext::NonUse(StorageDead | StorageLive | PlaceMention | VarDebugInfo) => { + ty::Invariant + } PlaceContext::NonMutatingUse( Inspect | Copy | Move | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf | Projection, @@ -1282,6 +1284,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | StatementKind::Retag { .. } | StatementKind::Coverage(..) | StatementKind::ConstEvalCounter + | StatementKind::PlaceMention(..) | StatementKind::Nop => {} StatementKind::Deinit(..) | StatementKind::SetDiscriminant { .. } => { bug!("Statement not allowed in this MIR phase") |
