about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/librustc_lint/builtin.rs86
-rw-r--r--src/librustc_lint/lib.rs3
-rw-r--r--src/librustc_llvm/diagnostic.rs1
-rw-r--r--src/test/compile-fail/lint-raw-ptr-derive.rs34
-rw-r--r--src/test/run-pass/issue-21296.rs21
6 files changed, 0 insertions, 146 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index df7b7c437c3..a4745ac636d 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -63,7 +63,6 @@
 #![doc(test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
 
 #![no_core]
-#![allow(raw_pointer_derive)]
 #![deny(missing_docs)]
 
 #![feature(allow_internal_unstable)]
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index a001289b196..39837862c4e 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -139,92 +139,6 @@ impl LateLintPass for BoxPointers {
 }
 
 declare_lint! {
-    RAW_POINTER_DERIVE,
-    Warn,
-    "uses of #[derive] with raw pointers are rarely correct"
-}
-
-struct RawPtrDeriveVisitor<'a, 'tcx: 'a> {
-    cx: &'a LateContext<'a, 'tcx>
-}
-
-impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDeriveVisitor<'a, 'tcx> {
-    fn visit_ty(&mut self, ty: &hir::Ty) {
-        const MSG: &'static str = "use of `#[derive]` with a raw pointer";
-        if let hir::TyPtr(..) = ty.node {
-            self.cx.span_lint(RAW_POINTER_DERIVE, ty.span, MSG);
-        }
-        visit::walk_ty(self, ty);
-    }
-    // explicit override to a no-op to reduce code bloat
-    fn visit_expr(&mut self, _: &hir::Expr) {}
-    fn visit_block(&mut self, _: &hir::Block) {}
-}
-
-pub struct RawPointerDerive {
-    checked_raw_pointers: NodeSet,
-}
-
-impl RawPointerDerive {
-    pub fn new() -> RawPointerDerive {
-        RawPointerDerive {
-            checked_raw_pointers: NodeSet(),
-        }
-    }
-}
-
-impl LintPass for RawPointerDerive {
-    fn get_lints(&self) -> LintArray {
-        lint_array!(RAW_POINTER_DERIVE)
-    }
-}
-
-impl LateLintPass for RawPointerDerive {
-    fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
-        if !attr::contains_name(&item.attrs, "automatically_derived") {
-            return;
-        }
-        let did = match item.node {
-            hir::ItemImpl(_, _, _, ref t_ref_opt, _, _) => {
-                // Deriving the Copy trait does not cause a warning
-                if let &Some(ref trait_ref) = t_ref_opt {
-                    let def_id = cx.tcx.trait_ref_to_def_id(trait_ref);
-                    if Some(def_id) == cx.tcx.lang_items.copy_trait() {
-                        return;
-                    }
-                }
-
-                match cx.tcx.node_id_to_type(item.id).sty {
-                    ty::TyEnum(def, _) => def.did,
-                    ty::TyStruct(def, _) => def.did,
-                    _ => return,
-                }
-            }
-            _ => return,
-        };
-        let node_id = if let Some(node_id) = cx.tcx.map.as_local_node_id(did) {
-            node_id
-        } else {
-            return;
-        };
-        let item = match cx.tcx.map.find(node_id) {
-            Some(hir_map::NodeItem(item)) => item,
-            _ => return,
-        };
-        if !self.checked_raw_pointers.insert(item.id) {
-            return;
-        }
-        match item.node {
-            hir::ItemStruct(..) | hir::ItemEnum(..) => {
-                let mut visitor = RawPtrDeriveVisitor { cx: cx };
-                visit::walk_item(&mut visitor, &item);
-            }
-            _ => {}
-        }
-    }
-}
-
-declare_lint! {
     NON_SHORTHAND_FIELD_PATTERNS,
     Warn,
     "using `Struct { x: x }` instead of `Struct { x }`"
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 920e0341372..2613115d805 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -135,7 +135,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
 
     add_builtin_with_new!(sess,
                           TypeLimits,
-                          RawPointerDerive,
                           MissingDoc,
                           MissingDebugImplementations,
                           );
@@ -152,8 +151,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
     store.register_late_pass(sess, false, box lint::GatherNodeLevels);
 
     // Insert temporary renamings for a one-time deprecation
-    store.register_renamed("raw_pointer_deriving", "raw_pointer_derive");
-
     store.register_renamed("unknown_features", "unused_features");
 
     store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs
index e6350ae44d4..c09048d677e 100644
--- a/src/librustc_llvm/diagnostic.rs
+++ b/src/librustc_llvm/diagnostic.rs
@@ -37,7 +37,6 @@ impl OptimizationDiagnosticKind {
     }
 }
 
-#[allow(raw_pointer_derive)]
 #[derive(Copy, Clone)]
 pub struct OptimizationDiagnostic {
     pub kind: OptimizationDiagnosticKind,
diff --git a/src/test/compile-fail/lint-raw-ptr-derive.rs b/src/test/compile-fail/lint-raw-ptr-derive.rs
deleted file mode 100644
index 4320b3e7441..00000000000
--- a/src/test/compile-fail/lint-raw-ptr-derive.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2013 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-#![deny(raw_pointer_derive)]
-
-#[derive(Clone)]
-struct Foo {
-    x: *const isize //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-#[derive(Clone)]
-struct Bar(*mut isize); //~ ERROR use of `#[derive]` with a raw pointer
-
-#[derive(Clone)]
-enum Baz {
-    A(*const isize), //~ ERROR use of `#[derive]` with a raw pointer
-    B { x: *mut isize } //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-#[derive(Clone)]
-struct Buzz {
-    x: (*const isize, //~ ERROR use of `#[derive]` with a raw pointer
-        *const usize) //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-fn main() {}
diff --git a/src/test/run-pass/issue-21296.rs b/src/test/run-pass/issue-21296.rs
deleted file mode 100644
index 5e2ac61caa2..00000000000
--- a/src/test/run-pass/issue-21296.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// pretty-expanded FIXME #23616
-
-#[forbid(raw_pointer_derive)]
-#[derive(Copy)]
-struct Test(*const i32);
-
-impl Clone for Test {
-    fn clone(&self) -> Test { *self }
-}
-
-fn main() {}