From 2a663555ddf36f6b041445894a8c175cd1bc718c Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 25 Dec 2018 08:56:47 -0700 Subject: Remove licenses --- src/libstd/sys/cloudabi/abi/mod.rs | 10 ---------- src/libstd/sys/cloudabi/args.rs | 10 ---------- src/libstd/sys/cloudabi/backtrace.rs | 10 ---------- src/libstd/sys/cloudabi/condvar.rs | 10 ---------- src/libstd/sys/cloudabi/mod.rs | 10 ---------- src/libstd/sys/cloudabi/mutex.rs | 10 ---------- src/libstd/sys/cloudabi/os.rs | 10 ---------- src/libstd/sys/cloudabi/rwlock.rs | 10 ---------- src/libstd/sys/cloudabi/shims/args.rs | 10 ---------- src/libstd/sys/cloudabi/shims/env.rs | 10 ---------- src/libstd/sys/cloudabi/shims/fs.rs | 10 ---------- src/libstd/sys/cloudabi/shims/mod.rs | 10 ---------- src/libstd/sys/cloudabi/shims/net.rs | 10 ---------- src/libstd/sys/cloudabi/shims/os.rs | 10 ---------- src/libstd/sys/cloudabi/shims/pipe.rs | 10 ---------- src/libstd/sys/cloudabi/shims/process.rs | 10 ---------- src/libstd/sys/cloudabi/stack_overflow.rs | 10 ---------- src/libstd/sys/cloudabi/stdio.rs | 10 ---------- src/libstd/sys/cloudabi/thread.rs | 10 ---------- src/libstd/sys/cloudabi/time.rs | 10 ---------- 20 files changed, 200 deletions(-) (limited to 'src/libstd/sys/cloudabi') diff --git a/src/libstd/sys/cloudabi/abi/mod.rs b/src/libstd/sys/cloudabi/abi/mod.rs index 81a4d293423..9d01d24ea83 100644 --- a/src/libstd/sys/cloudabi/abi/mod.rs +++ b/src/libstd/sys/cloudabi/abi/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - #[allow(warnings)] mod cloudabi; pub use self::cloudabi::*; diff --git a/src/libstd/sys/cloudabi/args.rs b/src/libstd/sys/cloudabi/args.rs index 7b62cc6adc9..4147ffff871 100644 --- a/src/libstd/sys/cloudabi/args.rs +++ b/src/libstd/sys/cloudabi/args.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - pub use sys::cloudabi::shims::args::*; #[allow(dead_code)] diff --git a/src/libstd/sys/cloudabi/backtrace.rs b/src/libstd/sys/cloudabi/backtrace.rs index 2c43b5937ce..72f28550435 100644 --- a/src/libstd/sys/cloudabi/backtrace.rs +++ b/src/libstd/sys/cloudabi/backtrace.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2018 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. - use error::Error; use ffi::CStr; use intrinsics; diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs index 3229d98624e..758f29653ae 100644 --- a/src/libstd/sys/cloudabi/condvar.rs +++ b/src/libstd/sys/cloudabi/condvar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use cell::UnsafeCell; use mem; use sync::atomic::{AtomicU32, Ordering}; diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index dfb56472c6c..cd621b76945 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use io; use libc; use mem; diff --git a/src/libstd/sys/cloudabi/mutex.rs b/src/libstd/sys/cloudabi/mutex.rs index d4ba6bcfc80..ae62d8bfdb0 100644 --- a/src/libstd/sys/cloudabi/mutex.rs +++ b/src/libstd/sys/cloudabi/mutex.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use cell::UnsafeCell; use mem; use sync::atomic::{AtomicU32, Ordering}; diff --git a/src/libstd/sys/cloudabi/os.rs b/src/libstd/sys/cloudabi/os.rs index 7e506b84df1..8a6464125de 100644 --- a/src/libstd/sys/cloudabi/os.rs +++ b/src/libstd/sys/cloudabi/os.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use ffi::CStr; use libc::{self, c_int}; use str; diff --git a/src/libstd/sys/cloudabi/rwlock.rs b/src/libstd/sys/cloudabi/rwlock.rs index dc8624ec8a1..7f08c2c7869 100644 --- a/src/libstd/sys/cloudabi/rwlock.rs +++ b/src/libstd/sys/cloudabi/rwlock.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use cell::UnsafeCell; use mem; use sync::atomic::{AtomicU32, Ordering}; diff --git a/src/libstd/sys/cloudabi/shims/args.rs b/src/libstd/sys/cloudabi/shims/args.rs index 1b5785adc8a..f924a434263 100644 --- a/src/libstd/sys/cloudabi/shims/args.rs +++ b/src/libstd/sys/cloudabi/shims/args.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use ffi::OsString; pub struct Args(()); diff --git a/src/libstd/sys/cloudabi/shims/env.rs b/src/libstd/sys/cloudabi/shims/env.rs index c7691e3b2df..de165a864b9 100644 --- a/src/libstd/sys/cloudabi/shims/env.rs +++ b/src/libstd/sys/cloudabi/shims/env.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - pub mod os { pub const FAMILY: &str = "cloudabi"; pub const OS: &str = "cloudabi"; diff --git a/src/libstd/sys/cloudabi/shims/fs.rs b/src/libstd/sys/cloudabi/shims/fs.rs index d3da0fbc371..3af10a74c7d 100644 --- a/src/libstd/sys/cloudabi/shims/fs.rs +++ b/src/libstd/sys/cloudabi/shims/fs.rs @@ -1,13 +1,3 @@ -// 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. - use ffi::OsString; use fmt; use hash::{Hash, Hasher}; diff --git a/src/libstd/sys/cloudabi/shims/mod.rs b/src/libstd/sys/cloudabi/shims/mod.rs index 407c2b90511..080eac19ceb 100644 --- a/src/libstd/sys/cloudabi/shims/mod.rs +++ b/src/libstd/sys/cloudabi/shims/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use io; pub mod args; diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index 7229e71d175..b4caa899a75 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -1,13 +1,3 @@ -// 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. - use fmt; use io; use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; diff --git a/src/libstd/sys/cloudabi/shims/os.rs b/src/libstd/sys/cloudabi/shims/os.rs index 1e355d9ad04..31cb18ea526 100644 --- a/src/libstd/sys/cloudabi/shims/os.rs +++ b/src/libstd/sys/cloudabi/shims/os.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use error::Error as StdError; use ffi::{OsStr, OsString}; use fmt; diff --git a/src/libstd/sys/cloudabi/shims/pipe.rs b/src/libstd/sys/cloudabi/shims/pipe.rs index 77a9cd62590..30ef79dd769 100644 --- a/src/libstd/sys/cloudabi/shims/pipe.rs +++ b/src/libstd/sys/cloudabi/shims/pipe.rs @@ -1,13 +1,3 @@ -// 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. - use io; use sys::Void; diff --git a/src/libstd/sys/cloudabi/shims/process.rs b/src/libstd/sys/cloudabi/shims/process.rs index fcd40c15c17..49b9d5e266e 100644 --- a/src/libstd/sys/cloudabi/shims/process.rs +++ b/src/libstd/sys/cloudabi/shims/process.rs @@ -1,13 +1,3 @@ -// 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. - use ffi::OsStr; use fmt; use io; diff --git a/src/libstd/sys/cloudabi/stack_overflow.rs b/src/libstd/sys/cloudabi/stack_overflow.rs index 5c0b1e5671e..e97831b2c28 100644 --- a/src/libstd/sys/cloudabi/stack_overflow.rs +++ b/src/libstd/sys/cloudabi/stack_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2016 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. - #![cfg_attr(test, allow(dead_code))] pub struct Handler; diff --git a/src/libstd/sys/cloudabi/stdio.rs b/src/libstd/sys/cloudabi/stdio.rs index c90dbd8beab..2cd3477cd51 100644 --- a/src/libstd/sys/cloudabi/stdio.rs +++ b/src/libstd/sys/cloudabi/stdio.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use io; use sys::cloudabi::abi; diff --git a/src/libstd/sys/cloudabi/thread.rs b/src/libstd/sys/cloudabi/thread.rs index a64e0f06849..950420420f0 100644 --- a/src/libstd/sys/cloudabi/thread.rs +++ b/src/libstd/sys/cloudabi/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2018 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. - use boxed::FnBox; use cmp; use ffi::CStr; diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index c9fea18fda6..906beba4ae1 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -1,13 +1,3 @@ -// Copyright 2018 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. - use mem; use sys::cloudabi::abi; use time::Duration; -- cgit 1.4.1-3-g733a5 From 190d139f3aa0613a8b639bae742561ff89c8fbc7 Mon Sep 17 00:00:00 2001 From: Wiktor Kuchta Date: Thu, 3 Jan 2019 21:27:50 +0100 Subject: Fix repeated word typos Found with `git grep -P '\b([a-z]+)\s+\1\b'` --- src/doc/rustc/src/lints/listing/warn-by-default.md | 26 +++++++++++----------- src/doc/rustdoc/src/documentation-tests.md | 2 +- src/librustc/infer/opaque_types/mod.rs | 2 +- src/librustc/mir/interpret/value.rs | 2 +- src/librustc/ty/fold.rs | 2 +- src/librustc_apfloat/ieee.rs | 4 ++-- src/librustc_lint/builtin.rs | 2 +- src/librustc_resolve/diagnostics.rs | 2 +- src/librustc_typeck/check/demand.rs | 2 +- src/librustdoc/clean/auto_trait.rs | 2 +- src/libstd/collections/hash/set.rs | 2 +- src/libstd/sys/cloudabi/abi/cloudabi.rs | 2 +- src/libstd/sys/windows/ext/fs.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 2 +- src/test/debuginfo/simd.rs | 2 +- src/test/run-make-fulldeps/relro-levels/Makefile | 2 +- src/tools/compiletest/src/runtest.rs | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src/libstd/sys/cloudabi') diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index b01aed0915d..7fbbe686b5b 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -24,7 +24,7 @@ warning: attempt to add with overflow ## dead-code -This lint detects detect unused, unexported items. Some +This lint detects unused, unexported items. Some example code that triggers this lint: ```rust @@ -44,7 +44,7 @@ warning: function is never used: `foo` ## deprecated -This lint detects detects use of deprecated items. Some +This lint detects use of deprecated items. Some example code that triggers this lint: ```rust @@ -119,7 +119,7 @@ warning: found struct without foreign-function-safe representation annotation in ## late-bound-lifetime-arguments -This lint detects detects generic lifetime arguments in path segments with +This lint detects generic lifetime arguments in path segments with late bound lifetime parameters. Some example code that triggers this lint: ```rust @@ -381,7 +381,7 @@ extern crate macro_crate_test; ## private-in-public -This lint detects detect private items in public interfaces not caught by the old implementation. Some +This lint detects private items in public interfaces not caught by the old implementation. Some example code that triggers this lint: ```rust,ignore @@ -659,7 +659,7 @@ warning: unknown lint: `not_a_real_lint` ## unreachable-code -This lint detects detects unreachable code paths. Some example code that +This lint detects unreachable code paths. Some example code that triggers this lint: ```rust,no_run @@ -681,7 +681,7 @@ warning: unreachable statement ## unreachable-patterns -This lint detects detects unreachable patterns. Some +This lint detects unreachable patterns. Some example code that triggers this lint: ```rust @@ -716,11 +716,11 @@ annotations now. ## unused-allocation -This lint detects detects unnecessary allocations that can be eliminated. +This lint detects unnecessary allocations that can be eliminated. ## unused-assignments -This lint detects detect assignments that will never be read. Some +This lint detects assignments that will never be read. Some example code that triggers this lint: ```rust @@ -741,7 +741,7 @@ warning: value assigned to `x` is never read ## unused-attributes -This lint detects detects attributes that were not used by the compiler. Some +This lint detects attributes that were not used by the compiler. Some example code that triggers this lint: ```rust @@ -785,7 +785,7 @@ warning: comparison is useless due to type limits ## unused-doc-comment -This lint detects detects doc comments that aren't used by rustdoc. Some +This lint detects doc comments that aren't used by rustdoc. Some example code that triggers this lint: ```rust @@ -831,7 +831,7 @@ warning: unused import: `std::collections::HashMap` ## unused-macros -This lint detects detects macros that were not used. Some example code that +This lint detects macros that were not used. Some example code that triggers this lint: ```rust @@ -884,7 +884,7 @@ warning: unused `std::result::Result` that must be used ## unused-mut -This lint detects detect mut variables which don't need to be mutable. Some +This lint detects mut variables which don't need to be mutable. Some example code that triggers this lint: ```rust @@ -946,7 +946,7 @@ warning: unnecessary `unsafe` block ## unused-variables -This lint detects detect variables which are not used in any way. Some +This lint detects variables which are not used in any way. Some example code that triggers this lint: ```rust diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index dd8dcb7ff9b..dcc13f53493 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -171,7 +171,7 @@ compiles, while only showing the parts that are relevant to that part of your explanation. The `#`-hiding of lines can be prevented by using two consecutive hashes -`##`. This only needs to be done with with the first `#` which would've +`##`. This only needs to be done with the first `#` which would've otherwise caused hiding. If we have a string literal like the following, which has a line that starts with a `#`: diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 56c6da83ed9..5e94bb1f877 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -19,7 +19,7 @@ pub type OpaqueTypeMap<'tcx> = DefIdMap>; /// appear in the return type). #[derive(Copy, Clone, Debug)] pub struct OpaqueTypeDecl<'tcx> { - /// The substitutions that we apply to the abstract that that this + /// The substitutions that we apply to the abstract that this /// `impl Trait` desugars to. e.g., if: /// /// fn foo<'a, 'b, T>() -> impl Trait<'a> diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 1e4cfedc2a6..6f6b0c4ccd8 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -87,7 +87,7 @@ pub enum Scalar { /// The raw bytes of a simple value. Bits { /// The first `size` bytes are the value. - /// Do not try to read less or more bytes that that. The remaining bytes must be 0. + /// Do not try to read less or more bytes than that. The remaining bytes must be 0. size: u8, bits: u128, }, diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 0a72f733b51..d118b37c5ae 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -110,7 +110,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { self.has_type_flags(TypeFlags::HAS_FREE_REGIONS) } - /// True if there any any un-erased free regions. + /// True if there any un-erased free regions. fn has_erasable_regions(&self) -> bool { self.has_type_flags(TypeFlags::HAS_FREE_REGIONS) } diff --git a/src/librustc_apfloat/ieee.rs b/src/librustc_apfloat/ieee.rs index 2ff9faa3bb1..7ad34bec899 100644 --- a/src/librustc_apfloat/ieee.rs +++ b/src/librustc_apfloat/ieee.rs @@ -2341,7 +2341,7 @@ mod sig { // Our exponent should not underflow. *exp = exp.checked_sub(bits as ExpInt).unwrap(); - // Jump is the inter-limb jump; shift is is intra-limb shift. + // Jump is the inter-limb jump; shift is the intra-limb shift. let jump = bits / LIMB_BITS; let shift = bits % LIMB_BITS; @@ -2375,7 +2375,7 @@ mod sig { // Our exponent should not overflow. *exp = exp.checked_add(bits as ExpInt).unwrap(); - // Jump is the inter-limb jump; shift is is intra-limb shift. + // Jump is the inter-limb jump; shift is the intra-limb shift. let jump = bits / LIMB_BITS; let shift = bits % LIMB_BITS; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 27b65b4ec48..a555b779097 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -673,7 +673,7 @@ impl EarlyLintPass for AnonymousParameters { } } -/// Checks for incorrect use use of `repr` attributes. +/// Checks for incorrect use of `repr` attributes. #[derive(Clone)] pub struct BadRepr; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 84a9c80ab2f..3f9c5f4fd27 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -192,7 +192,7 @@ use foo::core; // error: an extern crate named `core` has already fn main() {} ``` -To fix issue issue, you have to rename at least one of the two imports. +To fix this issue, you have to rename at least one of the two imports. Example: ``` diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 7a788f2de7f..41f2b0ec7d2 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -335,7 +335,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // we may want to suggest adding a `*`, or removing // a `&`. // - // (But, also check check the `expn_info()` to see if this is + // (But, also check the `expn_info()` to see if this is // a macro; if so, it's hard to extract the text and make a good // suggestion, so don't bother.) if self.infcx.can_sub(self.param_env, checked, &expected).is_ok() && diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index bdd2b058fd1..27ca205720d 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -534,7 +534,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { did, param_env, type_generics, existing_predicates ); - // The `Sized` trait must be handled specially, since we only only display it when + // The `Sized` trait must be handled specially, since we only display it when // it is *not* required (i.e., '?Sized') let sized_trait = self.cx .tcx diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index aebd0eb5de6..92145907b95 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -179,7 +179,7 @@ impl HashSet HashSet { map: HashMap::with_hasher(hasher) } } - /// Creates an empty `HashSet` with with the specified capacity, using + /// Creates an empty `HashSet` with the specified capacity, using /// `hasher` to hash the keys. /// /// The hash set will be able to hold at least `capacity` elements without diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs index cd9a5ad448f..aac1804734a 100644 --- a/src/libstd/sys/cloudabi/abi/cloudabi.rs +++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs @@ -107,7 +107,7 @@ //! //! ## Specification of the ABI //! -//! The entire ABI is specified in a a file called +//! The entire ABI is specified in a file called //! [`cloudabi.txt`](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt), //! from which all //! [headers](https://github.com/NuxiNL/cloudabi/tree/master/headers) diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 8eaf58aed32..6342af46daf 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -126,7 +126,7 @@ pub trait OpenOptionsExt { /// /// By default `share_mode` is set to /// `FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE`. This allows - /// other processes to to read, write, and delete/rename the same file + /// other processes to read, write, and delete/rename the same file /// while it is open. Removing any of the flags will prevent other /// processes from performing the corresponding operation until the file /// handle is closed. diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 970796a2136..d55f785bd9b 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -161,7 +161,7 @@ struct MatcherPos<'root, 'tt: 'root> { /// The position of the "dot" in this matcher idx: usize, - /// The first span of source source that the beginning of this matcher corresponds to. In other + /// The first span of source that the beginning of this matcher corresponds to. In other /// words, the token in the source whose span is `sp_open` is matched against the first token of /// the matcher. sp_open: Span, diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs index 4748916002c..e41acc2e1ec 100644 --- a/src/test/debuginfo/simd.rs +++ b/src/test/debuginfo/simd.rs @@ -4,7 +4,7 @@ // FIXME: LLVM generates invalid debug info for variables requiring // dynamic stack realignment, which is the case on s390x for vector -// types with with non-vector ABI. +// types with non-vector ABI. // ignore-s390x // compile-flags:-g diff --git a/src/test/run-make-fulldeps/relro-levels/Makefile b/src/test/run-make-fulldeps/relro-levels/Makefile index 673ba9a9a02..78ac2f6a82d 100644 --- a/src/test/run-make-fulldeps/relro-levels/Makefile +++ b/src/test/run-make-fulldeps/relro-levels/Makefile @@ -1,6 +1,6 @@ -include ../tools.mk -# This tests the different -Zrelro-level values, and makes sure that they they work properly. +# This tests the different -Zrelro-level values, and makes sure that they work properly. all: ifeq ($(UNAME),Linux) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 84f3f30d691..400c205d44b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2569,7 +2569,7 @@ impl<'test> TestCx<'test> { .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags) // We for sure don't want these tests to run in parallel, so make - // sure they don't have access to these vars if we we run via `make` + // sure they don't have access to these vars if we run via `make` // at the top level .env_remove("MAKEFLAGS") .env_remove("MFLAGS") -- cgit 1.4.1-3-g733a5 From 255a3f3e183150e30d411628d5996bd3a183bd6f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Dec 2018 10:29:23 -0800 Subject: std: Force `Instant::now()` to be monotonic This commit is an attempt to force `Instant::now` to be monotonic through any means possible. We tried relying on OS/hardware/clock implementations, but those seem buggy enough that we can't rely on them in practice. This commit implements the same hammer Firefox recently implemented (noted in #56612) which is to just keep whatever the lastest `Instant::now()` return value was in memory, returning that instead of the OS looks like it's moving backwards. Closes #48514 Closes #49281 cc #51648 cc #56560 Closes #56612 Closes #56940 --- src/librustc/util/profiling.rs | 17 ++--------------- src/libstd/sys/cloudabi/time.rs | 8 ++++++++ src/libstd/sys/redox/time.rs | 8 ++++++++ src/libstd/sys/unix/time.rs | 40 +++++++++++++++++++++++++++------------ src/libstd/sys/wasm/time.rs | 8 ++++++++ src/libstd/sys/windows/time.rs | 8 ++++++++ src/libstd/time.rs | 42 ++++++++++++++++++++++++++++++++++++++++- 7 files changed, 103 insertions(+), 28 deletions(-) (limited to 'src/libstd/sys/cloudabi') diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index d598709ae3a..a73a2d79d30 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -2,7 +2,7 @@ use session::config::Options; use std::fs; use std::io::{self, StderrLock, Write}; -use std::time::{Duration, Instant}; +use std::time::Instant; macro_rules! define_categories { ($($name:ident,)*) => { @@ -203,20 +203,7 @@ impl SelfProfiler { } fn stop_timer(&mut self) -> u64 { - let elapsed = if cfg!(windows) { - // On Windows, timers don't always appear to be monotonic (see #51648) - // which can lead to panics when calculating elapsed time. - // Work around this by testing to see if the current time is less than - // our recorded time, and if it is, just returning 0. - let now = Instant::now(); - if self.current_timer >= now { - Duration::new(0, 0) - } else { - self.current_timer.elapsed() - } - } else { - self.current_timer.elapsed() - }; + let elapsed = self.current_timer.elapsed(); self.current_timer = Instant::now(); diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index 906beba4ae1..545e3c0ce84 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -25,6 +25,14 @@ impl Instant { } } + pub fn actually_monotonic() -> bool { + true + } + + pub const fn zero() -> Instant { + Instant { t: 0 } + } + pub fn sub_instant(&self, other: &Instant) -> Duration { let diff = self.t .checked_sub(other.t) diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index b3272350657..401b7012aa7 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -128,6 +128,14 @@ impl Instant { Instant { t: now(syscall::CLOCK_MONOTONIC) } } + pub const fn zero() -> Instant { + Instant { t: Timespec { t: syscall::TimeSpec { tv_sec: 0, tv_nsec: 0 } } } + } + + pub fn actually_monotonic() -> bool { + false + } + pub fn sub_instant(&self, other: &Instant) -> Duration { self.t.sub_timespec(&other.t).unwrap_or_else(|_| { panic!("specified instant was later than self") diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 073c0d0686d..4a655714f99 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -14,6 +14,12 @@ struct Timespec { } impl Timespec { + const fn zero() -> Timespec { + Timespec { + t: libc::timespec { tv_sec: 0, tv_nsec: 0 }, + } + } + fn sub_timespec(&self, other: &Timespec) -> Result { if self >= other { Ok(if self.t.tv_nsec >= other.t.tv_nsec { @@ -128,12 +134,7 @@ mod inner { } pub const UNIX_EPOCH: SystemTime = SystemTime { - t: Timespec { - t: libc::timespec { - tv_sec: 0, - tv_nsec: 0, - }, - }, + t: Timespec::zero(), }; impl Instant { @@ -141,6 +142,14 @@ mod inner { Instant { t: unsafe { libc::mach_absolute_time() } } } + pub const fn zero() -> Instant { + Instant { t: 0 } + } + + pub fn actually_monotonic() -> bool { + true + } + pub fn sub_instant(&self, other: &Instant) -> Duration { let info = info(); let diff = self.t.checked_sub(other.t) @@ -258,12 +267,7 @@ mod inner { } pub const UNIX_EPOCH: SystemTime = SystemTime { - t: Timespec { - t: libc::timespec { - tv_sec: 0, - tv_nsec: 0, - }, - }, + t: Timespec::zero(), }; impl Instant { @@ -271,6 +275,18 @@ mod inner { Instant { t: now(libc::CLOCK_MONOTONIC) } } + pub const fn zero() -> Instant { + Instant { + t: Timespec::zero(), + } + } + + pub fn actually_monotonic() -> bool { + (cfg!(target_os = "linux") && cfg!(target_arch = "x86_64")) || + (cfg!(target_os = "linux") && cfg!(target_arch = "x86")) || + false // last clause, used so `||` is always trailing above + } + pub fn sub_instant(&self, other: &Instant) -> Duration { self.t.sub_timespec(&other.t).unwrap_or_else(|_| { panic!("specified instant was later than self") diff --git a/src/libstd/sys/wasm/time.rs b/src/libstd/sys/wasm/time.rs index a5c41d4a96e..31798466fed 100644 --- a/src/libstd/sys/wasm/time.rs +++ b/src/libstd/sys/wasm/time.rs @@ -14,6 +14,14 @@ impl Instant { Instant(TimeSysCall::perform(TimeClock::Monotonic)) } + pub const fn zero() -> Instant { + Instant(Duration::from_secs(0)) + } + + pub fn actually_monotonic() -> bool { + false + } + pub fn sub_instant(&self, other: &Instant) -> Duration { self.0 - other.0 } diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 60c96959186..8e8e9195cf4 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -40,6 +40,14 @@ impl Instant { t } + pub fn actually_monotonic() -> bool { + false + } + + pub const fn zero() -> Instant { + Instant { t: 0 } + } + pub fn sub_instant(&self, other: &Instant) -> Duration { // Values which are +- 1 need to be considered as basically the same // units in time due to various measurement oddities, according to diff --git a/src/libstd/time.rs b/src/libstd/time.rs index eb67b718dbd..72a5a070233 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -12,11 +12,13 @@ #![stable(feature = "time", since = "1.3.0")] +use cmp; use error::Error; use fmt; use ops::{Add, Sub, AddAssign, SubAssign}; use sys::time; use sys_common::FromInner; +use sys_common::mutex::Mutex; #[stable(feature = "time", since = "1.3.0")] pub use core::time::Duration; @@ -150,7 +152,45 @@ impl Instant { /// ``` #[stable(feature = "time2", since = "1.8.0")] pub fn now() -> Instant { - Instant(time::Instant::now()) + let os_now = time::Instant::now(); + + // And here we come upon a sad state of affairs. The whole point of + // `Instant` is that it's monotonically increasing. We've found in the + // wild, however, that it's not actually monotonically increasing for + // one reason or another. These appear to be OS and hardware level bugs, + // and there's not really a whole lot we can do about them. Here's a + // taste of what we've found: + // + // * #48514 - OpenBSD, x86_64 + // * #49281 - linux arm64 and s390x + // * #51648 - windows, x86 + // * #56560 - windows, x86_64, AWS + // * #56612 - windows, x86, vm (?) + // * #56940 - linux, arm64 + // * https://bugzilla.mozilla.org/show_bug.cgi?id=1487778 - a similar + // Firefox bug + // + // It simply seems that this it just happens so that a lot in the wild + // we're seeing panics across various platforms where consecutive calls + // to `Instant::now`, such as via the `elapsed` function, are panicking + // as they're going backwards. Placed here is a last-ditch effort to try + // to fix things up. We keep a global "latest now" instance which is + // returned instead of what the OS says if the OS goes backwards. + // + // To hopefully mitigate the impact of this though a few platforms are + // whitelisted as "these at least haven't gone backwards yet". + if time::Instant::actually_monotonic() { + return Instant(os_now) + } + + static LOCK: Mutex = Mutex::new(); + static mut LAST_NOW: time::Instant = time::Instant::zero(); + unsafe { + let _lock = LOCK.lock(); + let now = cmp::max(LAST_NOW, os_now); + LAST_NOW = now; + Instant(now) + } } /// Returns the amount of time elapsed from another instant to this one. -- cgit 1.4.1-3-g733a5