Skip to content

Commit 302cac1

Browse files
authored
Merge 63ae319 into ff8e8b5
2 parents ff8e8b5 + 63ae319 commit 302cac1

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

noir_stdlib/src/lib.nr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ mod runtime;
2828
mod meta;
2929
mod append;
3030
mod mem;
31+
mod panic;
3132

3233
// Oracle calls are required to be wrapped in an unconstrained function
3334
// Thus, the only argument to the `println` oracle is expected to always be an ident

noir_stdlib/src/meta/op.nr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ impl UnaryOp {
3939
} else if self.is_dereference() {
4040
quote { * }
4141
} else {
42-
crate::mem::zeroed()
42+
let op = self;
43+
crate::panic::panic(f"Unexpected unary operator in UnaryOp::quoted: {op}")
4344
}
4445
}
4546
}
@@ -181,7 +182,8 @@ impl BinaryOp {
181182
} else if self.is_modulo() {
182183
quote { % }
183184
} else {
184-
crate::mem::zeroed()
185+
let op = self;
186+
crate::panic::panic(f"Unexpected binary operator in BinaryOp::quoted: {op}")
185187
}
186188
}
187189
}

noir_stdlib/src/panic.nr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub fn panic<T, U, let N: u32>(message: fmtstr<N, T>) -> U {
2+
assert(false, message);
3+
crate::mem::zeroed()
4+
}

noir_stdlib/src/prelude.nr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ pub use crate::cmp::{Eq, Ord};
77
pub use crate::default::Default;
88
pub use crate::convert::{From, Into};
99
pub use crate::meta::{derive, derive_via};
10+
pub use crate::panic::panic;

0 commit comments

Comments
 (0)