180 Commits

Author SHA1 Message Date
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
be5a41dd34 test: migrate doc json to snapbox 2024-08-14 16:16:11 -05:00
Ed Page
3ae40458a5 Partial revert of 3085b548ecbd7d29d40c6180609ea3c224bad857
This is to quickly resolve a test failure from #14318
2024-07-29 12:59:00 -05:00
Ed Page
3085b548ec test: Migrate json install doc to snapbox 2024-07-24 10:42:51 -05:00
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
Weihang Lo
7e78271c5f
fix: rename to rustdoc::broken_intra_doc_links 2024-07-08 23:47:22 -04:00
heisen-li
e29862ce34 test: migrate doc to snapbox 2024-07-03 09:59:40 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Eric Huss
3adb796e87 Fix doc collision for lib/bin with a dash in the inferred name. 2024-03-25 13:35:52 -07:00
Eric Huss
9e7d6e3122 Add test for doc lib/bin collision with a dash. 2024-03-25 13:32:15 -07:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
bors
69726309bf Auto merge of #12783 - dvdhrm:pr/libname2, r=ehuss
cargo: prevent dashes in lib.name

The TOML parser of Cargo currently refuses `lib.name` entries that contain dashes. Unfortunately, it uses the package-name as default if no explicit `lib.name` entry is specified. This package-name, however, can contain dashes.

Cargo documentation states that the package name is converted first, yet this was never implemented by the code-base.

Fix this inconsistency and convert the package name to a suitable crate-name first.

This fixes #12780. It is an alternative to #12640.
2024-03-16 20:50:35 +00:00
Ed Page
7bc6044fe4 fix(doc): Collapse down Generated statuses without --verbose
Fixes #13336
2024-03-07 09:34:34 -06:00
Ed Page
7ffa09a296 test(docs): Show verbose behavior 2024-03-07 09:22:12 -06:00
Ed Page
d8bf778124 test(docs): Verify generated output 2024-03-07 09:20:42 -06:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
831847e5f0 fix(rustc): Always pass --edition to rustc
On [Internals](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309),
the idea came up for warning on unset Edition.
I am working on the cargo warning but if rustc ever wants to do so,
they'd be blocked on cargo ensuring `--edition` is always set.
Hence this change.
2024-02-28 15:35:41 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
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
David Rheinsberg
3ca04e261e cargo: prevent dashes in lib.name
The TOML parser of Cargo currently refuses `lib.name` entries that
contain dashes. Unfortunately, it uses the package-name as default if no
explicit `lib.name` entry is specified. This package-name, however, can
contain dashes.

Cargo documentation states that the package name is converted first, yet
this was never implemented by the code-base.

Fix this inconsistency and convert the package name to a suitable
crate-name first.
2023-10-17 13:48:41 +02: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