-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed as duplicate of#35016
Labels
A-ASTArea: ASTArea: ASTA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST
Description
I found an interesting quirk of how #[path = ] behaves.
In src/lib.rs:
pub mod inner {
#[path = "foo.rs"] pub mod foo;
}looks for src/inner/foo.rs. One would expect that the path would be relative to the file the code is in, but it appears to be relative to the module's directory.
This gets worse if you try to sidestep this behavior:
pub mod inner {
#[path = "../foo.rs"] pub mod foo;
}This looks for src/inner/../foo.rs. At first glance, that seems fine, but it doesn't work _until you have an inner folder, which is kind of silly.
I'm not sure if we can change the behavior of path to be file-relative rather than module-folder-relative (probably in an edition?), but the second thing might be fixable.
Metadata
Metadata
Assignees
Labels
A-ASTArea: ASTArea: ASTA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST