Skip to content

Update compiler error 0034 to use new format. #35959 modified #36009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Member

@GuillaumeGomez GuillaumeGomez Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing the indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh!, I did that unintentionally. Will recommit it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit then squash. It'll be faster. If you don't know how to squash, take a look here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, that blog link is not loading.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine for me. :-/

err.span_label(span, &format!("multiple `{}` found", item_name));

report_candidates(&mut err, sources);
err.emit();
Expand Down
14 changes: 11 additions & 3 deletions src/test/compile-fail/E0034.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}