You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#148820 - oli-obk:comptime, r=fee1-dead
Add very basic "comptime" fn implementation
Implements functions that cannot be called at runtime (and thus also not from normal const functions, as those could be called from runtime).
This is done via the internal attribute `rustc_comptime` that can be added to normal functions, turning them into compile-time-only functions.
Because @fee1-dead and @compiler-errors did amazing work, we even get trait bounds that work inside comptime fns: via unconditionally-const `const Trait` bounds.
Use cases are
* rust-lang#146923
* const heap intrinsics
* and the other various intrinsics (e.g. size_of 😆) that will just ICE in codegen or panic at runtime if they actually end up in runtime code
project goal issue: rust-lang/rust-project-goals#406
no tracking issue until we have a feature gate and some sort of syntax
cc @scottmcm as the T-lang goal champion
0 commit comments