Skip to content

Commit

Permalink
Merge 63ae319 into ff8e8b5
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Sep 6, 2024
2 parents ff8e8b5 + 63ae319 commit 302cac1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions noir_stdlib/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mod runtime;
mod meta;
mod append;
mod mem;
mod panic;

// Oracle calls are required to be wrapped in an unconstrained function
// Thus, the only argument to the `println` oracle is expected to always be an ident
Expand Down
6 changes: 4 additions & 2 deletions noir_stdlib/src/meta/op.nr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ impl UnaryOp {
} else if self.is_dereference() {
quote { * }
} else {
crate::mem::zeroed()
let op = self;
crate::panic::panic(f"Unexpected unary operator in UnaryOp::quoted: {op}")
}
}
}
Expand Down Expand Up @@ -181,7 +182,8 @@ impl BinaryOp {
} else if self.is_modulo() {
quote { % }
} else {
crate::mem::zeroed()
let op = self;
crate::panic::panic(f"Unexpected binary operator in BinaryOp::quoted: {op}")
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions noir_stdlib/src/panic.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub fn panic<T, U, let N: u32>(message: fmtstr<N, T>) -> U {
assert(false, message);
crate::mem::zeroed()
}
1 change: 1 addition & 0 deletions noir_stdlib/src/prelude.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pub use crate::cmp::{Eq, Ord};
pub use crate::default::Default;
pub use crate::convert::{From, Into};
pub use crate::meta::{derive, derive_via};
pub use crate::panic::panic;

0 comments on commit 302cac1

Please sign in to comment.