From 10fa0bf2bb8177dccaa4f838169551a9b93e934a Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Sat, 30 Jul 2022 12:09:35 -0700 Subject: [PATCH] test: fix miri failure due to `tracing` deps (#280) This adds a Cargo patch for the `once_cell` crate to pick up an upstream branch that fixes an int-to-pointer cast that Miri rejects. The patch can be removed once matklad/once_cell#185 has merged. --- Cargo.lock | 3 +-- Cargo.toml | 5 +++++ cordyceps/src/list/tests.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e9ceb45..825dc24d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1044,8 +1044,7 @@ dependencies = [ [[package]] name = "once_cell" version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +source = "git+https://github.com/hawkw/once_cell?branch=eliza/saethlin/provenance#ee55dd2504d6f1bfc8e0f216bd5253ba41f027bc" [[package]] name = "os_str_bytes" diff --git a/Cargo.toml b/Cargo.toml index 41f5a1ba..b565e5d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -90,6 +90,11 @@ tracing-core = { git = "https://github.com/tokio-rs/tracing" } # https://github.com/rust-osdev/volatile/pull/25 merges upstream. this is # necessary to build with unstable features on recent nightlies. volatile = { git = "https://github.com/hawkw/volatile", branch = "eliza/update-features" } +# patch `once_cell` to use https://github.com/matklad/once_cell/pull/185 so that +# Miri doesn't reject `tracing`'s use of `once_cell`. +# +# remove this patch once once_cell#185 is merged. +once_cell = { git = "https://github.com/hawkw/once_cell", branch = "eliza/saethlin/provenance" } # Custom profile for Loom tests: enable release optimizations so that the loom # tests are less slow, but don't disable debug assertions. diff --git a/cordyceps/src/list/tests.rs b/cordyceps/src/list/tests.rs index 511d0ebb..d71e1062 100644 --- a/cordyceps/src/list/tests.rs +++ b/cordyceps/src/list/tests.rs @@ -117,7 +117,7 @@ fn const_new() { const _: List = List::new(); } -fn trace_init() -> tracing::dispatcher::DefaultGuard { +fn trace_init() -> impl Drop { use tracing_subscriber::prelude::*; tracing_subscriber::fmt() .with_test_writer()