File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,23 @@ pub trait PreludeCodegen: Clone {
149
149
emit_libc_abort ( ctx)
150
150
}
151
151
152
+ /// Emit instructions to halt execution with the error `err`.
153
+ ///
154
+ /// The type of `err` must match that returned from [Self::error_type].
155
+ ///
156
+ /// The default implementation emits calls to libc's `printf` and `abort`,
157
+ /// matching the default implementation of [Self::emit_panic].
158
+ ///
159
+ /// Note that implementations of `emit_panic` must not emit `unreachable`
160
+ /// terminators, that, if appropriate, is the responsibility of the caller.
161
+ fn emit_exit < H : HugrView < Node = Node > > (
162
+ & self ,
163
+ ctx : & mut EmitFuncContext < H > ,
164
+ err : BasicValueEnum ,
165
+ ) -> Result < ( ) > {
166
+ self . emit_panic ( ctx, err)
167
+ }
168
+
152
169
/// Emit instructions to materialise an LLVM value representing `str`.
153
170
///
154
171
/// The type of the returned value must match [Self::string_type].
@@ -351,7 +368,7 @@ pub fn add_prelude_extensions<'a, H: HugrView<Node = Node> + 'a>(
351
368
. error_type( & context. typing_session( ) ) ?
352
369
. as_basic_type_enum( )
353
370
) ;
354
- pcg. emit_panic ( context, err) ?;
371
+ pcg. emit_exit ( context, err) ?;
355
372
let returns = args
356
373
. outputs
357
374
. get_types ( )
You can’t perform that action at this time.
0 commit comments