Skip to content

Commit 1a6b111

Browse files
authored
fix: type declaration order, typo, and improve variable clarity
1 parent 2308caf commit 1a6b111

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

halo2_proofs/src/plonk/error.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,48 @@ use std::io;
55
use super::TableColumn;
66
use super::{Any, Column};
77

8+
/// This is an error that could occur during table synthesis.
9+
#[derive(Debug)]
10+
pub enum TableError {
11+
/// A `TableColumn` has not been assigned.
12+
ColumnNotAssigned(TableColumn),
13+
/// A Table has columns of uneven lengths.
14+
UnevenColumnLengths((TableColumn, usize), (TableColumn, usize)),
15+
/// Attempt to assign a used `TableColumn`
16+
UsedColumn(TableColumn),
17+
/// Attempt to overwrite a default value
18+
OverwriteDefault(TableColumn, String, String),
19+
}
20+
21+
impl fmt::Display for TableError {
22+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23+
match self {
24+
TableError::ColumnNotAssigned(col) => {
25+
write!(
26+
f,
27+
"{:?} not fully assigned. Help: assign a value at offset 0.",
28+
col
29+
)
30+
}
31+
TableError::UnevenColumnLengths((col, col_len), (col2, col2_len)) => write!(
32+
f,
33+
"{:?} has length {} while {:?} has length {}",
34+
col, col_len, col2, col2_len
35+
),
36+
TableError::UsedColumn(col) => {
37+
write!(f, "{:?} has already been used", col)
38+
}
39+
TableError::OverwriteDefault(col, default, val) => {
40+
write!(
41+
f,
42+
"Attempted to overwrite default value {} with {} in {:?}",
43+
default, val, col
44+
)
45+
}
46+
}
47+
}
48+
}
49+
850
/// This is an error that could occur during proving or circuit synthesis.
951
// TODO: these errors need to be cleaned up
1052
#[non_exhaustive]
@@ -81,7 +123,7 @@ impl fmt::Display for Error {
81123
}
82124
Error::ColumnNotInPermutation(column) => write!(
83125
f,
84-
"Column {:?} must be included in the permutation. Help: try applying `meta.enable_equalty` on the column",
126+
"Column {:?} must be included in the permutation. Help: try applying `meta.enable_equality` on the column",
85127
column
86128
),
87129
Error::TableError(error) => write!(f, "{}", error),
@@ -101,45 +143,3 @@ impl error::Error for Error {
101143
}
102144
}
103145
}
104-
105-
/// This is an error that could occur during table synthesis.
106-
#[derive(Debug)]
107-
pub enum TableError {
108-
/// A `TableColumn` has not been assigned.
109-
ColumnNotAssigned(TableColumn),
110-
/// A Table has columns of uneven lengths.
111-
UnevenColumnLengths((TableColumn, usize), (TableColumn, usize)),
112-
/// Attempt to assign a used `TableColumn`
113-
UsedColumn(TableColumn),
114-
/// Attempt to overwrite a default value
115-
OverwriteDefault(TableColumn, String, String),
116-
}
117-
118-
impl fmt::Display for TableError {
119-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
120-
match self {
121-
TableError::ColumnNotAssigned(col) => {
122-
write!(
123-
f,
124-
"{:?} not fully assigned. Help: assign a value at offset 0.",
125-
col
126-
)
127-
}
128-
TableError::UnevenColumnLengths((col, col_len), (table, table_len)) => write!(
129-
f,
130-
"{:?} has length {} while {:?} has length {}",
131-
col, col_len, table, table_len
132-
),
133-
TableError::UsedColumn(col) => {
134-
write!(f, "{:?} has already been used", col)
135-
}
136-
TableError::OverwriteDefault(col, default, val) => {
137-
write!(
138-
f,
139-
"Attempted to overwrite default value {} with {} in {:?}",
140-
default, val, col
141-
)
142-
}
143-
}
144-
}
145-
}

0 commit comments

Comments
 (0)