summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-04-16rustdoc: Correctly merge import's and its target's docs in one more caseVadim Petrochenkov-6/+8
2023-04-16Don't collect return-position impl traits for documentationMichael Goulet-1/+9
2023-03-03Emit an error for unclosed genericGuillaume Gomez-1/+13
2023-03-02Put backtick content from rustdoc search errors into a <code> elementsGuillaume Gomez-40/+99
2023-03-01Rollup merge of #108143 - notriddle:notriddle/filter-exclamation-macro, ↵Dylan DPC-6/+26
r=GuillaumeGomez rustdoc: search by macro when query ends with `!` Related to #96399 Note: the `never` type alias is tested in [`/tests/rustdoc-js-std/alias-3.js`](https://github.com/notriddle/rust/blob/08ad401633037cc226b3806a3c5f48c2f34703bf/tests/rustdoc-js-std/alias-3.js) ## Before ![image](https://user-images.githubusercontent.com/1593513/219504192-54cc0753-ff97-4a37-ad4a-8ae915181325.png) ## After ![image](https://user-images.githubusercontent.com/1593513/219504251-589a7e11-1e7b-4b7b-879d-1b564080017c.png)
2023-03-01Rollup merge of #108297 - chenyukang:yukang/delim-error-exit, r=petrochenkovMatthias Krüger-11/+3
Exit when there are unmatched delims to avoid noisy diagnostics From https://github.com/rust-lang/rust/pull/104012#issuecomment-1311764832 r? ``@petrochenkov``
2023-02-28Exit when there are unmatched delims to avoid noisy diagnosticsyukang-11/+3
2023-02-28Auto merge of #108098 - notriddle:notriddle/rustdoc-tooltip-alloc, ↵bors-23/+30
r=GuillaumeGomez rustdoc: reduce allocations when generating tooltips An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-27Rollup merge of #108494 - GuillaumeGomez:cleanup-js, r=notriddleMatthias Krüger-13/+7
Clean up JS files code a bit I mostly moved values closer to where they are used to make the code reading easier. r? ```@notriddle```
2023-02-26Clean up JS files code a bitGuillaume Gomez-13/+7
2023-02-26Rollup merge of #108379 - compiler-errors:hir-error-guaranteed, r=cjgillotMatthias Krüger-1/+1
Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants First step in making the `Err` variants of `ExprKind` and `TyKind` require an `ErrorGuaranteed` during parsing. Making the corresponding AST versions require `ErrorGuaranteed` is a bit harder, whereas it was pretty easy to do this for HIR, so let's do that first. The only weird thing about this PR is that `ErrorGuaranteed` is moved to `rustc_span`. This is *certainly* not the right place to put it, but `rustc_hir` cannot depend on `rustc_error` because the latter already depends on the former. Should I just pull out some of the error machinery from `rustc_error` into an even more minimal crate that `rustc_hir` can depend on? Advice would be appreciated.
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-1/+1
2023-02-25Update search eBNF with `!` movedMichael Howell-2/+2
Co-Authored-By: GuillaumeGomez <guillaume1.gomez@gmail.com>
2023-02-23rustdoc: avoid including `<li>` tags in item table short descMichael Howell-4/+1
Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
2023-02-23Rollup merge of #108349 - GuillaumeGomez:fix-duplicated-imports2, r=notriddleMatthias Krüger-8/+16
rustdoc: Prevent duplicated imports Fixes #108163. Interestingly enough, the AST is providing us an import for each corresponding item, even though the `Res` links to multiple ones each time, which leaded to the same import being duplicated. So in this PR, I decided to prevent the add of the import before the clean pass. However, I originally took a different path by instead filtering after cleaning the path. You can see it [here](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:rust:fix-duplicated-imports?expand=1). Only the second commit differs. I think this approach is better though, but at least we can compare both if we want. The first commit adds the check for duplicated items in the rustdoc-json output as asked in #108163. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-23/+30
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-23Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, ↵bors-1/+1
r=compiler-errors,davidtwco,estebank,oli-obk diagnostics: if AssocFn has self argument, describe as method Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods. For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods> > Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation. In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-2/+2
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Remove type-traversal trait aliasesAlan Egerton-2/+2
2023-02-22Prevent duplicated importsGuillaume Gomez-8/+16
2023-02-22diagnostics: if AssocFn has self argument, describe as methodMichael Howell-1/+1
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
2023-02-22Auto merge of #103042 - davidtwco:translation-distributed-ftl, r=oli-obkbors-9/+20
errors: generate typed identifiers in each crate 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. There are advantages and disadvantages to this change.. #### Advantages - Changing a diagnostic now only recompiles the crate for that diagnostic and those crates that depend on it, rather than `rustc_error_messages` and all crates thereafter. - This approach can be used to support first-party crates that want to supply translatable diagnostics (e.g. `rust-lang/thorin` in https://github.com/rust-lang/rust/pull/102612#discussion_r985372582, cc `@JhonnyBillM)` - We can extend this a little so that tools built using rustc internals (like clippy or rustdoc) can add their own diagnostic resources (much more easily than those resources needing to be available to `rustc_error_messages`) #### Disadvantages - Crates can only refer to the diagnostic messages defined in the current crate (or those from dependencies), rather than all diagnostic messages. - `rustc_driver` (or some other crate we create for this purpose) has to directly depend on *everything* that has error messages. - It already transitively depended on all these crates. #### Pending work - [x] I don't know how to make `rustc_codegen_gcc`'s translated diagnostics work with this approach - because `rustc_driver` can't depend on that crate and so can't get its resources to provide to the diagnostic emission. I don't really know how the alternative codegen backends are actually wired up to the compiler at all. - [x] Update `triagebot.toml` to track the moved FTL files. r? `@compiler-errors` cc #100717
2023-02-22Rollup merge of #108310 - ↵Guillaume Gomez-7/+17
GuillaumeGomez:fix-reexports-duplicated-attributes, r=notriddle rustdoc: Fix duplicated attributes for first reexport Fixes #108281. r? ``@notriddle``
2023-02-22various: translation resources from cg backendDavid Wood-9/+18
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-5/+7
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-21Fix duplicated attributes for first reexportGuillaume Gomez-7/+17
2023-02-21Auto merge of #104754 - nnethercote:more-ThinVec-in-ast, r=the8472bors-3/+10
Use `ThinVec` more in the AST r? `@ghost`
2023-02-21Allow disabling of auto and blanket trait impls retrieval in rustdoc when in ↵Guillaume Gomez-0/+6
parallel_compiler mode.
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-3/+4
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Upgrade `thin-vec` from 0.2.9 to 0.2.12.Nicholas Nethercote-1/+1
Because 0.2.10 added supports for `ThinVec::splice`, and 0.2.12 is the latest release.
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-19Only include stable lints in `rustdoc::all` groupNoah Lev-1/+5
Including unstable lints in the lint group produces unintuitive behavior on stable (see #106289). Meanwhile, if we only included unstable lints on nightly and not on stable, we could end up with confusing bugs that were hard to compare across versions of Rust that lacked code changes. I think that only including stable lints in `rustdoc::all`, no matter the release channel, is the most intuitive option. Users can then control unstable lints individually, which is reasonable since they have to enable the feature gates individually anyway.
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-19Rollup merge of #107766 - ↵Guillaume Gomez-41/+73
GuillaumeGomez:fix-json-reexports-of-different-items-with-same-name, r=aDotInTheVoid Fix json reexports of different items with same name Fixes #107677. I renamed `from_item_id*` functions into `id_from_item` instead because it makes more sense now. I also simplified the logic around it a bit so that the `ids` function will now directly pass `&clean::Item` to `id_from_item` and the ID will be consistently generated (it caused an issue when I updated the ID for imports). So now, the big change of this PR: I changed how imports' ID is generated: it now includes the target item's ID at the end of the ID. It's to prevent two reexported items with the same name (but different types). r? `@aDotInTheVoid`
2023-02-19Rollup merge of #108146 - notriddle:notriddle/rustdoc-search-reference, ↵Dylan DPC-0/+10
r=GuillaumeGomez rustdoc: hide `reference` methods in search index They're hidden in the HTML, so it makes no sense in the search engine for `reference::next` or `reference::shrink` to be shown. https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/What.20is.20.60reference.3A.3Ashrink.60.3F
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-17/+19
rustdoc: simplify DOM for `.item-table` This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-18Correctly handle if a link starts with a whitespaceGuillaume Gomez-2/+3
2023-02-18Improve code readabilityGuillaume Gomez-10/+21
2023-02-18Fix bad handling of primitive typesGuillaume Gomez-30/+48
2023-02-18Allow reexports of items with same name but different types to both appearGuillaume Gomez-57/+60
2023-02-18doc links: Filter away autolinks in both rustc and rustdocVadim Petrochenkov-16/+8
2023-02-18rustdoc: Cleanup broken link callbacksVadim Petrochenkov-29/+17
2023-02-18rustdoc: Do not use Footnotes and HeadingLinks when extracting doc linksVadim Petrochenkov-8/+3
they do not add any `Link` events
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-17Add comment explaining the search index tweakMichael Howell-0/+6
2023-02-17Add `Clause::ConstArgHasType` variantBoxy-0/+1
2023-02-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-28/+54
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16Correct eslint warningMichael Howell-1/+1
2023-02-16rustdoc: search by macro when query ends with `!`Michael Howell-4/+24
Related to #96399