mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 22:16:53 +00:00
Add regression test for #90770
This commit is contained in:
parent
9aaca1d38e
commit
37fa925525
17
src/test/ui/consts/drop_zst.rs
Normal file
17
src/test/ui/consts/drop_zst.rs
Normal file
@ -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
src/test/ui/consts/drop_zst.stderr
Normal file
9
src/test/ui/consts/drop_zst.stderr
Normal file
@ -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`.
|
Loading…
Reference in New Issue
Block a user