Skip to content
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

Rust 1.77 toolchain - Fix alignment and layout for z_owned_reply_t #295

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ typedef struct z_owned_closure_query_t {
* To check if `val` is still valid, you may use `z_X_check(&val)` (or `z_check(val)` if your compiler supports `_Generic`), which will return `true` if `val` is valid.
*/
#if defined(TARGET_ARCH_X86_64)
typedef struct ALIGN(8) z_owned_reply_t {
uint64_t _0[28];
typedef struct ALIGN(16) z_owned_reply_t {
uint64_t _0[30];
} z_owned_reply_t;
#endif
#if defined(TARGET_ARCH_AARCH64)
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.72.0"
channel = "1.77.0"
4 changes: 2 additions & 2 deletions src/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ type ReplyInner = Option<Reply>;
///
/// To check if `val` is still valid, you may use `z_X_check(&val)` (or `z_check(val)` if your compiler supports `_Generic`), which will return `true` if `val` is valid.
#[cfg(target_arch = "x86_64")]
#[repr(C, align(8))]
pub struct z_owned_reply_t([u64; 28]);
#[repr(C, align(16))]
pub struct z_owned_reply_t([u64; 30]);

#[cfg(target_arch = "aarch64")]
#[repr(C, align(16))]
Expand Down
6 changes: 3 additions & 3 deletions src/liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub extern "C" fn zc_liveliness_declare_subscriber(
return z_owned_subscriber_t::null();
};
let callback = core::mem::replace(callback, z_owned_closure_sample_t::empty());
match session
let res = session
.liveliness()
.declare_subscriber(key)
.callback(move |sample| {
Expand All @@ -185,8 +185,8 @@ pub extern "C" fn zc_liveliness_declare_subscriber(
let sample = z_sample_t::new(&sample, &owner);
z_closure_sample_call(&callback, &sample)
})
.res()
{
.res();
match res {
Ok(token) => z_owned_subscriber_t::new(token),
Err(e) => {
log::error!("Failed to subscribe to liveliness: {e}");
Expand Down
6 changes: 3 additions & 3 deletions src/querying_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber(
.query_timeout(std::time::Duration::from_millis(options.query_timeout_ms));
}
}
match sub
let res = sub
.callback(move |sample| {
let payload = sample.payload.contiguous();
let owner = match payload {
Expand All @@ -212,8 +212,8 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber(
let sample = z_sample_t::new(&sample, &owner);
z_closure_sample_call(&closure, &sample)
})
.res()
{
.res();
match res {
Ok(sub) => ze_owned_querying_subscriber_t::new(sub, session),
Err(e) => {
log::debug!("{}", e);
Expand Down
Loading