Skip to content

Commit b24d9ad

Browse files
Rollup merge of rust-lang#142704 - tgross35:remove-concat_idents, r=fee1-dead
Remove the deprecated unstable `concat_idents!` macro In [rust-lang#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 513276e ("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: rust-lang#29599 [rust-lang#137653]: rust-lang#137653 [`macro_metavar_expr_concat`]: rust-lang#124225
2 parents 766aa60 + 395ae00 commit b24d9ad

File tree

4 files changed

+4
-47
lines changed

4 files changed

+4
-47
lines changed

core/src/macros/mod.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,45 +1109,6 @@ pub(crate) mod builtin {
11091109
($name:expr $(,)?) => {{ /* compiler built-in */ }};
11101110
}
11111111

1112-
/// Concatenates identifiers into one identifier.
1113-
///
1114-
/// This macro takes any number of comma-separated identifiers, and
1115-
/// concatenates them all into one, yielding an expression which is a new
1116-
/// identifier. Note that hygiene makes it such that this macro cannot
1117-
/// capture local variables. Also, as a general rule, macros are only
1118-
/// allowed in item, statement or expression position. That means while
1119-
/// you may use this macro for referring to existing variables, functions or
1120-
/// modules etc, you cannot define a new one with it.
1121-
///
1122-
/// # Examples
1123-
///
1124-
/// ```
1125-
/// #![feature(concat_idents)]
1126-
///
1127-
/// # fn main() {
1128-
/// fn foobar() -> u32 { 23 }
1129-
///
1130-
/// let f = concat_idents!(foo, bar);
1131-
/// println!("{}", f());
1132-
///
1133-
/// // fn concat_idents!(new, fun, name) { } // not usable in this way!
1134-
/// # }
1135-
/// ```
1136-
#[unstable(
1137-
feature = "concat_idents",
1138-
issue = "29599",
1139-
reason = "`concat_idents` is not stable enough for use and is subject to change"
1140-
)]
1141-
#[deprecated(
1142-
since = "1.88.0",
1143-
note = "use `${concat(...)}` with the `macro_metavar_expr_concat` feature instead"
1144-
)]
1145-
#[rustc_builtin_macro]
1146-
#[macro_export]
1147-
macro_rules! concat_idents {
1148-
($($e:ident),+ $(,)?) => {{ /* compiler built-in */ }};
1149-
}
1150-
11511112
/// Concatenates literals into a byte slice.
11521113
///
11531114
/// This macro takes any number of comma-separated literals, and concatenates them all into

core/src/prelude/v1.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ pub use crate::fmt::macros::Debug;
5858
pub use crate::hash::macros::Hash;
5959

6060
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
61-
#[allow(deprecated)]
6261
#[doc(no_inline)]
6362
pub use crate::{
64-
assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
63+
assert, cfg, column, compile_error, concat, env, file, format_args,
6564
format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
6665
stringify, trace_macros,
6766
};

std/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@
281281
#![feature(cfg_target_thread_local)]
282282
#![feature(cfi_encoding)]
283283
#![feature(char_max_len)]
284-
#![feature(concat_idents)]
285284
#![feature(core_float_math)]
286285
#![feature(decl_macro)]
287286
#![feature(deprecated_suggestion)]
@@ -717,10 +716,9 @@ pub use core::primitive;
717716
pub use core::todo;
718717
// Re-export built-in macros defined through core.
719718
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
720-
#[allow(deprecated)]
721719
pub use core::{
722-
assert, assert_matches, cfg, column, compile_error, concat, concat_idents, const_format_args,
723-
env, file, format_args, format_args_nl, include, include_bytes, include_str, line, log_syntax,
720+
assert, assert_matches, cfg, column, compile_error, concat, const_format_args, env, file,
721+
format_args, format_args_nl, include, include_bytes, include_str, line, log_syntax,
724722
module_path, option_env, stringify, trace_macros,
725723
};
726724
// Re-export macros defined in core.

std/src/prelude/v1.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ pub use crate::result::Result::{self, Err, Ok};
4545

4646
// Re-exported built-in macros
4747
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
48-
#[allow(deprecated)]
4948
#[doc(no_inline)]
5049
pub use core::prelude::v1::{
51-
assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
50+
assert, cfg, column, compile_error, concat, env, file, format_args,
5251
format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
5352
stringify, trace_macros, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd,
5453
};

0 commit comments

Comments
 (0)