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

rustdoc: change doctests locating rustc binary #64328

Merged
merged 2 commits into from
Sep 12, 2019

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Sep 10, 2019

We previously used the "naive" approach of replacing the current_exe()'s file name with rustc, but now load from the sysroot by default ($sysroot/bin/rustc). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc.

The second commit adds an unstable --test-builder flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).

@Mark-Simulacrum
Copy link
Member Author

cc @RalfJung @oli-obk on second commit for potential usefulness for miri (see second paragraph of PR description)

@Mark-Simulacrum Mark-Simulacrum added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 10, 2019
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-10T01:22:54.8389032Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-10T01:22:54.8602114Z ##[command]git config gc.auto 0
2019-09-10T01:22:54.8687292Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-10T01:22:54.8758160Z ##[command]git config --get-all http.proxy
2019-09-10T01:22:54.8915987Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64328/merge:refs/remotes/pull/64328/merge
---
2019-09-10T01:32:38.5303952Z     Checking rustc_codegen_ssa v0.0.0 (/checkout/src/librustc_codegen_ssa)
2019-09-10T01:32:41.4686364Z     Checking rustc_save_analysis v0.0.0 (/checkout/src/librustc_save_analysis)
2019-09-10T01:32:42.5712868Z     Checking rustc_plugin v0.0.0 (/checkout/src/librustc_plugin/deprecated)
2019-09-10T01:32:43.3126420Z     Checking rustc_interface v0.0.0 (/checkout/src/librustc_interface)
2019-09-10T01:32:43.5725174Z error[E0425]: cannot find function `current_dll_path` in this scope
2019-09-10T01:32:43.5725512Z    --> src/librustc_interface/util.rs:319:16
2019-09-10T01:32:43.5725753Z     |
2019-09-10T01:32:43.5726019Z 319 |     let path = current_dll_path().and_then(|s| s.canonicalize().ok());
2019-09-10T01:32:43.5726361Z 
2019-09-10T01:32:43.6013399Z error[E0106]: missing lifetime specifier
2019-09-10T01:32:43.6013780Z    --> src/librustc_interface/util.rs:295:31
2019-09-10T01:32:43.6014074Z     |
2019-09-10T01:32:43.6014074Z     |
2019-09-10T01:32:43.6014351Z 295 | pub fn rustc_path() -> Option<&Path> {
2019-09-10T01:32:43.6014698Z     |                               ^ help: consider giving it a 'static lifetime: `&'static`
2019-09-10T01:32:43.6015258Z     = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
2019-09-10T01:32:43.6015302Z 
2019-09-10T01:32:43.7469925Z error: aborting due to 2 previous errors
2019-09-10T01:32:43.7470041Z 
---
2019-09-10T01:32:43.7771112Z == clock drift check ==
2019-09-10T01:32:43.7787515Z   local time: Tue Sep 10 01:32:43 UTC 2019
2019-09-10T01:32:43.9293971Z   network time: Tue, 10 Sep 2019 01:32:43 GMT
2019-09-10T01:32:43.9294131Z == end clock drift check ==
2019-09-10T01:32:45.2411455Z ##[error]Bash exited with code '1'.
2019-09-10T01:32:45.2450896Z ##[section]Starting: Checkout
2019-09-10T01:32:45.2452689Z ==============================================================================
2019-09-10T01:32:45.2452745Z Task         : Get sources
2019-09-10T01:32:45.2452791Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Sep 10, 2019

☔ The latest upstream changes (presumably #60387) made this pull request unmergeable. Please resolve the merge conflicts.

This ensures that the failure cases for finding the codegen backend and
for finding the rustc binary are essentially the same, and since we
almost always will load the codegen backend, this is essentially meaning
that the rustc change is not a regression.
This allows overriding the rustc binary used to build tests; it should
not generally be necessary as we fallback to the sysroot.
@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 12, 2019

📌 Commit 093cbd6 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 12, 2019
bors added a commit that referenced this pull request Sep 12, 2019
…eGomez

rustdoc: change doctests locating rustc binary

We previously used the "naive" approach of replacing the `current_exe()`'s file name with rustc, but now load from the sysroot by default (`$sysroot/bin/rustc`). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc.

The second commit adds an unstable `--test-builder` flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).
@bors
Copy link
Contributor

bors commented Sep 12, 2019

⌛ Testing commit 093cbd6 with merge 28e85d7...

@bors
Copy link
Contributor

bors commented Sep 12, 2019

☀️ Test successful - checks-azure
Approved by: GuillaumeGomez
Pushing 28e85d7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 12, 2019
@bors bors merged commit 093cbd6 into rust-lang:master Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants