about summary refs log tree commit diff
path: root/tests/ui/consts/promoted-const-drop.rs
blob: b7d92d6523a81da72907c3661aae26da0845389f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(const_trait_impl)]
#![feature(const_mut_refs)]

struct A();

impl const Drop for A {
    //~^ ERROR const `impl` for trait `Drop` which is not marked with `#[const_trait]`
    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
}