rust/library/core/src
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 Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
array Rollup merge of #140066 - thaliaarchi:const-array-as-mut-slice, r=jhpratt 2025-05-24 21:23:47 +02:00
ascii Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
async_iter Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
bstr Replace colon with parentheses, add missing period 2025-04-21 10:48:46 -04:00
cell Rollup merge of #129334 - ChayimFriedman2:more-lazy-methods, r=Amanieu 2025-05-10 16:26:01 +02:00
char Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
clone CloneToUninit: use a private specialization trait 2024-07-29 20:44:43 +03:00
cmp Use generic NonZero everywhere in core. 2024-02-22 15:17:33 +01:00
convert Rollup merge of #141130 - mejrs:use_self, r=compiler-errors 2025-05-22 16:02:30 +02:00
ffi Rollup merge of #139994 - tamird:cstr-display, r=Amanieu 2025-05-29 04:50:47 +02:00
fmt Rollup merge of #141130 - mejrs:use_self, r=compiler-errors 2025-05-22 16:02:30 +02:00
future update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
hash library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
intrinsics Rollup merge of #141533 - RalfJung:rintf, r=bjorn3 2025-05-29 04:49:41 +02:00
io Add inherent versions of MaybeUninit methods for slices 2025-01-11 23:57:00 -05:00
iter Auto merge of #141086 - a1phyr:spec_advance_by, r=jhpratt 2025-05-25 11:34:43 +00:00
macros Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4 2025-05-28 10:28:08 -04:00
marker Call out possibility of invariant result 2025-05-26 15:06:36 -04:00
mem make std::intrinsic functions actually be intrinsics 2025-05-20 08:09:16 +02:00
net Add Ipv4Addr and Ipv6Addr diagnostic items 2025-05-14 09:34:25 +02:00
num Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
ops Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
panic Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
pin update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
prelude update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
ptr Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
range Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
slice Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
str Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
sync core: unstably expose atomic_compare_exchange so stdarch can use it 2025-05-28 15:20:29 +02:00
task Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
unicode Remove unneeded parentheses. 2025-03-08 12:56:00 +01:00
any.rs fix missing word in comment 2025-04-16 18:53:40 -07:00
arch.rs update version placeholders 2025-05-12 15:33:30 +02:00
ascii.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
asserting.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
bool.rs Move select_unpredictable to the hint module 2025-04-13 01:34:25 +01:00
borrow.rs Suggest borrowing on fn argument that is impl AsRef 2024-05-09 23:25:31 +00:00
cell.rs update version placeholders 2025-05-12 15:33:30 +02:00
clone.rs Auto merge of #139279 - BoxyUwU:bump-boostrap, r=jieyouxu 2025-04-10 00:43:25 +00:00
cmp.rs Extend the chaining logic to slices too 2025-04-12 22:10:17 -07:00
contracts.rs Apply suggestions from code review 2025-04-10 16:32:56 -07:00
default.rs Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
error.md Mention core's PanicInfo in error.md. 2024-06-11 15:47:00 +02:00
error.rs Remove #[cfg(not(test))] gates in core 2025-03-06 13:21:59 -08:00
escape.rs core: add #![warn(unreachable_pub)] 2025-01-20 18:35:32 +01:00
hint.rs Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt 2025-05-27 22:11:53 +00:00
internal_macros.rs Use cfg_match in core 2025-03-26 14:32:35 -04:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4 2025-05-28 10:28:08 -04:00
marker.rs Switch library rustc_unimplemented to use Self and This 2025-05-17 12:50:37 +02:00
option.rs feat: map_or_default for result and option 2025-05-27 19:47:14 +02:00
panic.rs update cfgs 2024-11-27 15:14:54 +00:00
panicking.rs update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
pat.rs update cfgs 2025-04-09 12:29:59 +01:00
pin.rs Rollup merge of #141289 - compiler-errors:more-self, r=jhpratt 2025-05-20 20:57:28 +02:00
primitive.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
primitive_docs.rs Remove i128 and u128 from improper_ctypes_definitions 2025-05-29 12:55:26 +00:00
random.rs random: add tracking issue, address other comments 2024-09-23 10:36:16 +02:00
range.rs update cfg(bootstrap) 2025-02-18 09:32:44 -08:00
result.rs feat: map_or_default for result and option 2025-05-27 19:47:14 +02:00
time.rs Split duration_constructors to get non-controversial bits out faster. 2025-05-09 22:52:39 -04:00
tuple.rs Extend the chaining logic to slices too 2025-04-12 22:10:17 -07:00
ub_checks.rs Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
unit.rs core: Make Debug impl of raw pointers print metadata if present 2025-02-15 17:27:55 +01:00
unsafe_binder.rs Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators 2024-12-12 16:29:40 +00:00