]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #92992 - kornelski:backtraceopt, r=Mark-Simulacrum
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 20 Jan 2022 16:10:40 +0000 (17:10 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Jan 2022 16:10:40 +0000 (17:10 +0100)
commit1cb57e2d2b6400ed6fb6d498cb5639fe6fd5d984
tree5e3dcae0bc73dd3264e076302666a31f26993119
parented3bf67db74ffa0165bef56d1d6597f5fa56a5fa
parentc2807525a5d7adff0e340007f73b9558f45e38b5
Rollup merge of #92992 - kornelski:backtraceopt, r=Mark-Simulacrum

Help optimize out backtraces when disabled

The comment in `rust_backtrace_env` says:

>    // If the `backtrace` feature of this crate isn't enabled quickly return
>   // `None` so this can be constant propagated all over the place to turn
>  // optimize away callers.

but this optimization has regressed, because the only caller of this function had an alternative path that unconditionally (and pointlessly) asked for a full backtrace, so the disabled state couldn't propagate.

I've added a getter for the full format that respects the feature flag, so that the caller will now be able to really optimize out the disabled backtrace path. I've also made `rust_backtrace_env` trivially inlineable when backtraces are disabled.