pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
    assert!(stage > 0, "the stage0 compiler isn't assembled, it's downloaded");
    // The compiler that we're assembling
    let target_compiler = Compiler::new(stage, host);

    // The compiler that compiled the compiler we're assembling
    let build_compiler = Compiler::new(stage - 1, &build.config.build);

    // Clear out old files
    let sysroot = build.sysroot(&target_compiler);
    let _ = fs::remove_dir_all(&sysroot);
    t!(fs::create_dir_all(&sysroot));

    // Link in all dylibs to the libdir
    let sysroot_libdir = sysroot.join(libdir(host));
    t!(fs::create_dir_all(&sysroot_libdir));
    let src_libdir = build.sysroot_libdir(&build_compiler, host);
    for f in t!(fs::read_dir(&src_libdir)).map(|f| t!(f)) {
        let filename = f.file_name().into_string().unwrap();
        if is_dylib(&filename) {
            copy(&f.path(), &sysroot_libdir.join(&filename));
        }
    }

    let out_dir = build.cargo_out(&build_compiler, Mode::Librustc, host);

    // Link the compiler binary itself into place
    let rustc = out_dir.join(exe("rustc", host));
    let bindir = sysroot.join("bin");
    t!(fs::create_dir_all(&bindir));
    let compiler = build.compiler_path(&Compiler::new(stage, host));
    let _ = fs::remove_file(&compiler);
    copy(&rustc, &compiler);

    // See if rustdoc exists to link it into place
    let rustdoc = exe("rustdoc", host);
    let rustdoc_src = out_dir.join(&rustdoc);
    let rustdoc_dst = bindir.join(&rustdoc);
    if fs::metadata(&rustdoc_src).is_ok() {
        let _ = fs::remove_file(&rustdoc_dst);
        copy(&rustdoc_src, &rustdoc_dst);
    }
}
/// Prepare a new compiler from the artifacts in `stage`
///
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
/// must have been previously produced by the `stage - 1` build.config.build
/// compiler.
Prepare a new compiler from the artifacts in `stage`
This will assemble a compiler in `build/$host/stage$stage`. The compiler
must have been previously produced by the `stage - 1` build.config.build
compiler.
Prepare a new compiler from the artifacts in ` stage ` This will assemble a compiler in ` build / $host / stage$stage ` . The compiler must have been previously produced by the ` stage - 1 ` build . config . build compiler .
pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
    assert!(stage > 0, "the stage0 compiler isn't assembled, it's downloaded");
    // The compiler that we're assembling
    let target_compiler = Compiler::new(stage, host);
    // The compiler that compiled the compiler we're assembling
    let build_compiler = Compiler::new(stage - 1, &build.config.build);
    // Clear out old files
    let sysroot = build.sysroot(&target_compiler);
    let _ = fs::remove_dir_all(&sysroot);
    t!(fs::create_dir_all(&sysroot));
    // Link in all dylibs to the libdir
    let sysroot_libdir = sysroot.join(libdir(host));
    t!(fs::create_dir_all(&sysroot_libdir));
    let src_libdir = build.sysroot_libdir(&build_compiler, host);
    for f in t!(fs::read_dir(&src_libdir)).map(|f| t!(f)) {
        let filename = f.file_name().into_string().unwrap();
        if is_dylib(&filename) {
            copy(&f.path(), &sysroot_libdir.join(&filename));
        }
    }
    let out_dir = build.cargo_out(&build_compiler, Mode::Librustc, host);
    // Link the compiler binary itself into place
    let rustc = out_dir.join(exe("rustc", host));
    let bindir = sysroot.join("bin");
    t!(fs::create_dir_all(&bindir));
    let compiler = build.compiler_path(&Compiler::new(stage, host));
    let _ = fs::remove_file(&compiler);
    copy(&rustc, &compiler);
    // See if rustdoc exists to link it into place
    let rustdoc = exe("rustdoc", host);
    let rustdoc_src = out_dir.join(&rustdoc);
    let rustdoc_dst = bindir.join(&rustdoc);
    if fs::metadata(&rustdoc_src).is_ok() {
        let _ = fs::remove_file(&rustdoc_dst);
        copy(&rustdoc_src, &rustdoc_dst);
    }
}
pub fn assemble_rustc ( build : & Build , stage : u32 , host : & str ) { assert ! ( stage 0 " " ) ; // The compiler that we're assembling let target_compiler = Compiler :: new ( stage , host ) ; // The compiler that compiled the compiler we're assembling let build_compiler = Compiler :: new ( stage - 1 , & build . config . build ) ; // Clear out old files let sysroot = build . sysroot ( & target_compiler ) ; let _ = fs :: remove_dir_all ( & sysroot ) ; t ! ( fs create_dir_all ( sysroot ) ) ; // Link in all dylibs to the libdir let sysroot_libdir = sysroot . join ( libdir ( host ) ) ; t ! ( fs create_dir_all ( sysroot_libdir ) ) ; let src_libdir = build . sysroot_libdir ( & build_compiler , host ) ; for f in t ! ( fs read_dir ( src_libdir ) ) . map ( | f | t ! ( f ) ) { let filename = f . file_name ( ) . into_string ( ) . unwrap ( ) ; if is_dylib ( & filename ) { copy ( & f . path ( ) , & sysroot_libdir . join ( & filename ) ) ; } } let out_dir = build . cargo_out ( & build_compiler , Mode :: Librustc , host ) ; // Link the compiler binary itself into place let rustc = out_dir . join ( exe ( " " , host ) ) ; let bindir = sysroot . join ( " " ) ; t ! ( fs create_dir_all ( bindir ) ) ; let compiler = build . compiler_path ( & Compiler :: new ( stage , host ) ) ; let _ = fs :: remove_file ( & compiler ) ; copy ( & rustc , & compiler ) ; // See if rustdoc exists to link it into place let rustdoc = exe ( " " , host ) ; let rustdoc_src = out_dir . join ( & rustdoc ) ; let rustdoc_dst = bindir . join ( & rustdoc ) ; if fs :: metadata ( & rustdoc_src ) . is_ok ( ) { let _ = fs :: remove_file ( & rustdoc_dst ) ; copy ( & rustdoc_src , & rustdoc_dst ) ; } }
Prepare a new compiler from the artifacts in `stage`
This will assemble a compiler in `build/$host/stage$stage`.
Prepare a new compiler from the artifacts in ` stage ` This will assemble a compiler in ` build / $host / stage$stage ` .
build
&Build
stage
u32
host
&str
build
&Build
stage
u32
host
&str