-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugS-blocked-on-new-solverwill be fixed when we will switch to the new trait solverwill be fixed when we will switch to the new trait solverS-unactionableIssue requires feedback, design decisions or is blocked on other workIssue requires feedback, design decisions or is blocked on other work
Description
The following code fails to infer the type of x, as well as the call to the inherent method as_str:
fn f<T: Into<String>>(u: T) {
let x = u.into();
x.as_str();
}rustc has no problem with this code, since the .into() call will eagerly use the T: Into<String> bound from the where clause. This happens despite plenty of other Into impls existing in the wild and is an intentional Rust feature.
yizhepku
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bugS-blocked-on-new-solverwill be fixed when we will switch to the new trait solverwill be fixed when we will switch to the new trait solverS-unactionableIssue requires feedback, design decisions or is blocked on other workIssue requires feedback, design decisions or is blocked on other work