mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
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:
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user