about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2021-08-19Give precedence to `html_root_url` over `--extern-html-root-url` by default, ↵Joshua Nelson-3/+25
but add a way to opt-in to the previous behavior ## What is an HTML root url? It tells rustdoc where it should link when documentation for a crate is not available locally; for example, when a crate is a dependency of a crate documented with `cargo doc --no-deps`. ## What is the difference between `html_root_url` and `--extern-html-root-url`? Both of these tell rustdoc what the HTML root should be set to. `doc(html_root_url)` is set by the crate author, while `--extern-html-root-url` is set by the person documenting the crate. These are often different. For example, docs.rs uses `--extern-html-root-url https://docs.rs/crate-name/version` to ensure all crates have documentation, even if `html_root_url` is not set. Conversely, crates such as Rocket set `doc(html_root_url = "https://api.rocket.rs")`, because they prefer users to view the documentation on their own site. Crates also set `html_root_url` to ensure they have documentation when building locally when offline. This is unfortunate to require, because it's more work from the library author. It also makes it impossible to distinguish between crates that want to be viewed on a different site (e.g. Rocket) and crates that just want documentation to be visible offline at all (e.g. Tokio). I have authored a separate change to the API guidelines to no longer recommend doing this: https://github.com/rust-lang/api-guidelines/pull/230. ## Why change the default? In the past, docs.rs has been the main user of `--extern-html-root-url`. However, it's useful for other projects as well. In particular, Cargo wants to pass it by default when running `--no-deps` (https://github.com/rust-lang/cargo/issues/8296). Unfortunately, for these other use cases, the priority order is inverted. They want to give *precedence* to the URL the crate picks, and only fall back to the `--extern-html-root` if no `html_root_url` is present. That allows passing `--extern-html-root` unconditionally, without having to parse the source code to see what attributes are present. For docs.rs, however, we still want to keep the old behavior, so that all links on docs.rs stay on the site.
2021-08-05Fix URL conflict for std typeGuillaume Gomez-1/+1
2021-08-05Add missing root_path when generating links using hrefGuillaume Gomez-3/+9
2021-08-05Generate links for modules as wellGuillaume Gomez-4/+5
2021-08-05Add test for source code pages URLsGuillaume Gomez-0/+55
2021-07-29Rollup merge of #87451 - GuillaumeGomez:tuple-struct-field-doc, r=jyn514Yuki Okushi-2/+38
Add support for tuple struct field documentation Fixes #42615. This is #80320 updated to new codebase and with added tests. Part of https://github.com/rust-lang/rust/issues/83255. cc ```@camelid``` (since you were involved on the original PR). r? ```@jyn514```
2021-07-27Make all tests use type_alias_impl_trait feature instead of minSantiago Pastorino-3/+3
2021-07-26Add test for enum item tuple fields documentationGuillaume Gomez-2/+19
2021-07-25Auto merge of #87390 - notriddle:notriddle/rustdoc-headers-patch, ↵bors-191/+191
r=GuillaumeGomez Rustdoc accessibility: use real headers for doc items Part of #87059 Partially reverts #84703 Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
2021-07-25Rustdoc accessibility: use real headers for doc itemsbors-191/+191
Part of #87059 Partially reverts #84703 Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
2021-07-25Add test for tuple struct documentation fieldsGuillaume Gomez-0/+19
2021-07-22Don't hide fields of enum struct variantsNoah Lev-4/+2
* The toggle adds visual clutter * It's easy to miss that there are fields * Tuple variant fields are always shown, so it is inconsistent to hide struct variant fields * It's annoying to have to click the toggle every time
2021-07-22Rollup merge of #87288 - ijackson:rustdoc-theme, r=GuillaumeGomezGuillaume Gomez-0/+7
rustdoc: Restore --default-theme, etc, by restoring varname escaping In #86157 cd0f93193c84ddc6698f9b65909da71c084dcb74 Use Tera templates for rustdoc. dropped the following transformation from the keys of the default settings element's `data-` attribute names: .map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v))) The `Escape` part is indeed no longer needed, because Tera does that for us. But the massaging of `-` to `_` is needed, for the (bizarre) reasons explained in the new comments. I have tested that the default theme function works again for me. I have also verified that passing (in shell syntax) '--default-theme="zork&"' escapes the value in the HTML. Closes #87263
2021-07-22Add tests for default-settingsGuillaume Gomez-0/+7
2021-07-21Rollup merge of #87024 - weihanglo:issue-85494, r=ManishearthEric Huss-7/+38
rustdoc: show count of item contents when hidden Resolves #85494
2021-07-17Fix test cases for header titles in sidebarMichael Howell-11/+11
2021-07-16Auto merge of #86662 - mockersf:fix-86620-link-unknown-location, r=jyn514bors-0/+22
fix dead link for method in trait of blanket impl from third party crate fix #86620 * changes `href` method to raise the actual error it had instead of an `Option` * set the href link correctly in case of an error I did not manage to make a small reproducer, I think it happens in a situation where * crate A expose a trait with a blanket impl * crate B use the trait from crate A * crate C use types from crate B * building docs for crate C without dependencies r? `@jyn514`
2021-07-15add assertions on existing tests with missing doc sourceFrançois Mockers-0/+2
2021-07-12Auto merge of #86841 - GuillaumeGomez:reexported-macro-2-render, r=Stupremeebors-0/+142
Fix rendering of reexported macros 2.0 and fix visibility of reexported items So, this PR grew a bit out of focus, it does the following things: * Fixes #86276. * Fixes visibility display for reexported items: it now takes the visibility of the "use" statement rather than the visibility of the reexported item itself). * Fixes the display of reexported items if "--document-private-items" option is used. Before, they were simply skipped. * Fixes inconsistency on typedef items: they didn't display their visibility contrary to other items. I added tests to check everything listed above. cc `@camelid` `@ollie27` (in case one of you want to review?) r? `@jyn514`
2021-07-11rustdoc: test count of item contents when hiddenWeihang Lo-7/+38
2021-07-10Change all 'optflag' arguments to 'optflagmulti'Zach Lute-0/+4
Because specifying these flags multiple times will never be discernibly different in functionality from specifying them a single time, there is no reason to fail and report an error to the user.
2021-07-07Only show restricted pub useGuillaume Gomez-0/+5
2021-07-07Add tests for reexports (both public and private)Guillaume Gomez-14/+137
2021-07-07Add test for reexported macros 2.0 renderingGuillaume Gomez-0/+14
2021-07-06add check on anchor linkFrançois Mockers-0/+1
2021-07-06add mcve as testFrançois Mockers-0/+19
2021-07-05Auto merge of #86282 - camelid:macro_rules-matchers, r=jyn514bors-10/+55
Pretty-print macro matchers instead of using source code Fixes #86208.
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-15/+19
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-07-03Pretty-print macro matchers instead of using source codeNoah Lev-15/+14
The output is not quite as nice as it used to be, but it does work.
2021-07-01Revert "Don't load all extern crates unconditionally"Guillaume Gomez-0/+12
2021-06-28Add regression test for #86208Noah Lev-0/+42
This test does not test the output as well as I would like, but I think I am limited by htmldocck. I would really just like to strip all the HTML tags from the output for the sake of the different `@has` checks, but that doesn't seem to be currently possible.
2021-06-28Add test for item-table with resize to mobileStefan Schindler-10/+13
2021-06-26Auto merge of #86449 - Stupremee:render-self-cast-in-type-bound, ↵bors-1/+30
r=GuillaumeGomez rustdoc: Render `<Self as X>::Y` type casts properly across crate bounds My last PR that introduced the type casting did not work for cross-crate re-exported traits, which is fixed in this PR. Fully resolves #85454
2021-06-26Auto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomezbors-12/+61
Properly render HRTBs ```rust pub fn test<T>() where for<'a> &'a T: Iterator, {} ``` This will now render properly including the `for<'a>` ![image](https://user-images.githubusercontent.com/39732259/116808426-fe6ce600-ab38-11eb-9452-f33f554fbb8e.png) I do not know if this covers all cases, it only covers everything that I could think of that includes `for` and lifetimes in where bounds. Also someone need to mentor me on how to add a proper rustdoc test for this. Resolves #78482
2021-06-26Rollup merge of #86513 - fee1-dead:cross-crate-doc-hidden, r=danielhenrymantillaYuki Okushi-0/+76
Rustdoc: Do not list impl when trait has doc(hidden) Fixes #86448.
2021-06-25Renamed test and added test for same crateDeadbeef-3/+39
2021-06-24Migrate from custom elements to divs with classes to be compatible with safariStefan Schindler-54/+56
2021-06-24Fixing the test rustdoc by ignoring ↵Stefan Schindler-3/+3
`*[@id="module-item"]//following-sibling::item-right` relationship and rustdoc-gui
2021-06-24Implement Desktop and Mobile version with gridlayoutStefan Schindler-15/+15
* implement sans-serif #85621
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-22Account for more casesDeadbeef-4/+19
2021-06-22Rollup merge of #86334 - LeSeulArtichaut:86120-links-type-aliases, r=jyn514Yuki Okushi-0/+19
Resolve type aliases to the type they point to in intra-doc links This feels a bit sketchy, but I think it's better than just rejecting the link. Helps with #86120, r? ``@jyn514``
2021-06-22Do not list impl when trait has doc(hidden)Deadbeef-0/+25
2021-06-21Readd `unsafe` keyword in testsDeadbeef-6/+6
2021-06-21Removed/Updated some cases and simplified `match`Deadbeef-28/+3
2021-06-21Added some tests for `unsafe` in const-dispay.rsDeadbeef-6/+47
2021-06-21Check for const_unstable before printing `const`Deadbeef-4/+4
2021-06-21Resolve type aliases to the type they point to in intra-doc linksLeSeulArtichaut-0/+19
2021-06-20"(const: unstable)" for stable-but-const-unstableDeadbeef-0/+2