Inference poisoned by presence of unrelated impl #130180
Labels
A-trait-system
Area: Trait system
fixed-by-next-solver
Fixed by the next-generation trait solver, `-Znext-solver`.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
The following code compiles fine:
Here,
dothing_str()
simply uses return type inference to resolvedothing()
todothing::<str>()
. Quite straightforward, nothing fancy.However, if you add in the following type, inference gets poisoned:
Instead of trying to resolve
Box<str>: Deserialize
(reasonable), it tries to resolveBox<Poison<Poison<Poison<Poison<Poison<Poison<Poison<Poison<Poison<Poison<Poison<Poison<...>>>>>>>>>>>>>: Deserialize
. Note that this happens even if you replace thefor<'de> ... Deserialize<'de>
withDeserialize<'static>
, this isn't Yet Another HRTB issue.Full error
The poisoning is fixed by explicitly invoking
dothing::<str>()
. It's the return type inference that's getting grossly misled here, and it's really unclear as to why.The text was updated successfully, but these errors were encountered: