Skip to content

Commit

Permalink
Rollup merge of rust-lang#126157 - RalfJung:scalar-i128, r=compiler-e…
Browse files Browse the repository at this point in the history
…rrors

add missing Scalar::from_i128

We seem to have `from` methods for all primitive types except `i128`... let's complete the set of methods. (This came up in rust-lang/miri#3622.)
  • Loading branch information
matthiaskrgr committed Jun 8, 2024
2 parents ea26e7b + e26e42f commit 7fd9b1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ impl<Prov> Scalar<Prov> {
Self::from_int(i, Size::from_bits(64))
}

#[inline]
pub fn from_i128(i: i128) -> Self {
Self::from_int(i, Size::from_bits(128))
}

#[inline]
pub fn from_target_isize(i: i64, cx: &impl HasDataLayout) -> Self {
Self::from_int(i, cx.data_layout().pointer_size)
Expand Down

0 comments on commit 7fd9b1f

Please sign in to comment.