eyre: color-eyre 0.6.4 fails to build: expected `owo_colors::dyn_styles::Style`, found `Style`

When I tried upgrading to color-eyre 0.6.4 I get the following build error:

   Compiling color-eyre v0.6.4
error[E0308]: mismatched types
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:739:19
    |
739 |             .file(src.file)
    |              ---- ^^^^^^^^ expected `owo_colors::dyn_styles::Style`, found `Style`
    |              |
    |              arguments to this method are incorrect
    |
note: two different versions of crate `owo_colors` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-3.5.0/src/dyn_styles.rs:82:1
    |
82  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the expected type `owo_colors::dyn_styles::Style`
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-4.2.0/src/dyn_styles.rs:83:1
    |
83  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the found type `Style`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:729:33
    |
729 |         eyre::WrapErr::wrap_err(color_spantrace::set_theme(self.theme.into()), "could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")?;
    |                                 --------------- one version of crate `owo_colors` used here, as a dependency of crate `color_spantrace`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/lib.rs:368:9
    |
368 | pub use owo_colors;
    |         ---------- one version of crate `owo_colors` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-spantrace-0.2.1/src/lib.rs:139:12
    |
139 |     pub fn file(mut self, style: Style) -> Self {
    |            ^^^^

error[E0308]: mismatched types
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:740:26
    |
740 |             .line_number(src.line_number)
    |              ----------- ^^^^^^^^^^^^^^^ expected `owo_colors::dyn_styles::Style`, found `Style`
    |              |
    |              arguments to this method are incorrect
    |
note: two different versions of crate `owo_colors` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-3.5.0/src/dyn_styles.rs:82:1
    |
82  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the expected type `owo_colors::dyn_styles::Style`
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-4.2.0/src/dyn_styles.rs:83:1
    |
83  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the found type `Style`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:729:33
    |
729 |         eyre::WrapErr::wrap_err(color_spantrace::set_theme(self.theme.into()), "could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")?;
    |                                 --------------- one version of crate `owo_colors` used here, as a dependency of crate `color_spantrace`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/lib.rs:368:9
    |
368 | pub use owo_colors;
    |         ---------- one version of crate `owo_colors` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-spantrace-0.2.1/src/lib.rs:145:12
    |
145 |     pub fn line_number(mut self, style: Style) -> Self {
    |            ^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:741:21
    |
741 |             .target(src.spantrace_target)
    |              ------ ^^^^^^^^^^^^^^^^^^^^ expected `owo_colors::dyn_styles::Style`, found `Style`
    |              |
    |              arguments to this method are incorrect
    |
note: two different versions of crate `owo_colors` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-3.5.0/src/dyn_styles.rs:82:1
    |
82  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the expected type `owo_colors::dyn_styles::Style`
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-4.2.0/src/dyn_styles.rs:83:1
    |
83  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the found type `Style`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:729:33
    |
729 |         eyre::WrapErr::wrap_err(color_spantrace::set_theme(self.theme.into()), "could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")?;
    |                                 --------------- one version of crate `owo_colors` used here, as a dependency of crate `color_spantrace`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/lib.rs:368:9
    |
368 | pub use owo_colors;
    |         ---------- one version of crate `owo_colors` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-spantrace-0.2.1/src/lib.rs:151:12
    |
151 |     pub fn target(mut self, style: Style) -> Self {
    |            ^^^^^^

error[E0308]: mismatched types
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:742:21
    |
742 |             .fields(src.spantrace_fields)
    |              ------ ^^^^^^^^^^^^^^^^^^^^ expected `owo_colors::dyn_styles::Style`, found `Style`
    |              |
    |              arguments to this method are incorrect
    |
note: two different versions of crate `owo_colors` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-3.5.0/src/dyn_styles.rs:82:1
    |
82  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the expected type `owo_colors::dyn_styles::Style`
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-4.2.0/src/dyn_styles.rs:83:1
    |
83  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the found type `Style`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:729:33
    |
729 |         eyre::WrapErr::wrap_err(color_spantrace::set_theme(self.theme.into()), "could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")?;
    |                                 --------------- one version of crate `owo_colors` used here, as a dependency of crate `color_spantrace`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/lib.rs:368:9
    |
368 | pub use owo_colors;
    |         ---------- one version of crate `owo_colors` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-spantrace-0.2.1/src/lib.rs:157:12
    |
157 |     pub fn fields(mut self, style: Style) -> Self {
    |            ^^^^^^

error[E0308]: mismatched types
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:743:26
    |
743 |             .active_line(src.active_line)
    |              ----------- ^^^^^^^^^^^^^^^ expected `owo_colors::dyn_styles::Style`, found `Style`
    |              |
    |              arguments to this method are incorrect
    |
note: two different versions of crate `owo_colors` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-3.5.0/src/dyn_styles.rs:82:1
    |
82  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the expected type `owo_colors::dyn_styles::Style`
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/owo-colors-4.2.0/src/dyn_styles.rs:83:1
    |
83  | pub struct Style {
    | ^^^^^^^^^^^^^^^^ this is the found type `Style`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/config.rs:729:33
    |
729 |         eyre::WrapErr::wrap_err(color_spantrace::set_theme(self.theme.into()), "could not set the provided `Theme` via `color_spantrace::set_theme` globally as another was already set")?;
    |                                 --------------- one version of crate `owo_colors` used here, as a dependency of crate `color_spantrace`
    |
   ::: /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-eyre-0.6.4/src/lib.rs:368:9
    |
368 | pub use owo_colors;
    |         ---------- one version of crate `owo_colors` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /home/arvid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/color-spantrace-0.2.1/src/lib.rs:163:12
    |
163 |     pub fn active_line(mut self, style: Style) -> Self {
    |            ^^^^^^^^^^^
  • rustc 1.86.0 (05f9846f8 2025-03-31)
  • Apparently I have both owo-colors 3.5.0 and 4.2.0 in my dependency tree (sigh)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (7 by maintainers)

Most upvoted comments

TL;DR to whoever comes here by googling the error, this fixed the problem for me:

cargo update -p color-spantrace

Published color-spantrace 0.3 and color-eyre 0.6.5, yanking previous version of each. I ended up doing a breaking update of spantrace anyway since not many people directly depend on it so the upgrade cost is low.

This part I don’t consider breaking, it’s pretty normal for people to sometimes need to unify deps in the lockfile. It’s not a public dep of color-eyre, so it shouldn’t matter.

The perspective that breaking a dependency like this doesn’t matter seems like it ignores how the wider ecosystem approaches semver. Specifically, Dependabot gives this update a 3% compatibility score, which meant 97% of the packages that it attempted to update from 0.6.3 to 0.6.4 failed to build…

Dependabot compatibility score

~Adding a direct minimal-versions check to CI would help avoid this problem in the future.~ Edit: oddly, running cargo-minimal-versions against the 0.6.4 tag, I can’t get it to fail to build even with --detach-path-deps, so this may not be a solution for this problem. Seems like a fun edge case.

@joshka I didn’t say I didn’t consider this change breaking, just one aspect of it around “internal dependencies”. the proposed fix will unbreak things for the external dep. I haven’t gotten around to it because the repo is in a weird state and I’m doing trailwork in the mountains right now so I personally can’t do it yet.

So yes, it’s going to have a bad score. That doesn’t refute what I said in that comment.

Treating “internal” dependency bumps as breaking is absolutely not how the wider ecosystem approaches semver.

color-eyre does not force a dependency on a new enough color-spantrace to ensure it has the same version of owo-colors.

This part I don’t consider breaking, it’s pretty normal for people to sometimes need to unify deps in the lockfile. It’s not a public dep of color-eyre, so it shouldn’t matter.