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.rs4
-rw-r--r--crates/ra_hir_def/src/nameres/tests/mod_resolution.rs16
2 files changed, 18 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 5a0eba437..a35ac1024 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -764,7 +764,7 @@ impl ModCollector<'_, '_> {
764 // `#[macro_use] extern crate` is hoisted to imports macros before collecting 764 // `#[macro_use] extern crate` is hoisted to imports macros before collecting
765 // any other items. 765 // any other items.
766 for item in items { 766 for item in items {
767 if self.is_cfg_enabled(self.item_tree.attrs(*item)) { 767 if self.is_cfg_enabled(self.item_tree.attrs((*item).into())) {
768 if let ModItem::ExternCrate(id) = item { 768 if let ModItem::ExternCrate(id) = item {
769 let import = self.item_tree[*id].clone(); 769 let import = self.item_tree[*id].clone();
770 if import.is_macro_use { 770 if import.is_macro_use {
@@ -775,7 +775,7 @@ impl ModCollector<'_, '_> {
775 } 775 }
776 776
777 for &item in items { 777 for &item in items {
778 let attrs = self.item_tree.attrs(item); 778 let attrs = self.item_tree.attrs(item.into());
779 if self.is_cfg_enabled(attrs) { 779 if self.is_cfg_enabled(attrs) {
780 let module = 780 let module =
781 ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id }; 781 ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id };
diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
index e9a5e4cba..753684201 100644
--- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
@@ -335,6 +335,22 @@ fn module_resolution_relative_path_2() {
335} 335}
336 336
337#[test] 337#[test]
338fn module_resolution_relative_path_outside_root() {
339 let map = def_map(
340 r###"
341 //- /main.rs
342
343 #[path="../../../../../outside.rs"]
344 mod foo;
345 "###,
346 );
347
348 assert_snapshot!(map, @r###"
349 â‹®crate
350 "###);
351}
352
353#[test]
338fn module_resolution_explicit_path_mod_rs_2() { 354fn module_resolution_explicit_path_mod_rs_2() {
339 let map = def_map( 355 let map = def_map(
340 r###" 356 r###"