rust/tests/ui/consts/promoted-const-drop.rs
2025-01-14 19:12:08 +00:00

15 lines
306 B
Rust

#![feature(const_trait_impl, const_destruct)]
struct A();
impl const Drop for A {
fn drop(&mut self) {}
}
const C: A = A();
fn main() {
let _: &'static A = &A(); //~ ERROR temporary value dropped while borrowed
let _: &'static [A] = &[C]; //~ ERROR temporary value dropped while borrowed
}