1
Fork 0

EnumSet assertion: better error message.

This commit is contained in:
Simon Sapin 2014-11-06 15:20:36 -08:00
parent 1fdb759527
commit a22772d6a6

View file

@ -52,8 +52,10 @@ pub trait CLike {
}
fn bit<E:CLike>(e: &E) -> uint {
use core::uint;
let value = e.to_uint();
assert!(value < ::core::uint::BITS);
assert!(value < uint::BITS,
"EnumSet only supports up to {} variants.", uint::BITS - 1);
1 << value
}