about summary refs log tree commit diff
path: root/src/test/rustdoc/auxiliary
AgeCommit message (Collapse)AuthorLines
2021-08-19Give precedence to `html_root_url` over `--extern-html-root-url` by default, ↵Joshua Nelson-0/+3
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-05Add missing root_path when generating links using hrefGuillaume Gomez-0/+1
2021-08-05Add test for source code pages URLsGuillaume Gomez-0/+17
2021-07-27Make all tests use type_alias_impl_trait feature instead of minSantiago Pastorino-1/+1
2021-07-16Auto merge of #86662 - mockersf:fix-86620-link-unknown-location, r=jyn514bors-0/+11
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-07Add tests for reexports (both public and private)Guillaume Gomez-6/+42
2021-07-07Add test for reexported macros 2.0 renderingGuillaume Gomez-0/+6
2021-07-06add mcve as testFrançois Mockers-0/+11
2021-07-01Revert "Don't load all extern crates unconditionally"Guillaume Gomez-0/+2
2021-06-26Auto merge of #86449 - Stupremee:render-self-cast-in-type-bound, ↵bors-0/+17
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-25Renamed test and added test for same crateDeadbeef-0/+0
2021-06-22Account for more casesDeadbeef-0/+3
2021-06-22Do not list impl when trait has doc(hidden)Deadbeef-0/+2
2021-06-18rustdoc: Render `<Self as X>::Y` type casts properly across crate boundsJustus K-0/+17
2021-06-04Remove `doc(include)`Joshua Nelson-6/+4
2021-05-03Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514Dylan DPC-0/+3
Do not print visibility in external traits This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid. It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible. Resolves #81274
2021-05-02PR feedbackScott McMurray-0/+3
2021-05-02Do not print visibility in external traitsJustus K-0/+3
2021-04-17rustdoc: use more precise relative URLSMichael Howell-0/+6
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-02Don't load all extern crates unconditionallyJoshua Nelson-2/+0
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.
2021-03-15Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no ↵Oli Scherer-1/+1
actual changes in behaviour This makes `type_alias_impl_trait` not actually do anything anymore
2021-01-13Update tests for extern block lintingMark Rousskov-1/+1
2021-01-06Update test assertions (showcases bug)Daniel Henry-Mantilla-1/+1
2021-01-06Fix type/value namespace clashes + test for thatDaniel Henry-Mantilla-0/+13
2020-12-31Rustdoc render public underscore_imports as Re-exportsbors-0/+4
Fixes #61592
2020-11-28Move `src/test/rustdoc` intra-doc link tests into a subdirectoryJoshua Nelson-98/+0
They were starting to get unwieldy.
2020-11-26Auto merge of #77467 - jyn514:query-docs, r=oli-obkbors-0/+12
Normalize `<X as Y>::T` for rustdoc - Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved The first commit is a pure refactor and should probably be reviewed by `@GuillaumeGomez.` I recommend reviewing the second commit on its own. Fixes https://github.com/rust-lang/rust/issues/77459. r? `@eddyb` cc `@danielhenrymantilla` , `@lcnr`
2020-11-24Use the name "auto traits" everywhere in the compilerCamelid-1/+1
Goodbye, OIBIT!
2020-11-24Normalize `<X as Y>::T` for rustdocJoshua Nelson-0/+12
- Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved - Show what the behavior is if the type can't be normalized - Run `resolve_vars_if_possible` It's not clear whether or not this is necessary. See https://github.com/rust-lang/rust/pull/77616 for more context. - Add a test for cross-crate re-exports - Use the same code for both `hir::Ty` and `Ty`
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-3/+3
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-10-11Show summary lines on cross-crate re-exportsJoshua Nelson-0/+8
This removes the unnecessary `DocFragmentKind::Divider` in favor of just using the logic I actually want in `collapse_docs`.
2020-09-27Resolve `crate` properly across cratesJoshua Nelson-0/+5
2020-09-13Add ui test for 74672 and 76571Lzu Tao-0/+28
These tests will fall without the next commit.
2020-08-30Improve testsJoshua Nelson-0/+4
Now this actually tests the links are generated correctly
2020-08-08Cross-crate doc inlining test case for elided lifetimeGary Guo-0/+11
2020-07-19Only skip impls of foreign unstable traitsMark Rousskov-0/+26
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
2020-07-08Apply #![crate_type = "rlib"] directly to the linkerSeth Pellegrino-0/+1
2020-07-06Two new rustdoc tests for intra linksSeth Pellegrino-0/+18
They both produce less-than-desirable output (links going to docs.rust-lang.org), but I haven't figured out yet how to assert about them properly.
2020-06-11Add more tests for type alias impl TraitMatthew Jasper-0/+17
2020-06-10Avoid collisions between traits and their derive macrosManish Goregaokar-0/+5
2020-06-09Add test for proc macro resolution in intra doc linksManish Goregaokar-0/+30
2020-04-29rustdoc supports const re-exportsMark Rousskov-0/+0
2020-04-08rustdoc: Don't try to load source files from external cratesOliver Middleton-0/+15
Local items defined in external macros shouldn't generate rendered source files and should link to the external crate's docs instead.
2020-01-26rustdoc: Fix re-exporting primitive typesOliver Middleton-0/+8
* Generate links to the primitive type docs for re-exports. * Don't ICE on cross crate primitive type re-exports. * Make primitive type re-exports show up cross crate.
2019-11-08rustdoc: Deliberately load extern crates before processing docsDaniel Silverstone-0/+2
In order that we can successfully later resolve paths in crates which weren't loaded as a result of merely parsing the crate we're documenting, we force the resolution of the path to each crate before cloning the resolver to use later. Closes #66159 Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-09-27Auto merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomezbors-0/+16
Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output Fixes #57180
2019-08-28Add regression test for issue, apply suggestion to convert to assert_eqPaul Daniel Faria-0/+16
2019-08-26add regression testEsteban Küber-0/+20
2019-04-22Remove double trailing newlinesvarkor-1/+0
2019-04-11Auto merge of #58972 - QuietMisdreavus:intra-doc-link-imports, r=GuillaumeGomezbors-0/+6
rustdoc: don't process `Crate::external_traits` when collecting intra-doc links Part of https://github.com/rust-lang/rust/issues/58745, closes https://github.com/rust-lang/rust/pull/58917 The `collect-intra-doc-links` pass keeps track of the modules it recurses through as it processes items. This is used to know what module to give the resolver when looking up links. When looking through the regular items of the crate, this works fine, but the `DocFolder` trait as written doesn't just process the main crate hierarchy - it also processes the trait items in the `external_traits` map. This is useful for other passes (so they can strip out `#[doc(hidden)]` items, for example), but here it creates a situation where we're processing items "outside" the regular module hierarchy. Since everything in `external_traits` is defined outside the current crate, we can't fall back to finding its module scope like we do with local items. Skipping this collection saves us from emitting some spurious warnings. We don't even lose anything by skipping it, either - the docs loaded from here are only ever rendered through `html::render::document_short` which strips any links out, so the fact that the links haven't been loaded doesn't matter. Hopefully this removes most of the remaining spurious resolution warnings from intra-doc links. r? @GuillaumeGomez