File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ include!("../dylib_util.rs");
19
19
20
20
use std:: env;
21
21
use std:: path:: PathBuf ;
22
- use std:: process:: { Child , Command } ;
22
+ use std:: process:: { exit , Child , Command } ;
23
23
use std:: str:: FromStr ;
24
24
use std:: time:: Instant ;
25
25
@@ -47,7 +47,12 @@ fn main() {
47
47
} else {
48
48
( "RUSTC_REAL" , "RUSTC_LIBDIR" )
49
49
} ;
50
- let stage = env:: var ( "RUSTC_STAGE" ) . expect ( "RUSTC_STAGE was not set" ) ;
50
+ let stage = env:: var ( "RUSTC_STAGE" ) . unwrap_or_else ( |_| {
51
+ // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead.
52
+ eprintln ! ( "rustc shim: fatal: RUSTC_STAGE was not set" ) ;
53
+ eprintln ! ( "rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap" ) ;
54
+ exit ( 101 ) ;
55
+ } ) ;
51
56
let sysroot = env:: var_os ( "RUSTC_SYSROOT" ) . expect ( "RUSTC_SYSROOT was not set" ) ;
52
57
let on_fail = env:: var_os ( "RUSTC_ON_FAIL" ) . map ( Command :: new) ;
53
58
Original file line number Diff line number Diff line change 5
5
use std:: env;
6
6
use std:: ffi:: OsString ;
7
7
use std:: path:: PathBuf ;
8
- use std:: process:: Command ;
8
+ use std:: process:: { exit , Command } ;
9
9
10
10
include ! ( "../dylib_util.rs" ) ;
11
11
12
12
fn main ( ) {
13
13
let args = env:: args_os ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
14
- let stage = env:: var ( "RUSTC_STAGE" ) . expect ( "RUSTC_STAGE was not set" ) ;
14
+ let stage = env:: var ( "RUSTC_STAGE" ) . unwrap_or_else ( |_| {
15
+ // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead.
16
+ eprintln ! ( "rustc shim: fatal: RUSTC_STAGE was not set" ) ;
17
+ eprintln ! ( "rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap" ) ;
18
+ exit ( 101 ) ;
19
+ } ) ;
15
20
let rustdoc = env:: var_os ( "RUSTDOC_REAL" ) . expect ( "RUSTDOC_REAL was not set" ) ;
16
21
let libdir = env:: var_os ( "RUSTDOC_LIBDIR" ) . expect ( "RUSTDOC_LIBDIR was not set" ) ;
17
22
let sysroot = env:: var_os ( "RUSTC_SYSROOT" ) . expect ( "RUSTC_SYSROOT was not set" ) ;
You can’t perform that action at this time.
0 commit comments