]> git.lizzy.rs Git - rust.git/commitdiff
Rename `raw_pointer_deriving` lint to `raw_pointer_derive`
authorChase Southwood <chase.southwood@gmail.com>
Sun, 4 Jan 2015 06:09:18 +0000 (00:09 -0600)
committerChase Southwood <chase.southwood@gmail.com>
Sun, 4 Jan 2015 06:39:42 +0000 (00:39 -0600)
Due to the `#[deriving]` -> `#[derive]` switch.

src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/test/compile-fail/lint-raw-ptr-derive.rs [new file with mode: 0644]
src/test/compile-fail/lint-raw-ptr-deriving.rs [deleted file]

index 53249c724627e0839cb5197367d4b38b2f7086d3..e44e3154d3df1e252c7c5d8e2840ac9fc36db1f6 100644 (file)
@@ -550,20 +550,20 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
 }
 
 declare_lint! {
-    RAW_POINTER_DERIVING,
+    RAW_POINTER_DERIVE,
     Warn,
     "uses of #[derive] with raw pointers are rarely correct"
 }
 
-struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
+struct RawPtrDeriveVisitor<'a, 'tcx: 'a> {
     cx: &'a Context<'a, 'tcx>
 }
 
-impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
+impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDeriveVisitor<'a, 'tcx> {
     fn visit_ty(&mut self, ty: &ast::Ty) {
         static MSG: &'static str = "use of `#[derive]` with a raw pointer";
         if let ast::TyPtr(..) = ty.node {
-            self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG);
+            self.cx.span_lint(RAW_POINTER_DERIVE, ty.span, MSG);
         }
         visit::walk_ty(self, ty);
     }
@@ -572,21 +572,21 @@ fn visit_expr(&mut self, _: &ast::Expr) {}
     fn visit_block(&mut self, _: &ast::Block) {}
 }
 
-pub struct RawPointerDeriving {
+pub struct RawPointerDerive {
     checked_raw_pointers: NodeSet,
 }
 
-impl RawPointerDeriving {
-    pub fn new() -> RawPointerDeriving {
-        RawPointerDeriving {
+impl RawPointerDerive {
+    pub fn new() -> RawPointerDerive {
+        RawPointerDerive {
             checked_raw_pointers: NodeSet::new(),
         }
     }
 }
 
-impl LintPass for RawPointerDeriving {
+impl LintPass for RawPointerDerive {
     fn get_lints(&self) -> LintArray {
-        lint_array!(RAW_POINTER_DERIVING)
+        lint_array!(RAW_POINTER_DERIVE)
     }
 
     fn check_item(&mut self, cx: &Context, item: &ast::Item) {
@@ -611,7 +611,7 @@ fn check_item(&mut self, cx: &Context, item: &ast::Item) {
         if !self.checked_raw_pointers.insert(item.id) { return }
         match item.node {
             ast::ItemStruct(..) | ast::ItemEnum(..) => {
-                let mut visitor = RawPtrDerivingVisitor { cx: cx };
+                let mut visitor = RawPtrDeriveVisitor { cx: cx };
                 visit::walk_item(&mut visitor, &*item);
             }
             _ => {}
index ffae485364a8625bbc9d3d22cffda256b3aac743..9cf4ae9d467b0a09d298456b466f56445cb61218 100644 (file)
@@ -208,7 +208,7 @@ macro_rules! add_lint_group ( ( $sess:ident, $name:expr, $($lint:ident),* ) => (
 
         add_builtin_with_new!(sess,
                               TypeLimits,
-                              RawPointerDeriving,
+                              RawPointerDerive,
                               MissingDoc,
         );
 
@@ -247,6 +247,7 @@ macro_rules! add_lint_group ( ( $sess:ident, $name:expr, $($lint:ident),* ) => (
         self.register_renamed("unknown_crate_type", "unknown_crate_types");
         self.register_renamed("variant_size_difference", "variant_size_differences");
         self.register_renamed("transmute_fat_ptr", "fat_ptr_transmutes");
+        self.register_renamed("raw_pointer_deriving", "raw_pointer_derive");
 
     }
 
diff --git a/src/test/compile-fail/lint-raw-ptr-derive.rs b/src/test/compile-fail/lint-raw-ptr-derive.rs
new file mode 100644 (file)
index 0000000..3198e78
--- /dev/null
@@ -0,0 +1,34 @@
+// 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 int //~ ERROR use of `#[derive]` with a raw pointer
+}
+
+#[derive(Clone)]
+struct Bar(*mut int); //~ ERROR use of `#[derive]` with a raw pointer
+
+#[derive(Clone)]
+enum Baz {
+    A(*const int), //~ ERROR use of `#[derive]` with a raw pointer
+    B { x: *mut int } //~ ERROR use of `#[derive]` with a raw pointer
+}
+
+#[derive(Clone)]
+struct Buzz {
+    x: (*const int, //~ ERROR use of `#[derive]` with a raw pointer
+        *const uint) //~ ERROR use of `#[derive]` with a raw pointer
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/lint-raw-ptr-deriving.rs b/src/test/compile-fail/lint-raw-ptr-deriving.rs
deleted file mode 100644 (file)
index 6fe8862..0000000
+++ /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_deriving)]
-
-#[derive(Clone)]
-struct Foo {
-    x: *const int //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-#[derive(Clone)]
-struct Bar(*mut int); //~ ERROR use of `#[derive]` with a raw pointer
-
-#[derive(Clone)]
-enum Baz {
-    A(*const int), //~ ERROR use of `#[derive]` with a raw pointer
-    B { x: *mut int } //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-#[derive(Clone)]
-struct Buzz {
-    x: (*const int, //~ ERROR use of `#[derive]` with a raw pointer
-        *const uint) //~ ERROR use of `#[derive]` with a raw pointer
-}
-
-fn main() {}