diff options
author | Jonas Schievink <[email protected]> | 2021-04-06 16:59:18 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-04-06 16:59:18 +0100 |
commit | e9752308bbaa2fd720e1eeaca970977fe22514d1 (patch) | |
tree | b391af28f6bfaee53effcc64aeab325e95b5b461 /crates/hir_ty/src/infer | |
parent | 74711deb724e0a6c84a221bfdfa15eaedbdb2300 (diff) |
infer: remove `record_field_resolutions` field
It stores no useful data, since we can derive all fields from
`variant_resolutions`
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 7 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 5b3cdab4e..9ab0fa212 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -21,7 +21,7 @@ use crate::{ | |||
21 | primitive::{self, UintTy}, | 21 | primitive::{self, UintTy}, |
22 | static_lifetime, 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, Generics}, |
25 | AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner, | 25 | AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner, |
26 | ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyExt, TyKind, | 26 | ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyExt, TyKind, |
27 | TypeWalk, | 27 | TypeWalk, |
@@ -414,7 +414,7 @@ impl<'a> InferenceContext<'a> { | |||
414 | 414 | ||
415 | let substs = ty.substs().cloned().unwrap_or_else(|| Substitution::empty(&Interner)); | 415 | let substs = ty.substs().cloned().unwrap_or_else(|| Substitution::empty(&Interner)); |
416 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); | 416 | let field_types = def_id.map(|it| self.db.field_types(it)).unwrap_or_default(); |
417 | let variant_data = def_id.map(|it| variant_data(self.db.upcast(), it)); | 417 | let variant_data = def_id.map(|it| it.variant_data(self.db.upcast())); |
418 | for field in fields.iter() { | 418 | for field in fields.iter() { |
419 | let field_def = | 419 | let field_def = |
420 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { | 420 | variant_data.as_ref().and_then(|it| match it.field(&field.name) { |
@@ -426,9 +426,6 @@ impl<'a> InferenceContext<'a> { | |||
426 | None | 426 | None |
427 | } | 427 | } |
428 | }); | 428 | }); |
429 | if let Some(field_def) = field_def { | ||
430 | self.result.record_field_resolutions.insert(field.expr, field_def); | ||
431 | } | ||
432 | let field_ty = field_def.map_or(self.err_ty(), |it| { | 429 | let field_ty = field_def.map_or(self.err_ty(), |it| { |
433 | field_types[it.local_id].clone().substitute(&Interner, &substs) | 430 | field_types[it.local_id].clone().substitute(&Interner, &substs) |
434 | }); | 431 | }); |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 12431ae07..942f70edf 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -13,8 +13,8 @@ use hir_expand::name::Name; | |||
13 | 13 | ||
14 | use super::{BindingMode, Expectation, InferenceContext}; | 14 | use super::{BindingMode, Expectation, InferenceContext}; |
15 | use crate::{ | 15 | use crate::{ |
16 | lower::lower_to_chalk_mutability, static_lifetime, utils::variant_data, Interner, Substitution, | 16 | lower::lower_to_chalk_mutability, static_lifetime, Interner, Substitution, Ty, TyBuilder, |
17 | Ty, TyBuilder, TyExt, TyKind, | 17 | TyExt, TyKind, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | impl<'a> InferenceContext<'a> { | 20 | impl<'a> InferenceContext<'a> { |
@@ -28,7 +28,7 @@ impl<'a> InferenceContext<'a> { | |||
28 | ellipsis: Option<usize>, | 28 | ellipsis: Option<usize>, |
29 | ) -> Ty { | 29 | ) -> Ty { |
30 | let (ty, def) = self.resolve_variant(path); | 30 | let (ty, def) = self.resolve_variant(path); |
31 | let var_data = def.map(|it| variant_data(self.db.upcast(), it)); | 31 | let var_data = def.map(|it| it.variant_data(self.db.upcast())); |
32 | if let Some(variant) = def { | 32 | if let Some(variant) = def { |
33 | self.write_variant_resolution(id.into(), variant); | 33 | self.write_variant_resolution(id.into(), variant); |
34 | } | 34 | } |
@@ -68,7 +68,7 @@ impl<'a> InferenceContext<'a> { | |||
68 | id: PatId, | 68 | id: PatId, |
69 | ) -> Ty { | 69 | ) -> Ty { |
70 | let (ty, def) = self.resolve_variant(path); | 70 | let (ty, def) = self.resolve_variant(path); |
71 | let var_data = def.map(|it| variant_data(self.db.upcast(), it)); | 71 | let var_data = def.map(|it| it.variant_data(self.db.upcast())); |
72 | if let Some(variant) = def { | 72 | if let Some(variant) = def { |
73 | self.write_variant_resolution(id.into(), variant); | 73 | self.write_variant_resolution(id.into(), variant); |
74 | } | 74 | } |