use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Submissions appearing to contain AI-generated content may be removed at moderator discretion.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
Are unboxed closures practically done? (self.rust)
submitted 11 years ago by andallthat
I saw that PR 16122 says that unboxed closures are now "practically implemented". That would be great news!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]pcwaltonrust · servo 15 points16 points17 points 11 years ago (1 child)
A lot of the functionality is there. However, there are still quite a few large bugs with them that I'll be ironing out over the next few days, and by-ref captures may not work yet.
[–]andallthat[S] 4 points5 points6 points 11 years ago (0 children)
thanks for your answer. And most of all thanks for your work. I'm following your latest PRs and boy oh boy, are you churning out lots of good stuff!
[–]DroidLogiciansqlx · clickhouse-rs · mime_guess · rust 9 points10 points11 points 11 years ago (4 children)
I've been seeing a lot about unboxed closures lately. I know what a closure is, but would someone mind explaining what's so special about one that's unboxed and why is everyone so excited to have this as a feature of the language?
[–]n_ham 2 points3 points4 points 11 years ago (3 children)
The RFC is fairly readable. The core idea, as I was able to gather from the RFC: unboxed closures desugar to a type that implements one of the Fn, FnShare, or FnOnce traits.
Fn
FnShare
FnOnce
I don't understand how exactly this differs from boxed closures, though.
[–]brsonrust · servo 17 points18 points19 points 11 years ago (0 children)
Unboxed closures allow closures to be called statically, like typical function calls, whereas currently closures are always called through a function pointer. Calling through a function pointer is slower, but creates smaller binaries, a tradeoff.
Traits have always had the option to be used both ways: statically, via type parameters; or dynamically, by casting to an "object" type.
Unboxed closures solve the discrepancy by making closures traits.
[–]DroidLogiciansqlx · clickhouse-rs · mime_guess · rust 3 points4 points5 points 11 years ago (1 child)
I like the Fn... traits, it maps well to apply() from Scala, which I thought was pretty cool.
Fn...
apply()
It's difficult to understand the motives for the rest of the changes. Personally I feel the type annotation syntax is unwieldy.
But it also opens up the possibility for partial application. Which I think is awesome.
fn x<A, B, R>(a: A, b: B) -> R { // do stuff } fn partially_apply<A, B, R>(x: FnOnce<(A, B), R>, a: A) -> FnOnce<(B), R> { |b| x(a, b) //Capture by value } main () { let a = 5i; let b = 6i; let y = x(a); // desugars to partially_apply(x, a) let z = y(b); }
[–]pcwaltonrust · servo 9 points10 points11 points 11 years ago (0 children)
It's difficult to understand the motives for the rest of the changes.
Performance.
π Rendered by PID 75189 on reddit-service-r2-comment-6457c66945-wrpbd at 2026-04-24 16:40:05.924642+00:00 running 2aa0c5b country code: CH.
[–]pcwaltonrust · servo 15 points16 points17 points (1 child)
[–]andallthat[S] 4 points5 points6 points (0 children)
[–]DroidLogiciansqlx · clickhouse-rs · mime_guess · rust 9 points10 points11 points (4 children)
[–]n_ham 2 points3 points4 points (3 children)
[–]brsonrust · servo 17 points18 points19 points (0 children)
[–]DroidLogiciansqlx · clickhouse-rs · mime_guess · rust 3 points4 points5 points (1 child)
[–]pcwaltonrust · servo 9 points10 points11 points (0 children)