rust/library
Trevor Gross 0cba7fb6f6 Remove i128 and u128 from improper_ctypes_definitions
Rust's 128-bit integers have historically been incompatible with C [1].
However, there have been a number of changes in Rust and LLVM that
mean this is no longer the case:

* Incorrect alignment of `i128` on x86 [1]: adjusting Rust's alignment
  proposed at https://github.com/rust-lang/compiler-team/issues/683,
  implemented at https://github.com/rust-lang/rust/pull/116672.
* LLVM version of the above: resolved in LLVM, including ABI fix.
  Present in LLVM18 (our minimum supported version).
* Incorrect alignment of `i128` on 64-bit PowerPC, SPARC, and MIPS [2]:
  Rust's data layouts adjusted at
  https://github.com/rust-lang/rust/pull/132422,
  https://github.com/rust-lang/rust/pull/132741,
  https://github.com/rust-lang/rust/pull/134115.
* LLVM version of the above: done in LLVM 20
  https://github.com/llvm/llvm-project/issues/102783.
* Incorrect return convention of `i128` on Windows: adjusted to match
  GCC and Clang at https://github.com/rust-lang/rust/pull/134290.

At [3], the lang team considered it acceptable to remove `i128` from
`improper_ctypes_definitions` if the LLVM version is known to be
compatible. Time has elapsed since then and we have dropped support for
LLVM versions that do not have the x86 fixes, meaning a per-llvm-version
lint should no longer be necessary. The PowerPC, SPARC, and MIPS changes
only came in LLVM 20 but since Rust's datalayouts have also been updated
to match, we will be using the correct alignment regardless of LLVM
version.

`repr(i128)` was added to this lint in [4], but is also removed here.

Part of the decision is that `i128` should match `__int128` in C on
platforms that provide it, which documentation is updated to indicate.
We will not guarantee that `i128` matches `_BitInt(128)` since that can
be different from `__int128`. Some platforms (usually 32-bit) do not
provide `__int128`; if any ABIs are extended in the future to define it,
we will need to make sure that our ABI matches.

Closes: https://github.com/rust-lang/rust/issues/134288
Closes: https://github.com/rust-lang/rust/issues/128950

[1]: https://github.com/rust-lang/rust/issues/54341
[2]: https://github.com/rust-lang/rust/issues/128950
[3]: https://github.com/rust-lang/lang-team/issues/255#issuecomment-2088855084
[4]: https://github.com/rust-lang/rust/pull/138282
2025-05-29 12:55:26 +00:00
..
alloc Rollup merge of #141108 - PaulDance:fix-extract_if-docs, r=Mark-Simulacrum 2025-05-25 04:00:56 +02:00
alloctests update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
backtrace@6c882eb119 Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
core Remove i128 and u128 from improper_ctypes_definitions 2025-05-29 12:55:26 +00:00
coretests Rollup merge of #141571 - RalfJung:float-tests, r=tgross35 2025-05-29 04:50:47 +02:00
panic_abort deduplicate abort implementations 2025-05-15 11:20:13 +02:00
panic_unwind deduplicate abort implementations 2025-05-15 11:20:13 +02:00
portable-simd Merge commit 'c14f2fc3eb' into sync-from-portable-simd-2025-03-19 2025-03-19 00:58:47 -04:00
proc_macro manual clippy fixes 2025-05-12 15:33:41 +02:00
profiler_builtins Fix profiler_builtins build script to handle full path to profiler lib 2025-04-11 16:57:38 +02:00
rtstartup Revert changes for rtstartup 2025-03-10 21:23:31 +08:00
rustc-std-workspace-alloc Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-core Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
rustc-std-workspace-std Migrated the rustc-std-workspace crates to Rust 2024 2025-03-11 09:46:35 -07:00
std Rollup merge of #141690 - Patrick-6:intercept-mutex, r=m-ou-se 2025-05-29 04:49:47 +02:00
stdarch@b6e2249e38 bump stdarch 2025-05-21 13:41:58 +02:00
sysroot Update stdarch 2025-05-01 20:01:43 +05:30
test Add new test_main_with_exit_callback public function in libtest to allow a callback to be called before exiting 2025-05-06 18:17:48 +02:00
unwind unwind: bump unwinding dependency to 0.2.6 2025-04-29 09:46:32 +08:00
windows_targets Fix backtrace for cygwin 2025-05-07 13:08:19 +08:00
Cargo.lock deduplicate abort implementations 2025-05-15 11:20:13 +02:00
Cargo.toml Add opt-level = "s" for more std symbolication crates 2025-04-01 20:50:19 +00:00