-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code:
struct Runner;
type RuntimeImpl = Runner;
trait Runtime {
fn run(&mut self);
}
impl Runtime for &mut RuntimeImpl {
fn run(&mut self) { }
}
fn main() {
let mut runner = Runner;
(&mut runner).run();
}
takes the warning:
Compiling playground v0.0.1 (/playground)
warning: type alias is never used: `RuntimeImpl`
--> src/main.rs:3:1
|
3 | type RuntimeImpl = Runner;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
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
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.