Skip to content

Conversation

@rickvanprim
Copy link
Contributor

Updates module_resolution_relative_path_outside_root test to check valid paths outside of the root, by moving the root to a subpath so that paths outside of it are possible. If this would be more appropriate as a new test, or if the original check for an invalid path should be left, I'm happy to update.

check(
r#"
//- /main.rs
//- /a/b/c/d/e/main.rs root:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//- /a/b/c/d/e/main.rs root:
//- /a/b/c/d/e/main.rs crate:main

I think this should do the same without introducnig code for explicit_root handling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That worked. I'll revert the explicit root stuff.

//- /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

@matklad
Copy link
Contributor

matklad commented Nov 3, 2020

bors r+

I think this should pass via bors, but it might need a rebase

@bors
Copy link
Contributor

bors bot commented Nov 3, 2020

@bors bors bot merged commit 8ad01d8 into rust-lang:master Nov 3, 2020
@rickvanprim rickvanprim deleted the module_resolution_relative_path_outside_root branch November 3, 2020 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants