Skip to content

Commit d583342

Browse files
committed
Auto merge of rust-lang#102256 - cjgillot:let-under, r=lcnr
Introduce a no-op `PlaceMention` statement for `let _ =`. Fixes rust-lang#54003 Fixes rust-lang#80059 Split from rust-lang#101500 This PR introduces a new `PlaceMention` statement dedicated to matches that neither introduce bindings nor ascribe types. Without this, all traces of the match would vanish from MIR, making it impossible to diagnose unsafety or use in rust-lang#101500. This allows to mark `let _ = <unsafe union access or dereference>` as requiring an unsafe block. Nominating for lang team, as this introduces an extra error.
2 parents 104f430 + 684de04 commit d583342

Some content is hidden

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

48 files changed

+271
-19
lines changed

compiler/rustc_borrowck/src/dataflow.rs

+1
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
390390
| mir::StatementKind::Deinit(..)
391391
| mir::StatementKind::StorageLive(..)
392392
| mir::StatementKind::Retag { .. }
393+
| mir::StatementKind::PlaceMention(..)
393394
| mir::StatementKind::AscribeUserType(..)
394395
| mir::StatementKind::Coverage(..)
395396
| mir::StatementKind::Intrinsic(..)

compiler/rustc_borrowck/src/def_use.rs

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
7272
PlaceContext::MutatingUse(MutatingUseContext::Drop) =>
7373
Some(DefUse::Drop),
7474

75+
// This statement exists to help unsafeck. It does not require the place to be live.
76+
PlaceContext::NonUse(NonUseContext::PlaceMention) => None,
7577
// Debug info is neither def nor use.
7678
PlaceContext::NonUse(NonUseContext::VarDebugInfo) => None,
7779

compiler/rustc_borrowck/src/invalidation.rs

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
7979
}
8080
// Only relevant for mir typeck
8181
StatementKind::AscribeUserType(..)
82+
// Only relevant for unsafeck
83+
| StatementKind::PlaceMention(..)
8284
// Doesn't have any language semantics
8385
| StatementKind::Coverage(..)
8486
// Does not actually affect borrowck

compiler/rustc_borrowck/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx
690690
}
691691
// Only relevant for mir typeck
692692
StatementKind::AscribeUserType(..)
693+
// Only relevant for unsafeck
694+
| StatementKind::PlaceMention(..)
693695
// Doesn't have any language semantics
694696
| StatementKind::Coverage(..)
695697
// These do not actually affect borrowck

compiler/rustc_borrowck/src/type_check/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,9 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
772772

773773
match context {
774774
PlaceContext::MutatingUse(_) => ty::Invariant,
775-
PlaceContext::NonUse(StorageDead | StorageLive | VarDebugInfo) => ty::Invariant,
775+
PlaceContext::NonUse(StorageDead | StorageLive | PlaceMention | VarDebugInfo) => {
776+
ty::Invariant
777+
}
776778
PlaceContext::NonMutatingUse(
777779
Inspect | Copy | Move | SharedBorrow | ShallowBorrow | UniqueBorrow | AddressOf
778780
| Projection,
@@ -1282,6 +1284,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12821284
| StatementKind::Retag { .. }
12831285
| StatementKind::Coverage(..)
12841286
| StatementKind::ConstEvalCounter
1287+
| StatementKind::PlaceMention(..)
12851288
| StatementKind::Nop => {}
12861289
StatementKind::Deinit(..) | StatementKind::SetDiscriminant { .. } => {
12871290
bug!("Statement not allowed in this MIR phase")

compiler/rustc_codegen_cranelift/src/base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ fn codegen_stmt<'tcx>(
819819
| StatementKind::Nop
820820
| StatementKind::FakeRead(..)
821821
| StatementKind::Retag { .. }
822+
| StatementKind::PlaceMention(..)
822823
| StatementKind::AscribeUserType(..) => {}
823824

824825
StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),

compiler/rustc_codegen_cranelift/src/constant.rs

+1
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
529529
| StatementKind::StorageDead(_)
530530
| StatementKind::Retag(_, _)
531531
| StatementKind::AscribeUserType(_, _)
532+
| StatementKind::PlaceMention(..)
532533
| StatementKind::Coverage(_)
533534
| StatementKind::ConstEvalCounter
534535
| StatementKind::Nop => {}

compiler/rustc_codegen_ssa/src/mir/statement.rs

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
9292
| mir::StatementKind::Retag { .. }
9393
| mir::StatementKind::AscribeUserType(..)
9494
| mir::StatementKind::ConstEvalCounter
95+
| mir::StatementKind::PlaceMention(..)
9596
| mir::StatementKind::Nop => {}
9697
}
9798
}

compiler/rustc_const_eval/src/interpret/step.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
114114
Intrinsic(box intrinsic) => self.emulate_nondiverging_intrinsic(intrinsic)?,
115115

116116
// Statements we do not track.
117-
AscribeUserType(..) => {}
117+
PlaceMention(..) | AscribeUserType(..) => {}
118118

119119
// Currently, Miri discards Coverage statements. Coverage statements are only injected
120120
// via an optional compile time MIR pass and have no side effects. Since Coverage

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
690690
| StatementKind::StorageLive(_)
691691
| StatementKind::StorageDead(_)
692692
| StatementKind::Retag { .. }
693+
| StatementKind::PlaceMention(..)
693694
| StatementKind::AscribeUserType(..)
694695
| StatementKind::Coverage(..)
695696
| StatementKind::Intrinsic(..)

compiler/rustc_const_eval/src/transform/validate.rs

+8
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
679679
}
680680
}
681681
}
682+
StatementKind::PlaceMention(..) => {
683+
if self.mir_phase >= MirPhase::Runtime(RuntimePhase::Initial) {
684+
self.fail(
685+
location,
686+
"`PlaceMention` should have been removed after drop lowering phase",
687+
);
688+
}
689+
}
682690
StatementKind::AscribeUserType(..) => {
683691
if self.mir_phase >= MirPhase::Runtime(RuntimePhase::Initial) {
684692
self.fail(

compiler/rustc_middle/src/mir/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,9 @@ impl Debug for Statement<'_> {
14531453
write!(fmt, "discriminant({:?}) = {:?}", place, variant_index)
14541454
}
14551455
Deinit(ref place) => write!(fmt, "Deinit({:?})", place),
1456+
PlaceMention(ref place) => {
1457+
write!(fmt, "PlaceMention({:?})", place)
1458+
}
14561459
AscribeUserType(box (ref place, ref c_ty), ref variance) => {
14571460
write!(fmt, "AscribeUserType({:?}, {:?}, {:?})", place, variance, c_ty)
14581461
}

compiler/rustc_middle/src/mir/spanview.rs

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ pub fn statement_kind_name(statement: &Statement<'_>) -> &'static str {
247247
StorageLive(..) => "StorageLive",
248248
StorageDead(..) => "StorageDead",
249249
Retag(..) => "Retag",
250+
PlaceMention(..) => "PlaceMention",
250251
AscribeUserType(..) => "AscribeUserType",
251252
Coverage(..) => "Coverage",
252253
Intrinsic(..) => "Intrinsic",

compiler/rustc_middle/src/mir/syntax.rs

+9
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ pub enum StatementKind<'tcx> {
325325
/// Only `RetagKind::Default` and `RetagKind::FnEntry` are permitted.
326326
Retag(RetagKind, Box<Place<'tcx>>),
327327

328+
/// This statement exists to preserve a trace of a scrutinee matched against a wildcard binding.
329+
/// This is especially useful for `let _ = PLACE;` bindings that desugar to a single
330+
/// `PlaceMention(PLACE)`.
331+
///
332+
/// When executed at runtime this is a nop.
333+
///
334+
/// Disallowed after drop elaboration.
335+
PlaceMention(Box<Place<'tcx>>),
336+
328337
/// Encodes a user's type ascription. These need to be preserved
329338
/// intact so that NLL can respect them. For example:
330339
/// ```ignore (illustrative)

compiler/rustc_middle/src/mir/visit.rs

+9
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ macro_rules! make_mir_visitor {
405405
StatementKind::Retag(kind, place) => {
406406
self.visit_retag($(& $mutability)? *kind, place, location);
407407
}
408+
StatementKind::PlaceMention(place) => {
409+
self.visit_place(
410+
place,
411+
PlaceContext::NonUse(NonUseContext::PlaceMention),
412+
location
413+
);
414+
}
408415
StatementKind::AscribeUserType(
409416
box (place, user_ty),
410417
variance
@@ -1288,6 +1295,8 @@ pub enum NonUseContext {
12881295
AscribeUserTy,
12891296
/// The data of a user variable, for debug info.
12901297
VarDebugInfo,
1298+
/// PlaceMention statement.
1299+
PlaceMention,
12911300
}
12921301

12931302
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

compiler/rustc_mir_build/src/build/cfg.rs

+11
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ impl<'tcx> CFG<'tcx> {
9090
self.push(block, stmt);
9191
}
9292

93+
pub(crate) fn push_place_mention(
94+
&mut self,
95+
block: BasicBlock,
96+
source_info: SourceInfo,
97+
place: Place<'tcx>,
98+
) {
99+
let kind = StatementKind::PlaceMention(Box::new(place));
100+
let stmt = Statement { source_info, kind };
101+
self.push(block, stmt);
102+
}
103+
93104
pub(crate) fn terminate(
94105
&mut self,
95106
block: BasicBlock,

compiler/rustc_mir_build/src/build/matches/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
556556

557557
_ => {
558558
let place_builder = unpack!(block = self.as_place_builder(block, initializer));
559+
560+
if let Some(place) = place_builder.try_to_place(self) {
561+
let source_info = self.source_info(initializer.span);
562+
self.cfg.push_place_mention(block, source_info, place);
563+
}
564+
559565
self.place_into_pattern(block, &irrefutable_pat, place_builder, true)
560566
}
561567
}
@@ -576,6 +582,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
576582
false,
577583
&mut [&mut candidate],
578584
);
585+
579586
// For matches and function arguments, the place that is being matched
580587
// can be set when creating the variables. But the place for
581588
// let PATTERN = ... might not even exist until we do the assignment.

compiler/rustc_mir_dataflow/src/impls/liveness.rs

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a> {
263263
| StatementKind::StorageDead(_)
264264
| StatementKind::Retag(..)
265265
| StatementKind::AscribeUserType(..)
266+
| StatementKind::PlaceMention(..)
266267
| StatementKind::Coverage(..)
267268
| StatementKind::Intrinsic(..)
268269
| StatementKind::ConstEvalCounter

compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ impl<'mir, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'mir, 'tc
139139
// Nothing to do for these. Match exhaustively so this fails to compile when new
140140
// variants are added.
141141
StatementKind::AscribeUserType(..)
142+
| StatementKind::PlaceMention(..)
142143
| StatementKind::Coverage(..)
143144
| StatementKind::FakeRead(..)
144145
| StatementKind::ConstEvalCounter

compiler/rustc_mir_dataflow/src/move_paths/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
329329
}
330330
StatementKind::Retag { .. }
331331
| StatementKind::AscribeUserType(..)
332+
| StatementKind::PlaceMention(..)
332333
| StatementKind::Coverage(..)
333334
| StatementKind::Intrinsic(..)
334335
| StatementKind::ConstEvalCounter

compiler/rustc_mir_dataflow/src/value_analysis.rs

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub trait ValueAnalysis<'tcx> {
8686
StatementKind::ConstEvalCounter
8787
| StatementKind::Nop
8888
| StatementKind::FakeRead(..)
89+
| StatementKind::PlaceMention(..)
8990
| StatementKind::Coverage(..)
9091
| StatementKind::AscribeUserType(..) => (),
9192
}

compiler/rustc_mir_transform/src/check_unsafety.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
100100
| StatementKind::StorageLive(..)
101101
| StatementKind::StorageDead(..)
102102
| StatementKind::Retag { .. }
103-
| StatementKind::AscribeUserType(..)
103+
| StatementKind::PlaceMention(..)
104104
| StatementKind::Coverage(..)
105105
| StatementKind::Intrinsic(..)
106106
| StatementKind::ConstEvalCounter
107107
| StatementKind::Nop => {
108108
// safe (at least as emitted during MIR construction)
109109
}
110+
// `AscribeUserType` just exists to help MIR borrowck.
111+
// It has no semantics, and everything is already reported by `PlaceMention`.
112+
StatementKind::AscribeUserType(..) => return,
110113
}
111114
self.super_statement(statement, location);
112115
}

compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl<'tcx> MirPass<'tcx> for CleanupPostBorrowck {
2424
for statement in basic_block.statements.iter_mut() {
2525
match statement.kind {
2626
StatementKind::AscribeUserType(..)
27+
| StatementKind::PlaceMention(..)
2728
| StatementKind::Assign(box (_, Rvalue::Ref(_, BorrowKind::Shallow, _)))
2829
| StatementKind::FakeRead(..) => statement.make_nop(),
2930
_ => (),

compiler/rustc_mir_transform/src/coverage/spans.rs

+1
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ pub(super) fn filtered_statement_span(statement: &Statement<'_>) -> Option<Span>
832832
| StatementKind::SetDiscriminant { .. }
833833
| StatementKind::Deinit(..)
834834
| StatementKind::Retag(_, _)
835+
| StatementKind::PlaceMention(..)
835836
| StatementKind::AscribeUserType(_, _) => {
836837
Some(statement.source_info.span)
837838
}

compiler/rustc_mir_transform/src/dead_store_elimination.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, borrowed: &BitS
5656
| StatementKind::ConstEvalCounter
5757
| StatementKind::Nop => (),
5858

59-
StatementKind::FakeRead(_) | StatementKind::AscribeUserType(_, _) => {
59+
StatementKind::FakeRead(_)
60+
| StatementKind::PlaceMention(_)
61+
| StatementKind::AscribeUserType(_, _) => {
6062
bug!("{:?} not found in this MIR phase!", &statement.kind)
6163
}
6264
}

compiler/rustc_mir_transform/src/dest_prop.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ impl WriteInfo {
583583
| StatementKind::Coverage(_)
584584
| StatementKind::StorageLive(_)
585585
| StatementKind::StorageDead(_) => (),
586-
StatementKind::FakeRead(_) | StatementKind::AscribeUserType(_, _) => {
586+
StatementKind::FakeRead(_)
587+
| StatementKind::AscribeUserType(_, _)
588+
| StatementKind::PlaceMention(_) => {
587589
bug!("{:?} not found in this MIR phase", statement)
588590
}
589591
}

compiler/rustc_mir_transform/src/generator.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,7 @@ impl<'tcx> Visitor<'tcx> for EnsureGeneratorFieldAssignmentsNeverAlias<'_> {
16471647
| StatementKind::StorageDead(_)
16481648
| StatementKind::Retag(..)
16491649
| StatementKind::AscribeUserType(..)
1650+
| StatementKind::PlaceMention(..)
16501651
| StatementKind::Coverage(..)
16511652
| StatementKind::Intrinsic(..)
16521653
| StatementKind::ConstEvalCounter

compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ impl RemoveNoopLandingPads {
3333
StatementKind::FakeRead(..)
3434
| StatementKind::StorageLive(_)
3535
| StatementKind::StorageDead(_)
36+
| StatementKind::PlaceMention(..)
3637
| StatementKind::AscribeUserType(..)
3738
| StatementKind::Coverage(..)
3839
| StatementKind::ConstEvalCounter

compiler/rustc_mir_transform/src/separate_const_switch.rs

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ fn is_likely_const<'tcx>(mut tracked_place: Place<'tcx>, block: &BasicBlockData<
245245
| StatementKind::StorageLive(_)
246246
| StatementKind::Retag(_, _)
247247
| StatementKind::AscribeUserType(_, _)
248+
| StatementKind::PlaceMention(..)
248249
| StatementKind::Coverage(_)
249250
| StatementKind::StorageDead(_)
250251
| StatementKind::Intrinsic(_)
@@ -315,6 +316,7 @@ fn find_determining_place<'tcx>(
315316
| StatementKind::StorageDead(_)
316317
| StatementKind::Retag(_, _)
317318
| StatementKind::AscribeUserType(_, _)
319+
| StatementKind::PlaceMention(..)
318320
| StatementKind::Coverage(_)
319321
| StatementKind::Intrinsic(_)
320322
| StatementKind::ConstEvalCounter

compiler/rustc_mir_transform/src/simplify.rs

+1
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ impl<'tcx> Visitor<'tcx> for UsedLocals {
525525
| StatementKind::Retag(..)
526526
| StatementKind::Coverage(..)
527527
| StatementKind::FakeRead(..)
528+
| StatementKind::PlaceMention(..)
528529
| StatementKind::AscribeUserType(..) => {
529530
self.super_statement(statement, location);
530531
}

src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ fn check_statement<'tcx>(
241241
| StatementKind::StorageDead(_)
242242
| StatementKind::Retag { .. }
243243
| StatementKind::AscribeUserType(..)
244+
| StatementKind::PlaceMention(..)
244245
| StatementKind::Coverage(..)
245246
| StatementKind::ConstEvalCounter
246247
| StatementKind::Nop => Ok(()),

tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ fn full_tested_match() -> () {
100100
}
101101

102102
bb11: {
103+
PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
103104
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
104105
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
105106
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2

tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ fn full_tested_match2() -> () {
100100
}
101101

102102
bb11: {
103+
PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
103104
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
104105
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
105106
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2

tests/mir-opt/building/match_false_edges.main.built.after.mir

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ fn main() -> () {
162162
}
163163

164164
bb19: {
165+
PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
165166
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
166167
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
167168
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2

tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ fn move_out_by_subslice() -> () {
7777
bb6: {
7878
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
7979
FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
80+
PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+2:21: +2:22
8081
StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
8182
_12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
8283
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2

tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ fn move_out_from_end() -> () {
7777
bb6: {
7878
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
7979
FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
80+
PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+2:20: +2:21
8081
StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
8182
_12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
8283
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +3:2

tests/mir-opt/issue_72181.main.built.after.mir

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fn main() -> () {
2929
}
3030

3131
bb1: {
32+
PlaceMention(_1); // scope 0 at $DIR/issue_72181.rs:+1:13: +1:34
3233
StorageDead(_1); // scope 0 at $DIR/issue_72181.rs:+1:34: +1:35
3334
StorageLive(_2); // scope 1 at $DIR/issue_72181.rs:+3:9: +3:10
3435
StorageLive(_3); // scope 1 at $DIR/issue_72181.rs:+3:14: +3:27
@@ -49,6 +50,7 @@ fn main() -> () {
4950

5051
bb2: {
5152
_5 = (_2[_6].0: u64); // scope 4 at $DIR/issue_72181.rs:+4:22: +4:28
53+
PlaceMention(_5); // scope 2 at $DIR/issue_72181.rs:+4:13: +4:30
5254
StorageDead(_6); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31
5355
StorageDead(_5); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31
5456
_0 = const (); // scope 0 at $DIR/issue_72181.rs:+0:11: +5:2

0 commit comments

Comments
 (0)