mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
test(versionable): test bounds visibility in the generated code
This commit is contained in:
committed by
Nicolas Sarlin
parent
bce5cd3552
commit
3ff81c3c4b
44
utils/tfhe-versionable/tests/bounds_private_in_public.rs
Normal file
44
utils/tfhe-versionable/tests/bounds_private_in_public.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
//! This test checks that the bounds added by the proc macro does not prevent the code to
|
||||
//! compile by leaking a private type
|
||||
use tfhe_versionable::Versionize;
|
||||
|
||||
mod mymod {
|
||||
use tfhe_versionable::{Versionize, VersionsDispatch};
|
||||
|
||||
#[derive(Versionize)]
|
||||
#[versionize(PublicVersions)]
|
||||
pub struct Public<T> {
|
||||
private: Private<T>,
|
||||
}
|
||||
|
||||
impl Public<u64> {
|
||||
pub fn new(val: u64) -> Self {
|
||||
Self {
|
||||
private: Private(val),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
#[allow(unused)]
|
||||
pub enum PublicVersions<T> {
|
||||
V0(Public<T>),
|
||||
}
|
||||
|
||||
#[derive(Versionize)]
|
||||
#[versionize(PrivateVersions)]
|
||||
struct Private<T>(T);
|
||||
|
||||
#[derive(VersionsDispatch)]
|
||||
#[allow(dead_code)]
|
||||
enum PrivateVersions<T> {
|
||||
V0(Private<T>),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bounds_private_in_public() {
|
||||
let public = mymod::Public::new(42);
|
||||
|
||||
let _vers = public.versionize();
|
||||
}
|
||||
Reference in New Issue
Block a user