]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #40372 - nagisa:never-drop, r=eddyb
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>
Sat, 11 Mar 2017 19:57:45 +0000 (21:57 +0200)
committerGitHub <noreply@github.com>
Sat, 11 Mar 2017 19:57:45 +0000 (21:57 +0200)
Do not bother creating StorageLive for TyNever

Keeps MIR cleaner, `StorageLive(_: !)` makes no sense anyway.

r? @eddyb

src/librustc_mir/build/expr/as_temp.rs
src/test/mir-opt/issue-38669.rs

index 69b95702009213432d1528cd281e09e85e3bc761..42d9ab4d2bf274dde9f1c82b789c70b325220f0c 100644 (file)
@@ -55,7 +55,7 @@ fn expr_as_temp(&mut self,
 (https://github.com/rust-lang/rust/issues/39283)");
         }
 
-        if temp_lifetime.is_some() {
+        if !expr_ty.is_never() && temp_lifetime.is_some() {
             this.cfg.push(block, Statement {
                 source_info: source_info,
                 kind: StatementKind::StorageLive(temp.clone())
index 1d452907cf59acad2c58c4fedb74da2b66e302cb..fbbffe8953b38959a550565ba3fcd80128315e47 100644 (file)
@@ -35,7 +35,6 @@ fn main() {
 //     }
 //
 //     bb2: {
-//         StorageLive(_6);
 //         _0 = ();
 //         StorageDead(_4);
 //         StorageDead(_1);