From 84bbd650b016c6eec40f7b7bc49935e8c7f9ca39 Mon Sep 17 00:00:00 2001 From: athulappadan Date: Fri, 26 Aug 2016 10:32:06 +0530 Subject: [PATCH 1/2] Update compiler error 0034 to use new format. #35959 modified --- src/librustc_typeck/check/method/suggest.rs | 3 ++- src/test/compile-fail/E0034.rs | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 573dae46456ba..4d974749a3207 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -241,7 +241,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { MethodError::Ambiguity(sources) => { let mut err = struct_span_err!(self.sess(), span, E0034, - "multiple applicable items in scope"); + "multiple applicable items in scope"); + err.span_label(span, &format!("multiple `{}` found", item_name)); report_candidates(&mut err, sources); err.emit(); diff --git a/src/test/compile-fail/E0034.rs b/src/test/compile-fail/E0034.rs index 669bece0f7d17..136a74f7a8b74 100644 --- a/src/test/compile-fail/E0034.rs +++ b/src/test/compile-fail/E0034.rs @@ -18,9 +18,17 @@ trait Trait2 { fn foo(); } -impl Trait1 for Test { fn foo() {} } -impl Trait2 for Test { fn foo() {} } +impl Trait1 for Test { + fn foo() {} + //~^ NOTE candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` +} + +impl Trait2 for Test { + fn foo() {} + //~^ NOTE candidate #2 is defined in an impl of the trait `Trait2` for the type `Test` +} fn main() { - Test::foo() //~ ERROR E0034 + Test::foo() //~ ERROR multiple applicable items in scope + //~| NOTE multiple `foo` found } From 32eb3c83ee6422adbcaab9fdebb69dec68ba73fa Mon Sep 17 00:00:00 2001 From: athulappadan Date: Sat, 27 Aug 2016 16:18:39 +0530 Subject: [PATCH 2/2] Update compiler error 0034 to use new format. #35959 modified --- src/librustc_typeck/check/method/suggest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 4d974749a3207..0cdedd7e58ba4 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -241,7 +241,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { MethodError::Ambiguity(sources) => { let mut err = struct_span_err!(self.sess(), span, E0034, - "multiple applicable items in scope"); + "multiple applicable items in scope"); err.span_label(span, &format!("multiple `{}` found", item_name)); report_candidates(&mut err, sources);