Skip to content

[WIP] Introduce repr(Swift) - #160729

Open
Lancelotbronner wants to merge 1 commit into
rust-lang:mainfrom
Lancelotbronner:feature/swift_interop
Open

[WIP] Introduce repr(Swift)#160729
Lancelotbronner wants to merge 1 commit into
rust-lang:mainfrom
Lancelotbronner:feature/swift_interop

Conversation

@Lancelotbronner

Copy link
Copy Markdown

Adds the repr(Swift) attribute, allowing direct representation of Swift structs.

Since rebasing on the latest main it probably doesn't compile anymore.
I'd like to gauge interest to see if it's worth my time to continue this.

  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

Squash of the following 8 commits

Added Swift repr and callconv

Implemented extern "Swift" and started repr(Swift)

Also assert size_of and align_of

Adjust ABI to account for Swift small structs

Splat Swift structs' padding as well

Renames and adjust core::mem primitives

Fix build post-merge

Correct SizedTypeProperties::SIZE

x test
@rustbot

rustbot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

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

This PR changes rustc_public

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

⚠️ #[rustc_intrinsic_const_stable_indirect] controls whether intrinsics can be exposed to stable const
code; adding it needs t-lang approval.

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Aug 8, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 8, 2026
@rustbot

rustbot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] jiff test:false 7.416
error[E0308]: mismatched types
   --> compiler/rustc_target/src/callconv/mod.rs:772:21
    |
771 |                 arg.cast_to(CastTarget::prefixed(
    |                             -------------------- arguments to this function are incorrect
772 |                     prefix,
    |                     ^^^^^^ expected `ArrayVec<Reg, 8>`, found `[Option<Reg>; 8]`
    |
    = note: expected struct `ArrayVec<Reg, 8>`
                found array `[std::option::Option<Reg>; 8]`
note: associated function defined here
   --> compiler/rustc_target/src/callconv/mod.rs:297:12
    |
297 |     pub fn prefixed(prefix: ArrayVec<Reg, 8>, rest: Uniform) -> Self {
    |            ^^^^^^^^ ------------------------

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] rustc_target test:false 2.797
error: could not compile `rustc_target` (lib) due to 1 previous error

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants