Skip to content

Commit 4aff2c5

Browse files
authored
Rollup merge of #108377 - clubby789:duplicate-diagnostic-ice, r=compiler-errors
Fix ICE in 'duplicate diagnostic item' diagnostic Not sure how to add this in a test; I found it by mistakenly running `cargo fix --lib -p std` rather than `x fix` at the root.
2 parents f94c3c9 + 4332a27 commit 4aff2c5

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

compiler/rustc_passes/locales/en-US.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,10 @@ passes_duplicate_diagnostic_item =
407407
408408
passes_duplicate_diagnostic_item_in_crate =
409409
duplicate diagnostic item in crate `{$crate_name}`: `{$name}`.
410+
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
410411
411412
passes_diagnostic_item_first_defined =
412413
the diagnostic item is first defined here
413-
.note = the diagnostic item is first defined in crate `{$orig_crate_name}`.
414414
415415
passes_abi =
416416
abi: {$abi}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#![feature(rustc_attrs)]
2+
#[rustc_diagnostic_item = "Foo"]
3+
pub struct Foo {}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#![feature(rustc_attrs)]
2+
#[rustc_diagnostic_item = "Foo"]
3+
pub struct Foo {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// aux-build: p1.rs
2+
// aux-build: p2.rs
3+
4+
// error-pattern: duplicate diagnostic item in crate `p2`
5+
// error-pattern: note: the diagnostic item is first defined in crate `p1`
6+
7+
#![feature(rustc_attrs)]
8+
extern crate p1;
9+
extern crate p2;
10+
11+
#[rustc_diagnostic_item = "Foo"]
12+
pub struct Foo {} //~ ERROR duplicate diagnostic item found
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: duplicate diagnostic item in crate `p2`: `Foo`.
2+
|
3+
= note: the diagnostic item is first defined in crate `p1`.
4+
5+
error: duplicate diagnostic item found: `Foo`.
6+
--> $DIR/duplicate-diagnostic.rs:12:1
7+
|
8+
LL | pub struct Foo {}
9+
| ^^^^^^^^^^^^^^
10+
11+
error: aborting due to 2 previous errors
12+

0 commit comments

Comments
 (0)