about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/const-in-closure.rs
blob: 0657c5af58837abdda8289b7f53f39047ccbf44a (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
//@ compile-flags: -Znext-solver
//@ check-pass

#![feature(const_trait_impl)]

#[const_trait]
trait Trait {
    fn method();
}

const fn foo<T: Trait>() {
    let _ = || {
        // Make sure this doesn't enforce `T: [const] Trait`
        T::method();
    };
}

fn bar<T: const Trait>() {
    let _ = || {
        // Make sure unconditionally const bounds propagate from parent.
        const {
            T::method();
        };
    };
}

fn main() {}