Skip to content

Commit 22dd7b1

Browse files
committed
Move DuplicateEiiImpls to rustc_middle
1 parent cced03b commit 22dd7b1

3 files changed

Lines changed: 31 additions & 30 deletions

File tree

compiler/rustc_middle/src/error.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,32 @@ pub(crate) struct IncrementCompilation {
160160
pub run_cmd: String,
161161
pub dep_node: String,
162162
}
163+
164+
#[derive(Diagnostic)]
165+
#[diag("multiple implementations of `#[{$name}]`")]
166+
pub struct DuplicateEiiImpls {
167+
pub name: Symbol,
168+
169+
#[primary_span]
170+
#[label("first implemented here in crate `{$first_crate}`")]
171+
pub first_span: Span,
172+
pub first_crate: Symbol,
173+
174+
#[label("also implemented here in crate `{$second_crate}`")]
175+
pub second_span: Span,
176+
pub second_crate: Symbol,
177+
178+
#[note("in addition to these two, { $num_additional_crates ->
179+
[one] another implementation was found in crate {$additional_crate_names}
180+
*[other] more implementations were also found in the following crates: {$additional_crate_names}
181+
}")]
182+
pub additional_crates: Option<()>,
183+
184+
pub num_additional_crates: usize,
185+
pub additional_crate_names: String,
186+
187+
#[help(
188+
"an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
189+
)]
190+
pub help: (),
191+
}

compiler/rustc_passes/src/eii.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ use std::iter;
66
use rustc_data_structures::fx::FxIndexMap;
77
use rustc_hir::attrs::{EiiDecl, EiiImpl};
88
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
9+
use rustc_middle::error::DuplicateEiiImpls;
910
use rustc_middle::ty::TyCtxt;
1011
use rustc_session::config::CrateType;
1112

12-
use crate::errors::{DuplicateEiiImpls, EiiWithoutImpl};
13+
use crate::errors::EiiWithoutImpl;
1314

1415
#[derive(Clone, Copy, Debug)]
1516
enum CheckingMode {

compiler/rustc_passes/src/errors.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,35 +1224,6 @@ pub(crate) struct EiiWithoutImpl {
12241224
pub help: (),
12251225
}
12261226

1227-
#[derive(Diagnostic)]
1228-
#[diag("multiple implementations of `#[{$name}]`")]
1229-
pub(crate) struct DuplicateEiiImpls {
1230-
pub name: Symbol,
1231-
1232-
#[primary_span]
1233-
#[label("first implemented here in crate `{$first_crate}`")]
1234-
pub first_span: Span,
1235-
pub first_crate: Symbol,
1236-
1237-
#[label("also implemented here in crate `{$second_crate}`")]
1238-
pub second_span: Span,
1239-
pub second_crate: Symbol,
1240-
1241-
#[note("in addition to these two, { $num_additional_crates ->
1242-
[one] another implementation was found in crate {$additional_crate_names}
1243-
*[other] more implementations were also found in the following crates: {$additional_crate_names}
1244-
}")]
1245-
pub additional_crates: Option<()>,
1246-
1247-
pub num_additional_crates: usize,
1248-
pub additional_crate_names: String,
1249-
1250-
#[help(
1251-
"an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
1252-
)]
1253-
pub help: (),
1254-
}
1255-
12561227
#[derive(Diagnostic)]
12571228
#[diag("function doesn't have a default implementation")]
12581229
pub(crate) struct FunctionNotHaveDefaultImplementation {

0 commit comments

Comments
 (0)