Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions crates/hir_def/src/nameres/tests/mod_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,26 @@ pub struct Baz;
fn module_resolution_relative_path_outside_root() {
check(
r#"
//- /main.rs
//- /a/b/c/d/e/main.rs crate:main
#[path="../../../../../outside.rs"]
mod foo;

//- /outside.rs
mod bar;

//- /bar.rs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, shouldn't it be /outside/bar.rs? I see that the test passes, so there might be a bug in rust-analyzer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, you're right that should be /outside/bar.rs or /outside/bar/mod.rs. I'll see if I can figure out what's happening there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err actually I think this behavior is correct, my bad. If you declare a non-inline mod, it's located in the same parent as where it's declared. /main.rs: mod foo; -> /foo.rs

pub struct Baz;
"#,
expect![[r#"
crate
"#]],
foo: t

crate::foo
bar: t

crate::foo::bar
Baz: t v
"#]],
);
}

Expand Down