Skip to content

Commit

Permalink
Rollup merge of rust-lang#35394 - mikhail-m1:master, r=jonathandturner
Browse files Browse the repository at this point in the history
Update error format rust-lang#35304

Fixes rust-lang#35304 as part of rust-lang#35233.

r? @jonathandturner
  • Loading branch information
Jonathan Turner committed Aug 6, 2016
2 parents edd8e04 + e7e5cfe commit 5e84fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,10 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201,
"duplicate definitions with name `{}`:",
impl_item.name);
span_note!(&mut err, *entry.get(),
"previous definition of `{}` here",
impl_item.name);
err.span_label(*entry.get(),
&format!("previous definition of `{}` here",
impl_item.name));
err.span_label(impl_item.span, &format!("duplicate definition"));
err.emit();
}
Vacant(entry) => {
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/impl-duplicate-methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ struct Foo;

impl Foo {
fn orange(&self) {} //~ NOTE previous definition of `orange` here
fn orange(&self) {} //~ ERROR duplicate definitions with name `orange`
fn orange(&self) {}
//~^ ERROR duplicate definition
//~| NOTE duplicate definition
}

fn main() {}

0 comments on commit 5e84fc4

Please sign in to comment.