Files
rust/library/std/src
bors 548c1088ef 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
2021-11-18 23:54:14 +00:00
..
2021-10-25 22:44:41 -05:00
2021-10-25 22:44:41 -05:00
2021-11-11 11:40:34 +09:00
2021-02-06 13:05:56 +01:00
2021-11-06 16:13:14 +01:00
2021-11-10 08:35:42 -08:00
2021-05-19 15:52:09 +02:00
2020-09-02 17:37:40 -04:00
2021-10-04 10:29:46 +01:00
2021-10-25 22:44:41 -05:00
2021-10-25 22:44:41 -05:00
2021-11-09 10:22:28 -08:00
2021-11-09 19:11:01 -08:00
2021-08-01 11:19:24 -04:00
2021-10-19 15:02:21 +01:00