mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
gen_wasm: Change some compiler bugs error handling from Result to panic
Result makes sense where I have something meaningful to say to the user like "X is not implemented yet". And also for public functions that may interface with other parts of the project like Backend. But for private functions internal to gen_wasm, it's just unhelpful to get a stack trace to where the Result is unwrapped! I want a stack trace to the root cause. I always end up temporarily rewriting Err("oops") to panic!("oops") and then waiting for it to recompile. This feels like a more balanced approach, using each technique where it makes sense.
This commit is contained in:
parent
a42620ecb5
commit
4aa2452e01
3 changed files with 28 additions and 34 deletions
|
@ -128,7 +128,7 @@ fn copy_memory(
|
|||
size: u32,
|
||||
alignment_bytes: u32,
|
||||
offset: u32,
|
||||
) -> Result<(), String> {
|
||||
) {
|
||||
let alignment_flag = encode_alignment(alignment_bytes);
|
||||
let mut current_offset = offset;
|
||||
while size - current_offset >= 8 {
|
||||
|
@ -152,7 +152,6 @@ fn copy_memory(
|
|||
instructions.push(I32Store8(alignment_flag, current_offset));
|
||||
current_offset += 1;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Round up to alignment_bytes (assumed to be a power of 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue