Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support compiler switches for std feature #47

Open
brenzi opened this issue Sep 21, 2019 · 4 comments
Open

support compiler switches for std feature #47

brenzi opened this issue Sep 21, 2019 · 4 comments

Comments

@brenzi
Copy link

brenzi commented Sep 21, 2019

If a crate has

#[cfg(feature = "std")]
use std::vec::Vec;

this shouldn't result in FAILURE because the compiler switch deactivates the use std::

@dbrgn
Copy link

dbrgn commented Jan 16, 2020

I have a similar problem: I include tests like this.

#[cfg(test)]
mod tests;

The tests require std, which cargo-nono doesn't like.

$ cargo nono check --features asdf
at-rs: FAILURE
  - Source code contains an explicit `use std::` statement.
   --> src/tests.rs:18:4
    |
18  |use std::sync::Once;
    |    ^^^^^^^^^^^^^^^

@l0calh05t
Copy link

I'm running into what I assume is this issue when using wmidi in a no_std crate, where my Cargo.toml explicitly disables default features

[dependencies]
wmidi = { version = "4", default-features = false }

But cargo nono check fails with

wmidi: FAILURE
  - Source code contains an explicit `use std::` statement.
   --> <...>\wmidi-4.0.6\src\error.rs

  - Source code contains an explicit `use std::` statement.
   --> <...>\wmidi-4.0.6\src\midi_message.rs

The corresponding use statements are behind a cfg, e.g.

#[cfg(feature = "std")]
use std::error;

Interestingly, another crate (itertools) only fails if I enable default features.

@alxiong
Copy link

alxiong commented Jul 27, 2022

I'm running into a similar problem on num-bigint

└─○ cargo nono check
num-bigint: ❌
  - Source code contains an explicit `use std::` statement.
   --> src/lib.rs:119:4
    |
119 |use std::error::Error;
    |    ^^^^^^^^^^^^^^^^^
num-integer: ✅
num-traits: ✅

but apparently in the source code here:

#[cfg(feature = "std")]
use std::error::Error;

this issue is long-standing, any technical blocker preventing from being addressed? @hobofan

@hobofan
Copy link
Owner

hobofan commented Jul 28, 2022

@alxiong No explicit technical blocker, there is just no logic in place yet to track and evaluate compiler switches on individual use items (as evaluating arbitrary compiler switches was a rabbit hole I didn't want to go into).

I'm overall maintaining the project passively, but if someone were to make a PR for it, I'll review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants