-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo doc --open always respect request_kind #11804
base: master
Are you sure you want to change the base?
Conversation
r? @ehuss (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR still working in the process. I'll add a test later.
My suggestion would be to have the following behavior:
This may require extending the |
4f08041
to
1adb8c1
Compare
How does it interact with
|
It depends, but for the most part the code should not know or care about forced-target. If there is only one root unit, then that's the one that gets opened (whether it is forced-target or not). If there are multiple, such as in a workspace, and one of those is forced-target and the other is not, then it will open the one that is not forced-target. As for the "first" entry, that is completely arbitrary, and is currently alphabetical I believe. The operation should be relatively simple, I think it would be something like: root_units.iter().find(|unit| unit.kind == requested_kind).next().unwrap_or(root_units[0]); That's a very rough sketch, but the general shape of what I think it should look like. |
181c726
to
83863ea
Compare
cargo doc --open
respect forced-target
@rustbot author |
d85b7a3
to
681e938
Compare
681e938
to
eb8be9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self check
@rustbot ready |
@ehuss Do you have any suggestion about which target I should use in the test on the stable channel? Thanks! |
The cargo testsuite has various things to help with cross-compiling. At the start of the function, write: if cross_compile::disabled() {
return;
} Then, for the target value, use |
eb8be9d
to
6cd42f8
Compare
Thanks for your help! It works. |
Hi, just to confirm, |
Yes. |
2f31cd6
to
7f90e71
Compare
7f90e71
to
a9847e2
Compare
Added |
In thinking about this more, I came up with a concern with this approach, to be followed up at #11728 (comment). |
@rustbot blocked |
@ehuss What should I do to help this PR move forward? Do you think we still need to wait for more discussion about this behavior? |
☔ The latest upstream changes (presumably #12252) made this pull request unmergeable. Please resolve the merge conflicts. |
What does this PR try to resolve?
closes #11728
More details:
The open behavior is as follows:
cargo doc --open:
cargo doc --target TARGET --open:
How should we test and review this PR?
See the unit test.