Skip to content

Commit 2c3e207

Browse files
committed
Do not use make use of InferenceResult::has_errors flag for mir building
It generaly does not work as expected right now as we fallback type parameters to errors
1 parent 88b9018 commit 2c3e207

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

crates/hir-ty/src/infer.rs

+3
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ pub struct InferenceResult {
466466
pub type_of_for_iterator: FxHashMap<ExprId, Ty>,
467467
type_mismatches: FxHashMap<ExprOrPatId, TypeMismatch>,
468468
/// Whether there are any type-mismatching errors in the result.
469+
// FIXME: This isn't as useful as initially thought due to us falling back placeholders to
470+
// `TyKind::Error`.
471+
// Which will then mark this field.
469472
pub(crate) has_errors: bool,
470473
/// Interned common types to return references to.
471474
// FIXME: Move this into `InferenceContext`

crates/hir-ty/src/mir/eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ impl Evaluator<'_> {
12021202
ty = z.clone();
12031203
let size = if ty.is_str() {
12041204
if *op != BinOp::Eq {
1205-
never!("Only eq is builtin for `str`");
1205+
never!("Only `eq` is builtin for `str`");
12061206
}
12071207
let ls = from_bytes!(usize, &lc[self.ptr_size()..self.ptr_size() * 2]);
12081208
let rs = from_bytes!(usize, &rc[self.ptr_size()..self.ptr_size() * 2]);

crates/hir-ty/src/mir/lower.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ pub fn lower_to_mir(
21562156
// need to take this input explicitly.
21572157
root_expr: ExprId,
21582158
) -> Result<MirBody> {
2159-
if infer.has_errors {
2159+
if infer.type_mismatches().next().is_some() {
21602160
return Err(MirLowerError::HasErrors);
21612161
}
21622162
let mut ctx = MirLowerCtx::new(db, owner, body, infer);

0 commit comments

Comments
 (0)