-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add builtin# for compiler-intrinsic syntax #580
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. cc @rust-lang/compiler @rust-lang/compiler-contributors |
A bit of a tangent but related: having match #[lang = "branch"](x) {
#[lang = "Break"] { 0: residual } =>
#[allow(unreachable_code)]
return #[lang = "from_residual"](residual),
#[lang = "Continue"] { 0: val } =>
#[allow(unreachable_code)]
val,
}; changing that to (Or maybe we should rename 'lang items' to something that makes more sense first. ^^) |
Another potential use case is |
@rustbot second |
@rustbot label -final-comment-period +major-change-accepted |
Parse builtin# syntax and add typechecking for builtin#offset_of expression Also removes box syntax, fixes #14504 cc rust-lang/compiler-team#580 #15082
Proposal
Some of rust's builtin macros use their direct access to the AST to do things that proc macros can't: create AST nodes that are not present in syntax. This turns those macros into language extensions more than actual macros.
The proposed solution is to add the
builtin#...
syntax intended for constructs that are perma-unstable, possibly having stable wrappers, where no final syntax is known.builtin#
would always be followed by a conditional keyword that corresponds to the functionality of the construct, and then contain its arguments in parentheses. Soasm!(foo)
becomesbuiltin#asm(foo)
.Possible cases of
builtin#
:asm!
/global_asm!
macrosformat_args
offset_of
box
syntax that is more of an implementation detail than a future feature at this point. It is still used in thevec
macro thus can't be removed easily. This would free upbox
as a keyword.do yeet
comes to mind.Acceptance of this MCP does not imply that all of these should be migrated. For the last few non-macro cases the migration discussion is explicitly left for the future. Mainly, the list serves to show the targeted area of
builtin#
.Macros can be changed to
macro_rules
macros with anallow_internal_unstable
(or alternativelymacro
macros).Mentors or Reviewers
@petrochenkov has expressed desire for this.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: