Mundane HRTB causes constraint satisfaction failure #97487
Labels
C-bug
Category: This is a bug.
F-generic_associated_types
`#![feature(generic_associated_types)]` a.k.a. GATs
T-types
Relevant to the types team, which will review and decide on the PR/issue.
I'm trying to understand an error I'm seeing with some project code, which I've minimised down to a test case that I'm trying to get my head around.
The following two snippets build perfectly fine, as I would expect:
(https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=052cefcd91b153d1958b8452a9ddbfe7)
(https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=302cd29650a304e40d8ca65bb9d7521d)
However, this third snippet, which combines both the mundane HRTB and the associated type requirement, fails with an obscure error:
(https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=56ad9194355f412f7b22c121ff6479d3)
Giving:
What is it about the HRTB that causes the compiler to suddenly become unable to determine that the type of X must be u32? Am I fundamentally misunderstanding HRTBs?
I ran into this because I needed to
impl
a supertrait with GATs on a type with an existingimpl
of the sub-trait, a la:(https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=74172d3948e66032f917f18fc8cfaf2a)
The text was updated successfully, but these errors were encountered: