aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r--crates/hir_ty/src/infer/expr.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 23d4ac8ef..928ad37a3 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -3,6 +3,7 @@
3use std::iter::{repeat, repeat_with}; 3use std::iter::{repeat, repeat_with};
4use std::{mem, sync::Arc}; 4use std::{mem, sync::Arc};
5 5
6use chalk_ir::TyVariableKind;
6use hir_def::{ 7use hir_def::{
7 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, 8 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
8 path::{GenericArg, GenericArgs}, 9 path::{GenericArg, GenericArgs},
@@ -18,8 +19,8 @@ use crate::{
18 primitive::{self, UintTy}, 19 primitive::{self, UintTy},
19 traits::{FnTrait, InEnvironment}, 20 traits::{FnTrait, InEnvironment},
20 utils::{generics, variant_data, Generics}, 21 utils::{generics, variant_data, Generics},
21 Binders, CallableDefId, FnPointer, FnSig, InferTy, Mutability, Obligation, OpaqueTyId, Rawness, 22 Binders, CallableDefId, FnPointer, FnSig, Mutability, Obligation, OpaqueTyId, Rawness, Scalar,
22 Scalar, Substs, TraitRef, Ty, 23 Substs, TraitRef, Ty,
23}; 24};
24 25
25use super::{ 26use super::{
@@ -527,8 +528,8 @@ impl<'a> InferenceContext<'a> {
527 Ty::Scalar(Scalar::Int(_)) 528 Ty::Scalar(Scalar::Int(_))
528 | Ty::Scalar(Scalar::Uint(_)) 529 | Ty::Scalar(Scalar::Uint(_))
529 | Ty::Scalar(Scalar::Float(_)) 530 | Ty::Scalar(Scalar::Float(_))
530 | Ty::Infer(InferTy::IntVar(..)) 531 | Ty::InferenceVar(_, TyVariableKind::Integer)
531 | Ty::Infer(InferTy::FloatVar(..)) => inner_ty, 532 | Ty::InferenceVar(_, TyVariableKind::Float) => inner_ty,
532 // Otherwise we resolve via the std::ops::Neg trait 533 // Otherwise we resolve via the std::ops::Neg trait
533 _ => self 534 _ => self
534 .resolve_associated_type(inner_ty, self.resolve_ops_neg_output()), 535 .resolve_associated_type(inner_ty, self.resolve_ops_neg_output()),
@@ -540,7 +541,7 @@ impl<'a> InferenceContext<'a> {
540 Ty::Scalar(Scalar::Bool) 541 Ty::Scalar(Scalar::Bool)
541 | Ty::Scalar(Scalar::Int(_)) 542 | Ty::Scalar(Scalar::Int(_))
542 | Ty::Scalar(Scalar::Uint(_)) 543 | Ty::Scalar(Scalar::Uint(_))
543 | Ty::Infer(InferTy::IntVar(..)) => inner_ty, 544 | Ty::InferenceVar(_, TyVariableKind::Integer) => inner_ty,
544 // Otherwise we resolve via the std::ops::Not trait 545 // Otherwise we resolve via the std::ops::Not trait
545 _ => self 546 _ => self
546 .resolve_associated_type(inner_ty, self.resolve_ops_not_output()), 547 .resolve_associated_type(inner_ty, self.resolve_ops_not_output()),
@@ -761,7 +762,7 @@ impl<'a> InferenceContext<'a> {
761 // `!`). 762 // `!`).
762 if self.diverges.is_always() { 763 if self.diverges.is_always() {
763 // we don't even make an attempt at coercion 764 // we don't even make an attempt at coercion
764 self.table.new_maybe_never_type_var() 765 self.table.new_maybe_never_var()
765 } else { 766 } else {
766 self.coerce(&Ty::unit(), expected.coercion_target()); 767 self.coerce(&Ty::unit(), expected.coercion_target());
767 Ty::unit() 768 Ty::unit()