Commit Graph

36 Commits

Author SHA1 Message Date
Guillaume Gomez
2b9e41c128 Improve documentation for intra-doc links computation 2024-10-15 15:42:53 +02:00
Guillaume Gomez
d540e7285c Add regression tests for #130233 2024-10-14 17:51:37 +02:00
Michael Howell
3686e59913 rustdoc: cleaner errors on disambiguator/namespace mismatches 2024-10-04 09:56:53 -07:00
Michael Howell
253fec494f rustdoc: prevent ctors from resolving 2024-10-03 22:01:23 -07:00
Noa
e91e01509e
Add field@ and variant@ doc-link disambiguators 2024-09-19 19:16:53 -05:00
Jane Losare-Lusby
b174cf827b Integrate crlf directly into related test file instead via of .gitattributes 2024-08-06 13:19:48 -07:00
Esteban Küber
b61570ac11 Structured suggestion for extern crate foo when foo isn't resolved in import
When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate.

When encountering `_` in an import, do not suggest `extern crate _;`.

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ maybe a missing crate `spam`?
   |
help: consider importing the `spam` crate
   |
LL + extern crate spam;
   |
```
2024-07-29 23:49:51 +00:00
Esteban Küber
850faea030 Do not use question as label
We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might":

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ you might be missing crate `spam`
   |
   = help: consider adding `extern crate spam` to use the `spam` crate
```
2024-07-24 21:03:27 +00:00
Michael Howell
98642da6a9 rustdoc: point at span in include_str!-ed md file 2024-03-29 13:31:35 -07:00
许杰友 Jieyou Xu (Joe)
6e48b96692
[AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
George-lewis
d56cdd48cb Bless tests
Update tests
2024-01-13 12:46:58 -05:00
Nilstrieb
87a354b15d Bless rustdoc-ui tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Alex Macleod
5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
Lukas Markeffsky
237ed1630f add tests for broken links in unused doc strings 2023-07-22 13:02:49 +02:00
Michael Howell
1a77d9a54d rustdoc: get unnormalized link destination for suggestions
Fixes #110111

This bug, and the workaround in this commit, is closely linked to
[raphlinus/pulldown-cmark#441], getting offsets of link
components. In particular, pulldown-cmark doesn't provide the
offsets of the contents of a link.

To work around this, rustdoc parser parts of a link definition
itself.

[raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-26 18:38:46 -07:00
Guillaume Gomez
bcdfda1b6b Add regression test for #111189 2023-05-23 15:33:43 +02:00
jyn
5da288f842 move lint tests into subdirectories 2023-04-29 11:36:19 -05:00
jyn
5fa975142f Move some rustdoc-ui tests to subdirectories 2023-04-29 11:36:19 -05:00
jyn
a1d47188a7
Rollup merge of #110329 - aDotInTheVoid:json-inline-again, r=jyn514
Improve tests for #110138

These should live in rustdoc-json, not rustdoc-ui, so we can run assertions, and not just check there's no ICE

CC #100515, as we never document this suite

r? rustdoc
2023-04-26 01:55:51 -05:00
Michael Howell
df8a48fc8a rustdoc: fix ICE from rustc_resolve and librustdoc parse divergence 2023-04-18 12:22:13 -07:00
Alona Enraght-Moony
e3de409aaa Move test from rustdoc-ui to rustdoc-json 2023-04-14 18:19:49 +00:00
bohan
c127020b0f fix(doc): do not parse inline when output is json for external crate 2023-04-10 23:02:08 +08:00
Rémy Rakic
4e235a7fa9 Bless rustdoc-ui test with new errors order
The order in which the multiple errors for the ambiguous intra doc links
are printed is different.
2023-04-05 15:59:29 +00:00
Guillaume Gomez
8fe5b56b66
Rollup merge of #109104 - GuillaumeGomez:fix-invalid-suggestion-ambiguous-intra-doc2, r=oli-obk,notriddle
rustdoc: Fix invalid suggestions on ambiguous intra doc links v2

Fixes https://github.com/rust-lang/rust/issues/108653.

This is another approach to fixing the same issue. This time, we keep the computed information around instead of re-computing it.

Strangely enough, the order for ambiguities seem to have been changed. Not an issue but it creates a lot of diff...

So which version do you prefer?

r? `@notriddle`
2023-03-31 22:32:48 +02:00
Guillaume Gomez
415a3ca909 Put back is_derive_trait_collision check 2023-03-24 16:10:31 +01:00
Guillaume Gomez
ec43cb3e9c Update UI tests for primitive type ambiguity error renaming 2023-03-24 14:50:12 +01:00
Guillaume Gomez
c78ebab258 Add regression tests for #108653 2023-03-24 13:41:21 +01:00
Vadim Petrochenkov
bec4eab3f9 rustdoc: Skip doc link resolution for non-exported items 2023-03-23 16:19:59 +04:00
Vadim Petrochenkov
d3a5541939 rustdoc: Cleanup parent module tracking for doc links
Keep ids of the documented items themselves, not their parent modules.
Parent modules can be retreived from those ids when necessary.
2023-03-21 17:36:57 +04:00
Vadim Petrochenkov
5e0fc0459e rustdoc: Correctly merge import's and its target's docs in one more case 2023-03-17 18:46:27 +04:00
Oli Scherer
37e2f4f487 Make configure_and_expand "infalllible" by just aborting the compilation if it fails instead of bubbling out an error 2023-02-20 15:28:59 +00:00
Dylan DPC
4a0f088f7c
Rollup merge of #107951 - petrochenkov:procmacdoc, r=jackh726
resolve: Fix doc links referring to other crates when documenting proc macro crates directly

Fixes https://github.com/rust-lang/rust/issues/107950
2023-02-19 13:03:41 +05:30
Vadim Petrochenkov
ccdb598d1b rustdoc: Cleanup broken link callbacks 2023-02-18 14:45:01 +04:00
Vadim Petrochenkov
efbf6547cf resolve: Fix doc links referring to other crates when documenting proc macro crates directly 2023-02-13 00:51:29 +04:00
clubby789
ef8de38c84 rustdoc: Don't resolve link to field on different variant 2023-02-11 12:28:35 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00