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

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

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2019

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

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Sep 10, 2019

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)

src/librustc_interface/util.rs Outdated Show resolved Hide resolved
@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2019

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

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:rustdoc-find-rustc branch from f6a1e02 to d101de8 Sep 10, 2019

src/librustc_interface/util.rs Outdated Show resolved Hide resolved
Locate rustc binary similarly to codegen backend loading
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.
Add unstable --test-builder to rustdoc
This allows overriding the rustc binary used to build tests; it should
not generally be necessary as we fallback to the sysroot.

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:rustdoc-find-rustc branch from d101de8 to 093cbd6 Sep 10, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented Sep 12, 2019

Thanks!

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2019

📌 Commit 093cbd6 has been approved by GuillaumeGomez

bors added a commit that referenced this pull request Sep 12, 2019
Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=Guillaum…
…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

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2019

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

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2019

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

@bors bors added the merged-by-bors label Sep 12, 2019

@bors bors merged commit 093cbd6 into rust-lang:master Sep 12, 2019

5 checks passed

homu Test successful
Details
pr Build #20190910.44 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (LinuxTools) LinuxTools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.