From 4972beaf65cad992a6ed791fdefe90e46c09aa7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= <matthias.krueger@famsik.de>
Date: Mon, 22 Oct 2018 18:21:55 +0200
Subject: [PATCH] fix typos in various places

---
 src/bootstrap/bootstrap.py                       |  2 +-
 src/etc/lldb_rust_formatters.py                  |  2 +-
 src/liballoc/collections/btree/map.rs            |  2 +-
 src/libcore/alloc.rs                             |  2 +-
 src/libcore/intrinsics.rs                        |  2 +-
 src/libcore/pin.rs                               |  2 +-
 src/libcore/ptr.rs                               |  2 +-
 src/librustc/hir/def_id.rs                       |  4 ++--
 src/librustc/mir/interpret/mod.rs                |  2 +-
 src/librustc/mir/mod.rs                          |  2 +-
 src/librustc/traits/error_reporting.rs           |  2 +-
 src/librustc_codegen_llvm/builder.rs             |  2 +-
 src/librustc_metadata/cstore_impl.rs             |  2 +-
 src/librustc_mir/const_eval.rs                   |  2 +-
 src/librustc_mir/diagnostics.rs                  |  2 +-
 src/librustc_mir/interpret/eval_context.rs       |  2 +-
 src/librustc_mir/interpret/memory.rs             |  6 +++---
 src/librustc_mir/interpret/operand.rs            |  4 ++--
 src/librustc_mir/interpret/validity.rs           |  4 ++--
 src/librustc_passes/ast_validation.rs            | 16 ++++++++--------
 src/librustc_target/abi/mod.rs                   |  2 +-
 src/librustc_typeck/check/mod.rs                 |  2 +-
 src/librustc_typeck/check/wfcheck.rs             |  2 +-
 src/librustc_typeck/coherence/builtin.rs         |  2 +-
 src/libstd/sync/mod.rs                           |  2 +-
 src/libstd/sync/once.rs                          |  4 ++--
 src/libsyntax/config.rs                          |  4 ++--
 src/test/run-pass/issues/issue-18804/main.rs     |  2 +-
 .../ui/block-result/unexpected-return-on-unit.rs |  2 +-
 .../cfg-attr-multi-false.rs                      |  2 +-
 .../ui/nll/issue-21232-partial-init-and-use.rs   |  2 +-
 ...52059-report-when-borrow-and-drop-conflict.rs |  2 +-
 src/test/ui/resolve/token-error-correct-2.rs     |  2 +-
 src/test/ui/resolve/token-error-correct-3.rs     |  2 +-
 src/test/ui/resolve/token-error-correct.rs       |  2 +-
 .../syntax-ambiguity-2015.rs                     | 12 ++++++------
 .../syntax-ambiguity-2015.stderr                 | 12 ++++++------
 .../syntax-ambiguity-2018.rs                     | 12 ++++++------
 .../syntax-ambiguity-2018.stderr                 | 12 ++++++------
 .../rust-2018/edition-lint-infer-outlives.fixed  |  2 +-
 .../ui/rust-2018/edition-lint-infer-outlives.rs  |  2 +-
 src/test/ui/specialization/issue-52050.rs        |  2 +-
 src/tools/tidy/src/pal.rs                        |  2 +-
 43 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index c27f4f056d7..ffc5adbebb3 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -594,7 +594,7 @@ class RustBuild(object):
         return ''
 
     def bootstrap_binary(self):
-        """Return the path of the boostrap binary
+        """Return the path of the bootstrap binary
 
         >>> rb = RustBuild()
         >>> rb.build_dir = "build"
diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py
index 4427313f9e5..2bbd4372721 100644
--- a/src/etc/lldb_rust_formatters.py
+++ b/src/etc/lldb_rust_formatters.py
@@ -277,7 +277,7 @@ def print_std_string_val(val, internal_dict):
 #=--------------------------------------------------------------------------------------------------
 
 def print_array_of_values(array_name, data_ptr_val, length, internal_dict):
-    """Prints a contigous memory range, interpreting it as values of the
+    """Prints a contiguous memory range, interpreting it as values of the
        pointee-type of data_ptr_val."""
 
     data_ptr_type = data_ptr_val.type
diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs
index 8c950cd06d9..24c8fd3a969 100644
--- a/src/liballoc/collections/btree/map.rs
+++ b/src/liballoc/collections/btree/map.rs
@@ -77,7 +77,7 @@ use self::Entry::*;
 /// movie_reviews.insert("Office Space",       "Deals with real issues in the workplace.");
 /// movie_reviews.insert("Pulp Fiction",       "Masterpiece.");
 /// movie_reviews.insert("The Godfather",      "Very enjoyable.");
-/// movie_reviews.insert("The Blues Brothers", "Eye lyked it alot.");
+/// movie_reviews.insert("The Blues Brothers", "Eye lyked it a lot.");
 ///
 /// // check for a specific one.
 /// if !movie_reviews.contains_key("Les Misérables") {
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 35e4eea756d..4efcaae59b0 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -518,7 +518,7 @@ pub unsafe trait GlobalAlloc {
     /// The block is described by the given `ptr` pointer and `layout`.
     ///
     /// If this returns a non-null pointer, then ownership of the memory block
-    /// referenced by `ptr` has been transferred to this alloctor.
+    /// referenced by `ptr` has been transferred to this allocator.
     /// The memory may or may not have been deallocated,
     /// and should be considered unusable (unless of course it was
     /// transferred back to the caller again via the return value of
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 56a24168e28..cceae9249e4 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1025,7 +1025,7 @@ extern "rust-intrinsic" {
     ///         // to avoid problems in case something further down panics.
     ///         src.set_len(0);
     ///
-    ///         // The two regions cannot overlap becuase mutable references do
+    ///         // The two regions cannot overlap because mutable references do
     ///         // not alias, and two different vectors cannot own the same
     ///         // memory.
     ///         ptr::copy_nonoverlapping(src_ptr, dst_ptr, src_len);
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index 0224560af4c..a03c080fb3f 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -102,7 +102,7 @@ pub use marker::Unpin;
 /// value in place, preventing the value referenced by that pointer from being moved
 /// unless it implements [`Unpin`].
 ///
-/// See the [`pin` module] documentation for furthur explanation on pinning.
+/// See the [`pin` module] documentation for further explanation on pinning.
 ///
 /// [`Unpin`]: ../../std/marker/trait.Unpin.html
 /// [`pin` module]: ../../std/pin/index.html
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 1c761ba21b3..b699cb02884 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -38,7 +38,7 @@
 //!   underlying object is live and no reference (just raw pointers) is used to
 //!   access the same memory.
 //!
-//! These axioms, along with careful use of [`offset`] for pointer arithmentic,
+//! These axioms, along with careful use of [`offset`] for pointer arithmetic,
 //! are enough to correctly implement many useful things in unsafe code. Stronger guarantees
 //! will be provided eventually, as the [aliasing] rules are being determined. For more
 //! information, see the [book] as well as the section in the reference devoted
diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs
index a09fd5df557..e378e1b8be0 100644
--- a/src/librustc/hir/def_id.rs
+++ b/src/librustc/hir/def_id.rs
@@ -40,7 +40,7 @@ impl ::std::fmt::Debug for CrateNum {
         match self {
             CrateNum::Index(id) => write!(fmt, "crate{}", id.private),
             CrateNum::Invalid => write!(fmt, "invalid crate"),
-            CrateNum::BuiltinMacros => write!(fmt, "bultin macros crate"),
+            CrateNum::BuiltinMacros => write!(fmt, "builtin macros crate"),
             CrateNum::ReservedForIncrCompCache => write!(fmt, "crate for decoding incr comp cache"),
         }
     }
@@ -101,7 +101,7 @@ impl fmt::Display for CrateNum {
         match self {
             CrateNum::Index(id) => fmt::Display::fmt(&id.private, f),
             CrateNum::Invalid => write!(f, "invalid crate"),
-            CrateNum::BuiltinMacros => write!(f, "bultin macros crate"),
+            CrateNum::BuiltinMacros => write!(f, "builtin macros crate"),
             CrateNum::ReservedForIncrCompCache => write!(f, "crate for decoding incr comp cache"),
         }
     }
diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs
index 4c2b2b2d41d..5054f522778 100644
--- a/src/librustc/mir/interpret/mod.rs
+++ b/src/librustc/mir/interpret/mod.rs
@@ -632,7 +632,7 @@ pub fn read_target_uint(endianness: layout::Endian, mut source: &[u8]) -> Result
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// Methods to faciliate working with signed integers stored in a u128
+// Methods to facilitate working with signed integers stored in a u128
 ////////////////////////////////////////////////////////////////////////////////
 
 pub fn sign_extend(value: u128, size: Size) -> u128 {
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 62b5327ae46..f1c5030c641 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -469,7 +469,7 @@ pub enum BorrowKind {
     ///     }
     ///
     /// This can't be a shared borrow because mutably borrowing (*x as Some).0
-    /// should not prevent `if let None = x { ... }`, for example, becase the
+    /// should not prevent `if let None = x { ... }`, for example, because the
     /// mutating `(*x as Some).0` can't affect the discriminant of `x`.
     /// We can also report errors with this kind of borrow differently.
     Shallow,
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index dc003992644..ea30752a820 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -412,7 +412,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             flags.push(("crate_local".to_owned(), None));
         }
 
-        // Allow targetting all integers using `{integral}`, even if the exact type was resolved
+        // Allow targeting all integers using `{integral}`, even if the exact type was resolved
         if self_ty.is_integral() {
             flags.push(("_Self".to_owned(), Some("{integral}".to_owned())));
         }
diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs
index 169bd9a8466..2fe6a0377f8 100644
--- a/src/librustc_codegen_llvm/builder.rs
+++ b/src/librustc_codegen_llvm/builder.rs
@@ -761,7 +761,7 @@ impl Builder<'a, 'll, 'tcx> {
                     fty, asm, cons, volatile, alignstack, dia);
                 Some(self.call(v, inputs, None))
             } else {
-                // LLVM has detected an issue with our constaints, bail out
+                // LLVM has detected an issue with our constraints, bail out
                 None
             }
         }
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index 7988de28b5d..e6e1367b592 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -68,7 +68,7 @@ macro_rules! provide {
 
                 let $cdata = $tcx.crate_data_as_rc_any($def_id.krate);
                 let $cdata = $cdata.downcast_ref::<cstore::CrateMetadata>()
-                    .expect("CrateStore crated ata is not a CrateMetadata");
+                    .expect("CrateStore created data is not a CrateMetadata");
                 $compute
             })*
 
diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs
index bc917140bbd..9702e94a9e0 100644
--- a/src/librustc_mir/const_eval.rs
+++ b/src/librustc_mir/const_eval.rs
@@ -129,7 +129,7 @@ pub fn op_to_const<'tcx>(
             assert!(alloc.bytes.len() as u64 - ptr.offset.bytes() >= op.layout.size.bytes());
             let mut alloc = alloc.clone();
             alloc.align = align;
-            // FIXME shouldnt it be the case that `mark_static_initialized` has already
+            // FIXME shouldn't it be the case that `mark_static_initialized` has already
             // interned this?  I thought that is the entire point of that `FinishStatic` stuff?
             let alloc = ecx.tcx.intern_const_alloc(alloc);
             ConstValue::ByRef(ptr.alloc_id, alloc, ptr.offset)
diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs
index bb3e4a8d881..56a9daf84f7 100644
--- a/src/librustc_mir/diagnostics.rs
+++ b/src/librustc_mir/diagnostics.rs
@@ -2279,7 +2279,7 @@ fn demo<'a>(s: &'a mut S<'a>) -> &'a mut String { let p = &mut *(*s).data; p }
 
 Note that this approach needs a reference to S with lifetime `'a`.
 Nothing shorter than `'a` will suffice: a shorter lifetime would imply
-that after `demo` finishes excuting, something else (such as the
+that after `demo` finishes executing, something else (such as the
 destructor!) could access `s.data` after the end of that shorter
 lifetime, which would again violate the `&mut`-borrow's exclusive
 access.
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 18938892165..64ad4c2eec1 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -556,7 +556,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
                 )?;
             }
         } else {
-            // Uh, that shouln't happen... the function did not intend to return
+            // Uh, that shouldn't happen... the function did not intend to return
             return err!(Unreachable);
         }
 
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index 9adca6c4297..6fe490c6efc 100644
--- a/src/librustc_mir/interpret/memory.rs
+++ b/src/librustc_mir/interpret/memory.rs
@@ -94,7 +94,7 @@ impl<'a, 'b, 'c, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout
     }
 }
 
-// FIXME: Really we shouldnt clone memory, ever. Snapshot machinery should instad
+// FIXME: Really we shouldn't clone memory, ever. Snapshot machinery should instead
 // carefully copy only the reachable parts.
 impl<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>>
     Clone for Memory<'a, 'mir, 'tcx, M>
@@ -658,7 +658,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
     }
 
     /// It is the caller's responsibility to handle undefined and pointer bytes.
-    /// However, this still checks that there are no relocations on the *egdes*.
+    /// However, this still checks that there are no relocations on the *edges*.
     #[inline]
     fn get_bytes_with_undef_and_ptr(
         &self,
@@ -1098,7 +1098,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
         Ok(())
     }
 
-    /// Error if there are relocations overlapping with the egdes of the
+    /// Error if there are relocations overlapping with the edges of the
     /// given memory range.
     #[inline]
     fn check_relocation_edges(&self, ptr: Pointer<M::PointerTag>, size: Size) -> EvalResult<'tcx> {
diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs
index 71b2f4b53a6..021e2d58f84 100644
--- a/src/librustc_mir/interpret/operand.rs
+++ b/src/librustc_mir/interpret/operand.rs
@@ -357,14 +357,14 @@ fn from_known_layout<'tcx>(
 }
 
 impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
-    /// Try reading a value in memory; this is interesting particularily for ScalarPair.
+    /// Try reading a value in memory; this is interesting particularly for ScalarPair.
     /// Return None if the layout does not permit loading this as a value.
     pub(super) fn try_read_value_from_mplace(
         &self,
         mplace: MPlaceTy<'tcx, M::PointerTag>,
     ) -> EvalResult<'tcx, Option<Value<M::PointerTag>>> {
         if mplace.layout.is_unsized() {
-            // Dont touch unsized
+            // Don't touch unsized
             return Ok(None);
         }
         let (ptr, ptr_align) = mplace.to_scalar_ptr_align();
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs
index 38cf79d8fa0..ac1ba0edc3b 100644
--- a/src/librustc_mir/interpret/validity.rs
+++ b/src/librustc_mir/interpret/validity.rs
@@ -230,7 +230,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
                                 ),
                         }
                     }
-                    // non-ZST also have to be dereferencable
+                    // non-ZST also have to be dereferenceable
                     if size != Size::ZERO {
                         let ptr = try_validation!(place.ptr.to_ptr(),
                             "integer pointer in non-ZST reference", path);
@@ -272,7 +272,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
                 // FIXME: Check if the signature matches
             }
             // This should be all the primitive types
-            ty::Never => bug!("Uninhabited type should have been catched earlier"),
+            ty::Never => bug!("Uninhabited type should have been caught earlier"),
             _ => bug!("Unexpected primitive type {}", value.layout.ty)
         }
         Ok(())
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index f6ace57f5e0..0e9596244cd 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -166,12 +166,12 @@ impl<'a> AstValidator<'a> {
         }
     }
 
-    /// With eRFC 2497, we need to check whether an expression is ambigious and warn or error
+    /// With eRFC 2497, we need to check whether an expression is ambiguous and warn or error
     /// depending on the edition, this function handles that.
     fn while_if_let_ambiguity(&self, expr: &P<Expr>) {
         if let Some((span, op_kind)) = self.while_if_let_expr_ambiguity(&expr) {
             let mut err = self.err_handler().struct_span_err(
-                span, &format!("ambigious use of `{}`", op_kind.to_string())
+                span, &format!("ambiguous use of `{}`", op_kind.to_string())
             );
 
             err.note(
@@ -193,9 +193,9 @@ impl<'a> AstValidator<'a> {
     }
 
     /// With eRFC 2497 adding if-let chains, there is a requirement that the parsing of
-    /// `&&` and `||` in a if-let statement be unambigious. This function returns a span and
-    /// a `BinOpKind` (either `&&` or `||` depending on what was ambigious) if it is determined
-    /// that the current expression parsed is ambigious and will break in future.
+    /// `&&` and `||` in a if-let statement be unambiguous. This function returns a span and
+    /// a `BinOpKind` (either `&&` or `||` depending on what was ambiguous) if it is determined
+    /// that the current expression parsed is ambiguous and will break in future.
     fn while_if_let_expr_ambiguity(&self, expr: &P<Expr>) -> Option<(Span, BinOpKind)> {
         debug!("while_if_let_expr_ambiguity: expr.node: {:?}", expr.node);
         match &expr.node {
@@ -203,12 +203,12 @@ impl<'a> AstValidator<'a> {
                 Some((expr.span, op.node))
             },
             ExprKind::Range(ref lhs, ref rhs, _) => {
-                let lhs_ambigious = lhs.as_ref()
+                let lhs_ambiguous = lhs.as_ref()
                     .and_then(|lhs| self.while_if_let_expr_ambiguity(lhs));
-                let rhs_ambigious = rhs.as_ref()
+                let rhs_ambiguous = rhs.as_ref()
                     .and_then(|rhs| self.while_if_let_expr_ambiguity(rhs));
 
-                lhs_ambigious.or(rhs_ambigious)
+                lhs_ambiguous.or(rhs_ambiguous)
             }
             _ => None,
         }
diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs
index 6b28fd09174..1a5d2801af0 100644
--- a/src/librustc_target/abi/mod.rs
+++ b/src/librustc_target/abi/mod.rs
@@ -430,7 +430,7 @@ impl Align {
     }
 
     /// Lower the alignment, if necessary, such that the given offset
-    /// is aligned to it (the offset is a multiple of the aligment).
+    /// is aligned to it (the offset is a multiple of the alignment).
     pub fn restrict_for_offset(self, offset: Size) -> Align {
         self.min(Align::max_for_offset(offset))
     }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 1c562859bb4..77151351d08 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -5198,7 +5198,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                         } else {
                             // If no type arguments were provided, we have to infer them.
                             // This case also occurs as a result of some malformed input, e.g.
-                            // a lifetime argument being given instead of a type paramter.
+                            // a lifetime argument being given instead of a type parameter.
                             // Using inference instead of `Error` gives better error messages.
                             self.var_for_def(span, param)
                         }
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index ec773e384af..9990d2ee2b6 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -674,7 +674,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
                     } // if may_define_existential_type
 
                     // now register the bounds on the parameters of the existential type
-                    // so the parameters given by the function need to fulfil them
+                    // so the parameters given by the function need to fulfill them
                     // ```rust
                     // existential type Foo<T: Bar>: 'static;
                     // fn foo<U>() -> Foo<U> { .. *}
diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs
index c54d9e4b475..05a83dd307c 100644
--- a/src/librustc_typeck/coherence/builtin.rs
+++ b/src/librustc_typeck/coherence/builtin.rs
@@ -269,7 +269,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>,
                 // exactly one (non-phantom) field has changed its
                 // type, which we will expect to be the pointer that
                 // is becoming fat (we could probably generalize this
-                // to mutiple thin pointers of the same type becoming
+                // to multiple thin pointers of the same type becoming
                 // fat, but we don't). In this case:
                 //
                 // - `extra` has type `T` before and type `T` after
diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs
index d69ebc17622..a7db372a0e2 100644
--- a/src/libstd/sync/mod.rs
+++ b/src/libstd/sync/mod.rs
@@ -97,7 +97,7 @@
 //! - A **multiprocessor** system executing multiple hardware threads
 //!   at the same time: In multi-threaded scenarios, you can use two
 //!   kinds of primitives to deal with synchronization:
-//!   - [memory fences] to ensure memory accesses are made visibile to
+//!   - [memory fences] to ensure memory accesses are made visible to
 //!   other CPUs in the right order.
 //!   - [atomic operations] to ensure simultaneous access to the same
 //!   memory location doesn't lead to undefined behavior.
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index 98845e457b2..cf9698cb2a9 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -290,8 +290,8 @@ impl Once {
     }
 
     /// Returns true if some `call_once` call has completed
-    /// successfuly. Specifically, `is_completed` will return false in
-    /// the following situtations:
+    /// successfully. Specifically, `is_completed` will return false in
+    /// the following situations:
     ///   * `call_once` was not called at all,
     ///   * `call_once` was called, but has not yet completed,
     ///   * the `Once` instance is poisoned
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index e611eb86dc1..d8fb20d4250 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -96,7 +96,7 @@ impl<'a> StripUnconfigured<'a> {
     /// when the configuration predicate is true, or otherwise expand into an
     /// empty list of attributes.
     ///
-    /// Gives a compiler warning when the `cfg_attr` contains no attribtes and
+    /// Gives a compiler warning when the `cfg_attr` contains no attributes and
     /// is in the original source file. Gives a compiler error if the syntax of
     /// the attribute is incorrect
     fn process_cfg_attr(&mut self, attr: ast::Attribute) -> Vec<ast::Attribute> {
@@ -138,7 +138,7 @@ impl<'a> StripUnconfigured<'a> {
         };
 
         // Check feature gate and lint on zero attributes in source. Even if the feature is gated,
-        // we still compute as if it wasn't, since the emitted error will stop compilation futher
+        // we still compute as if it wasn't, since the emitted error will stop compilation further
         // along the compilation.
         match (expanded_attrs.len(), gate_cfg_attr_multi) {
             (0, false) => {
diff --git a/src/test/run-pass/issues/issue-18804/main.rs b/src/test/run-pass/issues/issue-18804/main.rs
index a3a5337077c..2abcd4b7ba9 100644
--- a/src/test/run-pass/issues/issue-18804/main.rs
+++ b/src/test/run-pass/issues/issue-18804/main.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // run-pass
-// Test for issue #18804, #[linkage] does not propagate thorugh generic
+// Test for issue #18804, #[linkage] does not propagate through generic
 // functions. Failure results in a linker error.
 
 // ignore-asmjs no weak symbol support
diff --git a/src/test/ui/block-result/unexpected-return-on-unit.rs b/src/test/ui/block-result/unexpected-return-on-unit.rs
index 3cf76365c77..b116888d63c 100644
--- a/src/test/ui/block-result/unexpected-return-on-unit.rs
+++ b/src/test/ui/block-result/unexpected-return-on-unit.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we do some basic error correcton in the tokeniser (and don't spew
+// Test that we do some basic error correction in the tokeniser (and don't spew
 // too many bogus errors).
 
 fn foo() -> usize {
diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs
index 84bd33fc0e7..ec4ee80b498 100644
--- a/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs
+++ b/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs
@@ -1,5 +1,5 @@
 // Test that cfg_attr doesn't emit any attributes when the
-// configuation variable is false. This mirrors `cfg-attr-multi-true.rs`
+// configuration variable is false. This mirrors `cfg-attr-multi-true.rs`
 
 // compile-pass
 
diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.rs b/src/test/ui/nll/issue-21232-partial-init-and-use.rs
index e3ae4c0dcbe..186ecc54827 100644
--- a/src/test/ui/nll/issue-21232-partial-init-and-use.rs
+++ b/src/test/ui/nll/issue-21232-partial-init-and-use.rs
@@ -66,7 +66,7 @@ impl<F> R<F> { fn new(f: F) -> Self { R { w: 0, f } } }
 // It got pretty monotonous writing the same code over and over, and I
 // feared I would forget details. So I abstracted some desiderata into
 // macros. But I left the initialization code inline, because that's
-// where the errors for #54986 will be emited.
+// where the errors for #54986 will be emitted.
 
 macro_rules! use_fully {
     (struct $s:expr) => { {
diff --git a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs
index fff73c6d0fa..eaa809d2b37 100644
--- a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs
+++ b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.rs
@@ -1,5 +1,5 @@
 // rust-lang/rust#52059: Regardless of whether you are moving out of a
-// Drop type or just introducing an inadvertant alias via a borrow of
+// Drop type or just introducing an inadvertent alias via a borrow of
 // one of its fields, it is useful to be reminded of the significance
 // of the fact that the type implements Drop.
 
diff --git a/src/test/ui/resolve/token-error-correct-2.rs b/src/test/ui/resolve/token-error-correct-2.rs
index e49374f9ce6..55803e4034b 100644
--- a/src/test/ui/resolve/token-error-correct-2.rs
+++ b/src/test/ui/resolve/token-error-correct-2.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we do some basic error correcton in the tokeniser (and don't ICE).
+// Test that we do some basic error correction in the tokeniser (and don't ICE).
 
 fn main() {
     if foo {
diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs
index 8881b965f94..fd4bbde2866 100644
--- a/src/test/ui/resolve/token-error-correct-3.rs
+++ b/src/test/ui/resolve/token-error-correct-3.rs
@@ -10,7 +10,7 @@
 
 // ignore-cloudabi no std::fs support
 
-// Test that we do some basic error correcton in the tokeniser (and don't spew
+// Test that we do some basic error correction in the tokeniser (and don't spew
 // too many bogus errors).
 
 pub mod raw {
diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs
index 39c664e270c..099ead93beb 100644
--- a/src/test/ui/resolve/token-error-correct.rs
+++ b/src/test/ui/resolve/token-error-correct.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we do some basic error correcton in the tokeniser.
+// Test that we do some basic error correction in the tokeniser.
 
 fn main() {
     foo(bar(;
diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs
index 339d49104b0..31a34a9e6fb 100644
--- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs
+++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs
@@ -19,22 +19,22 @@ fn main() {
     use std::ops::Range;
 
     if let Range { start: _, end: _ } = true..true && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     if let Range { start: _, end: _ } = true..true || false { }
-    //~^ ERROR ambigious use of `||`
+    //~^ ERROR ambiguous use of `||`
 
     while let Range { start: _, end: _ } = true..true && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     while let Range { start: _, end: _ } = true..true || false { }
-    //~^ ERROR ambigious use of `||`
+    //~^ ERROR ambiguous use of `||`
 
     if let true = false && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     while let true = (1 == 2) && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     // The following cases are not an error as parenthesis are used to
     // clarify intent:
diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr
index 8597294913f..411cb99fbca 100644
--- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr
+++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr
@@ -1,4 +1,4 @@
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2015.rs:21:47
    |
 LL |     if let Range { start: _, end: _ } = true..true && false { }
@@ -7,7 +7,7 @@ LL |     if let Range { start: _, end: _ } = true..true && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `||`
+error: ambiguous use of `||`
   --> $DIR/syntax-ambiguity-2015.rs:24:47
    |
 LL |     if let Range { start: _, end: _ } = true..true || false { }
@@ -16,7 +16,7 @@ LL |     if let Range { start: _, end: _ } = true..true || false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2015.rs:27:50
    |
 LL |     while let Range { start: _, end: _ } = true..true && false { }
@@ -25,7 +25,7 @@ LL |     while let Range { start: _, end: _ } = true..true && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `||`
+error: ambiguous use of `||`
   --> $DIR/syntax-ambiguity-2015.rs:30:50
    |
 LL |     while let Range { start: _, end: _ } = true..true || false { }
@@ -34,7 +34,7 @@ LL |     while let Range { start: _, end: _ } = true..true || false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2015.rs:33:19
    |
 LL |     if let true = false && false { }
@@ -43,7 +43,7 @@ LL |     if let true = false && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2015.rs:36:22
    |
 LL |     while let true = (1 == 2) && false { }
diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs
index baa90bcf8e9..99495717c3a 100644
--- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs
+++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs
@@ -19,22 +19,22 @@ fn main() {
     use std::ops::Range;
 
     if let Range { start: _, end: _ } = true..true && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     if let Range { start: _, end: _ } = true..true || false { }
-    //~^ ERROR ambigious use of `||`
+    //~^ ERROR ambiguous use of `||`
 
     while let Range { start: _, end: _ } = true..true && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     while let Range { start: _, end: _ } = true..true || false { }
-    //~^ ERROR ambigious use of `||`
+    //~^ ERROR ambiguous use of `||`
 
     if let true = false && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     while let true = (1 == 2) && false { }
-    //~^ ERROR ambigious use of `&&`
+    //~^ ERROR ambiguous use of `&&`
 
     // The following cases are not an error as parenthesis are used to
     // clarify intent:
diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr
index 86ee04747b2..bd49abeb7b2 100644
--- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr
+++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr
@@ -1,4 +1,4 @@
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2018.rs:21:47
    |
 LL |     if let Range { start: _, end: _ } = true..true && false { }
@@ -7,7 +7,7 @@ LL |     if let Range { start: _, end: _ } = true..true && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `||`
+error: ambiguous use of `||`
   --> $DIR/syntax-ambiguity-2018.rs:24:47
    |
 LL |     if let Range { start: _, end: _ } = true..true || false { }
@@ -16,7 +16,7 @@ LL |     if let Range { start: _, end: _ } = true..true || false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2018.rs:27:50
    |
 LL |     while let Range { start: _, end: _ } = true..true && false { }
@@ -25,7 +25,7 @@ LL |     while let Range { start: _, end: _ } = true..true && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `||`
+error: ambiguous use of `||`
   --> $DIR/syntax-ambiguity-2018.rs:30:50
    |
 LL |     while let Range { start: _, end: _ } = true..true || false { }
@@ -34,7 +34,7 @@ LL |     while let Range { start: _, end: _ } = true..true || false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2018.rs:33:19
    |
 LL |     if let true = false && false { }
@@ -43,7 +43,7 @@ LL |     if let true = false && false { }
    = note: this will be a error until the `let_chains` feature is stabilized
    = note: see rust-lang/rust#53668 for more information
 
-error: ambigious use of `&&`
+error: ambiguous use of `&&`
   --> $DIR/syntax-ambiguity-2018.rs:36:22
    |
 LL |     while let true = (1 == 2) && false { }
diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed
index d70c847e9fe..f13f8ef2bb4 100644
--- a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed
+++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed
@@ -24,7 +24,7 @@ use std::fmt::{Debug, Display};
 // • one generic parameter (T) bound inline
 // • one parameter (T) with a where clause
 // • two parameters (T and U), both bound inline
-// • two paramters (T and U), one bound inline, one with a where clause
+// • two parameters (T and U), one bound inline, one with a where clause
 // • two parameters (T and U), both with where clauses
 //
 // —and for every permutation of 0, 1, or 2 lifetimes to outlive and 0 or 1
diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs
index 0e4436fe163..f47b3fcb9be 100644
--- a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs
+++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs
@@ -24,7 +24,7 @@ use std::fmt::{Debug, Display};
 // • one generic parameter (T) bound inline
 // • one parameter (T) with a where clause
 // • two parameters (T and U), both bound inline
-// • two paramters (T and U), one bound inline, one with a where clause
+// • two parameters (T and U), one bound inline, one with a where clause
 // • two parameters (T and U), both with where clauses
 //
 // —and for every permutation of 0, 1, or 2 lifetimes to outlive and 0 or 1
diff --git a/src/test/ui/specialization/issue-52050.rs b/src/test/ui/specialization/issue-52050.rs
index 70cdb4899c4..00d8d126e05 100644
--- a/src/test/ui/specialization/issue-52050.rs
+++ b/src/test/ui/specialization/issue-52050.rs
@@ -12,7 +12,7 @@
 
 // Regression test for #52050: when inserting the blanket impl `I`
 // into the tree, we had to replace the child node for `Foo`, which
-// led to the struture of the tree being messed up.
+// led to the structure of the tree being messed up.
 
 use std::iter::Iterator;
 
diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs
index 69a4c09c228..3d5e18e37b0 100644
--- a/src/tools/tidy/src/pal.rs
+++ b/src/tools/tidy/src/pal.rs
@@ -163,7 +163,7 @@ fn check_cfgs(contents: &mut String, file: &Path,
 
 fn find_test_mod(contents: &str) -> usize {
     if let Some(mod_tests_idx) = contents.find("mod tests") {
-        // Also capture a previos line indicating "mod tests" in cfg-ed out
+        // Also capture a previous line indicating "mod tests" in cfg-ed out
         let prev_newline_idx = contents[..mod_tests_idx].rfind('\n').unwrap_or(mod_tests_idx);
         let prev_newline_idx = contents[..prev_newline_idx].rfind('\n');
         if let Some(nl) = prev_newline_idx {