-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lightbeam] Refactoring Error handling + remove panicking calls in lightbeam backend #672
[lightbeam] Refactoring Error handling + remove panicking calls in lightbeam backend #672
Conversation
Any ETA for review/merging? |
I guess it is hindersome to review this PR as long as CI fails for it, especially the Lightbeam CI is failing, indicating that something is off. |
CI seems to failed when lightbeam feature is excluded. so it's maybe more related to wasi in that case. For the tests on macos, there is not output, it's strange. |
…_handling_lightbeam
I don't know of any CI bugs but also I am not a wasmtime maintainer - just filed my own first PR here but it passes CI. |
Thanks for your help ;) I've update wasmparser to last version and correct the error due to refactoring of wasmparser in this commit bytecodealliance/wasmparser@8643144 Maybe that's why wasi tests don't pass. |
Nice so everything good ;) |
CI seems to be happy now. |
Yes i'm working on the conflicts right now. |
@Robbepop Everything seems good ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a real code review yet but just ran cargo clippy
on your PR and identified some new warnings that haven't been there before, namely:
warning: redundant clone
--> crates/lightbeam/src/backend.rs:351:62
|
351 | format!("Double-freed register: {}", gpr).to_string(),
| ^^^^^^^^^^^^ help: remove this
|
= note: `#[warn(clippy::redundant_clone)]` on by default
note: this value is dropped without further use
--> crates/lightbeam/src/backend.rs:351:21
|
351 | format!("Double-freed register: {}", gpr).to_string(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
warning: redundant clone
--> crates/lightbeam/src/function_body.rs:468:78
|
468 | ... format!("br_if unimplemented case: {:#?}", other).to_string(),
| ^^^^^^^^^^^^ help: remove this
|
note: this value is dropped without further use
--> crates/lightbeam/src/function_body.rs:468:29
|
468 | ... format!("br_if unimplemented case: {:#?}", other).to_string(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
warning: passing a unit value to a function
--> crates/lightbeam/src/function_body.rs:399:86
|
399 | | (ref mut other @ (None, _), (Some(Left(ref cc)), _)) => Ok({
| ______________________________________________________________________________________^
400 | | let mut cc = ctx.serialize_block_args(cc, max_params)?;
401 | | if let Some(to_drop) = other.1 {
402 | | drop_elements(&mut cc.arguments, to_drop.clone());
403 | | }
404 | | *other.0 = Some(Left(cc));
405 | | }),
| |_________________________^
|
= note: `#[warn(clippy::unit_arg)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: if you intended to pass a unit value, use a unit literal instead
|
399 | | (ref mut other @ (None, _), (Some(Left(ref cc)), _)) => Ok(()),
| ^^
@alexcrichton @sunfishcode seems that the CI for .NET bindings can't start properly. Can you restart the CI? |
Ok, I've now clicked the button to re-run the tests. |
@sunfishcode Thx, everything seems good now. |
Could you switch to using proper error types please? Here's a good overview of crates in the ecosystem to define error types https://users.rust-lang.org/t/the-state-of-error-handling-in-the-2018-edition/23263 Apart from that this seems good and ready to merge. EDIT: I thought that I'd mentioned this in the review but my comments were still pending. Sorry! Basically, I mean that the error type in a lot of this code is essentially |
We discuss about error types with @Vurich, and it seems better to merge the current pull request and then create a new one only for error types uniformisation. |
Hi guys,
I triggered some new bugs during fuzzing of lightbeam. Those bugs are mainly related to usage of unreachable! and expect.
I remove a lot of the panic!, assert!, expect, etc. from
backend.rs
andfunction_body.rs
. Removing all those calls make me refactoring completely the Error handling ofbackend.rs
as well as some modification infunction_body.rs
i.e. that's why it's a huge PR.Related bugs:
This code has been successfully tested with:
cargo test --release --features lightbeam