bootstrap: minor docs cleanup

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-15 14:03:22 +08:00
parent 4b28e52f32
commit 1d77715f83

View File

@ -98,7 +98,8 @@ pub struct Cargo {
} }
impl Cargo { impl Cargo {
/// Calls `Builder::cargo` and `Cargo::configure_linker` to prepare an invocation of `cargo` to be run. /// Calls [`Builder::cargo`] and [`Cargo::configure_linker`] to prepare an invocation of `cargo`
/// to be run.
pub fn new( pub fn new(
builder: &Builder<'_>, builder: &Builder<'_>,
compiler: Compiler, compiler: Compiler,
@ -125,7 +126,8 @@ impl Cargo {
self.into() self.into()
} }
/// Same as `Cargo::new` except this one doesn't configure the linker with `Cargo::configure_linker` /// Same as [`Cargo::new`] except this one doesn't configure the linker with
/// [`Cargo::configure_linker`].
pub fn new_for_mir_opt_tests( pub fn new_for_mir_opt_tests(
builder: &Builder<'_>, builder: &Builder<'_>,
compiler: Compiler, compiler: Compiler,
@ -163,8 +165,10 @@ impl Cargo {
self self
} }
/// 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 fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
// These are managed through rustflag/rustdocflag interfaces.
assert_ne!(key.as_ref(), "RUSTFLAGS"); assert_ne!(key.as_ref(), "RUSTFLAGS");
assert_ne!(key.as_ref(), "RUSTDOCFLAGS"); assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
self.command.env(key.as_ref(), value.as_ref()); self.command.env(key.as_ref(), value.as_ref());
@ -182,8 +186,8 @@ impl Cargo {
/// Adds nightly-only features that this invocation is allowed to use. /// Adds nightly-only features that this invocation is allowed to use.
/// ///
/// By default, all nightly features are allowed. Once this is called, it /// By default, all nightly features are allowed. Once this is called, it will be restricted to
/// will be restricted to the given set. /// the given set.
pub fn allow_features(&mut self, features: &str) -> &mut Cargo { pub fn allow_features(&mut self, features: &str) -> &mut Cargo {
if !self.allow_features.is_empty() { if !self.allow_features.is_empty() {
self.allow_features.push(','); self.allow_features.push(',');
@ -351,7 +355,7 @@ impl From<Cargo> for BootstrapCommand {
} }
impl Builder<'_> { impl Builder<'_> {
/// Like `cargo`, but only passes flags that are valid for all commands. /// Like [`Builder::cargo`], but only passes flags that are valid for all commands.
pub fn bare_cargo( pub fn bare_cargo(
&self, &self,
compiler: Compiler, compiler: Compiler,
@ -429,12 +433,11 @@ impl Builder<'_> {
cargo cargo
} }
/// This will create a `Command` that represents a pending execution of /// This will create a [`BootstrapCommand`] that represents a pending execution of cargo. This
/// Cargo. This cargo will be configured to use `compiler` as the actual /// cargo will be configured to use `compiler` as the actual rustc compiler, its output will be
/// rustc compiler, its output will be scoped by `mode`'s output directory, /// scoped by `mode`'s output directory, it will pass the `--target` flag for the specified
/// it will pass the `--target` flag for the specified `target`, and will be /// `target`, and will be executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for
/// executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for commands /// commands to be run with Miri.
/// to be run with Miri.
fn cargo( fn cargo(
&self, &self,
compiler: Compiler, compiler: Compiler,