You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an interesting quirk of how #[path = ] behaves.
In src/lib.rs:
pubmod inner {#[path = "foo.rs"]pubmod 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:
pubmod inner {#[path = "../foo.rs"]pubmod 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.
The text was updated successfully, but these errors were encountered:
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 aninner
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.The text was updated successfully, but these errors were encountered: