summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
blob: eb2fb6e841bce2e2b1454df1ad0cbd2489919f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Check that we validate associated type bounds for trait objects when they
// have bound lifetimes

trait X<'a> {
    type F: FnOnce(&i32) -> &'a i32;
}

fn f<T: for<'r> X<'r> + ?Sized>() {
    None::<T::F>.map(|f| f(&0));
}

fn main() {
    f::<dyn for<'x> X<'x, F = i32>>();
    //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
}