Skip to content

Commit b244f61

Browse files
committed
Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments This has been factored out from #58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2 parents c84e797 + f943296 commit b244f61

File tree

486 files changed

+2850
-2822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

486 files changed

+2850
-2822
lines changed

src/bootstrap/builder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
6060
/// Run this rule for all hosts without cross compiling.
6161
const ONLY_HOSTS: bool = false;
6262

63-
/// Primary function to execute this rule. Can call `builder.ensure(...)`
63+
/// Primary function to execute this rule. Can call `builder.ensure()`
6464
/// with other steps to run those.
6565
fn run(self, builder: &Builder) -> Self::Output;
6666

6767
/// When bootstrap is passed a set of paths, this controls whether this rule
6868
/// will execute. However, it does not get called in a "default" context
69-
/// when we are not passed any paths; in that case, make_run is called
69+
/// when we are not passed any paths; in that case, `make_run` is called
7070
/// directly.
7171
fn should_run(run: ShouldRun) -> ShouldRun;
7272

73-
/// Build up a "root" rule, either as a default rule or from a path passed
73+
/// Builds up a "root" rule, either as a default rule or from a path passed
7474
/// to us.
7575
///
7676
/// When path is `None`, we are executing in a context where no paths were
@@ -648,7 +648,7 @@ impl<'a> Builder<'a> {
648648
add_lib_path(vec![self.rustc_libdir(compiler)], cmd);
649649
}
650650

651-
/// Get a path to the compiler specified.
651+
/// Gets a path to the compiler specified.
652652
pub fn rustc(&self, compiler: Compiler) -> PathBuf {
653653
if compiler.is_snapshot(self) {
654654
self.initial_rustc.clone()
@@ -659,7 +659,7 @@ impl<'a> Builder<'a> {
659659
}
660660
}
661661

662-
/// Get the paths to all of the compiler's codegen backends.
662+
/// Gets the paths to all of the compiler's codegen backends.
663663
fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf> {
664664
fs::read_dir(self.sysroot_codegen_backends(compiler))
665665
.into_iter()

src/bootstrap/cache.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ lazy_static! {
227227
pub static ref INTERNER: Interner = Interner::default();
228228
}
229229

230-
/// This is essentially a HashMap which allows storing any type in its input and
230+
/// This is essentially a `HashMap` which allows storing any type in its input and
231231
/// any type in its output. It is a write-once cache; values are never evicted,
232232
/// which means that references to the value can safely be returned from the
233-
/// get() method.
233+
/// `get()` method.
234234
#[derive(Debug)]
235235
pub struct Cache(
236236
RefCell<HashMap<

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Step for Rustc {
6666
});
6767
}
6868

69-
/// Build the compiler.
69+
/// Builds the compiler.
7070
///
7171
/// This will build the compiler for a particular stage of the build using
7272
/// the `compiler` targeting the `target` architecture. The artifacts

src/bootstrap/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Responsible for cleaning out a build directory of all old and stale
44
//! artifacts to prepare for a fresh build. Currently doesn't remove the
55
//! `build/cache` directory (download cache) or the `build/$target/llvm`
6-
//! directory unless the --all flag is present.
6+
//! directory unless the `--all` flag is present.
77
88
use std::fs;
99
use std::io::{self, ErrorKind};

src/bootstrap/compile.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Step for Std {
4848
});
4949
}
5050

51-
/// Build the standard library.
51+
/// Builds the standard library.
5252
///
5353
/// This will build the standard library for a particular stage of the build
5454
/// using the `compiler` targeting the `target` architecture. The artifacts
@@ -269,7 +269,7 @@ impl Step for StartupObjects {
269269
});
270270
}
271271

272-
/// Build and prepare startup objects like rsbegin.o and rsend.o
272+
/// Builds and prepare startup objects like rsbegin.o and rsend.o
273273
///
274274
/// These are primarily used on Windows right now for linking executables/dlls.
275275
/// They don't require any library support as they're just plain old object
@@ -334,7 +334,7 @@ impl Step for Test {
334334
});
335335
}
336336

