about summary refs log tree commit diff
path: root/src/librustc_const_eval
diff options
context:
space:
mode:
authorJake Goulding <jake.goulding@gmail.com>2016-05-06 09:31:11 -0400
committerJake Goulding <jake.goulding@gmail.com>2016-05-19 13:55:13 -0400
commitbc7595c8abbf4e3b737e926d61814686e0ebda77 (patch)
tree3ead763b6c18622639409543dc3a46ba1e6374c1 /src/librustc_const_eval
parent2fb6f8e2c94a7041877ed8460f2621974c5233f7 (diff)
downloadrust-bc7595c8abbf4e3b737e926d61814686e0ebda77.tar.gz
rust-bc7595c8abbf4e3b737e926d61814686e0ebda77.zip
Support 16-bit pointers as well as i/usize
This is based on the original work of Dylan McKay for the
[avr-rust project][ar].

[ar]: https://github.com/avr-rust/rust
Diffstat (limited to 'src/librustc_const_eval')
-rw-r--r--src/librustc_const_eval/eval.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs
index 9db24fa4770..ad3292489c5 100644
--- a/src/librustc_const_eval/eval.rs
+++ b/src/librustc_const_eval/eval.rs
@@ -584,6 +584,9 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     (&LitKind::Int(n, Unsuffixed), Some(&ty::TyInt(IntTy::Is))) |
                     (&LitKind::Int(n, Signed(IntTy::Is)), _) => {
                         match tcx.sess.target.int_type {
+                            IntTy::I16 => if n == I16_OVERFLOW {
+                                return Ok(Integral(Isize(Is16(::std::i16::MIN))));
+                            },
                             IntTy::I32 => if n == I32_OVERFLOW {
                                 return Ok(Integral(Isize(Is32(::std::i32::MIN))));
                             },