-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Inline const_eval_select
#98059
Inline const_eval_select
#98059
Conversation
To avoid circular link time dependency between core and compiler builtins when building with `-Zshare-generics`.
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@bors r+ |
📌 Commit 8a8404b has been approved by |
Shouldn't rust/library/core/src/num/f32.rs Line 939 in 083721a
|
Are you referring to a situation where we would generate an internal copy of
What is the implied difference between the closures and functions? And how does using functions help in debug mode? |
I see.
Closure calls seem to generate significantly more code: https://rust.godbolt.org/z/KaP4rKzoa Basically instead of a direct call of the closure function itself, FnOnce::call_once is called, which then calls the closure function.
Less llvm ir generated -> lower compile time & better runtime performance in debug mode |
The extra indirection is a shim that adapts Fn / FnMut closure to FnOnce. Functions would also use a shim in this context. |
I see. Would be nice to somehow remove the need for that shim in the context of const_eval_select. |
If closure captures a non-copy value then it would be FnOnce and shim will be omitted. Not exactly a serious proposal, but it's possible :-). |
…=Amanieu Inline `const_eval_select` To avoid circular link time dependency between core and compiler builtins when building with `-Zshare-generics`. r? `@Amanieu`
…=Amanieu Inline `const_eval_select` To avoid circular link time dependency between core and compiler builtins when building with `-Zshare-generics`. r? ``@Amanieu``
Rollup of 7 pull requests Successful merges: - rust-lang#97202 (os str capacity documentation) - rust-lang#97964 (Fix suggestions for `&a: T` parameters) - rust-lang#98053 (Fix generic impl rustdoc json output) - rust-lang#98059 (Inline `const_eval_select`) - rust-lang#98092 (Fix sidebar items expand collapse) - rust-lang#98119 (Refactor path segment parameter error) - rust-lang#98135 (Add regression test for rust-lang#93775) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
To avoid circular link time dependency between core and compiler
builtins when building with
-Zshare-generics
.r? @Amanieu