Commit graph

159 commits

Author SHA1 Message Date
Alex Crichton
1439b3fbe9 Don't print rustdoc command lines on failure by default
This commit lifts a helper function from invoking rustc to additionally
being used for invoking rustdoc. This enables hiding the command line
invocation of `rustdoc` by default when it fails, although it's still
available to see with `--verbose`. The intention here is to match the
behavior of `cargo build` for rustc failures here and was inspired by
recently running `cargo doc` and not being able to see the actual
failure as the command line ended up taking the whole screen (afterwards
I made the screen bigger and that helped too).
2024-02-02 10:33:07 -08:00
Weihang Lo
f9fd4ff4ee
fix(json-msg): use pkgid spec in in JSON messages
In 12914 we stabilized pkgid spec as unique package identifier for
`cargo metadata`. However, we forgot to make the same change to
JSON message format[^1]. This PR does so.

Note that the `package_id` field in JSON message is not clearly stated
as "opaque", so it might be considered as a breaking change to some extent.

[^1]: https://doc.rust-lang.org/nightly/cargo/reference/external-tools.html#compiler-messages
2024-01-17 11:31:19 -05:00
hi-rustin
ed9dc44f47 Update other tests to use cargo:: syntax
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
David Tolnay
65bb09d434
Handle $message_type in JSON diagnostics 2023-11-19 20:37:16 -08:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Ed Page
293f2250d6 feat(doc): Print the generated docs links
I've wanted something like this myself.  I dislike using `--open`
because I tend to move up to re-run my `cargo doc` run but then have to
edit it to remove `--open`.
Also makes it annoying when opening docs when `cargo doc` is wrapped by
a tool like `make`.

This was previously attempted in #5592:
- Unlike the request in #5562, this aligns with #5592 in always printing
  rather than using a flag as this seems generally useful
- Unlike #5592, this prints as an alternative to "Opening" to keep
  things light
- Unlike #5592, this prints afterwards as the link is only valid then

Fixes #5562
2023-10-19 10:51:56 -05:00
Michael Howell
f0d3cdf191 rustdoc: remove the word "Version" from test cases
Needed for https://github.com/rust-lang/rust/pull/115948 to merge.
2023-10-10 11:19:57 -07:00
Eric Huss
1df0f1d734 Add allow(internal_features) 2023-08-05 12:11:07 -07:00
Arpad Borsos
18e290c0e4
Enable doctest-in-workspace by default
This stabilizes and enables the `-Z doctest-in-workspace` flag by default.

Also adds another testcase to make sure that the `include!()` and `file!()` macros interact well together.
2023-06-17 19:34:34 +02:00
Scott Schafer
620dfb13e1 chore: update doc tests to use check 2023-02-20 12:21:15 -06:00
Will Crichton
39e6737de7 Change rustdoc-scrape-examples to be a target-level configuration 2022-11-16 09:18:33 -08:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Eric Huss
7eb007ddbf Add reasons to all ignored tests. 2022-08-02 12:24:00 -07:00
Eric Huss
e8d92919cf Disable scrape_examples_complex_reverse_dependencies 2022-08-02 06:57:34 -07:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Loïc BRANSTETT
2d0ca84b0e Move check cfg tests to their own module 2022-05-06 22:42:28 +02:00
Loïc BRANSTETT
6a9f094c8c Convert the testsuite to use the new -Zcheck-cfg flag and syntax 2022-05-06 22:40:08 +02:00
bors
08b8fe5c2d Auto merge of #10142 - jyn514:bin-private-link, r=ehuss
When documenting private items in a binary, ignore warnings about links to private items

Previously, rustdoc would warn about linking to private items in a binary, even
though cargo unconditionally documents private items in a binary.
This changes cargo to silence the warning, since it's only relevant in
cases where the private items might not be documented.

Fixes https://github.com/rust-lang/rust/issues/89600.
2022-05-06 19:48:59 +00:00
Joshua Nelson
727baf0db1 When documenting private items in a binary, ignore warnings about links to private items
Previously, rustdoc would warn about linking to items in a binary, even
though cargo unconditionally documents private items in a binary.
This changes cargo to silence the warning, since it's only relevant in
cases where the private items might not be documented.
2022-05-03 20:03:44 -05:00
Will Crichton
642ca5491a Ensure host units don't depend on Docscrape units, fixes #10535 2022-04-08 15:01:01 -07:00
Will Crichton
e55c40fdda Fix scrape-examples incorrectly handling proc macros 2022-04-01 19:34:53 -07:00
Loïc BRANSTETT
e828e85ee7 Add -Z check-cfg-features support for rustdoc 2022-02-26 14:10:17 +01:00
hi-rustin
81c2cd5a95 Compute non custom build and non transitive deps for doc
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-30 00:06:27 +08:00
Eric Huss
fdeb38b903 Fix documenting with undocumented dependencies. 2022-01-24 17:10:05 -08:00
hi-rustin
07843ed8fb add open_no_doc_crate test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-12-16 22:29:32 +08:00
Eric Huss
6e568690a6 Don't document libs with doc=false 2021-12-15 15:13:54 -08:00
bors
a4cdd757e5 Auto merge of #10171 - ehuss:no-executable-doc, r=alexcrichton
Don't emit "executable" JSON field for non-executables.

