Closed
Description
The macro is required, as is that exact order of the bounds, and the use of the repeated bound in the impl
. (It's not specific to Zero
though.)
// compile with --test
use core::num::Zero;
pub struct X<T> {
a: T
}
// reordering these bounds stops the ICE
impl<T: Zero + Eq + Zero>
Zero for X<T> {
fn zero() -> X<T> {
X { a: Zero::zero() }
}
}
macro_rules! constants {
() => {
let _0 : X<int> = Zero::zero();
}
}
fn test_X() {
constants!();
}
RUST_LOG=..
output: https://gist.github.com/huonw/5246555