]> git.lizzy.rs Git - rust.git/commitdiff
EnumSet assertion: better error message.
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 6 Nov 2014 23:20:36 +0000 (15:20 -0800)
committerSimon Sapin <simon.sapin@exyr.org>
Fri, 7 Nov 2014 02:16:17 +0000 (18:16 -0800)
src/libcollections/enum_set.rs

index c2c56554f7c0bb44f1ec01a56dee7459dd18bfdd..93dbb7e8b2073b24a86dd5adbc35f8180846f190 100644 (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
 }