Skip to content

Commit

Permalink
Auto merge of #1602 - Aaron1011:fix/rustc-tarball, r=gnzlbg
Browse files Browse the repository at this point in the history
Fix build.rs failing with a rustc built from a tarball

Fixes #1601
  • Loading branch information
bors committed Nov 20, 2019
2 parents bd48043 + f10ee11 commit ae17918
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,16 @@ fn rustc_minor_nightly() -> Option<(u32, bool)> {
}

let minor = pieces.next();
let nightly_raw = otry!(otry!(pieces.next()).split('-').nth(1));
let nightly =
nightly_raw.starts_with("dev") || nightly_raw.starts_with("nightly");

// If `rustc` was built from a tarball, its version string
// will have neither a git hash nor a commit date
// (e.g. "rustc 1.39.0"). Treat this case as non-nightly,
// since a nightly build should either come from CI
// or a git checkout
let nightly_raw = otry!(pieces.next()).split('-').nth(1);
let nightly = nightly_raw
.map(|raw| raw.starts_with("dev") || raw.starts_with("nightly"))
.unwrap_or(false);
let minor = otry!(otry!(minor).parse().ok());

Some((minor, nightly))
Expand Down

0 comments on commit ae17918

Please sign in to comment.