mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
fix: replace errors in receiver type when iterating method candidates
This commit is contained in:
parent
009e6ceb1d
commit
11aed78e2b
2 changed files with 23 additions and 3 deletions
|
@ -2601,9 +2601,7 @@ impl Type {
|
||||||
) {
|
) {
|
||||||
// There should be no inference vars in types passed here
|
// There should be no inference vars in types passed here
|
||||||
// FIXME check that?
|
// FIXME check that?
|
||||||
// FIXME replace Unknown by bound vars here
|
let canonical = hir_ty::replace_errors_with_variables(&self.ty);
|
||||||
let canonical =
|
|
||||||
Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(&Interner) };
|
|
||||||
|
|
||||||
let env = self.env.clone();
|
let env = self.env.clone();
|
||||||
let krate = krate.id;
|
let krate = krate.id;
|
||||||
|
|
|
@ -697,4 +697,26 @@ fn f() {
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn completes_method_call_when_receiver_type_has_errors_issue_10297() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- minicore: iterator, sized
|
||||||
|
struct Vec<T>;
|
||||||
|
impl<T> IntoIterator for Vec<T> {
|
||||||
|
type Item = ();
|
||||||
|
type IntoIter = ();
|
||||||
|
fn into_iter(self);
|
||||||
|
}
|
||||||
|
fn main() {
|
||||||
|
let x: Vec<_>;
|
||||||
|
x.$0;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue