about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-09-07 15:28:23 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-09-11 11:25:28 +0200
commit06a041cbd399dc641cadef2bc22c6e519b01856e (patch)
tree877ed7346b700140688c791818a1eb38f6a41d02 /src/librustc_data_structures
parentd272e2f6e2e40dadcc68a0f4be5a4145e3d6a006 (diff)
downloadrust-06a041cbd399dc641cadef2bc22c6e519b01856e.tar.gz
rust-06a041cbd399dc641cadef2bc22c6e519b01856e.zip
Forbid the upper indices of `IndexVec` indices to allow for niche optimizations
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/indexed_vec.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index 186bc6d43cc..2d1709f2374 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -72,7 +72,7 @@ macro_rules! newtype_index {
         newtype_index!(
             // Leave out derives marker so we can use its absence to ensure it comes first
             @type         [$name]
-            @max          [::std::u32::MAX - 1]
+            @max          [0xFFFF_FFFE]
             @vis          [$v]
             @debug_format ["{}"]);
     );
@@ -82,7 +82,7 @@ macro_rules! newtype_index {
         newtype_index!(
             // Leave out derives marker so we can use its absence to ensure it comes first
             @type         [$name]
-            @max          [::std::u32::MAX - 1]
+            @max          [0xFFFF_FFFE]
             @vis          [$v]
             @debug_format ["{}"]
                           $($tokens)+);
@@ -97,6 +97,7 @@ macro_rules! newtype_index {
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]) => (
         #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
+        #[rustc_layout_scalar_range_end($max)]
         $v struct $type {
             private: u32
         }