152 Commits

Author SHA1 Message Date
Simonas Kazlauskas
548300b20f Add the path to the manifest in json output
This allows consumers of the json messages to avoid guessing where
exactly the package root is. Having access to the package root is
difficult by virtue of requiring logic to guess its location by e.g.
walking filesystem from the source file.

This guessing logic becomes further complicated in presence of
workspaces and nigh impossible to implement correctly in instances where
artifacts end up produced from paths above the package root (e.g.
`../foo.rs`).

Since Cargo has access to this data in the first place, there doesn't
seem to be much reason to force consumers to invent their own, possibly
flawed, logic.
2021-03-04 20:09:51 +02:00
Arpad Borsos
b4c4028f76
Run rustdoc doctests relative to the workspace
By doing so, rustdoc will also emit workspace-relative filenames for the doctests.

This was first landed in #8954 but later backed out in #8996 because it changed the CWD of rustdoc test invocations.

The second try relies on the new `--test-run-directory` rustdoc option which was added in https://github.com/rust-lang/rust/pull/81264 to explicitly control the rustdoc test cwd.

fixes #8993
2021-02-22 20:33:31 +01:00
CPerezz
cb21e6424b
Improve & fix doc dir removal process 2021-02-01 01:54:13 +01:00
CPerezz
7c45021328
Check target-dependant doc folders
When checking the fingerprint for rustdoc and applying
the corresponding logic, we don't only need to consider
the `target/doc` folder (Host target) but also triple targets.

So now the actual compilation targets are checked during the
rustdoc_fingerprint processing and they're treated as the Host/doc
folder.
2021-01-31 23:43:27 +01:00
CPerezz
d2572a2800
Address latest reivew suggestions
- Instead of `fs` we use the `utils::paths` functions
to interact with the filesystem.
- The doc fingerprint is now stored under `target/` instead
of `target/doc/`.
- The code in `compile` has been reduced to a single function call.
2021-01-27 01:14:31 +01:00
CPerezz
94519f2649
Create dirs if needed before f_p write call
Once `RustDocFingerprint::check_rustdoc_fingerprint()` is
executed it might happen that the `doc/` dir is removed.

This means that when we call `fingerprint.write()` we need
to create the `doc` directory again.
2021-01-26 00:54:41 +01:00
CPerezz
994ccec136
Address @ehuss suggestions/nits 2020-12-17 02:05:25 +01:00
CPerezz
ebd0d58c1c
Apply rustfmt 2020-12-16 09:39:51 +01:00
Carlos Pérez
31ef7affcb
Merge branch 'master' into doc_versioning 2020-12-16 09:32:39 +01:00
CPerezz
2fea14e449
Add tests for rustdoc fingerprint impl
- Check wether the fingerprint is created with the
correct data after a `rustdoc` execution.
- Check wether the previous docs are removed if the version
used to compile them reported in the fingerprint is different
from the actual one being used by the compiler.
2020-12-16 09:24:59 +01:00
Arpad Borsos
e729880f56 fix failures on linux 2020-12-07 09:25:49 +01:00
Arpad Borsos
2cc2ae8c96 Run rustdoc doctests relative to the workspace
By doing so, rustdoc will also emit workspace-relative filenames for
the doctests.

fixes #8097
2020-12-06 23:21:06 +01:00
Eric Huss
9b590d0dd4 Bump to 0.51.0 2020-11-23 17:34:18 -08:00
Weihang Lo
8f0664f02a
test: normalize raw string indentation. 2020-10-10 07:44:57 +08:00
Weihang Lo
f1de239450
test(doc): glob support for package selection 2020-10-05 01:24:42 +08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
CPerezz
7a5f7844aa Add skeleton for testing doc-fingerprint 2020-09-20 10:28:46 +02:00
Eric Huss
1b72e1fbf4 Fix intra-doc tests for renamed lint. 2020-08-01 09:52:11 -07:00
bors
dbbab42585 Auto merge of #8509 - ehuss:stabilize-crate-version, r=Eh2406
Stabilize -Z crate-versions

This stabilizes the `-Z crate-versions` flag which forwards the crate version to rustdoc so it can display the version in the sidebar.

The flag in rustdoc was stabilized in 1.44.

Closes #7907
2020-07-23 13:15:05 +00:00
Eric Huss
9e35ee1b93 Fix nightly tests for intra-doc links. 2020-07-22 19:11:01 -07:00
Eric Huss
3ce3d34071 Stabilize -Z crate-versions 2020-07-18 11:09:37 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Alex Tokarev
d3b9d89a38 Use stabilized version of rustdoc's --crate-version
Since --crate-version flag of rustdoc was stabilized, there is no need to enable its unstable features when using it.
2020-03-26 01:17:45 +03:00
Alex Tokarev
c9e3141b0f Do not supply --crate-version flag to rustdoc if present in RUSTDOCFLAGS or extra compiler arguments 2020-03-18 21:26:49 +03:00
Eric Huss
517b59dbb4 Enable cargo doc --open tests on macos. 2020-02-25 08:13:30 -08:00
Alex Tokarev
1ea41babdc Add an option to include crate versions to the generated docs
Fixes https://github.com/rust-lang/cargo/issues/1681
2020-02-21 00:34:33 +03:00
Eric Huss
10e9bc9dfe Fix doc_target test which no longer works on stable/beta. 2020-01-20 11:16:53 -08:00
Eric Huss
2ad6b5413a Update tests for slight wording change in rustdoc error message. 2019-11-29 13:59:56 -08:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Lukas Kalbertodt
00b21c8b46
Add tests for documenting private items by default in binary crates 2019-11-21 22:14:42 +01:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Eric Huss
ecf824f7b2 Update additional uses of --all.
- man pages
- Slightly reword deprecation notice.
- Include --all in man pages.
- Update some additional usages in code and docs.
2019-09-03 17:51:07 -07:00
Eric Huss
3c20a24335 Clean up some git test support functions. 2019-08-12 22:25:36 -07:00
Eric Huss
a59ea45c1a Fix documenting an example. 2019-06-08 14:18:51 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Eric Huss
87449f453b Remove unnecessary calls to masquerade_as_nightly_cargo.
These are not needed anymore.
2019-05-09 10:58:18 -07:00
Zach Lute
782266aaee Changed RUST_LOG usage to CARGO_LOG to avoid confusion. 2019-05-08 10:53:02 -07:00
Eric Huss
59af340d8f Allow cargo doc --open with multiple packages. 2019-03-31 15:47:03 -07:00
bors
a57b96dc52 Auto merge of #6786 - ehuss:remove-is_nightly-test-checks, r=dwijnand
Testsuite: remove some unnecessary is_nightly checks.
2019-03-26 23:45:46 +00:00
Eric Huss
50277e88fe Testsuite: remove some unnecessary is_nightly checks. 2019-03-26 13:56:14 -07:00
Eric Huss
27a95d0e74 Some fingerprint cleanup. 2019-03-26 13:22:49 -07:00
Eric Huss
a7fd6670d6 Relax some rustdoc tests. 2019-03-06 10:49:24 -08:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Andy Russell
eda10a468c
relax rustdoc output assertion 2019-01-17 13:15:14 -05:00
Philipp Hansch
5e62437eb9
Remove a nightly check from doc tests 2018-12-13 07:55:08 +01:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
81a7f472ed
lang items need feature gates 2018-10-16 11:52:48 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
4da662d2be
Future proof an unstable test
statics (even extern ones) will get their type checked for a `Sized` bound in order to fix https://github.com/rust-lang/rust/issues/54410
2018-10-15 20:45:39 +02:00
Joel Gallant
2e9ea1e21c Fixes doc::doc_edition test output (too many spaces) 2018-09-20 16:09:55 -06:00