Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various minor/cosmetic improvements to code #56578

Merged
merged 7 commits into from
Dec 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ impl<'a> Builder<'a> {
}

// Set a flag for `check` so that certain build scripts can do less work
// (e.g. not building/requiring LLVM).
// (e.g., not building/requiring LLVM).
if cmd == "check" {
cargo.env("RUST_CHECK", "1");
}
Expand Down Expand Up @@ -923,12 +923,12 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_FORCE_UNSTABLE", "1");

// Currently the compiler depends on crates from crates.io, and
// then other crates can depend on the compiler (e.g. proc-macro
// then other crates can depend on the compiler (e.g., proc-macro
// crates). Let's say, for example that rustc itself depends on the
// bitflags crate. If an external crate then depends on the
// bitflags crate as well, we need to make sure they don't
// conflict, even if they pick the same version of bitflags. We'll
// want to make sure that e.g. a plugin and rustc each get their
// want to make sure that e.g., a plugin and rustc each get their
// own copy of bitflags.

// Cargo ensures that this works in general through the -C metadata
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl Step for Mingw {
/// Build the `rust-mingw` installer component.
///
/// This contains all the bits and pieces to run the MinGW Windows targets
/// without any extra installed software (e.g. we bundle gcc, libraries, etc).
/// without any extra installed software (e.g., we bundle gcc, libraries, etc).
fn run(self, builder: &Builder) -> Option<PathBuf> {
let host = self.host;

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
opts.optopt("", "on-fail", "command to run on failure", "CMD");
opts.optflag("", "dry-run", "dry run; don't build anything");
opts.optopt("", "stage",
"stage to build (indicates compiler to use/test, e.g. stage 0 uses the \
"stage to build (indicates compiler to use/test, e.g., stage 0 uses the \
bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)",
"N");
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling \
(pass multiple times to keep e.g. both stages 0 and 1)", "N");
(pass multiple times to keep e.g., both stages 0 and 1)", "N");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! Job management on Windows for bootstrapping
//!
//! Most of the time when you're running a build system (e.g. make) you expect
//! Most of the time when you're running a build system (e.g., make) you expect
//! Ctrl-C or abnormal termination to actually terminate the entire tree of
//! process in play, not just the one at the top. This currently works "by
//! default" on Unix platforms because Ctrl-C actually sends a signal to the
Expand Down Expand Up @@ -162,11 +162,11 @@ pub unsafe fn setup(build: &mut Build) {
return
}

// If we've got a parent process (e.g. the python script that called us)
// If we've got a parent process (e.g., the python script that called us)
// then move ownership of this job object up to them. That way if the python
// script is killed (e.g. via ctrl-c) then we'll all be torn down.
// script is killed (e.g., via ctrl-c) then we'll all be torn down.
//
// If we don't have a parent (e.g. this was run directly) then we
// If we don't have a parent (e.g., this was run directly) then we
// intentionally leak the job object handle. When our process exits
// (normally or abnormally) it will close the handle implicitly, causing all
// processes in the job to be cleaned up.
Expand All @@ -184,7 +184,7 @@ pub unsafe fn setup(build: &mut Build) {

// If this failed, well at least we tried! An example of DuplicateHandle
// failing in the past has been when the wrong python2 package spawned this
// build system (e.g. the `python2` package in MSYS instead of
// build system (e.g., the `python2` package in MSYS instead of
// `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure
// mode" here is that we only clean everything up when the build system
// dies, not when the python parent does, so not too bad.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! However, compiletest itself tries to avoid running tests when the artifacts
//! that are involved (mainly the compiler) haven't changed.
//!
//! When you execute `x.py build`, the steps which are executed are:
//! When you execute `x.py build`, the steps executed are:
//!
//! * First, the python script is run. This will automatically download the
//! stage0 rustc and cargo according to `src/stage0.txt`, or use the cached
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl Step for Llvm {
configure_cmake(builder, target, &mut cfg, false);

// FIXME: we don't actually need to build all LLVM tools and all LLVM
// libraries here, e.g. we just want a few components and a few
// libraries here, e.g., we just want a few components and a few
// tools. Figure out how to filter them down and only build the right
// tools and libs on all platforms.

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ impl Step for Compiletest {
}

if builder.no_std(target) == Some(true) {
// for no_std run-make (e.g. thumb*),
// for no_std run-make (e.g., thumb*),
// we need a host compiler which is called by cargo.
builder.ensure(compile::Std { compiler, target: compiler.host });
}
Expand Down Expand Up @@ -1277,7 +1277,7 @@ impl Step for DocTest {

/// Run `rustdoc --test` for all documentation in `src/doc`.
///
/// This will run all tests in our markdown documentation (e.g. the book)
/// This will run all tests in our markdown documentation (e.g., the book)
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
/// `compiler`.
fn run(self, builder: &Builder) {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ impl<'a> Builder<'a> {
self.cargo_out(compiler, tool.get_mode(), *host).join("deps"),
];

// On MSVC a tool may invoke a C compiler (e.g. compiletest in run-make
// On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make
// mode) and that C compiler may need some extra PATH modification. Do
// so here.
if compiler.host.contains("msvc") {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
* safe.)
* - It is in practice very useful to have Box<T> be unconditionally
* Unpin because of trait objects, for which the structural auto
* trait functionality does not apply (e.g. Box<dyn Foo> would
* trait functionality does not apply (e.g., Box<dyn Foo> would
* otherwise not be Unpin).
*
* Another type with the same semantics as Box but only a conditional
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/collections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ impl<T: Ord> BinaryHeap<T> {
}
}

/// Hole represents a hole in a slice i.e. an index without valid value
/// Hole represents a hole in a slice i.e., an index without valid value
/// (because it was moved from or duplicated).
/// In drop, `Hole` will restore the slice by filling the hole
/// position with the value that was originally removed.
Expand Down
12 changes: 6 additions & 6 deletions src/liballoc/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Visits the values representing the difference,
/// i.e. the values that are in `self` but not in `other`,
/// i.e., the values that are in `self` but not in `other`,
/// in ascending order.
///
/// # Examples
Expand Down Expand Up @@ -286,7 +286,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Visits the values representing the symmetric difference,
/// i.e. the values that are in `self` or in `other` but not in both,
/// i.e., the values that are in `self` or in `other` but not in both,
/// in ascending order.
///
/// # Examples
Expand Down Expand Up @@ -316,7 +316,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Visits the values representing the intersection,
/// i.e. the values that are both in `self` and `other`,
/// i.e., the values that are both in `self` and `other`,
/// in ascending order.
///
/// # Examples
Expand Down Expand Up @@ -344,7 +344,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Visits the values representing the union,
/// i.e. all the values in `self` or `other`, without duplicates,
/// i.e., all the values in `self` or `other`, without duplicates,
/// in ascending order.
///
/// # Examples
Expand Down Expand Up @@ -455,7 +455,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Returns `true` if the set is a subset of another,
/// i.e. `other` contains at least all the values in `self`.
/// i.e., `other` contains at least all the values in `self`.
///
/// # Examples
///
Expand Down Expand Up @@ -498,7 +498,7 @@ impl<T: Ord> BTreeSet<T> {
}

/// Returns `true` if the set is a superset of another,
/// i.e. `self` contains at least all the values in `other`.
/// i.e., `self` contains at least all the values in `other`.
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> {
// On 64-bit we just need to check for overflow since trying to allocate
// `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
// an extra guard for this in case we're running on a platform which can use
// all 4GB in user-space. e.g. PAE or x32
// all 4GB in user-space. e.g., PAE or x32

#[inline]
fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct RcBox<T: ?Sized> {
/// See the [module-level documentation](./index.html) for more details.
///
/// The inherent methods of `Rc` are all associated functions, which means
/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
/// that you have to call them as e.g., [`Rc::get_mut(&mut value)`][get_mut] instead of
/// `value.get_mut()`. This avoids conflicts with methods of the inner
/// type `T`.
///
Expand Down Expand Up @@ -1252,7 +1252,7 @@ impl<T: ?Sized> Weak<T> {
}

/// Return `None` when the pointer is dangling and there is no allocated `RcBox`,
/// i.e. this `Weak` was created by `Weak::new`
/// i.e., this `Weak` was created by `Weak::new`
#[inline]
fn inner(&self) -> Option<&RcBox<T>> {
if is_dangling(self.ptr) {
Expand Down
10 changes: 5 additions & 5 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ mod hack {
impl<T> [T] {
/// Sorts the slice.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
/// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
///
/// When applicable, unstable sorting is preferred because it is generally faster than stable
/// sorting and it doesn't allocate auxiliary memory.
Expand Down Expand Up @@ -211,7 +211,7 @@ impl<T> [T] {

/// Sorts the slice with a comparator function.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
/// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
///
/// The comparator function must define a total ordering for the elements in the slice. If
/// the ordering is not total, the order of the elements is unspecified. An order is a
Expand Down Expand Up @@ -264,7 +264,7 @@ impl<T> [T] {

/// Sorts the slice with a key extraction function.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(m n log(m n))`
/// This sort is stable (i.e., does not reorder equal elements) and `O(m n log(m n))`
/// worst-case, where the key function is `O(m)`.
///
/// When applicable, unstable sorting is preferred because it is generally faster than stable
Expand Down Expand Up @@ -301,10 +301,10 @@ impl<T> [T] {
///
/// During sorting, the key function is called only once per element.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
/// This sort is stable (i.e., does not reorder equal elements) and `O(m n + n log n)`
/// worst-case, where the key function is `O(m)`.
///
/// For simple key functions (e.g. functions that are property accesses or
/// For simple key functions (e.g., functions that are property accesses or
/// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be
/// faster.
///
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ impl<T: ?Sized> Weak<T> {
}

/// Return `None` when the pointer is dangling and there is no allocated `ArcInner`,
/// i.e. this `Weak` was created by `Weak::new`
/// i.e., this `Weak` was created by `Weak::new`
#[inline]
fn inner(&self) -> Option<&ArcInner<T>> {
if is_dangling(self.ptr) {
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ fn test_sort_stability() {
// create a vector like [(6, 1), (5, 1), (6, 2), ...],
// where the first item of each tuple is random, but
// the second item represents which occurrence of that
// number this element is, i.e. the second elements
// number this element is, i.e., the second elements
// will occur in sorted order.
let mut orig: Vec<_> = (0..len)
.map(|_| {
Expand All @@ -502,7 +502,7 @@ fn test_sort_stability() {
// This comparison includes the count (the second item
// of the tuple), so elements with equal first items
// will need to be ordered with increasing
// counts... i.e. exactly asserting that this sort is
// counts... i.e., exactly asserting that this sort is
// stable.
assert!(v.windows(2).all(|w| w[0] <= w[1]));

Expand Down Expand Up @@ -1579,7 +1579,7 @@ macro_rules! test {
}).join();

// Check that the number of things dropped is exactly
// what we expect (i.e. the contents of `v`).
// what we expect (i.e., the contents of `v`).
for (i, c) in DROP_COUNTS.iter().enumerate().take(len) {
let count = c.load(Relaxed);
assert!(count == 1,
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ fn test_escape_debug() {
// Note that there are subtleties with the number of backslashes
// on the left- and right-hand sides. In particular, Unicode code points
// are usually escaped with two backslashes on the right-hand side, as
// they are escaped. However, when the character is unescaped (e.g. for
// they are escaped. However, when the character is unescaped (e.g., for
// printable characters), only a single backslash appears (as the character
// itself appears in the debug string).
assert_eq!("abc".escape_debug(), "abc");
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ use raw_vec::RawVec;
/// about its design. This ensures that it's as low-overhead as possible in
/// the general case, and can be correctly manipulated in primitive ways
/// by unsafe code. Note that these guarantees refer to an unqualified `Vec<T>`.
/// If additional type parameters are added (e.g. to support custom allocators),
/// If additional type parameters are added (e.g., to support custom allocators),
/// overriding their defaults may change the behavior.
///
/// Most fundamentally, `Vec` is and always will be a (pointer, capacity, length)
Expand Down
Loading