get rid of deprecated mem::uninitialized()

This requires a Rust version bump, as MaybeUninit was introduced in Rust
1.36.
This commit is contained in:
Scott Lamb 2019-12-28 07:51:47 -06:00
parent 2bd8963961
commit 72d301af6e
4 changed files with 6 additions and 5 deletions

View File

@ -23,7 +23,7 @@ matrix:
script: script:
- ci/script-rust.sh - ci/script-rust.sh
- language: rust - language: rust
rust: 1.34.0 rust: 1.36.0
script: script:
- ci/script-rust.sh - ci/script-rust.sh
- language: node_js - language: node_js

View File

@ -75,8 +75,9 @@ pub struct RealClocks {}
impl RealClocks { impl RealClocks {
fn get(&self, clock: libc::clockid_t) -> Timespec { fn get(&self, clock: libc::clockid_t) -> Timespec {
unsafe { unsafe {
let mut ts = mem::uninitialized(); let mut ts = mem::MaybeUninit::uninit();
assert_eq!(0, libc::clock_gettime(clock, &mut ts)); assert_eq!(0, libc::clock_gettime(clock, ts.as_mut_ptr()));
let ts = ts.assume_init();
Timespec::new(ts.tv_sec as i64, ts.tv_nsec as i32) Timespec::new(ts.tv_sec as i64, ts.tv_nsec as i32)
} }
} }

View File

@ -48,7 +48,7 @@ $ sudo apt-get install \
tzdata tzdata
``` ```
Next, you need Rust 1.34+ and Cargo. The easiest way to install them is by Next, you need Rust 1.36+ and Cargo. The easiest way to install them is by
following the instructions at [rustup.rs](https://www.rustup.rs/). following the instructions at [rustup.rs](https://www.rustup.rs/).
Finally, building the UI requires [yarn](https://yarnpkg.com/en/). Finally, building the UI requires [yarn](https://yarnpkg.com/en/).

View File

@ -40,7 +40,7 @@ fi
NODE_MIN_VERSION="8" NODE_MIN_VERSION="8"
YARN_MIN_VERSION="1.0" YARN_MIN_VERSION="1.0"
CARGO_MIN_VERSION="0.2" CARGO_MIN_VERSION="0.2"
RUSTC_MIN_VERSION="1.34" RUSTC_MIN_VERSION="1.36"
normalizeDirPath() normalizeDirPath()
{ {