Rollup merge of #93497 - willcrichton:rustdoc-scrape-test, r=GuillaumeGomez
Pass `--test` flag through rustdoc to rustc so `#[test]` functions can be scraped As a part of stabilizing the scrape examples extension in Cargo, I uncovered a bug where examples cannot be scraped from tests. See this test: https://github.com/rust-lang/cargo/pull/10343/files#diff-27aa4f012ebfebaaee61498d91d2370de460628405d136b05e77efe61e044679R2496 The issue is that when rustdoc is run on a test file, because `--test` is not passed as a rustc option, then functions annotated with `#[test]` are ignored by the compiler. So this PR changes rustdoc so when `--test` is passed in conjunction with a `--scrape-example-<suffix>` flag, then the `test` field of `rustc_interface::Config` is true. r? `@camelid`
This commit is contained in:
commit
e3a1e19296
8 changed files with 37 additions and 5 deletions
|
@ -596,6 +596,9 @@ fn opts() -> Vec<RustcOptGroup> {
|
|||
"collect function call information for functions from the target crate",
|
||||
)
|
||||
}),
|
||||
unstable("scrape-tests", |o| {
|
||||
o.optflag("", "scrape-tests", "Include test code when scraping examples")
|
||||
}),
|
||||
unstable("with-examples", |o| {
|
||||
o.optmulti(
|
||||
"",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue