TAITs with different args incorrectly assumed to be equal · Issue #122876 · rust-lang/rust (original) (raw)

The following should not compile. Adapted from #115017.

#![feature(type_alias_impl_trait)]

type Opaque<'a> = impl Sized;

fn get_one<'a>(a: *mut &'a str) -> Opaque<'a> { a }

fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> { None::<Opaque<'static>> }

This is a quick issue, I did not have the chance to look into it deeper but I guess it affects ATPIT as well.
cc @compiler-errors @oli-obk