Double same-bound where
clause causes failed type inference
#132667
Labels
A-traits
Area: Trait system
C-bug
Category: This is a bug.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I came across this scenario where having two functions with the same
where
-bounds causes type inference failure:I would expect the type inference to hold up and allow for calling
foo
with aString
constructed inbar
. Instead it fails with a mismatched types error (E0308) sayingexpected type parameter `S`, found `String`
Notably, ANY
String
or&str
constructed inbar
and passed tofoo
will fail type inference. For example:Some examples of similar scenarios that work, but show that there shouldn't be anything wrong with the actual operation (particularly
bap
):Meta
This occurs on stable (1.82.0), beta (1.83.0-beta.4 // 2024-11-02 67512de), and nightly (1.83.0-nightly // 2024-11-03 b8c8287) in debug and release modes.
Full Playground Link
The text was updated successfully, but these errors were encountered: