about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-11-22Add documentation on `filter_doc_attr`Guillaume Gomez-0/+2
2023-11-22Don't merge cfg and doc(cfg) attributes for re-exportsGuillaume Gomez-45/+42
2023-11-22Auto merge of #118086 - nnethercote:queries-cleanups, r=bjorn3bors-5/+5
Queries cleanups r? `@bjorn3`
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-1/+1
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Make `Compiler::{sess,codegen_backend}` public.Nicholas Nethercote-5/+5
And remove the relevant getters on `Compiler` and `Queries`.
2023-11-22Update itertools to 0.11.Nicholas Nethercote-1/+1
Because the API for `with_position` improved in 0.11 and I want to use it.
2023-11-21rustdoc-search: make primitives and keywords less specialMichael Howell-46/+41
The search sorting code already sorts by item type discriminant, putting things with smaller discriminants first. There was also a special case for sorting keywords and primitives earlier, and this commit removes it by giving them lower discriminants. The sorting code has another criteria where items with descriptions appear earlier than items without, and that criteria has higher priority than the item type. This shouldn't matter, though, because primitives and keywords normally only appear in the standard library, and it always gives them descriptions.
2023-11-21rustdoc-search: clean up `checkPath`Michael Howell-13/+3
This computes the same result with less code by computing many of the old checks at once: * It won't enter the loop if clength > length, because then the result of length - clength will be negative and the loop conditional will fail. * i + clength will never be greater than length, because it starts out as i = length - clength, implying that i + clength equals length, and it only goes down from there. * The aborted variable is replaced with control flow.
2023-11-19rustdoc-search: add support for associated typesMichael Howell-114/+730
2023-11-19Auto merge of #118024 - notriddle:notriddle/search-speed, r=GuillaumeGomezbors-150/+153
rustdoc-search: optimize unifyFunctionTypes Final profile output: https://notriddle.com/rustdoc-html-demo-5/profile-4/index.html This PR contains three commits that improve performance of this hot inner loop: reduces the number of allocations, a fast path for the 1-element basic query case, and reconstructing the multi-element query case to use recursion instead of an explicit `backtracking` array. It also adds new test cases that I found while working on this. r? `@GuillaumeGomez`
2023-11-18rustdoc-search: switch to recursive backtrackingMichael Howell-157/+87
This is significantly faster, because - It allows the one-element fast path to kick in on multi- element queries. - It constructs intermediate data structures more lazily than the old system did. It's measurably faster than the old algo even without the fast path, but that fast path still helps significantly.
2023-11-18Remove unneeded `unknown` variable and `Symbol` creation when iterating over ↵Guillaume Gomez-4/+4
items in rustdoc rendering
2023-11-17rustdoc-search: fix accidental shared, mutable mapMichael Howell-30/+14
2023-11-17rustdoc-search: fast path for 1-query unificationMichael Howell-2/+76
Short queries, in addition to being common, are also the base case for a lot of more complicated queries. We can avoid most of the backtracking data structures, and use simple recursive matching instead, by special casing them. Profile output: https://notriddle.com/rustdoc-html-demo-5/profile-3/index.html
2023-11-17rustdoc-search: less new Maps in unifyFunctionTypeMichael Howell-16/+31
This is a major source of expense on generic queries, and this commit reduces them. Profile output: https://notriddle.com/rustdoc-html-demo-5/profile-2/index.html
2023-11-17Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naberMatthias Krüger-1/+0
Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all.
2023-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-8/+1
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-16Auto merge of #117875 - Mark-Simulacrum:bootstrap-bump, r=clubby789bors-229/+294
Bootstrap bump Bumps bootstrap compiler to just-released beta. https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2023-11-15Re-format code with new rustfmtMark Rousskov-229/+294
2023-11-15rustdoc-search: simplify the checkTypes fast pathMichael Howell-61/+10
This reduces code size while still matching the common case for plain, concrete types.
2023-11-15Auto merge of #117908 - lcnr:region-kind-rename, r=BoxyUwUbors-7/+7
finish `RegionKind` renaming second step of https://github.com/rust-lang/types-team/issues/95 continues the work from #117876. While working on this and I encountered a bunch of further cleanup which I'll either open a tracking issue for or will do in a separate PR: - rewrite the `RegionKind` docs, they still talk about `ReEmpty` and are generally out of date - rename `DescriptionCtx` to `DescriptionCtxt` - what is `CheckRegions::Bound`? - `collect_late_bound_regions` et al - `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`? - `EraseEarlyRegions` visitor should be removed, feels duplicate r? `@BoxyUwU`
2023-11-15Auto merge of #117814 - RalfJung:rustc-logger-without-set-var, r=TaKO8Kibors-1/+2
rustc_log: provide a way to init logging based on the values, not names, of the env vars Miri wants to affect how rustc does logging. So far this required setting environment variables before calling `rustc_driver::init_rustc_env_logger`. However, `set_var` is a function one should really [avoid calling](https://github.com/rust-lang/rust/issues/90308), so this adds the necessary APIs to rustc such that Miri can just pass it the *values* of all the log-relevant environment variables, rather than having to change the global environment.
2023-11-14Auto merge of #117849 - compiler-errors:cycle, r=cjgillotbors-1/+1
make `LayoutError::Cycle` carry `ErrorGuaranteed` Addresses a FIXME, and also I think it's wise for error variants to carry their `ErrorGuaranteed` -- makes it easier to use that `ErrorGuaranteed` for creating, e.g. `TyKind::Error` and other error kinds. Splitting out from #117703.
2023-11-14finish `RegionKind` renamelcnr-7/+7
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13rename `ReLateBound` to `ReBound`lcnr-9/+5
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-12rustdoc: use `.rustdoc` class instead of `body`Michael Howell-2/+2
This didn't show up in our local tests, because the problem is actually caused by docs.rs rewritten HTML (which relocates the classes that this code looked for from the body tag to a child div). Fixes #117290
2023-11-12make LayoutError::Cycle carry ErrorGuaranteedMichael Goulet-1/+1
2023-11-11rustc_log: provide a way to init logging based on the values, not names, of ↵Ralf Jung-1/+2
the env vars
2023-11-08Rollup merge of #117531 - ↵Matthias Krüger-6/+3
fmease:rustdoc-effects-properly-elide-x-crate-host-args, r=GuillaumeGomez rustdoc: properly elide cross-crate host effect args Fixes FIXMEs introduced in #116670.
2023-11-08rustdoc: minor changes suggested by clippy perf lints.Nicholas Nethercote-12/+10
2023-11-07Auto merge of #115904 - notriddle:notriddle/preload-bold, r=GuillaumeGomezbors-1/+0
rustdoc: stop preloading Source Serif 4 Bold According to #91170, italic fonts are not preloaded because they're rarely used, but bold fonts are. This seems to be true of bold Source Code Pro and bold Fira Sans, but bold and italic Source Serif Pro seem to be equally heavily used. This is, I assume, the result of using Fira Sans Bold and Source Code Bold headings, so you only get bold Serif text when the doc author uses strong `**` emphasis (or within certain kinds of tooltip, which shouldn't be preloaded because they only show up long after the page is loaded). To check this, run these two commands in the browser console to measure how much they're used. The measurement is extremely rough, but it gets the idea across: the two styles are about equally popular. // count bold elements Array.prototype.slice.call(document.querySelectorAll("*")).filter(x => { const y = document.defaultView.getComputedStyle(x); return y.fontFamily.indexOf("Source Serif 4") !== -1 && y.fontWeight > 400 }).length // count italic elements Array.prototype.slice.call(document.querySelectorAll("*")).filter(x => { const y = document.defaultView.getComputedStyle(x); return y.fontFamily.indexOf("Source Serif 4") !== -1 && y.fontStyle == "italic" }).length | URL | Bold | Italic | |--------------|-----:|-------:| | [std] | 2 | 9 | | [Vec] | 8 | 89 | | [regex] | 33 | 17 | | [test_suite] | 0 | 0 | [std]: https://doc.rust-lang.org/nightly/std/index.html [Vec]: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html [regex]: https://docs.rs/regex/1.9.5/regex/index.html [test_suite]: https://docs.rs/test-suite/3.2.9/test_suite/
2023-11-05rustdoc: properly elide cross-crate host effect argsLeón Orell Valerian Liehr-6/+3
2023-11-04Auto merge of #117540 - ↵bors-80/+74
matthiaskrgr:baby_dont_clone_me_dont_clone_me_no_more, r=est31 clone less
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-7/+4
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-03clone lessMatthias Krüger-80/+74
2023-11-02Auto merge of #117521 - GuillaumeGomez:impl-on-foreign-order, r=notriddlebors-1/+2
Fix order of implementations in the "implementations on foreign types" section Fixes #117391. We forgot to run the `sort_by_cached_key` on this section. This fixes it. r? `@notriddle`
2023-11-02Fix order of implementations in the "implementations on foreign types" sectionGuillaume Gomez-1/+2
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-7/+4
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-11-01Rollup merge of #117488 - GuillaumeGomez:update-minifier, r=notriddleMatthias Krüger-1/+1
Update minifier-rs version to 0.3.0 It fixes https://github.com/GuillaumeGomez/minifier-rs/issues/105. r? ```@notriddle```
2023-11-01Update minifier-rs version to 0.3.0Guillaume Gomez-1/+1
2023-10-31Auto merge of #117459 - matthiaskrgr:rollup-t3osb3c, r=matthiaskrgrbors-0/+27
Rollup of 5 pull requests Successful merges: - #113241 (rustdoc: Document lack of object safety on affected traits) - #117388 (Turn const_caller_location from a query to a hook) - #117417 (Add a stable MIR visitor) - #117439 (prepopulate opaque ty storage before using it) - #117451 (Add support for pre-unix-epoch file dates on Apple platforms (#108277)) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-31Rollup merge of #113241 - poliorcetics:85138-doc-object-safety, r=GuillaumeGomezMatthias Krüger-0/+27
rustdoc: Document lack of object safety on affected traits Closes #85138 I saw the issue didn't have any recent activity, if there is another MR for it I missed it. I want the issue to move forward so here is my proposition. It takes some space just before the "Implementors" section and only if the trait is **not** object safe since it is the only case where special care must be taken in some cases and this has the benefit of avoiding generation of HTML in (I hope) the common case.
2023-10-31Accept less invalid Rust in rustdocOli Scherer-1/+5
2023-10-31Auto merge of #117377 - dtolnay:deprecatedsince, r=cjgillotbors-37/+35
Store #[deprecated] attribute's `since` value in parsed form This PR implements the first followup bullet listed in https://github.com/rust-lang/rust/pull/117148#issue-1960240108. We centralize error handling to the attribute parsing code in `compiler/rustc_attr/src/builtin.rs`, and thereby remove some awkward error codepaths from later phases of compilation that had to make sense of these #\[deprecated\] attributes, namely `compiler/rustc_passes/src/stability.rs` and `compiler/rustc_middle/src/middle/stability.rs`.
2023-10-30Descriptive variant name deprecation versions outside the standard libraryDavid Tolnay-2/+2
2023-10-30Represent absence of 'since' attribute as a variant of DeprecatedSinceDavid Tolnay-8/+8
2023-10-30Add a DeprecatedSince::Err variant for versions that fail to parseDavid Tolnay-10/+18
2023-10-30Rollup merge of #117376 - nnethercote:rustc_interface-more, r=oli-obkGuillaume Gomez-15/+8
More `rustc_interface` cleanups In particular, following up #117268 with more improvement to `--cfg`/`--check-cfg` handling. r? ``@oli-obk``
2023-10-30Rollup merge of #112463 - fmease:rustdoc-elide-x-crate-def-gen-args, ↵Guillaume Gomez-31/+113
r=GuillaumeGomez rustdoc: elide cross-crate default generic arguments Elide cross-crate generic arguments if they coincide with their default. TL;DR: Most notably, no more `Box<…, Global>` in `std`'s docs, just `Box<…>` from now on. Fixes #80379. Also helps with #44306. Follow-up to #103885, #107637. r? ``@ghost``
2023-10-30Move deprecation_in_effect to inherent method on DeprecationDavid Tolnay-8/+2