The "executable" field of JSON artifact messages was accidentally filled (with the path to `index.html`) when documenting a binary target. This fixes it so that it is null.

Closes #10149
2021-12-13 19:48:00 +00:00
Eric Huss
6a79008cad Don't emit "executable" JSON field for non-executables. 2021-12-05 18:39:30 -08:00
Eric Huss
a09fbf2ef8 Document lib before bin. 2021-12-05 15:14:54 -08:00
Eric Huss
2507d53bb6 Fix some tests with output collisions. 2021-11-29 11:04:08 -08:00
Esteban Kuber
0dfe70f7e1 Change test to not trigger emoji error
This change is needed to land rust-lang/rust#88781, as it changes the
handling of emojis in source code to treat them as identifiers.
2021-11-24 17:07:40 +00:00
Joshua Nelson
8713cd7e69 Give a hard error if -Zrustdoc-scrape-examples is missing a flag
It's the same as if the flag wasn't passed, and it makes it difficult to
figure out why rustdoc isn't generating examples.
2021-11-05 09:07:15 -05:00
Will Crichton
7ee3ffc7e6 Fix --scrape-examples-target-crate using package name (with dashes) instead of crate name (with underscores), closes #10035 2021-11-04 11:23:40 -07:00
Will Crichton
9fb78cf698 Change --scrape-examples flag to -Z rustdoc-scrape-examples 2021-10-29 00:15:19 -07:00
Will Crichton
0a2382b6db Formatting 2021-10-28 00:38:16 -07:00
Will Crichton
11209570c9 Change scraping to apply to all workspace packages instead of just
root units. Only attach Docscrape unit dependencies to workspace Doc
units. Add test for scraping examples with complex reverse dependencies.
2021-10-28 00:35:34 -07:00
Will Crichton
e4a65b91be Fix several bugs when checking wasmtime repo:
* Docscrape unit not having dev-dependencies included
* Sources for reverse-dependencies generated to the wrong directory
* Incorrect features being selected for Docscrape units
* Panics from Docscrape-dependent packages not being available
2021-10-27 11:42:31 -07:00
Will Crichton
b948fc86c0 Add test / documentation for scrape-examples cycle-avoidance, add map for doc unit -> metadata to Context 2021-10-14 16:06:26 -07:00
Will Crichton
470556603e Add documentation and a test 2021-10-12 19:11:07 -07:00
Eric Huss
422d5b030c Enable some tests on windows. 2021-09-08 23:34:37 -07:00
l00556901
1bbd505a72 add fmt 2021-08-24 17:49:21 +08:00
l00556901
2929efdf88 add --examples subcommand 2021-08-24 17:44:58 +08:00
bors
4952979031 Auto merge of #9531 - 5225225:cargo-doc-open-fix, r=ehuss
Fix `BorrowMutError` when calling `cargo doc --open`

~~I'm not sure why the existing test suite didn't catch this, it definitely calls `cargo doc --open`.~~

I had

```toml
[doc.extern-map]
std = "local"
```

in my `.cargo/config.toml`. Will write a test case that sets that and then tries to run `cargo doc --open`.

Closes #9530
2021-07-01 01:14:50 +00:00
5225225
950c415583 Fully match stderr, return if not nightly, shorten file 2021-06-28 19:01:16 +01:00
5225225
9e4c0e1e44 Don't use CargoDocConfig struct 2021-06-19 17:45:44 +01:00
Eric Huss
bd4010c43d Relax doc collision error. 2021-06-17 16:28:17 -07:00
Eric Huss
16b5402fd7 testsuite: Switch to colored diffs with Myers diff. 2021-06-16 15:43:29 -07:00
5225225
1919ce7ce5 Add test to try to catch doc --open issue with extern-map 2021-06-06 13:28:45 +01:00
Eric Huss
81defa6d1e Consolidate doc collision detection. 2021-05-30 19:39:48 -07:00