Skip to content

add extern "tail" calling convention - #157016

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:add-tailcc-abi
Jun 7, 2026
Merged

add extern "tail" calling convention#157016
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
folkertdev:add-tailcc-abi

Conversation

@folkertdev

@folkertdevfolkertdev commented May 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

Maps to LLVM's tailcc and hence inherits all its problems.

This calling convention at least compiles on:

  • x86_64
  • aarch64

It also compiles on

  • s390x
  • loongarch64

But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.

For most backends LLVM does not have support and fails loudly.

@rustbotrustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 27, 2026
@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_codegen_cranelift/src/abi/mod.rs Outdated
Comment threadcompiler/rustc_codegen_cranelift/src/abi/mod.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@folkertdevfolkertdev left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does not yet lift the same-signature restriction for this calling convention. Also tailcc is currently kind of broken on x86_64 due to llvm/llvm-project#199224 (which I caused, whoops). There is an open PR for a fix that should make it into LLVM 23.

cc @scottmcm as our T-lang contact

View changes since this review

Comment threadcompiler/rustc_abi/src/extern_abi.rs Outdated
RustCold =><= "rust-cold",
RustInvalid =><= "rust-invalid",
RustPreserveNone =><= "rust-preserve-none",
RustTail =><= "tail",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what the most consistent naming scheme is here, but we can change it later. Waffle preferred the shorter "tail" over "rust-tail" because this is meant to be a user-facing calling convention eventually.

@folkertdev
folkertdev marked this pull request as ready for review June 2, 2026 13:45
@rustbot

Copy link
Copy Markdown
Collaborator

The GCC codegen subtree was changed

cc @antoyo, @GuillaumeGomez

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

The Cranelift subtree was changed

cc @bjorn3

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 2, 2026
@folkertdevfolkertdev changed the title add extern "rust-tail" calling conventionadd extern "tail" calling conventionJun 2, 2026
Comment threadcompiler/rustc_codegen_gcc/src/abi.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_feature/src/unstable.rs Outdated
Comment threadcompiler/rustc_feature/src/unstable.rs Outdated

@WaffleLapkinWaffleLapkinJun 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, but I'm confused why names in abi.rs and ty.rs are different...

View changes since the review

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, that's kind of up to the rustc_public maintainers.

