diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-01-22 16:55:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-22 16:55:00 +0100 |
| commit | d3761de43fbb66a19fb53cd25a7bdfcca0b7c318 (patch) | |
| tree | 01569c3d1b08ebd6f2878f9385f02c54263a399c /compiler/rustc_macros/src | |
| parent | 6e4933f94f9b06a7a5ab4ad3e39a0229e9f17023 (diff) | |
| parent | c43344e839906624a388847906f6a9b27dcd35c4 (diff) | |
| download | rust-d3761de43fbb66a19fb53cd25a7bdfcca0b7c318.tar.gz rust-d3761de43fbb66a19fb53cd25a7bdfcca0b7c318.zip | |
Rollup merge of #120181 - dtolnay:tlconst, r=thomcc
Allow any `const` expression blocks in `thread_local!`
This PR contains a rebase of the macro change from #116392, together with adding a test under library/std/tests.
Testing this feature by making the documentation's example code needlessly more complicated was not appropriate as pointed out in https://github.com/rust-lang/rust/pull/116392#pullrequestreview-1753097757.
Without the macro change, this new test would fail to build as follows:
```console
error: no rules expected the token `let`
--> library/std/tests/thread.rs:26:13
|
26 | let value = 1;
| ^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$init:expr`
--> library/std/src/thread/local.rs:189:69
|
189 | ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = const { $init:expr }; $($rest:tt)*) => (
| ^^^^^^^^^^
```
Closes #116392.
Diffstat (limited to 'compiler/rustc_macros/src')
0 files changed, 0 insertions, 0 deletions
