Skip to content

Remove the deprecated unstable concat_idents! macro #142704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ builtin_macros_concat_bytes_oob = numeric literal is out of bounds
builtin_macros_concat_bytestr = cannot concatenate a byte string literal
builtin_macros_concat_c_str_lit = cannot concatenate a C string literal

builtin_macros_concat_idents_ident_args = `concat_idents!()` requires ident args

builtin_macros_concat_idents_missing_args = `concat_idents!()` takes 1 or more arguments
builtin_macros_concat_idents_missing_comma = `concat_idents!()` expecting comma
builtin_macros_concat_missing_literal = expected a literal
.note = only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()`

Expand Down
71 changes: 0 additions & 71 deletions compiler/rustc_builtin_macros/src/concat_idents.rs

This file was deleted.

21 changes: 0 additions & 21 deletions compiler/rustc_builtin_macros/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,27 +290,6 @@ pub(crate) struct ConcatBytesBadRepeat {
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_concat_idents_missing_args)]
pub(crate) struct ConcatIdentsMissingArgs {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_concat_idents_missing_comma)]
pub(crate) struct ConcatIdentsMissingComma {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_concat_idents_ident_args)]
pub(crate) struct ConcatIdentsIdentArgs {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag(builtin_macros_bad_derive_target, code = E0774)]
pub(crate) struct BadDeriveTarget {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ mod cfg_eval;
mod compile_error;
mod concat;
mod concat_bytes;
mod concat_idents;
mod define_opaque;
mod derive;
mod deriving;
Expand Down Expand Up @@ -84,7 +83,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
compile_error: compile_error::expand_compile_error,
concat: concat::expand_concat,
concat_bytes: concat_bytes::expand_concat_bytes,
concat_idents: concat_idents::expand_concat_idents,
const_format_args: format::expand_format_args,
core_panic: edition_panic::expand_panic,
env: env::expand_env,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ symbols! {
compiler_fence,
concat,
concat_bytes,
concat_idents,
conservative_impl_trait,
console,
const_allocate,
Expand Down
39 changes: 0 additions & 39 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 2 additions & 4 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@
#![feature(cfg_target_thread_local)]
#![feature(cfi_encoding)]
#![feature(char_max_len)]
#![feature(concat_idents)]
#![feature(core_float_math)]
#![feature(decl_macro)]
#![feature(deprecated_suggestion)]
Expand Down Expand Up @@ -717,10 +716,9 @@ pub use core::primitive;
pub use core::todo;
// Re-export built-in macros defined through core.
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
pub use core::{
assert, assert_matches, cfg, column, compile_error, concat, concat_idents, const_format_args,
env, file, format_args, format_args_nl, include, include_bytes, include_str, line, log_syntax,
assert, assert_matches, cfg, column, compile_error, concat, const_format_args, env, file,
format_args, format_args_nl, include, include_bytes, include_str, line, log_syntax,
module_path, option_env, stringify, trace_macros,
};
// Re-export macros defined in core.
Expand Down
3 changes: 1 addition & 2 deletions library/std/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ pub use crate::result::Result::{self, Err, Ok};

// Re-exported built-in macros
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
#[doc(no_inline)]
pub use core::prelude::v1::{
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, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ In stable Rust, there is no way to create new identifiers by joining identifiers
`#![feature(macro_metavar_expr_concat)]` introduces a way to do this, using the concat metavariable expression.

> This feature uses the syntax from [`macro_metavar_expr`] but is otherwise
> independent. It replaces the old unstable feature [`concat_idents`].
> independent. It replaces the since-removed unstable feature
> [`concat_idents`].

> This is an experimental feature; it and its syntax will require a RFC before stabilization.

Expand Down Expand Up @@ -126,8 +127,7 @@ test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini

[`paste`]: https://crates.io/crates/paste
[RFC 3086]: https://rust-lang.github.io/rfcs/3086-macro-metavar-expr.html
[`concat_idents!`]: https://doc.rust-lang.org/nightly/std/macro.concat_idents.html
[`macro_metavar_expr`]: ../language-features/macro-metavar-expr.md
[`concat_idents`]: ../library-features/concat-idents.md
[`concat_idents`]: https://github.com/rust-lang/rust/issues/29599
[#124225]: https://github.com/rust-lang/rust/issues/124225
[declarative macros]: https://doc.rust-lang.org/stable/reference/macros-by-example.html
27 changes: 0 additions & 27 deletions src/doc/unstable-book/src/library-features/concat-idents.md

This file was deleted.

2 changes: 0 additions & 2 deletions src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,6 @@ ui/issues/issue-32782.rs
ui/issues/issue-32797.rs
ui/issues/issue-32805.rs
ui/issues/issue-3290.rs
ui/issues/issue-32950.rs
ui/issues/issue-32995-2.rs
ui/issues/issue-32995.rs
ui/issues/issue-33202.rs
Expand Down Expand Up @@ -2341,7 +2340,6 @@ ui/issues/issue-49934.rs
ui/issues/issue-49955.rs
ui/issues/issue-49973.rs
ui/issues/issue-50187.rs
ui/issues/issue-50403.rs
ui/issues/issue-50411.rs
ui/issues/issue-50415.rs
ui/issues/issue-50442.rs
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ignore::Walk;
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.

const ISSUES_ENTRY_LIMIT: u32 = 1623;
const ISSUES_ENTRY_LIMIT: u32 = 1619;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
1 change: 0 additions & 1 deletion tests/rustdoc-js/big-result.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(concat_idents)]
#![allow(nonstandard_style)]
/// Generate 250 items that all match the query, starting with the longest.
/// Those long items should be dropped from the result set, and the short ones
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/derives/nonsense-input-to-debug.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Issue 32950
// Ensure that using macros rather than a type doesn't break `derive`.

#[derive(Debug)]
struct Nonsense<T> {
//~^ ERROR type parameter `T` is never used
should_be_vec_t: vec![T]
//~^ ERROR `derive` cannot be used on items with type macros
//~| ERROR expected type, found `expr` metavariable
}

fn main() {}
30 changes: 30 additions & 0 deletions tests/ui/derives/nonsense-input-to-debug.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error: `derive` cannot be used on items with type macros
--> $DIR/nonsense-input-to-debug.rs:7:22
|
LL | should_be_vec_t: vec![T]
| ^^^^^^^

error: expected type, found `expr` metavariable
--> $DIR/nonsense-input-to-debug.rs:7:22
|
LL | should_be_vec_t: vec![T]
| ^^^^^^^
| |
| expected type
| in this macro invocation
| this macro call doesn't expand to a type
|
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0392]: type parameter `T` is never used
--> $DIR/nonsense-input-to-debug.rs:5:17
|
LL | struct Nonsense<T> {
| ^ unused type parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0392`.
11 changes: 0 additions & 11 deletions tests/ui/feature-gates/feature-gate-concat_idents.rs

This file was deleted.

23 changes: 0 additions & 23 deletions tests/ui/feature-gates/feature-gate-concat_idents.stderr

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/feature-gates/feature-gate-concat_idents2.rs

This file was deleted.

Loading
Loading