summaryrefslogtreecommitdiff
path: root/tests/ui/associated-inherent-types/late-bound-regions.rs
blob: 488a2cda649ce9d71727b83e9a17ac4a1a446011 (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
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

// Test if we correctly normalize `S<'a>::P` with respect to late-bound regions.

type Function = for<'a> fn(&'a i32) -> S<'a>::P;

struct S<'a>(&'a ());

trait Inter {
    type P;
}

impl<'a> S<'a> {
    type P = &'a i32;
}

fn ret_ref_local<'e>() -> &'e i32 {
    let f: Function = |x| x;

    let local = 0;
    f(&local) //~ ERROR cannot return value referencing local variable `local`
}

fn main() {}