aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/defs.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-10 11:31:55 +0100
committerBenjamin Coenen <[email protected]>2020-05-10 11:31:55 +0100
commite80903a96564c2239489a8c630a4748bf21a3659 (patch)
tree12b31a1fd12deb2120065cea5a558425c8c1984f /crates/ra_ide_db/src/defs.rs
parent6203e9c4faee288f16d93dbb7dd0f1f8df487d83 (diff)
parent4578154b608fa075595103d0c933da60d55b25c8 (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into feat_4348
Diffstat (limited to 'crates/ra_ide_db/src/defs.rs')
-rw-r--r--crates/ra_ide_db/src/defs.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 40d0e77b5..f990e3bb9 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -6,7 +6,7 @@
6// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06). 6// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
7 7
8use hir::{ 8use hir::{
9 Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, 9 Adt, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution,
10 Semantics, TypeParam, Visibility, 10 Semantics, TypeParam, Visibility,
11}; 11};
12use ra_prof::profile; 12use ra_prof::profile;
@@ -47,7 +47,13 @@ impl Definition {
47 match self { 47 match self {
48 Definition::Macro(_) => None, 48 Definition::Macro(_) => None,
49 Definition::Field(sf) => Some(sf.visibility(db)), 49 Definition::Field(sf) => Some(sf.visibility(db)),
50 Definition::ModuleDef(def) => module?.visibility_of(db, def), 50 Definition::ModuleDef(def) => match def {
51 ModuleDef::EnumVariant(id) => {
52 let parent = id.parent_enum(db);
53 module?.visibility_of(db, &ModuleDef::Adt(Adt::Enum(parent)))
54 }
55 _ => module?.visibility_of(db, def),
56 },
51 Definition::SelfType(_) => None, 57 Definition::SelfType(_) => None,
52 Definition::Local(_) => None, 58 Definition::Local(_) => None,
53 Definition::TypeParam(_) => None, 59 Definition::TypeParam(_) => None,