about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-02 00:27:24 +0000
committerbors <bors@rust-lang.org>2024-01-02 00:27:24 +0000
commite73bb00542de825567024133711df4f12dd01e31 (patch)
treec6c5de6e2a079d24c24c7dbe1fbeb80980899290 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parente1dbafd875f898a14514b39c928e735fb5a7e6b4 (diff)
parent70024e16c000edfb56324852414760cc82567217 (diff)
downloadrust-e73bb00542de825567024133711df4f12dd01e31.tar.gz
rust-e73bb00542de825567024133711df4f12dd01e31.zip
Auto merge of #12026 - PartiallyTyped:12015, r=llogiq
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. If so, we lint that the initializer value can be made const.

changelog: new lint [`thread_local_initializer_can_be_made_const`]

fixes: #12015
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions