Skip to content

Tests fail with --no-default-features flag #399

@nadzyah

Description

@nadzyah

I'm working on updating the codespan-reporting crate in Debian, and I've run into a build issue when testing different feature combinations by running cargo t --no-default-features --features std (with any feature name besides termcolor itself):

cargo t --no-default-features --features std
   Compiling codespan-reporting v0.12.0 (/home/nadzeya/debian/debcargo-conf/build/codespan-reporting)
error[E0432]: unresolved import `codespan_reporting::term::termcolor`
  --> examples/readme_preview.rs:12:31
   |
12 | use codespan_reporting::term::termcolor::{
   |                               ^^^^^^^^^ could not find `termcolor` in `term`
   |
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:14:9
   |
14 | pub use termcolor;
   |         ^^^^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:13:7
   |
13 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `codespan_reporting::term::termcolor`
  --> examples/term.rs:11:31
   |
11 | use codespan_reporting::term::termcolor::{ColorChoice, StandardStream};
   |                               ^^^^^^^^^ could not find `termcolor` in `term`
   |
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:14:9
   |
14 | pub use termcolor;
   |         ^^^^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:13:7
   |
13 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `codespan_reporting::term::termcolor`
  --> examples/reusable_diagnostic.rs:3:31
   |
3  | use codespan_reporting::term::termcolor::{ColorChoice, StandardStream};
   |                               ^^^^^^^^^ could not find `termcolor` in `term`
   |
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:14:9
   |
14 | pub use termcolor;
   |         ^^^^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:13:7
   |
13 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `codespan_reporting::term::termcolor`
  --> examples/custom_files.rs:14:31
   |
14 | use codespan_reporting::term::termcolor::{ColorChoice, StandardStream};
   |                               ^^^^^^^^^ could not find `termcolor` in `term`
   |
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:14:9
   |
14 | pub use termcolor;
   |         ^^^^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:13:7
   |
13 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0432`.
error: could not compile `codespan-reporting` (example "readme_preview") due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `codespan-reporting` (example "term") due to 1 previous error
error: could not compile `codespan-reporting` (example "reusable_diagnostic") due to 1 previous error
error[E0432]: unresolved imports `codespan_reporting::term::termcolor`, `codespan_reporting::term::Styles`
  --> tests/term.rs:3:32
   |
3  | use codespan_reporting::term::{termcolor::Color, Chars, Config, DisplayStyle, Styles};
   |                                ^^^^^^^^^ could not find `termcolor` in `term` ^^^^^^ no `Styles` in `term`
   |
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:14:9
   |
14 | pub use termcolor;
   |         ^^^^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:13:7
   |
13 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:19:23
   |
19 | pub use self::config::Styles;
   |                       ^^^^^^
note: the item is gated behind the `termcolor` feature
  --> /home/nadzeya/debian/debcargo-conf/build/codespan-reporting/src/term.rs:18:7
   |
18 | #[cfg(feature = "termcolor")]
   |       ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `termcolor`
 --> tests/support/mod.rs:4:5
  |
4 | use termcolor::{Buffer, WriteColor};
  |     ^^^^^^^^^ use of unresolved module or unlinked crate `termcolor`
  |
  = help: if you wanted to use a crate named `termcolor`, use `cargo add termcolor` to add it to your `Cargo.toml`

error[E0432]: unresolved import `termcolor`
 --> tests/support/color_buffer.rs:3:5
  |
3 | use termcolor::{ColorSpec, WriteColor};
  |     ^^^^^^^^^ use of unresolved module or unlinked crate `termcolor`
  |
  = help: if you wanted to use a crate named `termcolor`, use `cargo add termcolor` to add it to your `Cargo.toml`

error: could not compile `codespan-reporting` (example "custom_files") due to 1 previous error
error: could not compile `codespan-reporting` (test "term") due to 3 previous errors

For Debian package tests, we need to verify that crates build properly with minimal feature sets. Fixing this would be really helpful for getting the package updated with no extra patches in the package itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions