mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Temporary fix for unknown expectations
This commit is contained in:
parent
4ca1981c91
commit
0f7f1f0705
2 changed files with 8 additions and 0 deletions
|
@ -395,6 +395,10 @@ impl<'a> InferenceContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
|
fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
|
||||||
|
// TODO handle expectations properly
|
||||||
|
if ty2.is_unknown() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
self.table.unify(ty1, ty2)
|
self.table.unify(ty1, ty2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ impl<'a> InferenceContext<'a> {
|
||||||
/// Unify two types, but may coerce the first one to the second one
|
/// Unify two types, but may coerce the first one to the second one
|
||||||
/// using "implicit coercion rules" if needed.
|
/// using "implicit coercion rules" if needed.
|
||||||
pub(super) fn coerce(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
|
pub(super) fn coerce(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
|
||||||
|
// TODO handle expectations properly
|
||||||
|
if to_ty.is_unknown() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
let from_ty = self.resolve_ty_shallow(from_ty).into_owned();
|
let from_ty = self.resolve_ty_shallow(from_ty).into_owned();
|
||||||
let to_ty = self.resolve_ty_shallow(to_ty);
|
let to_ty = self.resolve_ty_shallow(to_ty);
|
||||||
match self.coerce_inner(from_ty, &to_ty) {
|
match self.coerce_inner(from_ty, &to_ty) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue