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.
I found an interesting quirk of how
#[path = ]behaves.In src/lib.rs:
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:
This looks for
src/inner/../foo.rs. At first glance, that seems fine, but it doesn't work _until you have aninnerfolder, which is kind of silly.I'm not sure if we can change the behavior of
pathto be file-relative rather than module-folder-relative (probably in an edition?), but the second thing might be fixable.