about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorQuinn Sinclair <me@partiallytyped.dev>2023-12-27 16:25:59 +0200
committerPartiallyTyped <me@partiallytyped.dev>2024-01-01 18:06:10 +0200
commit70024e16c000edfb56324852414760cc82567217 (patch)
treec6c5de6e2a079d24c24c7dbe1fbeb80980899290 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parente1dbafd875f898a14514b39c928e735fb5a7e6b4 (diff)
downloadrust-70024e16c000edfb56324852414760cc82567217.tar.gz
rust-70024e16c000edfb56324852414760cc82567217.zip
New Lint: [`thread_local_initializer_can_be_made_const`]
Adds a new lint to suggest using `const` on `thread_local!`
initializers that can be evaluated at compile time.

Impl details:

The lint relies on the expansion of `thread_local!`. For non
const-labelled initializers, `thread_local!` produces a function
called `__init` that lazily initializes the value. We check the function
and decide whether the body can be const. The body of the function is
exactly the initializer. If so, we lint the body.

changelog: new lint [`thread_local_initializer_can_be_made_const`]
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions