Skip to content

Conversation

@m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Mar 17, 2025

This moves the "missing function body" error from ast_passes to ast_lowering. This doesn't change much, except that it allows for builtin macro attributes to accept functions without a body.

We need this for externally implementable items:

// in core:
#[externally_implementable]
fn panic_handler();

Before this change, this would result in an error even before the (builtin) attribute macro gets expanded.

m-ou-se added 2 commits March 17, 2025 14:23
This makes it possible for builtin attribute macros to accept functions
without bodies, which we need for EII (externally implementable items).
@m-ou-se m-ou-se added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 17, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 17, 2025
@petrochenkov
Copy link
Contributor

Before this change, this would result in an error even before the (builtin) attribute macro gets expanded.

Are you sure?
ast_passes should also run after all the macro expansion.
This snippet already compiles successfully on stable.

#[cfg(FALSE)]
fn panic_handler();

@m-ou-se
Copy link
Member Author

m-ou-se commented Mar 17, 2025

Hmm, this change might have been a left-over from when my experimental implementation used a builtin attribute rather than a builtin macro. 🤔

Thanks for your quick response. I'll close this for now.

@m-ou-se m-ou-se closed this Mar 17, 2025
@m-ou-se m-ou-se deleted the fn-body branch March 17, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants