Skip to content
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

Remove duplicated errors for closure type mismatch #41760

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented May 5, 2017

Follow up to #41488.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member

eddyb commented May 5, 2017

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb May 5, 2017
.map_err(|e| OutputTypeParameterMismatch(expected_trait_ref, obligation_trait_ref, e))
.map_err(|e| {
let self_ty = expected_trait_ref.self_ty();
match (&self_ty.sty, &e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please just compare the # of parameters in the fn sig vs. the # of parameters in the obligation (that's obligation.predicate.skip_binder().subst_at(1))?

@@ -523,6 +524,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
{
let span = obligation.cause.span;

if !self.reported_selection_errors.borrow_mut().insert((span, error.clone())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds overly excessive. Outside of closures all trait errors are Unimplemented, so you are only showing 1 error per span.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it was surprising to me how many tests were affected by this. I'll think of a different way to deduplicate these errors...

Originally I was trying to get to the point where only one of FnMut and FnOnce were required, which feels like the correct way to accomplish this, but could not find where to tackle that (even pouring through the code and with full debugging output on :-/ ).

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 5, 2017
@estebank
Copy link
Contributor Author

estebank commented May 8, 2017

Superseded by #41840.

@estebank estebank closed this May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants