Skip to content

Commit fb65fe9

Browse files
committed
Update compiler error 0034 to use new format.
1 parent addb753 commit fb65fe9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/librustc_typeck/check/method/suggest.rs

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
242242
MethodError::Ambiguity(sources) => {
243243
let mut err = struct_span_err!(self.sess(), span, E0034,
244244
"multiple applicable items in scope");
245+
err.span_label(span, &format!("multiple `{}` found", item_name));
245246

246247
report_candidates(&mut err, sources);
247248
err.emit();

src/test/compile-fail/E0034.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ trait Trait2 {
1818
fn foo();
1919
}
2020

21-
impl Trait1 for Test { fn foo() {} }
22-
impl Trait2 for Test { fn foo() {} }
21+
impl Trait1 for Test {
22+
fn foo() {}
23+
//~^ NOTE candidate #1 is defined in an impl of the trait `Trait1` for the type `Test`
24+
}
25+
26+
impl Trait2 for Test {
27+
fn foo() {}
28+
//~^ NOTE candidate #2 is defined in an impl of the trait `Trait2` for the type `Test`
29+
}
2330

2431
fn main() {
25-
Test::foo() //~ ERROR E0034
32+
Test::foo() //~ ERROR multiple applicable items in scope
33+
//~| NOTE multiple `foo` found
2634
}

0 commit comments

Comments
 (0)