@@ -436,8 +436,8 @@ fn test_one_crate(_c: cargo, _path: str, cf: str, _p: pkg) {
436
436
let buildpath = fs:: connect ( _path, "/test" ) ;
437
437
need_dir ( buildpath) ;
438
438
#debug ( "Testing: %s -> %s" , cf, buildpath) ;
439
- let p = run:: program_output ( "rustc" , [ "--out-dir" , buildpath , "--test" ,
440
- cf] ) ;
439
+ let p = run:: program_output ( rustc_sysroot ( ) ,
440
+ [ "--out-dir" , buildpath , "--test" , cf] ) ;
441
441
if p. status != 0 {
442
442
error ( #fmt[ "rustc failed: %d\n %s\n %s" , p. status , p. err , p. out ] ) ;
443
443
ret;
@@ -452,7 +452,8 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
452
452
let buildpath = fs:: connect ( _path, "/build" ) ;
453
453
need_dir ( buildpath) ;
454
454
#debug ( "Installing: %s -> %s" , cf, buildpath) ;
455
- let p = run:: program_output ( "rustc" , [ "--out-dir" , buildpath, cf] ) ;
455
+ let p = run:: program_output ( rustc_sysroot ( ) ,
456
+ [ "--out-dir" , buildpath, cf] ) ;
456
457
if p. status != 0 {
457
458
error ( #fmt[ "rustc failed: %d\n %s\n %s" , p. status , p. err , p. out ] ) ;
458
459
ret;
@@ -473,6 +474,19 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
473
474
}
474
475
}
475
476
477
+ fn rustc_sysroot ( ) -> str {
478
+ alt os:: get_exe_path ( ) {
479
+ some ( _path) {
480
+ let path = [ _path, ".." , "bin" , "rustc" ] ;
481
+ check vec:: is_not_empty ( path) ;
482
+ let rustc = fs:: normalize ( fs:: connect_many ( path) ) ;
483
+ #debug ( " rustc: %s" , rustc) ;
484
+ rustc
485
+ }
486
+ none { "rustc" }
487
+ }
488
+ }
489
+
476
490
fn install_source ( c : cargo , path : str ) {
477
491
#debug ( "source: %s" , path) ;
478
492
fs:: change_dir ( path) ;
0 commit comments