Make #[path] always relative to the current directory#55560
Make #[path] always relative to the current directory#55560cramertj wants to merge 4 commits intorust-lang:masterfrom
Conversation
Previously, #[path] would be relative to the current
directory plus an offset for any inline modules.
However, it did not respect the module offset based
on a non-"mod.rs" filename unless there was *also*
a nested module.
After this commit, #[path] ignores inline modules
and is only ever relative to the current directory.
This means that the old #[path = ...] mod x { ... }
(#[path] applied to inline modules) no longer has
any effect.
c95f7c9 to
32eec18
Compare
|
One option would be to continue to respect |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Wait, this seems inconsistent with the previous PR (#55192) and is opposite to what I thought you was going to do (so the test change in In my mental model mod x {
mod y;
}is a sugar for mod x {
#[path = "y.rs"] // or #[path = "y/mod.rs"]
mod y;
}and |
|
The reason nobody understands the rules is because there are too many cases that are all treated separately. |
|
@cramertj |
Yes, this is intentional-- it's the sort of regression I was hoping to look for in a crater run.
IMO if |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
That's what I'd expect as well.
That's why I wanted to keep whatever rules exist now and wait for Rust 2021 :) |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors try |
Make #[path] always relative to the current directory
Previously, #[path] would be relative to the current
directory plus an offset for any inline modules.
However, it did not respect the module offset based
on a non-"mod.rs" filename unless there was *also*
a nested module.
After this commit, #[path] ignores inline modules
and is only ever relative to the current directory.
This means that the old #[path = ...] mod x { ... }
(#[path] applied to inline modules) no longer has
any effect.
This is a [breaking change]. Opening to see what a crater run says.
r? @petrochenkov
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
The try build failed because |
|
Closing this as non-viable. |
Previously, #[path] would be relative to the current
directory plus an offset for any inline modules.
However, it did not respect the module offset based
on a non-"mod.rs" filename unless there was also
a nested module.
After this commit, #[path] ignores inline modules
and is only ever relative to the current directory.
This means that the old #[path = ...] mod x { ... }
(#[path] applied to inline modules) no longer has
any effect.
This is a [breaking change]. Opening to see what a crater run says.
r? @petrochenkov