about summary refs log tree commit diff
path: root/tests/ui/associated-consts/assoc-const-eq-esc-bound-var-in-ty.rs
blob: 6db1e85ccfa6aab32d19a88e4f85dc30491b6e41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Detect and reject escaping late-bound generic params in
// the type of assoc consts used in an equality bound.
#![feature(associated_const_equality)]

trait Trait<'a> {
    const K: &'a ();
}

fn take(_: impl for<'r> Trait<'r, K = { &() }>) {}
//~^ ERROR the type of the associated constant `K` cannot capture late-bound generic parameters
//~| NOTE its type cannot capture the late-bound lifetime parameter `'r`
//~| NOTE the late-bound lifetime parameter `'r` is defined here
//~| NOTE `K` has type `&'r ()`

fn main() {}