Rollup merge of #154336 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer

Remove more BuiltinLintDiag variants - part 3

Part of https://github.com/rust-lang/rust/issues/153099.

Last part of the "easy" migration.

r? @JonathanBrouwer
This commit is contained in:
Jonathan Brouwer
2026-03-24 22:36:57 +01:00
committed by GitHub
5 changed files with 10 additions and 18 deletions
@@ -153,9 +153,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
.into_diag(dcx, level)
}
BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => {
lints::UnusedCrateDependency { extern_crate, local_crate }.into_diag(dcx, level)
}
BuiltinLintDiag::AttributeLint(kind) => {
DecorateAttrLint { sess: self.sess, tcx: self.tcx, diagnostic: &kind }
.into_diag(dcx, level)
-8
View File
@@ -2994,14 +2994,6 @@ pub(crate) enum CargoHelp {
}
}
#[derive(Diagnostic)]
#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
pub(crate) struct UnusedCrateDependency {
pub extern_crate: Symbol,
pub local_crate: Symbol,
}
// FIXME(jdonszelmann): duplicated in rustc_attr_parsing, should be moved there completely.
#[derive(Diagnostic)]
#[diag(
-4
View File
@@ -690,10 +690,6 @@ pub enum BuiltinLintDiag {
/// Indicates if the named argument is used as a width/precision for formatting
is_formatting_arg: bool,
},
UnusedCrateDependency {
extern_crate: Symbol,
local_crate: Symbol,
},
AttributeLint(AttributeLintKind),
}
+2 -3
View File
@@ -23,15 +23,14 @@
use rustc_middle::ty::data_structures::IndexSet;
use rustc_middle::ty::{TyCtxt, TyCtxtFeed};
use rustc_proc_macro::bridge::client::ProcMacro;
use rustc_session::Session;
use rustc_session::config::{
CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers,
TargetModifier,
};
use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource};
use rustc_session::lint::{self, BuiltinLintDiag};
use rustc_session::output::validate_crate_name;
use rustc_session::search_paths::PathKind;
use rustc_session::{Session, lint};
use rustc_span::def_id::DefId;
use rustc_span::edition::Edition;
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
@@ -1211,7 +1210,7 @@ fn report_unused_deps_in_crate(&mut self, tcx: TyCtxt<'_>, krate: &ast::Crate) {
lint::builtin::UNUSED_CRATE_DEPENDENCIES,
span,
ast::CRATE_NODE_ID,
BuiltinLintDiag::UnusedCrateDependency {
errors::UnusedCrateDependency {
extern_crate: name_interned,
local_crate: tcx.crate_name(LOCAL_CRATE),
},
+8
View File
@@ -688,3 +688,11 @@ pub struct RawDylibMalformed {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
pub(crate) struct UnusedCrateDependency {
pub extern_crate: Symbol,
pub local_crate: Symbol,
}