-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Make Clone a lang-item and implement it for closures whose members are all Clone #1369
Comments
Could this be implemented using default impls of |
This is also needed to fix rust-lang/rust#28229 |
Just thought I'd 👍 this and mention a couple use-cases I come across quite frequently:
|
Not just closures. Functions and arrays would be great as well. |
Meet this same issue, here is an example: #[derive(Debug)]
struct Take(String);
fn make<F>(func: F) -> Box<Fn(&str) -> Take>
where F: FnOnce(String) -> Take + Copy + 'static
{
Box::new(move |s| {
func(s.to_string())
})
}
fn main() {
let m = make(|s|Take(s));
println!("{:?}", m("abc"));
} should compile. |
I've started hitting this a lot, mostly in the "iterator ergonomics" that @mitchmindtree mentioned. I'm not sure why |
Since |
Since the RFC was accepted, closing in favour of the tracking issue rust-lang/rust#44490 |
moved from rust-lang/rust#23501
The text was updated successfully, but these errors were encountered: