| Age | Commit message (Collapse) | Author | Lines |
|
Rustdoc: only report broken ref-style links once
This PR assigns the markdown `LinkType` to each parsed link and passes this information into the link collector.
If a link can't be resolved in `resolve_with_disambiguator`, the failure is cached for the link types where we only want to report the error once (namely `Shortcut` and `Reference`).
Fixes #77681
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
r=jyn514
Add suggestion for "ignore" doc code block
Part of https://github.com/rust-lang/rust/issues/30032.
This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.
r? `@jyn514`
|
|
|
|
inside
|
|
Rustdoc render public underscore_imports as Re-exports
Fixes #61592
|
|
Fixes #61592
|
|
Revert "Cleanup markdown span handling"
Reverts rust-lang/rust#80244. This caused a diagnostic regression, originally it was:
```
warning: unresolved link to `std::process::Comman`
--> link.rs:3:10
|
3 | //! [a]: std::process::Comman
| ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process`
|
= note: `#[warn(broken_intra_doc_links)]` on by default
```
but after that PR rustdoc now displays
```
warning: unresolved link to `std::process::Comman`
--> link.rs:1:14
|
1 | //! Links to [a] [link][a]
| ^^^ no item named `Comman` in module `process`
|
= note: `#[warn(broken_intra_doc_links)]` on by default
```
which IMO is much less clear.
cc `@bugadani,` thanks for catching this in https://github.com/rust-lang/rust/pull/77859.
r? `@GuillaumeGomez`
|
|
Fix intra-doc links for non-path primitives
This does *not* currently work for associated items that are
auto-implemented by the compiler (e.g. `never::eq`), because they aren't
present in the source code. I plan to fix this in a follow-up PR.
Fixes https://github.com/rust-lang/rust/issues/63351 using the approach mentioned in https://github.com/rust-lang/rust/issues/63351#issuecomment-683352130.
r? `@Manishearth`
cc `@petrochenkov` - this makes `rustc_resolve::Res` public, is that ok? I'd just add an identical type alias in rustdoc if not, which seems a waste.
|
|
|
|
This caused a diagnostic regression, originally it was:
```
warning: unresolved link to `std::process::Comman`
--> link.rs:3:10
|
3 | //! [a]: std::process::Comman
| ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process`
|
= note: `#[warn(broken_intra_doc_links)]` on by default
```
but after that PR rustdoc now displays
```
warning: unresolved link to `std::process::Comman`
--> link.rs:1:14
|
1 | //! Links to [a] [link][a]
| ^^^ no item named `Comman` in module `process`
|
= note: `#[warn(broken_intra_doc_links)]` on by default
```
which IMO is much less clear.
|
|
This isn't actually a bug, it can occur when rustdoc tries to resolve a
crate that isn't used in the main code.
|
|
These caused several false positives when documenting rustc, which means
there will likely be many more false positives in the rest of the
ecosystem.
|
|
|
|
|
|
Improve attribute message error spans
I got the idea while working on https://github.com/rust-lang/rust/pull/79464
|
|
|
|
Move intra-doc link tests into a subdirectory
They were starting to get unwieldy.
r? ``@Manishearth``
|
|
libtest: Print the total time taken to execute a test suite
Print the total time taken to execute a test suite by default, without any kind of flag.
Closes #75660
# Example
```
anon@anon:~/code/rust/example$ cargo test
Compiling example v0.1.0 (/home/anon/code/rust/example)
Finished test [unoptimized + debuginfo] target(s) in 0.18s
Running target/debug/deps/example-745b64d3885c3565
running 3 tests
test tests::foo ... ok
test tests::bar ... ok
test tests::baz ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s
Doc-tests example
running 3 tests
test src/lib.rs - foo (line 3) ... ok
test src/lib.rs - bar (line 11) ... ok
test src/lib.rs - baz (line 19) ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s
```
```
anon@anon:~/code/rust/example$ cargo test -- --format terse
Finished test [unoptimized + debuginfo] target(s) in 0.08s
Running target/debug/deps/example-745b64d3885c3565
running 3 tests
...
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s
Doc-tests example
running 3 tests
...
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s
```
```
anon@anon:~/code/rust/example$ cargo test -- --format json -Z unstable-options
Compiling example v0.1.0 (/home/anon/code/rust/example)
Finished test [unoptimized + debuginfo] target(s) in 0.25s
Running target/debug/deps/example-745b64d3885c3565
{ "type": "suite", "event": "started", "test_count": 3 }
{ "type": "test", "event": "started", "name": "tests::bar" }
{ "type": "test", "event": "started", "name": "tests::baz" }
{ "type": "test", "event": "started", "name": "tests::foo" }
{ "type": "test", "name": "tests::foo", "event": "ok" }
{ "type": "test", "name": "tests::bar", "event": "ok" }
{ "type": "test", "name": "tests::baz", "event": "ok" }
{ "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.2s" }
Doc-tests example
{ "type": "suite", "event": "started", "test_count": 3 }
{ "type": "test", "event": "started", "name": "src/lib.rs - bar (line 11)" }
{ "type": "test", "event": "started", "name": "src/lib.rs - baz (line 19)" }
{ "type": "test", "event": "started", "name": "src/lib.rs - foo (line 3)" }
{ "type": "test", "name": "src/lib.rs - foo (line 3)", "event": "ok" }
{ "type": "test", "name": "src/lib.rs - bar (line 11)", "event": "ok" }
{ "type": "test", "name": "src/lib.rs - baz (line 19)", "event": "ok" }
{ "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.3s" }
```
|
|
Extend doc keyword feature by allowing any ident
Part of #51315.
As suggested by ``@danielhenrymantilla`` in [this comment](https://github.com/rust-lang/rust/issues/51315#issuecomment-733879934), this PR extends `#[doc(keyword = "...")]` to allow any ident to be used as keyword. The final goal is to allow (proc-)macro crates' owners to write documentation of the keywords they might introduce.
r? ``@jyn514``
|
|
This also changes the builder to allow using
`x.py test src/test/rustdoc-ui/intra-doc`; before, it would panic that
no paths were found.
|
|
|
|
|
|
|
|
Clean up rustdoc tests by removing unnecessary features
r? ``@jyn514``
|
|
|
|
|
|
|
|
|
|
|
|
Rustdoc check option
The ultimate goal behind this option would be to have `rustdoc --check` being run when you use `cargo check` as a second step.
r? `@jyn514`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Check html comments
Part of #67799.
cc @ollie27
r? @jyn514
|
|
Allow ascii whitespace char for doc aliases
Fixes issue from https://github.com/rust-lang/rust/issues/76705#issuecomment-703123847
cc @lopopolo @ollie27
r? @jyn514
|
|
|
|
|
|
rustdoc: skip #[allow(missing docs)] for docs in coverage report
During the document coverage reporting with:
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```
the coverage report counts code that is marked with `#[allow(missing_docs)]` for the calculation, which outputs lower numbers in the coverage report even though these parts should be ignored for the calculation.
Right now I'm not sure how this can be tested (CI)? (I verified it by hand and ran the unit tests)
r? `@jyn514`
**Reference:** Fixes #76121
|
|
|
|
|
|
|
|
During the document coverage reporting with
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```
the coverage report also includes parts of the code that are marked
with `#[allow(missing_docs)]`, which outputs lower numbers in the
coverage report even though these parts should be ignored for the
calculation.
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|