Skip to content

Commit 2f5294e

Browse files
committed
Fixes #35304
1 parent 40f3ee2 commit 2f5294e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/librustc_typeck/collect.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,10 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
772772
let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201,
773773
"duplicate definitions with name `{}`:",
774774
impl_item.name);
775-
span_note!(&mut err, *entry.get(),
776-
"previous definition of `{}` here",
777-
impl_item.name);
775+
err.span_label(*entry.get(),
776+
&format!("previous definition of `{}` here",
777+
impl_item.name));
778+
err.span_label(impl_item.span, &format!("duplicate definition"));
778779
err.emit();
779780
}
780781
Vacant(entry) => {

src/test/compile-fail/impl-duplicate-methods.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ struct Foo;
1212

1313
impl Foo {
1414
fn orange(&self) {} //~ NOTE previous definition of `orange` here
15-
fn orange(&self) {} //~ ERROR duplicate definitions with name `orange`
15+
fn orange(&self) {}
16+
//~^ ERROR duplicate definition
17+
//~| NOTE duplicate definition
1618
}
1719

1820
fn main() {}

0 commit comments

Comments
 (0)