Skip to content

Commit 3e7993a

Browse files
mark-i-mMark-Simulacrum
authored andcommitted
Document rustc internal env vars a little bit (#513)
1 parent a6cf284 commit 3e7993a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/building/bootstrapping.md

+17
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,20 @@ links against.
159159
This `stage2/bin/rustc` compiler is shipped to end-users, along with the
160160
`stage 1 {std,rustc}` artifacts.
161161

162+
## Environment Variables
163+
164+
During bootstrapping, there are a bunch of compiler-internal environment
165+
variables that are used. If you are trying to run an intermediate version of
166+
`rustc`, sometimes you may need to set some of these environment variables
167+
manually. Otherwise, you get an error like the following:
168+
169+
```text
170+
thread 'main' panicked at 'RUSTC_STAGE was not set: NotPresent', src/libcore/result.rs:1165:5
171+
```
172+
173+
If `./stageN/bin/rustc` gives an error about environment variables, that
174+
usually means something is quite wrong -- or you're trying to compile e.g.
175+
`librustc` or `libstd` or something that depends on environment variables. In
176+
the unlikely case that you actually need to invoke rustc in such a situation,
177+
you can find the environment variable values by adding the following flag to
178+
your `x.py` command: `--on-fail=print-env`.

0 commit comments

Comments
 (0)