There was an error while loading. Please reload this page.
2 parents 7c7ec67 + 8ba038c commit f2667ecCopy full SHA for f2667ec
1 file changed
tests/ui/lint/dead-code/type-alias-used-in-impl-59333.rs
@@ -0,0 +1,34 @@
1
+//@ check-pass
2
+//! Regression test for <https://github.com/rust-lang/rust/issues/59333>.
3
+//! A type alias used only as (part of) the self type of an impl was
4
+//! incorrectly flagged as dead code.
5
+
6
+#![deny(dead_code)]
7
8
+struct Runner;
9
10
+type RuntimeImpl = Runner;
11
12
+trait Runtime {
13
+ fn run(&mut self);
14
+}
15
16
+impl Runtime for &mut RuntimeImpl {
17
+ fn run(&mut self) {}
18
19
20
+struct Walker;
21
22
+type WalkerImpl = Walker;
23
24
+trait Walk {
25
+ fn walk(&self) {}
26
27
28
+impl Walk for WalkerImpl {}
29
30
+fn main() {
31
+ let mut runner = Runner;
32
+ (&mut runner).run();
33
+ Walker.walk();
34
0 commit comments