EnumSet assertion: better error message.
This commit is contained in:
parent
1fdb759527
commit
a22772d6a6
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue