Skip to content

Commit cc0697e

Browse files
committed
rollup merge of #20511: csouth3/derive-lint
`#[deriving]` has been changed to `#[derive]`, so we should update this lint accordingly so that it remains consistent with the language. Also register the rename with the LintStore. I've changed the one reference to `raw_pointer_deriving` that occurs in the tests (as well as renamed the file appropriately), but the rest of the `raw_pointer_deriving`s in the Rust codebase will need to wait for a snapshot to be changed because stage0 doesn't know about the new lint name. I'll take care of the remaining renaming after the next snapshot. Closes #20498.
2 parents 25d5a3a + 8cebb1f commit cc0697e

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/librustc/lint/builtin.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -546,20 +546,20 @@ impl LintPass for BoxPointers {
546546
}
547547

548548
declare_lint! {
549-
RAW_POINTER_DERIVING,
549+
RAW_POINTER_DERIVE,
550550
Warn,
551551
"uses of #[derive] with raw pointers are rarely correct"
552552
}
553553

554-
struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
554+
struct RawPtrDeriveVisitor<'a, 'tcx: 'a> {
555555
cx: &'a Context<'a, 'tcx>
556556
}
557557

558-
impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
558+
impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDeriveVisitor<'a, 'tcx> {
559559
fn visit_ty(&mut self, ty: &ast::Ty) {
560560
static MSG: &'static str = "use of `#[derive]` with a raw pointer";
561561
if let ast::TyPtr(..) = ty.node {
562-
self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG);
562+
self.cx.span_lint(RAW_POINTER_DERIVE, ty.span, MSG);
563563
}
564564
visit::walk_ty(self, ty);
565565
}
@@ -568,21 +568,21 @@ impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
568568
fn visit_block(&mut self, _: &ast::Block) {}
569569
}
570570

571-
pub struct RawPointerDeriving {
571+
pub struct RawPointerDerive {
572572
checked_raw_pointers: NodeSet,
573573
}
574574

575-
impl RawPointerDeriving {
576-
pub fn new() -> RawPointerDeriving {
577-
RawPointerDeriving {
575+
impl RawPointerDerive {
576+
pub fn new() -> RawPointerDerive {
577+
RawPointerDerive {
578578
checked_raw_pointers: NodeSet::new(),
579579
}
580580
}
581581
}
582582

583-
impl LintPass for RawPointerDeriving {
583+
impl LintPass for RawPointerDerive {
584584
fn get_lints(&self) -> LintArray {
585-
lint_array!(RAW_POINTER_DERIVING)
585+
lint_array!(RAW_POINTER_DERIVE)
586586
}
587587

588588
fn check_item(&mut self, cx: &Context, item: &ast::Item) {
@@ -607,7 +607,7 @@ impl LintPass for RawPointerDeriving {
607607
if !self.checked_raw_pointers.insert(item.id) { return }
608608
match item.node {
609609
ast::ItemStruct(..) | ast::ItemEnum(..) => {
610-
let mut visitor = RawPtrDerivingVisitor { cx: cx };
610+
let mut visitor = RawPtrDeriveVisitor { cx: cx };
611611
visit::walk_item(&mut visitor, &*item);
612612
}
613613
_ => {}

src/librustc/lint/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl LintStore {
208208

209209
add_builtin_with_new!(sess,
210210
TypeLimits,
211-
RawPointerDeriving,
211+
RawPointerDerive,
212212
MissingDoc,
213213
);
214214

@@ -247,6 +247,7 @@ impl LintStore {
247247
self.register_renamed("unknown_crate_type", "unknown_crate_types");
248248
self.register_renamed("variant_size_difference", "variant_size_differences");
249249
self.register_renamed("transmute_fat_ptr", "fat_ptr_transmutes");
250+
self.register_renamed("raw_pointer_deriving", "raw_pointer_derive");
250251

251252
}
252253

src/test/compile-fail/lint-raw-ptr-deriving.rs renamed to src/test/compile-fail/lint-raw-ptr-derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(dead_code)]
12-
#![deny(raw_pointer_deriving)]
12+
#![deny(raw_pointer_derive)]
1313

1414
#[derive(Clone)]
1515
struct Foo {

0 commit comments

Comments
 (0)