Skip to content

Commit 0aa7e8a

Browse files
committed
HACK: rust: pin-init: Disable references to previously initialized fields
aop_audio uses pin-init on `#[repr(C, packed)]` embedded into other structs. This fails with "error[E0793]: reference to packed field is unaligned" since packed struct have an alingment of 1 byte. Fixes: 42415d1 ("rust: pin-init: add references to previously initialized fields")
1 parent 957c64f commit 0aa7e8a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rust/pin-init/src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,8 @@ macro_rules! __init_internal {
13531353
// - the field is not structurally pinned, since the line above must compile,
13541354
// - the field has been initialized,
13551355
// - the reference is only valid until the end of the initializer.
1356-
#[allow(unused_variables)]
1357-
let $field = unsafe { &mut (*$slot).$field };
1356+
// #[allow(unused_variables)]
1357+
// let $field = unsafe { &mut (*$slot).$field };
13581358

13591359
// Create the drop guard:
13601360
//
@@ -1395,7 +1395,7 @@ macro_rules! __init_internal {
13951395
// initializer,
13961396
// - the field has been initialized,
13971397
// - the reference is only valid until the end of the initializer.
1398-
let $field = unsafe { &mut (*$slot).$field };
1398+
// let $field = unsafe { &mut (*$slot).$field };
13991399

14001400
// Create the drop guard:
14011401
//

0 commit comments

Comments
 (0)