Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion compiler/rustc_passes/src/eii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ pub(crate) fn check_externally_implementable_items<'tcx>(tcx: TyCtxt<'tcx>, ():
}

if default_impls.len() > 1 {
panic!("multiple not supported right now");
tcx.dcx().span_err(
decl.span,
format!(
"`{}` has more than one default implementation which is not supported",
tcx.item_name(decl_did)
),
);
continue;
}

let (local_impl, is_default) =
Expand Down
10 changes: 10 additions & 0 deletions e -i HEAD~2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
49b9580aa04 (HEAD -> main, origin/main, origin/HEAD) fixed the diagnostic message and fluent message inconsistency
22a10e199b8 lint: treat binders in improper_ctypes instead of ICE
ba86c0460b0 Auto merge of #149704 - matthiaskrgr:rollup-u4zhw99, r=matthiaskrgr
da2544bfbe8 Auto merge of #149495 - scottmcm:assume-filter-count, r=Mark-Simulacrum
60a4413ff0e Rollup merge of #149683 - korken89:fix-armv8r-tier, r=jieyouxu
4c8c967225b Rollup merge of #149401 - celinval:smir-109-name, r=scottmcm
8a6f82efac8 Rollup merge of #148814 - bend-n:stabilize_array_windows, r=scottmcm
f278da83859 Rollup merge of #148487 - Qelxiros:148441-option-into-flat-iter, r=scottmcm
865650a52f5 Rollup merge of #146826 - bluurryy:impl-allocator-for-mut-a, r=scottmcm
fbab541a7ad Auto merge of #149701 - jhpratt:rollup-cnlzfbv, r=jhpratt
13 changes: 13 additions & 0 deletions tests/ui/eii/multiple-default-impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ check-fail

#![feature(extern_item_impls)]

#[eii(eii1)]
//~^ ERROR `eii1` has more than one default implementation which is not supported
fn a() {}

#[eii(eii1)]
//~^ ERROR the name `eii1` is defined multiple times
//~| ERROR `#[eii1]` required, but not found
fn main() {}
//~^ ERROR the `main` function cannot be declared in an `extern` block
34 changes: 34 additions & 0 deletions tests/ui/eii/multiple-default-impls.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
error[E0428]: the name `eii1` is defined multiple times
--> $DIR/multiple-default-impls.rs:9:1
|
LL | #[eii(eii1)]
| ------------ previous definition of the macro `eii1` here
...
LL | #[eii(eii1)]
| ^^^^^^^^^^^^ `eii1` redefined here
|
= note: `eii1` must be defined only once in the macro namespace of this module

error: the `main` function cannot be declared in an `extern` block
--> $DIR/multiple-default-impls.rs:12:1
|
LL | fn main() {}
| ^^^^^^^^^

error: `eii1` has more than one default implementation which is not supported
--> $DIR/multiple-default-impls.rs:5:1
|
LL | #[eii(eii1)]
| ^^^^^^^^^^^^

error: `#[eii1]` required, but not found
--> $DIR/multiple-default-impls.rs:9:1
|
LL | #[eii(eii1)]
| ^^^^^^^^^^^^ expected because `#[eii1]` was declared here in crate `multiple_default_impls`
|
= help: expected at least one implementation in crate `multiple_default_impls` or any of its dependencies

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0428`.
Loading