Skip to content
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

Remove fake rust-intrinsic ABI #720

Closed
1 of 3 tasks
oli-obk opened this issue Feb 5, 2024 · 2 comments
Closed
1 of 3 tasks

Remove fake rust-intrinsic ABI #720

oli-obk opened this issue Feb 5, 2024 · 2 comments
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Feb 5, 2024

Proposal

Implement what was proposed 5 years ago in rust-lang/rust#63585

Add a new way to implement intrinsics that does not require us to abuse the fake rust-intrinsic ABI.

The new scheme allows using regular functions, and turning them into intrinsics by adding the #[rustc_intrinsic] attribute to them. The body of the function is used on backends that have not implemented the intrinsic. This avoids us having to write backend code to generate the function body.

For some intrinsics having a fallback body makes no sense, as there is either no reasonable default or it's something absolutely compiler internal (e.g. size_of). In that case, one can add another #[rustc_intrinsic_must_be_overridden] to the function. This causes the function body to not get monomorphized and sent to the backend. The implementation has various assertions that prevent screwing this up. So if a backend forgets to implement, at best they get an assertion explaining what's going on, at worst they get a linker error.

Once this is accepted and the implementation has landed, we can incrementally eliminate all those intrinsics and then remove support from the compiler for the rust-intrinsic ABI. Similarly we'll eliminate the platform-intrinsic ABI.

Already implemented in rust-lang/rust#120500 and rust-lang/rust#120675

Mentors or Reviewers

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

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.

@oli-obk oli-obk added T-compiler Add this label so rfcbot knows to poll the compiler team major-change A proposal to make a major change to rustc labels Feb 5, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2024

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.

Concerns or objections to the proposal should be discussed on Zulip and formally registered here by adding a comment with the following syntax:

@rustbot concern reason-for-concern 
<description of the concern> 

Concerns can be lifted with:

@rustbot resolve reason-for-concern 

See documentation at https://forge.rust-lang.org

cc @rust-lang/compiler @rust-lang/compiler-contributors

@WaffleLapkin
Copy link
Member

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label Feb 5, 2024
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 8, 2024
@oli-obk oli-obk added major-change-accepted A major change proposal that was accepted and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels Feb 19, 2024
@rustbot rustbot added the to-announce Announce this issue on triage meeting label Feb 19, 2024
@oli-obk oli-obk closed this as completed Feb 19, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 22, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang#63585

follow-up to rust-lang#120500

MCP at rust-lang/compiler-team#720
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 22, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 22, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang#63585

follow-up to rust-lang#120500

MCP at rust-lang/compiler-team#720
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang#63585

follow-up to rust-lang#120500

MCP at rust-lang/compiler-team#720
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 4, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang#63585

follow-up to rust-lang#120500

MCP at rust-lang/compiler-team#720
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 5, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang#63585

follow-up to rust-lang#120500

MCP at rust-lang/compiler-team#720
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Mar 7, 2024
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang/rust#63585

follow-up to #120500

MCP at rust-lang/compiler-team#720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

4 participants