build: Avoid MaybeUninit on older Debian
This commit is contained in:
@ -19,6 +19,7 @@ path = "@path@/examples/test_layout.rs"
|
||||
[features]
|
||||
gio_v0_5 = []
|
||||
gtk_v0_5 = []
|
||||
rustc_less_1_36 = []
|
||||
|
||||
# Dependencies which don't change based on build flags
|
||||
[dependencies.cairo-sys-rs]
|
||||
|
||||
@ -83,7 +83,7 @@ cargo_toml_base = configure_file(
|
||||
cargo_deps = files('Cargo.deps')
|
||||
|
||||
if get_option('legacy') == true
|
||||
cargo_build_flags += ['--features', 'gtk_v0_5,gio_v0_5']
|
||||
cargo_build_flags += ['--features', 'gtk_v0_5,gio_v0_5,rustc_less_1_36']
|
||||
cargo_deps = files('Cargo.deps.legacy')
|
||||
endif
|
||||
|
||||
|
||||
@ -143,7 +143,11 @@ fn single_key_map_new() -> SingleKeyMap {
|
||||
unsafe {
|
||||
// Inspired by
|
||||
// https://www.reddit.com/r/rust/comments/5n7bh1/how_to_create_an_array_of_a_type_with_clone_but/
|
||||
#[cfg(feature = "rustc_less_1_36")]
|
||||
let mut array: SingleKeyMap = mem::uninitialized();
|
||||
#[cfg(not(feature = "rustc_less_1_36"))]
|
||||
let mut array: SingleKeyMap = mem::MaybeUninit::uninit().assume_init();
|
||||
|
||||
for element in array.iter_mut() {
|
||||
ptr::write(element, None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user