fn cargo(&self,
             compiler: &Compiler,
             mode: Mode,
             target: &str,
             cmd: &str) -> Command {
        let mut cargo = Command::new(&self.cargo);
        let out_dir = self.stage_out(compiler, mode);
        cargo.env("CARGO_TARGET_DIR", out_dir)
             .arg(cmd)
             .arg("-j").arg(self.jobs().to_string())
             .arg("--target").arg(target);

        // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005
        // Force cargo to output binaries with disambiguating hashes in the name
        cargo.env("__CARGO_DEFAULT_LIB_METADATA", "1");

        let stage;
        if compiler.stage == 0 && self.local_rebuild {
            // Assume the local-rebuild rustc already has stage1 features.
            stage = 1;
        } else {
            stage = compiler.stage;
        }

        // Customize the compiler we're running. Specify the compiler to cargo
        // as our shim and then pass it some various options used to configure
        // how the actual compiler itself is called.
        //
        // These variables are primarily all read by
        // src/bootstrap/{rustc,rustdoc.rs}
        cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
             .env("RUSTC_REAL", self.compiler_path(compiler))
             .env("RUSTC_STAGE", stage.to_string())
             .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
             .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string())
             .env("RUSTC_CODEGEN_UNITS",
                  self.config.rust_codegen_units.to_string())
             .env("RUSTC_DEBUG_ASSERTIONS",
                  self.config.rust_debug_assertions.to_string())
             .env("RUSTC_SNAPSHOT", &self.rustc)
             .env("RUSTC_SYSROOT", self.sysroot(compiler))
             .env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
             .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir())
             .env("RUSTC_RPATH", self.config.rust_rpath.to_string())
             .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
             .env("RUSTDOC_REAL", self.rustdoc(compiler))
             .env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));

        self.add_bootstrap_key(&mut cargo);

        // Specify some various options for build scripts used throughout
        // the build.
        //
        // FIXME: the guard against msvc shouldn't need to be here
        if !target.contains("msvc") {
            cargo.env(format!("CC_{}", target), self.cc(target))
                 .env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
                 .env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
        }

        // Environment variables *required* needed throughout the build
        //
        // FIXME: should update code to not require this env var
        cargo.env("CFG_COMPILER_HOST_TRIPLE", target);

        if self.config.verbose || self.flags.verbose {
            cargo.arg("-v");
        }
        if self.config.rust_optimize {
            cargo.arg("--release");
        }
        if self.config.vendor {
            cargo.arg("--frozen");
        }
        return cargo
    }
/// Prepares an invocation of `cargo` to be run.
///
/// This will create a `Command` that represents a pending execution of
/// Cargo. This cargo will be configured to use `compiler` as the actual
/// rustc compiler, its output will be scoped by `mode`'s output directory,
/// it will pass the `--target` flag for the specified `target`, and will be
/// executing the Cargo command `cmd`.
Prepares an invocation of `cargo` to be run.
This will create a `Command` that represents a pending execution of
Cargo.
Prepares an invocation of ` cargo ` to be run . This will create a ` Command ` that represents a pending execution of Cargo .
fn cargo(&self,
             compiler: &Compiler,
             mode: Mode,
             target: &str,
             cmd: &str) -> Command {
        let mut cargo = Command::new(&self.cargo);
        let out_dir = self.stage_out(compiler, mode);
        cargo.env("CARGO_TARGET_DIR", out_dir)
             .arg(cmd)
             .arg("-j").arg(self.jobs().to_string())
             .arg("--target").arg(target);
        // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005
        // Force cargo to output binaries with disambiguating hashes in the name
        cargo.env("__CARGO_DEFAULT_LIB_METADATA", "1");
        let stage;
        if compiler.stage == 0 && self.local_rebuild {
            // Assume the local-rebuild rustc already has stage1 features.
            stage = 1;
        } else {
            stage = compiler.stage;
        }
        // Customize the compiler we're running. Specify the compiler to cargo
        // as our shim and then pass it some various options used to configure
        // how the actual compiler itself is called.
        //
        // These variables are primarily all read by
        // src/bootstrap/{rustc,rustdoc.rs}
        cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
             .env("RUSTC_REAL", self.compiler_path(compiler))
             .env("RUSTC_STAGE", stage.to_string())
             .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
             .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string())
             .env("RUSTC_CODEGEN_UNITS",
                  self.config.rust_codegen_units.to_string())
             .env("RUSTC_DEBUG_ASSERTIONS",
                  self.config.rust_debug_assertions.to_string())
             .env("RUSTC_SNAPSHOT", &self.rustc)
             .env("RUSTC_SYSROOT", self.sysroot(compiler))
             .env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
             .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir())
             .env("RUSTC_RPATH", self.config.rust_rpath.to_string())
             .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
             .env("RUSTDOC_REAL", self.rustdoc(compiler))
             .env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
        self.add_bootstrap_key(&mut cargo);
        // Specify some various options for build scripts used throughout
        // the build.
        //
        // FIXME: the guard against msvc shouldn't need to be here
        if !target.contains("msvc") {
            cargo.env(format!("CC_{}", target), self.cc(target))
                 .env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
                 .env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
        }
        // Environment variables *required* needed throughout the build
        //
        // FIXME: should update code to not require this env var
        cargo.env("CFG_COMPILER_HOST_TRIPLE", target);
        if self.config.verbose || self.flags.verbose {
            cargo.arg("-v");
        }
        if self.config.rust_optimize {
            cargo.arg("--release");
        }
        if self.config.vendor {
            cargo.arg("--frozen");
        }
        return cargo
    }
fn cargo ( & self , compiler : & Compiler , mode : Mode , target : & str , cmd : & str ) -> Command { let mut cargo = Command :: new ( & self . cargo ) ; let out_dir = self . stage_out ( compiler , mode ) ; cargo . env ( " " , out_dir ) . arg ( cmd ) . arg ( " " ) . arg ( self . jobs ( ) . to_string ( ) ) . arg ( " " ) . arg ( target ) ; // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 // Force cargo to output binaries with disambiguating hashes in the name cargo . env ( " " , " " ) ; let stage ; if compiler . stage == 0 && self . local_rebuild { // Assume the local-rebuild rustc already has stage1 features. stage = 1 ; } else { stage = compiler . stage ; } // Customize the compiler we're running. Specify the compiler to cargo // as our shim and then pass it some various options used to configure // how the actual compiler itself is called. // // These variables are primarily all read by // src/bootstrap/{rustc,rustdoc.rs} cargo . env ( " " , self . out . join ( " " ) ) . env ( " " , self . compiler_path ( compiler ) ) . env ( " " , stage . to_string ( ) ) . env ( " " , self . config . rust_debuginfo . to_string ( ) ) . env ( " " , self . config . rust_debuginfo_lines . to_string ( ) ) . env ( " " , self . config . rust_codegen_units . to_string ( ) ) . env ( " " , self . config . rust_debug_assertions . to_string ( ) ) . env ( " " , & self . rustc ) . env ( " " , self . sysroot ( compiler ) ) . env ( " " , self . rustc_libdir ( compiler ) ) . env ( " " , self . rustc_snapshot_libdir ( ) ) . env ( " " , self . config . rust_rpath . to_string ( ) ) . env ( " " , self . out . join ( " " ) ) . env ( " " , self . rustdoc ( compiler ) ) . env ( " " , self . rustc_flags ( target ) . join ( " " ) ) ; self . add_bootstrap_key ( & mut cargo ) ; // Specify some various options for build scripts used throughout // the build. // // FIXME: the guard against msvc shouldn't need to be here if ! target . contains ( " " ) { cargo . env ( format ! ( " " target ) , self . cc ( target ) ) . env ( format ! ( " " target ) , self . ar ( target ) . unwrap ( ) ) // only msvc is None . env ( format ! ( " " target ) , self . cflags ( target ) . join ( " " ) ) ; } // Environment variables *required* needed throughout the build // // FIXME: should update code to not require this env var cargo . env ( " " , target ) ; if self . config . verbose || self . flags . verbose { cargo . arg ( " " ) ; } if self . config . rust_optimize { cargo . arg ( " " ) ; } if self . config . vendor { cargo . arg ( " " ) ; } return cargo }
Prepares an invocation of `cargo` to be run.
Prepares an invocation of ` cargo ` to be run .
&self
compiler
&Compiler
mode
Mode
target
&str
cmd
&str
&self
compiler
&Compiler
mode
Mode
target
&str
cmd
&str