]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #70226 - RalfJung:checked, r=oli-obk
authorDylan DPC <dylan.dpc@gmail.com>
Wed, 25 Mar 2020 18:28:08 +0000 (19:28 +0100)
committerGitHub <noreply@github.com>
Wed, 25 Mar 2020 18:28:08 +0000 (19:28 +0100)
use checked casts and arithmetic in Miri engine

This is unfortunately pretty annoying because we have to cast back and forth between `u64` and `usize` more often that should be necessary, and that cast is considered fallible.

For example, should [this](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/interpret/value/enum.ConstValue.html) really be `usize`?

Also, `LayoutDetails` uses `usize` for field indices, but in Miri we use `u64` to be able to also handle array indexing. Maybe methods like `mplace_field` should be suitably generalized to accept both `u64` and `usize`?

r? @oli-obk Cc @eddyb


Trivial merge