337-
/// Build libtest.
337+
/// Builds libtest.
338338
///
339339
/// This will build libtest and supporting libraries for a particular stage of
340340
/// the build using the `compiler` targeting the `target` architecture. The
@@ -455,7 +455,7 @@ impl Step for Rustc {
455455
});
456456
}
457457

458-
/// Build the compiler.
458+
/// Builds the compiler.
459459
///
460460
/// This will build the compiler for a particular stage of the build using
461461
/// the `compiler` targeting the `target` architecture. The artifacts

src/bootstrap/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl Step for Mingw {
342342
run.builder.ensure(Mingw { host: run.target });
343343
}
344344

345-
/// Build the `rust-mingw` installer component.
345+
/// Builds the `rust-mingw` installer component.
346346
///
347347
/// This contains all the bits and pieces to run the MinGW Windows targets
348348
/// without any extra installed software (e.g., we bundle gcc, libraries, etc).

src/bootstrap/doc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl Step for TheBook {
259259
});
260260
}
261261

262-
/// Build the book and associated stuff.
262+
/// Builds the book and associated stuff.
263263
///
264264
/// We need to build:
265265
///
@@ -611,7 +611,7 @@ impl Step for WhitelistedRustc {
611611
});
612612
}
613613

614-
/// Generate whitelisted compiler crate documentation.
614+
/// Generates whitelisted compiler crate documentation.
615615
///
616616
/// This will generate all documentation for crates that are whitelisted
617617
/// to be included in the standard documentation. This documentation is
@@ -683,7 +683,7 @@ impl Step for Rustc {
683683
});
684684
}
685685

686-
/// Generate compiler documentation.
686+
/// Generates compiler documentation.
687687
///
688688
/// This will generate all documentation for compiler and dependencies.
689689
/// Compiler documentation is distributed separately, so we make sure
@@ -784,7 +784,7 @@ impl Step for Rustdoc {
784784
});
785785
}
786786

787-
/// Generate compiler documentation.
787+
/// Generates compiler documentation.
788788
///
789789
/// This will generate all documentation for compiler and dependencies.
790790
/// Compiler documentation is distributed separately, so we make sure

src/bootstrap/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
//! ## Copying stage0 {std,test,rustc}
7070
//!
7171
//! This copies the build output from Cargo into
72-
//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: This step's
72+
//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: this step's
7373
//! documentation should be expanded -- the information already here may be
7474
//! incorrect.
7575
//!
@@ -504,7 +504,7 @@ impl Build {
504504
cleared
505505
}
506506

