rust/compiler/rustc_middle/src
Matthias Krüger 7c3b2e5254
Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35
add `extern "custom"` functions

tracking issue: rust-lang/rust#140829
previous discussion: https://github.com/rust-lang/rust/issues/140566

In short, an `extern "custom"` function is a function with a custom ABI, that rust does not know about. Therefore, such functions can only be defined with `#[unsafe(naked)]` and `naked_asm!`, or via an `extern "C" { /* ... */ }` block. These functions cannot be called using normal rust syntax: calling them can only be done from inline assembly.

The motivation is low-level scenarios where a custom calling convention is used. Currently, we often pick `extern "C"`, but that is a lie because the function does not actually respect the C calling convention.

At the moment `"custom"` seems to be the name with the most support. That name is not final, but we need to pick something to actually implement this.

r? `@traviscross`
cc `@tgross35`

try-job: x86_64-apple-2
2025-06-13 05:19:14 +02:00
..
dep_graph Ensure query keys are printed with reduced queries 2025-06-03 20:56:52 +00:00
hir introduce new lint infra 2025-06-12 09:56:47 +02:00
hooks Move naked fn checks to hir_typeck 2025-05-30 16:08:44 +00:00
infer yeet CanonicalVarInfo 2025-05-23 12:10:53 +00:00
middle Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
mir Rollup merge of #142124 - oli-obk:transmute-cast, r=scottmcm 2025-06-10 16:54:50 +02:00
query introduce new lint infra 2025-06-12 09:56:47 +02:00
thir Improve some Visitor comments. 2025-06-04 16:40:00 +10:00
traits Remove weak alias terminology 2025-04-24 11:59:20 +01:00
ty Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35 2025-06-13 05:19:14 +02:00
util Remove attribute #[rustc_error] 2025-03-30 01:32:21 +03:00
arena.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
error.rs Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
lib.rs Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
lint.rs decouple "reporting in deps" from future incompatibility reason 2025-06-03 10:49:22 +02:00
macros.rs Fold visit into ty 2025-03-15 06:34:36 +00:00
metadata.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tests.rs Give an item related to issue 27438 a more meaningful name 2024-04-30 22:27:19 +02:00
thir.rs Add useful comments on ExprKind::If variants. 2025-05-02 15:53:39 +10:00
values.rs Use search_for_cycle_permutation to look for variances_of 2025-04-27 09:38:18 +02:00