diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index dad1c93c4..84e15385c 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -773,13 +773,13 @@ impl Const { | |||
773 | 773 | ||
774 | #[derive(Debug, Clone, PartialEq, Eq)] | 774 | #[derive(Debug, Clone, PartialEq, Eq)] |
775 | pub struct ConstData { | 775 | pub struct ConstData { |
776 | pub(crate) name: Name, | 776 | pub(crate) name: Option<Name>, |
777 | pub(crate) type_ref: TypeRef, | 777 | pub(crate) type_ref: TypeRef, |
778 | } | 778 | } |
779 | 779 | ||
780 | impl ConstData { | 780 | impl ConstData { |
781 | pub fn name(&self) -> &Name { | 781 | pub fn name(&self) -> Option<&Name> { |
782 | &self.name | 782 | self.name.as_ref() |
783 | } | 783 | } |
784 | 784 | ||
785 | pub fn type_ref(&self) -> &TypeRef { | 785 | pub fn type_ref(&self) -> &TypeRef { |
@@ -804,7 +804,7 @@ impl ConstData { | |||
804 | } | 804 | } |
805 | 805 | ||
806 | fn const_data_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstData> { | 806 | fn const_data_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstData> { |
807 | let name = node.name().map(|n| n.as_name()).unwrap_or_else(Name::missing); | 807 | let name = node.name().map(|n| n.as_name()); |
808 | let type_ref = TypeRef::from_ast_opt(node.ascribed_type()); | 808 | let type_ref = TypeRef::from_ast_opt(node.ascribed_type()); |
809 | let sig = ConstData { name, type_ref }; | 809 | let sig = ConstData { name, type_ref }; |
810 | Arc::new(sig) | 810 | Arc::new(sig) |
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 785499f77..bf9609d8c 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -585,7 +585,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
585 | 585 | ||
586 | crate::ImplItem::Const(konst) => { | 586 | crate::ImplItem::Const(konst) => { |
587 | let data = konst.data(self.db); | 587 | let data = konst.data(self.db); |
588 | if segment.name == *data.name() { | 588 | if Some(&segment.name) == data.name() { |
589 | Some(ValueNs::Const(konst)) | 589 | Some(ValueNs::Const(konst)) |
590 | } else { | 590 | } else { |
591 | None | 591 | None |