Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing a trait for a type disables dead_code lint. #3567

Closed
charles-r-earp opened this issue Feb 9, 2024 · 2 comments
Closed

Implementing a trait for a type disables dead_code lint. #3567

charles-r-earp opened this issue Feb 9, 2024 · 2 comments

Comments

@charles-r-earp
Copy link

Min example:

trait Zoom {}

struct Foo;
struct Bar;

impl Zoom for Foo {}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f9122e0d0aaecb171c6fded1d8589f19

Warns Bar is unused but not Foo.

Compiling playground v0.0.1 (/playground)
warning: struct `Bar` is never constructed
 --> src/lib.rs:4:8
  |
4 | struct Bar;
  |        ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `playground` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.34s
@charles-r-earp
Copy link
Author

Wrong repo.

@shepmaster
Copy link
Member

This was fixed in rust-lang/rust#118257 available in recent nightly builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants