From 1f0e9c149f97eba98a34215a043b81b11f962298 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sat, 13 Jul 2019 21:26:04 +0300 Subject: More resolution modules with attribute path #1211 --- crates/ra_hir/src/nameres/collector.rs | 20 +- crates/ra_hir/src/nameres/tests/mods.rs | 505 ++++++++++++++++++++++++++++++++ 2 files changed, 521 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 552a1b6d9..7eee3cb38 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -84,7 +84,7 @@ struct DefCollector { global_macro_scope: FxHashMap, /// Some macro use `$tt:tt which mean we have to handle the macro perfectly - /// To prevent stackoverflow, we add a deep counter here for prevent that. + /// To prevent stack overflow, we add a deep counter here for prevent that. macro_stack_monitor: MacroStackMonitor, } @@ -497,7 +497,7 @@ where fn collect_module(&mut self, module: &raw::ModuleData) { match module { - // inline module, just recurse + // inline module, just recursive raw::ModuleData::Definition { name, items, ast_id } => { let module_id = self.push_child_module(name.clone(), ast_id.with_file_id(self.file_id), None); @@ -509,7 +509,7 @@ where } .collect(&*items); } - // out of line module, resolve, parse and recurse + // out of line module, resolve, parse and recursive raw::ModuleData::Declaration { name, ast_id, attr_path } => { let ast_id = ast_id.with_file_id(self.file_id); let is_root = self.def_collector.def_map.modules[self.module_id].parent.is_none(); @@ -649,7 +649,8 @@ fn resolve_submodule( let file_dir_mod = dir_path.join(format!("{}/{}.rs", mod_name, name)); let mut candidates = ArrayVec::<[_; 3]>::new(); let file_attr_mod = attr_path.map(|file_path| { - let file_attr_mod = dir_path.join(file_path.to_string()); + let file_path = normalize_attribute_path(file_path); + let file_attr_mod = dir_path.join(file_path).normalize(); candidates.push(file_attr_mod.clone()); file_attr_mod @@ -675,6 +676,17 @@ fn resolve_submodule( } } +fn normalize_attribute_path(file_path: &SmolStr) -> String { + let current_dir = "./"; + + let separator = |path: &str| path.replace("\\", "/"); + if file_path.starts_with(current_dir) { + separator(&file_path[current_dir.len()..]) + } else { + separator(file_path.as_str()) + } +} + #[cfg(test)] mod tests { use ra_db::SourceDatabase; diff --git a/crates/ra_hir/src/nameres/tests/mods.rs b/crates/ra_hir/src/nameres/tests/mods.rs index 7c8c832fc..c36054c4b 100644 --- a/crates/ra_hir/src/nameres/tests/mods.rs +++ b/crates/ra_hir/src/nameres/tests/mods.rs @@ -172,6 +172,511 @@ fn module_resolution_module_with_path_non_crate_root() { "###); } +#[test] +fn module_resolution_module_decl_path_super() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"bar/baz/module.rs\"] + mod foo; + pub struct Baz; + + //- /bar/baz/module.rs + use super::Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮Baz: t v + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_explicit_path_mod_rs() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"module/mod.rs\"] + mod foo; + + //- /module/mod.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_relative_path() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo; + + //- /foo.rs + #[path = \"./sub.rs\"] + pub mod foo_bar; + + //- /sub.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮foo_bar: t + ⋮ + ⋮crate::foo::foo_bar + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_relative_path_2() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo; + + //- /foo/mod.rs + #[path=\"../sub.rs\"] + pub mod foo_bar; + + //- /sub.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮foo_bar: t + ⋮ + ⋮crate::foo::foo_bar + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_explicit_path_mod_rs_2() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"module/bar/mod.rs\"] + mod foo; + + //- /module/bar/mod.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_explicit_path_mod_rs_with_win_separator() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"module\\bar\\mod.rs\"] + mod foo; + + //- /module/bar/mod.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"models\"] + mod foo { + mod bar; + } + + //- /models/bar.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_2() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"models/db\"] + mod foo { + mod bar; + } + + //- /models/db/bar.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_3() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"models/db\"] + mod foo { + #[path = \"users.rs\"] + mod bar; + } + + //- /models/db/users.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_empty_path() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"\"] + mod foo { + #[path = \"users.rs\"] + mod bar; + } + + //- /users.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +#[test] +fn module_resolution_decl_empty_path() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"\"] + mod foo; + + //- /foo.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_relative_path() { + let map = def_map_with_crate_graph( + " + //- /main.rs + #[path = \"./models\"] + mod foo { + mod bar; + } + + //- /models/bar.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_in_crate_root() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo { + #[path = \"baz.rs\"] + mod bar; + } + use self::foo::bar::Baz; + + //- /foo/baz.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮Baz: t v + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_in_mod_rs() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo; + + //- /foo/mod.rs + mod bar { + #[path = \"qwe.rs\"] + pub mod baz; + } + use self::bar::baz::Baz; + + //- /foo/bar/qwe.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮baz: t + ⋮ + ⋮crate::foo::bar::baz + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_in_non_crate_root() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo; + + //- /foo.rs + mod bar { + #[path = \"qwe.rs\"] + pub mod baz; + } + use self::bar::baz::Baz; + + //- /foo/bar/qwe.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮baz: t + ⋮ + ⋮crate::foo::bar::baz + ⋮Baz: t v + "###); +} + +// FIXME: issue #1510. not support out-of-line modules inside inline. +#[test] +#[ignore] +fn module_resolution_decl_inside_inline_module_in_non_crate_root_2() { + let map = def_map_with_crate_graph( + " + //- /main.rs + mod foo; + + //- /foo.rs + #[path = \"bar\"] + mod bar { + pub mod baz; + } + use self::bar::baz::Baz; + + //- /bar/baz.rs + pub struct Baz; + ", + crate_graph! { + "main": ("/main.rs", []), + }, + ); + + assert_snapshot_matches!(map, @r###" + ⋮crate + ⋮foo: t + ⋮ + ⋮crate::foo + ⋮Baz: t v + ⋮bar: t + ⋮ + ⋮crate::foo::bar + ⋮baz: t + ⋮ + ⋮crate::foo::bar::baz + ⋮Baz: t v + "###); +} + #[test] fn unresolved_module_diagnostics() { let diagnostics = MockDatabase::with_files( -- cgit v1.2.3 From 22b863c53401971200ed0d94a6f4d9389891c608 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sat, 13 Jul 2019 21:51:20 +0300 Subject: Fixed comments --- crates/ra_hir/src/nameres/collector.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 7eee3cb38..b8840e37c 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -497,7 +497,7 @@ where fn collect_module(&mut self, module: &raw::ModuleData) { match module { - // inline module, just recursive + // inline module, just recurse raw::ModuleData::Definition { name, items, ast_id } => { let module_id = self.push_child_module(name.clone(), ast_id.with_file_id(self.file_id), None); @@ -509,7 +509,7 @@ where } .collect(&*items); } - // out of line module, resolve, parse and recursive + // out of line module, resolve, parse and recurse raw::ModuleData::Declaration { name, ast_id, attr_path } => { let ast_id = ast_id.with_file_id(self.file_id); let is_root = self.def_collector.def_map.modules[self.module_id].parent.is_none(); -- cgit v1.2.3 From 9c75f30272d8c520089a9937544bb77423b52a5c Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sun, 14 Jul 2019 09:24:18 +0300 Subject: Fixed request comments --- crates/ra_hir/src/nameres/collector.rs | 20 ++++-- crates/ra_hir/src/nameres/tests/mods.rs | 118 ++++++++++++++++---------------- 2 files changed, 72 insertions(+), 66 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index b8840e37c..7f765caf3 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use arrayvec::ArrayVec; use ra_db::FileId; use ra_syntax::{ast, SmolStr}; @@ -650,7 +652,7 @@ fn resolve_submodule( let mut candidates = ArrayVec::<[_; 3]>::new(); let file_attr_mod = attr_path.map(|file_path| { let file_path = normalize_attribute_path(file_path); - let file_attr_mod = dir_path.join(file_path).normalize(); + let file_attr_mod = dir_path.join(file_path.as_ref()).normalize(); candidates.push(file_attr_mod.clone()); file_attr_mod @@ -676,14 +678,18 @@ fn resolve_submodule( } } -fn normalize_attribute_path(file_path: &SmolStr) -> String { +fn normalize_attribute_path(file_path: &SmolStr) -> Cow { let current_dir = "./"; - - let separator = |path: &str| path.replace("\\", "/"); - if file_path.starts_with(current_dir) { - separator(&file_path[current_dir.len()..]) + let windows_path_separator = r#"\"#; + let current_dir_normalize = if file_path.starts_with(current_dir) { + &file_path[current_dir.len()..] + } else { + file_path.as_str() + }; + if current_dir_normalize.contains(windows_path_separator) { + Cow::Owned(current_dir_normalize.replace(windows_path_separator, "/")) } else { - separator(file_path.as_str()) + Cow::Borrowed(current_dir_normalize) } } diff --git a/crates/ra_hir/src/nameres/tests/mods.rs b/crates/ra_hir/src/nameres/tests/mods.rs index c36054c4b..d714a3276 100644 --- a/crates/ra_hir/src/nameres/tests/mods.rs +++ b/crates/ra_hir/src/nameres/tests/mods.rs @@ -80,15 +80,15 @@ fn module_resolution_works_for_raw_modules() { #[test] fn module_resolution_decl_path() { let map = def_map_with_crate_graph( - " + r###" //- /library.rs - #[path = \"bar/baz/foo.rs\"] + #[path = "bar/baz/foo.rs"] mod foo; use self::foo::Bar; //- /bar/baz/foo.rs pub struct Bar; - ", + "###, crate_graph! { "library": ("/library.rs", []), }, @@ -107,19 +107,19 @@ fn module_resolution_decl_path() { #[test] fn module_resolution_module_with_path_in_mod_rs() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo/mod.rs - #[path = \"baz.rs\"] + #[path = "baz.rs"] pub mod bar; use self::bar::Baz; //- /foo/baz.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -141,19 +141,19 @@ fn module_resolution_module_with_path_in_mod_rs() { #[test] fn module_resolution_module_with_path_non_crate_root() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo.rs - #[path = \"baz.rs\"] + #[path = "baz.rs"] pub mod bar; use self::bar::Baz; //- /baz.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -175,15 +175,15 @@ fn module_resolution_module_with_path_non_crate_root() { #[test] fn module_resolution_module_decl_path_super() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"bar/baz/module.rs\"] + #[path = "bar/baz/module.rs"] mod foo; pub struct Baz; //- /bar/baz/module.rs use super::Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -202,14 +202,14 @@ fn module_resolution_module_decl_path_super() { #[test] fn module_resolution_explicit_path_mod_rs() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"module/mod.rs\"] + #[path = "module/mod.rs"] mod foo; //- /module/mod.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -227,17 +227,17 @@ fn module_resolution_explicit_path_mod_rs() { #[test] fn module_resolution_relative_path() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo.rs - #[path = \"./sub.rs\"] + #[path = "./sub.rs"] pub mod foo_bar; //- /sub.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -258,17 +258,17 @@ fn module_resolution_relative_path() { #[test] fn module_resolution_relative_path_2() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo/mod.rs - #[path=\"../sub.rs\"] + #[path="../sub.rs"] pub mod foo_bar; //- /sub.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -289,14 +289,14 @@ fn module_resolution_relative_path_2() { #[test] fn module_resolution_explicit_path_mod_rs_2() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"module/bar/mod.rs\"] + #[path = "module/bar/mod.rs"] mod foo; //- /module/bar/mod.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -314,14 +314,14 @@ fn module_resolution_explicit_path_mod_rs_2() { #[test] fn module_resolution_explicit_path_mod_rs_with_win_separator() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"module\\bar\\mod.rs\"] + #[path = "module\bar\mod.rs"] mod foo; //- /module/bar/mod.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -341,16 +341,16 @@ fn module_resolution_explicit_path_mod_rs_with_win_separator() { #[ignore] fn module_resolution_decl_inside_inline_module() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"models\"] + #[path = "models"] mod foo { mod bar; } //- /models/bar.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -373,16 +373,16 @@ fn module_resolution_decl_inside_inline_module() { #[ignore] fn module_resolution_decl_inside_inline_module_2() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"models/db\"] + #[path = "models/db"] mod foo { mod bar; } //- /models/db/bar.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -405,17 +405,17 @@ fn module_resolution_decl_inside_inline_module_2() { #[ignore] fn module_resolution_decl_inside_inline_module_3() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"models/db\"] + #[path = "models/db"] mod foo { - #[path = \"users.rs\"] + #[path = "users.rs"] mod bar; } //- /models/db/users.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -438,17 +438,17 @@ fn module_resolution_decl_inside_inline_module_3() { #[ignore] fn module_resolution_decl_inside_inline_module_empty_path() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"\"] + #[path = ""] mod foo { - #[path = \"users.rs\"] + #[path = "users.rs"] mod bar; } //- /users.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -469,14 +469,14 @@ fn module_resolution_decl_inside_inline_module_empty_path() { #[test] fn module_resolution_decl_empty_path() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"\"] + #[path = ""] mod foo; //- /foo.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -496,16 +496,16 @@ fn module_resolution_decl_empty_path() { #[ignore] fn module_resolution_decl_inside_inline_module_relative_path() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs - #[path = \"./models\"] + #[path = "./models"] mod foo { mod bar; } //- /models/bar.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -528,17 +528,17 @@ fn module_resolution_decl_inside_inline_module_relative_path() { #[ignore] fn module_resolution_decl_inside_inline_module_in_crate_root() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo { - #[path = \"baz.rs\"] + #[path = "baz.rs"] mod bar; } use self::foo::bar::Baz; //- /foo/baz.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -562,20 +562,20 @@ fn module_resolution_decl_inside_inline_module_in_crate_root() { #[ignore] fn module_resolution_decl_inside_inline_module_in_mod_rs() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo/mod.rs mod bar { - #[path = \"qwe.rs\"] + #[path = "qwe.rs"] pub mod baz; } use self::bar::baz::Baz; //- /foo/bar/qwe.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -602,20 +602,20 @@ fn module_resolution_decl_inside_inline_module_in_mod_rs() { #[ignore] fn module_resolution_decl_inside_inline_module_in_non_crate_root() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo.rs mod bar { - #[path = \"qwe.rs\"] + #[path = "qwe.rs"] pub mod baz; } use self::bar::baz::Baz; //- /foo/bar/qwe.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, @@ -642,12 +642,12 @@ fn module_resolution_decl_inside_inline_module_in_non_crate_root() { #[ignore] fn module_resolution_decl_inside_inline_module_in_non_crate_root_2() { let map = def_map_with_crate_graph( - " + r###" //- /main.rs mod foo; //- /foo.rs - #[path = \"bar\"] + #[path = "bar"] mod bar { pub mod baz; } @@ -655,7 +655,7 @@ fn module_resolution_decl_inside_inline_module_in_non_crate_root_2() { //- /bar/baz.rs pub struct Baz; - ", + "###, crate_graph! { "main": ("/main.rs", []), }, -- cgit v1.2.3