-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Prefer match over combinators to make some Box methods inlineable #81826
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
r? @Amanieu as allocator working group member. |
Both examples on godbolt already generate identical code. |
I would expect that Or could we change |
The |
16e5740
to
f005a74
Compare
Alright. I changed the code to prefer match expression over Result combinators. |
f005a74
to
fb4e734
Compare
@bors r+ |
📌 Commit fb4e734 has been approved by |
Rollup of 11 pull requests Successful merges: - rust-lang#72209 (Add checking for no_mangle to unsafe_code lint) - rust-lang#80732 (Allow Trait inheritance with cycles on associated types take 2) - rust-lang#81697 (Add "every" as a doc alias for "all".) - rust-lang#81826 (Prefer match over combinators to make some Box methods inlineable) - rust-lang#81834 (Resolve typedef in HashMap lldb pretty-printer only if possible) - rust-lang#81841 ([rustbuild] Output rustdoc-json-types docs ) - rust-lang#81849 (Expand the docs for ops::ControlFlow a bit) - rust-lang#81876 (parser: Fix panic in 'const impl' recovery) - rust-lang#81882 (:arrow_up: rust-analyzer) - rust-lang#81888 (Fix pretty printer macro_rules with semicolon.) - rust-lang#81896 (Remove outdated comment in windows' mutex.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Report: Now the two snippet generate identical asm without intermediate closure: https://rust.godbolt.org/z/fjrj4E |
Hopefully this patch would make two snippets generated identical code: https://rust.godbolt.org/z/fjrj4E.