about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-15735/+0
2023-01-06Update testsclubby789-0/+6
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-22Auto merge of #106034 - matthiaskrgr:rollup-2zpql33, r=matthiaskrgrbors-0/+14
Rollup of 8 pull requests Successful merges: - #104741 (Switch `#[track_caller]` back to a no-op unless feature gate is enabled) - #105769 (add function to tell the identical errors for ambiguity_errors) - #105843 (Suggest associated const on possible capitalization mistake) - #105966 (Re-enable `Fn` trait call notation error for non-tuple argument) - #106002 (codegen tests: adapt patterns to also work with v0 symbol mangling) - #106010 (Give opaque types a better coherence error) - #106016 (rustdoc: simplify link anchor to section expand JS) - #106024 (Fix ICE due to `todo!()` in `rustdoc` for `Term`s) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-22Auto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, r=notriddlebors-0/+43
Fix impl block in const expr Fixes #83026. The problem was that we didn't visit block expressions. Considering how big the [walk_expr](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_hir/intravisit.rs.html#678) function is, I decided to instead implement the `hir` visitor on the struct. It also answers the question which was in a comment for `RustdocVisitor`: we should have used a visitor instead of our ad-hoc implementation. Adding this visitor also added some extra checks that weren't present before (check changes in `rustdoc-ui` tests). r? `@notriddle`
2022-12-22Fix ICEkadmin-0/+14
Left a todo awhile ago (I think), so fill it in to print a const for `Term`s.
2022-12-16Add test for presence of read more linksGuillaume Gomez-2/+34
2022-12-12rustdoc: stop treating everything in a trait item as a methodMichael Howell-0/+7
This was added in 0b9b4b70683db6ef707755f520f139eb7b92a944 to fix the spacing on trait pages, but stopped being needed because 791f04e5a47ee78951552c7ed1545b2b01a44c74 stopped styling method-toggle. By only putting the method-toggle class on actual methods, the JS setting does the right thing.
2022-12-08Update rustdoc test to check its error outputGuillaume Gomez-10/+0
2022-12-07Add regression test for impl blocks in const exprGuillaume Gomez-0/+43
2022-12-02Update existing rustdoc testsGuillaume Gomez-6/+6
2022-12-02Add rustdoc test for bounds de-duplication and mergeGuillaume Gomez-0/+20
2022-11-28rustdoc: remove `fnname` CSS class that's styled exactly like `fn`Michael Howell-27/+27
It's not obvious why this was ever a separate class name, since even in c4219a478354b464079b1b7ab081e071e8e39765 when it was first added, it was styled identically to regular `fn` links.
2022-11-27Add rustdoc test for Deref to primitive typesGuillaume Gomez-0/+15
2022-11-17rustdoc: update tests for enum variant margin tweakMichael Howell-5/+5
2022-11-15Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgrbors-0/+13
Rollup of 13 pull requests Successful merges: - #103842 (Adding Fuchsia compiler testing script, docs) - #104354 (Remove leading newlines from `NonZero*` doc examples) - #104372 (Update compiler-builtins) - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`) - #104381 (Remove dead NoneError diagnostic handling) - #104383 (Remove unused symbols and diagnostic items) - #104391 (Deriving cleanups) - #104403 (Specify language of code comment to generate document) - #104404 (Fix missing minification for static files) - #104413 ([llvm-wrapper] adapt for LLVM API change) - #104415 (rustdoc: fix corner case in search keyboard commands) - #104422 (Fix suggest associated call syntax) - #104426 (Add test for #102154) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-14Add test for #102154Nixon Enraght-Moony-0/+13
2022-11-14Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomezMatthias Krüger-0/+14
rustdoc: Resolve doc links in external traits having local impls For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten. Fixes https://github.com/rust-lang/rust/issues/104145.
2022-11-13Auto merge of #104292 - GuillaumeGomez:fix-missing-reexports-doc-comments, ↵bors-0/+34
r=notriddle Fix missing reexports' doc comments Fixes #81893. The issue was that an import directly "links" to the target without the intermediate imports. Unfortunately, to fix this bug we need to go through them one by one. To do so, I take the import path direct parent (so `b` in `a::b::c`) and then look for `c` into it. r? `@notriddle`
2022-11-13rustdoc: Resolve doc links in external traits having local implsVadim Petrochenkov-0/+14
2022-11-13Rollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, ↵Yuki Okushi-9/+9
r=GuillaumeGomez rustdoc: use consistent "popover" styling for notable traits Follow-up to #104129 Fixes https://github.com/rust-lang/rust/issues/104313. Preview: https://notriddle.com/notriddle-rustdoc-demos/js-notable-trait-v2/std/iter/trait.Iterator.html#method.step_by ## Before ![image](https://user-images.githubusercontent.com/1593513/200710372-d2d992ce-0bdc-4437-9a2e-379a29df09cf.png) ![image](https://user-images.githubusercontent.com/1593513/200711266-e372b176-daa9-45f3-a022-738ef0a77d3c.png) ## After ![image](https://user-images.githubusercontent.com/1593513/200710601-09b3b717-116f-43c6-b14f-34a8b02b33c0.png) ![image](https://user-images.githubusercontent.com/1593513/200711288-3978cdc1-a6c2-47f6-9216-e22e3c1f5bdf.png)
2022-11-13Rollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomezYuki Okushi-16/+16
rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a` Example: https://notriddle.com/notriddle-rustdoc-demos/line-anchors/test_dingus/fn.test.html This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-11-11rustdoc: update test casesMichael Howell-9/+9
2022-11-11Add regression test for multi-level importGuillaume Gomez-0/+34
2022-11-09rustdoc: sort output to make it deterministicMichael Howell-1/+1
2022-11-07rustdoc: use javascript to layout notable traits popupsMichael Howell-7/+15
Fixes #102576
2022-11-07Rollup merge of #103885 - fmease:rustdoc-various-cross-crate-reexport-fixes, ↵Yuki Okushi-4/+57
r=cjgillot,GuillaumeGomez rustdoc: various cross-crate reexport fixes Fixes for various smaller cross-crate reexport issues. The PR is split into several commits for easier review. Will be squashed after approval. Most notable changes: * We finally render late-bound lifetimes in the generic parameter list of cross-crate functions & methods. Previously, we would display the re-export of `pub fn f<'s>(x: &'s str) {}` as `pub fn f(x: &'s str)` * We now render unnamed parameters of cross-crate functions and function pointers as underscores since that's exactly what we do for local definitions, too. Mentioned as a bug in #44306. * From now on, the rendering of cross-crate trait-object types is more correct: * `for<>` parameter lists (for higher-ranked lifetimes) are now shown * the return type of `Fn{,Mut,Once}` trait bounds is now displayed Regarding the last list item, here is a diff for visualization (before vs. after): ```patch - dyn FnOnce(&'any str) + 'static + dyn for<'any> FnOnce(&'any str) -> bool + 'static ``` The redundant `+ 'static` will be removed in a follow-up PR that will hide trait-object lifetime-bounds if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) (see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097)). `FIXME(fmease)`s were added. ``@rustbot`` label A-cross-crate-reexports r? ``@GuillaumeGomez``
2022-11-05Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomezMatthias Krüger-6/+6
rustdoc: add hash to filename of toolchain files All static files used by rustdoc are now stored in static.files/ and their filenames include a hash of their contents. Their filenames no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. This has a useful side effect: once toolchain files aren't affected by resource suffix, it will become possible for docs.rs to include crate version in the resource suffix. That should fix a caching issue with `/latest/` URLs: https://github.com/rust-lang/docs.rs/issues/1593. My goal is that it should be safe to serve all rustdoc JS, CSS, and fonts with infinite caching headers, even when new versions of a crate are uploaded in the same place as old versions. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration. Example listing: ``` $ cd build/x86_64-unknown-linux-gnu/doc/ && find . | egrep 'js$|css$' | egrep -v 'sidebar-items|implementors' | sort ./crates1.65.0.js ./rust.css ./search-index1.65.0.js ./source-files1.65.0.js ./static.files/ayu-2bfd0af01c176fd5.css ./static.files/dark-95d11b5416841799.css ./static.files/light-c83a97e93a11f15a.css ./static.files/main-efc63f77fb116394.js ./static.files/normalize-76eba96aa4d2e634.css ./static.files/noscript-5bf457055038775c.css ./static.files/rustdoc-7a422337900fa894.css ./static.files/scrape-examples-3dd10048bcead3a4.js ./static.files/search-47f3c289722672cf.js ./static.files/settings-17b08337296ac774.js ./static.files/settings-3f95eacb845293c0.css ./static.files/source-script-215e9db86679192e.js ./static.files/storage-26d846fcae82ff09.js ``` Fixes #98413
2022-11-04rustdoc: add test for cross-crate trait-object typesLeón Orell Valerian Liehr-0/+49
as well as some FIXMEs
2022-11-04rustdoc: move cross-crate lifetime/outlives bounds on GAT params from ↵León Orell Valerian Liehr-1/+5
where-clause to param declaration site I've overlooked this in #103190.
2022-11-04rustdoc: render unnamed arguments as underscores in cross-crate functions & ↵León Orell Valerian Liehr-2/+2
function pointers for consistency with the way we display local definitions (cleaned from HIR, not from rustc_middle).
2022-11-04rustdoc: render late-bound lifetimes in generic parameter list of ↵León Orell Valerian Liehr-1/+1
cross-crate functions and methods
2022-11-04Rollup merge of #103892 - compiler-errors:afit-rustdoc, r=GuillaumeGomezMatthias Krüger-0/+14
Properly render asyncness for trait fns without default body We weren't properly desugaring async fns in traits unless they had default bodies (in which case rustdoc treats them much like they came from an impl). cc ```@yoshuawuyts``` should help with https://rust-lang.zulipchat.com/#narrow/stream/330606-wg-async.2Fasync-fn-in-trait-impl/topic/type.20inside.20.60async.20fn.60.20body.20must.20be.20known.20in.20this.20context/near/306894869
2022-11-02Properly render asyncness for traits without default bodyMichael Goulet-0/+14
2022-11-02Add regression test for doc of reexport of local itemsGuillaume Gomez-0/+16
2022-11-02Auto merge of #103649 - petrochenkov:docnotrait, r=GuillaumeGomezbors-0/+12
rustdoc: Do not add external traits to the crate in `register_res` 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. Fixes https://github.com/rust-lang/rust/issues/103463
2022-11-01Rollup merge of #103817 - notriddle:notriddle/attribute-css, r=GuillaumeGomezDylan DPC-4/+4
rustdoc: rename syntax highlighting CSS class `attribute` to `attr` Link classes use the abbreviation `attr` ... https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L255-L259 ... so why does syntax highlighting use the full word? https://github.com/rust-lang/rust/blob/2afca78a0b03db144c5d8b9f8868feebfe096309/src/librustdoc/html/static/css/rustdoc.css#L1095-L1097
2022-11-01Rollup merge of #103799 - GuillaumeGomez:search-index-tuple-struct-field, ↵Yuki Okushi-0/+18
r=notriddle Remove generation of tuple struct fields in the search index This comes from [this discussion](https://github.com/rust-lang/rust/pull/103710) as they're not very useful. r? `@notriddle`
2022-10-31rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`Michael Howell-16/+16
This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-10-31rustdoc: rename syntax highlighting CSS class `attribute` to `attr`Michael Howell-4/+4
Link classes use the abbreviation `attr`, so why shouldn't syntax highlighting?
2022-10-31Add test for tuple struct field generation in search indexGuillaume Gomez-0/+18
2022-10-30Rollup merge of #103746 - notriddle:notriddle/incoherent-dyn-trait, ↵Michael Howell-0/+35
r=GuillaumeGomez rustdoc: add support for incoherent impls on structs and traits Fixes #103170
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-29rustdoc: add support for incoherent impls on structs and traitsMichael Howell-0/+35
Fixes #103170
2022-10-30Rollup merge of #103253 - notriddle:notriddle/test-case-masked-blanket-impl, ↵Matthias Krüger-0/+5
r=Mark-Simulacrum rustdoc: add test case for masked blanket impl
2022-10-29Make --static-root-path point to static.filesJacob Hoffman-Andrews-3/+3
2022-10-29rustdoc: add hash to filename of toolchain filesJacob Hoffman-Andrews-6/+6
All static files used by rustdoc are now stored in static.files/ and include a hash of their contents. They no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.
2022-10-28Rollup merge of #103523 - GuillaumeGomez:inline-doc-comment-impl-block, ↵Matthias Krüger-0/+13
r=notriddle Fix unwanted merge of inline doc comments for impl blocks Fixes https://github.com/rust-lang/rust/issues/102909. We need this merge mechanism for inlined items but it's completely unwanted for impl blocks (at least the doc comments are, not the other attributes) since we want to keep what `cfg()` is put on the `pub use` or other attributes. r? ``@notriddle``
2022-10-27Rollup merge of #103408 - compiler-errors:rpitit-rustdoc, r=GuillaumeGomezMatthias Krüger-0/+25
Clean return-position `impl Trait` in traits correctly in rustdoc Fixes #103403
2022-10-27Rollup merge of #103432 - jsha:box-is-not-notable, r=GuillaumeGomezYuki Okushi-0/+38
rustdoc: don't mark Box<T> as Iterator, Read, etc Because Box<T> has pass-through implementations, rustdoc was giving it the "Notable Traits" treatment for Iterator, Read, Write, and Future, even when the type of T was unspecified. Pin had the same problem, but just for Future. Fixes #100320