Skip to content

Commit 16f6cf8

Browse files
fixed ICE for more than one eii implementations
1 parent 3f4dc1e commit 16f6cf8

File tree

4 files changed

+56
-1
lines changed

4 files changed

+56
-1
lines changed

compiler/rustc_passes/src/eii.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@ pub(crate) fn check_externally_implementable_items<'tcx>(tcx: TyCtxt<'tcx>, ():
116116
}
117117

118118
if default_impls.len() > 1 {
119-
panic!("multiple not supported right now");
119+
tcx.dcx().span_err(
120+
decl.span,
121+
format!(
122+
"`{}` has more than one default implementation which is not supported",
123+
tcx.item_name(decl_did)
124+
),
125+
);
126+
return;
120127
}
121128

122129
let (local_impl, is_default) =

e -i HEAD~2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
49b9580aa04 (HEAD -> main, origin/main, origin/HEAD) fixed the diagnostic message and fluent message inconsistency
2+
22a10e199b8 lint: treat binders in improper_ctypes instead of ICE
3+
ba86c0460b0 Auto merge of #149704 - matthiaskrgr:rollup-u4zhw99, r=matthiaskrgr
4+
da2544bfbe8 Auto merge of #149495 - scottmcm:assume-filter-count, r=Mark-Simulacrum
5+
60a4413ff0e Rollup merge of #149683 - korken89:fix-armv8r-tier, r=jieyouxu
6+
4c8c967225b Rollup merge of #149401 - celinval:smir-109-name, r=scottmcm
7+
8a6f82efac8 Rollup merge of #148814 - bend-n:stabilize_array_windows, r=scottmcm
8+
f278da83859 Rollup merge of #148487 - Qelxiros:148441-option-into-flat-iter, r=scottmcm
9+
865650a52f5 Rollup merge of #146826 - bluurryy:impl-allocator-for-mut-a, r=scottmcm
10+
fbab541a7ad Auto merge of #149701 - jhpratt:rollup-cnlzfbv, r=jhpratt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ check-fail
2+
3+
#![feature(extern_item_impls)]
4+
5+
#[eii(eii1)]
6+
//~^ ERROR `eii1` has more than one default implementation which is not supported
7+
fn a() {}
8+
9+
#[eii(eii1)]
10+
//~^ ERROR the name `eii1` is defined multiple times
11+
fn main() {}
12+
//~^ ERROR the `main` function cannot be declared in an `extern` block
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error[E0428]: the name `eii1` is defined multiple times
2+
--> $DIR/multiple-default-impls.rs:9:1
3+
|
4+
LL | #[eii(eii1)]
5+
| ------------ previous definition of the macro `eii1` here
6+
...
7+
LL | #[eii(eii1)]
8+
| ^^^^^^^^^^^^ `eii1` redefined here
9+
|
10+
= note: `eii1` must be defined only once in the macro namespace of this module
11+
12+
error: the `main` function cannot be declared in an `extern` block
13+
--> $DIR/multiple-default-impls.rs:11:1
14+
|
15+
LL | fn main() {}
16+
| ^^^^^^^^^
17+
18+
error: `eii1` has more than one default implementation which is not supported
19+
--> $DIR/multiple-default-impls.rs:5:1
20+
|
21+
LL | #[eii(eii1)]
22+
| ^^^^^^^^^^^^
23+
24+
error: aborting due to 3 previous errors
25+
26+
For more information about this error, try `rustc --explain E0428`.

0 commit comments

Comments
 (0)