Comments (10)
Most of the listed variables are used by the build system and test suite, not compiler itself.
Many of them are also implementation details (they are both set and read internally) that are not supposed to be set from the outside of rustbuild.
(P.S. I suspect the meaning of many of internal variables could could be more clear if naming schemes were more explicit and consistent, e.g. everything used by bootstrap/bin/rustc.rs
could be prefixed with RUSTC_WRAPPER_
, bootstrap/bin/rustdoc.rs
- RUSTDOC_WRAPPER_
, etc.)
from rustc-dev-guide.
There was some semi-recent discussion bemoaning the compilers undiscoverable environment variables; I suggested there that it might be a good idea to extend the rustc --help -v
output to include a section dedicated to environment variables.
from rustc-dev-guide.
Note: I believe this is dfferent from rust-lang/rust#44074, as this is concerned with the environment variables used for building the compiler itself, not the environment variables that the compiler uses.
However, stage0 probably makes use of the latter. I'm not sure how to manage the fact that those are related -- we probably need to document both.
rust-lang/rust#44074 also brings up the env!
macro. Please let me know if there are other ways to get environment variables than env::var(_os)
(rust) and os.environ.get
(python). Hopefully we don't have too many bash scripts, as it would just look like plain old variables there...
from rustc-dev-guide.
the rustc
and libdir
variables appear to be "RUSTC_STAGE"
, "RUSTC_REAL"
, "RUSTC_SNAPSHOT_LIBDIR"
, "RUSTC_LIBDIR"
let (rustc, libdir) = if target.is_none() && version.is_none() {
("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
} else {
("RUSTC_REAL", "RUSTC_LIBDIR")
};
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
let mut on_fail = env::var_os("RUSTC_ON_FAIL").map(|of| Command::new(of));
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
let mut cmd = Command::new(rustc);
cmd.args(&args)
from rustc-dev-guide.
Also be wary of code that does use std::env::var;
and uses it simply as var
.
from rustc-dev-guide.
Triage: we now have a home for this kind of information https://doc.rust-lang.org/rustc/
from rustc-dev-guide.
(But in practice if we want such a list to be kept up to date, we'll need an API for defining the environment variables in active use by the compiler, much the same way that we define e.g. command line switches via a standard API...)
from rustc-dev-guide.
Has there been any progress on this?
from rustc-dev-guide.
Fyi
from rustc-dev-guide.
Most of the listed variables are used by the build system and test suite, not compiler itself.
Many of them are also implementation details (they are both set and read internally) that are not supposed to be set from the outside of rustbuild.
I agree with this. Given that we document how to replicate the environment variables for a given run (https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html#environment-variables) I don't think it's important to document the variables themselves - the supported interface here is config.toml, not the env vars. If we were going to document this it would live in src/bootstrap/README.md
anyway, not the external facing docs.
from rustc-dev-guide.
Related Issues (20)
- Example in "Getting diagnostic through `rustc_interface`" is outdated and meaningless
- Modifying AST
- Date Reference Triage for 2024-01
- Getting Started page "help-wanted-search" link goes to a 404 Github page HOT 2
- Broken link in Canonicalization chapter HOT 3
- In Compiler Architecture section, state explicitly you assume the compiler do not change between build
- Clarify what is a UI test HOT 4
- Clarify why Salsa is mentioned HOT 2
- Not clear sentence "Eager expansion generally performs a subset of the things that lazy (normal) expansion does."
- In macro expansion section, explains why import and collections must be redone
- Clarify "call site hierarchy" in macro
- Date Reference Triage for 2024-02 HOT 1
- Appendix D: Compiler Lecture Series: Update
- HIR documentation is outdated
- Diagnostic/subdiagnostic example struct /struct field fluent slugs outdated
- Date Reference Triage for 2024-03 HOT 1
- Date Reference Triage for 2024-04 HOT 1
- Automated Dead Link Detection HOT 1
- Guide answers "what" but not "why" and "how" for codegen tests
- Date Reference Triage for 2024-05
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustc-dev-guide.