about summary refs log tree commit diff
path: root/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.rs
blob: e714aca812bc786b17a06cb055ec89331179410a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(type_alias_impl_trait)]

trait Captures<'a> {}
impl<T> Captures<'_> for T {}

fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> {
    //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type
    loop {}
}

pub fn main() {
    //~^ ERROR item does not constrain `Opaque::{opaque#0}`
    type Opaque = impl Sized;
    fn define() -> Opaque {
        let x: Opaque = dyn_hoops::<()>();
        x
    }
}