forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
const_precise_live_drops
- Loading branch information
1 parent
9e2ee32
commit 2dcf7db
Showing
5 changed files
with
49 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0493]: destructors cannot be evaluated at compile-time | ||
--> $DIR/drop-fail.rs:10:9 | ||
| | ||
LL | let x = Some(Vec::new()); | ||
| ^ constants cannot evaluate destructors | ||
|
||
error[E0493]: destructors cannot be evaluated at compile-time | ||
--> $DIR/drop-fail.rs:41:9 | ||
| | ||
LL | let mut tmp = None; | ||
| ^^^^^^^ constants cannot evaluate destructors | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0493`. |
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
8 changes: 4 additions & 4 deletions
8
...i/consts/control-flow/drop-failure.stderr → ...onsts/control-flow/drop-fail.stock.stderr
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
2 changes: 2 additions & 0 deletions
2
...st/ui/consts/control-flow/drop-success.rs → src/test/ui/consts/control-flow/drop-pass.rs
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// run-pass | ||
// gate-test-const_precise_live_drops | ||
|
||
#![feature(const_if_match)] | ||
#![feature(const_loop)] | ||
#![feature(const_precise_live_drops)] | ||
|
||
const _: Vec<i32> = { | ||
let vec_tuple = (Vec::new(),); | ||
vec_tuple.0 | ||
}; | ||
|
||
const _: Vec<i32> = { | ||
let x: Result<_, Vec<i32>> = Ok(Vec::new()); | ||
match x { | ||
Ok(x) | Err(x) => x, | ||
} | ||
}; | ||
|
||
fn main() {} |