diff options
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/hir/src/source_analyzer.rs | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 8d00f7401..caa22dace 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -58,9 +58,8 @@ use hir_ty::{ | |||
58 | subst_prefix, | 58 | subst_prefix, |
59 | traits::FnTrait, | 59 | traits::FnTrait, |
60 | AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, CanonicalVarKinds, Cast, | 60 | AliasEq, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, CanonicalVarKinds, Cast, |
61 | DebruijnIndex, InEnvironment, Interner, QuantifiedWhereClause, Scalar, Solution, | 61 | DebruijnIndex, InEnvironment, Interner, QuantifiedWhereClause, Scalar, Solution, Substitution, |
62 | SolutionVariables, Substitution, TraitEnvironment, Ty, TyBuilder, TyDefId, TyExt, TyKind, | 62 | TraitEnvironment, Ty, TyBuilder, TyDefId, TyExt, TyKind, TyVariableKind, WhereClause, |
63 | TyVariableKind, WhereClause, | ||
64 | }; | 63 | }; |
65 | use itertools::Itertools; | 64 | use itertools::Itertools; |
66 | use rustc_hash::FxHashSet; | 65 | use rustc_hash::FxHashSet; |
@@ -1822,8 +1821,9 @@ impl Type { | |||
1822 | ); | 1821 | ); |
1823 | 1822 | ||
1824 | match db.trait_solve(self.krate, goal)? { | 1823 | match db.trait_solve(self.krate, goal)? { |
1825 | Solution::Unique(SolutionVariables(subst)) => subst | 1824 | Solution::Unique(s) => s |
1826 | .value | 1825 | .value |
1826 | .subst | ||
1827 | .interned() | 1827 | .interned() |
1828 | .first() | 1828 | .first() |
1829 | .map(|ty| self.derived(ty.assert_ty_ref(&Interner).clone())), | 1829 | .map(|ty| self.derived(ty.assert_ty_ref(&Interner).clone())), |
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index c013e78d9..ce6f3c008 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs | |||
@@ -185,12 +185,16 @@ impl SourceAnalyzer { | |||
185 | 185 | ||
186 | pub(crate) fn resolve_record_pat_field( | 186 | pub(crate) fn resolve_record_pat_field( |
187 | &self, | 187 | &self, |
188 | _db: &dyn HirDatabase, | 188 | db: &dyn HirDatabase, |
189 | field: &ast::RecordPatField, | 189 | field: &ast::RecordPatField, |
190 | ) -> Option<Field> { | 190 | ) -> Option<Field> { |
191 | let pat_id = self.pat_id(&field.pat()?)?; | 191 | let field_name = field.field_name()?.as_name(); |
192 | let struct_field = self.infer.as_ref()?.record_pat_field_resolution(pat_id)?; | 192 | let record_pat = ast::RecordPat::cast(field.syntax().parent().and_then(|p| p.parent())?)?; |
193 | Some(struct_field.into()) | 193 | let pat_id = self.pat_id(&record_pat.into())?; |
194 | let variant = self.infer.as_ref()?.variant_resolution_for_pat(pat_id)?; | ||
195 | let variant_data = variant.variant_data(db.upcast()); | ||
196 | let field = FieldId { parent: variant, local_id: variant_data.field(&field_name)? }; | ||
197 | Some(field.into()) | ||
194 | } | 198 | } |
195 | 199 | ||
196 | pub(crate) fn resolve_macro_call( | 200 | pub(crate) fn resolve_macro_call( |