Skip to content

Commit

Permalink
fix(tfhe-lints): linter was not run, missing compile time env var
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Dec 6, 2024
1 parent 3dcf7f2 commit e363b76
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 0 additions & 6 deletions tfhe/src/high_level_api/compressed_ciphertext_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ pub(crate) enum InnerCompressedCiphertextList {
Cuda(crate::integer::gpu::ciphertext::compressed_ciphertext_list::CudaCompressedCiphertextList),
}

#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(tfhe_lints, allow(tfhe_lints::serialize_without_versionize))]
pub(crate) struct InnerCompressedCiphertextListVersionOwned(
<crate::integer::ciphertext::CompressedCiphertextList as VersionizeOwned>::VersionedOwned,
);

impl Versionize for InnerCompressedCiphertextList {
type Versioned<'vers> =
<crate::integer::ciphertext::CompressedCiphertextList as VersionizeOwned>::VersionedOwned;
Expand Down
1 change: 1 addition & 0 deletions tfhe/src/shortint/wopbs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod test;

// Struct for WoPBS based on the private functional packing keyswitch.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(tfhe_lints, allow(tfhe_lints::serialize_without_versionize))]
pub struct WopbsKey {
//Key for the private functional keyswitch
pub wopbs_server_key: ServerKey,
Expand Down
5 changes: 5 additions & 0 deletions utils/cargo-tfhe-lints-inner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ fn main() {
(tool_args.as_slice(), &[] as &[String])
};

// The linter calls rustc without cargo, so these variables won't be set. Since we use them in
// our code, we need to set them to any value to avoid a compilation error.
std::env::set_var("CARGO_PKG_VERSION_MAJOR", "X");
std::env::set_var("CARGO_PKG_VERSION_MINOR", "Y");

rustc_tools::cargo_integration(&cargo_args, |args| {
let mut args = args.to_vec();
args.extend(rustc_args.iter().skip(1).cloned());
Expand Down
18 changes: 15 additions & 3 deletions utils/cargo-tfhe-lints/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::process::{exit, Command};
use std::{
io::{Error, ErrorKind},
process::{exit, Command},
};

fn get_supported_rustc_version() -> &'static str {
const TOOLCHAIN_FILE: &str = include_str!("../../cargo-tfhe-lints-inner/rust-toolchain.toml");
Expand Down Expand Up @@ -26,8 +29,17 @@ fn main() {
.arg(toolchain.as_str())
.arg("tfhe-lints-inner")
.args(&cargo_args)
.spawn()
.and_then(|mut child| child.wait())
.status()
.and_then(|res| {
if !res.success() {
Err(Error::new(
ErrorKind::Other,
format!("Inner process failed with {res}"),
))
} else {
Ok(())
}
})
{
eprintln!(
"Command `cargo {toolchain} tfhe-lints-inner {}` failed: {err:?}",
Expand Down

0 comments on commit e363b76

Please sign in to comment.