about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-10-15 14:03:22 +0800
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-10-21 10:34:31 +0800
commit1d77715f83cd495d132f95e9f6c8babb96b44e9d (patch)
tree6a029e5a2111483a647e1088aa74a62f3ecacacb
parent4b28e52f32d5abee7b9964cfc554ab56a2204f9a (diff)
downloadrust-1d77715f83cd495d132f95e9f6c8babb96b44e9d.tar.gz
rust-1d77715f83cd495d132f95e9f6c8babb96b44e9d.zip
bootstrap: minor docs cleanup
-rw-r--r--src/bootstrap/src/core/builder/cargo.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index b33545341cc..c3d0994f164 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -98,7 +98,8 @@ pub struct 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(
         builder: &Builder<'_>,
         compiler: Compiler,
@@ -125,7 +126,8 @@ impl Cargo {
         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(
         builder: &Builder<'_>,
         compiler: Compiler,
@@ -163,8 +165,10 @@ impl Cargo {
         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 {
-        // These are managed through rustflag/rustdocflag interfaces.
         assert_ne!(key.as_ref(), "RUSTFLAGS");
         assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
         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.
     ///
-    /// By default, all nightly features are allowed. Once this is called, it
-    /// will be restricted to the given set.
+    /// 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 {
         if !self.allow_features.is_empty() {
             self.allow_features.push(',');
@@ -351,7 +355,7 @@ impl From<Cargo> for BootstrapCommand {
 }
 
 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(
         &self,
         compiler: Compiler,
@@ -429,12 +433,11 @@ impl Builder<'_> {
         cargo
     }
 
-    /// 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`. `cmd` can be `miri-cmd` for commands
-    /// to be run with Miri.
+    /// This will create a [`BootstrapCommand`] 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`. `cmd` can be `miri-cmd` for
+    /// commands to be run with Miri.
     fn cargo(
         &self,
         compiler: Compiler,