about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2023-05-27Rollup merge of #112018 - GuillaumeGomez:cleanup-tcx, r=notriddleMatthias Krüger-21/+19
Clean up usage of `cx.tcx` when `tcx` is already set into a variable I discovered a few cases where `cx.tcx` (and equivalents) was used whereas `tcx` was already stored into a variable. In those cases, better to just use `tcx` directly. r? `@notriddle`
2023-05-27Clean up usage of `cx.tcx` when `tcx` is already set into a variableGuillaume Gomez-21/+19
2023-05-26rustdoc: get unnormalized link destination for suggestionsMichael Howell-62/+112
Fixes #110111 This bug, and the workaround in this commit, is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of link components. In particular, pulldown-cmark doesn't provide the offsets of the contents of a link. To work around this, rustdoc parser parts of a link definition itself. [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-25Auto merge of #111512 - petrochenkov:microdoc2, r=GuillaumeGomezbors-15/+7
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-23Ignore "non-real" type Res in rustdoc intra doc link resolutionGuillaume Gomez-1/+1
2023-05-22rustdoc: Cleanup doc string collapsingVadim Petrochenkov-15/+7
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-12/+13
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-10Rollup merge of #111095 - GuillaumeGomez:fix-assoc-item-trait-inside-hidden, ↵Matthias Krüger-6/+26
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-05Modules can be reexported and it should be handled by rustdocGuillaume Gomez-1/+1
2023-05-05Correctly handle associated items of a trait inside a `#[doc(hidden)]` itemGuillaume Gomez-5/+25
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-20/+20
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-04-29Add `rustdoc::unescaped_backtick` lintLukas Markeffsky-0/+418
2023-04-27refactor(docs): remove macro resolution fallbackbohan-14/+16
2023-04-19Remove find_map_relevant_implMichael Goulet-9/+11
2023-04-18Rollup merge of #110348 - ↵Matthias Krüger-0/+2
GuillaumeGomez:disambiguators-suffixes-rustdoc-book, r=Manishearth Add list of supported disambiguators and suffixes for intra-doc links in the rustdoc book This information is otherwise only provided in case an error occurs, which isn't great. r? ```@notriddle```
2023-04-17Add code comment to remind contributors to update rustdoc book if they ↵Guillaume Gomez-0/+2
update the disambiguators list
2023-04-15fix clippy::{filter_map_identiy, map_identity, manual_flatten}Matthias Krüger-1/+1
2023-04-04Auto merge of #109876 - jsha:uniquify-intra-doc, r=notriddlebors-1/+1
rustdoc: make intra-doc link pass non-quadratic for repeated links In the collect_intra_doc_links pass, links to a given item that occurred repeatedly were getting inserted into a `Vec<clean::ItemLink>` repeatedly. This led to n^2 behavior (where n = the number of pages generated), particularly for the intra-doc link on the `Into<U> for T where U: From<T>` blanket implementation, since that link appears on every single struct page. Fixes #109851
2023-04-02rustdoc: fix quadratic time in intra-doc link passJacob Hoffman-Andrews-1/+1
In the collect_intra_doc_links pass, links to a given item that occurred repeatedly were getting inserted into a Vec<clean::ItemLink> repeatedly. This led to n^2 behavior (where n = the number of pages generated), particularly for the intra-doc link on the `Into<U> for T where U: From<T>` blanket implementation, since that link appears on every single struct page.
2023-04-01a couple clippy::complexity fixesMatthias Krüger-1/+1
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-03-31Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddleGuillaume Gomez-3/+3
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes` Fixes #88070. It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem. r? `@jyn514`
2023-03-31Rollup merge of #109104 - ↵Guillaume Gomez-142/+242
GuillaumeGomez:fix-invalid-suggestion-ambiguous-intra-doc2, r=oli-obk,notriddle rustdoc: Fix invalid suggestions on ambiguous intra doc links v2 Fixes https://github.com/rust-lang/rust/issues/108653. This is another approach to fixing the same issue. This time, we keep the computed information around instead of re-computing it. Strangely enough, the order for ambiguities seem to have been changed. Not an issue but it creates a lot of diff... So which version do you prefer? r? `@notriddle`
2023-03-30Replace doc(primitive) with rustc_doc_primitiveGuillaume Gomez-3/+3
2023-03-29Don't strip crate moduleGuillaume Gomez-2/+7
2023-03-24Put back `is_derive_trait_collision` checkGuillaume Gomez-2/+29
2023-03-24Strenghten disambiguation in `ambiguity_error` and improve documentationGuillaume Gomez-5/+11
2023-03-24Rename description of primitive from "builtin type" into "primitive type"Guillaume Gomez-1/+1
2023-03-24Special case `ambiguity_error` if all candidates have the same "kind"Guillaume Gomez-10/+21
2023-03-24Fix rustdoc intra-doc link invalid ambiguity error messageGuillaume Gomez-142/+198
2023-03-23rustdoc: Skip doc link resolution for non-exported itemsVadim Petrochenkov-2/+11
2023-03-21rustdoc: Factor out some doc link resolution code into a separate functionVadim Petrochenkov-24/+27
2023-03-21rustdoc: Cleanup parent module tracking for doc linksVadim Petrochenkov-87/+48
Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary.
2023-03-16clean up few allocklensy-2/+0
2023-03-13Better names?Michael Goulet-1/+1
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-5/+2
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-8/+8
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-22various: translation resources from cg backendDavid Wood-2/+4
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1/+1
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-20Rollup merge of #108241 - GuillaumeGomez:fix-reexported-macro-handling, ↵Matthias Krüger-5/+13
r=notriddle Fix handling of reexported macro in doc hidden items Fixes https://github.com/rust-lang/rust/issues/108231. Fixes #59368. r? `@notriddle`
2023-02-20Fix handling of reexported macro in doc hidden itemsGuillaume Gomez-5/+13
2023-02-19Rollup merge of #108129 - ↵Guillaume Gomez-2/+3
GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov Correctly handle links starting with whitespace Part of https://github.com/rust-lang/rust/issues/107995. I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^' r? `@petrochenkov`
2023-02-18Correctly handle if a link starts with a whitespaceGuillaume Gomez-2/+3
2023-02-17Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstriebbors-3/+3
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-16fix new usage of type_ofKyle Matsuda-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-6/+6
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-6/+6
2023-02-15Rollup merge of #108076 - GuillaumeGomez:more-let-chain, r=notriddleMatthias Krüger-66/+60
rustdoc: Use more let chain Got the idea after yesterday's review. r? `@notriddle`
2023-02-15Copy `ty::AssocItem` even in rustdocMaybe Waffle-3/+3
2023-02-15Use more let chainGuillaume Gomez-66/+60