Skip to content

Commit 81daf5b

Browse files
committed
Auto merge of #102256 - cjgillot:let-under, r=lcnr
Introduce a no-op `PlaceMention` statement for `let _ =`. Fixes rust-lang/rust#54003 Fixes rust-lang/rust#80059 Split from rust-lang/rust#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 #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 9333d52 + 5d5d25e commit 81daf5b

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/base.rs

Lines changed: 1 addition & 0 deletions
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"),

src/constant.rs

Lines changed: 1 addition & 0 deletions
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 => {}

0 commit comments

Comments
 (0)