Skip to content

Cargo sometimes doesn't ungate crate features #5362

Closed
@CAD97

Description

@CAD97
D:\Christopher\Documents\Code\Rust\rust-unic\unic\char\range>cd ../../..

D:\Christopher\Documents\Code\Rust\rust-unic>cargo.exe +nightly check --all-features --package=unic-char-range
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs

D:\Christopher\Documents\Code\Rust\rust-unic>cd unic/char/range

D:\Christopher\Documents\Code\Rust\rust-unic\unic\char\range>cargo.exe +nightly check --all-features --package=unic-char-range
   Compiling unic-char-range v0.7.0 (file:///D:/Christopher/Documents/Code/Rust/rust-unic/unic/char/range)
error: 
 --> unic\char\range\src\par_iter.rs:8:9
  |
8 |         compile_error!("")
  |         ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `unic-char-range`.

To learn more, run the command again with --verbose.

D:\Christopher\Documents\Code\Rust\rust-unic\unic\char\range>cargo.exe +nightly check --package=unic-char-range
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs

I was trying to add optional rayon ParIter support to unic-char-range, and ran into this situation. Adding the optional dependency, a #[cfg(feature = "rayon")] mod par_iter; to lib.rs, and a compile_error! to the new file led to this interesting situation.

Annoyingly, I haven't been able to reproduce this behavior in a smaller setup. You can check out Unic with the code reproducing this error, but I attempted to reproduce what I thought might be triggering it -- a root workspace with a different feature set from the end package -- but it didn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions