diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2018-05-25 10:37:38 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2018-05-28 19:47:03 -0400 |
| commit | b5018de0ed3f5f7e56832a22f3e488c5198b11db (patch) | |
| tree | 86c8ce2fc4b468a8168e4c5b3210e32ee34a3476 | |
| parent | 9c5a45044af4dd6b7d539b57be120ef158da9c84 (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.rs | 4 |
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 } } |
