@@ -24,25 +24,29 @@ impl<Id: FheUintId> Expandable for FheUint<Id> {
2424 Tag :: default ( ) ,
2525 ) )
2626 } else {
27- Err ( crate :: Error :: new ( format ! (
27+ Err ( crate :: error !(
2828 "Tried to expand a FheUint{} while a FheUint{} is stored in this slot" ,
2929 Id :: num_bits( ) ,
3030 stored_num_bits
31- ) ) )
31+ ) )
3232 }
3333 }
3434 DataKind :: Signed ( _) => {
3535 let stored_num_bits = num_bits_of_blocks ( & blocks) as usize ;
36- Err ( crate :: Error :: new ( format ! (
36+ Err ( crate :: error !(
3737 "Tried to expand a FheUint{} while a FheInt{} is stored in this slot" ,
3838 Id :: num_bits( ) ,
3939 stored_num_bits
40- ) ) )
40+ ) )
4141 }
42- DataKind :: Boolean => Err ( crate :: Error :: new ( format ! (
42+ DataKind :: Boolean => Err ( crate :: error !(
4343 "Tried to expand a FheUint{} while a FheBool is stored in this slot" ,
4444 Id :: num_bits( ) ,
45- ) ) ) ,
45+ ) ) ,
46+ DataKind :: String { .. } => Err ( crate :: error!(
47+ "Tried to expand a FheUint{} while a string is stored in this slot" ,
48+ Id :: num_bits( )
49+ ) ) ,
4650 }
4751 }
4852}
@@ -52,11 +56,11 @@ impl<Id: FheIntId> Expandable for FheInt<Id> {
5256 match kind {
5357 DataKind :: Unsigned ( _) => {
5458 let stored_num_bits = num_bits_of_blocks ( & blocks) as usize ;
55- Err ( crate :: Error :: new ( format ! (
59+ Err ( crate :: error !(
5660 "Tried to expand a FheInt{} while a FheUint{} is stored in this slot" ,
5761 Id :: num_bits( ) ,
5862 stored_num_bits
59- ) ) )
63+ ) )
6064 }
6165 DataKind :: Signed ( _) => {
6266 let stored_num_bits = num_bits_of_blocks ( & blocks) as usize ;
@@ -67,17 +71,21 @@ impl<Id: FheIntId> Expandable for FheInt<Id> {
6771 Tag :: default ( ) ,
6872 ) )
6973 } else {
70- Err ( crate :: Error :: new ( format ! (
74+ Err ( crate :: error !(
7175 "Tried to expand a FheInt{} while a FheInt{} is stored in this slot" ,
7276 Id :: num_bits( ) ,
7377 stored_num_bits
74- ) ) )
78+ ) )
7579 }
7680 }
77- DataKind :: Boolean => Err ( crate :: Error :: new ( format ! (
78- "Tried to expand a FheUint {} while a FheBool is stored in this slot" ,
81+ DataKind :: Boolean => Err ( crate :: error !(
82+ "Tried to expand a FheInt {} while a FheBool is stored in this slot" ,
7983 Id :: num_bits( ) ,
80- ) ) ) ,
84+ ) ) ,
85+ DataKind :: String { .. } => Err ( crate :: error!(
86+ "Tried to expand a FheInt{} while a string is stored in this slot" ,
87+ Id :: num_bits( )
88+ ) ) ,
8189 }
8290 }
8391}
@@ -87,15 +95,15 @@ impl Expandable for FheBool {
8795 match kind {
8896 DataKind :: Unsigned ( _) => {
8997 let stored_num_bits = num_bits_of_blocks ( & blocks) as usize ;
90- Err ( crate :: Error :: new ( format ! (
98+ Err ( crate :: error !(
9199 "Tried to expand a FheBool while a FheUint{stored_num_bits} is stored in this slot" ,
92- ) ) )
100+ ) )
93101 }
94102 DataKind :: Signed ( _) => {
95103 let stored_num_bits = num_bits_of_blocks ( & blocks) as usize ;
96- Err ( crate :: Error :: new ( format ! (
104+ Err ( crate :: error !(
97105 "Tried to expand a FheBool while a FheInt{stored_num_bits} is stored in this slot" ,
98- ) ) )
106+ ) )
99107 }
100108 DataKind :: Boolean => {
101109 let mut boolean_block = BooleanBlock :: new_unchecked ( blocks[ 0 ] . clone ( ) ) ;
@@ -105,6 +113,9 @@ impl Expandable for FheBool {
105113 // The expander will be responsible for setting the correct tag
106114 Ok ( Self :: new ( boolean_block, Tag :: default ( ) ) )
107115 }
116+ DataKind :: String { .. } => Err ( crate :: Error :: new (
117+ "Tried to expand a FheBool while a string is stored in this slot" . to_string ( ) ,
118+ ) ) ,
108119 }
109120 }
110121}
0 commit comments