diff options
| author | bors <bors@rust-lang.org> | 2024-06-14 16:41:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-14 16:41:39 +0000 |
| commit | f8e566053207b4ecbcbc7a7d6ded82c43061e3da (patch) | |
| tree | cf1ed832c3ef86f90448770fa7cfdb98c21b4f0c /compiler/rustc_feature/src | |
| parent | 7ac6c2fc685681824fbfc156b38035df743881dd (diff) | |
| parent | 4b82afb40c91fafdc9e4d84d4782573f848d84d9 (diff) | |
| download | rust-f8e566053207b4ecbcbc7a7d6ded82c43061e3da.tar.gz rust-f8e566053207b4ecbcbc7a7d6ded82c43061e3da.zip | |
Auto merge of #118958 - c410-f3r:concat-again, r=petrochenkov
Add a new concat metavar expr
Revival of #111930
Giving it another try now that #117050 was merged.
With the new rules, meta-variable expressions must be referenced with a dollar sign (`$`) and this can cause misunderstands with `$concat`.
```rust
macro_rules! foo {
( $bar:ident ) => {
const ${concat(VAR, bar)}: i32 = 1;
};
}
// Will produce `VARbar` instead of `VAR_123`
foo!(_123);
```
In other words, forgetting the dollar symbol can produce undesired outputs.
cc #29599
cc https://github.com/rust-lang/rust/issues/124225
Diffstat (limited to 'compiler/rustc_feature/src')
| -rw-r--r-- | compiler/rustc_feature/src/unstable.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 2d13f430cfc..58832cb1087 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -516,6 +516,8 @@ declare_features! ( (unstable, lint_reasons, "1.31.0", Some(54503)), /// Give access to additional metadata about declarative macro meta-variables. (unstable, macro_metavar_expr, "1.61.0", Some(83527)), + /// Provides a way to concatenate identifiers using metavariable expressions. + (unstable, macro_metavar_expr_concat, "CURRENT_RUSTC_VERSION", Some(124225)), /// Allows `#[marker]` on certain traits allowing overlapping implementations. (unstable, marker_trait_attr, "1.30.0", Some(29864)), /// Allows exhaustive pattern matching on types that contain uninhabited types in cases that are |
