Skip to content

Warn when a higher-ranked trait bound variable is unused #82998

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

Closed
SNCPlay42 opened this issue Mar 11, 2021 · 2 comments
Closed

Warn when a higher-ranked trait bound variable is unused #82998

SNCPlay42 opened this issue Mar 11, 2021 · 2 comments
Labels
A-lifetimes Area: Lifetimes / regions A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@SNCPlay42
Copy link
Contributor

This use of HRTB currently compiles without any warnings:

pub fn foo<T>() where for<'a> T: Sized {}

It would be helpful for the compiler to warn that the 'a lifetime is unnecessary.

@rustbot label A-lint A-lifetimes C-feature-request

@rustbot rustbot added A-lifetimes Area: Lifetimes / regions A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Mar 11, 2021
@Aaron1011
Copy link
Member

This produces a warning with #![warn(unused_lifetimes)]. See #41960

@Mark-Simulacrum
Copy link
Member

Going to go ahead and close this in favor of #94038 since this is otherwise working as intended (just needs that to be enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

4 participants