turn panic into span_delayed_bug
This commit is contained in:
parent
bd137df64a
commit
1cd7cb1e8d
3 changed files with 26 additions and 1 deletions
|
|
@ -116,7 +116,8 @@ pub(crate) fn check_externally_implementable_items<'tcx>(tcx: TyCtxt<'tcx>, ():
|
|||
}
|
||||
|
||||
if default_impls.len() > 1 {
|
||||
panic!("multiple not supported right now");
|
||||
let decl_span = tcx.def_ident_span(decl_did).unwrap();
|
||||
tcx.dcx().span_delayed_bug(decl_span, "multiple not supported right now");
|
||||
}
|
||||
|
||||
let (local_impl, is_default) =
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
#![crate_type = "lib"]
|
||||
#![feature(extern_item_impls)]
|
||||
// `eii` expands to, among other things, `macro eii() {}`.
|
||||
// If we have two eiis named the same thing, we have a duplicate definition
|
||||
// for that macro. The compiler happily continues compiling on duplicate
|
||||
// definitions though, to emit as many diagnostics as possible.
|
||||
// However, in the case of eiis, this can break the assumption that every
|
||||
// eii has only one default implementation, since the default for both eiis will
|
||||
// name resolve to the same eii definiton (since the other definition was duplicate)
|
||||
// This test tests for the previously-ICE that occurred when this assumption
|
||||
// (of 1 default) was broken which was reported in #149982.
|
||||
|
||||
#[eii(eii1)]
|
||||
fn a() {}
|
||||
|
||||
#[eii(eii1)]
|
||||
//~^ ERROR the name `eii1` is defined multiple times
|
||||
fn b() {}
|
||||
|
|
|
|||
14
tests/ui/eii/default/multiple-default-impls.stderr
Normal file
14
tests/ui/eii/default/multiple-default-impls.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0428]: the name `eii1` is defined multiple times
|
||||
--> $DIR/multiple-default-impls.rs:16: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: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0428`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue