mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
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:
parent
6db2da4993
commit
336a3c6121
4 changed files with 45 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue