Open
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