Auto merge of #62561 - Centril:rollup-5pxj3bo, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #62275 (rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.)
 - #62465 (Sometimes generate storage statements for temporaries with type `!`)
 - #62481 (Use `fold` in `Iterator::last` default implementation)
 - #62493 (#62357: doc(ptr): add example for {read,write}_unaligned)
 - #62532 (Some more cleanups to syntax::print)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-07-10 23:02:44 +00:00
commit 35cacbce16
24 changed files with 510 additions and 526 deletions

View file

@ -26,6 +26,7 @@ fn main() {
// _1 = ();
// StorageDead(_2);
// StorageDead(_1);
// StorageLive(_4);
// goto -> bb5;
// }
// ...

View file

@ -0,0 +1,14 @@
// Regression test for issue 62165
// check-pass
#![feature(never_type)]
pub fn main() {
loop {
match None {
None => return,
Some(val) => val,
};
};
}

View file

@ -9,10 +9,21 @@ impl Drop for FakeNeedsDrop {
// ok
const X: FakeNeedsDrop = { let x = FakeNeedsDrop; x };
// ok (used to incorrectly error, see #62273)
const X2: FakeNeedsDrop = { let x; x = FakeNeedsDrop; x };
// error
const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
//~^ ERROR constant contains unimplemented expression type
//~^ ERROR destructors cannot be evaluated at compile-time
// error
const Y2: FakeNeedsDrop = { let mut x; x = FakeNeedsDrop; x = FakeNeedsDrop; x };
//~^ ERROR destructors cannot be evaluated at compile-time
// error
const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
//~^ ERROR constant contains unimplemented expression type
//~^ ERROR destructors cannot be evaluated at compile-time
// error
const Z2: () = { let mut x; x = None; x = Some(FakeNeedsDrop); };
//~^ ERROR destructors cannot be evaluated at compile-time

View file

@ -1,15 +1,26 @@
error[E0019]: constant contains unimplemented expression type
--> $DIR/const_let.rs:13:55
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/const_let.rs:16:32
|
LL | const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
| ^
| ^^^^^ constants cannot evaluate destructors
error[E0019]: constant contains unimplemented expression type
--> $DIR/const_let.rs:17:35
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/const_let.rs:20:33
|
LL | const Y2: FakeNeedsDrop = { let mut x; x = FakeNeedsDrop; x = FakeNeedsDrop; x };
| ^^^^^ constants cannot evaluate destructors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/const_let.rs:24:21
|
LL | const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
| ^
| ^^^^^ constants cannot evaluate destructors
error: aborting due to 2 previous errors
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/const_let.rs:28:22
|
LL | const Z2: () = { let mut x; x = None; x = Some(FakeNeedsDrop); };
| ^^^^^ constants cannot evaluate destructors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0019`.