about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-02-20 15:13:51 +0100
committerGitHub <noreply@github.com>2024-02-20 15:13:51 +0100
commit4ff6bb51e24c93c5ad677f4c312104ce0844853b (patch)
treea90fdbb67f678caf633f67b8d45e68c962b4625f /compiler/rustc_pattern_analysis/src
parent073d2983a4840fadfd13588ba005a358966b6e24 (diff)
parent03d03c666c337acdaeb8911deaade55366bf8959 (diff)
downloadrust-4ff6bb51e24c93c5ad677f4c312104ce0844853b.tar.gz
rust-4ff6bb51e24c93c5ad677f4c312104ce0844853b.zip
Rollup merge of #121196 - Nilstrieb:the-clever-solution, r=saethlin
Always inline check in `assert_unsafe_precondition` with cfg(debug_assertions)

The current complexities in `assert_unsafe_precondition` are delicately balancing several concerns, among them compile times for the cases where there are no debug assertions. This comes at a large runtime cost when the assertions are enabled, making the debug assertion compiler a lot slower, which is very annoying.

To avoid this, we always inline the check when building with debug assertions.

Numbers (compiling stage1 library after touching core):
- master: 80s
- just adding `#[inline(always)]` to the `cfg(bootstrap)` `debug_assertions` (equivalent to a bootstrap bump (uhh, i just realized that i was on a slightly outdated master so this bump might have happened already), (#121112)): 67s
- this: 54s

So this seems like a good solution. I think we can still get the same run-time perf improvements for other users too by massaging this code further (see my other PR about adding `#[rustc_no_mir_inline]` #121114) but this is a simpler step that solves the imminent problem of "holy shit my rustc is sooo slow".

Funny consequence: This now means compiling the standard library with dbeug assertions makes it faster (than without, when using debug assertions downstream)!

r? ```@saethlin``` (or anyone else if someone wants to review this)

fixes #121110, supposedly
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions