From 1fc5c5668397231ff822c83f7963daf4ea0d2d5a Mon Sep 17 00:00:00 2001 From: nori li <50680474+thenorili@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:31:42 -0800 Subject: [PATCH] Avoid filename collision in the monorepo structure Warning: output filename collision appears in both stable and nightly builds. It's slightly more impactful than just a warning. Running cargo +nightly test, cargo test, cargo +nightly test in windows produces a linker error where color-spantrace tries to use eyre's usage.exe, see error 2 below. It's worked around pretty easily with cargo clean, but it's a problem that might get worse as the monorepo effort expands! This patch renames `usage.rs` to `CRATENAME-usage.rs`. Issue #115 --- color-spantrace/README.md | 2 +- .../{usage.rs => color-spantrace-usage.rs} | 0 color-spantrace/src/lib.rs | 14 +++++++------- eyre/examples/{usage.rs => eyre-usage.rs} | 0 4 files changed, 8 insertions(+), 8 deletions(-) rename color-spantrace/examples/{usage.rs => color-spantrace-usage.rs} (100%) rename eyre/examples/{usage.rs => eyre-usage.rs} (100%) diff --git a/color-spantrace/README.md b/color-spantrace/README.md index a2eaec9..7f4594b 100644 --- a/color-spantrace/README.md +++ b/color-spantrace/README.md @@ -55,7 +55,7 @@ println!("{}", color_spantrace::colorize(&span_trace)); ## Example -This example is taken from `examples/usage.rs`: +This example is taken from `examples/color-spantrace-usage.rs`: ```rust use tracing::instrument; diff --git a/color-spantrace/examples/usage.rs b/color-spantrace/examples/color-spantrace-usage.rs similarity index 100% rename from color-spantrace/examples/usage.rs rename to color-spantrace/examples/color-spantrace-usage.rs diff --git a/color-spantrace/src/lib.rs b/color-spantrace/src/lib.rs index 7be7a62..80a0cee 100644 --- a/color-spantrace/src/lib.rs +++ b/color-spantrace/src/lib.rs @@ -45,17 +45,17 @@ //! //! ## Output Format //! -//! Running `examples/usage.rs` from the `color-spantrace` repo produces the following output: +//! Running `examples/color-spantrace-usage.rs` from the `color-spantrace` repo produces the following output: //! -//!
 cargo run --example usage
+//! 
 cargo run --example color-spantrace-usage
 //!     Finished dev [unoptimized + debuginfo] target(s) in 0.04s
-//!      Running `target/debug/examples/usage`
+//!      Running `target/debug/examples/color-spantrace-usage`
 //! ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 //!
-//!  0: usage::two
-//!     at examples/usage.rs:18
-//!  1: usage::one with i=42
-//!     at examples/usage.rs:13
+//! 0: color-spantrace-usage::two +//! at examples/color-spantrace-usage.rs:18 +//! 1: color-spantrace-usage::one with i=42 +//! at examples/color-spantrace-usage.rs:13
//! //! [`tracing_error::SpanTrace`]: https://docs.rs/tracing-error/*/tracing_error/struct.SpanTrace.html //! [`color-backtrace`]: https://github.com/athre0z/color-backtrace diff --git a/eyre/examples/usage.rs b/eyre/examples/eyre-usage.rs similarity index 100% rename from eyre/examples/usage.rs rename to eyre/examples/eyre-usage.rs