diff --git a/compiler/rustc_passes/src/eii.rs b/compiler/rustc_passes/src/eii.rs index 691576e6a05fc..0e2d495924b67 100644 --- a/compiler/rustc_passes/src/eii.rs +++ b/compiler/rustc_passes/src/eii.rs @@ -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) = diff --git a/e -i HEAD~2 b/e -i HEAD~2 new file mode 100644 index 0000000000000..c04fda91ad7d3 --- /dev/null +++ b/e -i HEAD~2 @@ -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 diff --git a/tests/ui/eii/multiple-default-impls.rs b/tests/ui/eii/multiple-default-impls.rs new file mode 100644 index 0000000000000..bf9cbfc7cb449 --- /dev/null +++ b/tests/ui/eii/multiple-default-impls.rs @@ -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 diff --git a/tests/ui/eii/multiple-default-impls.stderr b/tests/ui/eii/multiple-default-impls.stderr new file mode 100644 index 0000000000000..010720d36445b --- /dev/null +++ b/tests/ui/eii/multiple-default-impls.stderr @@ -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`.