mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-29 03:53:55 +00:00
`concat_idents` has been around unstably for a long time, but there is
now a better (but still unstable) way to join identifiers using
`${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves
a lot of the problems with `concat_idents` and is on a better track
toward stabilization, so there is no need to keep both versions around.
`concat_idents!` still has a lot of use in the ecosystem so deprecate it
before removing, as discussed in [1].
Link: https://github.com/rust-lang/rust/issues/124225
[1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
16 lines
468 B
Rust
16 lines
468 B
Rust
//@ run-pass
|
|
|
|
#![feature(concat_idents)]
|
|
#![expect(deprecated)] // concat_idents is deprecated
|
|
|
|
pub fn main() {
|
|
struct Foo;
|
|
let _: concat_idents!(F, oo) = Foo; // Test that `concat_idents!` can be used in type positions
|
|
|
|
let asdf_fdsa = "<.<".to_string();
|
|
// concat_idents should have call-site hygiene.
|
|
assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string());
|
|
|
|
assert_eq!(stringify!(use_mention_distinction), "use_mention_distinction");
|
|
}
|