Skip to content

Commit 3f0b9a1

Browse files
committed
Move DuplicateEiiImpls to rustc_middle
1 parent 0490dd9 commit 3f0b9a1

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
@@ -148,3 +148,32 @@ pub(crate) struct IncrementCompilation {
148148
pub run_cmd: String,
149149
pub dep_node: String,
150150
}
151+
152+
#[derive(Diagnostic)]
153+
#[diag("multiple implementations of `#[{$name}]`")]
154+
pub struct DuplicateEiiImpls {
155+
pub name: Symbol,
156+
157+
#[primary_span]
158+
#[label("first implemented here in crate `{$first_crate}`")]
159+
pub first_span: Span,
160+
pub first_crate: Symbol,
161+
162+
#[label("also implemented here in crate `{$second_crate}`")]
163+
pub second_span: Span,
164+
pub second_crate: Symbol,
165+
166+
#[note("in addition to these two, { $num_additional_crates ->
167+
[one] another implementation was found in crate {$additional_crate_names}
168+
*[other] more implementations were also found in the following crates: {$additional_crate_names}
169+
}")]
170+
pub additional_crates: Option<()>,
171+
172+
pub num_additional_crates: usize,
173+
pub additional_crate_names: String,
174+
175+
#[help(
176+
"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"
177+
)]
178+
pub help: (),
179+
}

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)