about summary refs log tree commit diff
path: root/src/test/rustdoc/intra-doc
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1550/+0
2022-11-13rustdoc: Resolve doc links in external traits having local implsVadim Petrochenkov-0/+14
2022-10-30rustdoc: Do not add external traits to the crate in `register_res`Vadim Petrochenkov-0/+12
It's not clear why it was done, and apparently it's no longer necessary now. Such additions are unpredictable for early doc link resolution and would force us to collect all doc links from all external traits.
2022-10-16rustdoc: Do not expect `doc(primitive)` modules to always existVadim Petrochenkov-0/+15
2022-10-10Update rustdoc testsGuillaume Gomez-1/+1
2022-08-13Rename `@hastext` to `@hasraw` (same for `matches`)Noah Lev-3/+3
I think `@hasraw` is slightly clearer than `@hastext` since it is actually matching against the raw HTML, not the text nodes.
2022-08-13Update tests: arity-2 `@{has,matches}` -> `...text`Noah Lev-3/+3
2022-08-09Fix failing testNoah Lev-1/+1
For some reason, adding some text to match against makes this test pass. Before, when it was *more* general, it was failing! This seems very likely to be a bug in htmldocck, which I'm going to investigate.
2022-08-09Add regression test for #93205Noah Lev-0/+20
This issue was most likely fixed by #93805.
2022-07-03Remove FIXME from rustdoc intra-doc testGuillaume Gomez-12/+2
2022-05-27rustdoc: add test case for email that looks like intra-doc linkMichael Howell-2/+4
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-0/+4
2022-03-31rustdoc: Fix resolution of `crate`-relative paths in doc linksVadim Petrochenkov-0/+17
2022-03-30fix rustdoc wrt builtin impls switchlcnr-10/+9
2022-03-30update rustdoclcnr-2/+1
2022-03-30update ui testslcnr-0/+1
2022-03-06Auto merge of #93805 - petrochenkov:doclinkself, r=camelid,GuillaumeGomezbors-0/+8
rustdoc: Stop textually replacing `Self` in doc links before resolving them Resolve it directly to a type / def-id instead. Also never pass `Self` to `Resolver`, it is useless because it's guaranteed that no resolution will be found. This is a pre-requisite for https://github.com/rust-lang/rust/issues/83761.
2022-02-18rustdoc: Collect traits in scope for lang itemsVadim Petrochenkov-0/+40
2022-02-13rustdoc: Consider enum variants when resolving assoc items in doc linksVadim Petrochenkov-0/+8
2022-02-04rustdoc: Collect traits in scope for foreign inherent implsVadim Petrochenkov-0/+19
2022-01-28rustdoc: load the set of in-scope traits for modules with no docstringMichael Howell-0/+30
Fixes #93428 This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates: * The module id is always set to the current crate, when checking `crate::`. Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run. * the module id is set to the parent module, when resolving a module that is spelled like this: // Notice how we use an outlined doc comment here! // [`Test::my_fn`] mod something { } As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.
2022-01-16Rollup merge of #92792 - mdibaiee:92662/fix-intra-doc-generics, r=camelidMatthias Krüger-2/+42
rustdoc: fix intra-link for generic trait impls fixes #92662 r? `````@camelid`````
2022-01-13rustdoc: add intra-doc trait impl test for extern typesMahdi Dibaiee-2/+23
2022-01-13rustdoc: fix intra-link for generic trait implsMahdi Dibaiee-0/+19
2022-01-10Enable ignored part of testNoah Lev-4/+5
Inherent associated types *are* supported, just unstable.
2022-01-10Move two intra-doc-link tests into the `intra-doc` folderNoah Lev-0/+50
2022-01-05add a test case for each supported primitive typeMahdi Dibaiee-3/+42
2022-01-05Rustdoc: resolve associated traits for primitive typesMahdi Dibaiee-0/+7
Fixes #90703
2021-12-05Auto merge of #91356 - GuillaumeGomez:improve-rustdoc-layout, r=jshabors-11/+8
Improve rustdoc layout This is an overtake of https://github.com/rust-lang/rust/pull/89385 originally written by `@cynecx.` I kept the original commit and simply added the missing fixes into a new one. You can test it online [here](https://rustdoc.crud.net/imperio/improve-rustdoc-layout/std/index.html). r? `@jsha`
2021-12-02Rename ID "main" into "main-content"Guillaume Gomez-11/+8
2021-11-28Fix warnings in rustdoc HTML testsNoah Lev-73/+46
Now that compiletest denies warnings in these tests, they need fixing!
2021-09-22Run no_core rustdoc tests on Linux only.Hans Kratz-1/+1
Windows on Macos ARM64 produce linker errors.
2021-09-12Fix broken handling of primitive itemsJoshua Nelson-5/+24
- Fix broken handling of primitive associated items - Remove fragment hack Fixes 83083 - more logging - Update CrateNum hacks The CrateNum has no relation to where in the dependency tree the crate is, only when it's loaded. Explicitly special-case core instead of assuming it will be the first DefId. - Update and add tests - Cache calculation of primitive locations This could possibly be avoided by passing a Cache into collect_intra_doc_links; but that's a much larger change, and doesn't seem valuable other than for this.
2021-08-26Fix the bugs and add a regression testJoshua Nelson-0/+8
- All attributes for an item need to be considered at once, they can't be considered a line at a time. - The top-level crate was not being visited. This bug was caught by `extern-crate-used-only-in-link`, which I'm very glad I added. - Make the loader private to the module, so that only one function is exposed.
2021-08-22Revert "Revert "Don't load all extern crates unconditionally""Joshua Nelson-0/+10
This reverts commit 5f0c54db4e595a6a77048f2b0605138ffa49a326.
2021-06-23Rollup merge of #86523 - LeSeulArtichaut:macros-disambiguators, r=jyn514Dylan DPC-0/+25
Improvements to intra-doc link macro disambiguators A few small improvements around macro disambiguators: - display the link text as it was entered: previously `[macro!()]` would be displayed without the parantheses (fixes #86309) - support `!{}` and `![]` as macro disambiguators (fixes #86310) r? `@jyn514` cc `@Manishearth` `@camelid`
2021-06-22Add test for macro disambiguatorsLeSeulArtichaut-0/+25
2021-06-21Resolve type aliases to the type they point to in intra-doc linksLeSeulArtichaut-0/+19
2021-06-07use channel-relative urls in rustdoc/intra-doc/field.rsPietro Albini-2/+2
2021-06-05Rollup merge of #84942 - jyn514:channel-replace, r=ManishearthYuki Okushi-60/+60
rustdoc: link to stable/beta docs consistently in documentation This is an alternative to https://github.com/rust-lang/rust/pull/84941 which fixes the problem consistently by linking to stable/beta for *all* items, not just for primitives. ## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel cc Mark-Simulacrum - I know [you were dubious about this in the past](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Rustdoc.20unconditionally.20links.20to.20nightly.20libstd.20docs/near/231223124), but I'm not quite sure why? I see this as "just a bugfix", I don't know why rustdoc should unconditionally link to nightly. cc dtolnay who commented in https://github.com/rust-lang/rust/issues/30693: > I would welcome a PR to solve this permanently if anyone has ideas for how. I don't believe we need an RFC. Fixes https://github.com/rust-lang/rust/issues/30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2021-06-04rustdoc: link to stable/beta docs consistently in documentationJoshua Nelson-60/+60
## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel
2021-05-03Make match in `register_res` easier to readJoshua Nelson-0/+4
- Don't duplicate DefKind -> ItemType handling; that's a good way to get bugs - Use exhaustive match - Add comments This found that register_res is very wrong in at least one way: if it registers a Res for `Variant`, it should also register one for `Field`. But I don't know whether the one for Variant should be removed or Field added. Maybe someone has ideas?
2021-04-17rustdoc: use more precise relative URLSMichael Howell-88/+88
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter. Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping). $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html 2387389 struct.Wrapping.old.html 2298538 struct.Wrapping.new.html Most if it can be efficiently gzipped away. $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz 70679 struct.Wrapping.old.html.gz 70050 struct.Wrapping.new.html.gz But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-10Preprocess intra-doc links consistentlyJoshua Nelson-1/+14
Previously, rustdoc would panic on links to external crates if they were surrounded by backticks.
2021-04-06Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadaniYuki Okushi-2/+13
rustdoc: Cleanup handling of associated items for intra-doc links Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time. r? ```@bugadani``` maybe? Feel free to reassign :)
2021-04-05Use more appropriate return type for `resolve_associated_item`Joshua Nelson-2/+13
Previously, the types looked like this: - None means this is not an associated item (but may be a variant field) - Some(Err) means this is known to be an error. I think the only way that can happen is if it resolved and but you had your own anchor. - Some(Ok(_, None)) was impossible. Now, this returns a nested Option and does the error handling and fiddling with the side channel in the caller. As a side-effect, it also removes duplicate error handling. This has one small change in behavior, which is that `resolve_primitive_associated_item` now goes through `variant_field` if it fails to resolve something. This is not ideal, but since it will be quickly rejected anyway, I think the performance hit is worth the cleanup. This also fixes a bug where struct fields would forget to set the side channel, adds a test for the bug, and ignores `private_intra_doc_links` in rustc_resolve (since it's always documented with --document-private-items).
2021-04-05Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514Dylan DPC-0/+6
Don't report disambiguator error if link would have been ignored Fixes #83859. This prevents us from warning on links such as `<hello@example.com>`. Note that we still warn on links such as `<hello@localhost>` because they have no dots in them. However, the links will still work, even though a warning is reported. r? ````@jyn514````
2021-04-04Don't report disambiguator error if link would have been ignoredCamelid-0/+6
This prevents us from warning on links such as `<hello@example.com>`. Note that we still warn on links such as `<hello@localhost>` because they have no dots in them. However, the links will still work, even though a warning is reported.
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-16/+0
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-04-02Don't load all extern crates unconditionallyJoshua Nelson-0/+10
Instead, only load the crates that are linked to with intra-doc links. This doesn't help very much with any of rustdoc's fundamental issues with freezing the resolver, but it at least fixes a stable-to-stable regression, and makes the crate loading model somewhat more consistent with rustc's.