-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unused warning for type alias doesn't take into account inherent impls. #47131
Comments
This looks like a similar case: type aliases used for trait bounds on inherent impl are not considered used: playground #![deny(warnings)]
type FooBar<F> = <F as Foo>::Bar;
trait Foo {
type Bar;
}
struct Blop<F>(F);
impl<F: Foo> Blop<F>
where
FooBar<F>: Clone,
{
}
impl Foo for () {
type Bar = ();
}
fn main() {
let _ = Blop(());
} |
Additional example: type Inner = Box<i32>;
struct Wrapper(Inner);
fn main() {
Wrapper(Box::new(42));
}
Rust 1.32.0 |
Visit `ImplItem` in `dead_code` lint Fixes rust-lang#47131.
Hello, I'm still having this issue on rustc 1.39.0 (4560ea7 2019-11-04), how can I know when this will be released ? Thanks a lot ! |
Please provide a minimized example that demonstrates the problem. |
Here's a link to the playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=064177eade4f98748bacce0167eb354b
|
Further reduced: trait Trait<S> {}
type Alias = ();
trait Trait2 {
type Type: Trait<Alias>;
}
/cc @varkor — should we reopen or create a new issue? |
This isn't the same as the original issue, so let's open a new one (there are already related issues, so it might be worth checking if this is already open elsewhere). |
Do you think it's the same as #59333 ? |
@Elrendio: that's the one I was thinking of, thanks. I've added your example there — I think they probably are the same bug (but if not, we can split out another issue then). |
The following code (playground):
results in the warning:
This is incorrect, since the
Foo
impl uses it (and it can be unwieldy to write it out otherwise).The text was updated successfully, but these errors were encountered: