about summary refs log tree commit diff
path: root/tests/ui/abi
AgeCommit message (Collapse)AuthorLines
2025-09-20[GCC backend] Ignore failing ui abi testsGuillaume Gomez-0/+14
2025-09-16Update the minimum external LLVM to 20Josh Stone-88/+5
2025-09-13Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxuJacob Pratt-0/+19
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-09-12Add test batch 3Oneirical-0/+19
2025-09-10s390x: mark soft-float target feature as incompatibleRalf Jung-31/+37
2025-09-02Rollup merge of #144066 - RalfJung:extern-c-variadics, r=workingjubileeGuillaume Gomez-3/+1
stabilize c-style varargs for sysv64, win64, efiapi, aapcs This has been split up so the PR now only contains the extended_varargs_abi_support stabilization; "system" has been moved to https://github.com/rust-lang/rust/pull/145954. **Previous (combined) PR description:** This stabilizes extern block declarations of variadic functions with the system, sysv64, win64, efiapi, aapcs ABIs. This corresponds to the extended_varargs_abi_support and extern_system_varargs feature gates. The feature gates were split up since it seemed like there might be further discussion needed for what exactly "system" ABI variadic functions should do, but a [consensus](https://github.com/rust-lang/rust/issues/136946#issuecomment-2967847553) has meanwhile been reached: they shall behave like "C" functions. IOW, the ABI of a "system" function is (bold part is new in this PR): - "stdcall" for win32 targets **for non-variadic functions** - "C" for everything else This had been previously stabilized *without FCP* in https://github.com/rust-lang/rust/pull/116161, which got reverted in https://github.com/rust-lang/rust/pull/136897. There was also a "fun" race condition involved with the system ABI being [added](https://github.com/rust-lang/rust/pull/119587) to the list of variadic-supporting ABIs between the creation and merge of rust-lang/rust#116161. There was a question raised [here](https://github.com/rust-lang/rust/pull/116161#issuecomment-1983829513) whether t-lang even needs to be involved for a change like this. Not sure if that has meanwhile been clarified? The behavior of the "system" ABI (a Rust-specific ABI) definitely feels like t-lang territory to me. Fixes rust-lang/rust#100189 Cc `@rust-lang/lang` # Stabilization report > ## General design > ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? AFAIK there is no RFC. The tracking issues are - https://github.com/rust-lang/rust/issues/100189 - https://github.com/rust-lang/rust/issues/136946 > ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. The only controversial point is whether "system" ABI functions should support variadics. - Pro: This allows crates like windows-rs to consistently use "system", see e.g. https://github.com/microsoft/windows-rs/issues/3626. - Cons: `@workingjubilee` had some implementation concerns, but I think those have been [resolved](https://github.com/rust-lang/rust/issues/136946#issuecomment-2967847553). EDIT: turns out Jubilee still has concerns (she mentioned that in a DM); I'll let her express those. Note that "system" is already a magic ABI we introduced to "do the right thing". This just makes it do the right thing in more cases. In particular, it means that on Windows one can almost always just do ```rust extern "system" { // put all the things here } ``` and it'll do the right thing, rather than having to split imports into non-varargs and varargs, with the varargs in a separate `extern "C"` block (and risking accidentally putting a non-vararg there). (I am saying "almost" always because some Windows API functions actually use cdecl, not stdcall, on x86. Those of course need to go in `extern "C"` blocks.) > ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? Actually defining variadic functions in Rust remains unstable, under the [c_variadic feature gate](https://github.com/rust-lang/rust/issues/44930). > ## Has a Call for Testing period been conducted? If so, what feedback was received? > > Does any OSS nightly users use this feature? For instance, a useful indication might be "search <grep.app> for `#![feature(FEATURE_NAME)]` and had `N` results". There was no call for testing. A search brings up https://github.com/rust-osdev/uefi-rs/blob/main/uefi-raw/src/table/boot.rs using this for "efiapi". This doesn't seem widely used, but it is an "obvious" gap in our support for c-variadics. > ## Implementation quality All rustc does here is forward the ABI to LLVM so there's lot a lot to say here... > ### Summarize the major parts of the implementation and provide links into the code (or to PRs) > > An example for async closures: <https://rustc-dev-guide.rust-lang.org/coroutine-closures.html>. The check for allowed variadic ABIs is [here](https://github.com/rust-lang/rust/blob/9c870d30e2d6434c9e9a004b450c5ccffdf3d844/compiler/rustc_hir_analysis/src/lib.rs#L109-L126). The special handling of "system" is [here](https://github.com/rust-lang/rust/blob/c24914ec8329b22ec7bcaa6ab534a784b2bd8ab9/compiler/rustc_target/src/spec/abi_map.rs#L82-L85). > ### Summarize existing test coverage of this feature > > Consider what the "edges" of this feature are. We're particularly interested in seeing tests that assure us about exactly what nearby things we're not stabilizing. > > Within each test, include a comment at the top describing the purpose of the test and what set of invariants it intends to demonstrate. This is a great help to those reviewing the tests at stabilization time. > > - What does the test coverage landscape for this feature look like? > - Tests for compiler errors when you use the feature wrongly or make mistakes? > - Tests for the feature itself: > - Limits of the feature (so failing compilation) > - Exercises of edge cases of the feature > - Tests that checks the feature works as expected (where applicable, `//@ run-pass`). > - Are there any intentional gaps in test coverage? > > Link to test folders or individual tests (ui/codegen/assembly/run-make tests, etc.). Prior PRs add a codegen test for all ABIs and tests actually calling extern variadic functions for sysv64 and win64: - https://github.com/rust-lang/rust/pull/144359 - https://github.com/rust-lang/rust/pull/144379 We don't have a way of executing uefi target code in the test suite, so it's unclear how to fully test efiapi. aapcs could probably be done? (But note that we have hardly an such actually-calling-functions tests for ABI things, we almost entirely rely on codegen tests.) The test ensuring that we do *not* stabilize *defining* c-variadic functions is `tests/ui/feature-gates/feature-gate-c_variadic.rs`. > ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? None that I am aware of. > ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None that I am aware of. > ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization `@Soveu` added sysv64, win64, efiapi, aapcs to the list of ABIs that allow variadics, `@beepster4096` added system. `@workingjubilee` recently refactored the ABI handling in the compiler, also affecting this feature. > ### Which tools need to be adjusted to support this feature. Has this work been done? > > Consider rustdoc, clippy, rust-analyzer, rustfmt, rustup, docs.rs. Maybe RA needs to be taught about the new allowed ABIs? No idea how precisely they mirror what exactly rustc accepts and rejects here. > ## Type system and execution rules > ### What compilation-time checks are done that are needed to prevent undefined behavior? > > (Be sure to link to tests demonstrating that these tests are being done.) Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### Does the feature's implementation need checks to prevent UB or is it sound by default and needs opt in in places to perform the dangerous/unsafe operations? If it is not sound by default, what is the rationale? Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### Can users use this feature to introduce undefined behavior, or use this feature to break the abstraction of Rust and expose the underlying assembly-level implementation? (Describe.) Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### What updates are needed to the reference/specification? (link to PRs when they exist) - https://github.com/rust-lang/reference/pull/1936 > ## Common interactions > ### Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries? No. > ### What other unstable features may be exposed by this feature? None.
2025-09-02stabilize extended_varargs_abi_supportRalf Jung-3/+1
2025-08-26Use captures(address) instead of captures(none) for indirect argsNikita Popov-10/+10
While provenance cannot be captured through these arguments, the address / object identity can.
2025-08-22Rollup merge of #145710 - heiher:issue-145692-2, r=nnethercoteJacob Pratt-25/+1019
Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64 Issue: rust-lang/rust#145692
2025-08-21Rollup merge of #145661 - folkertdev:s390x-codegen-test-cleanup, r=dianqkJacob Pratt-9/+9
update some s390x codegen tests By using `minicore`, `&raw` and removing use of `link_llvm_intrinsics`
2025-08-21Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64WANG Rui-25/+1019
2025-08-21Rollup merge of #145662 - GrigorenkoPV:x86-interrupt, r=compiler-errorsJacob Pratt-110/+160
Enforce correct number of arguments for `"x86-interrupt"` functions Tracking issue: rust-lang/rust#40180 Partially fixes rust-lang/rust#132835 `````@rustbot````` label: +F-abi_x86_interrupt +A-LLVM +O-x86_64 +O-x86_32 +A-ABI
2025-08-20Auto merge of #145259 - nikic:read-only-capture, r=wesleywiserbors-2/+2
Tell LLVM about read-only captures `&Freeze` parameters are not only `readonly` within the function, but any captures of the pointer can also only be used for reads. This can now be encoded using the `captures(address, read_provenance)` attribute.
2025-08-20Tell LLVM about read-only capturesNikita Popov-2/+2
`&Freeze` parameters are not only `readonly` within the function, but any captures of the pointer can also only be used for reads. This can now be encoded using the `captures(address, read_provenance)` attribute.
2025-08-20Enforce correct number of arguments for `"x86-interrupt"` functionsPavel Grigorenko-110/+160
2025-08-20update some s390x codegen testsFolkert de Vries-9/+9
By using `minicore`, `&raw` and removing use of `link_llvm_intrinsics`
2025-08-19bless tests with new lint messagesKarol Zwolak-6/+6
2025-08-15Rollup merge of #143075 - workingjubilee:interrupts-may-return-nevermore, ↵Stuart Cook-0/+414
r=davidtwco compiler: Allow `extern "interrupt" fn() -> !` While reviewing rust-lang/rust#142633 I overlooked a few details because I was kind of excited. - Fixes rust-lang/rust#143072
2025-08-04Rehome tests/ui/issues/ tests [3/?]Oneirical-0/+15
2025-07-22Rename `tests/codegen` into `tests/codegen-llvm`Guillaume Gomez-1/+1
2025-07-04Fix tests/ui/abi/debug.rs to cross-compile for riscv64Jubilee Young-31/+32
2025-07-04Fixed the ABI parameter inconsistency issue in debug.rs for the riscv64 ↵YingkaiLi-VM-15/+1009
architecture.
2025-07-03Rollup merge of #143329 - folkertdev:minicore-diagnostic-on-unimplemented, ↵Jana Dönszelmann-20/+39
r=jieyouxu minicore: use core's `diagnostic::on_unimplemented` messages Without these attributes, the error message is different. Keeping the diagnostics up-to-date seems related to https://github.com/rust-lang/rust/issues/137531. The modified test files are reported in https://github.com/rust-lang/rust/issues/143319 as failing for `--target=riscv64gc-unknown-linux-gnu`. Using `minicore` for them makes it easier to troubleshoot this sort of issue. r? ``@jieyouxu``
2025-07-03minicore: use core's `diagnostic::on_unimplemented` messagesFolkert de Vries-20/+39
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-10/+10
2025-06-27remember how to write never returnsJubilee Young-10/+10
2025-06-27compiler: allow interrupts to return () or !Jubilee Young-0/+110
2025-06-27compiler: fixup error message for x86-interrupt invalid returnsJubilee Young-2/+2
2025-06-27tests: add test for invalid interrupt signaturesJubilee Young-0/+304
2025-06-25Rollup merge of #142992 - workingjubilee:dont-validate-naughty-abis, r=jieyouxuJana Dönszelmann-188/+81
Convert some ABI tests to use `extern "rust-invalid"`
2025-06-25tests: specify why extern "rust-invalid" cannot be used in varargs testJubilee Young-1/+2
2025-06-25tests: migrate unsupported-abi-transmute.rs to extern "rust-invalid"Jubilee Young-13/+13
2025-06-25tests: split out unsupported-in-impls.rsJubilee Young-174/+66
The cross-build megatest gets extremely conflict-prone, so start cutting it into smaller pieces.
2025-06-25tests: bless s/C-cmse/cmse/Jubilee Young-84/+84
2025-06-25tests: s/C-cmse/cmse/Jubilee Young-5/+5
2025-06-24Rollup merge of #142983 - compiler-errors:taint-invalid-call-abi, ↵Jubilee-0/+44
r=workingjubilee Taint body on invalid call ABI Fixes https://github.com/rust-lang/rust/issues/142969 I'm not certain if there are any other paths that should be tainted, but they would operate similarly. Perhaps pointer coercion. Introduces `extern "rust-invalid"` for testing purposes. r? ```@workingjubilee``` or ```@oli-obk``` (or anyone)
2025-06-24Taint body on invalid call ABIMichael Goulet-0/+23
2025-06-24Add rust-invalid ABIMichael Goulet-0/+21
2025-06-24Error on invalid signatures for interrupt ABIsFolkert de Vries-152/+390
2025-06-23tests: Bless cannot-be-called and dedup with unsupported ABI testJubilee Young-1147/+414
2025-06-23tests: Verify varargs with unsupported fn ptr ABIs must errorJubilee Young-0/+27
2025-06-23tests: Adopt ABI transmute tests from crashtestsJubilee Young-0/+24
2025-06-23tests: Enhance unsupported ABI testsJubilee Young-1846/+1096
We have fairly different error messages now and handle more cases, so we augment the test in tests/ui/abi/unsupported.rs with more examples to handle structs, traits, and impls on same when those feature the unsupported ABIs of interest.
2025-06-20error on calls to ABIs that cannot be calledFolkert de Vries-176/+1293
2025-06-17Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obkbors-2/+12
Sized Hierarchy: Part I This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract. These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler. RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows: - `?Sized` is rewritten as `MetaSized` - `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already. There are no edition migrations implemented in this, as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled. Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately). It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output. **Notes:** - Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged. - This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together. - Each commit has a short description describing its purpose. - This patch is large but it's primarily in the test suite. - I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor. - `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway. - `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491) - FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485 Fixes rust-lang/rust#79409. r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-16tests: `{Meta,Pointee}Sized` in non-minicore testsDavid Wood-2/+12
As before, add `MetaSized` and `PointeeSized` traits to all of the non-minicore `no_core` tests so that they don't fail for lack of language items.
2025-06-16Fix RISC-V C function ABI when passing/returning structs containing floatsbeetrees-0/+44
2025-06-15Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3León Orell Valerian Liehr-0/+1118
Apply ABI attributes on return types in `rustc_codegen_cranelift` - The [x86-64 System V ABI standard](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build) doesn't sign/zero-extend integer arguments or return types. - But the de-facto standard as implemented by Clang and GCC is to sign/zero-extend arguments to 32 bits (but not return types). - Additionally, Apple targets [sign/zero-extend both arguments and return values to 32 bits](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms#Pass-arguments-to-functions-correctly). - However, the `rustc_target` ABI adjustment code currently [unconditionally extends both arguments and return values to 32 bits](https://github.com/rust-lang/rust/blame/e703dff8fe220b78195c53478e83fb2f68d8499c/compiler/rustc_target/src/callconv/x86_64.rs#L240) on all targets. - This doesn't cause a miscompilation when compiling with LLVM as LLVM will ignore the `signext`/`zeroext` attribute when applied to return types on non-Apple x86-64 targets. - Cranelift, however, does not have a similar special case, requiring `rustc` to set the argument extension attribute correctly. - However, `rustc_codegen_cranelift` doesn't currently apply ABI attributes to return types at all, meaning `rustc_codegen_cranelift` will currently miscompile `i8`/`u8`/`i16`/`u16` returns on x86-64 Apple targets as those targets require sign/zero-extension of return types. This PR fixes the bug(s) by making the `rustc_target` x86-64 System V ABI only mark return types as sign/zero-extended on Apple platforms, while also making `rustc_codegen_cranelift` apply ABI attributes to return types. The RISC-V and s390x C ABIs also require sign/zero extension of return types, so this will fix those targets when building with `rustc_codegen_cranelift` too. r? `````@bjorn3`````
2025-06-13Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgrbors-0/+508
Rollup of 9 pull requests Successful merges: - rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error) - rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features) - rust-lang/rust#140770 (add `extern "custom"` functions) - rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - rust-lang/rust#142248 (Add supported asm types for LoongArch32) - rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`) - rust-lang/rust#142274 (Update the stdarch submodule) - rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`) - rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library) Failed merges: - rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-06-12add `extern "custom"` functionsFolkert de Vries-0/+508