rust/compiler/rustc_resolve/src
Jacob Pratt d3c9908a8a
Rollup merge of #145747 - joshtriplett:builtin-diag-dyn, r=jdonszelmann
Refactor lint buffering to avoid requiring a giant enum

Lint buffering currently relies on a giant enum `BuiltinLintDiag` containing all the lints that might potentially get buffered. In addition to being an unwieldy enum in a central crate, this also makes `rustc_lint_defs` a build bottleneck: it depends on various types from various crates (with a steady pressure to add more), and many crates depend on it.

Having all of these variants in a separate crate also prevents detecting when a variant becomes unused, which we can do with a dedicated type defined and used in the same crate.

Refactor this to use a dyn trait, to allow using `LintDiagnostic` types directly.

Because the existing `BuiltinLintDiag` requires some additional types in order to decorate some variants, which are only available later in `rustc_lint`, use an enum `DecorateDiagCompat` to handle both the `dyn LintDiagnostic` case and the `BuiltinLintDiag` case.

---

With the infrastructure in place, use it to migrate three of the enum variants to use `LintDiagnostic` directly, as a proof of concept and to demonstrate that the net result is a reduction in code size and a removal of a boilerplate-heavy layer of indirection.

Also remove an unused `BuiltinLintDiag` variant.
2025-08-22 22:00:59 -04:00
..
late Rollup merge of #145597 - petrochenkov:nolateset, r=b-naber 2025-08-22 22:00:51 -04:00
rustdoc Update tests to work with new DocFragment field and redundant_explicit_links new API 2025-06-23 16:02:34 +02:00
build_reduced_graph.rs Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkov 2025-08-21 01:12:19 -04:00
check_unused.rs Introduce ModernIdent type to unify macro 2.0 hygiene handling 2025-08-06 21:19:09 +08:00
def_collector.rs Pass the target type down to parse_attribute_list 2025-08-14 18:11:56 +02:00
diagnostics.rs resolve: Remove derive fallback lint id from ScopeSet::Late 2025-08-22 16:52:16 +03:00
effective_visibilities.rs resolve: Minimize borrow scopes for resolutions 2025-07-26 00:19:12 +03:00
errors.rs Rollup merge of #145166 - makai410:teach-pub-crate, r=lcnr 2025-08-19 19:42:08 +08:00
ident.rs resolve: Remove ScopeSet::Late 2025-08-22 16:52:16 +03:00
imports.rs resolve: early_resolve_ident_in_lexical_scope -> resolve_ident_in_scope_set 2025-08-22 16:52:16 +03:00
late.rs run spellcheck as a tidy extra check in ci 2025-08-16 09:51:44 -05:00
lib.rs Rollup merge of #145747 - joshtriplett:builtin-diag-dyn, r=jdonszelmann 2025-08-22 22:00:59 -04:00
macros.rs resolve: early_resolve_ident_in_lexical_scope -> resolve_ident_in_scope_set 2025-08-22 16:52:16 +03:00
rustdoc.rs rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansion 2025-07-22 18:36:09 -05:00