From cd7c376abcfa2041b99654d3cdf0a487abc15aee Mon Sep 17 00:00:00 2001 From: Yu Ding Date: Tue, 20 Mar 2018 19:51:33 -0700 Subject: [PATCH] Allowing stable channel rustc in Rust\'s style --- src/main.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2575d16..5917de6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,13 +140,21 @@ fn run() -> Result { sysroot.src()? }, Channel::Stable | Channel::Beta => { - writeln!( - io::stderr(), - "WARNING: the sysroot can't be built for the {:?} channel. \ - Switch to nightly.", - meta.channel - ).ok(); - return cargo::run(&args, verbose); + if env::var("RUSTC_BOOTSTRAP").is_ok() { + if let Some(src) = rustc::Src::from_env() { + src + } else { + sysroot.src()? + } + } else { + writeln!( + io::stderr(), + "WARNING: the sysroot can't be built for the {:?} channel. \ + Switch to nightly.", + meta.channel + ).ok(); + return cargo::run(&args, verbose); + } } };