Skip to content

Commit

Permalink
Add regression test for rust-lang#90770
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Dec 1, 2021
1 parent 9aaca1d commit 37fa925
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/ui/consts/drop_zst.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// check-fail

#![feature(const_precise_live_drops)]

struct S;

impl Drop for S {
fn drop(&mut self) {
println!("Hello!");
}
}

const fn foo() {
let s = S; //~ destructor
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/consts/drop_zst.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0493]: destructors cannot be evaluated at compile-time
--> $DIR/drop_zst.rs:14:9
|
LL | let s = S;
| ^ constant functions cannot evaluate destructors

error: aborting due to previous error

For more information about this error, try `rustc --explain E0493`.

0 comments on commit 37fa925

Please sign in to comment.