From 8a13ceb360a1ae577dfe2ff4a7feb65b6126e9b5 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 8 Feb 2019 19:57:02 -0800 Subject: [PATCH 1/2] Deprecate lints checking for Debug or Copy impls These lints are now implemented in Clippy and those should be used instead. --- .../src/lints/listing/allowed-by-default.md | 47 +------------------ src/librustc_lint/builtin.rs | 4 +- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/doc/rustc/src/lints/listing/allowed-by-default.md b/src/doc/rustc/src/lints/listing/allowed-by-default.md index 7768b41f85ee4..735c6be152b74 100644 --- a/src/doc/rustc/src/lints/listing/allowed-by-default.md +++ b/src/doc/rustc/src/lints/listing/allowed-by-default.md @@ -126,54 +126,11 @@ Lifetime elision elides this lifetime, but that is being deprecated. ## missing-copy-implementations -This lint detects potentially-forgotten implementations of `Copy`. Some -example code that triggers this lint: - -```rust -pub struct Foo { - pub field: i32 -} -``` - -When set to 'deny', this will produce: - -```text -error: type could implement `Copy`; consider adding `impl Copy` - --> src/main.rs:3:1 - | -3 | / pub struct Foo { //~ ERROR type could implement `Copy`; consider adding `impl Copy` -4 | | pub field: i32 -5 | | } - | |_^ - | -``` - -You can fix the lint by deriving `Copy`. - -This lint is set to 'allow' because this code isn't bad; it's common to write -newtypes like this specifically so that a `Copy` type is no longer `Copy`. +This lint is deprecated and no longer used. ## missing-debug-implementations -This lint detects missing implementations of `fmt::Debug`. Some example code -that triggers this lint: - -```rust -pub struct Foo; -``` - -When set to 'deny', this will produce: - -```text -error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation - --> src/main.rs:3:1 - | -3 | pub struct Foo; - | ^^^^^^^^^^^^^^^ - | -``` - -You can fix the lint by deriving `Debug`. +This lint is deprecated and no longer used. ## missing-docs diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 46e784c4099c8..2da00e73c3c89 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -532,7 +532,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { declare_lint! { pub MISSING_COPY_IMPLEMENTATIONS, Allow, - "detects potentially-forgotten implementations of `Copy`" + "detects potentially-forgotten implementations of `Copy` (deprecated, do not use)" } #[derive(Copy, Clone)] @@ -596,7 +596,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations { declare_lint! { MISSING_DEBUG_IMPLEMENTATIONS, Allow, - "detects missing implementations of fmt::Debug" + "detects missing implementations of fmt::Debug (deprecated, do not use)" } pub struct MissingDebugImplementations { From f10126c417780524c132834a17cb6c01b4e9ac80 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 8 Feb 2019 21:36:13 -0800 Subject: [PATCH 2/2] Add Default, Display, and Hash as lang_items --- src/librustc/middle/lang_items.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 87107f727a05d..d8c87c798cd73 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -377,6 +377,10 @@ language_item_table! { Arc, "arc", arc, Target::Struct; Rc, "rc", rc, Target::Struct; + + DefaultTraitLangItem, "default", default_trait, Target::Trait; + DisplayTraitLangItem, "display", display_trait, Target::Trait; + HashTraitLangItem, "hash", hash_trait, Target::Trait; } impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> {