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.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 77fb36332..796487d02 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -19,11 +19,11 @@ use crate::{
19 lower::lower_to_chalk_mutability, 19 lower::lower_to_chalk_mutability,
20 method_resolution, op, 20 method_resolution, op,
21 primitive::{self, UintTy}, 21 primitive::{self, UintTy},
22 to_chalk_trait_id, 22 static_lifetime, to_chalk_trait_id,
23 traits::{chalk::from_chalk, FnTrait}, 23 traits::{chalk::from_chalk, FnTrait},
24 utils::{generics, variant_data, Generics}, 24 utils::{generics, variant_data, Generics},
25 AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner, 25 AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner,
26 LifetimeData, ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, 26 ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, TypeWalk,
27}; 27};
28 28
29use super::{ 29use super::{
@@ -527,9 +527,7 @@ impl<'a> InferenceContext<'a> {
527 let inner_ty = self.infer_expr_inner(*expr, &expectation); 527 let inner_ty = self.infer_expr_inner(*expr, &expectation);
528 match rawness { 528 match rawness {
529 Rawness::RawPtr => TyKind::Raw(mutability, inner_ty), 529 Rawness::RawPtr => TyKind::Raw(mutability, inner_ty),
530 Rawness::Ref => { 530 Rawness::Ref => TyKind::Ref(mutability, static_lifetime(), inner_ty),
531 TyKind::Ref(mutability, LifetimeData::Static.intern(&Interner), inner_ty)
532 }
533 } 531 }
534 .intern(&Interner) 532 .intern(&Interner)
535 } 533 }
@@ -732,17 +730,14 @@ impl<'a> InferenceContext<'a> {
732 } 730 }
733 Expr::Literal(lit) => match lit { 731 Expr::Literal(lit) => match lit {
734 Literal::Bool(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner), 732 Literal::Bool(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner),
735 Literal::String(..) => TyKind::Ref( 733 Literal::String(..) => {
736 Mutability::Not, 734 TyKind::Ref(Mutability::Not, static_lifetime(), TyKind::Str.intern(&Interner))
737 LifetimeData::Static.intern(&Interner), 735 .intern(&Interner)
738 TyKind::Str.intern(&Interner), 736 }
739 )
740 .intern(&Interner),
741 Literal::ByteString(..) => { 737 Literal::ByteString(..) => {
742 let byte_type = TyKind::Scalar(Scalar::Uint(UintTy::U8)).intern(&Interner); 738 let byte_type = TyKind::Scalar(Scalar::Uint(UintTy::U8)).intern(&Interner);
743 let array_type = TyKind::Array(byte_type).intern(&Interner); 739 let array_type = TyKind::Array(byte_type).intern(&Interner);
744 TyKind::Ref(Mutability::Not, LifetimeData::Static.intern(&Interner), array_type) 740 TyKind::Ref(Mutability::Not, static_lifetime(), array_type).intern(&Interner)
745 .intern(&Interner)
746 } 741 }
747 Literal::Char(..) => TyKind::Scalar(Scalar::Char).intern(&Interner), 742 Literal::Char(..) => TyKind::Scalar(Scalar::Char).intern(&Interner),
748 Literal::Int(_v, ty) => match ty { 743 Literal::Int(_v, ty) => match ty {