about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-05-25 10:37:38 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-05-28 19:47:03 -0400
commitb5018de0ed3f5f7e56832a22f3e488c5198b11db (patch)
tree86c8ce2fc4b468a8168e4c5b3210e32ee34a3476
parent9c5a45044af4dd6b7d539b57be120ef158da9c84 (diff)
make `shifted_in` and `shifted_out` const fns
Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
-rw-r--r--src/librustc/ty/sty.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 7e45d8a2269..1582481120c 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -1277,7 +1277,7 @@ 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 {
+    pub const fn shifted_in(self, amount: u32) -> DebruijnIndex {
         DebruijnIndex { depth: self.depth + amount }
     }
 
@@ -1290,7 +1290,7 @@ 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 {
+    pub const fn shifted_out(self, amount: u32) -> DebruijnIndex {
         DebruijnIndex { depth: self.depth - amount }
     }