diff options
author | Aleksey Kladov <[email protected]> | 2019-11-21 11:13:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-21 11:13:49 +0000 |
commit | 061e6c77b5fdb63aa1cad63f1420a7fc810fa17d (patch) | |
tree | c24ffc3fe582c84ad78be3129aef472253b5d9f7 /crates | |
parent | 621cf06156975f8bd75e35af46da034f72e11fad (diff) |
Decouple
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/expr.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/impl_block.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 148 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 16 |
6 files changed, 105 insertions, 75 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 550ab1a98..c4935c0d7 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -829,7 +829,7 @@ impl Trait { | |||
829 | } | 829 | } |
830 | 830 | ||
831 | fn direct_super_traits(self, db: &impl HirDatabase) -> Vec<Trait> { | 831 | fn direct_super_traits(self, db: &impl HirDatabase) -> Vec<Trait> { |
832 | let resolver = self.resolver(db); | 832 | let resolver = self.id.resolver(db); |
833 | // returning the iterator directly doesn't easily work because of | 833 | // returning the iterator directly doesn't easily work because of |
834 | // lifetime problems, but since there usually shouldn't be more than a | 834 | // lifetime problems, but since there usually shouldn't be more than a |
835 | // few direct traits this should be fine (we could even use some kind of | 835 | // few direct traits this should be fine (we could even use some kind of |
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 3ca0a4de5..9cdc0c645 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -122,7 +122,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
122 | 122 | ||
123 | let std_result_path = known::std_result_result(); | 123 | let std_result_path = known::std_result_result(); |
124 | 124 | ||
125 | let resolver = self.func.resolver(db); | 125 | let resolver = self.func.id.resolver(db); |
126 | let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) { | 126 | let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) { |
127 | Some(it) => it, | 127 | Some(it) => it, |
128 | _ => return, | 128 | _ => return, |
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 964a3da8c..c84ceee62 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -27,12 +27,12 @@ impl ImplBlock { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | pub fn target_ty(&self, db: &impl HirDatabase) -> Ty { | 29 | pub fn target_ty(&self, db: &impl HirDatabase) -> Ty { |
30 | Ty::from_hir(db, &self.resolver(db), &self.target_type(db)) | 30 | Ty::from_hir(db, &self.id.resolver(db), &self.target_type(db)) |
31 | } | 31 | } |
32 | 32 | ||
33 | pub fn target_trait_ref(&self, db: &impl HirDatabase) -> Option<TraitRef> { | 33 | pub fn target_trait_ref(&self, db: &impl HirDatabase) -> Option<TraitRef> { |
34 | let target_ty = self.target_ty(db); | 34 | let target_ty = self.target_ty(db); |
35 | TraitRef::from_hir(db, &self.resolver(db), &self.target_trait(db)?, Some(target_ty)) | 35 | TraitRef::from_hir(db, &self.id.resolver(db), &self.target_trait(db)?, Some(target_ty)) |
36 | } | 36 | } |
37 | 37 | ||
38 | pub fn items(&self, db: &impl DefDatabase) -> Vec<AssocItem> { | 38 | pub fn items(&self, db: &impl DefDatabase) -> Vec<AssocItem> { |
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 770864ec5..ed9fa0491 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs | |||
@@ -8,18 +8,18 @@ use hir_def::{ | |||
8 | generics::GenericParams, | 8 | generics::GenericParams, |
9 | nameres::CrateDefMap, | 9 | nameres::CrateDefMap, |
10 | path::{Path, PathKind}, | 10 | path::{Path, PathKind}, |
11 | AdtId, ConstId, CrateModuleId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId, | 11 | AdtId, AstItemDef, ConstId, ContainerId, CrateModuleId, DefWithBodyId, EnumId, EnumVariantId, |
12 | ImplId, ModuleDefId, StaticId, StructId, TraitId, TypeAliasId, | 12 | FunctionId, GenericDefId, ImplId, Lookup, ModuleDefId, ModuleId, StaticId, StructId, TraitId, |
13 | TypeAliasId, UnionId, | ||
13 | }; | 14 | }; |
14 | use hir_expand::name::{self, Name}; | 15 | use hir_expand::name::{self, Name}; |
15 | use rustc_hash::FxHashSet; | 16 | use rustc_hash::FxHashSet; |
16 | 17 | ||
17 | use crate::{ | 18 | use crate::{ |
18 | code_model::Crate, | 19 | code_model::Crate, |
19 | db::{DefDatabase, HirDatabase}, | 20 | db::HirDatabase, |
20 | expr::{ExprScopes, PatId, ScopeId}, | 21 | expr::{ExprScopes, PatId, ScopeId}, |
21 | Adt, Const, Container, DefWithBody, Function, GenericDef, ImplBlock, Local, MacroDef, Module, | 22 | Adt, DefWithBody, GenericDef, ImplBlock, Local, MacroDef, ModuleDef, PerNs, |
22 | ModuleDef, PerNs, Static, Trait, TypeAlias, | ||
23 | }; | 23 | }; |
24 | 24 | ||
25 | #[derive(Debug, Clone, Default)] | 25 | #[derive(Debug, Clone, Default)] |
@@ -506,7 +506,7 @@ pub(crate) fn resolver_for_scope( | |||
506 | owner: DefWithBodyId, | 506 | owner: DefWithBodyId, |
507 | scope_id: Option<ScopeId>, | 507 | scope_id: Option<ScopeId>, |
508 | ) -> Resolver { | 508 | ) -> Resolver { |
509 | let mut r = DefWithBody::from(owner).resolver(db); | 509 | let mut r = owner.resolver(db); |
510 | let scopes = db.expr_scopes(owner); | 510 | let scopes = db.expr_scopes(owner); |
511 | let scope_chain = scopes.scope_chain(scope_id).collect::<Vec<_>>(); | 511 | let scope_chain = scopes.scope_chain(scope_id).collect::<Vec<_>>(); |
512 | for scope in scope_chain.into_iter().rev() { | 512 | for scope in scope_chain.into_iter().rev() { |
@@ -517,100 +517,130 @@ pub(crate) fn resolver_for_scope( | |||
517 | 517 | ||
518 | pub(crate) trait HasResolver { | 518 | pub(crate) trait HasResolver { |
519 | /// Builds a resolver for type references inside this def. | 519 | /// Builds a resolver for type references inside this def. |
520 | fn resolver(self, db: &impl DefDatabase) -> Resolver; | 520 | fn resolver(self, db: &impl DefDatabase2) -> Resolver; |
521 | } | 521 | } |
522 | 522 | ||
523 | impl HasResolver for Module { | 523 | impl HasResolver for ModuleId { |
524 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 524 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
525 | let def_map = db.crate_def_map(self.id.krate); | 525 | let def_map = db.crate_def_map(self.krate); |
526 | Resolver::default().push_module_scope(def_map, self.id.module_id) | 526 | Resolver::default().push_module_scope(def_map, self.module_id) |
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | impl HasResolver for Trait { | 530 | impl HasResolver for TraitId { |
531 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 531 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
532 | self.module(db).resolver(db).push_generic_params_scope(db, self.id.into()) | 532 | self.module(db).resolver(db).push_generic_params_scope(db, self.into()) |
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | impl<T: Into<Adt>> HasResolver for T { | 536 | impl HasResolver for AdtId { |
537 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 537 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
538 | let def = self.into(); | 538 | let module = match self { |
539 | def.module(db) | 539 | AdtId::StructId(it) => it.0.module(db), |
540 | AdtId::UnionId(it) => it.0.module(db), | ||
541 | AdtId::EnumId(it) => it.module(db), | ||
542 | }; | ||
543 | |||
544 | module | ||
540 | .resolver(db) | 545 | .resolver(db) |
541 | .push_generic_params_scope(db, def.into()) | 546 | .push_generic_params_scope(db, self.into()) |
542 | .push_scope(Scope::AdtScope(def.into())) | 547 | .push_scope(Scope::AdtScope(self.into())) |
543 | } | 548 | } |
544 | } | 549 | } |
545 | 550 | ||
546 | impl HasResolver for Function { | 551 | impl HasResolver for StructId { |
547 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 552 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
548 | self.container(db) | 553 | AdtId::from(self).resolver(db) |
549 | .map(|c| c.resolver(db)) | ||
550 | .unwrap_or_else(|| self.module(db).resolver(db)) | ||
551 | .push_generic_params_scope(db, self.id.into()) | ||
552 | } | 554 | } |
553 | } | 555 | } |
554 | 556 | ||
555 | impl HasResolver for DefWithBody { | 557 | impl HasResolver for UnionId { |
556 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 558 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
559 | AdtId::from(self).resolver(db) | ||
560 | } | ||
561 | } | ||
562 | |||
563 | impl HasResolver for EnumId { | ||
564 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { | ||
565 | AdtId::from(self).resolver(db) | ||
566 | } | ||
567 | } | ||
568 | |||
569 | impl HasResolver for FunctionId { | ||
570 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { | ||
571 | self.lookup(db).container.resolver(db).push_generic_params_scope(db, self.into()) | ||
572 | } | ||
573 | } | ||
574 | |||
575 | impl HasResolver for DefWithBodyId { | ||
576 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { | ||
557 | match self { | 577 | match self { |
558 | DefWithBody::Const(c) => c.resolver(db), | 578 | DefWithBodyId::ConstId(c) => c.resolver(db), |
559 | DefWithBody::Function(f) => f.resolver(db), | 579 | DefWithBodyId::FunctionId(f) => f.resolver(db), |
560 | DefWithBody::Static(s) => s.resolver(db), | 580 | DefWithBodyId::StaticId(s) => s.resolver(db), |
561 | } | 581 | } |
562 | } | 582 | } |
563 | } | 583 | } |
564 | 584 | ||
565 | impl HasResolver for Const { | 585 | impl HasResolver for ConstId { |
566 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 586 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
567 | self.container(db).map(|c| c.resolver(db)).unwrap_or_else(|| self.module(db).resolver(db)) | 587 | self.lookup(db).container.resolver(db) |
568 | } | 588 | } |
569 | } | 589 | } |
570 | 590 | ||
571 | impl HasResolver for Static { | 591 | impl HasResolver for StaticId { |
572 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 592 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
573 | self.module(db).resolver(db) | 593 | self.module(db).resolver(db) |
574 | } | 594 | } |
575 | } | 595 | } |
576 | 596 | ||
577 | impl HasResolver for TypeAlias { | 597 | impl HasResolver for TypeAliasId { |
578 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 598 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
579 | self.container(db) | 599 | self.lookup(db).container.resolver(db).push_generic_params_scope(db, self.into()) |
580 | .map(|ib| ib.resolver(db)) | ||
581 | .unwrap_or_else(|| self.module(db).resolver(db)) | ||
582 | .push_generic_params_scope(db, self.id.into()) | ||
583 | } | 600 | } |
584 | } | 601 | } |
585 | 602 | ||
586 | impl HasResolver for Container { | 603 | impl HasResolver for ContainerId { |
587 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 604 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
588 | match self { | 605 | match self { |
589 | Container::Trait(trait_) => trait_.resolver(db), | 606 | ContainerId::TraitId(it) => it.resolver(db), |
590 | Container::ImplBlock(impl_block) => impl_block.resolver(db), | 607 | ContainerId::ImplId(it) => it.resolver(db), |
608 | ContainerId::ModuleId(it) => it.resolver(db), | ||
591 | } | 609 | } |
592 | } | 610 | } |
593 | } | 611 | } |
594 | 612 | ||
595 | impl HasResolver for GenericDef { | 613 | impl HasResolver for GenericDefId { |
596 | fn resolver(self, db: &impl DefDatabase) -> crate::Resolver { | 614 | fn resolver(self, db: &impl DefDatabase2) -> crate::Resolver { |
597 | match self { | 615 | match self { |
598 | GenericDef::Function(inner) => inner.resolver(db), | 616 | GenericDefId::FunctionId(inner) => inner.resolver(db), |
599 | GenericDef::Adt(adt) => adt.resolver(db), | 617 | GenericDefId::AdtId(adt) => adt.resolver(db), |
600 | GenericDef::Trait(inner) => inner.resolver(db), | 618 | GenericDefId::TraitId(inner) => inner.resolver(db), |
601 | GenericDef::TypeAlias(inner) => inner.resolver(db), | 619 | GenericDefId::TypeAliasId(inner) => inner.resolver(db), |
602 | GenericDef::ImplBlock(inner) => inner.resolver(db), | 620 | GenericDefId::ImplId(inner) => inner.resolver(db), |
603 | GenericDef::EnumVariant(inner) => inner.parent_enum(db).resolver(db), | 621 | GenericDefId::EnumVariantId(inner) => inner.parent.resolver(db), |
604 | GenericDef::Const(inner) => inner.resolver(db), | 622 | GenericDefId::ConstId(inner) => inner.resolver(db), |
605 | } | 623 | } |
606 | } | 624 | } |
607 | } | 625 | } |
608 | 626 | ||
609 | impl HasResolver for ImplBlock { | 627 | impl HasResolver for ImplId { |
610 | fn resolver(self, db: &impl DefDatabase) -> Resolver { | 628 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { |
611 | self.module(db) | 629 | self.module(db) |
612 | .resolver(db) | 630 | .resolver(db) |
613 | .push_generic_params_scope(db, self.id.into()) | 631 | .push_generic_params_scope(db, self.into()) |
614 | .push_impl_block_scope(self.id) | 632 | .push_impl_block_scope(self) |
633 | } | ||
634 | } | ||
635 | |||
636 | impl HasResolver for GenericDef { | ||
637 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { | ||
638 | GenericDefId::from(self).resolver(db) | ||
639 | } | ||
640 | } | ||
641 | |||
642 | impl HasResolver for DefWithBody { | ||
643 | fn resolver(self, db: &impl DefDatabase2) -> Resolver { | ||
644 | DefWithBodyId::from(self).resolver(db) | ||
615 | } | 645 | } |
616 | } | 646 | } |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 09df4f0aa..8e379498a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -35,19 +35,19 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) - | |||
35 | match (node.value) { | 35 | match (node.value) { |
36 | ast::Module(it) => { | 36 | ast::Module(it) => { |
37 | let src = node.with_value(it); | 37 | let src = node.with_value(it); |
38 | Some(crate::Module::from_declaration(db, src)?.resolver(db)) | 38 | Some(crate::Module::from_declaration(db, src)?.id.resolver(db)) |
39 | }, | 39 | }, |
40 | ast::SourceFile(it) => { | 40 | ast::SourceFile(it) => { |
41 | let src = node.with_value(crate::ModuleSource::SourceFile(it)); | 41 | let src = node.with_value(crate::ModuleSource::SourceFile(it)); |
42 | Some(crate::Module::from_definition(db, src)?.resolver(db)) | 42 | Some(crate::Module::from_definition(db, src)?.id.resolver(db)) |
43 | }, | 43 | }, |
44 | ast::StructDef(it) => { | 44 | ast::StructDef(it) => { |
45 | let src = node.with_value(it); | 45 | let src = node.with_value(it); |
46 | Some(Struct::from_source(db, src)?.resolver(db)) | 46 | Some(Struct::from_source(db, src)?.id.resolver(db)) |
47 | }, | 47 | }, |
48 | ast::EnumDef(it) => { | 48 | ast::EnumDef(it) => { |
49 | let src = node.with_value(it); | 49 | let src = node.with_value(it); |
50 | Some(Enum::from_source(db, src)?.resolver(db)) | 50 | Some(Enum::from_source(db, src)?.id.resolver(db)) |
51 | }, | 51 | }, |
52 | _ => match node.value.kind() { | 52 | _ => match node.value.kind() { |
53 | FN_DEF | CONST_DEF | STATIC_DEF => { | 53 | FN_DEF | CONST_DEF | STATIC_DEF => { |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index d4fbddac0..8ea2806dd 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -553,8 +553,8 @@ pub(crate) fn callable_item_sig(db: &impl HirDatabase, def: CallableDef) -> FnSi | |||
553 | pub(crate) fn type_for_field(db: &impl HirDatabase, field: StructField) -> Ty { | 553 | pub(crate) fn type_for_field(db: &impl HirDatabase, field: StructField) -> Ty { |
554 | let parent_def = field.parent_def(db); | 554 | let parent_def = field.parent_def(db); |
555 | let resolver = match parent_def { | 555 | let resolver = match parent_def { |
556 | VariantDef::Struct(it) => it.resolver(db), | 556 | VariantDef::Struct(it) => it.id.resolver(db), |
557 | VariantDef::EnumVariant(it) => it.parent_enum(db).resolver(db), | 557 | VariantDef::EnumVariant(it) => it.parent.id.resolver(db), |
558 | }; | 558 | }; |
559 | let var_data = parent_def.variant_data(db); | 559 | let var_data = parent_def.variant_data(db); |
560 | let type_ref = &var_data.fields().unwrap()[field.id].type_ref; | 560 | let type_ref = &var_data.fields().unwrap()[field.id].type_ref; |
@@ -623,7 +623,7 @@ pub(crate) fn generic_defaults_query(db: &impl HirDatabase, def: GenericDef) -> | |||
623 | 623 | ||
624 | fn fn_sig_for_fn(db: &impl HirDatabase, def: Function) -> FnSig { | 624 | fn fn_sig_for_fn(db: &impl HirDatabase, def: Function) -> FnSig { |
625 | let data = def.data(db); | 625 | let data = def.data(db); |
626 | let resolver = def.resolver(db); | 626 | let resolver = def.id.resolver(db); |
627 | let params = data.params().iter().map(|tr| Ty::from_hir(db, &resolver, tr)).collect::<Vec<_>>(); | 627 | let params = data.params().iter().map(|tr| Ty::from_hir(db, &resolver, tr)).collect::<Vec<_>>(); |
628 | let ret = Ty::from_hir(db, &resolver, data.ret_type()); | 628 | let ret = Ty::from_hir(db, &resolver, data.ret_type()); |
629 | FnSig::from_params_and_return(params, ret) | 629 | FnSig::from_params_and_return(params, ret) |
@@ -640,7 +640,7 @@ fn type_for_fn(db: &impl HirDatabase, def: Function) -> Ty { | |||
640 | /// Build the declared type of a const. | 640 | /// Build the declared type of a const. |
641 | fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty { | 641 | fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty { |
642 | let data = def.data(db); | 642 | let data = def.data(db); |
643 | let resolver = def.resolver(db); | 643 | let resolver = def.id.resolver(db); |
644 | 644 | ||
645 | Ty::from_hir(db, &resolver, data.type_ref()) | 645 | Ty::from_hir(db, &resolver, data.type_ref()) |
646 | } | 646 | } |
@@ -648,7 +648,7 @@ fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty { | |||
648 | /// Build the declared type of a static. | 648 | /// Build the declared type of a static. |
649 | fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty { | 649 | fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty { |
650 | let data = def.data(db); | 650 | let data = def.data(db); |
651 | let resolver = def.resolver(db); | 651 | let resolver = def.id.resolver(db); |
652 | 652 | ||
653 | Ty::from_hir(db, &resolver, data.type_ref()) | 653 | Ty::from_hir(db, &resolver, data.type_ref()) |
654 | } | 654 | } |
@@ -700,7 +700,7 @@ fn fn_sig_for_struct_constructor(db: &impl HirDatabase, def: Struct) -> FnSig { | |||
700 | Some(fields) => fields, | 700 | Some(fields) => fields, |
701 | None => panic!("fn_sig_for_struct_constructor called on unit struct"), | 701 | None => panic!("fn_sig_for_struct_constructor called on unit struct"), |
702 | }; | 702 | }; |
703 | let resolver = def.resolver(db); | 703 | let resolver = def.id.resolver(db); |
704 | let params = fields | 704 | let params = fields |
705 | .iter() | 705 | .iter() |
706 | .map(|(_, field)| Ty::from_hir(db, &resolver, &field.type_ref)) | 706 | .map(|(_, field)| Ty::from_hir(db, &resolver, &field.type_ref)) |
@@ -726,7 +726,7 @@ fn fn_sig_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariant) | |||
726 | Some(fields) => fields, | 726 | Some(fields) => fields, |
727 | None => panic!("fn_sig_for_enum_variant_constructor called for unit variant"), | 727 | None => panic!("fn_sig_for_enum_variant_constructor called for unit variant"), |
728 | }; | 728 | }; |
729 | let resolver = def.parent_enum(db).resolver(db); | 729 | let resolver = def.parent.id.resolver(db); |
730 | let params = fields | 730 | let params = fields |
731 | .iter() | 731 | .iter() |
732 | .map(|(_, field)| Ty::from_hir(db, &resolver, &field.type_ref)) | 732 | .map(|(_, field)| Ty::from_hir(db, &resolver, &field.type_ref)) |
@@ -755,7 +755,7 @@ fn type_for_adt(db: &impl HirDatabase, adt: impl Into<Adt> + HasGenericParams) - | |||
755 | 755 | ||
756 | fn type_for_type_alias(db: &impl HirDatabase, t: TypeAlias) -> Ty { | 756 | fn type_for_type_alias(db: &impl HirDatabase, t: TypeAlias) -> Ty { |
757 | let generics = t.generic_params(db); | 757 | let generics = t.generic_params(db); |
758 | let resolver = t.resolver(db); | 758 | let resolver = t.id.resolver(db); |
759 | let type_ref = t.type_ref(db); | 759 | let type_ref = t.type_ref(db); |
760 | let substs = Substs::identity(&generics); | 760 | let substs = Substs::identity(&generics); |
761 | let inner = Ty::from_hir(db, &resolver, &type_ref.unwrap_or(TypeRef::Error)); | 761 | let inner = Ty::from_hir(db, &resolver, &type_ref.unwrap_or(TypeRef::Error)); |