Skip to content

Commit 0b7ee9d

Browse files
committed
build-manifest: bundle the rustc version in the binary
1 parent cbded3e commit 0b7ee9d

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/bootstrap/dist.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,6 @@ impl Step for HashSign {
23532353
cmd.arg(today.trim());
23542354
cmd.arg(addr);
23552355
cmd.arg(&builder.config.channel);
2356-
cmd.arg(&builder.version);
23572356
cmd.env("BUILD_MANIFEST_LEGACY", "1");
23582357

23592358
builder.create_dir(&distdir(builder));

src/bootstrap/run.rs

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ impl Step for BuildManifest {
7777
cmd.arg(today.trim());
7878
cmd.arg(addr);
7979
cmd.arg(&builder.config.channel);
80-
cmd.arg(&builder.version);
8180

8281
builder.create_dir(&distdir(builder));
8382
builder.run(&mut cmd);

src/tools/build-manifest/src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ fn main() {
226226
let date = args.next().unwrap();
227227
let s3_address = args.next().unwrap();
228228
let channel = args.next().unwrap();
229-
let rustc_version = args.next().unwrap();
230229

231230
// Do not ask for a passphrase while manually testing
232231
let mut passphrase = String::new();
@@ -236,7 +235,7 @@ fn main() {
236235
}
237236

238237
Builder {
239-
versions: Versions::new(&channel, &rustc_version, &input).unwrap(),
238+
versions: Versions::new(&channel, &input).unwrap(),
240239

241240
input,
242241
output,

src/tools/build-manifest/src/versions.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::path::{Path, PathBuf};
77
use tar::Archive;
88

99
const DEFAULT_TARGET: &str = "x86_64-unknown-linux-gnu";
10+
const RUSTC_VERSION: &str = include_str!("../../../version");
1011

1112
#[derive(Debug, Hash, Eq, PartialEq, Clone)]
1213
pub(crate) enum PkgType {
@@ -87,19 +88,13 @@ pub(crate) struct VersionInfo {
8788

8889
pub(crate) struct Versions {
8990
channel: String,
90-
rustc_version: String,
9191
dist_path: PathBuf,
9292
versions: HashMap<PkgType, VersionInfo>,
9393
}
9494

9595
impl Versions {
96-
pub(crate) fn new(channel: &str, rustc_version: &str, dist_path: &Path) -> Result<Self, Error> {
97-
Ok(Self {
98-
channel: channel.into(),
99-
rustc_version: rustc_version.into(),
100-
dist_path: dist_path.into(),
101-
versions: HashMap::new(),
102-
})
96+
pub(crate) fn new(channel: &str, dist_path: &Path) -> Result<Self, Error> {
97+
Ok(Self { channel: channel.into(), dist_path: dist_path.into(), versions: HashMap::new() })
10398
}
10499

105100
pub(crate) fn channel(&self) -> &str {
@@ -177,10 +172,10 @@ impl Versions {
177172
) -> Result<String, Error> {
178173
let component_name = package.tarball_component_name();
179174
let version = match self.channel.as_str() {
180-
"stable" => self.rustc_version.clone(),
175+
"stable" => RUSTC_VERSION.into(),
181176
"beta" => "beta".into(),
182177
"nightly" => "nightly".into(),
183-
_ => format!("{}-dev", self.rustc_version),
178+
_ => format!("{}-dev", RUSTC_VERSION),
184179
};
185180

186181
if package.target_independent() {
@@ -191,6 +186,6 @@ impl Versions {
191186
}
192187

193188
pub(crate) fn rustc_version(&self) -> &str {
194-
&self.rustc_version
189+
RUSTC_VERSION
195190
}
196191
}

0 commit comments

Comments
 (0)