forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#62275 - eddyb:const-drop-replace, r=pnkfelix
rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts. This slipped through the cracks and never got implemented (thankfully that just meant it was overly conservative and didn't allow assignments that don't *actually* drop the previous value). Fixes rust-lang#62273. r? @oli-obk
- Loading branch information
Showing
3 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[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 2 previous errors | ||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0019`. |