Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mz/update toolchain #1838

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/src/check_tfhe_docs_are_tested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn check_tfhe_docs_are_tested() -> Result<(), Error> {
.into_iter()
.filter_map(|entry| {
let path = entry.path().canonicalize().ok()?;
if path.is_file() && path.extension().map_or(false, |e| e == "md") {
if path.is_file() && path.extension().is_some_and(|e| e == "md") {
let file_content = std::fs::read_to_string(&path).ok()?;
if file_content.contains("```rust") {
Some(path.to_path_buf())
Expand Down
2 changes: 1 addition & 1 deletion tfhe-fft/src/unordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl Plan {
base_n: usize,
}

impl<'de, 'a> Visitor<'de> for SeqVisitor<'a> {
impl<'de> Visitor<'de> for SeqVisitor<'_> {
type Value = ();

fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ pub struct StandardMultiBitModulusSwitchedCt<
}

impl<
'a,
Scalar: UnsignedInteger + CastInto<usize> + CastFrom<usize>,
C: Container<Element = Scalar> + Sync,
> MultiBitModulusSwitchedCt for StandardMultiBitModulusSwitchedCt<'a, Scalar, C>
> MultiBitModulusSwitchedCt for StandardMultiBitModulusSwitchedCt<'_, Scalar, C>
{
fn lwe_dimension(&self) -> LweDimension {
self.input.lwe_size().to_lwe_dimension()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<C: Container<Element = c64>> PseudoFourierGgswLevelRow<C> {
}
}

impl<'a> PseudoFourierGgswCiphertextView<'a> {
impl PseudoFourierGgswCiphertextView<'_> {
/// Return an iterator over the level matrices.
pub fn into_levels(
self,
Expand Down Expand Up @@ -263,7 +263,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}

impl<'a> PseudoFourierGgswCiphertextMutView<'a> {
impl PseudoFourierGgswCiphertextMutView<'_> {
/// Fill a GGSW ciphertext with the Fourier transform of a GGSW ciphertext in the standard
/// domain.
pub fn fill_with_forward_fourier<
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/core_crypto/fft_impl/fft128/math/fft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ fn convert_backward_torus<Scalar: UnsignedTorus>(
}
}

impl<'a> Fft128View<'a> {
impl Fft128View<'_> {
pub fn polynomial_size(self) -> PolynomialSize {
PolynomialSize(2 * self.plan.fft_size())
}
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/core_crypto/fft_impl/fft128_u128/math/fft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ pub fn convert_add_backward_torus(
);
}

impl<'a> Fft128View<'a> {
impl Fft128View<'_> {
pub fn forward_as_integer_split(
self,
fourier_re0: &mut [f64],
Expand Down
4 changes: 2 additions & 2 deletions tfhe/src/core_crypto/fft_impl/fft64/crypto/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}

impl<'a> FourierLweBootstrapKeyMutView<'a> {
impl FourierLweBootstrapKeyMutView<'_> {
/// Fill a bootstrapping key with the Fourier transform of a bootstrapping key in the standard
/// domain.
pub fn fill_with_forward_fourier<Scalar: UnsignedTorus>(
Expand Down Expand Up @@ -281,7 +281,7 @@ pub fn batch_bootstrap_scratch<Scalar>(
)?)
}

impl<'a> FourierLweBootstrapKeyView<'a> {
impl FourierLweBootstrapKeyView<'_> {
// CastInto required for PBS modulus switch which returns a usize
pub fn blind_rotate_assign<InputScalar, OutputScalar>(
self,
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/core_crypto/fft_impl/fft64/crypto/ggsw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub fn fill_with_forward_fourier_scratch(fft: FftView<'_>) -> Result<StackReq, S
fft.forward_scratch()
}

impl<'a> FourierGgswCiphertextMutView<'a> {
impl FourierGgswCiphertextMutView<'_> {
/// Fill a GGSW ciphertext with the Fourier transform of a GGSW ciphertext in the standard
/// domain.
pub fn fill_with_forward_fourier<Scalar: UnsignedTorus>(
Expand Down
1 change: 1 addition & 0 deletions tfhe/src/core_crypto/fft_impl/fft64/math/decomposition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl<'buffers, Scalar: UnsignedInteger> TensorSignedDecompositionLendingIter<'bu

// inlining this improves perf of external product by about 25%, even in LTO builds
#[inline]
#[allow(clippy::type_complexity)]
pub fn next_term<'short>(
&'short mut self,
) -> Option<(
Expand Down
6 changes: 3 additions & 3 deletions tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ fn convert_add_backward_torus<Scalar: UnsignedTorus>(
convert_add_backward_torus_scalar::<Scalar>(out_re, out_im, inp, twisties);
}

impl<'a> FftView<'a> {
impl FftView<'_> {
/// Return the polynomial size that this FFT was made for.
pub fn polynomial_size(self) -> PolynomialSize {
PolynomialSize(2 * self.plan.fft_size())
Expand Down Expand Up @@ -629,7 +629,7 @@ impl<C: Container<Element = c64>> serde::Serialize for FourierPolynomialList<C>
buf: &'a [c64],
}

impl<'a> serde::Serialize for SingleFourierPolynomial<'a> {
impl serde::Serialize for SingleFourierPolynomial<'_> {
fn serialize<S: serde::Serializer>(
&self,
serializer: S,
Expand Down Expand Up @@ -701,7 +701,7 @@ impl<'de, C: IntoContainerOwned<Element = c64>> serde::Deserialize<'de>
buf: &'a mut [c64],
}

impl<'de, 'a> serde::de::DeserializeSeed<'de> for FillFourier<'a> {
impl<'de> serde::de::DeserializeSeed<'de> for FillFourier<'_> {
type Value = ();

fn deserialize<D: serde::Deserializer<'de>>(
Expand Down
10 changes: 5 additions & 5 deletions tfhe/src/high_level_api/array/cpu/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl ArrayBackend for CpuFheBoolArrayBackend {
type Owned = Vec<BooleanBlock>;
}

impl<'a> BackendDataContainer for &'a [BooleanBlock] {
impl BackendDataContainer for &[BooleanBlock] {
type Backend = CpuFheBoolArrayBackend;

fn len(&self) -> usize {
Expand All @@ -55,7 +55,7 @@ impl<'a> BackendDataContainer for &'a [BooleanBlock] {
}
}

impl<'a> BackendDataContainer for &'a mut [BooleanBlock] {
impl BackendDataContainer for &mut [BooleanBlock] {
type Backend = CpuFheBoolArrayBackend;

fn len(&self) -> usize {
Expand All @@ -74,7 +74,7 @@ impl<'a> BackendDataContainer for &'a mut [BooleanBlock] {
}
}

impl<'a> BackendDataContainerMut for &'a mut [BooleanBlock] {
impl BackendDataContainerMut for &mut [BooleanBlock] {
fn as_sub_slice_mut(
&mut self,
range: impl RangeBounds<usize>,
Expand Down Expand Up @@ -220,7 +220,7 @@ impl FheTryEncrypt<&[bool], ClientKey> for CpuFheBoolArray {
}
}

impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'a> {
impl FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
self.elems
.iter()
Expand All @@ -229,7 +229,7 @@ impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSlice<'a> {
}
}

impl<'a> FheDecrypt<Vec<bool>> for CpuFheBoolSliceMut<'a> {
impl FheDecrypt<Vec<bool>> for CpuFheBoolSliceMut<'_> {
fn decrypt(&self, key: &ClientKey) -> Vec<bool> {
self.as_slice().decrypt(key)
}
Expand Down
26 changes: 13 additions & 13 deletions tfhe/src/high_level_api/array/cpu/integers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ where
}
}

impl<'a, T> BackendDataContainer for &'a [T]
impl<T> BackendDataContainer for &[T]
where
T: IntegerRadixCiphertext,
{
Expand All @@ -389,7 +389,7 @@ where
}
}

impl<'a, T> BackendDataContainer for &'a mut [T]
impl<T> BackendDataContainer for &mut [T]
where
T: IntegerRadixCiphertext,
{
Expand All @@ -411,7 +411,7 @@ where
}
}

impl<'a, T> BackendDataContainerMut for &'a mut [T]
impl<T> BackendDataContainerMut for &mut [T]
where
T: IntegerRadixCiphertext,
{
Expand All @@ -423,14 +423,14 @@ where
}
}

impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
impl<Clear, Id> FheTryEncrypt<&[Clear], ClientKey> for FheArrayBase<Vec<RadixCiphertext>, Id>
where
Id: FheUintId,
Clear: DecomposableInto<u64> + UnsignedNumeric,
{
type Error = Error;

fn try_encrypt(clears: &'a [Clear], key: &ClientKey) -> Result<Self, Self::Error> {
fn try_encrypt(clears: &[Clear], key: &ClientKey) -> Result<Self, Self::Error> {
let num_blocks = Id::num_blocks(key.message_modulus());
Ok(Self::new(
clears
Expand All @@ -443,7 +443,7 @@ where
}
}

impl<'a, Clear, Id> FheTryEncrypt<(&'a [Clear], Vec<usize>), ClientKey>
impl<Clear, Id> FheTryEncrypt<(&[Clear], Vec<usize>), ClientKey>
for FheArrayBase<Vec<RadixCiphertext>, Id>
where
Id: FheUintId,
Expand All @@ -452,7 +452,7 @@ where
type Error = Error;

fn try_encrypt(
(clears, shape): (&'a [Clear], Vec<usize>),
(clears, shape): (&'_ [Clear], Vec<usize>),
key: &ClientKey,
) -> Result<Self, Self::Error> {
if clears.len() != shape.iter().copied().product::<usize>() {
Expand Down Expand Up @@ -481,7 +481,7 @@ where
}
}

impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSliceMut<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
Expand All @@ -491,7 +491,7 @@ where
}
}

impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheUintSlice<'_, Id>
where
Id: FheUintId,
Clear: RecomposableFrom<u64> + UnsignedNumeric,
Expand All @@ -504,14 +504,14 @@ where
}
}

impl<'a, Clear, Id> FheTryEncrypt<&'a [Clear], ClientKey> for CpuFheIntArray<Id>
impl<Clear, Id> FheTryEncrypt<&[Clear], ClientKey> for CpuFheIntArray<Id>
where
Id: FheIntId,
Clear: DecomposableInto<u64> + SignedNumeric,
{
type Error = Error;

fn try_encrypt(clears: &'a [Clear], key: &ClientKey) -> Result<Self, Self::Error> {
fn try_encrypt(clears: &[Clear], key: &ClientKey) -> Result<Self, Self::Error> {
let num_blocks = Id::num_blocks(key.message_modulus());
Ok(Self::new(
clears
Expand All @@ -534,7 +534,7 @@ where
}
}

impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSliceMut<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSliceMut<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,
Expand All @@ -544,7 +544,7 @@ where
}
}

impl<'a, Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSlice<'a, Id>
impl<Clear, Id> FheDecrypt<Vec<Clear>> for CpuFheIntSlice<'_, Id>
where
Id: FheIntId,
Clear: RecomposableSignedInteger,
Expand Down
6 changes: 3 additions & 3 deletions tfhe/src/high_level_api/array/cpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
type Owned = ClearContainer<Vec<T>>;
}

impl<'a, T> BackendDataContainer for ClearContainer<&'a [T]>
impl<T> BackendDataContainer for ClearContainer<&[T]>
where
T: Copy,
{
Expand All @@ -79,7 +79,7 @@ where
}
}

impl<'a, T> BackendDataContainer for ClearContainer<&'a mut [T]>
impl<T> BackendDataContainer for ClearContainer<&mut [T]>
where
T: Copy,
{
Expand All @@ -101,7 +101,7 @@ where
}
}

impl<'a, T> BackendDataContainerMut for ClearContainer<&'a mut [T]>
impl<T> BackendDataContainerMut for ClearContainer<&mut [T]>
where
T: Copy,
{
Expand Down
12 changes: 6 additions & 6 deletions tfhe/src/high_level_api/array/dynamic/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ pub enum InnerBoolSlice<'a> {
Cpu(&'a [BooleanBlock]),
}

impl<'a> InnerBoolSlice<'a> {
impl InnerBoolSlice<'_> {
fn on_cpu(&self) -> Cow<'_, [BooleanBlock]> {
match self {
InnerBoolSlice::Cpu(cpu_slice) => Cow::Borrowed(cpu_slice),
}
}
}

impl<'a> BackendDataContainer for InnerBoolSlice<'a> {
impl BackendDataContainer for InnerBoolSlice<'_> {
type Backend = DynFheBoolArrayBackend;

fn len(&self) -> usize {
Expand Down Expand Up @@ -268,7 +268,7 @@ pub enum InnerBoolSliceMut<'a> {
Cpu(&'a mut [BooleanBlock]),
}

impl<'a> BackendDataContainer for InnerBoolSliceMut<'a> {
impl BackendDataContainer for InnerBoolSliceMut<'_> {
type Backend = DynFheBoolArrayBackend;

fn len(&self) -> usize {
Expand All @@ -295,7 +295,7 @@ impl<'a> BackendDataContainer for InnerBoolSliceMut<'a> {
}
}

impl<'a> BackendDataContainerMut for InnerBoolSliceMut<'a> {
impl BackendDataContainerMut for InnerBoolSliceMut<'_> {
fn as_sub_slice_mut(
&mut self,
range: impl RangeBounds<usize>,
Expand All @@ -308,10 +308,10 @@ impl<'a> BackendDataContainerMut for InnerBoolSliceMut<'a> {
}
}

impl<'a> FheTryEncrypt<&'a [bool], ClientKey> for FheBoolArray {
impl FheTryEncrypt<&[bool], ClientKey> for FheBoolArray {
type Error = crate::Error;

fn try_encrypt(value: &'a [bool], key: &ClientKey) -> Result<Self, Self::Error> {
fn try_encrypt(value: &[bool], key: &ClientKey) -> Result<Self, Self::Error> {
let cpu_array = crate::CpuFheBoolArray::try_encrypt(value, key)?;
let inner = InnerBoolArray::Cpu(cpu_array.into_container());
// TODO move to default device
Expand Down
Loading
Loading