Fix #3373
Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code.
This commit is contained in:
@@ -1048,6 +1048,25 @@ where
|
||||
assert_eq!(t, "{unknown}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn method_resolution_3373() {
|
||||
let t = type_at(
|
||||
r#"
|
||||
//- /main.rs
|
||||
struct A<T>(T);
|
||||
|
||||
impl A<i32> {
|
||||
fn from(v: i32) -> A<i32> { A(v) }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
A::from(3)<|>;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
assert_eq!(t, "A<i32>");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn method_resolution_slow() {
|
||||
// this can get quite slow if we set the solver size limit too high
|
||||
|
||||
Reference in New Issue
Block a user