about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-05-27Correctly handle multiple re-exports of bang macros at the same levelGuillaume Gomez-3/+9
2023-05-27Rollup merge of #111927 - sladyn98:item-static, r=GuillaumeGomezMatthias Krüger-5/+9
Migrate `item_static` to Askama This pull request addresses the type signature of the item_static function in our codebase. Previously, this function accepted a mutable reference to a Buffer for writing output. The current changes modify this to instead accept a mutable reference to any type that implements the Write trait. Referes https://github.com/rust-lang/rust/issues/108868
2023-05-26Fix re-export of doc hidden macro not showing upGuillaume Gomez-1/+12
2023-05-26Formatted file correctlysladynnunes-1/+0
2023-05-26Fixed testssladynnunes-4/+9
2023-05-26Fix failing CIsladynnunes-1/+1
2023-05-25Auto merge of #111512 - petrochenkov:microdoc2, r=GuillaumeGomezbors-84/+51
rustdoc: Cleanup doc string collapsing `doc_value` and (former) `collapsed_doc_value` can be implemented in terms of each other, and `doc_value` doesn't need the `Option`. This PR doesn't do any semantic changes, only refactoring, although some pre-existing choices between `doc_value` and `collapsed_doc_value` across rustdoc may be questionable.
2023-05-25Add `ItemTemplate` traitNicky Lim-42/+61
2023-05-24Migrate item_static to Askamasladynnunes-1/+1
2023-05-24Auto merge of #111195 - GuillaumeGomez:fix-ice-intra-doc-link, r=petrochenkovbors-1/+1
Prevent crash when a path is not resolved in intra-doc link Fixes https://github.com/rust-lang/rust/issues/111189. cc `@petrochenkov` r? `@notriddle`
2023-05-23rustdoc: add hover indicator for notable trait tooltipMichael Howell-0/+4
2023-05-23rustdoc: add interaction delays for tooltip popoversMichael Howell-9/+112
Designing a good hover microinteraction is a matter of guessing user intent from what are, literally, vague gestures. In this case, guessing if hovering in our out of the tooltip base is intentional or not. To figure this out, a few different techniques are used: * When the mouse pointer enters a tooltip anchor point, its hitbox is grown on the bottom, where the popover is/will appear. This was already there before this commit: search "hover tunnel" in rustdoc.css for the implementation. * This commit adds a delay when the mouse pointer enters the base anchor, in case the mouse pointer was just passing through and the user didn't want to open it. * This commit also adds a delay when the mouse pointer exits the tooltip's base anchor or its popover, before hiding it. * A fade-out animation is layered onto the pointer exit delay to immediately inform the user that they successfully dismissed the popover, while still providing a way for them to cancel it if it was a mistake and they still wanted to interact with it. * No animation is used for revealing it, because we don't want people to try to interact with an element while it's in the middle of fading in: either they're allowed to interact with it while it's fading in, meaning it can't serve as mistake- proofing for opening the popover, or they can't, but they might try and be frustrated. See also: * https://www.nngroup.com/articles/timing-exposing-content/ * https://www.nngroup.com/articles/tooltip-guidelines/ * https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown
2023-05-23Ignore "non-real" type Res in rustdoc intra doc link resolutionGuillaume Gomez-1/+1
2023-05-22rustdoc: remove unneeded `position: relative` setting CSSMichael Howell-1/+0
This was added to control percentage sizes, in 79956b96e875e6ba2bfa551fabda6b7896f988ac Now, the only percentage size is [`border-radius`], which is based on the size of the box itself, not its containing block. This leaves the property unused. [`border-radius`]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
2023-05-22rustdoc: merge identical CSS rulesMichael Howell-5/+3
2023-05-22rustdoc: Cleanup doc string collapsingVadim Petrochenkov-84/+51
2023-05-21rustdoc: include strikethrough in item summaryLukas Markeffsky-1/+9
2023-05-18Rollup merge of #111633 - nnethercote:avoid-ref-format, r=WaffleLapkinDylan DPC-18/+19
Avoid `&format("...")` calls in error message code. Some error message cleanups. Best reviewed one commit at a time. r? `@davidtwco`
2023-05-17Rollup merge of #111674 - GuillaumeGomez:add-missing-backslash, r=notriddleDylan DPC-1/+1
Add missing backslash in HTML string Found this missing one when looking at code. r? `@notriddle`
2023-05-17Add missing backslash in HTML stringGuillaume Gomez-1/+1
2023-05-16Rollup merge of #111642 - GuillaumeGomez:only-impl-from-bodies, r=notriddleMatthias Krüger-1/+29
[rustdoc] Only keep impl blocks from bodies Fixes https://github.com/rust-lang/rust/issues/111415. The problem was that we kept everything inside bodies whereas only impl blocks are actually accessible from outside bodies. r? `@notriddle`
2023-05-16Only keep impl blocks from bodiesGuillaume Gomez-1/+29
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-18/+19
Error message all end up passing into a function as an `impl Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as `&format("...")` that means we allocate a string (in the `format!` call), then take a reference, and then clone (allocating again) the reference to produce the `{D,Subd}iagnosticMessage`, which is silly. This commit removes the leading `&` from a lot of these cases. This means the original `String` is moved into the `{D,Subd}iagnosticMessage`, avoiding the double allocations. This requires changing some function argument types from `&str` to `String` (when all arguments are `String`) or `impl Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and some are `&str`).
2023-05-13refactor: add chunks method to TokenStream to obviate rustdoc clonesCaleb Cartwright-2/+1
2023-05-13Auto merge of #107586 - SparrowLii:parallel-query, r=cjgillotbors-0/+3
Introduce `DynSend` and `DynSync` auto trait for parallel compiler part of parallel-rustc #101566 This PR introduces `DynSend / DynSync` trait and `FromDyn / IntoDyn` structure in rustc_data_structure::marker. `FromDyn` can dynamically check data structures for thread safety when switching to parallel environments (such as calling `par_for_each_in`). This happens only when `-Z threads > 1` so it doesn't affect single-threaded mode's compile efficiency. r? `@cjgillot`
2023-05-12Require `impl Trait` in associated types to appear in method signaturesOli Scherer-1/+2
2023-05-10Use proper impl self type for alias impl in rustdocMichael Goulet-8/+9
2023-05-10Rollup merge of #111095 - GuillaumeGomez:fix-assoc-item-trait-inside-hidden, ↵Matthias Krüger-46/+110
r=notriddle Correctly handle associated items of a trait inside a `#[doc(hidden)]` item Fixes https://github.com/rust-lang/rust/issues/111064. cc `@compiler-errors` r? `@notriddle`
2023-05-08Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errorsMichael Goulet-29/+97
Introduce `AliasKind::Inherent` for inherent associated types Allows us to check (possibly generic) inherent associated types for well-formedness. Type inference now also works properly. Follow-up to #105961. Supersedes #108430. Fixes #106722. Fixes #108957. Fixes #109768. Fixes #109789. Fixes #109790. ~Not to be merged before #108860 (`AliasKind::Weak`).~ CC `@jackh726` r? `@compiler-errors` `@rustbot` label T-types F-inherent_associated_types
2023-05-06Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkinMatthias Krüger-4/+8
Make the BUG_REPORT_URL configurable by tools This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. I haven't changed clippy in case they want to make the change upstream instead of the subtree, but I'm happy to do so here if the maintainers want - cc ````@rust-lang/clippy```` Fixes https://github.com/rust-lang/rust/issues/109486.
2023-05-06correct literals for dyn thread safeSparrowLii-2/+2
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-0/+3
2023-05-06Rollup merge of #111261 - ↵Yuki Okushi-1/+6
compiler-errors:error-guaranteed-should-be-scarier-to-construct, r=BoxyUwU Mark `ErrorGuaranteed` constructor as deprecated so people don't use it You should never ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever use this function unless you know what you're doing, so make it harder to accidentally use it! Alternatives are to change the name to sound scarier, make it `unsafe` (though it's not really a soundness thing), or work on deeper refactors to make it private. r? `@BoxyUwU`
2023-05-06Rollup merge of #110780 - notriddle:notriddle/slice-index, r=GuillaumeGomezYuki Okushi-2/+28
rustdoc-search: add slices and arrays to index This indexes them as primitives with generics, so `slice<u32>` is how you search for `[u32]`, and `array<u32>` for `[u32; 1]`. A future commit will desugar the square bracket syntax to search both arrays and slices at once.
2023-05-05Improve code to remove duplicationGuillaume Gomez-28/+24
2023-05-05Modules can be reexported and it should be handled by rustdocGuillaume Gomez-9/+56
2023-05-05Correctly handle associated items of a trait inside a `#[doc(hidden)]` itemGuillaume Gomez-14/+35
2023-05-05Mark `ErrorGuaranteed` constructor as deprecated so people don't use itMichael Goulet-1/+6
2023-05-05Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errorsDylan DPC-1/+3
Implement RFC 3348, `c"foo"` literals RFC: https://github.com/rust-lang/rfcs/pull/3348 Tracking issue: #105723
2023-05-04IAT: Rustdoc integrationLeón Orell Valerian Liehr-32/+96
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-0/+4
2023-05-04Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnrbors-2/+2
Replace `tcx.mk_trait_ref` with `TraitRef::new` First step in implementing https://github.com/rust-lang/compiler-team/issues/616 r? `@lcnr`
2023-05-03Rollup merge of #110371 - notriddle:notriddle/search-corrections, ↵Manish Goregaokar-197/+232
r=GuillaumeGomez rustdoc: restructure type search engine to pick-and-use IDs Fixes #110029 Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming ![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png) This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items. This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
2023-05-04Rollup merge of #111097 - oli-obk:🚲_layout, r=compiler-errorsDylan DPC-44/+49
Avoid ICEing miri on layout query cycles Miri has special logic for catching panics during interpretation. Raising a fatal error in rustc uses unwinding to abort compilation. Thus miri ends up catching that fatal error and thinks it saw an ICE. While we should probably change that to ignore `Fatal` payloads, I think it's also neat to continue compilation after a layout query cycle 😆 Query cycles now (in addition to reporting an error just like before), return `Err(Cycle)` instead of raising a fatal error. This allows the interpreter to wind down via the regular error paths. r? `@RalfJung` for a first round, feel free to reroll for the compiler team once the miri side looks good
2023-05-04Rollup merge of #110908 - petrochenkov:notagain4, r=compiler-errorsDylan DPC-7/+9
resolve: One more attempt to simplify `module_children` If the next step is performed and `fn module_children_local` is merged with the `module_children` query, then it causes perf regressions, regardless of whether query result feeding is [used](https://perf.rust-lang.org/compare.html?start=43a78029b4f4d92978b8fde0a677ea300b113c41&end=2eb5bcc5068b9d92f74bcb1797da664865d6981d&stat=instructions:u) or [not](https://perf.rust-lang.org/compare.html?start=2fce2290865f012391b8f3e581c3852a248031fa&end=2a33d6cd99481d1712037a79e7d66a8aefadbf72&stat=instructions:u).
2023-05-04Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obkDylan DPC-0/+5
Implement negative bounds for internal testing purposes Implements partial support the `!` negative polarity on trait bounds. This is incomplete, but should allow us to at least be able to play with the feature. Not even gonna consider them as a public-facing feature, but I'm implementing them because would've been nice to have in UI tests, for example in #110671.
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-44/+43
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-02Make tools happyMichael Goulet-0/+5
2023-05-02Avoid ICEing miri on layout query cyclesOli Scherer-44/+49
2023-05-02resolve: One more attempt to simplify `module_children`Vadim Petrochenkov-7/+9