Comment threadtests/codegen-llvm/tailcc.rs Outdated
rust-borsBot pushed a commit that referenced this pull request Jun 6, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #157016 (add `extern "tail"` calling convention)
- #157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- #157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- #157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- #156136 (Move tests box)
- #157289 (Add infallible primitive type lookups to template arg resolver)
- #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- #157494 (Convert `QueryRegionConstraint` into a struct)
- #157526 (std tests: skip a slow test on Miri)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 6, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 6, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 6, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
rust-borsBot pushed a commit that referenced this pull request Jun 6, 2026
…uwer
Rollup of 17 pull requests
Successful merges:
- #157251 (`rust-analyzer` subtree update)
- #157533 (Subtree sync for rustc_codegen_cranelift)
- #154742 (Add APIs for case folding to the standard library)
- #155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- #157016 (add `extern "tail"` calling convention)
- #157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- #157386 (Parse deprecated note links separately in rustc_resolve)
- #157483 (fix windows-gnu TLS leak)
- #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- #157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- #157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- #156136 (Move tests box)
- #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- #157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- #157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- #157494 (Convert `QueryRegionConstraint` into a struct)
- #157526 (std tests: skip a slow test on Miri)
Failed merges:
- #155527 (Replace printables table with `unicode_data.rs` tables)
rust-borsBot pushed a commit that referenced this pull request Jun 6, 2026
…uwer
Rollup of 17 pull requests
Successful merges:
- #157251 (`rust-analyzer` subtree update)
- #157533 (Subtree sync for rustc_codegen_cranelift)
- #154742 (Add APIs for case folding to the standard library)
- #155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- #157016 (add `extern "tail"` calling convention)
- #157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- #157386 (Parse deprecated note links separately in rustc_resolve)
- #157483 (fix windows-gnu TLS leak)
- #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- #157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- #157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- #156136 (Move tests box)
- #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- #157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- #157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- #157494 (Convert `QueryRegionConstraint` into a struct)
- #157526 (std tests: skip a slow test on Miri)
Failed merges:
- #155527 (Replace printables table with `unicode_data.rs` tables)
rust-borsBot pushed a commit that referenced this pull request Jun 6, 2026
…uwer
Rollup of 17 pull requests
Successful merges:
- #157251 (`rust-analyzer` subtree update)
- #157533 (Subtree sync for rustc_codegen_cranelift)
- #154742 (Add APIs for case folding to the standard library)
- #155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- #157016 (add `extern "tail"` calling convention)
- #157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- #157386 (Parse deprecated note links separately in rustc_resolve)
- #157483 (fix windows-gnu TLS leak)
- #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- #157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- #157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- #156136 (Move tests box)
- #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- #157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- #157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- #157494 (Convert `QueryRegionConstraint` into a struct)
- #157526 (std tests: skip a slow test on Miri)
Failed merges:
- #155527 (Replace printables table with `unicode_data.rs` tables)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 7, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
@jhprattjhpratt mentioned this pull request Jun 7, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 7, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
This was referenced Jun 7, 2026
rust-borsBot pushed a commit that referenced this pull request Jun 7, 2026
Rollup of 25 pull requests
Successful merges:
- #157251 (`rust-analyzer` subtree update)
- #157533 (Subtree sync for rustc_codegen_cranelift)
- #154742 (Add APIs for case folding to the standard library)
- #155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- #156222 (Stabilize `Result::map_or_default` and `Option::map_or_default`)
- #157016 (add `extern "tail"` calling convention)
- #157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- #157386 (Parse deprecated note links separately in rustc_resolve)
- #157483 (fix windows-gnu TLS leak)
- #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- #157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- #157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- #156136 (Move tests box)
- #156573 (Add unwinder_private_data_size for wasm64 target)
- #156783 (docs: make `Rc::into_raw` clickable in `Rc::increment_strong_count` doc)
- #156840 (Stabilize `PathBuf::into_string`)
- #156936 (Remove FIXME about impl PinCoerceUnsized for UnsafePinned<T>)
- #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- #157380 (clarify compiler_fence (and fence) docs)
- #157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- #157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- #157494 (Convert `QueryRegionConstraint` into a struct)
- #157526 (std tests: skip a slow test on Miri)
- #157531 (ci: bump x86_64-gnu base image to 26.04)
- #157556 (Add `BTree::append()` change to 1.96.0 relnotes)
Failed merges:
- #155527 (Replace printables table with `unicode_data.rs` tables)
@rust-bors
rust-borsBot merged commit d66ac24 into rust-lang:mainJun 7, 2026
13 of 14 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jun 7, 2026
rust-timer added a commit that referenced this pull request Jun 7, 2026
Rollup merge of #157016 - folkertdev:add-tailcc-abi, r=WaffleLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
pullBot pushed a commit to asukaminato0721/rust-analyzer that referenced this pull request Jun 7, 2026
Rollup of 25 pull requests
Successful merges:
- rust-lang/rust#157251 (`rust-analyzer` subtree update)
- rust-lang/rust#157533 (Subtree sync for rustc_codegen_cranelift)
- rust-lang/rust#154742 (Add APIs for case folding to the standard library)
- rust-lang/rust#155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- rust-lang/rust#156222 (Stabilize `Result::map_or_default` and `Option::map_or_default`)
- rust-lang/rust#157016 (add `extern "tail"` calling convention)
- rust-lang/rust#157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- rust-lang/rust#157386 (Parse deprecated note links separately in rustc_resolve)
- rust-lang/rust#157483 (fix windows-gnu TLS leak)
- rust-lang/rust#157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- rust-lang/rust#157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- rust-lang/rust#157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- rust-lang/rust#156136 (Move tests box)
- rust-lang/rust#156573 (Add unwinder_private_data_size for wasm64 target)
- rust-lang/rust#156783 (docs: make `Rc::into_raw` clickable in `Rc::increment_strong_count` doc)
- rust-lang/rust#156840 (Stabilize `PathBuf::into_string`)
- rust-lang/rust#156936 (Remove FIXME about impl PinCoerceUnsized for UnsafePinned<T>)
- rust-lang/rust#157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- rust-lang/rust#157380 (clarify compiler_fence (and fence) docs)
- rust-lang/rust#157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- rust-lang/rust#157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- rust-lang/rust#157494 (Convert `QueryRegionConstraint` into a struct)
- rust-lang/rust#157526 (std tests: skip a slow test on Miri)
- rust-lang/rust#157531 (ci: bump x86_64-gnu base image to 26.04)
- rust-lang/rust#157556 (Add `BTree::append()` change to 1.96.0 relnotes)
Failed merges:
- rust-lang/rust#155527 (Replace printables table with `unicode_data.rs` tables)
pullBot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jun 8, 2026
Rollup of 25 pull requests
Successful merges:
- rust-lang/rust#157251 (`rust-analyzer` subtree update)
- rust-lang/rust#157533 (Subtree sync for rustc_codegen_cranelift)
- rust-lang/rust#154742 (Add APIs for case folding to the standard library)
- rust-lang/rust#155144 (mir_build: Add an extra intermediate step in MIR building for patterns )
- rust-lang/rust#156222 (Stabilize `Result::map_or_default` and `Option::map_or_default`)
- rust-lang/rust#157016 (add `extern "tail"` calling convention)
- rust-lang/rust#157264 (diagnostics: Fix ICE building a trait ref in method suggestions)
- rust-lang/rust#157386 (Parse deprecated note links separately in rustc_resolve)
- rust-lang/rust#157483 (fix windows-gnu TLS leak)
- rust-lang/rust#157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows)
- rust-lang/rust#157509 (remove solaris implementation for File::lock, it has the wrong semantics)
- rust-lang/rust#157521 (Rename `SyncView::{as_pin => as_pin_ref}`)
- rust-lang/rust#156136 (Move tests box)
- rust-lang/rust#156573 (Add unwinder_private_data_size for wasm64 target)
- rust-lang/rust#156783 (docs: make `Rc::into_raw` clickable in `Rc::increment_strong_count` doc)
- rust-lang/rust#156840 (Stabilize `PathBuf::into_string`)
- rust-lang/rust#156936 (Remove FIXME about impl PinCoerceUnsized for UnsafePinned<T>)
- rust-lang/rust#157365 (Revert "LLVM 23: Run AssignGUIDPass in some places")
- rust-lang/rust#157380 (clarify compiler_fence (and fence) docs)
- rust-lang/rust#157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`)
- rust-lang/rust#157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N))
- rust-lang/rust#157494 (Convert `QueryRegionConstraint` into a struct)
- rust-lang/rust#157526 (std tests: skip a slow test on Miri)
- rust-lang/rust#157531 (ci: bump x86_64-gnu base image to 26.04)
- rust-lang/rust#157556 (Add `BTree::append()` change to 1.96.0 relnotes)
Failed merges:
- rust-lang/rust#155527 (Replace printables table with `unicode_data.rs` tables)
Comment threadcompiler/rustc_codegen_llvm/src/abi.rs
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 15, 2026
mention in the `extern "tail"` error that it's supported on x86
rust-lang#157016 (comment)
r? folkertdev
@bors rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 15, 2026
mention in the `extern "tail"` error that it's supported on x86
rust-lang#157016 (comment)
r? folkertdev
@bors rollup
rust-timer added a commit that referenced this pull request Jun 16, 2026
Rollup merge of #157919 - WaffleLapkin:x86tc, r=folkertdev
mention in the `extern "tail"` error that it's supported on x86
#157016 (comment)
r? folkertdev
@bors rollup
Kobzol pushed a commit to Kobzol/rust that referenced this pull request Jul 4, 2026
…eLapkin
add `extern "tail"` calling convention
Maps to LLVM's `tailcc` and hence inherits all its problems.
This calling convention at least compiles on:
- `x86_64`
- `aarch64`
It also compiles on
- `s390x`
- `loongarch64`
But I've been told by target maintainers that this is kind of unintentional, and it's not tested in LLVM.
For most backends LLVM does not have support and fails loudly.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.F-rust_tail_cc`#![feature(rust_tail_cc)]`S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

8 participants

@folkertdev@rust-log-analyzer@rustbot@WaffleLapkin@jhpratt@RalfJung@antoyo@bjorn3