Skip to content

Commit 750936d

Browse files
committed
bootstrap: minor docs cleanup
1 parent 4e98462 commit 750936d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/bootstrap/src/core/builder/cargo.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub struct Cargo {
2727
}
2828

2929
impl Cargo {
30-
/// Calls `Builder::cargo` and `Cargo::configure_linker` to prepare an invocation of `cargo` to be run.
30+
/// Calls [`Builder::cargo`] and [`Cargo::configure_linker`] to prepare an invocation of `cargo`
31+
/// to be run.
3132
pub fn new(
3233
builder: &Builder<'_>,
3334
compiler: Compiler,
@@ -54,7 +55,8 @@ impl Cargo {
5455
self.into()
5556
}
5657

57-
/// Same as `Cargo::new` except this one doesn't configure the linker with `Cargo::configure_linker`
58+
/// Same as [`Cargo::new`] except this one doesn't configure the linker with
59+
/// [`Cargo::configure_linker`].
5860
pub fn new_for_mir_opt_tests(
5961
builder: &Builder<'_>,
6062
compiler: Compiler,
@@ -92,8 +94,10 @@ impl Cargo {
9294
self
9395
}
9496

97+
/// Add an env var to the cargo command instance. Note that `RUSTFLAGS`/`RUSTDOCFLAGS` must go
98+
/// through [`Cargo::rustdocflags`] and [`Cargo::rustflags`] because inconsistent `RUSTFLAGS`
99+
/// and `RUSTDOCFLAGS` usages will trigger spurious rebuilds.
95100
pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
96-
// These are managed through rustflag/rustdocflag interfaces.
97101
assert_ne!(key.as_ref(), "RUSTFLAGS");
98102
assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
99103
self.command.env(key.as_ref(), value.as_ref());
@@ -111,8 +115,8 @@ impl Cargo {
111115

112116
/// Adds nightly-only features that this invocation is allowed to use.
113117
///
114-
/// By default, all nightly features are allowed. Once this is called, it
115-
/// will be restricted to the given set.
118+
/// By default, all nightly features are allowed. Once this is called, it will be restricted to
119+
/// the given set.
116120
pub fn allow_features(&mut self, features: &str) -> &mut Cargo {
117121
if !self.allow_features.is_empty() {
118122
self.allow_features.push(',');
@@ -280,7 +284,7 @@ impl From<Cargo> for BootstrapCommand {
280284
}
281285

282286
impl Builder<'_> {
283-
/// Like `cargo`, but only passes flags that are valid for all commands.
287+
/// Like [`Builder::cargo`], but only passes flags that are valid for all commands.
284288
pub fn bare_cargo(
285289
&self,
286290
compiler: Compiler,
@@ -358,12 +362,11 @@ impl Builder<'_> {
358362
cargo
359363
}
360364

361-
/// This will create a `Command` that represents a pending execution of
362-
/// Cargo. This cargo will be configured to use `compiler` as the actual
363-
/// rustc compiler, its output will be scoped by `mode`'s output directory,
364-
/// it will pass the `--target` flag for the specified `target`, and will be
365-
/// executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for commands
366-
/// to be run with Miri.
365+
/// This will create a [`BootstrapCommand`] that represents a pending execution of cargo. This
366+
/// cargo will be configured to use `compiler` as the actual rustc compiler, its output will be
367+
/// scoped by `mode`'s output directory, it will pass the `--target` flag for the specified
368+
/// `target`, and will be executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for
369+
/// commands to be run with Miri.
367370
fn cargo(
368371
&self,
369372
compiler: Compiler,

0 commit comments

Comments
 (0)