-
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
Wrong unused warning for type alias #59333
Comments
There is no compilation error if you remove the alias (and of course rename |
@Lonami: If you have to remove the alias and rename the impl, it's wrong to say that the alias was not used in the first place - isn't it? It seems that Rust ignores fact that aliases can have impls and shows the |
@Patryk27 I'm not talking about the warning, which is what the issue is for (and it is a valid issue), I'm talking about:
|
If you remove the alias, there is a compilation error: |
Yeah, I meant the alias is actually used and cannot be removed. |
Related (or possibly the same) problem: #47131 |
So, #59486 will fix part of this issue, which means that if |
Minimised: struct Runner;
type RuntimeImpl = Runner;
trait Runtime {
fn run(&self) {}
}
impl Runtime for RuntimeImpl {}
fn main() {
Runner.run();
} |
A similar issue was encountered in #47131 (comment): trait Trait<S> {}
type Alias = ();
trait Trait2 {
type Type: Trait<Alias>;
} If these are not fixed at the same time, we should open a new issue for the unaddressed test case. |
triage: partially resolved I'm not seeing errors for the original post nor for this example, but 2nd example still generates an incorrect warning. |
This code:
takes the warning:
But removing this alias introduces a compilation error 🤔
The link to the nightly playground example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=22a044608f4d67680bcf1cc7fd23a381
The text was updated successfully, but these errors were encountered: