From 3b4151c9f3f66894a8d9f2d313f406ad21abf00d Mon Sep 17 00:00:00 2001 From: liuzhenyu Date: Sun, 2 Aug 2020 23:20:00 +0800 Subject: [PATCH] fix typos --- library/alloc/src/rc.rs | 2 +- library/alloc/src/sync.rs | 2 +- library/alloc/tests/boxed.rs | 2 +- library/std/src/alloc.rs | 4 ++-- library/std/src/keyword_docs.rs | 2 +- library/std/src/sync/once.rs | 2 +- src/librustc_infer/infer/combine.rs | 4 ++-- .../error_reporting/nice_region_error/static_impl_trait.rs | 2 +- src/librustc_metadata/rmeta/encoder.rs | 2 +- src/librustc_middle/ty/util.rs | 2 +- src/librustc_mir/transform/promote_consts.rs | 2 +- src/librustc_mir_build/thir/pattern/mod.rs | 2 +- src/librustc_session/config.rs | 2 +- src/librustc_session/parse.rs | 2 +- src/librustc_span/hygiene.rs | 4 ++-- src/librustc_typeck/check/coercion.rs | 2 +- src/test/ui/consts/const_in_pattern/warn_corner_cases.rs | 2 +- src/test/ui/consts/issue-73976-polymorphic.rs | 2 +- src/test/ui/lint/lint-nonstandard-style-unicode-1.rs | 2 +- src/test/ui/lint/lint-nonstandard-style-unicode-2.rs | 2 +- src/test/ui/proc-macro/crt-static.rs | 2 +- src/tools/clippy/tests/ui/formatting.rs | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 116df63f94b..1c61050147d 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2101,7 +2101,7 @@ impl Unpin for Rc {} /// /// - This function is safe for any argument if `T` is sized, and /// - if `T` is unsized, the pointer must have appropriate pointer metadata -/// aquired from the real instance that you are getting this offset for. +/// acquired from the real instance that you are getting this offset for. unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `RcBox`. // Because it is ?Sized, it will always be the last field in memory. diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 58cab9c5c63..343a17b002f 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -2255,7 +2255,7 @@ impl Unpin for Arc {} /// /// - This function is safe for any argument if `T` is sized, and /// - if `T` is unsized, the pointer must have appropriate pointer metadata -/// aquired from the real instance that you are getting this offset for. +/// acquired from the real instance that you are getting this offset for. unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `ArcInner`. // Because it is `?Sized`, it will always be the last field in memory. diff --git a/library/alloc/tests/boxed.rs b/library/alloc/tests/boxed.rs index 5377485da8f..851ca17a365 100644 --- a/library/alloc/tests/boxed.rs +++ b/library/alloc/tests/boxed.rs @@ -37,7 +37,7 @@ fn box_clone_and_clone_from_equivalence() { /// This test might give a false positive in case the box realocates, but the alocator keeps the /// original pointer. /// -/// On the other hand it won't give a false negative, if it fails than the memory was definitly not +/// On the other hand it won't give a false negative, if it fails than the memory was definitely not /// reused #[test] fn box_clone_from_ptr_stability() { diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index ecfaaeace51..c44ce9873d5 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -189,7 +189,7 @@ unsafe impl AllocRef for System { ReallocPlacement::MayMove if layout.size() == 0 => { let new_layout = // SAFETY: The new size and layout alignement guarantees - // are transfered to the caller (they come from parameters). + // are transferred to the caller (they come from parameters). // // See the preconditions for `Layout::from_size_align` to // see what must be checked. @@ -254,7 +254,7 @@ unsafe impl AllocRef for System { // // See `GlobalAlloc::realloc` for more informations about the // guarantees expected by this method. `ptr`, `layout` and - // `new_size` are parameters and the responsability for their + // `new_size` are parameters and the responsibility for their // correctness is left to the caller. // // `realloc` probably checks for `new_size < size` or something diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 1fa438747c1..c98008688ab 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -1363,7 +1363,7 @@ mod self_upper_keyword {} /// /// let r1 = &FOO as *const _; /// let r2 = &FOO as *const _; -/// // With a strictly read-only static, references will have the same adress +/// // With a strictly read-only static, references will have the same address /// assert_eq!(r1, r2); /// // A static item can be used just like a variable in many cases /// println!("{:?}", FOO); diff --git a/library/std/src/sync/once.rs b/library/std/src/sync/once.rs index 64260990824..714ec3e8786 100644 --- a/library/std/src/sync/once.rs +++ b/library/std/src/sync/once.rs @@ -81,7 +81,7 @@ // see the changes to drop the `Waiter` struct correctly. // * There is one place where the two atomics `Once.state_and_queue` and // `Waiter.signaled` come together, and might be reordered by the compiler or -// processor. Because both use Aquire ordering such a reordering is not +// processor. Because both use Acquire ordering such a reordering is not // allowed, so no need for SeqCst. use crate::cell::Cell; diff --git a/src/librustc_infer/infer/combine.rs b/src/librustc_infer/infer/combine.rs index 5b4d91de3ca..133c4bf2db5 100644 --- a/src/librustc_infer/infer/combine.rs +++ b/src/librustc_infer/infer/combine.rs @@ -166,7 +166,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> { return self.unify_const_variable(!a_is_expected, vid, a); } (ty::ConstKind::Unevaluated(..), _) if self.tcx.lazy_normalization() => { - // FIXME(#59490): Need to remove the leak check to accomodate + // FIXME(#59490): Need to remove the leak check to accommodate // escaping bound variables here. if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() { relation.const_equate_obligation(a, b); @@ -174,7 +174,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> { return Ok(b); } (_, ty::ConstKind::Unevaluated(..)) if self.tcx.lazy_normalization() => { - // FIXME(#59490): Need to remove the leak check to accomodate + // FIXME(#59490): Need to remove the leak check to accommodate // escaping bound variables here. if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() { relation.const_equate_obligation(a, b); diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs index 4fa6d9d2394..0125e0f48e8 100644 --- a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -195,7 +195,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } } if let (Some(ident), true) = (override_error_code, fn_returns.is_empty()) { - // Provide a more targetted error code and description. + // Provide a more targeted error code and description. err.code(rustc_errors::error_code!(E0772)); err.set_primary_message(&format!( "{} has {} but calling `{}` introduces an implicit `'static` lifetime \ diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 49aaa845bc2..352b8bff7e2 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -267,7 +267,7 @@ impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { // real code should never need to care about this. // // 2. Using `Span::def_site` or `Span::mixed_site` will not - // include any hygiene information associated with the defintion + // include any hygiene information associated with the definition // site. This means that a proc-macro cannot emit a `$crate` // identifier which resolves to one of its dependencies, // which also should never come up in practice. diff --git a/src/librustc_middle/ty/util.rs b/src/librustc_middle/ty/util.rs index db78fa535cf..07221082048 100644 --- a/src/librustc_middle/ty/util.rs +++ b/src/librustc_middle/ty/util.rs @@ -585,7 +585,7 @@ struct OpaqueTypeExpander<'tcx> { found_recursion: bool, /// Whether or not to check for recursive opaque types. /// This is `true` when we're explicitly checking for opaque type - /// recursion, and 'false' otherwise to avoid unecessary work. + /// recursion, and 'false' otherwise to avoid unnecessary work. check_recursion: bool, tcx: TyCtxt<'tcx>, } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index f6847348063..f1a7338d11f 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -524,7 +524,7 @@ impl<'tcx> Validator<'_, 'tcx> { // The `is_empty` predicate is introduced to exclude the case // where the projection operations are [ .field, * ]. // The reason is because promotion will be illegal if field - // accesses preceed the dereferencing. + // accesses precede the dereferencing. // Discussion can be found at // https://github.com/rust-lang/rust/pull/74945#discussion_r463063247 // There may be opportunity for generalization, but this needs to be diff --git a/src/librustc_mir_build/thir/pattern/mod.rs b/src/librustc_mir_build/thir/pattern/mod.rs index bdefaadfdfe..daff10eb194 100644 --- a/src/librustc_mir_build/thir/pattern/mod.rs +++ b/src/librustc_mir_build/thir/pattern/mod.rs @@ -133,7 +133,7 @@ crate enum PatKind<'tcx> { var: hir::HirId, ty: Ty<'tcx>, subpattern: Option>, - /// Is this the leftmost occurance of the binding, i.e., is `var` the + /// Is this the leftmost occurrence of the binding, i.e., is `var` the /// `HirId` of this pattern? is_primary: bool, }, diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs index 620a04b45b0..9fcdd46539c 100644 --- a/src/librustc_session/config.rs +++ b/src/librustc_session/config.rs @@ -1717,7 +1717,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { } // `-Z instrument-coverage` implies: - // * `-Z symbol-mangling-version=v0` - to ensure consistent and reversable name mangling. + // * `-Z symbol-mangling-version=v0` - to ensure consistent and reversible name mangling. // Note, LLVM coverage tools can analyze coverage over multiple runs, including some // changes to source code; so mangled names must be consistent across compilations. // * `-C link-dead-code` - so unexecuted code is still counted as zero, rather than be diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs index b428315b3cd..b5ffe66ec51 100644 --- a/src/librustc_session/parse.rs +++ b/src/librustc_session/parse.rs @@ -63,7 +63,7 @@ impl GatedSpans { #[derive(Default)] pub struct SymbolGallery { - /// All symbols occurred and their first occurrance span. + /// All symbols occurred and their first occurrence span. pub symbols: Lock>, } diff --git a/src/librustc_span/hygiene.rs b/src/librustc_span/hygiene.rs index 13bc1751831..a03ac4e1fdb 100644 --- a/src/librustc_span/hygiene.rs +++ b/src/librustc_span/hygiene.rs @@ -891,7 +891,7 @@ impl UseSpecializedDecodable for ExpnId {} #[derive(Default)] pub struct HygieneEncodeContext { - /// All `SyntaxContexts` for which we have writen `SyntaxContextData` into crate metadata. + /// All `SyntaxContexts` for which we have written `SyntaxContextData` into crate metadata. /// This is `None` after we finish encoding `SyntaxContexts`, to ensure /// that we don't accidentally try to encode any more `SyntaxContexts` serialized_ctxts: Lock>, @@ -961,7 +961,7 @@ pub struct HygieneDecodeContext { // Maps serialized `SyntaxContext` ids to a `SyntaxContext` in the current // global `HygieneData`. When we deserialize a `SyntaxContext`, we need to create // a new id in the global `HygieneData`. This map tracks the ID we end up picking, - // so that multiple occurences of the same serialized id are decoded to the same + // so that multiple occurrences of the same serialized id are decoded to the same // `SyntaxContext` remapped_ctxts: Lock>>, // The same as `remapepd_ctxts`, but for `ExpnId`s diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index c7e9b97e2db..db8cdfc5b20 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -456,7 +456,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // // Both of these trigger a special `CoerceUnsized`-related error (E0376) // - // We can take advantage of this fact to avoid performing unecessary work. + // We can take advantage of this fact to avoid performing unnecessary work. // If either `source` or `target` is a type variable, then any applicable impl // would need to be generic over the self-type (`impl CoerceUnsized for T`) // or generic over the `CoerceUnsized` type parameter (`impl CoerceUnsized for diff --git a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs b/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs index c6b794de195..51e1af359cd 100644 --- a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs +++ b/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs @@ -10,7 +10,7 @@ // const-evaluator computes a value that *does* meet the conditions for // structural-match, but the const expression itself has abstractions (like // calls to const functions) that may fit better with a type-based analysis -// rather than a committment to a specific value. +// rather than a commitment to a specific value. #![warn(indirect_structural_match)] diff --git a/src/test/ui/consts/issue-73976-polymorphic.rs b/src/test/ui/consts/issue-73976-polymorphic.rs index 518036c9dbe..b3d8610ff51 100644 --- a/src/test/ui/consts/issue-73976-polymorphic.rs +++ b/src/test/ui/consts/issue-73976-polymorphic.rs @@ -1,5 +1,5 @@ // This test is from #73976. We previously did not check if a type is monomorphized -// before calculating its type id, which leads to the bizzare behaviour below that +// before calculating its type id, which leads to the bizarre behaviour below that // TypeId of a generic type does not match itself. // // This test case should either run-pass or be rejected at compile time. diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs index 4f90bd98c63..034499145b7 100644 --- a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs +++ b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs @@ -23,7 +23,7 @@ struct _ヒb; struct __χa; //~^ ERROR type `__χa` should have an upper camel case name -// Besides this, we cannot have two continous underscores in the middle. +// Besides this, we cannot have two continuous underscores in the middle. struct 对__否; //~^ ERROR type `对__否` should have an upper camel case name diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs index 813e0ea5c57..0b52a5fde35 100644 --- a/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs +++ b/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs @@ -18,7 +18,7 @@ fn 编程() {} fn Ц() {} //~^ ERROR function `Ц` should have a snake case name -// besides this, you cannot use continous underscores in the middle +// besides this, you cannot use continuous underscores in the middle fn 分__隔() {} //~^ ERROR function `分__隔` should have a snake case name diff --git a/src/test/ui/proc-macro/crt-static.rs b/src/test/ui/proc-macro/crt-static.rs index 97f6265e308..4f11f81b00b 100644 --- a/src/test/ui/proc-macro/crt-static.rs +++ b/src/test/ui/proc-macro/crt-static.rs @@ -1,4 +1,4 @@ -// Test proc-macro crate can be built without addtional RUSTFLAGS +// Test proc-macro crate can be built without additional RUSTFLAGS // on musl target // override -Ctarget-feature=-crt-static from compiletest // compile-flags: -Ctarget-feature= diff --git a/src/tools/clippy/tests/ui/formatting.rs b/src/tools/clippy/tests/ui/formatting.rs index 078811b8d88..f54b3f2bfe2 100644 --- a/src/tools/clippy/tests/ui/formatting.rs +++ b/src/tools/clippy/tests/ui/formatting.rs @@ -149,7 +149,7 @@ fn main() { 1 + 2, 3 - 4, 5 ]; - // lint if it doesnt + // lint if it doesn't let _ = &[ -1 -4,