aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-29 17:39:58 +0100
committerLukas Wirth <[email protected]>2021-03-29 17:41:21 +0100
commitb4bb7743810b1e6ac8b897a465c430e9ed8d5c44 (patch)
treeeb3952b349ae35246326fd5e28b2839aa9daa491 /crates/hir_def/src/item_tree
parentc2a63b97a80cb738f800da61c64e748994709c31 (diff)
Remove TraitRef::Error
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 4b2af564e..8d3862811 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -536,7 +536,10 @@ impl Ctx {
536 fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> { 536 fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> {
537 let generic_params = 537 let generic_params =
538 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); 538 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def);
539 let target_trait = impl_def.trait_().map(|tr| self.lower_trait_ref(&tr)); 539 // FIXME: If trait lowering fails, due to a non PathType for example, we treat this impl
540 // as if it was an non-trait impl. Ideally we want to create a unique missing ref that only
541 // equals itself.
542 let target_trait = impl_def.trait_().and_then(|tr| self.lower_trait_ref(&tr));
540 let self_ty = self.lower_type_ref(&impl_def.self_ty()?); 543 let self_ty = self.lower_type_ref(&impl_def.self_ty()?);
541 let is_negative = impl_def.excl_token().is_some(); 544 let is_negative = impl_def.excl_token().is_some();
542 545
@@ -740,9 +743,9 @@ impl Ctx {
740 self.data().vis.alloc(vis) 743 self.data().vis.alloc(vis)
741 } 744 }
742 745
743 fn lower_trait_ref(&mut self, trait_ref: &ast::Type) -> Idx<TraitRef> { 746 fn lower_trait_ref(&mut self, trait_ref: &ast::Type) -> Option<Idx<TraitRef>> {
744 let trait_ref = TraitRef::from_ast(&self.body_ctx, trait_ref.clone()); 747 let trait_ref = TraitRef::from_ast(&self.body_ctx, trait_ref.clone())?;
745 self.data().trait_refs.intern(trait_ref) 748 Some(self.data().trait_refs.intern(trait_ref))
746 } 749 }
747 750
748 fn lower_type_ref(&mut self, type_ref: &ast::Type) -> Idx<TypeRef> { 751 fn lower_type_ref(&mut self, type_ref: &ast::Type) -> Idx<TypeRef> {