summary refs log tree commit diff
path: root/src/test/ui/impl-trait/bindings.rs
blob: 104a44d65662e94b40f06e8b877fa26f7e531189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash

fn a<T: Clone>(x: T) {
    const foo: impl Clone = x;
    //~^ ERROR attempt to use a non-constant value in a constant
}

fn b<T: Clone>(x: T) {
    let _ = move || {
        const foo: impl Clone = x;
        //~^ ERROR attempt to use a non-constant value in a constant
    };
}

trait Foo<T: Clone> {
    fn a(x: T) {
        const foo: impl Clone = x;
        //~^ ERROR attempt to use a non-constant value in a constant
    }
}

impl<T: Clone> Foo<T> for i32 {
    fn a(x: T) {
        const foo: impl Clone = x;
        //~^ ERROR attempt to use a non-constant value in a constant
    }
}

fn main() { }