rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.63k stars 12.49k forks source link

Unable to see through associated type with where clause on GAT #122745

Open benluelo opened 5 months ago

benluelo commented 5 months ago

Ran into an issue when using GATs with a where clause. I wasn't able to find an existing issue, although I swear I've seen something similar reported before - apologies if this is a duplicate.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=84875b21dcdc81ddc2e1526c2e9b6cc5

It looks like the Self::Output type isn't realized early enough? Ran with latest stable and nightly. This does work with the next trait solver. I feel like this can be reduced further, but I was unable to do so.

workingjubilee commented 5 months ago

@benluelo In the future, please share the nonworking code that you want to make sure will compile:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4ac65c76d86af43f0fd0eaaa8dc6703b

That way a human doesn't have to read (and thus potentially misread) the comments and obey them as directives (especially in this case since there's two things that could be commented/uncommented).

benluelo commented 5 months ago

Ah, my bad, I meant to share a link with the broken line not commented out. Updated the description, thank you!