From 20167abe90eb21e3f9a153ed002ce341b4da4756 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 14 Aug 2017 20:56:54 +0200 Subject: [PATCH 01/16] Add help for static method invalid use --- src/librustc_typeck/check/method/suggest.rs | 1 + src/test/ui/issue-41652/issue_41652.stderr | 1 + src/test/ui/span/issue-7575.stderr | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 56eacc3194d1..11c043750357 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -260,6 +260,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !static_sources.is_empty() { err.note("found the following associated functions; to be used as methods, \ functions must have a `self` parameter"); + err.help(&format!("try with `{}::{}`", self.ty_to_string(actual), item_name)); report_candidates(&mut err, static_sources); } diff --git a/src/test/ui/issue-41652/issue_41652.stderr b/src/test/ui/issue-41652/issue_41652.stderr index 8a55c9989e18..5d1436979082 100644 --- a/src/test/ui/issue-41652/issue_41652.stderr +++ b/src/test/ui/issue-41652/issue_41652.stderr @@ -5,6 +5,7 @@ error[E0599]: no method named `f` found for type `{integer}` in the current scop | ^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter + = help: try with `{integer}::f` note: candidate #1 is defined in the trait `issue_41652_b::Tr` --> $DIR/auxiliary/issue_41652_b.rs:14:5 | diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index ff62adbfbd5f..08ec2a87fcdc 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -5,6 +5,7 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope | ^^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter + = help: try with `usize::f9` note: candidate #1 is defined in the trait `CtxtFn` --> $DIR/issue-7575.rs:16:5 | @@ -36,6 +37,7 @@ error[E0599]: no method named `fff` found for type `Myisize` in the current scop | ^^^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter + = help: try with `Myisize::fff` note: candidate #1 is defined in an impl for the type `Myisize` --> $DIR/issue-7575.rs:51:5 | @@ -51,6 +53,7 @@ error[E0599]: no method named `is_str` found for type `T` in the current scope | ^^^^^^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter + = help: try with `T::is_str` note: candidate #1 is defined in the trait `ManyImplTrait` --> $DIR/issue-7575.rs:57:5 | From 3af0e4a2ad40253b67e5259b6cb0a5b6c289d3e9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 14 Aug 2017 21:56:55 +0200 Subject: [PATCH 02/16] Remove useless help part --- src/librustc_typeck/check/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 17611af5ac41..0bb6f128d632 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2944,8 +2944,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { type_error_struct!(self.tcx().sess, field.span, expr_t, E0615, "attempted to take value of method `{}` on type `{}`", field.node, expr_t) - .help("maybe a `()` to call it is missing? \ - If not, try an anonymous function") + .help("maybe a `()` to call it is missing?") .emit(); self.tcx().types.err } else { From 034cd20f528c88be114cbd10c9a28d971ac12acc Mon Sep 17 00:00:00 2001 From: kennytm Date: Tue, 15 Aug 2017 06:58:47 +0800 Subject: [PATCH 03/16] Exclude `impl Trait` functions from everybody_loops. Fixes #43869. --- src/librustc_driver/pretty.rs | 41 ++++++++++++++++++++++++++++----- src/test/rustdoc/issue-43869.rs | 32 +++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 src/test/rustdoc/issue-43869.rs diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 84d3ab65b1c1..bdc6f3bb56c9 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -620,6 +620,15 @@ impl UserIdentifiedItem { } // Note: Also used by librustdoc, see PR #43348. Consider moving this struct elsewhere. +// +// FIXME: Currently the `everybody_loops` transformation is not applied to: +// * `const fn`, due to issue #43636 that `loop` is not supported for const evaluation. We are +// waiting for miri to fix that. +// * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging. +// Solving this may require `!` to implement every trait, which relies on the an even more +// ambitious form of the closed RFC #1637. See also [#34511]. +// +// [#34511]: https://github.com/rust-lang/rust/issues/34511#issuecomment-322340401 pub struct ReplaceBodyWithLoop { within_static_or_const: bool, } @@ -635,14 +644,34 @@ impl ReplaceBodyWithLoop { self.within_static_or_const = old_const; ret } + + fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool { + if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output { + fn involves_impl_trait(ty: &ast::Ty) -> bool { + match ty.node { + ast::TyKind::ImplTrait(_) => true, + ast::TyKind::Slice(ref subty) | + ast::TyKind::Array(ref subty, _) | + ast::TyKind::Ptr(ast::MutTy { ty: ref subty, .. }) | + ast::TyKind::Rptr(_, ast::MutTy { ty: ref subty, .. }) | + ast::TyKind::Paren(ref subty) => involves_impl_trait(subty), + ast::TyKind::Tup(ref tys) => tys.iter().any(|subty| involves_impl_trait(subty)), + _ => false, + } + } + involves_impl_trait(ty) + } else { + false + } + } } impl fold::Folder for ReplaceBodyWithLoop { fn fold_item_kind(&mut self, i: ast::ItemKind) -> ast::ItemKind { let is_const = match i { ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => true, - ast::ItemKind::Fn(_, _, ref constness, _, _, _) => - constness.node == ast::Constness::Const, + ast::ItemKind::Fn(ref decl, _, ref constness, _, _, _) => + constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), _ => false, }; self.run(is_const, |s| fold::noop_fold_item_kind(i, s)) @@ -651,8 +680,8 @@ impl fold::Folder for ReplaceBodyWithLoop { fn fold_trait_item(&mut self, i: ast::TraitItem) -> SmallVector { let is_const = match i.node { ast::TraitItemKind::Const(..) => true, - ast::TraitItemKind::Method(ast::MethodSig { ref constness, .. }, _) => - constness.node == ast::Constness::Const, + ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref constness, .. }, _) => + constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), _ => false, }; self.run(is_const, |s| fold::noop_fold_trait_item(i, s)) @@ -661,8 +690,8 @@ impl fold::Folder for ReplaceBodyWithLoop { fn fold_impl_item(&mut self, i: ast::ImplItem) -> SmallVector { let is_const = match i.node { ast::ImplItemKind::Const(..) => true, - ast::ImplItemKind::Method(ast::MethodSig { ref constness, .. }, _) => - constness.node == ast::Constness::Const, + ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref constness, .. }, _) => + constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), _ => false, }; self.run(is_const, |s| fold::noop_fold_impl_item(i, s)) diff --git a/src/test/rustdoc/issue-43869.rs b/src/test/rustdoc/issue-43869.rs new file mode 100644 index 000000000000..2d18e4be5328 --- /dev/null +++ b/src/test/rustdoc/issue-43869.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +pub fn g() -> impl Iterator { + Some(1u8).into_iter() +} + +pub fn h() -> (impl Iterator) { + Some(1u8).into_iter() +} + +pub fn i() -> impl Iterator + 'static { + Some(1u8).into_iter() +} + +pub fn j() -> impl Iterator + Clone { + Some(1u8).into_iter() +} + +// @has issue_43869/fn.g.html +// @has issue_43869/fn.h.html +// @has issue_43869/fn.i.html +// @has issue_43869/fn.j.html From 438abf0a583680b73d1cf804aca86be948bd50af Mon Sep 17 00:00:00 2001 From: kennytm Date: Tue, 15 Aug 2017 22:41:38 +0800 Subject: [PATCH 04/16] Stop testing i586-pc-windows-msvc on AppVeyor. Fixes #43881. Reduces AppVeyor test time back to ~2 hours on average. The i586 libstd was never tested before Aug 13th, so this PR brings the situation back to the previous status-quo. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index aaede7236a97..f81e4ba82665 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ environment: RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler SCRIPT: python x.py test - MSYS_BITS: 32 - RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc --target=i586-pc-windows-msvc + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc --target=i686-pc-windows-msvc SCRIPT: python x.py test --host i686-pc-windows-msvc --target i686-pc-windows-msvc # MSVC aux tests From c7104be1a37daa2f7ec114913247dc93524fd48e Mon Sep 17 00:00:00 2001 From: Fourchaux Date: Tue, 15 Aug 2017 21:45:21 +0200 Subject: [PATCH 05/16] Fix typos & us spellings --- src/bootstrap/lib.rs | 2 +- src/bootstrap/native.rs | 2 +- src/liballoc/allocator.rs | 6 +++--- src/liballoc/btree/node.rs | 2 +- src/liballoc/raw_vec.rs | 4 ++-- src/libcore/num/dec2flt/rawfp.rs | 6 +++--- src/libcore/ops/try.rs | 2 +- src/libcore/sync/atomic.rs | 2 +- src/libgraphviz/lib.rs | 6 +++--- src/librand/distributions/gamma.rs | 2 +- src/librand/isaac.rs | 4 ++-- src/librand/lib.rs | 2 +- src/librand/reseeding.rs | 2 +- src/librustc/hir/map/mod.rs | 2 +- src/librustc/infer/error_reporting/mod.rs | 2 +- src/librustc/infer/resolve.rs | 2 +- src/librustc/lint/context.rs | 2 +- src/librustc/middle/region.rs | 2 +- src/librustc/mir/traversal.rs | 2 +- src/librustc/traits/fulfill.rs | 2 +- src/librustc/ty/context.rs | 2 +- src/librustc/ty/inhabitedness/def_id_forest.rs | 2 +- src/librustc/ty/sty.rs | 2 +- src/librustc_data_structures/accumulate_vec.rs | 2 +- src/librustc_data_structures/ivar.rs | 2 +- src/librustc_data_structures/small_vec.rs | 2 +- src/librustc_driver/driver.rs | 2 +- src/librustc_errors/diagnostic.rs | 4 ++-- src/librustc_errors/diagnostic_builder.rs | 2 +- src/librustc_errors/emitter.rs | 2 +- src/librustc_errors/snippet.rs | 2 +- .../persist/preds/compress/construct.rs | 2 +- src/librustc_trans/attributes.rs | 2 +- src/librustc_trans/base.rs | 2 +- src/librustc_trans/debuginfo/doc.rs | 8 ++++---- src/librustdoc/html/highlight.rs | 2 +- src/librustdoc/html/toc.rs | 2 +- src/librustdoc/lib.rs | 2 +- src/libstd/ffi/c_str.rs | 2 +- src/libstd/ffi/os_str.rs | 2 +- src/libstd/sync/once.rs | 2 +- src/libstd/sys/redox/args.rs | 2 +- src/libstd/sys/unix/args.rs | 2 +- src/libstd/thread/mod.rs | 2 +- src/libstd/time/mod.rs | 2 +- src/libsyntax/json.rs | 2 +- src/libsyntax_ext/deriving/generic/mod.rs | 2 +- 47 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 1452a38f6ed2..f92b47035e33 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -444,7 +444,7 @@ impl Build { } /// Returns the root output directory for all Cargo output in a given stage, - /// running a particular compiler, wehther or not we're building the + /// running a particular compiler, whether or not we're building the /// standard library, and targeting the specified architecture. fn cargo_out(&self, compiler: Compiler, diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 59efbd5c4d20..0a307e72bf61 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -11,7 +11,7 @@ //! Compilation of native dependencies like LLVM. //! //! Native projects like LLVM unfortunately aren't suited just yet for -//! compilation in build scripts that Cargo has. This is because thie +//! compilation in build scripts that Cargo has. This is because the //! compilation takes a *very* long time but also because we don't want to //! compile LLVM 3 times as part of a normal bootstrap (we want it cached). //! diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index 2b3df15f7161..fc6585a9f951 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -293,7 +293,7 @@ impl Layout { /// Creates a layout describing the record for `self` followed by /// `next` with no additional padding between the two. Since no /// padding is inserted, the alignment of `next` is irrelevant, - /// and is not incoporated *at all* into the resulting layout. + /// and is not incorporated *at all* into the resulting layout. /// /// Returns `(k, offset)`, where `k` is layout of the concatenated /// record and `offset` is the relative location, in bytes, of the @@ -528,7 +528,7 @@ pub unsafe trait Alloc { /// to allocate that block of memory. unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout); - /// Allocator-specific method for signalling an out-of-memory + /// Allocator-specific method for signaling an out-of-memory /// condition. /// /// `oom` aborts the thread or process, optionally performing @@ -539,7 +539,7 @@ pub unsafe trait Alloc { /// unsatisfied allocation request (signaled by an error such as /// `AllocErr::Exhausted`), and wish to abandon computation rather /// than attempt to recover locally. Such clients should pass the - /// signalling error value back into `oom`, where the allocator + /// signaling error value back into `oom`, where the allocator /// may incorporate that error value into its diagnostic report /// before aborting. /// diff --git a/src/liballoc/btree/node.rs b/src/liballoc/btree/node.rs index 0e61905131f6..4d1ff3cbe139 100644 --- a/src/liballoc/btree/node.rs +++ b/src/liballoc/btree/node.rs @@ -763,7 +763,7 @@ impl Clone for Handle { } impl Handle { - /// Retrieves the node that contains the edge of key/value pair this handle pointes to. + /// Retrieves the node that contains the edge of key/value pair this handle points to. pub fn into_node(self) -> Node { self.node } diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 6090fc3942a5..fbd71536806c 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -544,12 +544,12 @@ impl RawVec { /// Attempts to ensure that the buffer contains at least enough space to hold /// `used_cap + needed_extra_cap` elements. If it doesn't already have /// enough capacity, will reallocate in place enough space plus comfortable slack - /// space to get amortized `O(1)` behaviour. Will limit this behaviour + /// space to get amortized `O(1)` behavior. Will limit this behaviour /// if it would needlessly cause itself to panic. /// /// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate /// the requested space. This is not really unsafe, but the unsafe - /// code *you* write that relies on the behaviour of this function may break. + /// code *you* write that relies on the behavior of this function may break. /// /// Returns true if the reallocation attempt has succeeded, or false otherwise. /// diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 2a60292d0232..12960fed0455 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -102,10 +102,10 @@ pub trait RawFloat : Float + Copy + Debug + LowerExp /// The number of bits in the exponent. const EXP_BITS: u8; - /// The number of bits in the singificand, *including* the hidden bit. + /// The number of bits in the significand, *including* the hidden bit. const SIG_BITS: u8; - /// The number of bits in the singificand, *excluding* the hidden bit. + /// The number of bits in the significand, *excluding* the hidden bit. const EXPLICIT_SIG_BITS: u8; /// The maximum legal exponent in fractional representation. @@ -123,7 +123,7 @@ pub trait RawFloat : Float + Copy + Debug + LowerExp /// `MIN_EXP` for integral representation, i.e., with the shift applied. const MIN_EXP_INT: i16; - /// The maximum normalized singificand in integral representation. + /// The maximum normalized significand in integral representation. const MAX_SIG: u64; /// The minimal normalized significand in integral representation. diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 4971e825a6fb..78326c3e6391 100644 --- a/src/libcore/ops/try.rs +++ b/src/libcore/ops/try.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -/// A trait for customizing the behaviour of the `?` operator. +/// A trait for customizing the behavior of the `?` operator. /// /// A type implementing `Try` is one that has a canonical way to view it /// in terms of a success/failure dichotomy. This trait allows both diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index d647a94a1efd..510e01db0e96 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1632,7 +1632,7 @@ unsafe fn atomic_xor(dst: *mut T, val: T, order: Ordering) -> T { /// /// pub fn lock(&self) { /// while !self.flag.compare_and_swap(false, true, Ordering::Relaxed) {} -/// // This fence syncronizes-with store in `unlock`. +/// // This fence synchronizes-with store in `unlock`. /// fence(Ordering::Acquire); /// } /// diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index c01938f5e117..a27240b11ef9 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -11,7 +11,7 @@ //! Generate files suitable for use with [Graphviz](http://www.graphviz.org/) //! //! The `render` function generates output (e.g. an `output.dot` file) for -//! use with [Graphviz](http://www.graphviz.org/) by walking a labelled +//! use with [Graphviz](http://www.graphviz.org/) by walking a labeled //! graph. (Graphviz can then automatically lay out the nodes and edges //! of the graph, and also optionally render the graph as an image or //! other [output formats]( @@ -150,7 +150,7 @@ //! //! The output from this example renders four nodes that make up the //! Hasse-diagram for the subsets of the set `{x, y}`. Each edge is -//! labelled with the ⊆ character (specified using the HTML character +//! labeled with the ⊆ character (specified using the HTML character //! entity `&sube`). //! //! ```rust @@ -789,7 +789,7 @@ mod tests { } struct LabelledGraph { - /// The name for this graph. Used for labelling generated `digraph`. + /// The name for this graph. Used for labeling generated `digraph`. name: &'static str, /// Each node is an index into `node_labels`; these labels are diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 9a42b82beff6..45ece4a5a888 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -254,7 +254,7 @@ impl IndependentSample for ChiSquared { /// The Fisher F distribution `F(m, n)`. /// -/// This distribution is equivalent to the ratio of two normalised +/// This distribution is equivalent to the ratio of two normalized /// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) / /// (χ²(n)/n)`. pub struct FisherF { diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index 2baa07e370e1..96ce0905e384 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -76,7 +76,7 @@ impl IsaacRng { rng } - /// Initialises `self`. If `use_rsl` is true, then use the current value + /// Initializes `self`. If `use_rsl` is true, then use the current value /// of `rsl` as a seed, otherwise construct one algorithmically (not /// randomly). fn init(&mut self, use_rsl: bool) { @@ -367,7 +367,7 @@ impl Isaac64Rng { rng } - /// Initialises `self`. If `use_rsl` is true, then use the current value + /// Initializes `self`. If `use_rsl` is true, then use the current value /// of `rsl` as a seed, otherwise construct one algorithmically (not /// randomly). fn init(&mut self, use_rsl: bool) { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 5e56b0d8ab16..18c6b4140de8 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -180,7 +180,7 @@ pub trait Rng: Sized { /// This method does *not* have a requirement to bear any fixed /// relationship to the other methods, for example, it does *not* /// have to result in the same output as progressively filling - /// `dest` with `self.gen::()`, and any such behaviour should + /// `dest` with `self.gen::()`, and any such behavior should /// not be relied upon. /// /// This method should guarantee that `dest` is entirely filled diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index 21684e38f7b6..3d5067ba2fa3 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -24,7 +24,7 @@ pub struct ReseedingRng { rng: R, generation_threshold: usize, bytes_generated: usize, - /// Controls the behaviour when reseeding the RNG. + /// Controls the behavior when reseeding the RNG. pub reseeder: Rsdr, } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index ed4e28cc9ebf..8cd229a2adf6 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -731,7 +731,7 @@ impl<'hir> Map<'hir> { /// Returns the nearest enclosing scope. A scope is an item or block. /// FIXME it is not clear to me that all items qualify as scopes - statics - /// and associated types probably shouldn't, for example. Behaviour in this + /// and associated types probably shouldn't, for example. Behavior in this /// regard should be expected to be highly unstable. pub fn get_enclosing_scope(&self, id: NodeId) -> Option { match self.walk_parent_nodes(id, |node| match *node { diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index b5390da7e852..d608d09d0549 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -24,7 +24,7 @@ //! a span, but also more information so that we can generate a meaningful //! error message. //! -//! Having a catalogue of all the different reasons an error can arise is +//! Having a catalog of all the different reasons an error can arise is //! also useful for other reasons, like cross-referencing FAQs etc, though //! we are not really taking advantage of this yet. //! diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 6a1f8f1d0692..639a330dc6e6 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -46,7 +46,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeResolver<'a, 'g } /// The opportunistic type and region resolver is similar to the -/// opportunistic type resolver, but also opportunistly resolves +/// opportunistic type resolver, but also opportunistically resolves /// regions. It is useful for canonicalization. pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 40d78d0138bb..92b159a55f49 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -101,7 +101,7 @@ pub struct FutureIncompatibleInfo { pub reference: &'static str // e.g., a URL for an issue/PR/RFC or error code } -/// The targed of the `by_name` map, which accounts for renaming/deprecation. +/// The target of the `by_name` map, which accounts for renaming/deprecation. enum TargetLint { /// A direct lint target Id(LintId), diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 9133a5e777db..45a3080ed91f 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -72,7 +72,7 @@ use mir::transform::MirSource; /// (M1.): Misc extent of the whole `let a = ...;` statement. /// (M2.): Misc extent of the `f()` expression. /// (M3.): Misc extent of the `f().g(..)` expression. -/// (M4.): Misc extent of the block labelled `'b:`. +/// (M4.): Misc extent of the block labeled `'b:`. /// (M5.): Misc extent of the `let x = d();` statement /// (D6.): DestructionScope for temporaries created during M5. /// (R7.): Remainder extent for block `'b:`, stmt 0 (let x = ...). diff --git a/src/librustc/mir/traversal.rs b/src/librustc/mir/traversal.rs index 5aab46b3cefb..74c3408c4c2f 100644 --- a/src/librustc/mir/traversal.rs +++ b/src/librustc/mir/traversal.rs @@ -216,7 +216,7 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// /// Reverse postorder is the reverse order of a postorder traversal. /// This is different to a preorder traversal and represents a natural -/// linearisation of control-flow. +/// linearization of control-flow. /// /// ```text /// diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 4f1eb6169209..78e47693caaf 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -37,7 +37,7 @@ impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> { /// consists of a list of obligations that must be (eventually) /// satisfied. The job is to track which are satisfied, which yielded /// errors, and which are still pending. At any point, users can call -/// `select_where_possible`, and the fulfilment context will try to do +/// `select_where_possible`, and the fulfillment context will try to do /// selection, retaining only those obligations that remain /// ambiguous. This may be helpful in pushing type inference /// along. Once all type inference constraints have been generated, the diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index f71ad67bd1d7..adcf2ddd408a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -851,7 +851,7 @@ pub struct GlobalCtxt<'tcx> { /// A vector of every trait accessible in the whole crate /// (i.e. including those from subcrates). This is used only for - /// error reporting, and so is lazily initialised and generally + /// error reporting, and so is lazily initialized and generally /// shouldn't taint the common path (hence the RefCell). pub all_traits: RefCell>>, } diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 896682e2370e..3629709e6a48 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -26,7 +26,7 @@ pub struct DefIdForest { /// The minimal set of DefIds required to represent the whole set. /// If A and B are DefIds in the DefIdForest, and A is a descendant /// of B, then only B will be in root_ids. - /// We use a SmallVec here because (for its use for cacheing inhabitedness) + /// We use a SmallVec here because (for its use for caching inhabitedness) /// its rare that this will contain even two ids. root_ids: SmallVec<[DefId; 1]>, } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index b42180b288bf..4e2440d83fe1 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -739,7 +739,7 @@ pub type Region<'tcx> = &'tcx RegionKind; /// /// The process of doing that is called "skolemization". The bound regions /// are replaced by skolemized markers, which don't satisfy any relation -/// not explicity provided. +/// not explicitly provided. /// /// There are 2 kinds of skolemized regions in rustc: `ReFree` and /// `ReSkolemized`. When checking an item's body, `ReFree` is supposed diff --git a/src/librustc_data_structures/accumulate_vec.rs b/src/librustc_data_structures/accumulate_vec.rs index c03c2890ba34..52306de74cb8 100644 --- a/src/librustc_data_structures/accumulate_vec.rs +++ b/src/librustc_data_structures/accumulate_vec.rs @@ -13,7 +13,7 @@ //! Space for up to N elements is provided on the stack. If more elements are collected, Vec is //! used to store the values on the heap. //! -//! The N above is determined by Array's implementor, by way of an associatated constant. +//! The N above is determined by Array's implementor, by way of an associated constant. use std::ops::{Deref, DerefMut}; use std::iter::{self, IntoIterator, FromIterator}; diff --git a/src/librustc_data_structures/ivar.rs b/src/librustc_data_structures/ivar.rs index f842f4a41a11..de44509ef2fd 100644 --- a/src/librustc_data_structures/ivar.rs +++ b/src/librustc_data_structures/ivar.rs @@ -14,7 +14,7 @@ use std::cell::Cell; /// A write-once variable. When constructed, it is empty, and /// can only be set once. /// -/// Ivars ensure that data that can only be initialised once. A full +/// Ivars ensure that data that can only be initialized once. A full /// implementation is used for concurrency and blocks on a read of an /// unfulfilled value. This implementation is more minimal and panics /// if you attempt to read the value before it has been set. It is also diff --git a/src/librustc_data_structures/small_vec.rs b/src/librustc_data_structures/small_vec.rs index 4e2b37860210..74738e61b446 100644 --- a/src/librustc_data_structures/small_vec.rs +++ b/src/librustc_data_structures/small_vec.rs @@ -14,7 +14,7 @@ //! used to store the values on the heap. SmallVec is similar to AccumulateVec, but adds //! the ability to push elements. //! -//! The N above is determined by Array's implementor, by way of an associatated constant. +//! The N above is determined by Array's implementor, by way of an associated constant. use std::ops::{Deref, DerefMut}; use std::iter::{IntoIterator, FromIterator}; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 1444dcf4271c..7a0ad166d0c9 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -306,7 +306,7 @@ pub fn source_name(input: &Input) -> String { } } -/// CompileController is used to customise compilation, it allows compilation to +/// CompileController is used to customize compilation, it allows compilation to /// be stopped and/or to call arbitrary code at various points in compilation. /// It also allows for various flags to be set to influence what information gets /// collected during compilation. diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 91d32dbb84fe..6f2ce105a484 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -93,9 +93,9 @@ impl Diagnostic { } /// Cancel the diagnostic (a structured diagnostic must either be emitted or - /// cancelled or it will panic when dropped). + /// canceled or it will panic when dropped). /// BEWARE: if this DiagnosticBuilder is an error, then creating it will - /// bump the error count on the Handler and cancelling it won't undo that. + /// bump the error count on the Handler and canceling it won't undo that. /// If you want to decrement the error count you should use `Handler::cancel`. pub fn cancel(&mut self) { self.level = Level::Cancelled; diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 5d7c5e2829a3..c9fb3d902d02 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -198,7 +198,7 @@ impl<'a> Debug for DiagnosticBuilder<'a> { } } -/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or cancelled +/// Destructor bomb - a `DiagnosticBuilder` must be either emitted or canceled /// or we emit a bug. impl<'a> Drop for DiagnosticBuilder<'a> { fn drop(&mut self) { diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 3cfa635f5b20..10dd579932a6 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -822,7 +822,7 @@ impl EmitterWriter { .map(|_| " ") .collect::(); - /// Return wether `style`, or the override if present and the style is `NoStyle`. + /// Return whether `style`, or the override if present and the style is `NoStyle`. fn style_or_override(style: Style, override_style: Option