Skip to content

missing_trait_methods should ignore unstable trait methods #17307

Description

@LebedevRI

Summary

Currently, when running clippy on a code with MSRV of 1.96,
with a rust beta version, clippy's missing_trait_methods
notes that pin_drop is not implemented.

Of course, this diagnostic can be silenced with allow(),
but expect() is recommended, and then clippy will complain
when run on the rust stable version...

As per rust-lang/rust#158406, this is something that clippy should be smarter about.
It is possible that some other currently-MSRV-aware lints should also ignore unstable features.

Lint Name

missing_trait_methods

Reproducer

I tried this code:

struct S {}

#[warn(clippy::missing_trait_methods)]
impl Drop for S {
    fn drop(&mut self) {
    }
}

I saw this happen:

warning: missing trait method provided by default: `pin_drop`
 --> <source>:4:1
  |
4 | impl Drop for S {
  | ^^^^^^^^^^^^^^^
  |
  = help: implement the missing `pin_drop` method of the `Drop` trait
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#missing_trait_methods
note: the lint level is defined here
 --> <source>:3:8
  |
3 | #[warn(clippy::missing_trait_methods)]
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I expected to see this happen:
no-warning

Version

rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: x86_64-unknown-linux-gnu
release: 1.96.0
LLVM version: 22.1.2

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions