File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/doc/unstable-book/src/compiler-flags Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` RUSTC_OVERRIDE_VERSION_STRING `
2+
3+ This feature is perma-unstable and has no tracking issue.
4+
5+ ----
6+
7+ The ` RUSTC_OVERRIDE_VERSION_STRING ` environment variable overrides the version reported by ` rustc --version ` . For example:
8+
9+ ``` console
10+ $ rustc --version
11+ rustc 1.87.0-nightly (43f0014ef 2025-03-25)
12+ $ env RUSTC_OVERRIDE_VERSION_STRING=1.81.0-nightly rustc --version
13+ rustc 1.81.0-nightly
14+ ```
15+
16+ Note that the version string is completely overwritten; i.e. rustc discards commit hash and commit date information unless it is explicitly included in the environment variable. The string only applies to the "release" part of the version; for example:
17+ ``` console
18+ $ RUSTC_OVERRIDE_VERSION_STRING=" 1.81.0-nightly (aaaaaaaaa 2025-03-22)" rustc -vV
19+ rustc 1.81.0-nightly (aaaaaaaaa 2025-03-22)
20+ binary: rustc
21+ commit-hash: 43f0014ef0f242418674f49052ed39b70f73bc1c
22+ commit-date: 2025-03-25
23+ host: x86_64-unknown-linux-gnu
24+ release: 1.81.0-nightly (aaaaaaaaa 2025-03-22)
25+ LLVM version: 20.1.1
26+ ```
27+
28+ Note here that ` commit-hash ` and ` commit-date ` do not match the values in the string, and ` release ` includes the fake hash and date.
29+
30+ This variable has no effect on whether or not unstable features are allowed to be used. It only affects the output of ` --version ` .
31+
32+ ## Why does this environment variable exist?
33+
34+ Various library crates have incomplete or incorrect feature detection.
35+ This environment variable allows bisecting crates that do incorrect detection with ` version_check::supports_feature ` .
36+
37+ This is not intended to be used for any other case (and, except for bisection, is not particularly useful).
38+
39+ See < https://github.com/rust-lang/rust/pull/124339 > for further discussion.
You can’t perform that action at this time.
0 commit comments