2012-11-28 12:34:30 -08:00
|
|
|
use cmp::{Eq, Ord};
|
|
|
|
|
use num::from_int;
|
|
|
|
|
|
2012-12-07 15:09:59 -08:00
|
|
|
pub trait NumExt: Eq Ord Num {}
|
2012-11-28 12:34:30 -08:00
|
|
|
|
|
|
|
|
pub impl f32: NumExt {}
|
|
|
|
|
|
|
|
|
|
fn num_eq_one<T:NumExt>(n: T) { io::println(fmt!("%?", n == from_int(1))) }
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
num_eq_one(1f32); // you need to actually use the function to trigger the ICE
|
|
|
|
|
}
|