about summary refs log tree commit diff
path: root/library/core/src/num/shells
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2020-09-04 14:00:38 +0000
committerLzu Tao <taolzu@gmail.com>2020-09-19 14:54:20 +0000
commita54584319e746df7a31cdead3deb360d23eeb6a8 (patch)
tree953bdfc01c0c9fe6b18a4f0df816f52afa7f4b7c /library/core/src/num/shells
parent550939f654f08bfb25723f0fb4cbee0871dfb063 (diff)
Move dummy integer modules (like core::u32) to shells dir
Diffstat (limited to 'library/core/src/num/shells')
-rw-r--r--library/core/src/num/shells/i128.rs10
-rw-r--r--library/core/src/num/shells/i16.rs10
-rw-r--r--library/core/src/num/shells/i32.rs10
-rw-r--r--library/core/src/num/shells/i64.rs10
-rw-r--r--library/core/src/num/shells/i8.rs10
-rw-r--r--library/core/src/num/shells/int_macros.rs49
-rw-r--r--library/core/src/num/shells/isize.rs10
-rw-r--r--library/core/src/num/shells/u128.rs9
-rw-r--r--library/core/src/num/shells/u16.rs10
-rw-r--r--library/core/src/num/shells/u32.rs10
-rw-r--r--library/core/src/num/shells/u64.rs10
-rw-r--r--library/core/src/num/shells/u8.rs10
-rw-r--r--library/core/src/num/shells/usize.rs10
13 files changed, 168 insertions, 0 deletions
diff --git a/library/core/src/num/shells/i128.rs b/library/core/src/num/shells/i128.rs
new file mode 100644
index 00000000000..08cb7959468
--- /dev/null
+++ b/library/core/src/num/shells/i128.rs
@@ -0,0 +1,10 @@
+//! The 128-bit signed integer type.
+//!
+//! *[See also the `i128` primitive type](../../std/primitive.i128.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "i128", since = "1.26.0")]
+
+int_module! { i128, #[stable(feature = "i128", since="1.26.0")] }
diff --git a/library/core/src/num/shells/i16.rs b/library/core/src/num/shells/i16.rs
new file mode 100644
index 00000000000..288eaceba59
--- /dev/null
+++ b/library/core/src/num/shells/i16.rs
@@ -0,0 +1,10 @@
+//! The 16-bit signed integer type.
+//!
+//! *[See also the `i16` primitive type](../../std/primitive.i16.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { i16 }
diff --git a/library/core/src/num/shells/i32.rs b/library/core/src/num/shells/i32.rs
new file mode 100644
index 00000000000..0e1a2ec56cc
--- /dev/null
+++ b/library/core/src/num/shells/i32.rs
@@ -0,0 +1,10 @@
+//! The 32-bit signed integer type.
+//!
+//! *[See also the `i32` primitive type](../../std/primitive.i32.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { i32 }
diff --git a/library/core/src/num/shells/i64.rs b/library/core/src/num/shells/i64.rs
new file mode 100644
index 00000000000..27f7092710b
--- /dev/null
+++ b/library/core/src/num/shells/i64.rs
@@ -0,0 +1,10 @@
+//! The 64-bit signed integer type.
+//!
+//! *[See also the `i64` primitive type](../../std/primitive.i64.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { i64 }
diff --git a/library/core/src/num/shells/i8.rs b/library/core/src/num/shells/i8.rs
new file mode 100644
index 00000000000..e84b421e1a4
--- /dev/null
+++ b/library/core/src/num/shells/i8.rs
@@ -0,0 +1,10 @@
+//! The 8-bit signed integer type.
+//!
+//! *[See also the `i8` primitive type](../../std/primitive.i8.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { i8 }
diff --git a/library/core/src/num/shells/int_macros.rs b/library/core/src/num/shells/int_macros.rs
new file mode 100644
index 00000000000..ffd30b03f21
--- /dev/null
+++ b/library/core/src/num/shells/int_macros.rs
@@ -0,0 +1,49 @@
+#![doc(hidden)]
+
+macro_rules! doc_comment {
+    ($x:expr, $($tt:tt)*) => {
+        #[doc = $x]
+        $($tt)*
+    };
+}
+
+macro_rules! int_module {
+    ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
+    ($T:ident, #[$attr:meta]) => (
+        doc_comment! {
+            concat!("The smallest value that can be represented by this integer type.
+Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead.
+
+# Examples
+
+```rust
+// deprecated way
+let min = std::", stringify!($T), "::MIN;
+
+// intended way
+let min = ", stringify!($T), "::MIN;
+```
+"),
+            #[$attr]
+            pub const MIN: $T = $T::MIN;
+        }
+
+        doc_comment! {
+            concat!("The largest value that can be represented by this integer type.
+Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead.
+
+# Examples
+
+```rust
+// deprecated way
+let max = std::", stringify!($T), "::MAX;
+
+// intended way
+let max = ", stringify!($T), "::MAX;
+```
+"),
+            #[$attr]
+            pub const MAX: $T = $T::MAX;
+        }
+    )
+}
diff --git a/library/core/src/num/shells/isize.rs b/library/core/src/num/shells/isize.rs
new file mode 100644
index 00000000000..0dcfa4a2bd1
--- /dev/null
+++ b/library/core/src/num/shells/isize.rs
@@ -0,0 +1,10 @@
+//! The pointer-sized signed integer type.
+//!
+//! *[See also the `isize` primitive type](../../std/primitive.isize.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { isize }
diff --git a/library/core/src/num/shells/u128.rs b/library/core/src/num/shells/u128.rs
new file mode 100644
index 00000000000..dd45ff14153
--- /dev/null
+++ b/library/core/src/num/shells/u128.rs
@@ -0,0 +1,9 @@
+//! The 128-bit unsigned integer type.
+//!
+//! *[See also the `u128` primitive type](../../std/primitive.u128.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "i128", since = "1.26.0")]
+int_module! { u128, #[stable(feature = "i128", since="1.26.0")] }
diff --git a/library/core/src/num/shells/u16.rs b/library/core/src/num/shells/u16.rs
new file mode 100644
index 00000000000..738071643b6
--- /dev/null
+++ b/library/core/src/num/shells/u16.rs
@@ -0,0 +1,10 @@
+//! The 16-bit unsigned integer type.
+//!
+//! *[See also the `u16` primitive type](../../std/primitive.u16.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { u16 }
diff --git a/library/core/src/num/shells/u32.rs b/library/core/src/num/shells/u32.rs
new file mode 100644
index 00000000000..9800c909974
--- /dev/null
+++ b/library/core/src/num/shells/u32.rs
@@ -0,0 +1,10 @@
+//! The 32-bit unsigned integer type.
+//!
+//! *[See also the `u32` primitive type](../../std/primitive.u32.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { u32 }
diff --git a/library/core/src/num/shells/u64.rs b/library/core/src/num/shells/u64.rs
new file mode 100644
index 00000000000..fb686c396f0
--- /dev/null
+++ b/library/core/src/num/shells/u64.rs
@@ -0,0 +1,10 @@
+//! The 64-bit unsigned integer type.
+//!
+//! *[See also the `u64` primitive type](../../std/primitive.u64.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { u64 }
diff --git a/library/core/src/num/shells/u8.rs b/library/core/src/num/shells/u8.rs
new file mode 100644
index 00000000000..c03cbdda25d
--- /dev/null
+++ b/library/core/src/num/shells/u8.rs
@@ -0,0 +1,10 @@
+//! The 8-bit unsigned integer type.
+//!
+//! *[See also the `u8` primitive type](../../std/primitive.u8.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { u8 }
diff --git a/library/core/src/num/shells/usize.rs b/library/core/src/num/shells/usize.rs
new file mode 100644
index 00000000000..a8930416152
--- /dev/null
+++ b/library/core/src/num/shells/usize.rs
@@ -0,0 +1,10 @@
+//! The pointer-sized unsigned integer type.
+//!
+//! *[See also the `usize` primitive type](../../std/primitive.usize.html).*
+//!
+//! Although using these constants won’t cause compilation warnings,
+//! new code should use the associated constants directly on the primitive type.
+
+#![stable(feature = "rust1", since = "1.0.0")]
+
+int_module! { usize }