From 6e85a3c7ea15a438d4fb2b6abdd04da140f7cdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Sat, 17 Jul 2021 15:07:19 +0200 Subject: [PATCH] [rust] fix some miri errors #1937 `cargo +nightly miri test --no-fail-fast -- --test-threads 1 --nocapture` --- rust/build/build.rs | 5 +++++ rust/src/lib.rs | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rust/build/build.rs b/rust/build/build.rs index 8d6a3e36d..ba21fe054 100644 --- a/rust/build/build.rs +++ b/rust/build/build.rs @@ -17,6 +17,8 @@ fn main() { // The bindgen::Builder is the main entry point to bindgen, and lets you // build up options for the resulting bindings. // + // https://docs.rs/bindgen/*/bindgen/struct.Builder.html + // // allow .blacklist_function instead of .blocklist_function for now, // until we update bindgen to >= 0.58. #[allow(deprecated)] @@ -48,6 +50,9 @@ fn main() { .blacklist_item("MSG_.*") .blacklist_item("N[^C].*") .blacklist_type("_bindgen.*") + // https://github.com/dankamongmen/notcurses/pull/1937 + // https://github.com/rust-lang/rust-bindgen/issues/1651 + .layout_tests(false) // Don't derive the Copy trait on types with destructors. .no_copy("ncdirect") .no_copy("ncdplot") diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 77b2b07ab..b1039d9d2 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -21,6 +21,7 @@ //! ```rust //! use libnotcurses_sys::*; //! +//! # #[cfg(not(miri))] //! fn main() -> NcResult<()> { //! let mut nc = Nc::with_flags(NCOPTION_NO_ALTERNATE_SCREEN)?; //! let plane = nc.stdplane(); @@ -29,6 +30,8 @@ //! nc.stop()?; //! Ok(()) //! } +//! # #[cfg(miri)] +//! # fn main() {} //! ``` //! //! Although you still have to manually call the `stop()` method for [`Nc`] and @@ -66,6 +69,7 @@ //! //! use libnotcurses_sys::*; //! +//! # #[cfg(not(miri))] //! fn main() { //! let options = ffi::notcurses_options { //! termtype: null(), @@ -93,7 +97,8 @@ //! } //! } //! } -//! +//! # #[cfg(miri)] +//! # fn main() {} //! ``` //! //! ### The `notcurses` C API docs