Skip to content

Commit

Permalink
Various cosmetic improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Regueiro committed Jan 1, 2019
1 parent fe6a54d commit 6434aaf
Show file tree
Hide file tree
Showing 1,600 changed files with 5,660 additions and 5,734 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn main() {
//
// `compiler_builtins` are unconditionally compiled with panic=abort to
// workaround undefined references to `rust_eh_unwind_resume` generated
// otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
// otherwise, see issue #43095.
if crate_name == "panic_abort" ||
crate_name == "compiler_builtins" && stage != "0" {
cmd.arg("-C").arg("panic=abort");
Expand Down
20 changes: 10 additions & 10 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,12 @@ impl<'a> Builder<'a> {
}

cargo.arg("-j").arg(self.jobs().to_string());
// Remove make-related flags to ensure Cargo can correctly set things up
// Remove make-related flags to ensure Cargo can correctly set things up.
cargo.env_remove("MAKEFLAGS");
cargo.env_remove("MFLAGS");

// FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005
// Force cargo to output binaries with disambiguating hashes in the name
// FIXME: temporary fix for Cargo issue #3005.
// Force cargo to output binaries with disambiguating hashes in the name.
let metadata = if compiler.stage == 0 {
// Treat stage0 like special channel, whether it's a normal prior-
// release rustc or a local rebuild with the same version, so we
Expand Down Expand Up @@ -901,7 +901,7 @@ impl<'a> Builder<'a> {

if mode.is_tool() {
// Tools like cargo and rls don't get debuginfo by default right now, but this can be
// enabled in the config. Adding debuginfo makes them several times larger.
// enabled in the config. Adding debuginfo makes them several times larger.
if self.config.rust_debuginfo_tools {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
cargo.env(
Expand Down Expand Up @@ -1007,7 +1007,7 @@ impl<'a> Builder<'a> {
// Build scripts use either the `cc` crate or `configure/make` so we pass
// the options through environment variables that are fetched and understood by both.
//
// FIXME: the guard against msvc shouldn't need to be here
// FIXME: the guard against `msvc` shouldn't need to be here.
if target.contains("msvc") {
if let Some(ref cl) = self.config.llvm_clang_cl {
cargo.env("CC", cl).env("CXX", cl);
Expand All @@ -1019,7 +1019,7 @@ impl<'a> Builder<'a> {
Some(ref s) => s,
None => return s.display().to_string(),
};
// FIXME: the cc-rs crate only recognizes the literal strings
// FIXME: the cc-rs crate only recognizes the literal strings.
// `ccache` and `sccache` when doing caching compilations, so we
// mirror that here. It should probably be fixed upstream to
// accept a new env var or otherwise work with custom ccache
Expand Down Expand Up @@ -1064,12 +1064,12 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
}

// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs.
cargo.env("RUSTDOC_CRATE_VERSION", self.rust_version());

// Environment variables *required* throughout the build
// Environment variables *required* throughout the build.
//
// FIXME: should update code to not require this env var
// FIXME: should update code to not require this env var.
cargo.env("CFG_COMPILER_HOST_TRIPLE", target);

// Set this for all builds to make sure doc builds also get it.
Expand Down Expand Up @@ -1460,7 +1460,7 @@ mod __test {
#[test]
fn dist_with_target_flag() {
let mut config = configure(&["B"], &["C"]);
config.run_host_only = false; // as-if --target=C was passed
config.run_host_only = false; // as if `--target=C` were passed
let build = Build::new(config);
let mut builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl<T: Hash + Clone + Eq> Default for TyIntern<T> {
impl<T: Hash + Clone + Eq> TyIntern<T> {
fn intern_borrow<B>(&mut self, item: &B) -> Interned<T>
where
B: Eq + Hash + ToOwned<Owned=T> + ?Sized,
B: Eq + Hash + ToOwned<Owned = T> + ?Sized,
T: Borrow<B>,
{
if let Some(i) = self.set.get(&item) {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Responsible for cleaning out a build directory of all old and stale
//! artifacts to prepare for a fresh build. Currently doesn't remove the
//! `build/cache` directory (download cache) or the `build/$target/llvm`
//! directory unless the --all flag is present.
//! directory unless the `--all` flag is present.

use std::fs;
use std::io::{self, ErrorKind};
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ pub fn std_cargo(builder: &Builder,
let features = builder.std_features();

if compiler.stage != 0 && builder.config.sanitizers {
// This variable is used by the sanitizer runtime crates, e.g.
// rustc_lsan, to build the sanitizer runtime from C code
// This variable is used by the sanitizer runtime crates, e.g.,
// `rustc_lsan`, to build the sanitizer runtime from C code
// When this variable is missing, those crates won't compile the C code,
// so we don't set this variable during stage0 where llvm-config is
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// We also only build the runtimes when `--enable-sanitizers` (or its
// config.toml equivalent) is used
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
Expand Down Expand Up @@ -933,17 +933,17 @@ impl Step for Assemble {
// produce some other architecture compiler we need to start from
// `build` to get there.
//
// FIXME: Perhaps we should download those libraries?
// FIXME: perhaps we should download those libraries?
// It would make builds faster...
//
// FIXME: It may be faster if we build just a stage 1 compiler and then
// FIXME: it may be faster if we build just a stage 1 compiler and then
// use that to bootstrap this compiler forward.
let build_compiler =
builder.compiler(target_compiler.stage - 1, builder.config.build);

// Build the libraries for this compiler to link to (i.e., the libraries
// it uses at runtime). NOTE: Crates the target compiler compiles don't
// link to these. (FIXME: Is that correct? It seems to be correct most
// link to these. (FIXME: is that correct? It seems to be correct most
// of the time but I think we do link to these for stage2/bin compilers
// when not performing a full bootstrap).
builder.ensure(Rustc {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2062,8 +2062,8 @@ impl Step for Lldb {
}
}

// The lldb scripts might be installed in lib/python$version
// or in lib64/python$version. If lib64 exists, use it;
// The lldb scripts might be installed in `lib/python$version`
// or in `lib64/python$version`. If lib64 exists, use it;
// otherwise lib.
let libdir = builder.llvm_out(target).join("lib64");
let (libdir, libdir_name) = if libdir.exists() {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl Step for Std {
.arg("-p").arg(package);
// Create all crate output directories first to make sure rustdoc uses
// relative links.
// FIXME: Cargo should probably do this itself.
// FIXME: cargo should probably do this itself.
t!(fs::create_dir_all(out_dir.join(package)));
cargo.arg("--")
.arg("--markdown-css").arg("rust.css")
Expand Down Expand Up @@ -711,7 +711,7 @@ impl Step for Rustc {
for krate in &compiler_crates {
// Create all crate output directories first to make sure rustdoc uses
// relative links.
// FIXME: Cargo should probably do this itself.
// FIXME: cargo should probably do this itself.
t!(fs::create_dir_all(out_dir.join(krate)));
cargo.arg("-p").arg(krate);
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
// We can't use getopt to parse the options until we have completed specifying which
// options are valid, but under the current implementation, some options are conditional on
// the subcommand. Therefore we must manually identify the subcommand first, so that we can
// complete the definition of the options. Then we can use the getopt::Matches object from
// complete the definition of the options. Then we can use the `getopt::Matches` object from
// there on out.
let subcommand = args.iter().find(|&s| {
(s == "build")
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
//! ## Copying stage0 {std,test,rustc}
//!
//! This copies the build output from Cargo into
//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: This step's
//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: this step's
//! documentation should be expanded -- the information already here may be
//! incorrect.
//!
Expand Down Expand Up @@ -606,7 +606,7 @@ impl Build {
self.out.join(&*target).join("crate-docs")
}

/// Returns true if no custom `llvm-config` is set for the specified target.
/// Returns whether no custom `llvm-config` is set for the specified target.
///
/// If no custom `llvm-config` was specified then Rust's llvm will be used.
fn is_rust_llvm(&self, target: Interned<String>) -> bool {
Expand Down Expand Up @@ -853,7 +853,7 @@ impl Build {
.map(|p| &**p)
}

/// Returns true if this is a no-std `target`, if defined
/// Returns whether this is a no-std `target`, if defined
fn no_std(&self, target: Interned<String>) -> Option<bool> {
self.config.target_config.get(&target)
.map(|t| t.no_std)
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl Step for Llvm {
cfg.define("LLDB_CODESIGN_IDENTITY", "");
} else {
// LLDB requires libxml2; but otherwise we want it to be disabled.
// See https://github.com/rust-lang/rust/pull/50104
// See PR #50104.
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
}

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ pub fn check(build: &mut Build) {
// On Windows, quotes are invalid characters for filename paths, and if
// one is present as part of the PATH then that can lead to the system
// being unable to identify the files properly. See
// https://github.com/rust-lang/rust/issues/34959 for more details.
// issue #34959 for more details.
if cfg!(windows) && path.to_string_lossy().contains('\"') {
panic!("PATH contains invalid character '\"'");
}

let mut cmd_finder = Finder::new();
// If we've got a git directory we're gonna need git to update
// If we've got a Git directory we're gonna need git to update
// submodules and learn about various other aspects.
if build.rust_info.is_git() {
cmd_finder.must_have("git");
Expand Down Expand Up @@ -122,7 +122,7 @@ pub fn check(build: &mut Build) {
// We're gonna build some custom C code here and there, host triples
// also build some C++ shims for LLVM so we need a C++ compiler.
for target in &build.targets {
// On emscripten we don't actually need the C compiler to just
// On Emscripten we don't actually need the C compiler to just
// build the target artifacts, only for testing. For the sake
// of easier bot configuration, just skip detection.
if target.contains("emscripten") {
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ impl Step for Clippy {
}

fn path_for_cargo(builder: &Builder, compiler: Compiler) -> OsString {
// Configure PATH to find the right rustc. NB. we have to use PATH
// and not RUSTC because the Cargo test suite has tests that will
// Configure `PATH` to find the right rustc. N.B., we have to use PATH
// and not `RUSTC` because the Cargo test suite has tests that will
// fail if rustc is not spelled `rustc`.
let path = builder.sysroot(compiler).join("bin");
let old_path = env::var_os("PATH").unwrap_or_default();
Expand Down Expand Up @@ -971,7 +971,7 @@ impl Step for Compiletest {
}

if suite.ends_with("fulldeps") ||
// FIXME: Does pretty need librustc compiled? Note that there are
// FIXME: does pretty need librustc compiled? Note that there are
// fulldeps test suites with mode = pretty as well.
mode == "pretty"
{
Expand Down Expand Up @@ -1966,7 +1966,7 @@ impl Step for Bootstrap {
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;

/// Test the build system itself
/// Test the build system itself.
fn run(self, builder: &Builder) {
let mut cmd = Command::new(&builder.initial_cargo);
cmd.arg("test")
Expand All @@ -1977,8 +1977,8 @@ impl Step for Bootstrap {
.env("RUSTC", &builder.initial_rustc);
if let Some(flags) = option_env!("RUSTFLAGS") {
// Use the same rustc flags for testing as for "normal" compilation,
// so that Cargo doesn’t recompile the entire dependency graph every time:
// https://github.com/rust-lang/rust/issues/49215
// so that Cargo doesn’t recompile the entire dependency graph every time
// (issue #49215).
cmd.env("RUSTFLAGS", flags);
}
if !builder.fail_fast {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use core::usize;
pub use core::alloc::*;

extern "Rust" {
// These are the magic symbols to call the global allocator. rustc generates
// These are the magic symbols to call the global allocator. rustc generates
// them from the `#[global_allocator]` attribute if there is one, or uses the
// default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`)
// otherwise.
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ impl<T> ToOwned for T
/// ```
/// use std::borrow::{Cow, ToOwned};
///
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned=Vec<X>> {
/// struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
/// values: Cow<'a, [X]>,
/// }
///
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned=Vec<X>> {
/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
/// fn new(v: Cow<'a, [X]>) -> Self {
/// Items { values: v }
/// }
Expand Down Expand Up @@ -262,7 +262,7 @@ impl<'a, B: ?Sized> Cow<'a, B>
/// );
/// ```
///
/// Calling `into_owned` on a `Cow::Owned` is a no-op:
/// Calling `into_owned` on a `Cow::Owned` is a noop:
///
/// ```
/// use std::borrow::Cow;
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl<T: ?Sized> Box<T> {
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<#[may_dangle] T: ?Sized> Drop for Box<T> {
fn drop(&mut self) {
// FIXME: Do nothing, drop is currently performed by compiler.
// FIXME: do nothing; drop is currently performed by compiler.
}
}

Expand Down Expand Up @@ -457,7 +457,7 @@ impl<T> From<Box<T>> for Pin<Box<T>> {
/// This conversion does not allocate on the heap and happens in place.
fn from(boxed: Box<T>) -> Self {
// It's not possible to move or replace the insides of a `Pin<Box<T>>`
// when `T: !Unpin`, so it's safe to pin it directly without any
// when `T: !Unpin`, so it's safe to pin it directly without any
// additional requirements.
unsafe { Pin::new_unchecked(boxed) }
}
Expand Down
10 changes: 5 additions & 5 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
}
}

/// Returns `true` if the map contains a value for the specified key.
/// Returns whether the map contains a value for the specified key.
///
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
Expand Down Expand Up @@ -892,7 +892,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn entry(&mut self, key: K) -> Entry<K, V> {
// FIXME(@porglezomp) Avoid allocating if we don't insert
// FIXME(porglezomp): avoid allocating if we don't insert.
self.ensure_root_is_owned();
match search::search_tree(self.root.as_mut(), &key) {
Found(handle) => {
Expand Down Expand Up @@ -1841,12 +1841,12 @@ fn range_search<BorrowType, K, V, Q: ?Sized, R: RangeBounds<Q>>(
where Q: Ord, K: Borrow<Q>
{
match (range.start_bound(), range.end_bound()) {
(Excluded(s), Excluded(e)) if s==e =>
(Excluded(s), Excluded(e)) if s == e =>
panic!("range start and end are equal and excluded in BTreeMap"),
(Included(s), Included(e)) |
(Included(s), Excluded(e)) |
(Excluded(s), Included(e)) |
(Excluded(s), Excluded(e)) if s>e =>
(Excluded(s), Excluded(e)) if s > e =>
panic!("range start is greater than range end in BTreeMap"),
_ => {},
};
Expand Down Expand Up @@ -2072,7 +2072,7 @@ impl<K, V> BTreeMap<K, V> {
self.length
}

/// Returns `true` if the map contains no elements.
/// Returns whether the map contains no elements.
///
/// # Examples
///
Expand Down
Loading

0 comments on commit 6434aaf

Please sign in to comment.