Skip to content

Commit 29a90c4

Browse files
authored
Rollup merge of #40372 - nagisa:never-drop, r=eddyb
Do not bother creating StorageLive for TyNever Keeps MIR cleaner, `StorageLive(_: !)` makes no sense anyway. r? @eddyb
2 parents b8bb1de + 84d1f6a commit 29a90c4

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/librustc_mir/build/expr/as_temp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
5555
(https://github.com/rust-lang/rust/issues/39283)");
5656
}
5757

58-
if temp_lifetime.is_some() {
58+
if !expr_ty.is_never() && temp_lifetime.is_some() {
5959
this.cfg.push(block, Statement {
6060
source_info: source_info,
6161
kind: StatementKind::StorageLive(temp.clone())

src/test/mir-opt/issue-38669.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fn main() {
3535
// }
3636
//
3737
// bb2: {
38-
// StorageLive(_6);
3938
// _0 = ();
4039
// StorageDead(_4);
4140
// StorageDead(_1);

0 commit comments

Comments
 (0)