You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn main() {
struct Foo<T> { x: T }
type Bar = Foo<u32>;
let spam = |Bar { x }| x != 0;
println!("{}", spam(Foo { x: 10 }));
}
Gives:
warning: type alias is never used: `Bar`
--> ...\test.rs:3:5
|
3 | type Bar = Foo<u32>;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
The text was updated successfully, but these errors were encountered:
kennytm
added
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
labels
Oct 29, 2017
Code in #45614 (comment) and #45614 (comment) looks pretty dead. At least the structure can be considered dead if it is never constructed.
The original example in #45614 (comment) is different - the structure is constructed there and only liveness of the type alias Bar is misinterpreted, not of the structure itself.
Alias should be considered used whenever it's named, not necessarily constructed.
Gives:
The text was updated successfully, but these errors were encountered: