A more powerful `impl Trait`

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?

These already work - contrived example.

2 Likes

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

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