mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Put the old resolver back
This commit is contained in:
parent
244d8e37f1
commit
a00fa0c06f
1 changed files with 8 additions and 3 deletions
|
@ -138,8 +138,11 @@ impl<'a> InferenceContext<'a> {
|
||||||
self.coerce_merge_branch(&then_ty, &else_ty)
|
self.coerce_merge_branch(&then_ty, &else_ty)
|
||||||
}
|
}
|
||||||
Expr::Block { statements, tail, label, id: _ } => {
|
Expr::Block { statements, tail, label, id: _ } => {
|
||||||
self.resolver = resolver_for_expr(self.db.upcast(), self.owner, tgt_expr);
|
let old_resolver = mem::replace(
|
||||||
match label {
|
&mut self.resolver,
|
||||||
|
resolver_for_expr(self.db.upcast(), self.owner, tgt_expr),
|
||||||
|
);
|
||||||
|
let ty = match label {
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
let break_ty = self.table.new_type_var();
|
let break_ty = self.table.new_type_var();
|
||||||
self.breakables.push(BreakableContext {
|
self.breakables.push(BreakableContext {
|
||||||
|
@ -157,7 +160,9 @@ impl<'a> InferenceContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => self.infer_block(statements, *tail, expected),
|
None => self.infer_block(statements, *tail, expected),
|
||||||
}
|
};
|
||||||
|
self.resolver = old_resolver;
|
||||||
|
ty
|
||||||
}
|
}
|
||||||
Expr::Unsafe { body } | Expr::Const { body } => self.infer_expr(*body, expected),
|
Expr::Unsafe { body } | Expr::Const { body } => self.infer_expr(*body, expected),
|
||||||
Expr::TryBlock { body } => {
|
Expr::TryBlock { body } => {
|
||||||
|
|
Loading…
Reference in a new issue