-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Allow cross-compiling doctests #60387
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
98bd8fd
Added ability to crosscompile doctests
Goirad 3f76408
added feature gate enable-per-target-ignores
Goirad 657e24c
changed target from option to plain target, populated with host tripl…
Goirad 14110eb
added rustdoc book documentation, improved behavior when unstable fla…
Goirad 4a2094c
address rebase changes
Goirad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is what @jethrogb was talking about with the behavior of the runtool arguments. This just takes arguments as-is without splitting or reparsing them, which (apparently) is what compiletest does. A more robust solution would split the strings we get from
opt_strs
to fill out a separate Vec, rather than taking the list directly....however, after reviewing your companion PR on Cargo, it seems like you're going to lean on Cargo pre-parsing the
runner
arguments, so i'm not too concerned, in the end. I'd like to see whether/how this is going to be integrated with bootstrap - do we cross-compile other tests already? How is that orchestrated? (Who is the best person to ask these questions to? 😅)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.
I'm a bit confused by your first paragraph, it is my understanding that
opt_strs
returns a vec of all arguments passed to (possibly many)--runtool-arg
's. The intention being that arguments get passed one at a time, one per--runtool-arg
.As for the question of integration with bootstrap, I am working on that now, but wanted to get the ball rolling here in rustdoc. My plan is to add an unstable flag to bootstrap that makes it pass
--Zdoctest-xcompile
to cargo test invocations. The current state is that compiletests do get cross-compiled, and it already has a--runtool
option. My change to compiletest removes that option and instead uses Cargo to create the merged.cargo/config
for a directory and use the runner specified there, with the idea being that it will ensure consistent testing across rustdoc and compiltest.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.
I see now what you meant in your first paragraph. You're right it would be more robust, I just omitted any error checking there, since worst case scenario one string that is in reality several instructions would just get passed wholesale to the runtool (which I think would not in the end be any different from adding them one at a time).
Also as far as who to ask, I don't know, but I welcome any suggestions since this seems to be pretty central to how the whole rust compiler building and testing process works.
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.
Since we would be building up a Command instance with these args, the space-splitting wouldn't happen - the recipient would receive the blob in one "argument", as if it had all been quoted together.
One option would be to look at how many
--runtool-arg
arguments there are and treat it differently based on whether there are one or more than one. If there's only one argument, we could do space-splitting on that, and if there is more than one argument, we can leave them as-is. This somewhat mirrors Cargo's own parsing of the relevant configuration item, which whitespace-splits it is it's just a string, and leaves them alone if given a list. (This can backfire if someone tried to give a single argument with spaces in it, though... 🤔)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.
It's not possible to correctly space-split command-line arguments based on some heuristic if you also want to support arguments with spaces in them. Just let the
cargo
/the user take care of this. Most people won't be runningrustdoc
directly this way anyway.