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

Bad call to rustdoc when cargo test --package feature when using features #3172

Closed
TeXitoi opened this issue Oct 6, 2016 · 5 comments · Fixed by #3242
Closed

Bad call to rustdoc when cargo test --package feature when using features #3172

TeXitoi opened this issue Oct 6, 2016 · 5 comments · Fixed by #3242
Labels
Command-test E-easy Experience: Easy

Comments

@TeXitoi
Copy link

TeXitoi commented Oct 6, 2016

TLDR: this (almost) minimal project doesn't work: https://github.com/TeXitoi/cargo_bug_feature_package

When using features, and calling cargo test --package feature, --cfg arguments are bad when calling rustdoc.

@TeXitoi
Copy link
Author

TeXitoi commented Oct 6, 2016

Maybe a duplicate of #2539

@alexcrichton
Copy link
Member

Right now --cfg flags are passed here to rustdoc which originates from this field which are all filled in here.

The bug here is that we're passing root_pkg to the calculations here, which doesn't work with the --package flag where we're actually testing something other than the root crate. I think this may be the same issue as #2539 because we attempt to pass build script cfg values, but that would require #2539 specifically being related to the -p flag which it currently doesn't mention.

I think we'll want to tweak this logic and perhaps just update Compilation to not only store the cfg values for the root package, but rather the entire crate graph. That way later on we can just look up the relevant piece in the hash table in Compilation instead of always picking the one cfgs value.

I'm going to tag this E-easy as I think it shouldn't be too hard to tackle, but if anyone works on this and needs some help feel free to ping me!

@alexcrichton alexcrichton added E-easy Experience: Easy Command-test labels Oct 6, 2016
TeXitoi added a commit to TeXitoi/mimirsbrunn that referenced this issue Oct 7, 2016
TeXitoi added a commit to TeXitoi/mimirsbrunn that referenced this issue Oct 7, 2016
TeXitoi added a commit to TeXitoi/mimirsbrunn that referenced this issue Oct 7, 2016
@jhbabon
Copy link
Contributor

jhbabon commented Oct 21, 2016

Hi @alexcrichton, I can take a look at this if no one has done it yet. (yes, I'm chasing E-easy tags in this project 😆 )

@alexcrichton
Copy link
Member

@jhbabon sure! Let me know if you need any pointers!

@jhbabon
Copy link
Contributor

jhbabon commented Oct 31, 2016

Hi! Sorry for the delay on this. This is the fix I managed to do: #3242

bors added a commit that referenced this issue Nov 1, 2016
FIX: Call rustdoc test with the correct cfg flags of a package.

There was a situation in which if you you had a lib that depends on a package with features, whenever you ran the tests for the package the `rustdoc test` call was failing because it was called with the root `cfg` flags, not the package `cfg` flags.

This fix solves the issue by keeping track of the `cfg` flags per package, so the `rustdoc` command will be generated with the correct `cfg` flags.

Closes #3172
@bors bors closed this as completed in #3242 Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-test E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants