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

libcore: Fix Sized bounds on overloaded function traits. #19573

Closed
wants to merge 1 commit into from
Closed

libcore: Fix Sized bounds on overloaded function traits. #19573

wants to merge 1 commit into from

Conversation

apasel422
Copy link
Contributor

  • Remove the for Sized? bound on core::ops::FnOnce, as it takes self by value and can never be implemented by an unsized type.
  • Add a missing Sized? bound to the blanket core::ops::FnMut impl, as both Fn and FnMut are for Sized?.

- Remove the `for Sized?` bound on `core::ops::FnOnce`, as it takes
  `self` by value and can never be implemented by an unsized type.
- Add a missing `Sized?` bound to the blanket `core::ops::FnMut` impl,
  as both `Fn` and `FnMut` are `for Sized?`.
@apasel422
Copy link
Contributor Author

Frankly, I'm not sure how useful it is for Fn and FnMut to be for Sized? either.

@apasel422
Copy link
Contributor Author

In #19467, types implementing these traits are passed by value. For example:

fn filter<P>(self, predicate: P) -> Filter<A, Self, P> where P: FnMut(&A)

So unsized types that implement the traits won't be usable there.

bors added a commit that referenced this pull request Dec 10, 2014
- Remove the `for Sized?` bound on `core::ops::FnOnce`, as it takes `self` by value and can never be implemented by an unsized type.
- Add a missing `Sized?` bound to the blanket `core::ops::FnMut` impl, as both `Fn` and `FnMut` are `for Sized?`.
@bors bors closed this Dec 10, 2014
@apasel422 apasel422 deleted the sized_fn_once branch December 10, 2014 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants