I tried this code:
#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn test() -> impl Sized;
}
impl<'a, T> Foo for T {
fn test() -> &'a () { &() }
}
I expected to see this happen: Fails saying something about unconstrained lifetime parameters
Instead, this happened: Passes 😢
We'll just have to generalize enforce_impl_params_are_constrained to check RPITITs too.
I haven't made a test that actually turns this into an unsoundness, or even really thought if it's unsound, but if conceptually RPITITs are supposed to act like anonymous associated types, this probably shouldn't pass.
I tried this code:
I expected to see this happen: Fails saying something about unconstrained lifetime parameters
Instead, this happened: Passes 😢
We'll just have to generalize
enforce_impl_params_are_constrainedto check RPITITs too.I haven't made a test that actually turns this into an unsoundness, or even really thought if it's unsound, but if conceptually RPITITs are supposed to act like anonymous associated types, this probably shouldn't pass.