diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-24 15:39:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 15:39:38 +0200 |
| commit | 0377330be4b7fa7569e4b04113207468e002d1bb (patch) | |
| tree | 94b74a984795dbb1c680252f78e44905d5babea8 /library/core | |
| parent | 30550c048d0d15a91ecd678f265d331531d49f7b (diff) | |
| parent | 0e4de4ceb0086b7befab6736e45ac3efbc560cea (diff) | |
| download | rust-0377330be4b7fa7569e4b04113207468e002d1bb.tar.gz rust-0377330be4b7fa7569e4b04113207468e002d1bb.zip | |
Rollup merge of #142704 - tgross35:remove-concat_idents, r=fee1-dead
Remove the deprecated unstable `concat_idents!` macro
In [rust-lang/rust#137653], the lang and libs-API teams did a joint FCP to deprecate
and eventually remove the long-unstable `concat_idents!` macro. The
deprecation is landing in 1.88, so do the removal here (target version
1.90).
This macro has been superseded by the more recent `${concat(...)}`
metavariable expression language feature, which avoids some of the
limitations of `concat_idents!`. The metavar expression is unstably
available under the [`macro_metavar_expr_concat`] feature.
History is mildly interesting here: `concat_idents!` goes back to 2011
when it was introduced with 513276e595f8 ("Add #concat_idents[] and
#ident_to_str[]"). The syntax looks a bit different but it still works
about the same:
let asdf_fdsa = "<.<";
assert(#concat_idents[asd,f_f,dsa] == "<.<");
assert(#ident_to_str[use_mention_distinction]
== "use_mention_distinction");
(That test existed from introduction until its removal here.)
Closes: https://github.com/rust-lang/rust/issues/29599
[rust-lang/rust#137653]: https://github.com/rust-lang/rust/pull/137653
[`macro_metavar_expr_concat`]: https://github.com/rust-lang/rust/issues/124225
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/macros/mod.rs | 39 | ||||
| -rw-r--r-- | library/core/src/prelude/v1.rs | 3 |
2 files changed, 1 insertions, 41 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index d7b2ec81555..8035dccc632 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1109,45 +1109,6 @@ pub(crate) mod builtin { ($name:expr $(,)?) => {{ /* compiler built-in */ }}; } - /// Concatenates identifiers into one identifier. - /// - /// This macro takes any number of comma-separated identifiers, and - /// concatenates them all into one, yielding an expression which is a new - /// identifier. Note that hygiene makes it such that this macro cannot - /// capture local variables. Also, as a general rule, macros are only - /// allowed in item, statement or expression position. That means while - /// you may use this macro for referring to existing variables, functions or - /// modules etc, you cannot define a new one with it. - /// - /// # Examples - /// - /// ``` - /// #![feature(concat_idents)] - /// - /// # fn main() { - /// fn foobar() -> u32 { 23 } - /// - /// let f = concat_idents!(foo, bar); - /// println!("{}", f()); - /// - /// // fn concat_idents!(new, fun, name) { } // not usable in this way! - /// # } - /// ``` - #[unstable( - feature = "concat_idents", - issue = "29599", - reason = "`concat_idents` is not stable enough for use and is subject to change" - )] - #[deprecated( - since = "1.88.0", - note = "use `${concat(...)}` with the `macro_metavar_expr_concat` feature instead" - )] - #[rustc_builtin_macro] - #[macro_export] - macro_rules! concat_idents { - ($($e:ident),+ $(,)?) => {{ /* compiler built-in */ }}; - } - /// Concatenates literals into a byte slice. /// /// This macro takes any number of comma-separated literals, and concatenates them all into diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index 8f1b5275871..7b9e04920d5 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -58,10 +58,9 @@ pub use crate::fmt::macros::Debug; pub use crate::hash::macros::Hash; #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -#[allow(deprecated)] #[doc(no_inline)] pub use crate::{ - assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, + assert, cfg, column, compile_error, concat, env, file, format_args, format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env, stringify, trace_macros, }; |
