File tree 1 file changed +44
-0
lines changed
utils/tfhe-versionable/tests 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ //! This test checks that the bounds added by the proc macro does not prevent the code to
2
+ //! compile by leaking a private type
3
+ use tfhe_versionable:: Versionize ;
4
+
5
+ mod mymod {
6
+ use tfhe_versionable:: { Versionize , VersionsDispatch } ;
7
+
8
+ #[ derive( Versionize ) ]
9
+ #[ versionize( PublicVersions ) ]
10
+ pub struct Public < T > {
11
+ private : Private < T > ,
12
+ }
13
+
14
+ impl Public < u64 > {
15
+ pub fn new ( val : u64 ) -> Self {
16
+ Self {
17
+ private : Private ( val) ,
18
+ }
19
+ }
20
+ }
21
+
22
+ #[ derive( VersionsDispatch ) ]
23
+ #[ allow( unused) ]
24
+ pub enum PublicVersions < T > {
25
+ V0 ( Public < T > ) ,
26
+ }
27
+
28
+ #[ derive( Versionize ) ]
29
+ #[ versionize( PrivateVersions ) ]
30
+ struct Private < T > ( T ) ;
31
+
32
+ #[ derive( VersionsDispatch ) ]
33
+ #[ allow( dead_code) ]
34
+ enum PrivateVersions < T > {
35
+ V0 ( Private < T > ) ,
36
+ }
37
+ }
38
+
39
+ #[ test]
40
+ fn bounds_private_in_public ( ) {
41
+ let public = mymod:: Public :: new ( 42 ) ;
42
+
43
+ let _vers = public. versionize ( ) ;
44
+ }
You can’t perform that action at this time.
0 commit comments