about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2022-10-27fix(rustdoc): add missing URL component for error messagesWeihang Lo-1/+1
2022-10-26privacy: Rename "accessibility levels" to "effective visibilities"Vadim Petrochenkov-12/+12
And a couple of other naming tweaks Related to https://github.com/rust-lang/rust/issues/48054
2022-10-24rustdoc: parse self-closing tags and attributes in `invalid_html_tags`Michael Howell-1/+54
Fixes #103460
2022-10-19rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`Vadim Petrochenkov-19/+13
2022-10-16rustdoc: Process extern impls in all loaded cratesVadim Petrochenkov-1/+2
including those loaded through hacks.
2022-10-16rustdoc: Do not expect `doc(primitive)` modules to always existVadim Petrochenkov-5/+5
2022-10-12Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errorsDylan DPC-3/+4
translation: eager translation Part of #100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context. - **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. - **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. - **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation. - **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`. - **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic. - **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move. This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg` anyway. However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as: let diag = { /* create diagnostic */ }; diag.span_suggestion_with_style( span, fluent::crate::slug, format!("{}", __binding_0), Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.emit(); For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first. Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition. By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added. let diag = { /* create diagnostic */ }; let __code_0 = format!("{}", __binding_0); /* + other formatting */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.span_suggestion_with_style( span, fluent::crate::slug, __code_0, Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.emit(); - **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem. r? ```@compiler-errors```
2022-10-10Stabilize rustdoc CHECK_INVALID_HTML_TAGS checkGuillaume Gomez-4/+2
2022-10-10errors: use `HashMap` to store diagnostic argsDavid Wood-3/+4
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-03Fix rustdoc ICE in invalid_rust_codeblocks lintNilstrieb-2/+5
The diagnostic message extraction code didn't handle translations yet.
2022-10-01rustdoc: adopt to the new lint APIMaybe Waffle-67/+57
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-1/+1
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-12Rollup merge of #101735 - notriddle:notriddle/backslash-escaped-html, ↵Guillaume Gomez-1/+1
r=GuillaumeGomez rustdoc: fix treatment of backslash-escaped HTML Try generating HTML for this markup: \<a href="https://example.com">example</a> It will produce text, not HTML, in both rustdoc's real HTML output and in the commonmark reference implementation: https://spec.commonmark.org/dingus/?text=%5C%3Ca%20href%3D%22https%3A%2F%2Fexample.com%22%3Eexample%3C%2Fa%3E
2022-09-12Rollup merge of #101732 - Nemo157:gate-rustdoc-missing-examples, ↵Guillaume Gomez-1/+1
r=GuillaumeGomez Feature gate the `rustdoc::missing_doc_code_examples` lint Moves the lint from being implicitly active on nightly `rustdoc` to requiring a feature to activate, like other unstable lints. Uses the new tracking issue https://github.com/rust-lang/rust/issues/101730
2022-09-12rustdoc: fix treatment of backslash-escaped HTMLMichael Howell-1/+1
Try generating HTML for this markup: \<a href="https://example.com">example</a> It will produce text, not HTML, in both rustdoc's real HTML output and in the commonmark reference implementation: https://spec.commonmark.org/dingus/?text=%5C%3Ca%20href%3D%22https%3A%2F%2Fexample.com%22%3Eexample%3C%2Fa%3E
2022-09-12Feature gate the rustdoc::missing_doc_code_examples lintWim Looman-1/+1
2022-09-12rustdoc: improve rustdoc HTML suggestions handling of nested genericsMichael Howell-3/+80
Based on some poor suggestions produced when stablizing this lint and running it on `manformed-generics.rs`
2022-09-10Rustdoc-Json: Correcty handle intra-doc-links to items without HTML pageNixon Enraght-Moony-3/+7
Closes #101531
2022-09-09Rustdoc supportMichael Goulet-2/+2
2022-09-01Rollup merge of #101279 - GuillaumeGomez:doc_auto_cfg_nested_impl, r=notriddleMatthias Krüger-20/+40
Fix doc_auto_cfg for impl blocks in different modules with different `cfg` Fixes #101129. Just like reexports, impl blocks don't necessarily share the same "space" as the item they implement so we need to merge attributes from its parents as well. r? `@notriddle`
2022-09-01Rollup merge of #101274 - aDotInTheVoid:comment-typo, r=TaKO8KiMatthias Krüger-1/+1
Fix typo in comment
2022-09-01tracing::instrument cleanupOli Scherer-4/+2
2022-09-01Correctly merge impl block cfg attributes with its parentsGuillaume Gomez-20/+40
2022-09-01Fix typo in commentNixon Enraght-Moony-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-2/+2
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-28extend attrs if local_def_id existsTakayuki Maeda-2/+3
2022-08-25Fix missing cfg propagation for reexportsGuillaume Gomez-4/+35
2022-08-17Rollup merge of #100379 - davidtwco:triagebot-diag, r=Mark-SimulacrumMatthias Krüger-9/+12
triagebot: add translation-related mention groups - Move some code around so that triagebot can ping relevant parties when translation logic is modified. - Add mention groups to triagebot for translation-related files/folders. - Auto-label pull requests with changes to translation-related files/folders with `A-translation`. r? `@Mark-Simulacrum`
2022-08-15Rollup merge of #100325 - aDotInTheVoid:rdj-import-impl, r=GuillaumeGomezMatthias Krüger-1/+11
Rustdoc-Json: Don't remove impls for items imported from private modules After #99287, items in private modules may still be in the json output, if a public import accesses them. To reflect this, items that are imported need to be marked as retained in the `Stripper` pass, so their impls arn't removed by `ImplStripper`. [More context on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Populating.20cache.2Eimpls), thanks to @ jyn514 for helping debug this. ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc r? ``@GuillaumeGomez`` Fixes #100252 Fixes #100242
2022-08-15rustdoc: Mark imported items as retainedNixon Enraght-Moony-1/+11
Fixes a bug where impl of items that were imported from a private module would be striped Fixes #100252 Fixes #100242
2022-08-15errors: move translation logic into moduleDavid Wood-9/+12
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-13make clean::Item::span return option instead of dummy spanMichael Goulet-8/+10
2022-08-09Prevent impl blocks containing only private items to be documented by defaultGuillaume Gomez-17/+54
2022-08-01Store associated item defaultness in impl_defaultness.Camille GILLOT-1/+1
2022-07-30Rollup merge of #99873 - ↵Matthias Krüger-1/+9
notriddle:notriddle/invalid-html-tags-webcomponents, r=GuillaumeGomezp rustdoc: align invalid-html-tags lint with commonmark spec
2022-07-30Update src/librustdoc/passes/html_tags.rsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-07-29Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKindest31-3/+3
This reduces ItemKind size from 224 bytes to 160 bytes.
2022-07-28rustdoc: align invalid-html-tags lint with commonmark specMichael Howell-1/+9
2022-07-21Rollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=notriddleMatthias Krüger-2/+2
Remove unused field in ItemKind::KeywordItem For the keyword name, we use `Item::name` directly everywhere so there is no point into keeping it. r? ``@notriddle``
2022-07-21Remove unused field in ItemKind::KeywordItemGuillaume Gomez-2/+2
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-1/+4
2022-07-16Correctly handle usage of private items in public API for JSON output formatGuillaume Gomez-4/+19
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-1/+2
2022-07-05lint: `LintDiagnosticBuilder` into `rustc_errors`David Wood-2/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-2/+2
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-2/+2
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-1/+0
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-06-06Rollup merge of #90905 - GuillaumeGomez:empty-impl-blocks, r=jshaMatthias Krüger-2/+3
Add empty impl blocks if they have documentation Fixes https://github.com/rust-lang/rust/issues/90866. The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with https://github.com/rust-lang/rust/pull/89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc ```@Mark-Simulacrum).``` It looks like this: ![Screenshot from 2021-11-14 16-51-28](https://user-images.githubusercontent.com/3050060/141689100-e57123c0-bf50-4c42-adf5-d991e169a0e4.png) cc ```@jyn514``` r? ```@camelid```
2022-06-02Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, ↵Yuki Okushi-2/+29
r=GuillaumeGomez rustdoc: avoid including impl blocks with filled-in generics Fixes #94937 # Before ![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png) # After ![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)