A more powerful `impl Trait`


#1

I would quite like to do things like

fn test() -> Result<impl Trait, impl Error>

or even

fn test<'a>(&'a self) -> impl Deref<Target = impl Iterator<Item=u8>> + 'a

are there any plans to generalise impl Trait to these cases?


#2

These already work - contrived example.


#3

Thanks, I was sure these didn’t work when I tried them - I will try again.


#4

If you try to compile and it doesn’t work, maybe update Rust?