Skip to content

Traits allow unused generic parameters #37496

Closed
@steveklabnik

Description

@steveklabnik

Consider this trait:

trait Foo<'a> {
  fn foo(x: i32, y: i32) -> i32;
}

rustc will happily let this compile, even though 'a is never used for anything. The same goes for type parameters. This feels incorrect to me, though I might be wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-trait-systemArea: Trait systemA-type-systemArea: Type systemT-langRelevant to the language 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