-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
The following code compiles in rustc:
fn f<T: Into<String>>(u: T) {
let x = u.into();
x.as_str();
}
This works even though there are other (blanket) impls that could apply for the into()
call. rust-analyzer on the other hand can't resolve the type of x
because the T: Into<?>
goal is ambiguous. Note that if we have a struct S
that impls Into<String>
instead of the type parameter T
, we get an ambiguity error (see this playground).
This works because rustc eagerly selects clauses from the environment, before looking at other impls. I think the old recursive solver actually handled this, but we removed the code because we didn't have / come up with a test case for it.
merlinio2000
Metadata
Metadata
Assignees
Labels
No labels