mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-05 17:36:20 +00:00
Make all of crate::core::builder::cargo non-pub
This commit is contained in:
@@ -139,7 +139,7 @@ impl HostFlags {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cargo {
|
||||
pub(crate) struct Cargo {
|
||||
command: BootstrapCommand,
|
||||
args: Vec<OsString>,
|
||||
compiler: Compiler,
|
||||
@@ -158,7 +158,7 @@ impl Cargo {
|
||||
/// Calls [`Builder::cargo`] and [`Cargo::configure_linker`] to prepare an invocation of `cargo`
|
||||
/// to be run.
|
||||
#[track_caller]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
builder: &Builder<'_>,
|
||||
compiler: Compiler,
|
||||
mode: Mode,
|
||||
@@ -182,30 +182,31 @@ impl Cargo {
|
||||
cargo
|
||||
}
|
||||
|
||||
pub fn release_build(&mut self, release_build: bool) {
|
||||
pub(crate) fn release_build(&mut self, release_build: bool) {
|
||||
self.profile = if release_build { Some("release") } else { None };
|
||||
}
|
||||
|
||||
pub fn profile(&mut self, profile: &'static str) {
|
||||
#[expect(dead_code, reason = "general-purpose, currently unused")]
|
||||
pub(crate) fn profile(&mut self, profile: &'static str) {
|
||||
self.profile = Some(profile);
|
||||
}
|
||||
|
||||
pub fn compiler(&self) -> Compiler {
|
||||
pub(crate) fn compiler(&self) -> Compiler {
|
||||
self.compiler
|
||||
}
|
||||
|
||||
pub fn mode(&self) -> Mode {
|
||||
pub(crate) fn mode(&self) -> Mode {
|
||||
self.mode
|
||||
}
|
||||
|
||||
pub fn into_cmd(self) -> BootstrapCommand {
|
||||
pub(crate) fn into_cmd(self) -> BootstrapCommand {
|
||||
self.into()
|
||||
}
|
||||
|
||||
/// Same as [`Cargo::new`] except this one doesn't configure the linker with
|
||||
/// [`Cargo::configure_linker`].
|
||||
#[track_caller]
|
||||
pub fn new_for_mir_opt_tests(
|
||||
pub(crate) fn new_for_mir_opt_tests(
|
||||
builder: &Builder<'_>,
|
||||
compiler: Compiler,
|
||||
mode: Mode,
|
||||
@@ -220,22 +221,22 @@ impl Cargo {
|
||||
cargo
|
||||
}
|
||||
|
||||
pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
|
||||
pub(crate) fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
|
||||
self.rustdocflags.arg(arg);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn rustflag(&mut self, arg: &str) -> &mut Cargo {
|
||||
pub(crate) fn rustflag(&mut self, arg: &str) -> &mut Cargo {
|
||||
self.rustflags.arg(arg);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Cargo {
|
||||
pub(crate) fn arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Cargo {
|
||||
self.args.push(arg.as_ref().into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn args<I, S>(&mut self, args: I) -> &mut Cargo
|
||||
pub(crate) fn args<I, S>(&mut self, args: I) -> &mut Cargo
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<OsStr>,
|
||||
@@ -249,7 +250,7 @@ impl Cargo {
|
||||
/// Add an env var to the cargo command instance. Note that `RUSTFLAGS`/`RUSTDOCFLAGS` must go
|
||||
/// through [`Cargo::rustdocflags`] and [`Cargo::rustflags`] because inconsistent `RUSTFLAGS`
|
||||
/// and `RUSTDOCFLAGS` usages will trigger spurious rebuilds.
|
||||
pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
|
||||
pub(crate) fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
|
||||
assert_ne!(key.as_ref(), "RUSTFLAGS");
|
||||
assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
|
||||
self.command.env(key.as_ref(), value.as_ref());
|
||||
@@ -262,7 +263,7 @@ impl Cargo {
|
||||
///
|
||||
/// Note that this only considers the existence of the env. var. configured on this `Cargo`
|
||||
/// instance. It does not look at the environment of this process.
|
||||
pub fn append_to_env(
|
||||
pub(crate) fn append_to_env(
|
||||
&mut self,
|
||||
key: impl AsRef<OsStr>,
|
||||
value: impl AsRef<OsStr>,
|
||||
@@ -282,11 +283,11 @@ impl Cargo {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_rustc_lib_path(&mut self, builder: &Builder<'_>) {
|
||||
pub(crate) fn add_rustc_lib_path(&mut self, builder: &Builder<'_>) {
|
||||
builder.add_rustc_lib_path(self.compiler, &mut self.command);
|
||||
}
|
||||
|
||||
pub fn current_dir(&mut self, dir: &Path) -> &mut Cargo {
|
||||
pub(crate) fn current_dir(&mut self, dir: &Path) -> &mut Cargo {
|
||||
self.command.current_dir(dir);
|
||||
self
|
||||
}
|
||||
@@ -295,7 +296,7 @@ impl Cargo {
|
||||
///
|
||||
/// By default, all nightly features are allowed. Once this is called, it will be restricted to
|
||||
/// the given set.
|
||||
pub fn allow_features(&mut self, features: &str) -> &mut Cargo {
|
||||
pub(crate) fn allow_features(&mut self, features: &str) -> &mut Cargo {
|
||||
if !self.allow_features.is_empty() {
|
||||
self.allow_features.push(',');
|
||||
}
|
||||
@@ -554,7 +555,7 @@ impl From<Cargo> for BootstrapCommand {
|
||||
impl Builder<'_> {
|
||||
/// Like [`Builder::cargo`], but only passes flags that are valid for all commands.
|
||||
#[track_caller]
|
||||
pub fn bare_cargo(
|
||||
pub(crate) fn bare_cargo(
|
||||
&self,
|
||||
compiler: Compiler,
|
||||
mode: Mode,
|
||||
@@ -1538,7 +1539,7 @@ impl Builder<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cargo_profile_var(name: &str, config: &Config, mode: Mode) -> String {
|
||||
pub(crate) fn cargo_profile_var(name: &str, config: &Config, mode: Mode) -> String {
|
||||
let profile = match (mode, config.rust_optimize.is_release()) {
|
||||
// Some std configuration exists in its own profile
|
||||
(Mode::Std, _) => "DIST",
|
||||
@@ -1550,7 +1551,7 @@ pub fn cargo_profile_var(name: &str, config: &Config, mode: Mode) -> String {
|
||||
|
||||
/// Applies PGO compile flags to the given Cargo invocation based on the given PGO config.
|
||||
/// PGO flags are only applied when compiling a stage2 component.
|
||||
pub fn apply_pgo(
|
||||
pub(crate) fn apply_pgo(
|
||||
builder: &Builder<'_>,
|
||||
cargo: &mut Cargo,
|
||||
build_compiler: Compiler,
|
||||
|
||||
@@ -13,7 +13,7 @@ use clap::ValueEnum;
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::instrument;
|
||||
|
||||
pub use self::cargo::{Cargo, apply_pgo, cargo_profile_var};
|
||||
pub(crate) use self::cargo::{Cargo, apply_pgo, cargo_profile_var};
|
||||
use crate::core::build_steps::compile::{Std, StdLink, looks_like_codegen_backend};
|
||||
use crate::core::build_steps::tool::RustcPrivateCompilers;
|
||||
use crate::core::build_steps::{
|
||||
|
||||
Reference in New Issue
Block a user