Closed
Description
It seems that if a const
is only used in impl
s, but not in actual code, then rustc emits a "constant item is never used" warning, as in the following code:
const TLC: uint = 4;
trait Tr { fn doit(&self); }
impl Tr for [uint, ..TLC] {
fn doit(&self) { println!("called 4"); }
}
fn main() {
let s = [0,1,2,3u];
s.doit(); // which .doit is called depends on architecture
}
Which prints (when compiled and then run):
<anon>:1:1: 1:21 warning: constant item is never used: `TLC`, #[warn(dead_code)] on by default
<anon>:1 const TLC: uint = 4;
^~~~~~~~~~~~~~~~~~~~
called 4