Skip to content

Commit 9154cc9

Browse files
author
Jonathan Turner
authored
Rollup merge of #35394 - mikhail-m1:master, r=jonathandturner
Update error format #35304 Fixes #35304 as part of #35233. r? @jonathandturner
2 parents 3e1fe82 + e7e5cfe commit 9154cc9

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
@@ -770,9 +770,10 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
770770
let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201,
771771
"duplicate definitions with name `{}`:",
772772
impl_item.name);
773-
span_note!(&mut err, *entry.get(),
774-
"previous definition of `{}` here",
775-
impl_item.name);
773+
err.span_label(*entry.get(),
774+
&format!("previous definition of `{}` here",
775+
impl_item.name));
776+
err.span_label(impl_item.span, &format!("duplicate definition"));
776777
err.emit();
777778
}
778779
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)