about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-7/+7
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-18/+18
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-03-04Remove `file_path_mapping` param from `ParseSess::new`.Nicholas Nethercote-3/+1
It's always empty.
2024-03-02Auto merge of #121914 - Nadrieril:rollup-ol98ncg, r=Nadrierilbors-0/+4
Rollup of 5 pull requests Successful merges: - #120761 (Add initial support for DataFlowSanitizer) - #121622 (Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake) - #121716 (match lowering: Lower bindings in a predictable order) - #121731 (Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore) - #121841 (`f16` and `f128` step 2: intrinsics) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-02Rollup merge of #121855 - GuillaumeGomez:trait-item-info, r=notriddleMatthias Krüger-13/+14
Correctly generate item info of trait items Fixes #121772. The `document_info` function was wrongly used when documenting a trait item. r? `@notriddle`
2024-03-01Propegate HIR and AST `f16` and `f128` types to rustdocTrevor Gross-0/+4
2024-03-01Correctly generate item info of trait itemsGuillaume Gomez-13/+14
2024-03-01Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errorsbors-0/+6
Add stubs in IR and ABI for `f16` and `f128` This is the very first step toward the changes in https://github.com/rust-lang/rust/pull/114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary. These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`. The next steps will probably be AST support with parsing and the feature gate. r? `@compiler-errors` cc `@Nilstrieb` suggested breaking the PR up in https://github.com/rust-lang/rust/pull/120645#issuecomment-1925900572
2024-02-29Rollup merge of #121783 - nnethercote:emitter-cleanups, r=oli-obkGuillaume Gomez-17/+17
Emitter cleanups Some cleanups I made when reading emitter code. In particular, `HumanEmitter` and `JsonEmitter` have gone from three constructors to one. r? `@oli-obk`
2024-02-29Make `JsonEmitter` more like `HumanEmitter`.Nicholas Nethercote-7/+4
Use `derive(Setters)` to derive setters, and then change `JsonEmitter::new` to only have the arguments that are always used.
2024-02-29Inline and remove `JsonEmitter::{basic,stderr}`.Nicholas Nethercote-1/+3
They are so similar to `JsonEmitter::new` it's not worth having separate functions, it makes the code harder to read.
2024-02-29Inline and remove `HumanEmitter::stderr`.Nicholas Nethercote-3/+5
Because `HumanEmitter::new` is enough, in conjunction with the (renamed) `stderr_destination` function.
2024-02-29Rename `DiagCtxt::with_emitter` as `DiagCtxt::new`.Nicholas Nethercote-4/+4
Because it's now the only constructor.
2024-02-29Remove unnecessary `diagnostic_width` call.Nicholas Nethercote-3/+2
This `HumanEmitter` is only created to test if it supports colour. The diagnostic width isn't relevant.
2024-02-29Rollup merge of #121689 - GuillaumeGomez:rustdoc-highlighting-whitespace, ↵Matthias Krüger-1/+2
r=notriddle [rustdoc] Prevent inclusion of whitespace character after macro_rules ident Discovered this bug randomly when looking at: ![image](https://github.com/rust-lang/rust/assets/3050060/dca38047-9085-4377-bfac-f98890224be4) We were too eagerly trying to merge tokens that shouldn't be merged together (for example if you have a code comment followed by a code comment, we merge them in one attribute to reduce the DOM size). r? ``@notriddle``
2024-02-28Auto merge of #121489 - nnethercote:diag-renaming, r=davidtwcobors-27/+26
Diagnostic renaming Renaming various diagnostic types from `Diagnostic*` to `Diag*`. Part of https://github.com/rust-lang/compiler-team/issues/722. There are more to do but this is enough for one PR. r? `@davidtwco`
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-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