summaryrefslogtreecommitdiffstats
path: root/src
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 /src
parentport `fold_regions` and friends to use debruijn indices directly (diff)
downloadgrust-b5018de0ed3f5f7e56832a22f3e488c5198b11db.tar.gz
grust-b5018de0ed3f5f7e56832a22f3e488c5198b11db.tar.bz2
grust-b5018de0ed3f5f7e56832a22f3e488c5198b11db.tar.xz
make `shifted_in` and `shifted_out` const fns
Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
Diffstat (limited to 'src')
-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 7e45d8a226..1582481120 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -1277,7 +1277,7 @@ impl DebruijnIndex {
1277 /// 1277 ///
1278 /// you would need to shift the index for `'a` into 1 new binder. 1278 /// you would need to shift the index for `'a` into 1 new binder.
1279 #[must_use] 1279 #[must_use]
1280 pub fn shifted_in(self, amount: u32) -> DebruijnIndex { 1280 pub const fn shifted_in(self, amount: u32) -> DebruijnIndex {
1281 DebruijnIndex { depth: self.depth + amount } 1281 DebruijnIndex { depth: self.depth + amount }
1282 } 1282 }
1283 1283
@@ -1290,7 +1290,7 @@ impl DebruijnIndex {
1290 /// Returns the resulting index when this value is moved out from 1290 /// Returns the resulting index when this value is moved out from
1291 /// `amount` number of new binders. 1291 /// `amount` number of new binders.
1292 #[must_use] 1292 #[must_use]
1293 pub fn shifted_out(self, amount: u32) -> DebruijnIndex { 1293 pub const fn shifted_out(self, amount: u32) -> DebruijnIndex {
1294 DebruijnIndex { depth: self.depth - amount } 1294 DebruijnIndex { depth: self.depth - amount }
1295 } 1295 }
1296 1296