507-
/// Get the space-separated set of activated features for the standard
507+
/// Gets the space-separated set of activated features for the standard
508508
/// library.
509509
fn std_features(&self) -> String {
510510
let mut features = "panic-unwind".to_string();
@@ -521,7 +521,7 @@ impl Build {
521521
features
522522
}
523523

524-
/// Get the space-separated set of activated features for the compiler.
524+
/// Gets the space-separated set of activated features for the compiler.
525525
fn rustc_features(&self) -> String {
526526
let mut features = String::new();
527527
if self.config.jemalloc {
@@ -609,7 +609,7 @@ impl Build {
609609
self.out.join(&*target).join("crate-docs")
610610
}
611611

612-
/// Returns true if no custom `llvm-config` is set for the specified target.
612+
/// Returns `true` if no custom `llvm-config` is set for the specified target.
613613
///
614614
/// If no custom `llvm-config` was specified then Rust's llvm will be used.
615615
fn is_rust_llvm(&self, target: Interned<String>) -> bool {
@@ -857,13 +857,13 @@ impl Build {
857857
.map(|p| &**p)
858858
}
859859

860-
/// Returns true if this is a no-std `target`, if defined
860+
/// Returns `true` if this is a no-std `target`, if defined
861861
fn no_std(&self, target: Interned<String>) -> Option<bool> {
862862
self.config.target_config.get(&target)
863863
.map(|t| t.no_std)
864864
}
865865

866-
/// Returns whether the target will be tested using the `remote-test-client`
866+
/// Returns `true` if the target will be tested using the `remote-test-client`
867867
/// and `remote-test-server` binaries.
868868
fn remote_tested(&self, target: Interned<String>) -> bool {
869869
self.qemu_rootfs(target).is_some() || target.contains("android") ||
@@ -1059,7 +1059,7 @@ impl Build {
10591059
self.rust_info.version(self, channel::CFG_RELEASE_NUM)
10601060
}
10611061

1062-
/// Return the full commit hash
1062+
/// Returns the full commit hash.
10631063
fn rust_sha(&self) -> Option<&str> {
10641064
self.rust_info.sha()
10651065
}
@@ -1079,7 +1079,7 @@ impl Build {
10791079
panic!("failed to find version in {}'s Cargo.toml", package)
10801080
}
10811081

1082-
/// Returns whether unstable features should be enabled for the compiler
1082+
/// Returns `true` if unstable features should be enabled for the compiler
10831083
/// we're building.
10841084
fn unstable_features(&self) -> bool {
10851085
match &self.config.channel[..] {
@@ -1327,7 +1327,7 @@ impl<'a> Compiler {
13271327
self
13281328
}
13291329

1330-
/// Returns whether this is a snapshot compiler for `build`'s configuration
1330+
/// Returns `true` if this is a snapshot compiler for `build`'s configuration
13311331
pub fn is_snapshot(&self, build: &Build) -> bool {
13321332
self.stage == 0 && self.host == build.build
13331333
}

src/bootstrap/test.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const ADB_TEST_DIR: &str = "/data/tmp/work";
3030
/// The two modes of the test runner; tests or benchmarks.
3131
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, PartialOrd, Ord)]
3232
pub enum TestKind {
33-
/// Run `cargo test`
33+
/// Run `cargo test`.
3434
Test,
35-
/// Run `cargo bench`
35+
/// Run `cargo bench`.
3636
Bench,
3737
}
3838

@@ -1288,7 +1288,7 @@ impl Step for DocTest {
12881288
run.never()
12891289
}
12901290

1291-
/// Run `rustdoc --test` for all documentation in `src/doc`.
1291+
/// Runs `rustdoc --test` for all documentation in `src/doc`.
12921292
///
12931293
/// This will run all tests in our markdown documentation (e.g., the book)
12941294
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
@@ -1408,7 +1408,7 @@ impl Step for ErrorIndex {
14081408
});
14091409
}
14101410

1411-
/// Run the error index generator tool to execute the tests located in the error
1411+
/// Runs the error index generator tool to execute the tests located in the error
14121412
/// index.
14131413
///
14141414
/// The `error_index_generator` tool lives in `src/tools` and is used to
@@ -1614,7 +1614,7 @@ impl Step for Crate {
16141614
}
16151615
}
16161616

1617-
/// Run all unit tests plus documentation tests for a given crate defined
1617+
/// Runs all unit tests plus documentation tests for a given crate defined
16181618
/// by a `Cargo.toml` (single manifest)
16191619
///
16201620
/// This is what runs tests for crates like the standard library, compiler, etc.
@@ -1833,7 +1833,7 @@ fn envify(s: &str) -> String {
18331833
/// the standard library and such to the emulator ahead of time. This step
18341834
/// represents this and is a dependency of all test suites.
18351835
///
1836-
/// Most of the time this is a noop. For some steps such as shipping data to
1836+
/// Most of the time this is a no-op. For some steps such as shipping data to
18371837
/// QEMU we have to build our own tools so we've got conditional dependencies
18381838
/// on those programs as well. Note that the remote test client is built for
18391839
/// the build target (us) and the server is built for the target.
@@ -1904,7 +1904,7 @@ impl Step for Distcheck {
19041904
run.builder.ensure(Distcheck);
19051905
}
19061906

1907-
/// Run "distcheck", a 'make check' from a tarball
1907+
/// Runs "distcheck", a 'make check' from a tarball
19081908
fn run(self, builder: &Builder) {
19091909
builder.info("Distcheck");
19101910
let dir = builder.out.join("tmp").join("distcheck");
@@ -1965,7 +1965,7 @@ impl Step for Bootstrap {
19651965
const DEFAULT: bool = true;
19661966
const ONLY_HOSTS: bool = true;
19671967

1968-
/// Test the build system itself
1968+
/// Tests the build system itself.
19691969
fn run(self, builder: &Builder) {
19701970
let mut cmd = Command::new(&builder.initial_cargo);
19711971
cmd.arg("test")

src/bootstrap/tool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Step for ToolBuild {
4040
run.never()
4141
}
4242

43-
/// Build a tool in `src/tools`
43+
/// Builds a tool in `src/tools`
4444
///
4545
/// This will build the specified tool with the specified `host` compiler in
4646
/// `stage` into the normal cargo output directory.
@@ -621,7 +621,7 @@ tool_extended!((self, builder),
621621
);
622622

623623
impl<'a> Builder<'a> {
624-
/// Get a `Command` which is ready to run `tool` in `stage` built for
624+
/// Gets a `Command` which is ready to run `tool` in `stage` built for
625625
/// `host`.
626626
pub fn tool_cmd(&self, tool: Tool) -> Command {
627627
let mut cmd = Command::new(self.tool_exe(tool));

src/bootstrap/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn exe(name: &str, target: &str) -> String {
3333
}
3434
}
3535

36-
/// Returns whether the file name given looks like a dynamic library.
36+
/// Returns `true` if the file name given looks like a dynamic library.
3737
pub fn is_dylib(name: &str) -> bool {
3838
name.ends_with(".dylib") || name.ends_with(".so") || name.ends_with(".dll")
3939
}

src/build_helper/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn mtime(path: &Path) -> SystemTime {
163163
.unwrap_or(UNIX_EPOCH)
164164
}
165165

166-
/// Returns whether `dst` is up to date given that the file or files in `src`
166+
/// Returns `true` if `dst` is up to date given that the file or files in `src`
167167
/// are used to generate it.
168168
///
169169
/// Uses last-modified time checks to verify this.
@@ -190,12 +190,12 @@ pub struct NativeLibBoilerplate {
190190
}
191191

192192
impl NativeLibBoilerplate {
193-
/// On OSX we don't want to ship the exact filename that compiler-rt builds.
193+
/// On macOS we don't want to ship the exact filename that compiler-rt builds.
194194
/// This conflicts with the system and ours is likely a wildly different
195195
/// version, so they can't be substituted.
196196
///
197197
/// As a result, we rename it here but we need to also use
198-
/// `install_name_tool` on OSX to rename the commands listed inside of it to
198+
/// `install_name_tool` on macOS to rename the commands listed inside of it to
199199
/// ensure it's linked against correctly.
200200
pub fn fixup_sanitizer_lib_name(&self, sanitizer_name: &str) {
201201
if env::var("TARGET").unwrap() != "x86_64-apple-darwin" {

src/liballoc/borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ impl<T> ToOwned for T
137137
/// ```
138138
/// use std::borrow::{Cow, ToOwned};
139139
///
140-
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned=Vec<X>> {
140+
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
141141
/// values: Cow<'a, [X]>,
142142
/// }
143143
///
144-
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned=Vec<X>> {
144+
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
145145
/// fn new(v: Cow<'a, [X]>) -> Self {
146146
/// Items { values: v }
147147
/// }

src/liballoc/collections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ struct Hole<'a, T: 'a> {
863863
}
864864

865865
impl<'a, T> Hole<'a, T> {
866-
/// Create a new Hole at index `pos`.
866+
/// Create a new `Hole` at index `pos`.
867867
///
868868
/// Unsafe because pos must be within the data slice.
869869
#[inline]

src/liballoc/collections/btree/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
23682368

23692369
/// Gets a mutable reference to the value in the entry.
23702370
///
2371-
/// If you need a reference to the `OccupiedEntry` which may outlive the
2371+
/// If you need a reference to the `OccupiedEntry` that may outlive the
23722372
/// destruction of the `Entry` value, see [`into_mut`].
23732373
///
23742374
/// [`into_mut`]: #method.into_mut

0 commit comments

Comments
 (0)