Skip to content

Commit d54a564

Browse files
Rollup merge of rust-lang#154336 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Remove more BuiltinLintDiag variants - part 3 Part of rust-lang#153099. Last part of the "easy" migration. r? @JonathanBrouwer
2 parents 22f3a5d + c17dec6 commit d54a564

5 files changed

Lines changed: 10 additions & 18 deletions

File tree

compiler/rustc_lint/src/early/diagnostics.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> {
153153
.into_diag(dcx, level)
154154
}
155155

156-
BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => {
157-
lints::UnusedCrateDependency { extern_crate, local_crate }.into_diag(dcx, level)
158-
}
159156
BuiltinLintDiag::AttributeLint(kind) => {
160157
DecorateAttrLint { sess: self.sess, tcx: self.tcx, diagnostic: &kind }
161158
.into_diag(dcx, level)

compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,14 +2994,6 @@ pub(crate) mod unexpected_cfg_value {
29942994
}
29952995
}
29962996

2997-
#[derive(Diagnostic)]
2998-
#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
2999-
#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
3000-
pub(crate) struct UnusedCrateDependency {
3001-
pub extern_crate: Symbol,
3002-
pub local_crate: Symbol,
3003-
}
3004-
30052997
// FIXME(jdonszelmann): duplicated in rustc_attr_parsing, should be moved there completely.
30062998
#[derive(Diagnostic)]
30072999
#[diag(

compiler/rustc_lint_defs/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,6 @@ pub enum BuiltinLintDiag {
690690
/// Indicates if the named argument is used as a width/precision for formatting
691691
is_formatting_arg: bool,
692692
},
693-
UnusedCrateDependency {
694-
extern_crate: Symbol,
695-
local_crate: Symbol,
696-
},
697693
AttributeLint(AttributeLintKind),
698694
}
699695

compiler/rustc_metadata/src/creader.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ use rustc_middle::bug;
2323
use rustc_middle::ty::data_structures::IndexSet;
2424
use rustc_middle::ty::{TyCtxt, TyCtxtFeed};
2525
use rustc_proc_macro::bridge::client::ProcMacro;
26-
use rustc_session::Session;
2726
use rustc_session::config::{
2827
CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers,
2928
TargetModifier,
3029
};
3130
use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource};
32-
use rustc_session::lint::{self, BuiltinLintDiag};
3331
use rustc_session::output::validate_crate_name;
3432
use rustc_session::search_paths::PathKind;
33+
use rustc_session::{Session, lint};
3534
use rustc_span::def_id::DefId;
3635
use rustc_span::edition::Edition;
3736
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
@@ -1211,7 +1210,7 @@ impl CStore {
12111210
lint::builtin::UNUSED_CRATE_DEPENDENCIES,
12121211
span,
12131212
ast::CRATE_NODE_ID,
1214-
BuiltinLintDiag::UnusedCrateDependency {
1213+
errors::UnusedCrateDependency {
12151214
extern_crate: name_interned,
12161215
local_crate: tcx.crate_name(LOCAL_CRATE),
12171216
},

compiler/rustc_metadata/src/errors.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,11 @@ pub struct RawDylibMalformed {
688688
#[primary_span]
689689
pub span: Span,
690690
}
691+
692+
#[derive(Diagnostic)]
693+
#[diag("extern crate `{$extern_crate}` is unused in crate `{$local_crate}`")]
694+
#[help("remove the dependency or add `use {$extern_crate} as _;` to the crate root")]
695+
pub(crate) struct UnusedCrateDependency {
696+
pub extern_crate: Symbol,
697+
pub local_crate: Symbol,
698+
}

0 commit comments

Comments
 (0)