Repository navigation
Remove support for extern "rust-intrinsic" blocks #132735
Copy link
Copy link
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call 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.Relevant 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.Relevant to the library team, which will review and decide on the PR/issue.
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:
#[rustc_intrinsic]
unsafe fn unreachable() -> !;The goal of this issue is to remove support for the old style, and consistently use the new style.
- Port the remaining
extern "rust-intrinsic"intrinsics inlibraryto the new style, updating them using the pattern described above. This can be a PR on its own. (Implemented in Change intrinsic declarations to new style #132907, changes old intrinsic declaration to new declaration #133106, ports last few library files to new intrinsic style #136005) - Port the uses of
extern "rust-intrinsic"insrc/tools/miriandtests/ui/simdto the new style.
This is implemented in Partial progress on #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase #135333, Port ui/simd tests to use the intrinsic macro #136022. - Similarly port the
extern "rust-intrinsic"in this file (note that this is a separate repository) - Remove support for
extern "rust-intrinsic"blocks from the compiler -- in particular, remove this. A bunch of tests will still need updating; you can grep forrust-intrinsicto find them all. They should all be ported to the new style, similar to the PR in step 2. - Determine whether there is more cleanup that can be done. For instance, this can be removed. Maybe we can get rid of
Abi::RustIntrinsicentirely?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call 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.Relevant 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.Relevant to the library team, which will review and decide on the PR/issue.
Activity
compiler-errors commentedon Nov 7, 2024
I do wonder if there's some way we could have body-less free function items when users write
#[rustc_intrinsic_must_be_overridden]. Having all these dummy bodies likeloop {}andunreachable {}seem kinda meh.RalfJung commentedon Nov 7, 2024
compiler-errors commentedon Nov 7, 2024
We actually reject them after expansion but before ast lowering.
We could perhaps intercept these bodyless functions during ast lowering and fill them with a dummy body like
loop {}or something that diverges rather than having it be manually written on each function.compiler-errors commentedon Nov 7, 2024
Obviously only intercepting them if they're marked with
rustc_intrinsic_must_be_overridden; if it's a regular function we'd issue the regular error for a bodyless free function, and if it'srustc_intrinsicwe could tell the user that it needs to be marked withrustc_intrinsic_must_be_overridden.RalfJung commentedon Nov 7, 2024
That's way beyond my knowledge of those parts of the compiler. ;) So sure, sounds great. :D
Cc @petrochenkov
I was actually going to suggest that a
#[rustc_intrinsic]not having a body should replace therustc_intrinsic_must_be_overriddenattribute.compiler-errors commentedon Nov 7, 2024
Oh, that works too.
workingjubilee commentedon Nov 7, 2024
hmm do we have the notion of a builtin attribute macro...?
compiler-errors commentedon Nov 7, 2024
@workingjubilee: Yes
aaishwarymishra commentedon Nov 9, 2024
@rustbot claim
59 remaining items
Rollup merge of rust-lang#139496 - Skgland:139455-went-too-far, r=Vey…
Rollup merge of rust-lang#139496 - Skgland:139455-went-too-far, r=Vey…
Unrolled build for rust-lang#139496
Rollup merge of rust-lang#139530 - oli-obk:rustc-intrinsic-cleanup, r…
Rollup merge of rust-lang#139530 - oli-obk:rustc-intrinsic-cleanup, r…
Rollup merge of rust-lang#139530 - oli-obk:rustc-intrinsic-cleanup, r…
Unrolled build for rust-lang#139530
Rollup merge of rust-lang#139455 - Skgland:remove_rust-intrinsic_ABI,…
Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk
Rollup merge of #139496 - Skgland:139455-went-too-far, r=Veykril
RalfJung commentedon Apr 30, 2025
@oli-obk do you know of anything left to do here? I think it is all done, isn't it?
oli-obk commentedon Apr 30, 2025
Nope, this is done
Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk
Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk