@@ -98,7 +98,8 @@ pub struct Cargo {
9898}
9999
100100impl Cargo {
101- /// Calls `Builder::cargo` and `Cargo::configure_linker` to prepare an invocation of `cargo` to be run.
101+ /// Calls [`Builder::cargo`] and [`Cargo::configure_linker`] to prepare an invocation of `cargo`
102+ /// to be run.
102103 pub fn new (
103104 builder : & Builder < ' _ > ,
104105 compiler : Compiler ,
@@ -125,7 +126,8 @@ impl Cargo {
125126 self . into ( )
126127 }
127128
128- /// Same as `Cargo::new` except this one doesn't configure the linker with `Cargo::configure_linker`
129+ /// Same as [`Cargo::new`] except this one doesn't configure the linker with
130+ /// [`Cargo::configure_linker`].
129131 pub fn new_for_mir_opt_tests (
130132 builder : & Builder < ' _ > ,
131133 compiler : Compiler ,
@@ -163,8 +165,10 @@ impl Cargo {
163165 self
164166 }
165167
168+ /// Add an env var to the cargo command instance. Note that `RUSTFLAGS`/`RUSTDOCFLAGS` must go
169+ /// through [`Cargo::rustdocflags`] and [`Cargo::rustflags`] because inconsistent `RUSTFLAGS`
170+ /// and `RUSTDOCFLAGS` usages will trigger spurious rebuilds.
166171 pub fn env ( & mut self , key : impl AsRef < OsStr > , value : impl AsRef < OsStr > ) -> & mut Cargo {
167- // These are managed through rustflag/rustdocflag interfaces.
168172 assert_ne ! ( key. as_ref( ) , "RUSTFLAGS" ) ;
169173 assert_ne ! ( key. as_ref( ) , "RUSTDOCFLAGS" ) ;
170174 self . command . env ( key. as_ref ( ) , value. as_ref ( ) ) ;
@@ -182,8 +186,8 @@ impl Cargo {
182186
183187 /// Adds nightly-only features that this invocation is allowed to use.
184188 ///
185- /// By default, all nightly features are allowed. Once this is called, it
186- /// will be restricted to the given set.
189+ /// By default, all nightly features are allowed. Once this is called, it will be restricted to
190+ /// the given set.
187191 pub fn allow_features ( & mut self , features : & str ) -> & mut Cargo {
188192 if !self . allow_features . is_empty ( ) {
189193 self . allow_features . push ( ',' ) ;
@@ -351,7 +355,7 @@ impl From<Cargo> for BootstrapCommand {
351355}
352356
353357impl Builder < ' _ > {
354- /// Like ` cargo`, but only passes flags that are valid for all commands.
358+ /// Like [`Builder:: cargo`] , but only passes flags that are valid for all commands.
355359 pub fn bare_cargo (
356360 & self ,
357361 compiler : Compiler ,
@@ -429,12 +433,11 @@ impl Builder<'_> {
429433 cargo
430434 }
431435
432- /// This will create a `Command` that represents a pending execution of
433- /// Cargo. This cargo will be configured to use `compiler` as the actual
434- /// rustc compiler, its output will be scoped by `mode`'s output directory,
435- /// it will pass the `--target` flag for the specified `target`, and will be
436- /// executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for commands
437- /// to be run with Miri.
436+ /// This will create a [`BootstrapCommand`] that represents a pending execution of cargo. This
437+ /// cargo will be configured to use `compiler` as the actual rustc compiler, its output will be
438+ /// scoped by `mode`'s output directory, it will pass the `--target` flag for the specified
439+ /// `target`, and will be executing the Cargo command `cmd`. `cmd` can be `miri-cmd` for
440+ /// commands to be run with Miri.
438441 fn cargo (
439442 & self ,
440443 compiler : Compiler ,
0 commit comments