Skip to content

Commit 1cbce47

Browse files
author
Jon Gjengset
committed
Remove RUSTC_VERSION envvar
1 parent 9313266 commit 1cbce47

File tree

4 files changed

+1
-36
lines changed

4 files changed

+1
-36
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,14 +1041,6 @@ pub fn is_nightly() -> bool {
10411041
&& (vv.contains("-nightly") || vv.contains("-dev"))
10421042
}
10431043

1044-
pub fn rustc_release() -> &'static str {
1045-
RUSTC_INFO
1046-
.verbose_version
1047-
.lines()
1048-
.find_map(|line| line.strip_prefix("release: "))
1049-
.expect("verbose version has release: field")
1050-
}
1051-
10521044
pub fn process<T: AsRef<OsStr>>(t: T) -> ProcessBuilder {
10531045
_process(t.as_ref())
10541046
}

src/cargo/core/compiler/custom_build.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,6 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
266266
bcx.rustflags_args(unit).join("\x1f"),
267267
);
268268
cmd.env_remove("RUSTFLAGS");
269-
let version = &bcx.rustc().version;
270-
cmd.env(
271-
"RUSTC_VERSION",
272-
format!("{}.{}.{}", version.major, version.minor, version.patch),
273-
);
274-
cmd.env("RUSTC_VERSION_MAJOR", version.major.to_string());
275-
cmd.env("RUSTC_VERSION_MINOR", version.minor.to_string());
276-
cmd.env("RUSTC_VERSION_PATCH", version.patch.to_string());
277269

278270
// Gather the set of native dependencies that this package has along with
279271
// some other variables to close over.

src/doc/src/reference/environment-variables.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,6 @@ let out_dir = env::var("OUT_DIR").unwrap();
355355
(ASCII Unit Separator). See
356356
[`build.rustflags`].
357357
* `CARGO_PKG_<var>` - The package information variables, with the same names and values as are [provided during crate building][variables set for crates].
358-
* `RUSTC_VERSION` - The version of rustc used by the cargo that invokes
359-
the build script. Its constituent parts are also
360-
available as `RUSTC_VERSION_MAJOR`, `_MINOR`, and
361-
`_PATCH`.
362358

363359
[unix-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows
364360
[windows-like platforms]: ../../reference/conditional-compilation.html#unix-and-windows

tests/testsuite/build_script.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use cargo_test_support::paths::CargoPathExt;
55
use cargo_test_support::registry::Package;
66
use cargo_test_support::tools;
77
use cargo_test_support::{basic_manifest, cross_compile, is_coarse_mtime, project};
8-
use cargo_test_support::{
9-
rustc_host, rustc_release, sleep_ms, slow_cpu_multiplier, symlink_supported,
10-
};
8+
use cargo_test_support::{rustc_host, sleep_ms, slow_cpu_multiplier, symlink_supported};
119
use cargo_util::paths::remove_dir_all;
1210
use std::env;
1311
use std::fs;
@@ -82,7 +80,6 @@ fn custom_build_env_vars() {
8280
)
8381
.file("bar/src/lib.rs", "pub fn hello() {}");
8482

85-
let rustc_version = semver::Version::parse(rustc_release()).unwrap();
8683
let file_content = format!(
8784
r#"
8885
use std::env;
@@ -126,25 +123,13 @@ fn custom_build_env_vars() {
126123
assert!(env::var("RUSTFLAGS").is_err());
127124
let rustflags = env::var("CARGO_ENCODED_RUSTFLAGS").unwrap();
128125
assert_eq!(rustflags, "");
129-
130-
let version = env::var("RUSTC_VERSION").unwrap();
131-
assert_eq!(version, "{1}.{2}.{3}", "bad rust version");
132-
let version = env::var("RUSTC_VERSION_MAJOR").unwrap();
133-
assert_eq!(version, "{1}");
134-
let version = env::var("RUSTC_VERSION_MINOR").unwrap();
135-
assert_eq!(version, "{2}");
136-
let version = env::var("RUSTC_VERSION_PATCH").unwrap();
137-
assert_eq!(version, "{3}");
138126
}}
139127
"#,
140128
p.root()
141129
.join("target")
142130
.join("debug")
143131
.join("build")
144132
.display(),
145-
rustc_version.major,
146-
rustc_version.minor,
147-
rustc_version.patch,
148133
);
149134

150135
let p = p.file("bar/build.rs", &file_content).build();

0 commit comments

Comments
 (0)