]> git.lizzy.rs Git - rust.git/commit
Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez
authorbors <bors@rust-lang.org>
Thu, 12 Sep 2019 08:29:55 +0000 (08:29 +0000)
committerbors <bors@rust-lang.org>
Thu, 12 Sep 2019 08:29:55 +0000 (08:29 +0000)
commit28e85d7ae78b05f30ab9c2b2f51c2dd96858b4b2
treeb7667d1f3b9add300041d38988949697b8cff2e1
parentf71826e8f26fd4fa331574caa462960db8ed961a
parent093cbd60fc331e9aab63fc4cdd8b8c9a043eaa3e
Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez

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).
src/librustdoc/test.rs