mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-19 19:42:19 +02:00
Update MSRV to 1.75
This commit is contained in:
parent
56d9778179
commit
ee87aebc79
2
.github/workflows/build_and_test.yml
vendored
2
.github/workflows/build_and_test.yml
vendored
@ -9,7 +9,7 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
NDK_VERSION: 27.0.12077973
|
||||
RUST_BACKTRACE: 1
|
||||
LIBSIGNAL_MINIMUM_SUPPORTED_RUST_VERSION: 1.72
|
||||
LIBSIGNAL_MINIMUM_SUPPORTED_RUST_VERSION: 1.75
|
||||
# For dev builds, include limited debug info in the output. See
|
||||
# https://doc.rust-lang.org/cargo/reference/profiles.html#debug
|
||||
CARGO_PROFILE_DEV_DEBUG: limited
|
||||
|
@ -1451,10 +1451,7 @@ where
|
||||
let parallelism = std::thread::available_parallelism()
|
||||
.map(usize::from)
|
||||
.unwrap_or(1);
|
||||
let chunk_size = std::cmp::max(
|
||||
6,
|
||||
crate::utils::div_ceil(identity_keys_and_ranges.len(), parallelism),
|
||||
);
|
||||
let chunk_size = std::cmp::max(6, identity_keys_and_ranges.len().div_ceil(parallelism));
|
||||
|
||||
if parallelism == 1 || chunk_size >= identity_keys_and_ranges.len() {
|
||||
process_chunk(&mut serialized, &identity_keys_and_ranges)?;
|
||||
|
@ -4,7 +4,6 @@
|
||||
//
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::ops::{Add, Div, Rem};
|
||||
|
||||
fn expand_top_bit(a: u8) -> u8 {
|
||||
//if (a >> 7) == 1 { 0xFF } else { 0 }
|
||||
@ -82,24 +81,6 @@ pub(crate) fn constant_time_cmp(x: &[u8], y: &[u8]) -> Ordering {
|
||||
}
|
||||
}
|
||||
|
||||
// To be replaced by 1.73's div_ceil when we update our MSRV.
|
||||
#[inline]
|
||||
pub(crate) fn div_ceil<
|
||||
T: Copy + Div<Output = T> + Rem<Output = T> + Add<Output = T> + Ord + From<u8>,
|
||||
>(
|
||||
dividend: T,
|
||||
divisor: T,
|
||||
) -> T {
|
||||
// From the std implementation of div_ceil.
|
||||
let q = dividend / divisor;
|
||||
let r = dividend % divisor;
|
||||
if (r > 0u8.into() && divisor > 0u8.into()) || (r < 0u8.into() && divisor < 0u8.into()) {
|
||||
q + 1u8.into()
|
||||
} else {
|
||||
q
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@ -157,30 +138,4 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_div_ceil() {
|
||||
assert_eq!(div_ceil(0_usize, 4), 0);
|
||||
assert_eq!(div_ceil(7_usize, 4), 2);
|
||||
assert_eq!(div_ceil(8_usize, 4), 2);
|
||||
assert_eq!(div_ceil(9_usize, 4), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_div_ceil_panic() {
|
||||
_ = div_ceil(4_usize, 0);
|
||||
}
|
||||
|
||||
// From https://doc.rust-lang.org/std/primitive.isize.html#method.div_ceil
|
||||
#[test]
|
||||
fn test_div_ceil_isize() {
|
||||
let a: isize = 8;
|
||||
let b = 3;
|
||||
|
||||
assert_eq!(div_ceil(a, b), 3);
|
||||
assert_eq!(div_ceil(a, -b), -2);
|
||||
assert_eq!(div_ceil(-a, b), -2);
|
||||
assert_eq!(div_ceil(-a, -b), 3);
|
||||
}
|
||||
}
|
||||
|
@ -52,8 +52,7 @@ fn arr_xor(from: &[u8], into: &mut [u8]) {
|
||||
pub struct Query4 {}
|
||||
|
||||
impl Query4 {
|
||||
// Using `impl Iterator<...>` makes libsignal-net fail to build in Rust 1.72
|
||||
pub fn requests() -> std::iter::Repeat<Vec<u8>> {
|
||||
pub fn requests() -> impl Iterator<Item = Vec<u8>> {
|
||||
std::iter::repeat(
|
||||
svr4::Request4 {
|
||||
inner: Some(svr4::request4::Inner::Query(svr4::request4::Query {})),
|
||||
@ -85,8 +84,7 @@ impl Query4 {
|
||||
pub struct Remove4 {}
|
||||
|
||||
impl Remove4 {
|
||||
// Using `impl Iterator<...>` makes libsignal-net fail to build in Rust 1.72
|
||||
pub fn requests() -> std::iter::Repeat<Vec<u8>> {
|
||||
pub fn requests() -> impl Iterator<Item = Vec<u8>> {
|
||||
std::iter::repeat(
|
||||
svr4::Request4 {
|
||||
inner: Some(svr4::request4::Inner::Remove(svr4::request4::Remove {})),
|
||||
|
Loading…
Reference in New Issue
Block a user