From 85a85c2070a6a967f1ccb1495391217fdb793112 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 3 Feb 2015 23:15:52 -0800 Subject: [PATCH] Switch missing_copy_implementations to default-allow This was particularly helpful in the time just after OIBIT's implementation to make sure things that were supposed to be Copy continued to be, but it's now creates a lot of noise for types that intentionally don't want to be Copy. --- src/doc/reference.md | 1 - src/libcollections/string.rs | 1 - src/libcore/hash/sip.rs | 1 - src/libcore/marker.rs | 2 -- src/libcore/str/mod.rs | 1 - src/liblibc/lib.rs | 5 ---- src/librand/lib.rs | 1 - src/librustc/lint/builtin.rs | 2 +- .../middle/infer/region_inference/mod.rs | 1 - src/librustc/middle/traits/coherence.rs | 1 - src/librustc/session/config.rs | 2 -- src/librustc/util/nodemap.rs | 1 - src/librustc/util/snapshot_vec.rs | 1 - src/librustc_borrowck/borrowck/mod.rs | 1 - src/librustc_llvm/lib.rs | 25 ------------------- src/librustc_trans/trans/value.rs | 1 - src/librustc_typeck/rscope.rs | 1 - src/libstd/collections/hash/map.rs | 2 -- src/libstd/dynamic_lib.rs | 1 - src/libstd/os.rs | 1 - src/libstd/rand/os.rs | 1 - src/libstd/rt/unwind.rs | 3 --- src/libstd/rt/util.rs | 1 - src/libstd/sync/barrier.rs | 1 - src/libstd/sync/poison.rs | 1 - src/test/compile-fail/lint-dead-code-1.rs | 1 - src/test/compile-fail/lint-missing-doc.rs | 1 - src/test/compile-fail/missing_debug_impls.rs | 2 +- 28 files changed, 2 insertions(+), 61 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 64ddb3ffdd39f..ecddb627c6590 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1813,7 +1813,6 @@ default visibility with the `priv` keyword. When an item is declared as `pub`, it can be thought of as being accessible to the outside world. For example: ``` -# #![allow(missing_copy_implementations)] # fn main() {} // Declare a private struct struct Foo; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 554eee765f3eb..508bd7e668621 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -49,7 +49,6 @@ pub struct FromUtf8Error { /// A possible error value from the `String::from_utf16` function. #[stable(feature = "rust1", since = "1.0.0")] -#[allow(missing_copy_implementations)] #[derive(Debug)] pub struct FromUtf16Error(()); diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index bef196d482460..d405d0d28beb3 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -30,7 +30,6 @@ use super::{Hasher, Writer}; /// strong, this implementation has not been reviewed for such purposes. /// As such, all cryptographic uses of this implementation are strongly /// discouraged. -#[allow(missing_copy_implementations)] pub struct SipHasher { k0: u64, k1: u64, diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 299cdbda3cc74..2d14b31748e5f 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -396,7 +396,6 @@ pub struct InvariantLifetime<'a>; reason = "likely to change with new variance strategy")] #[lang="no_copy_bound"] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] -#[allow(missing_copy_implementations)] pub struct NoCopy; /// A type which is considered managed by the GC. This is typically @@ -405,5 +404,4 @@ pub struct NoCopy; reason = "likely to change with new variance strategy")] #[lang="managed_bound"] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] -#[allow(missing_copy_implementations)] pub struct Managed; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8c0c16bafc4c5..030b4597e1247 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -149,7 +149,6 @@ impl FromStr for bool { /// An error returned when parsing a `bool` from a string fails. #[derive(Debug, Clone, PartialEq)] -#[allow(missing_copy_implementations)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseBoolError { _priv: () } diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index c5ea10beb83c5..b643b04035f2a 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -332,15 +332,12 @@ pub mod types { /// variants, because the compiler complains about the repr attribute /// otherwise. #[repr(u8)] - #[allow(missing_copy_implementations)] pub enum c_void { __variant1, __variant2, } - #[allow(missing_copy_implementations)] pub enum FILE {} - #[allow(missing_copy_implementations)] pub enum fpos_t {} } pub mod c99 { @@ -354,9 +351,7 @@ pub mod types { pub type uint64_t = u64; } pub mod posix88 { - #[allow(missing_copy_implementations)] pub enum DIR {} - #[allow(missing_copy_implementations)] pub enum dirent_t {} } pub mod posix01 {} diff --git a/src/librand/lib.rs b/src/librand/lib.rs index afb5d0c6eaab1..5f4df12ba45d0 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -383,7 +383,6 @@ pub trait SeedableRng: Rng { /// [1]: Marsaglia, George (July 2003). ["Xorshift /// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of /// Statistical Software*. Vol. 8 (Issue 14). -#[allow(missing_copy_implementations)] #[derive(Clone)] pub struct XorShiftRng { x: u32, diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 53054f462c8b6..8a7617cce2d5e 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -2038,7 +2038,7 @@ declare_lint! { declare_lint! { pub MISSING_COPY_IMPLEMENTATIONS, - Warn, + Allow, "detects potentially-forgotten implementations of `Copy`" } diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index 919ea0a25202c..0521a1dac69e0 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -224,7 +224,6 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> { } #[derive(Debug)] -#[allow(missing_copy_implementations)] pub struct RegionSnapshot { length: uint, skolemization_count: u32, diff --git a/src/librustc/middle/traits/coherence.rs b/src/librustc/middle/traits/coherence.rs index 44cd17caaecbb..3a7522cafee90 100644 --- a/src/librustc/middle/traits/coherence.rs +++ b/src/librustc/middle/traits/coherence.rs @@ -59,7 +59,6 @@ pub fn impl_can_satisfy(infcx: &InferCtxt, |o| selcx.evaluate_obligation(o)) } -#[allow(missing_copy_implementations)] pub enum OrphanCheckErr<'tcx> { NoLocalInputType, UncoveredTy(Ty<'tcx>), diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 88f6dc673cf18..645077b97869e 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -132,7 +132,6 @@ pub enum UnstableFeatures { } #[derive(Clone, PartialEq, Eq)] -#[allow(missing_copy_implementations)] pub enum PrintRequest { FileNames, Sysroot, @@ -290,7 +289,6 @@ macro_rules! options { $($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) => ( #[derive(Clone)] - #[allow(missing_copy_implementations)] pub struct $struct_name { $(pub $opt: $t),* } pub fn $defaultfn() -> $struct_name { diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index 8da06e63daefc..f8e3defe19d63 100644 --- a/src/librustc/util/nodemap.rs +++ b/src/librustc/util/nodemap.rs @@ -46,7 +46,6 @@ pub fn DefIdSet() -> DefIdSet { FnvHashSet() } /// /// This uses FNV hashing, as described here: /// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function -#[allow(missing_copy_implementations)] pub struct FnvHasher(u64); impl Default for FnvHasher { diff --git a/src/librustc/util/snapshot_vec.rs b/src/librustc/util/snapshot_vec.rs index 151173b3a4085..8fbc682246f47 100644 --- a/src/librustc/util/snapshot_vec.rs +++ b/src/librustc/util/snapshot_vec.rs @@ -46,7 +46,6 @@ pub struct SnapshotVec { } // Snapshots are tokens that should be created/consumed linearly. -#[allow(missing_copy_implementations)] pub struct Snapshot { // Length of the undo log at the time the snapshot was taken. length: uint, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index e5271cfde5a44..c94149105163d 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -464,7 +464,6 @@ pub fn opt_loan_path<'tcx>(cmt: &mc::cmt<'tcx>) -> Option>> { // Errors that can occur #[derive(PartialEq)] -#[allow(missing_copy_implementations)] pub enum bckerr_code { err_mutbl, err_out_of_scope(ty::Region, ty::Region), // superscope, subscope diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index a1532c044e3dc..b45a27214db56 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -430,73 +430,50 @@ pub enum DiagnosticKind { } // Opaque pointer types -#[allow(missing_copy_implementations)] pub enum Module_opaque {} pub type ModuleRef = *mut Module_opaque; -#[allow(missing_copy_implementations)] pub enum Context_opaque {} pub type ContextRef = *mut Context_opaque; -#[allow(missing_copy_implementations)] pub enum Type_opaque {} pub type TypeRef = *mut Type_opaque; -#[allow(missing_copy_implementations)] pub enum Value_opaque {} pub type ValueRef = *mut Value_opaque; -#[allow(missing_copy_implementations)] pub enum Metadata_opaque {} pub type MetadataRef = *mut Metadata_opaque; -#[allow(missing_copy_implementations)] pub enum BasicBlock_opaque {} pub type BasicBlockRef = *mut BasicBlock_opaque; -#[allow(missing_copy_implementations)] pub enum Builder_opaque {} pub type BuilderRef = *mut Builder_opaque; -#[allow(missing_copy_implementations)] pub enum ExecutionEngine_opaque {} pub type ExecutionEngineRef = *mut ExecutionEngine_opaque; -#[allow(missing_copy_implementations)] pub enum RustJITMemoryManager_opaque {} pub type RustJITMemoryManagerRef = *mut RustJITMemoryManager_opaque; -#[allow(missing_copy_implementations)] pub enum MemoryBuffer_opaque {} pub type MemoryBufferRef = *mut MemoryBuffer_opaque; -#[allow(missing_copy_implementations)] pub enum PassManager_opaque {} pub type PassManagerRef = *mut PassManager_opaque; -#[allow(missing_copy_implementations)] pub enum PassManagerBuilder_opaque {} pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque; -#[allow(missing_copy_implementations)] pub enum Use_opaque {} pub type UseRef = *mut Use_opaque; -#[allow(missing_copy_implementations)] pub enum TargetData_opaque {} pub type TargetDataRef = *mut TargetData_opaque; -#[allow(missing_copy_implementations)] pub enum ObjectFile_opaque {} pub type ObjectFileRef = *mut ObjectFile_opaque; -#[allow(missing_copy_implementations)] pub enum SectionIterator_opaque {} pub type SectionIteratorRef = *mut SectionIterator_opaque; -#[allow(missing_copy_implementations)] pub enum Pass_opaque {} pub type PassRef = *mut Pass_opaque; -#[allow(missing_copy_implementations)] pub enum TargetMachine_opaque {} pub type TargetMachineRef = *mut TargetMachine_opaque; -#[allow(missing_copy_implementations)] pub enum Archive_opaque {} pub type ArchiveRef = *mut Archive_opaque; -#[allow(missing_copy_implementations)] pub enum Twine_opaque {} pub type TwineRef = *mut Twine_opaque; -#[allow(missing_copy_implementations)] pub enum DiagnosticInfo_opaque {} pub type DiagnosticInfoRef = *mut DiagnosticInfo_opaque; -#[allow(missing_copy_implementations)] pub enum DebugLoc_opaque {} pub type DebugLocRef = *mut DebugLoc_opaque; -#[allow(missing_copy_implementations)] pub enum SMDiagnostic_opaque {} pub type SMDiagnosticRef = *mut SMDiagnostic_opaque; @@ -507,7 +484,6 @@ pub mod debuginfo { pub use self::DIDescriptorFlags::*; use super::{MetadataRef}; - #[allow(missing_copy_implementations)] pub enum DIBuilder_opaque {} pub type DIBuilderRef = *mut DIBuilder_opaque; @@ -2209,7 +2185,6 @@ pub fn get_param(llfn: ValueRef, index: c_uint) -> ValueRef { } } -#[allow(missing_copy_implementations)] pub enum RustString_opaque {} pub type RustStringRef = *mut RustString_opaque; type RustStringRepr = *mut RefCell>; diff --git a/src/librustc_trans/trans/value.rs b/src/librustc_trans/trans/value.rs index b6fd2eb57be27..464522f167b47 100644 --- a/src/librustc_trans/trans/value.rs +++ b/src/librustc_trans/trans/value.rs @@ -150,7 +150,6 @@ impl Use { } /// Iterator for the users of a value -#[allow(missing_copy_implementations)] pub struct Users { next: Option } diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs index ddb485d9776d1..60e969c4f99dd 100644 --- a/src/librustc_typeck/rscope.rs +++ b/src/librustc_typeck/rscope.rs @@ -79,7 +79,6 @@ impl RegionScope for UnelidableRscope { // A scope in which any omitted region defaults to `default`. This is // used after the `->` in function signatures, but also for backwards // compatibility with object types. The latter use may go away. -#[allow(missing_copy_implementations)] pub struct SpecificRscope { default: ty::Region } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 205eeb75b5b79..81acd87a27619 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1580,7 +1580,6 @@ impl Extend<(K, V)> for HashMap /// `Hasher`, but the hashers created by two different `RandomState` /// instances are unlikely to produce the same result for the same values. #[derive(Clone)] -#[allow(missing_copy_implementations)] #[unstable(feature = "std_misc", reason = "hashing an hash maps may be altered")] pub struct RandomState { @@ -1622,7 +1621,6 @@ impl Default for RandomState { /// This is the default hasher used in a `HashMap` to hash keys. Types do not /// typically declare an ability to explicitly hash into this particular type, /// but rather in a `H: hash::Writer` type parameter. -#[allow(missing_copy_implementations)] #[unstable(feature = "std_misc", reason = "hashing an hash maps may be altered")] pub struct Hasher { inner: SipHasher } diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 68ae0f7e5b5f3..51a889360342d 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -22,7 +22,6 @@ use mem; use env; use str; -#[allow(missing_copy_implementations)] pub struct DynamicLibrary { handle: *mut u8 } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index d92f361af0bf2..93dc8c49079e2 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -759,7 +759,6 @@ pub fn page_size() -> uint { /// /// The memory map is released (unmapped) when the destructor is run, so don't /// let it leave scope by accident if you want it to stick around. -#[allow(missing_copy_implementations)] pub struct MemoryMap { data: *mut u8, len: uint, diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 4b45d5501c235..f24867d6d0183 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -206,7 +206,6 @@ mod imp { /// - iOS: calls SecRandomCopyBytes as /dev/(u)random is sandboxed. /// /// This does not block. - #[allow(missing_copy_implementations)] pub struct OsRng { // dummy field to ensure that this struct cannot be constructed outside of this module _dummy: (), diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 81ca5aa0e8a6e..b37996fa9d9de 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -390,13 +390,10 @@ pub mod eabi { use libc::{c_void, c_int}; #[repr(C)] - #[allow(missing_copy_implementations)] pub struct EXCEPTION_RECORD; #[repr(C)] - #[allow(missing_copy_implementations)] pub struct CONTEXT; #[repr(C)] - #[allow(missing_copy_implementations)] pub struct DISPATCHER_CONTEXT; #[repr(C)] diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 86d21cf72782e..703dca4d29bf9 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -88,7 +88,6 @@ pub fn default_sched_threads() -> uint { pub const ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) || cfg!(rtassert); -#[allow(missing_copy_implementations)] pub struct Stdio(libc::c_int); #[allow(non_upper_case_globals)] diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index 581e540d3b6ed..cca376f7b6d05 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -46,7 +46,6 @@ struct BarrierState { /// /// Currently this opaque structure only has one method, `.is_leader()`. Only /// one thread will receive a result that will return `true` from this function. -#[allow(missing_copy_implementations)] pub struct BarrierWaitResult(bool); impl Barrier { diff --git a/src/libstd/sync/poison.rs b/src/libstd/sync/poison.rs index 18680b96592ce..d9bc37d312e86 100644 --- a/src/libstd/sync/poison.rs +++ b/src/libstd/sync/poison.rs @@ -42,7 +42,6 @@ impl Flag { } } -#[allow(missing_copy_implementations)] pub struct Guard { panicking: bool, } diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index 519839ae2f4cb..b1bb28f7ce716 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -12,7 +12,6 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -#![allow(missing_copy_implementations)] #![deny(dead_code)] #![feature(core)] diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 55103f10f2ce1..3b96fd64fa200 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -12,7 +12,6 @@ // injected intrinsics by the compiler. #![deny(missing_docs)] #![allow(dead_code)] -#![allow(missing_copy_implementations)] //! Some garbage docs for the crate here #![doc="More garbage"] diff --git a/src/test/compile-fail/missing_debug_impls.rs b/src/test/compile-fail/missing_debug_impls.rs index bc4bfef4d48c4..ddc9081e33bb6 100644 --- a/src/test/compile-fail/missing_debug_impls.rs +++ b/src/test/compile-fail/missing_debug_impls.rs @@ -10,7 +10,7 @@ // compile-flags: --crate-type lib #![deny(missing_debug_implementations)] -#![allow(unused, missing_copy_implementations)] +#![allow(unused)] use std::fmt;