Rustc should be able to unify <T as A<'static>>::B>
with <T as A<'a>>::B>
for all 'a
, given A::B: 'static
#50166
Labels
A-trait-system
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I had to use this trick to work around the lack of working GATs:
Ended up with this code: https://play.rust-lang.org/?gist=5f14fd0600bf0b1e1e9eac2c8a3d194a&version=stable
It works but to be able to do
I had to split up my trait
into two
to pull
Dev
out of the quantification scope of'a
.I thought it should work if I put
Dev
back insideDeviceApp
but make it: 'static
so thatrustc
can infer that it's the same for all'a
:But it doesn't work. Now I get this error:
https://play.rust-lang.org/?gist=d4084c0a87890d4ed17d0491e453565b&version=stable
Why can't
rustc
unify<T as DeviceApp<'static>>::Dev>
with<T as DeviceApp<'a>>::Dev>
for all'a
, when it KNOWS thatDev: 'static
(the type doesn't depend on'a
, so it can only be the same for all'a
)?It should be able to infer it..
The text was updated successfully, but these errors were encountered: