Skip to content

Spurious dead_code warning when type is only used in path #23808

Closed
@apasel422

Description

@apasel422

foo.rs:

trait Bar {
    fn bar() {}
}

enum Foo {}

impl Bar for Foo {}

fn main() {
    Foo::bar();
}

Warning:

> rustc --version
rustc 1.0.0-nightly (199bdcfef 2015-03-26) (built 2015-03-27)
> rustc foo.rs 
foo.rs:5:1: 5:12 warning: enum is never used: `Foo`, #[warn(dead_code)] on by default
foo.rs:5 enum Foo {}
         ^~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.L-dead_codeLint: dead_codeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions