-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
from-craterA regression found via a crater run, not part of our test suiteA regression found via a crater run, not part of our test suite
Description
trait Trait {
type Assoc;
}
impl<T: Trait> Trait for W<T> {
type Assoc = T::Assoc;
}
impl Trait for i32 {
type Assoc = i32;
}
struct W<T>(T);
fn foo<T: Trait>(_: <T as Trait>::Assoc) -> T {
todo!()
}
fn main() {
let x: W<_> = foo(1);
let _: W<i32> = x;
}fails in the new solver
error[E0282]: type annotations needed
--> src/main.rs:18:23
|
18 | let x: W<_> = foo(1);
| ^ cannot infer typeThe reason is that we fudge inference to compute the expectation for the call to foo. After equating the output of foo with W<?x> its input is <W<?new_var> as Trait>::Assoc with ?new_var :> ?x. We then fudge ?new_var, dropping the way its relatedd to ?x, meaning that this inference variable will never get constrained.
Metadata
Metadata
Assignees
Labels
from-craterA regression found via a crater run, not part of our test suiteA regression found via a crater run, not part of our test suite
Type
Projects
Status
todo