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

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Jun 19, 2025

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 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: #29599

tgross35 added 3 commits June 19, 2025 06:29
`concat_idents!` is in the process of being removed, but a few things it
is used to test will still be relevant. Migrate these tests to something
other than `concat_idents`.
These tests were updated in the previous commit; while they are being
cleaned up, move them to a non-issue directory.
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
@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2025

r? @WaffleLapkin

rustbot has assigned @WaffleLapkin.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-rustdoc-search Area: Rustdoc's search feature A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 19, 2025
@rustbot

This comment was marked as outdated.

@tgross35
Copy link
Contributor Author

This shouldn't need any specific approval because of the completed FCP at #137653 (comment), but just as a heads up: @rust-lang/lang @rust-lang/libs

@fee1-dead
Copy link
Member

should we do a crater run?

@tgross35
Copy link
Contributor Author

tgross35 commented Jun 19, 2025

I don't think we necessarily need to act on any crater results, since anyone using this should already be getting the deprecation warnings. But it also doesn't hurt to see what those results might be.

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

⌛ Trying commit 938b6f5 with merge 1f5783c

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 19, 2025
Remove the deprecated `concat_idents!` macro

In [#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: #29599

[#137653]: #137653
[`macro_metavar_expr_concat`]: #124225
@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

☀️ Try build successful (CI)
Build commit: 1f5783c (1f5783cbeb5da8b38566d718631d016891e9c912, parent: 8a65ee08296b36342bf7c3cdc15312ccbc357227)

@tgross35
Copy link
Contributor Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-142704 created and queued.
🤖 Automatically detected try build 1f5783c
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 19, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-142704 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@traviscross traviscross added the T-lang Relevant to the language team label Jun 19, 2025
@aDotInTheVoid aDotInTheVoid changed the title Remove the deprecated concat_idents! macro Remove the deprecated unstable concat_idents! macro Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature A-tidy Area: The tidy tool S-waiting-on-crater Status: Waiting on a crater run to be completed. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for concat_idents
6 participants