Skip to content

Remove support for extern "rust-intrinsic" blocks #132735

Open
@RalfJung

Description

We currently have two ways to declare symbols that are invoked as intrinsics. The old way:

extern "rust-intrinsic" {
    fn unreachable() -> !;
}

The new way, which supports giving a "fallback body" that will be used for backends that do not have the intrinsic implemented:

#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
unsafe fn unreachable() -> ! { unreachable!() }

The goal of this issue is to remove support for the old style, and consistently use the new style.

  1. Port the remaining extern "rust-intrinsic" intrinsics in library to the new style, updating them using the pattern described above. This can be a PR on its own.
  2. Port the uses of extern "rust-intrinsic" in src/tools/miri and tests/ui/simd to the new style. In fact, these can use the even newer style (which can't be used in library yet because of bootstraping):
#[rustc_intrinsic]
unsafe fn unreachable();
  1. Remove support for extern "rust-intrinsic" blocks from the compiler -- in particular, remove this. AFAIK these are also the only extern blocks that support generics, so there might be more things that can be cleaned up here. (@compiler-errors or @oli-obk might know more about that.) A lot of tests will need updating; you can grep for rust-intrinsic to find them all. They should all be ported to the new style, similar to the PR in step 2.

Activity

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

Metadata

Assignees

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions