rust/compiler
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
..
rustc Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_abi Initial UnsafePinned/UnsafeUnpin impl [Part 1: Libs] 2025-04-13 01:11:04 -04:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead 2025-05-29 04:49:43 +02:00
rustc_ast_ir Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_ast_lowering Reorder ast::ItemKind::{Struct,Enum,Union} fields. 2025-05-28 15:48:45 +10:00
rustc_ast_passes Reorder ast::ItemKind::{Struct,Enum,Union} fields. 2025-05-28 15:48:45 +10:00
rustc_ast_pretty Reorder ast::ItemKind::{Struct,Enum,Union} fields. 2025-05-28 15:48:45 +10:00
rustc_attr_data_structures Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING 2025-05-24 23:54:17 +02:00
rustc_attr_parsing Add custom trait for emitting lint within cfg_matches 2025-05-26 21:51:09 +02:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Fix some var names 2025-05-27 11:14:47 +00:00
rustc_builtin_macros Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead 2025-05-29 04:49:43 +02:00
rustc_codegen_cranelift Merge commit '979dcf8e2f' into sync_cg_clif-2025-05-25 2025-05-25 18:51:16 +00:00
rustc_codegen_gcc Remove usage of FnAbi in codegen_intrinsic_call 2025-05-26 10:13:03 +00:00
rustc_codegen_llvm Rollup merge of #141404 - bjorn3:refactor_cg_ssa_call_codegen, r=davidtwco 2025-05-28 10:28:09 -04:00
rustc_codegen_ssa Rollup merge of #138139 - xizheyin:issue-137384, r=ChrisDenton 2025-05-29 04:49:40 +02:00
rustc_const_eval Rollup merge of #141495 - compiler-errors:rename-unpack, r=fmease 2025-05-27 20:57:54 +02:00
rustc_data_structures Rollup merge of #139668 - matthewjasper:upper-bound-fix, r=compiler-errors 2025-05-22 16:02:26 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl compiler & tools: bump windows crate to dedupe versions 2025-05-17 15:26:38 +03:00
rustc_error_codes Stabilise repr128 2025-05-28 15:14:34 +01:00
rustc_error_messages bump fluent-* crates 2025-05-27 14:11:14 +03:00
rustc_errors Remove an unnecessary use of Box::into_inner. 2025-05-27 02:06:40 +10:00
rustc_expand Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead 2025-05-29 04:49:43 +02:00
rustc_feature Stabilise repr128 2025-05-28 15:14:34 +01:00
rustc_fluent_macro bump fluent-* crates 2025-05-27 14:11:14 +03:00
rustc_fs_util Retry if creating temp fails with access denied 2025-04-25 11:28:36 +00:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Rename kw::Empty as sym::empty. 2025-05-22 11:55:22 +10:00
rustc_hir_analysis Auto merge of #141717 - jhpratt:rollup-neu8nzl, r=jhpratt 2025-05-29 08:53:27 +00:00
rustc_hir_pretty update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
rustc_hir_typeck Rollup merge of #141638 - oli-obk:builtin-index, r=lcnr 2025-05-29 04:49:42 +02:00
rustc_incremental Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk 2025-05-07 12:39:54 +00:00
rustc_index Add copy_within to IndexSlice 2025-04-15 10:44:28 -04:00
rustc_index_macros In rustc_mir_tranform, iterate over index newtypes instead of ints 2025-04-12 11:53:07 +00:00
rustc_infer Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors 2025-05-29 02:29:01 +00:00
rustc_interface coverage: Revert "unused local file IDs" due to empty function names 2025-05-27 23:33:29 +10:00
rustc_lexer Implement RFC 3503: frontmatters 2025-05-05 23:10:08 +08:00
rustc_lint Remove i128 and u128 from improper_ctypes_definitions 2025-05-29 12:55:26 +00:00
rustc_lint_defs Make UNNECESSARY_TRANSMUTES into a HIR lint 2025-05-25 15:57:48 +00:00
rustc_llvm Experimental cygwin support in rustc 2025-05-15 23:34:11 +08:00
rustc_log Allow linking rustc and rustdoc against the same single tracing crate 2025-05-03 10:18:50 -07:00
rustc_macros Allow trailing comma after argument in query definition 2025-05-20 10:22:08 +00:00
rustc_metadata Introduce tcx.anon_const_kind query 2025-05-21 20:20:19 +01:00
rustc_middle Auto merge of #141716 - jhpratt:rollup-9bjrzfi, r=jhpratt 2025-05-29 05:41:04 +00:00
rustc_mir_build Rollup merge of #141683 - compiler-errors:unsafe-binder-capture, r=oli-obk 2025-05-29 04:49:45 +02:00
rustc_mir_dataflow update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
rustc_mir_transform Rollup merge of #141551 - compiler-errors:hir-lints, r=BoxyUwU 2025-05-27 20:28:32 -04:00
rustc_monomorphize Always evaluate free lifetime-generic constants 2025-05-27 18:58:51 +02:00
rustc_next_trait_solver Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors 2025-05-29 02:29:01 +00:00
rustc_parse Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead 2025-05-29 04:49:43 +02:00
rustc_parse_format Remove duplicate impl of string unescape 2025-05-06 10:00:22 +00:00
rustc_passes Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4 2025-05-28 10:28:08 -04:00
rustc_pattern_analysis Use builin_index instead of hand-rolling it 2025-05-28 10:03:01 +00:00
rustc_privacy Rollup merge of #140874 - mejrs:rads, r=WaffleLapkin 2025-05-19 13:24:54 +10:00
rustc_query_impl Auto merge of #140145 - Zoxc:job-server-proxy, r=SparrowLii 2025-05-01 04:11:52 +00:00
rustc_query_system Handle rustc_query_system cases of rustc::potential_query_instability lint 2025-05-14 08:59:55 +03:00
rustc_resolve Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead 2025-05-29 04:49:43 +02:00
rustc_sanitizers Rename unpack to kind 2025-05-27 11:14:45 +00:00
rustc_serialize Zero the buffer passed from write_with 2025-04-25 07:14:27 +02:00
rustc_session coverage: Revert "unused local file IDs" due to empty function names 2025-05-27 23:33:29 +10:00
rustc_smir Rename unpack to kind 2025-05-27 11:14:45 +00:00
rustc_span Rollup merge of #141690 - Patrick-6:intercept-mutex, r=m-ou-se 2025-05-29 04:49:47 +02:00
rustc_symbol_mangling Rename unpack to kind 2025-05-27 11:14:45 +00:00
rustc_target Enable xray support for Mac 2025-05-24 15:06:53 +08:00
rustc_trait_selection Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors 2025-05-29 02:29:01 +00:00
rustc_traits Querify coroutine_hidden_types 2025-05-20 11:50:25 +00:00
rustc_transmute Rollup merge of #140509 - tmiasko:merge-contiguous-ranges, r=jswrenn 2025-05-02 19:37:56 +02:00
rustc_ty_utils Rollup merge of #141495 - compiler-errors:rename-unpack, r=fmease 2025-05-27 20:57:54 +02:00
rustc_type_ir Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors 2025-05-29 02:29:01 +00:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00
stable_mir Change rustc_driver dependency on stable_mir crate 2025-04-30 15:39:52 -07:00