about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFabian Drinck <fabian.drinck@rwth-aachen.de>2018-06-15 19:03:36 +0200
committerFabian Drinck <fabian.drinck@rwth-aachen.de>2018-06-15 19:07:16 +0200
commit862d25c89076c5914fa4b8bc17e6b7656799535f (patch)
tree2d284c904b5569b8d0e4d9edfbe11a76d75aad7f
parent8d53b89b66bd4ae765e102afbd4d3a24c12f6c3e (diff)
downloadrust-862d25c89076c5914fa4b8bc17e6b7656799535f.tar.gz
rust-862d25c89076c5914fa4b8bc17e6b7656799535f.zip
Fix compile error
-rw-r--r--src/librustc/ty/sty.rs10
-rw-r--r--src/librustc_driver/test.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 5a54349f6e0..cddf6dc8899 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -1269,8 +1269,8 @@ impl DebruijnIndex {
     ///
     /// you would need to shift the index for `'a` into 1 new binder.
     #[must_use]
-    pub fn shifted_in(self, amount: u32) -> DebruijnIndex {
-        DebruijnIndex::new(self.index() + amount as usize)
+    pub const fn shifted_in(self, amount: u32) -> DebruijnIndex {
+        DebruijnIndex(self.0 + amount)
     }
 
     /// Update this index in place by shifting it "in" through
@@ -1282,8 +1282,8 @@ impl DebruijnIndex {
     /// Returns the resulting index when this value is moved out from
     /// `amount` number of new binders.
     #[must_use]
-    pub fn shifted_out(self, amount: u32) -> DebruijnIndex {
-        DebruijnIndex::new(self.index() - amount as usize)
+    pub const fn shifted_out(self, amount: u32) -> DebruijnIndex {
+        DebruijnIndex(self.0 - amount)
     }
 
     /// Update in place by shifting out from `amount` binders.
@@ -1312,7 +1312,7 @@ impl DebruijnIndex {
     /// bound by one of the binders we are shifting out of, that is an
     /// error (and should fail an assertion failure).
     pub fn shifted_out_to_binder(self, to_binder: DebruijnIndex) -> Self {
-        self.shifted_out((to_binder.index() - INNERMOST.index()) as u32)
+        self.shifted_out((to_binder.0 - INNERMOST.0) as u32)
     }
 }
 
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index f66a4f8a538..d8894722519 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -184,7 +184,7 @@ fn test_env_with_pool<F>(
 }
 
 const D1: ty::DebruijnIndex = ty::INNERMOST;
-const D2: ty::DebruijnIndex = ty::DebruijnIndex(1);
+const D2: ty::DebruijnIndex = D1.shifted_in(1);
 
 impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
     pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> {