about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-09-08 20:17:23 +0200
committerMara Bos <m-ou.se@m-ou.se>2020-09-19 06:50:45 +0200
commit3f68ae47df90d2803c849503a4cbdb2bb3dbb9a6 (patch)
tree8211ee75ea70e69d24b5a15f1af5ce625bb9f7f2 /library/core/src
parenta2c82df1f568cfc8f7469deb46b97c3c861818a0 (diff)
downloadrust-3f68ae47df90d2803c849503a4cbdb2bb3dbb9a6.tar.gz
rust-3f68ae47df90d2803c849503a4cbdb2bb3dbb9a6.zip
Add `BITS` associated constant to all integer types.
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/num/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index 050c187e555..33bcf93676b 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -348,6 +348,10 @@ $EndFeature, "
             pub const MAX: Self = !Self::MIN;
         }
 
+        /// The size of this integer type in bits.
+        #[unstable(feature = "int_bits_const", issue = "none")]
+        pub const BITS: u32 = $BITS;
+
         doc_comment! {
             concat!("Converts a string slice in a given base to an integer.
 
@@ -2601,6 +2605,10 @@ $EndFeature, "
             pub const MAX: Self = !0;
         }
 
+        /// The size of this integer type in bits.
+        #[unstable(feature = "int_bits_const", issue = "none")]
+        pub const BITS: u32 = $BITS;
+
         doc_comment! {
             concat!("Converts a string slice in a given base to an integer.