Skip to content

Commit 37fa925

Browse files
Add regression test for #90770
1 parent 9aaca1d commit 37fa925

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/test/ui/consts/drop_zst.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// check-fail
2+
3+
#![feature(const_precise_live_drops)]
4+
5+
struct S;
6+
7+
impl Drop for S {
8+
fn drop(&mut self) {
9+
println!("Hello!");
10+
}
11+
}
12+
13+
const fn foo() {
14+
let s = S; //~ destructor
15+
}
16+
17+
fn main() {}

src/test/ui/consts/drop_zst.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0493]: destructors cannot be evaluated at compile-time
2+
--> $DIR/drop_zst.rs:14:9
3+
|
4+
LL | let s = S;
5+
| ^ constant functions cannot evaluate destructors
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0493`.

0 commit comments

Comments
 (0)