about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/early/diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2025-09-14Move more early buffered lints to dyn lint diagnostics (4/N)León Orell Valerian Liehr-19/+0
2025-09-14Move more early buffered lints to dyn lint diagnostics (3/N)León Orell Valerian Liehr-8/+0
2025-09-14Remove a dead early lintLeón Orell Valerian Liehr-3/+0
Dropped in favor a hard error in RUST-127907.
2025-09-14Move more early buffered lints to dyn lint diagnostics (2/N)León Orell Valerian Liehr-13/+0
2025-09-14Move more early buffered lints to dyn lint diagnostics (1/N)León Orell Valerian Liehr-41/+0
2025-08-22Migrate `BuiltinLintDiag::HiddenUnicodeCodepoints` to use `LintDiagnostic` ↵Josh Triplett-21/+0
directly
2025-08-22Remove unused `BuiltinLintDiag` variant `InnerAttributeUnstable`Josh Triplett-6/+0
This variant doesn't appear to have ever been used. There's a matching message in `rustc_resolve`, that used to have a FIXME for porting it to the new diagnostic infrastructure, but that message is using `feature_err`, which doesn't use buffered lints. Thus, even when that does get ported, it won't use `BuiltinLintDiag`.
2025-08-22Migrate `BuiltinLintDiag::MissingAbi` to use `LintDiagnostic` directlyJosh Triplett-3/+0
2025-08-22Migrate `BuiltinLintDiag::UnexpectedBuiltinCfg` to use `LintDiagnostic` directlyJosh Triplett-3/+0
2025-08-20rustc_lint_defs: Eliminate the dependency on `rustc_hir` for `Namespace`Josh Triplett-4/+6
`rustc_lint_defs` uses `rustc_hir` solely for the `Namespace` type, which it only needs the static description from. Use the static description directly, to eliminate the dependency on `rustc_hir`. This reduces a long dependency chain: - Many things depend on `rustc_errors` - `rustc_errors` depends on `rustc_lint_defs` - `rustc_lint_defs` depended on `rustc_hir` prior to this commit - `rustc_hir` depends on `rustc_target`
2025-08-13Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmeaseJakub Beránek-2/+8
Remove unused `#[must_use]` Self-explanatory Fixes https://github.com/rust-lang/rust/issues/145257
2025-08-12Remove unused must_useMichael Goulet-2/+8
2025-08-11Add link to docs on malformed attributesEsteban Küber-1/+3
2025-07-15Implement resolver warnings about reexporting private dependenciesDavid Mládek-0/+3
2025-07-07Remove unused allow attrsYotam Ofek-3/+0
2025-06-12Make `missing_fragment_specifier` an unconditional errorTrevor Gross-3/+0
This was attempted in [1] then reverted in [2] because of fallout. Recently, this was made an edition-dependent error in [3]. Make missing fragment specifiers an unconditional error again. [1]: https://github.com/rust-lang/rust/pull/75516 [2]: https://github.com/rust-lang/rust/pull/80210 [3]: https://github.com/rust-lang/rust/pull/128006
2025-06-04Replace `elided_named_lifetimes` with `mismatched_lifetime_syntaxes`Jake Goulding-14/+3
2025-05-30Rollup merge of #141004 - matthewjasper:unicode-before-expansion, r=davidtwcoMatthias Krüger-0/+21
Report text_direction_codepoint_in_literal when parsing The lint is now reported in code that gets removed/modified/duplicated by macro expansion, and spans are more accurate so we don't get ICEs from trying to split a span in the middle of a character. This removes support for lint level attributes for `text_direction_codepoint_in_literal` except at the crate level, I don't think that there's an easy way around this when the lint can be reported on code that's removed by `cfg` or that is only in the input of a macro. Fixes #140281
2025-05-30Rollup merge of #133823 - estebank:issue-56328, r=petrochenkovMatthias Krüger-2/+2
Use `cfg_attr_trace` in AST with a placeholder attribute for accurate suggestion In rust-lang/rust#138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix rust-lang/rust#56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused `extern crate` --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; | ``` r? `@petrochenkov` try-job: x86_64-gnu-aux
2025-05-29Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnosticsEsteban Küber-2/+2
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused extern crate --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; LL + | ```
2025-05-27Report text_direction_codepoint_in_literal when parsingMatthew Jasper-0/+21
- The lint is now reported in code that gets removed/modified/duplicated by macro expansion. - Spans are more accurate - Fixes #140281
2025-05-26Expose `rustc_lint::decorate_builtin_lint` for use in `rustdoc`Urgau-1/+1
2025-02-20Reword messageEsteban Küber-2/+2
2025-02-19Specify scope in `out_of_scope_macro_calls` lintEsteban Küber-2/+2
``` warning: cannot find macro `in_root` in the crate root --> $DIR/key-value-expansion-scope.rs:1:10 | LL | #![doc = in_root!()] | ^^^^^^^ not found in the crate root | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #124535 <https://github.com/rust-lang/rust/issues/124535> = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[warn(out_of_scope_macro_calls)]` on by default ```
2025-02-11compiler: replace ExternAbi::name calls with formattersJubilee Young-2/+1
Most of these just format the ABI string, so... just format ExternAbi? This makes it more consistent and less jank when we can do it.
2025-01-23Make the wasm_c_abi future compat warning a hard errorbjorn3-1/+0
This is the next step in getting rid of the broken C abi for wasm32-unknown-unknown.
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-15Improve check-cfg Cargo macro diagnostic with crate nameUrgau-3/+3
2024-12-15Access `TyCtxt` from early diagnostic decorationUrgau-0/+468