From ab43c1e9a43d5c62e0e6ea7442221a2d2f638f7f Mon Sep 17 00:00:00 2001
From: Niko Matsakis <niko@alum.mit.edu>
Date: Thu, 6 Sep 2018 15:33:54 -0400
Subject: [PATCH] add `const_fn` feature

---
 src/librustc_data_structures/indexed_vec.rs | 6 +++---
 src/librustc_mir/lib.rs                     | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index 31dba2c2cdfbe..186bc6d43ccc5 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -136,7 +136,7 @@ macro_rules! newtype_index {
                 ];
 
                 unsafe {
-                    $type::from_u32_unchecked(value)
+                    $type { private: value }
                 }
             }
 
@@ -153,13 +153,13 @@ macro_rules! newtype_index {
 
             /// Extract value of this index as a usize.
             #[inline]
-            $v const fn as_u32(self) -> u32 {
+            $v fn as_u32(self) -> u32 {
                 self.private
             }
 
             /// Extract value of this index as a u32.
             #[inline]
-            $v const fn as_usize(self) -> usize {
+            $v fn as_usize(self) -> usize {
                 self.as_u32() as usize
             }
         }
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index be04f75c7260c..d4024981c3754 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -24,6 +24,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
 #![feature(box_syntax)]
 #![feature(crate_visibility_modifier)]
 #![feature(core_intrinsics)]
+#![feature(const_fn)]
 #![feature(decl_macro)]
 #![cfg_attr(stage0, feature(macro_vis_matcher))]
 #![feature(exhaustive_patterns)]