Open Ygg01 opened 7 years ago
@bukowa Making file!
usable at runtime is one of the use cases we've been working towards with the unstable CARGO_RUSTC_CURRENT_DIR
env variable. There has been debate between Cargo and Libs on which should solve the problem and we need to work to resolve it.
From #13644
Discussed this with @Amanieu at RustConf about this.
In stepping through the use cases, he is now leaning towards
file_absolute!()
. This potentially would warn or error if trim paths is enabled.
file!
documentation should be updated to either* unspecified and should only be used for diagnostic output and not for programmatic usage * specified precisely.
This might need to go through compiler (MCP) and libs-api (ACP)...
As we work towards that, we'll need to remove CARGO_RUSTC_CURRENT_DIR
.
Another thought I had was that we could change CARGO_RUSTC_CURRENT_DIR
to always be CARGO_MANIFEST_DIR
if we fixed the rendering if paths from compiler errors. However, this would likely make panic messages confusing.
T-cargo notes:
A
CARGO_RUSTC_CURRENT_DIR
is added as a nightly only environment variable. See https://github.com/rust-lang/cargo/issues/3946#issuecomment-1832514876. Seek for feedback.Hi, while working on using workspace in html5ever, I've ran into issue of needing the
CARGO_WORKSPACE
directory, and being unable, to find it. What I resorted to is essentially,&Path(cargo_manifest).join("..")
which feels hacky.Could
CARGO_WORKSPACE
be added as environment variable? I'm not sure what it should be when there is no workspace defined, I assume it should either returnErr
or default it toCARGO_MANIFEST_DIR
.Sidenote I'm willing to work on this issue, if I could get quick pointers, to what I need to do.