Skip to content

Conversation

estebank
Copy link
Contributor

@estebank estebank commented May 5, 2017

Follow up to #41488.

@rust-highfive
Copy link
Contributor

r? @eddyb

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

@estebank estebank force-pushed the closure-args-dedup branch from 58df6bd to e964329 Compare May 5, 2017 01:40
@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))?

{
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.

6 participants