aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs7
-rw-r--r--crates/ra_hir_def/src/nameres/tests/globs.rs20
2 files changed, 21 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 63beaedc5..30771d510 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -378,12 +378,7 @@ where
378 .resolutions() 378 .resolutions()
379 // only keep visible names... 379 // only keep visible names...
380 .map(|(n, res)| { 380 .map(|(n, res)| {
381 ( 381 (n, res.filter_visibility(|v| v.visible_from_other_crate()))
382 n,
383 res.filter_visibility(|v| {
384 v.visible_from_def_map(&self.def_map, module_id)
385 }),
386 )
387 }) 382 })
388 .filter(|(_, res)| !res.is_none()) 383 .filter(|(_, res)| !res.is_none())
389 .collect::<Vec<_>>(); 384 .collect::<Vec<_>>();
diff --git a/crates/ra_hir_def/src/nameres/tests/globs.rs b/crates/ra_hir_def/src/nameres/tests/globs.rs
index 82d947b78..71fa0abe8 100644
--- a/crates/ra_hir_def/src/nameres/tests/globs.rs
+++ b/crates/ra_hir_def/src/nameres/tests/globs.rs
@@ -170,6 +170,26 @@ fn glob_across_crates() {
170} 170}
171 171
172#[test] 172#[test]
173fn glob_privacy_across_crates() {
174 covers!(glob_across_crates);
175 let map = def_map(
176 "
177 //- /main.rs crate:main deps:test_crate
178 use test_crate::*;
179
180 //- /lib.rs crate:test_crate
181 pub struct Baz;
182 struct Foo;
183 ",
184 );
185 assert_snapshot!(map, @r###"
186 ⋮crate
187 ⋮Baz: t v
188 "###
189 );
190}
191
192#[test]
173fn glob_enum() { 193fn glob_enum() {
174 covers!(glob_enum); 194 covers!(glob_enum);
175 let map = def_map( 195 let map = def_map(