Rollup merge of #126157 - RalfJung:scalar-i128, r=compiler-errors

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 https://github.com/rust-lang/miri/pull/3622.)
This commit is contained in:
Matthias Krüger 2024-06-08 18:38:00 +02:00 committed by GitHub
commit 7fd9b1ffd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -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)