mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Also mark InferenceResult::has_errors flag when there are error types
This commit is contained in:
parent
bb9678ea3b
commit
e0105c473e
2 changed files with 6 additions and 3 deletions
|
@ -701,18 +701,23 @@ impl<'a> InferenceContext<'a> {
|
|||
table.propagate_diverging_flag();
|
||||
for ty in type_of_expr.values_mut() {
|
||||
*ty = table.resolve_completely(ty.clone());
|
||||
*has_errors = *has_errors || ty.contains_unknown();
|
||||
}
|
||||
for ty in type_of_pat.values_mut() {
|
||||
*ty = table.resolve_completely(ty.clone());
|
||||
*has_errors = *has_errors || ty.contains_unknown();
|
||||
}
|
||||
for ty in type_of_binding.values_mut() {
|
||||
*ty = table.resolve_completely(ty.clone());
|
||||
*has_errors = *has_errors || ty.contains_unknown();
|
||||
}
|
||||
for ty in type_of_rpit.values_mut() {
|
||||
*ty = table.resolve_completely(ty.clone());
|
||||
*has_errors = *has_errors || ty.contains_unknown();
|
||||
}
|
||||
for ty in type_of_for_iterator.values_mut() {
|
||||
*ty = table.resolve_completely(ty.clone());
|
||||
*has_errors = *has_errors || ty.contains_unknown();
|
||||
}
|
||||
|
||||
*has_errors = !type_mismatches.is_empty();
|
||||
|
|
|
@ -2160,9 +2160,7 @@ pub fn lower_to_mir(
|
|||
root_expr: ExprId,
|
||||
) -> Result<MirBody> {
|
||||
if infer.has_errors {
|
||||
return Err(MirLowerError::TypeMismatch(
|
||||
infer.type_mismatches().next().map(|(_, it)| it.clone()),
|
||||
));
|
||||
return Err(MirLowerError::TypeMismatch(None));
|
||||
}
|
||||
let mut ctx = MirLowerCtx::new(db, owner, body, infer);
|
||||
// 0 is return local
|
||||
|
|
Loading…
Reference in a new issue