diff options
| author | bohan <bohan-zhang@foxmail.com> | 2024-07-05 00:59:58 +0800 |
|---|---|---|
| committer | bohan <bohan-zhang@foxmail.com> | 2024-07-05 01:00:13 +0800 |
| commit | 07481b9e90df0860519043b54e07529003e74814 (patch) | |
| tree | 9f9362a36983e6d03f058999a51f241419827972 /tests/incremental | |
| parent | 9f877c9cd2c3f8f2f64df1e0c1804ad0682416d0 (diff) | |
| download | rust-07481b9e90df0860519043b54e07529003e74814.tar.gz rust-07481b9e90df0860519043b54e07529003e74814.zip | |
use old ctx if has same expand environment during decode span
Diffstat (limited to 'tests/incremental')
| -rw-r--r-- | tests/incremental/decl_macro.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/incremental/decl_macro.rs b/tests/incremental/decl_macro.rs new file mode 100644 index 00000000000..74810ae4227 --- /dev/null +++ b/tests/incremental/decl_macro.rs @@ -0,0 +1,34 @@ +//@ revisions: rpass1 rpass2 + +// issue#112680 + +#![feature(decl_macro)] + +pub trait T { + type Key; + fn index_from_key(key: Self::Key) -> usize; +} + +pub macro m($key_ty:ident, $val_ty:ident) { + struct $key_ty { + inner: usize, + } + + impl T for $val_ty { + type Key = $key_ty; + + fn index_from_key(key: Self::Key) -> usize { + key.inner + } + } +} + +m!(TestId, Test); + +#[cfg(rpass1)] +struct Test(u32); + +#[cfg(rpass2)] +struct Test; + +fn main() {} |
