Skip to content

Improve error without required features for futures-test #1388

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

Merged
merged 1 commit into from
Jan 2, 2019

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Jan 1, 2019

fixes #1385

@Nemo157
Copy link
Member Author

Nemo157 commented Jan 1, 2019

https://travis-ci.org/rust-lang-nursery/futures-rs/jobs/474096048#L531 shows the failure building the new crate.

Unfortunately the same thing that requires having an extra crate to test this causes the failure in https://travis-ci.org/rust-lang-nursery/futures-rs/jobs/474097015, I don't think it's possible to actually fix this properly with Cargo's current handling of features.

I'll try adding a std feature and an error message if this is not active so that users can fix it easily.

@Nemo157 Nemo157 changed the title Enable required features for futures-test Improve error without required features for futures-test Jan 1, 2019
@Nemo157
Copy link
Member Author

Nemo157 commented Jan 1, 2019

If someone attempts to use futures-test = { default-features = false } now they will get a useful error message:

→ cargo build --manifest-path futures-test/Cargo.toml --no-default-features
   Compiling futures-test-preview v0.3.0-alpha.11 (/Users/nemo157/sources/futures-rs/futures-test)
error: `futures-test` must have the `std` feature activated, this is a default-active feature
  --> futures-test/src/lib.rs:15:1
   |
15 | compile_error!("`futures-test` must have the `std` feature activated, this is a default-active feature");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@Thomasdezeeuw
Copy link
Contributor

I don't think the std feature is required for future-test, only run_in_background needs std features from other crates I think.

@Nemo157
Copy link
Member Author

Nemo157 commented Jan 2, 2019

For what it needs from other crates yes, but around a third of the rest of the APIs depend on Arc and a few are using Box::leak with ZSTs (probably possible to do soundly some other way, but I don’t know how). If anyone is actually using a no_std testing framework then I’d be happy to have the feature used here properly, I just don’t think it’s worth it at this point (after 80% implementing it, then reverting back to this).

@Thomasdezeeuw
Copy link
Contributor

@Nemo157 Ok, then I'm happy to use the std feature by default, I don't have a no_std use case.

@cramertj
Copy link
Member

cramertj commented Jan 2, 2019

Nice, this will be much better, thanks!

@cramertj cramertj merged commit 6698fc3 into rust-lang:master Jan 2, 2019
@Nemo157 Nemo157 deleted the futures-test-std branch January 3, 2019 10:38
@Nemo157 Nemo157 mentioned this pull request Jan 3, 2019
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

Successfully merging this pull request may close these issues.

Unable to compile with futures-test as dev-dependency
3 participants