about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2024-02-28Add basic support for `f16` and `f128` to rustdocTrevor Gross-0/+6
2024-02-28Add regression test for inclusion of whitespace characters in rustdoc ↵Guillaume Gomez-1/+1
highlighting
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-25/+24
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-28Rename `Diagnostic` as `DiagInner`.Nicholas Nethercote-2/+2
I started by changing it to `DiagData`, but that didn't feel right. `DiagInner` felt much better.
2024-02-27Prevent inclusion of whitespace character after macro_rules identGuillaume Gomez-0/+1
2024-02-27Fix link generation for locate foreign macro in jump to definition featureGuillaume Gomez-1/+1
2024-02-26Rollup merge of #121590 - GuillaumeGomez:rustdoc-js-changed, r=notriddleGuillaume Gomez-3/+11
Correctly handle if rustdoc JS script hash changed It's something that annoyed me for quite some time: I have nightly docs open (for both std and compiler). And often, I don't look at the page for some days. Then when I come back to it, I make a search... except nothing happens. Took me a while to figure out that it was because the hash of one of the JS files we load for the search (either `search.js` or `search-index.js`) was updated in the meantime, preventing the search to be done. To go around it, I added to press `ENTER` to make the form submitted (which would reload the same page but with the correct hashes this time and the search being run). r? `@notriddle`
2024-02-25Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkinbors-5/+7
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](https://github.com/rust-lang/rust/issues/120363).
2024-02-25Rollup merge of #121060 - clubby789:bool-newtypes, r=cjgillotMatthias Krüger-2/+2
Add newtypes for bool fields/params/return types Fixed all the cases of this found with some simple searches for `*/ bool` and `bool /*`; probably many more
2024-02-25Correctly handle if rustdoc JS script hash changedGuillaume Gomez-3/+11
2024-02-24Rustdoc: include crate name in links for local primitivesGurinder Singh-2/+7
It makes the link easier to use in cases in which the path of the page where it will be embedded is not known beforehand such as when we generate impls dynamically from `register_type_impls` method in `main.js` Earlier for local primitives we would generate a path that was relative to the current page depth passed in `cx.current` . e.g if the current page was `std::simd::prelude::Simd` the generated path would be `../../primitive.<prim>.html` After this change the path will first take you to the the wesite root and add the crate name. e.g. for `std::simd::prelude::Simd` the path now will be `../../../std/primitive.<prim>.html`
2024-02-22Auto merge of #121129 - nnethercote:codegen-Diags, r=estebankbors-1/+1
Improve codegen diagnostic handling Clarify the workings of the temporary `Diagnostic` type used to send diagnostics from codegen threads to the main thread. r? `@estebank`
2024-02-22Overhaul `Diagnostic` args.Nicholas Nethercote-1/+1
First, introduce a typedef `DiagnosticArgMap`. Second, make the `args` field public, and remove the `args` getter and `replace_args` setter. These were necessary previously because the getter had a `#[allow(rustc::potential_query_instability)]` attribute, but that was removed in #120931 when the args were changed from `FxHashMap` to `FxIndexMap`. (All the other `Diagnostic` fields are public.)
2024-02-22Inline and remove `abort_on_err`.Nicholas Nethercote-3/+2
It's clumsy and doesn't improve readability.
2024-02-22Refactor `run_global_ctxt`.Nicholas Nethercote-7/+10
It currently is infallible and uses `abort_if_errors` and `FatalError.raise()` to signal errors. It's easy to instead return a `Result<_, ErrorGuaranteed>`, which is the more usual way of doing things.
2024-02-22Adjust the `has_errors*` methods.Nicholas Nethercote-4/+2
Currently `has_errors` excludes lint errors. This commit changes it to include lint errors. The motivation for this is that for most places it doesn't matter whether lint errors are included or not. But there are multiple places where they must be includes, and only one place where they must not be included. So it makes sense for `has_errors` to do the thing that fits the most situations, and the new `has_errors_excluding_lint_errors` method in the one exceptional place. The same change is made for `err_count`. Annoyingly, this requires the introduction of `err_count_excluding_lint_errs` for one place, to preserve existing error printing behaviour. But I still think the change is worthwhile overall.
2024-02-20Stabilize `LazyCell` and `LazyLock` (`lazy_cell`)Peter Jaszkowiak-1/+0
2024-05-23Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obkMatthias Krüger-5/+5
rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from https://github.com/rust-lang/rust/pull/121167.
2024-05-22rustc: Use `tcx.used_crates(())` moreVadim Petrochenkov-5/+5
And explain when it should be used.
2024-05-21PR feedbackBen Kimock-1/+1
2024-05-21Add a footer in FileEncoder and check for it in MemDecoderBen Kimock-1/+3
2024-02-20Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obkMatthias Krüger-9/+8
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings Fixes #114220. Follow-up to #120780. r? `@oli-obk`
2024-02-20Expand weak alias types before collecting constrained and referenced late ↵León Orell Valerian Liehr-9/+8
bound regions
2024-02-20Add newtype for raw identsclubby789-2/+2
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-18/+19
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-18Rollup merge of #121218 - ShoyuVanilla:fix-issue-76736, r=notriddleLeón Orell Valerian Liehr-7/+16
Fix missing trait impls for type in rustc docs Fixes #76736
2024-02-18Rollup merge of #121160 - fmease:rustdoc-fix-n-refactor-html-rendering, ↵León Orell Valerian Liehr-281/+173
r=GuillaumeGomez rustdoc: fix and refactor HTML rendering a bit * refactoring: get rid of a bunch of manual `f.alternate()` branches * not sure why this wasn't done so already, is this perf-sensitive? * fix an ICE in debug builds of rustdoc * rustdoc used to crash on empty outlives-bounds: `where 'a:` * properly escape const generic defaults * actually print empty trait and outlives-bounds (doesn't work for cross-crate reexports yet, will fix that at some other point) since they can have semantic significance * outlives-bounds: forces lifetime params to be early-bound instead of late-bound which is technically speaking part of the public API * trait-bounds: can affect the well-formedness, consider * makeshift “const-evaluatable” bounds under `generic_const_exprs` * bounds to force wf-checking in light of #100041 (quite artificial I know, I couldn't figure out something better), see https://github.com/rust-lang/rust/pull/121160#discussion_r1491563816
2024-02-18Rollup merge of #120526 - GuillaumeGomez:mobile-long-crate-name, r=notriddleLeón Orell Valerian Liehr-7/+2
rustdoc: Correctly handle long crate names on mobile Fixes https://github.com/rust-lang/rust/issues/120471. It now renders like this: ![image](https://github.com/rust-lang/rust/assets/3050060/065b4b8b-ba55-4163-a928-8d7bf735c111) r? `@notriddle`
2024-02-17Fix non_local_definitions lint in rustdocUrgau-5/+7
2024-02-17Fix missing trait impls for type in rustc docsShoyu Vanilla-7/+16
2024-02-16rustdoc: fix and refactor HTML rendering a bitLeón Orell Valerian Liehr-281/+173
2024-02-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-1/+1
Implement intrinsics with fallback bodies fixes #93145 (though we can port many more intrinsics) cc #63585 The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for * codegen_ssa (so llvm and gcc) * codegen_cranelift other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body). cc `@scottmcm` `@WaffleLapkin` ### todo * [ ] miri support * [x] default intrinsic name to name of function instead of requiring it to be specified in attribute * [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16Rollup merge of #121095 - chenyukang:yukang-fix-120998-rust-playground-link, ↵Guillaume Gomez-5/+64
r=GuillaumeGomez Add extra indent spaces for rust-playground link Fixes #120998 Seems add `rustfmt` for this is somehow too heavy, only adding indent spaces at the starting of each line of code seems good enough.
2024-02-15add extra indent spaces for rust-playground linkyukang-5/+64
2024-02-15Rollup merge of #121022 - fmease:rustdoc-x-crate-late-bound-lt-src-order, ↵Matthias Krüger-70/+85
r=GuillaumeGomez rustdoc: cross-crate re-exports: correctly render late-bound params in source order even if early-bound params are present r? ghost
2024-02-15rustdoc: cross-crate re-exports: correctly render late-bound params in ↵León Orell Valerian Liehr-70/+85
source order even if early-bound params are present
2024-02-13Rollup merge of #120999 - fmease:rustdoc-rm-instantiation-param, r=notriddleMatthias Krüger-73/+31
rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg` Probably better known as `SubstParam` (until #120958 which should've probably renamed it to `InstantiatedParam` but anyways). It doesn't make any sense to me why it should exist as a separate type. `GenericArg` is exactly what we want here anyways from a semantic perspective. Both have the same size btw. I also took the liberty of doing some drive-by cleanups.
2024-02-13Rollup merge of #120548 - GuillaumeGomez:glob-reexport-cfg-merge, ↵Matthias Krüger-1/+1
r=GuillaumeGomez rustdoc: Fix handling of doc_auto_cfg feature for cfg attributes on glob reexport This is a follow-up of #120501 and a part of https://github.com/rust-lang/rust/issues/120487. r? `@notriddle`
2024-02-13Replace clean::InstantiationParam with clean::GenericArgLeón Orell Valerian Liehr-73/+31
2024-02-12Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obkMatthias Krüger-12/+18
Dejargonize `subst` In favor of #110793, replace almost every occurence of `subst` and `substitution` from rustc codes, but they still remains in subtrees under `src/tools/` like clippy and test codes (I'd like to replace them after this)
2024-02-12Auto merge of #120980 - matthiaskrgr:rollup-dsjsqql, r=matthiaskrgrbors-1/+3
Rollup of 11 pull requests Successful merges: - #120765 (Reorder diagnostics API) - #120833 (More internal emit diagnostics cleanups) - #120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - #120917 (Remove a bunch of dead parameters in functions) - #120928 (Add test for recently fixed issue) - #120933 (check_consts: fix duplicate errors, make importance consistent) - #120936 (improve `btree_cursors` functions documentation) - #120944 (Check that the ABI of the instance we are inlining is correct) - #120956 (Clean inlined type alias with correct param-env) - #120962 (Add myself to library/std review) - #120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-12Implement intrinsics with fallback bodiesOli Scherer-1/+1
2024-02-12Dejargnonize substShoyu Vanilla-12/+18
2024-02-12Clean inlined type alias with correct param-envMichael Goulet-1/+3
2024-02-12Improve some codes according to the reviewsFrank King-4/+0
- improve diagnostics of field uniqueness check and representation check - simplify the implementation of field uniqueness check - remove some useless codes and improvement neatness
2024-02-12Fix compile error in rustdoc.Frank King-9/+2
2024-02-12Lower anonymous structs or unions to HIRFrank King-0/+14
2024-02-11Auto merge of #120619 - compiler-errors:param, r=lcnrbors-24/+56
Assert that params with the same *index* have the same *name* Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
2024-02-10Rollup merge of #120596 - GuillaumeGomez:jump-to-def-non-local-link, ↵Matthias Krüger-79/+171
r=notriddle,fmease [rustdoc] Correctly generate path for non-local items in source code pages While browsing some crates using the "jump to def" feature, I realized that a lot of items didn't have a link generated. The reason is because we only cache foreign items if they appear in the documented API. This means that for the others, we need to infer them. r? ``@notriddle``
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-0/+2
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````