Skip to content

Replace builtin # with forced keywords - #23625

Closed
jeffs wants to merge 1 commit into
rust-lang:masterfrom
jeffs:fix-23622-forced-keywords
Closed

jeffs wants to merge 1 commit into
rust-lang:masterfrom
jeffs:fix-23622-forced-keywords

Conversation

@jeffs

@jeffs jeffs commented Nov 6, 2026 •

Copy link
Copy Markdown

Fixes #23622.

As of rust-lang/rust#162232, built-in macros like offset_of! expand to k#offset_of(...) rather than builtin # offset_of(...). offset_of in particular was changed on expr.rs:798. This PR also updates format_args, asm, global_asm, naked_asm, include_bytes, cfg, pattern_type, and deref.

This was a lot of Whac-a-Mole, and my first contribution to RA. I made the code changes by hand, but with heavy guidance from AI.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 6, 2026
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Per our AI policy, E-easy+E-has-instructions issues, like that one, cannot use code written by AI. So, did the AI guidance include writing code? AI used not for writing code is fine, as you can see in the policy.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Also, and sorry for not remembering that earlier, we cannot remove builtin # yet because we also need to support older versions, so we should support both syntaxes in the meantime (but do switch the tests except for a few maybe).

@jeffs

jeffs commented Nov 7, 2026 •

Copy link
Copy Markdown
Author

No, AI did not write any of the code. I read the AI policy, and complied with it. Thanks for the guidance, and I will leave any remaining changes to an expert.

For future reference, where are the instructions? In particular, where should a newcomer learn that a ticket like this requires cargo codegen, env UPDATE_EXPECT=1 cargo qt, the comment-based DSL used to define many of the tests, etc.? (And is there any introduction to macros like T![] that are used heavily in the code?)

@jeffs

jeffs commented Nov 7, 2026

Copy link
Copy Markdown
Author

Closing so that someone more familiar can take over, but please feel free to use this as a starting point.

@jeffs jeffs closed this Nov 7, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 7, 2026
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Closing so that someone more familiar can take over, but please feel free to use this as a starting point.

Why? I mean it's fine to close if you want, but I don't see a reason for that. If you need further guidance I'm happy to provide it.

For future reference, where are the instructions?

We don't have enough general contributing instructions but do have some at https://rust-analyzer.github.io/book/contributing/index.html.

@jeffs

jeffs commented Nov 7, 2026

Copy link
Copy Markdown
Author

Thanks, I'll take a look. No need to hold this change up in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly rejects core::mem::offset_of!(SomeStruct, some_field)

3 participants