Skip to content

Fix test failure with rustc 1.47.0 from Bullseye

Ritesh Raj Sarraf requested to merge apertis/v2021-updates into apertis/v2021

On v2021 we updated the rustc compiler to 1.47.0 from Bullseye as it was required elsewhere, but it is causing the librsvg build to fail with:

---- property_bag::tests::property_bag_can_iterate_from_c stdout ----
thread 'property_bag::tests::property_bag_can_iterate_from_c' panicked at 'attempted to leave type `attributes::Attribute` uninitialized, which is invalid', /usr/src/rustc-1.47.0/library/core/src/mem/mod.rs:666:9

Earlier in the log the compiler warns about the relevant code:

warning: the type `attributes::Attribute` does not permit being left uninitialized
   --> rsvg_internals/src/property_bag.rs:276:32
    |
276 |         let mut att = unsafe { mem::uninitialized() };
    |                                ^^^^^^^^^^^^^^^^^^^^
    |                                |
    |                                this code causes undefined behavior when executed
    |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |

Blindly do what the compiler suggest to make the test pass again.

In newer upstream version of librsvg this code has been dropped as part of a larger refactoring.

Signed-off-by: Emanuele Aina emanuele.aina@collabora.com

Merge request reports