about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2023-11-26Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkovGuillaume Gomez-1/+0
merge `DefKind::Coroutine` into `Defkind::Closure` Related to #118188 We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`. Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F r? `@petrochenkov`
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-1/+0
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-2/+2
cleanup
2023-11-25is_{some,ok}_and for rustdocMichael Goulet-1/+1
2023-11-16small code improvements in collect_intra_doc_linkskadiwa-64/+39
2023-11-15Re-format code with new rustfmtMark Rousskov-26/+35
2023-11-08rustdoc: minor changes suggested by clippy perf lints.Nicholas Nethercote-1/+1
2023-11-03clone lessMatthias Krüger-78/+72
2023-10-22rustdoc: use JS to inline target type impl docs into aliasMichael Howell-7/+13
This is an attempt to balance three problems, each of which would be violated by a simpler implementation: - A type alias should show all the `impl` blocks for the target type, and vice versa, if they're applicable. If nothing was done, and rustdoc continues to match them up in HIR, this would not work. - Copying the target type's docs into its aliases' HTML pages directly causes far too much redundant HTML text to be generated when a crate has large numbers of methods and large numbers of type aliases. - Using JavaScript exclusively for type alias impl docs would be a functional regression, and could make some docs very hard to find for non-JS readers. - Making sure that only applicable docs are show in the resulting page requires a type checkers. Do not reimplement the type checker in JavaScript. So, to make it work, rustdoc stashes these type-alias-inlined docs in a JSONP "database-lite". The file is generated in `write_shared.rs`, included in a `<script>` tag added in `print_item.rs`, and `main.js` takes care of patching the additional docs into the DOM. The format of `trait.impl` and `type.impl` JS files are superficially similar. Each line, except the JSONP wrapper itself, belongs to a crate, and they are otherwise separate (rustdoc should be idempotent). The "meat" of the file is HTML strings, so the frontend code is very simple. Links are relative to the doc root, though, so the frontend needs to fix that up, and inlined docs can reuse these files. However, there are a few differences, caused by the sophisticated features that type aliases have. Consider this crate graph: ```text --------------------------------- | crate A: struct Foo<T> | | type Bar = Foo<i32> | | impl X for Foo<i8> | | impl Y for Foo<i32> | --------------------------------- | ---------------------------------- | crate B: type Baz = A::Foo<i8> | | type Xyy = A::Foo<i8> | | impl Z for Xyy | ---------------------------------- ``` The type.impl/A/struct.Foo.js JS file has a structure kinda like this: ```js JSONP({ "A": [["impl Y for Foo<i32>", "Y", "A::Bar"]], "B": [["impl X for Foo<i8>", "X", "B::Baz", "B::Xyy"], ["impl Z for Xyy", "Z", "B::Baz"]], }); ``` When the type.impl file is loaded, only the current crate's docs are actually used. The main reason to bundle them together is that there's enough duplication in them for DEFLATE to remove the redundancy. The contents of a crate are a list of impl blocks, themselves represented as lists. The first item in the sublist is the HTML block, the second item is the name of the trait (which goes in the sidebar), and all others are the names of type aliases that successfully match. This way: - There's no need to generate these files for types that have no aliases in the current crate. If a dependent crate makes a type alias, it'll take care of generating its own docs. - There's no need to reimplement parts of the type checker in JavaScript. The Rust backend does the checking, and includes its results in the file. - Docs defined directly on the type alias are dropped directly in the HTML by `render_assoc_items`, and are accessible without JavaScript. The JSONP file will not list impl items that are known to be part of the main HTML file already. [JSONP]: https://en.wikipedia.org/wiki/JSONP
2023-10-20s/Generator/Coroutine/Oli Scherer-3/+3
2023-09-26Don't store lazyness in DefKindMichael Goulet-1/+1
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-2/+1
2023-09-19Return early in `check_custom_code_classes` check if the feature is enabledGuillaume Gomez-1/+5
2023-09-17Don't emit an error if the `custom_code_classes_in_docs` feature is disabled ↵Guillaume Gomez-13/+40
when its syntax is used.
2023-09-15Update to new `emit_error` APIGuillaume Gomez-3/+2
2023-09-15Fix compilation error "the trait bound `SubdiagnosticMessage: ↵Guillaume Gomez-2/+3
From<&std::string::String>` is not satisfied"
2023-09-15Implement custom classes for rustdoc code blocks with ↵Guillaume Gomez-0/+82
`custom_code_classes_in_docs` feature
2023-09-08Reuse rustdoc's doc comment handling in ClippyAlex Macleod-140/+71
2023-08-24Auto merge of #115078 - camelid:tydef-to-alias, r=aDotInTheVoid,GuillaumeGomezbors-2/+2
rustdoc: Rename typedef to type alias This matches the name used by the [Rust Reference][1], which is also what people usually call these items. [1]: https://doc.rust-lang.org/reference/items/type-aliases.html r? `@GuillaumeGomez`
2023-08-21rustdoc: use unicode-aware checks for redundant explicit link fastpathMichael Howell-14/+4
Fixes #115064
2023-08-21rustdoc: Rename `clean` items from typedef to type aliasNoah Lev-2/+2
2023-08-18Fix formatKyle Lin-1/+1
2023-08-18Fix private function importingKyle Lin-1/+1
2023-08-18Skip lint check when item is not fully publicKyle Lin-0/+19
2023-08-18relax redundancy constraintKyle Lin-6/+1
2023-08-18narrow down the lint trigger constraintKyle Lin-13/+25
2023-08-18fomar filesKyle Lin-4/+9
2023-08-18Still resolving rustdoc resolution panickingKyle Lin-71/+74
2023-08-18Support Reference & ReferenceUnknown link lintKyle Lin-61/+221
2023-08-18Refactor lint from rustc to rustdocKyle Lin-28/+192
2023-08-18add more testsKyle Lin-1/+1
2023-08-18Fix resolution cachingKyle Lin-37/+35
2023-08-18Add warn level lint `redundant_explicit_links`Kyle Lin-11/+90
- Currently it will panic due to the resolution's caching issue
2023-08-16Use more named format argsGuillaume Gomez-7/+9
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-55/+49
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-2/+7
2023-07-29Move `inherits_doc_hidden` and `should_ignore_res` into `clean/utils.rs`Guillaume Gomez-3/+3
2023-07-25Use a builder instead of boolean/option argumentsOli Scherer-1/+1
2023-07-22improve debuggabilityLukas Markeffsky-2/+8
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-1/+1
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-18Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, ↵bors-8/+32
r=aDotInTheVoid,notriddle Strip impl if not re-exported and is doc(hidden) Part of #112852. r? `@aDotInTheVoid`
2023-07-14Correctly handle `--document-hidden-items`Guillaume Gomez-13/+31
2023-07-14Strip impl if not re-exported and is doc(hidden)Guillaume Gomez-1/+7
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-8/+8
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-18/+17
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-2/+2
2023-06-29document that the panic in collect_intra_doc_links is load-bearingjyn-0/+4
2023-06-19Clean up "doc(hidden)" checkGuillaume Gomez-7/+6
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-1/+1
2023-05-29Use `Cow` in `{D,Subd}iagnosticMessage`.Nicholas Nethercote-98/+105
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment: ``` // FIXME(davidtwco): can a `Cow<'static, str>` be used here? ``` This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging. This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths. Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.