diff options
| author | bors <bors@rust-lang.org> | 2021-11-18 23:54:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-18 23:54:14 +0000 |
| commit | 548c1088eff51fd92ad94d56b8c5b2d48b7088f0 (patch) | |
| tree | f708203519be2f68d88d88a5986eef1431b6e5c9 /compiler/rustc_codegen_llvm/src | |
| parent | cc946fcd326f7d85d4af096efdc73538622568e9 (diff) | |
| parent | 1ac5d7dcde57c3f4baa975d79dbdb57dfdb2489c (diff) | |
| download | rust-548c1088eff51fd92ad94d56b8c5b2d48b7088f0.tar.gz rust-548c1088eff51fd92ad94d56b8c5b2d48b7088f0.zip | |
Auto merge of #90774 - alexcrichton:tweak-const, r=m-ou-se
std: Tweak expansion of thread-local const
This commit tweaks the expansion of `thread_local!` when combined with a
`const { ... }` value to help ensure that the rules which apply to
`const { ... }` blocks will be the same as when they're stabilized.
Previously with this invocation:
thread_local!(static NAME: Type = const { init_expr });
this would generate (on supporting platforms):
#[thread_local]
static NAME: Type = init_expr;
instead the macro now expands to:
const INIT_EXPR: Type = init_expr;
#[thread_local]
static NAME: Type = INIT_EXPR;
with the hope that because `init_expr` is defined as a `const` item then
it's not accidentally allowing more behavior than if it were put into a
`static`. For example on the stabilization issue [this example][ex] now
gives the same error both ways.
[ex]: https://github.com/rust-lang/rust/issues/84223#issuecomment-953384298
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
