about summary refs log tree commit diff
path: root/compiler/rustc_abi
AgeCommit message (Collapse)AuthorLines
2025-03-11Auto merge of #138302 - matthiaskrgr:rollup-an2up80, r=matthiaskrgrbors-4/+4
Rollup of 8 pull requests Successful merges: - #136395 (Update to rand 0.9.0) - #137279 (Make some invalid codegen attr errors structured/translatable) - #137585 (Update documentation to consistently use 'm' in atomic synchronization example) - #137926 (Add a test for `-znostart-stop-gc` usage with LLD) - #138074 (Support `File::seek` for Hermit) - #138238 (Fix dyn -> param suggestion in struct ICEs) - #138270 (chore: Fix some comments) - #138286 (triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search (…) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-3/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-10Update rand to 0.9.0Chris Denton-4/+4
2025-03-09Rollup merge of #138158 - moulins:move-layout-to-rustc_abi, r=workingjubileeMatthias Krüger-101/+614
Move more layouting logic to `rustc_abi` Move all `LayoutData`-constructing code to `rustc_abi`: - Infaillible operations get a new `LayoutData` constructor method; - Faillible ones get a new method on `LayoutCalculator`.
2025-03-08Move coroutine layout logic to `rustc_abi`Moulins-0/+350
2025-03-08Move SIMD layout logic to `rustc_abi`Moulins-12/+98
2025-03-08Remove most manual LayoutData creations and move them to `rustc_abi`Moulins-94/+171
...either as: - methods on LayoutCalculator, for faillible operations; - constructors on LayoutData, for infaillible ones.
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-0/+3
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-03-06Rollup merge of #137805 - RalfJung:layout-debug-print, r=NoratriebMichael Goulet-1/+1
adjust Layout debug printing to match the internal field name The field got renamed a while ago, but the debug printing was not updated to match.
2025-03-04compiler: add `ExternAbi::is_rustic_abi`Jubilee Young-0/+11
2025-02-28rename BackendRepr::Vector → SimdVectorRalf Jung-20/+24
2025-02-28adjust Layout debug printing to match the internal field namesRalf Jung-1/+1
2025-02-23Rollup merge of #137334 - compiler-errors:edition-2024-fresh-2, ↵Jacob Pratt-1/+1
r=saethlin,traviscross Greatly simplify lifetime captures in edition 2024 Remove most of the `+ Captures` and `+ '_` from the compiler, since they are now unnecessary with the new edition 2021 lifetime capture rules. Use some `+ 'tcx` and `+ 'static` rather than being overly verbose with precise capturing syntax.
2025-02-23Rollup merge of #137256 - workingjubilee:untangle-vector-abi-assumptions, ↵Matthias Krüger-59/+73
r=bjorn3,RalfJung compiler: untangle SIMD alignment assumptions There were a number of puzzling assumptions being made about SIMD types and their layout that I have corrected in this diff. These are mostly no-op edits in actual fact, but they do subtly alter a pair of checks in our invariant-checking and union layout computation that rested on those peculiar assumptions. Those unfortunately stand in the way of any further actual fixes. I submit this for review, even though it's not clearly motivated without its followups, because it should still be possible to independently conclude whether this is correct.
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-1/+1
2025-02-22Fix binding mode problemsMichael Goulet-9/+9
2025-02-22Upgrade the compiler to edition 2024Michael Goulet-1/+1
2025-02-20compiler: split vector_align into cabi and llvmlikeJubilee Young-10/+15
Introduce a pair of functions that actually describe what they do, because it wasn't clear the alignment is sometimes a forgery.
2025-02-20compiler: `BackendRepr::inherent_{size,align} -> scalar_{size,align}`Jubilee Young-40/+50
This pair of fn was introduced to perform invariant checks for scalars. Their current behavior doesn't mesh as well with checking SIMD types, so change the name of the fn to reflect their actual use-case and refactor the corresponding checks. Also simplify the returns from Option<AbiAndPrefAlign> to Option<Align>, because every site was mapping away the "preferred" alignment anyways.
2025-02-20compiler: Align::max_for_offset -> Align::max_aligned_factorJubilee Young-9/+8
No functional changes.
2025-02-20Adjust LayoutData::uninhabited doc comment.zachs18-2/+2
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-02-20Remove `BackendRepr::Uninhabited`, replaced with an `uninhabited: bool` ↵Zachary S-32/+28
field in `LayoutData`. Also update comments that refered to BackendRepr::Uninhabited.
2025-02-19Add a .bss-like scheme for encoded const allocsBen Kimock-2/+2
2025-02-16Move hashes from rustc_data_structure to rustc_hashes so they can be shared ↵Ben Kimock-2/+3
with rust-analyzer
2025-02-15Replace some u64 hashes with Hash64Ben Kimock-7/+9
2025-02-12Split out the `extern_system_varargs` featureJubilee Young-2/+0
After the stabilization PR was opened, `extern "system"` functions were added to `extended_varargs_abi_support`. This has a number of questions regarding it that were not discussed and were somewhat surprising. It deserves to be considered as its own feature, separate from `extended_varargs_abi_support`.
2025-02-11compiler: remove rustc_abi::lookup and AbiUnsupportedJubilee Young-17/+14
These can be entirely replaced by the FromStr implementation.
2025-02-11compiler: remove AbiDatasJubilee Young-131/+9
These were a way to ensure hashes were stable over time for ExternAbi, but simply hashing the strings is more stable in the face of changes. As a result, we can do away with them.
2025-02-11compiler: compare and hash ExternAbi like its stringJubilee Young-12/+137
Directly map each ExternAbi variant to its string and back again. This has a few advantages: - By making the ABIs compare equal to their strings, we can easily lexicographically sort them and use that sorted slice at runtime. - We no longer need a workaround to make sure the hashes remain stable, as they already naturally are (by being the hashes of unique strings). - The compiler can carry around less &str wide pointers
2025-02-11compiler: narrow scope of nightly cfg in rustc_abiJubilee Young-6/+3
2025-02-09compiler: remove `abi`-specific `extern "{abi}"` suggestionsJubilee Young-20/+7
These are either residue of a long-term migration away from something, or are simply trying too hard to be specifically useful: nearest-match suggestions for ABI strings should handle this.
2025-02-09compiler: gate `extern "{abi}"` in ast_loweringJubilee Young-109/+5
By moving this stability check into AST lowering, we effectively make it impossible to accidentally miss, as it must happen to generate HIR. Also, we put the ABI-stability code next to code that actually uses it! This allows code that wants to reason about backend ABI implementations to stop worrying about high-level concerns like syntax stability, while still leaving it as the authority on what ABIs actually exist. It also makes it easy to refactor things to have more consistent errors. For now, we only apply this to generalize the existing messages a bit.
2025-02-08Rustfmtbjorn3-4/+7
2025-02-06compiler: reorganize rustc_abi to be more internally uniformJubilee Young-74/+78
General housekeeping: - Use less reexports from its rustc_target era - Unify some imports as a result - Split the Reg(ister) types into their own files Generally moving stuff around because it makes the crate more consistent.
2025-01-17Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubileebors-13/+22
Add gpu-kernel calling convention The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 (#120495 and https://github.com/rust-lang/rust-analyzer/pull/16463) due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for. Tracking issue: #135467 amdgpu target tracking issue: #135024
2025-01-16Add gpu-kernel calling conventionFlakebi-13/+22
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2025-01-10fix ZST handling for Windows ABIs on MSVC targetRalf Jung-0/+4
2025-01-10exclude unsizable tail from randomization seed calculationThe 8472-13/+9
2025-01-10Foo<T> != Foo<U> under layout randomizationThe 8472-2/+74
previously field ordering was using the same seed for all instances of Foo, now we pass seed values through the layout tree so that not only the struct itself affects layout but also its fields
2024-12-30compiler: Add a statement-of-intent to `rustc_abi`Jubilee Young-0/+32
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-14/+17
2024-12-18Variants::Single: do not use invalid VariantIdx for uninhabited enumsRalf Jung-11/+11
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-01fix safe-transmute handling of enumsRalf Jung-1/+5
2024-11-30improve TagEncoding::Niche docs and sanity checkRalf Jung-5/+19
2024-11-22Auto merge of #130867 - michirakara:steps_between, r=dtolnaybors-1/+1
distinguish overflow and unimplemented in Step::steps_between
2024-11-21distinguish overflow and unimplemented in Step::steps_betweenmichirakara-1/+1
2024-11-14Support s390x z13 vector ABITaiki Endo-0/+18
2024-11-08pointee_info_at: fix logic for recursing into enumsRalf Jung-4/+12