about summary refs log tree commit diff
path: root/src/librustdoc/passes
AgeCommit message (Collapse)AuthorLines
2024-04-25Fix some typos in commentsTechVest-1/+1
Signed-off-by: TechVest <techdashen@qq.com>
2024-04-13rustdoc: check redundant explicit links with correct itemidMichael Howell-11/+8
Fixes a regression caused by 0a50dba50bedd24377bd1066da3b4b7066df4d28
2024-04-09Rollup merge of #123647 - fmease:rustdoc-clean-up-blanket-impls-synth, r=camelidMatthias Krüger-3/+5
rustdoc: slightly clean up the synthesis of blanket impls Small follow-up to #123340 as promised in https://github.com/rust-lang/rust/pull/123340#discussion_r1546918604. No functional changes whatsoever. * inline the over-engineered “type namespace” (struct) `BlanketImplFinder` just like I did with `AutoTraitFinder` in #123340 * use the new `synthesize_*` terminology over the old nondescript / misleading `get_*` one * inline a `use super::*;` (not super modular, lead to `clean/mod.rs` (!) accumulating cruft) * use `tracing` properly r? GuillaumeGomez or rustdoc
2024-04-08rustdoc: slightly clean up the synthesis of blanket implsLeón Orell Valerian Liehr-3/+5
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+1
2024-04-06Add `f16` and `f128` to rustdoc's `PrimitiveType`Trevor Gross-0/+4
Fix a few places where these primitives were missing from librustdoc.
2024-03-28Correctly get complete intra-doc link dataGuillaume Gomez-1/+12
2024-03-22Programmatically convert some of the pat ctorsMichael Goulet-4/+2
2024-03-18Provide structured suggestion for `#![feature(foo)]`Esteban Küber-0/+1
``` error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | ``` Fix #55941.
2024-03-14hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`Vadim Petrochenkov-2/+1
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
2024-03-12s/mt/mutability/Oli Scherer-1/+1
2024-03-12Add `nested` bool to `DefKind::Static`.Oli Scherer-1/+1
Will be used in the next commit
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-3/+3
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-3/+3
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-2/+2
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-02-29Rename `DiagCtxt::with_emitter` as `DiagCtxt::new`.Nicholas Nethercote-1/+1
Because it's now the only constructor.
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-21/+20
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-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-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-11Auto merge of #120619 - compiler-errors:param, r=lcnrbors-3/+9
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-07Use correct param env when building and cleaning items in librustdocMichael Goulet-3/+9
2024-02-07docs: also check the inline stmt during redundant link checkbohan-17/+32
2024-02-06Rollup merge of #120575 - nnethercote:simplify-codegen-diag-handling, r=estebankMatthias Krüger-1/+1
Simplify codegen diagnostic handling Some nice improvements. Details in the individual commit logs. r? ````@estebank````
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-0/+1
2024-02-05Make `Emitter::emit_diagnostic` consuming.Nicholas Nethercote-1/+1
All the other `emit`/`emit_diagnostic` methods were recently made consuming (e.g. #119606), but this one wasn't. But it makes sense to. Much of this is straightforward, and lots of `clone` calls are avoided. There are a couple of tricky bits. - `Emitter::primary_span_formatted` no longer takes a `Diagnostic` and returns a pair. Instead it takes the two fields from `Diagnostic` that it used (`span` and `suggestions`) as `&mut`, and modifies them. This is necessary to avoid the cloning of `diag.children` in two emitters. - `from_errors_diagnostic` is rearranged so various uses of `diag` occur before the consuming `emit_diagnostic` call.
2024-01-23Rollup merge of #112806 - kadiwa4:collect_intra_doc_links, r=notriddleLeón Orell Valerian Liehr-64/+39
Small code improvements in `collect_intra_doc_links.rs` Makes some of the code more readable by shortening it, and removes some unnecessary bounds checks.
2024-01-23Rename `TyCtxt::struct_span_lint_hir` as `TyCtxt::node_span_lint`.Nicholas Nethercote-9/+9
2024-01-22Tweak error counting.Nicholas Nethercote-1/+1
We have several methods indicating the presence of errors, lint errors, and delayed bugs. I find it frustrating that it's very unclear which one you should use in any particular spot. This commit attempts to instill a basic principle of "use the least general one possible", because that reflects reality in practice -- `has_errors` is the least general one and has by far the most uses (esp. via `abort_if_errors`). Specifics: - Add some comments giving some usage guidelines. - Prefer `has_errors` to comparing `err_count` to zero. - Remove `has_errors_or_span_delayed_bugs` because it's a weird one: in the cases where we need to count delayed bugs, we should really be counting lint errors as well. - Rename `is_compilation_going_to_fail` as `has_errors_or_lint_errors_or_span_delayed_bugs`, for consistency with `has_errors` and `has_errors_or_lint_errors`. - Change a few other `has_errors_or_lint_errors` calls to `has_errors`, as per the "least general" principle. This didn't turn out to be as neat as I hoped when I started, but I think it's still an improvement.
2024-01-20Fix impl stripped in rustdoc HTML whereas it should not be in case the impl ↵Guillaume Gomez-12/+19
is implemented on a type alias
2024-01-17Make crate_inherent_impls fallible and stop using `track_errors` for itOli Scherer-1/+2
2024-01-13Add check for ui_testing via promoting parameters from `ParseSess` to `Session`George-lewis-4/+5
2024-01-10Rename consuming chaining methods on `DiagnosticBuilder`.Nicholas Nethercote-1/+1
In #119606 I added them and used a `_mv` suffix, but that wasn't great. A `with_` prefix has three different existing uses. - Constructors, e.g. `Vec::with_capacity`. - Wrappers that provide an environment to execute some code, e.g. `with_session_globals`. - Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`. The third case is exactly what we want, so this commit changes `DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`. Thanks to @compiler-errors for the suggestion.
2024-01-08Make `DiagnosticBuilder::emit` consuming.Nicholas Nethercote-1/+1
This works for most of its call sites. This is nice, because `emit` very much makes sense as a consuming operation -- indeed, `DiagnosticBuilderState` exists to ensure no diagnostic is emitted twice, but it uses runtime checks. For the small number of call sites where a consuming emit doesn't work, the commit adds `DiagnosticBuilder::emit_without_consuming`. (This will be removed in subsequent commits.) Likewise, `emit_unless` becomes consuming. And `delay_as_bug` becomes consuming, while `delay_as_bug_without_consuming` is added (which will also be removed in subsequent commits.) All this requires significant changes to `DiagnosticBuilder`'s chaining methods. Currently `DiagnosticBuilder` method chaining uses a non-consuming `&mut self -> &mut Self` style, which allows chaining to be used when the chain ends in `emit()`, like so: ``` struct_err(msg).span(span).emit(); ``` But it doesn't work when producing a `DiagnosticBuilder` value, requiring this: ``` let mut err = self.struct_err(msg); err.span(span); err ``` This style of chaining won't work with consuming `emit` though. For that, we need to use to a `self -> Self` style. That also would allow `DiagnosticBuilder` production to be chained, e.g.: ``` self.struct_err(msg).span(span) ``` However, removing the `&mut self -> &mut Self` style would require that individual modifications of a `DiagnosticBuilder` go from this: ``` err.span(span); ``` to this: ``` err = err.span(span); ``` There are *many* such places. I have a high tolerance for tedious refactorings, but even I gave up after a long time trying to convert them all. Instead, this commit has it both ways: the existing `&mut self -> Self` chaining methods are kept, and new `self -> Self` chaining methods are added, all of which have a `_mv` suffix (short for "move"). Changes to the existing `forward!` macro lets this happen with very little additional boilerplate code. I chose to add the suffix to the new chaining methods rather than the existing ones, because the number of changes required is much smaller that way. This doubled chainging is a bit clumsy, but I think it is worthwhile because it allows a *lot* of good things to subsequently happen. In this commit, there are many `mut` qualifiers removed in places where diagnostics are emitted without being modified. In subsequent commits: - chaining can be used more, making the code more concise; - more use of chaining also permits the removal of redundant diagnostic APIs like `struct_err_with_code`, which can be replaced easily with `struct_err` + `code_mv`; - `emit_without_diagnostic` can be removed, which simplifies a lot of machinery, removing the need for `DiagnosticBuilderState`.
2024-01-06Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errorsMatthias Krüger-2/+2
rustc_span: More consistent span combination operations Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits. This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-05rustc_span: Remove `fn fresh_expansion`Vadim Petrochenkov-2/+2
In the past it did create a fresh expansion, but now, after surviving a number of refactorings, it does not. Now it's just a thin wrapper around `apply_mark`.
2024-01-05Rollup merge of #119538 - nnethercote:cleanup-errors-5, r=compiler-errorsMichael Goulet-1/+1
Cleanup error handlers: round 5 More rustc_errors cleanups. A sequel to https://github.com/rust-lang/rust/pull/119171. r? ````@compiler-errors````
2024-01-04compiler: fix typosvuittont60-1/+1
librustdoc: fix typos
2024-01-03Rename some `Diagnostic` setters.Nicholas Nethercote-1/+1
`Diagnostic` has 40 methods that return `&mut Self` and could be considered setters. Four of them have a `set_` prefix. This doesn't seem necessary for a type that implements the builder pattern. This commit removes the `set_` prefixes on those four methods.
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-23Improve some names.Nicholas Nethercote-1/+1
Lots of vectors of messages called `message` or `msg`. This commit pluralizes them. Note that `emit_message_default` and `emit_messages_default` both already existed, and both process a vector, so I renamed the former `emit_messages_default_inner` because it's called by the latter.
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-2/+2
2023-12-18Rename `ParseSess::with_span_handler` as `ParseSess::with_dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `ParseSess::span_diagnostic` as `ParseSess::dcx`.Nicholas Nethercote-3/+2
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-2/+2
2023-12-15Rollup merge of #119004 - matthiaskrgr:conv, r=compiler-errorsJubilee-1/+1
NFC don't convert types to identical types
2023-12-15NFC don't convert types to identical typesMatthias Krüger-1/+1
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-16/+4
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-1/+1
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`