Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-05 Thread Zhao Liu
On Thu, Jun 05, 2025 at 12:15:35PM +0200, Paolo Bonzini wrote: > Date: Thu, 5 Jun 2025 12:15:35 +0200 > From: Paolo Bonzini > Subject: [PATCH 06/14] rust: qemu-api: add bindings to Error > X-Mailer: git-send-email 2.49.0 > > Provide an implementation of std::error::Error tha

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-05 Thread Markus Armbruster
Paolo Bonzini writes: > Provide an implementation of std::error::Error that bridges the Rust > anyhow::Error and std::panic::Location types with QEMU's Error*. > > It also has several utility methods, analogous to error_propagate(), > that convert a Result into a return value + Error** pair. One

[PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-05 Thread Paolo Bonzini
Provide an implementation of std::error::Error that bridges the Rust anyhow::Error and std::panic::Location types with QEMU's Error*. It also has several utility methods, analogous to error_propagate(), that convert a Result into a return value + Error** pair. One important difference is that the

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-04 Thread Markus Armbruster
Paolo Bonzini writes: > On 6/4/25 07:01, Markus Armbruster wrote: >> This is what your FOO_or_propagate() functions are for. >> >> The rule glosses over a subtle detail: the difference between >> error_setg() and error_propagate() isn't just create a new error vs. use >> an existing one, namely

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-04 Thread Paolo Bonzini
On 6/4/25 07:01, Markus Armbruster wrote: This is what your FOO_or_propagate() functions are for. The rule glosses over a subtle detail: the difference between error_setg() and error_propagate() isn't just create a new error vs. use an existing one, namely error_setg() makes the precondition vio

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-03 Thread Markus Armbruster
Paolo Bonzini writes: > On 6/3/25 12:32, Markus Armbruster wrote: >>> Then Rust's propagate has the same behavior as C (Of course, here Rust >>> is actually using C's error_propagate, so the two are equivalent.) >> >> *If* we want propagate semantics. I'm not sure we do. > > Yes, we do. This f

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-03 Thread Paolo Bonzini
On 6/2/25 15:18, Markus Armbruster wrote: Paolo Bonzini writes: Provide an implementation of std::error::Error that bridges the Rust anyhow::Error and std::panic::Location types with QEMU's Error*. It also has several utility methods, analogous to error_propagate(), that convert a Result into

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-03 Thread Paolo Bonzini
On 6/3/25 12:32, Markus Armbruster wrote: Then Rust's propagate has the same behavior as C (Of course, here Rust is actually using C's error_propagate, so the two are equivalent.) *If* we want propagate semantics. I'm not sure we do. Yes, we do. This function is used at the Rust-to-C bounda

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-03 Thread Markus Armbruster
Zhao Liu writes: > Markus Armbruster writes: [...] >> Let's examine the other aspect: how exactly "storing" behaves. >> >> error_setg() according to its contract: >> >> If @errp is NULL, the error is ignored. [...] >> >> If @errp is &error_abort, print a suitable message and abort()

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-03 Thread Zhao Liu
> > +/// Equivalent of the C function `error_propagate`. Fill `*errp` > > Uh, is it? Let's see... > > > +/// with the information container in `self` if `errp` is not NULL; > > +/// then consume it. > > +/// > > +/// # Safety > > +/// > > +/// `errp` must be a valid

Re: [PATCH 06/14] rust: qemu-api: add bindings to Error

2025-06-02 Thread Markus Armbruster
Paolo Bonzini writes: > Provide an implementation of std::error::Error that bridges the Rust > anyhow::Error and std::panic::Location types with QEMU's Error*. > It also has several utility methods, analogous to error_propagate(), > that convert a Result into a return value + Error** pair. > > Si

[PATCH 06/14] rust: qemu-api: add bindings to Error

2025-05-30 Thread Paolo Bonzini
Provide an implementation of std::error::Error that bridges the Rust anyhow::Error and std::panic::Location types with QEMU's Error*. It also has several utility methods, analogous to error_propagate(), that convert a Result into a return value + Error** pair. Signed-off-by: Paolo Bonzini --- ru