about summary refs log tree commit diff
path: root/tests/ui/abi
AgeCommit message (Collapse)AuthorLines
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
2025-06-12Apply ABI attributes on return types in `rustc_codegen_cranelift`beetrees-0/+1118
2025-06-11tests: Bless for weaker unsupported_calling_conventionsJubilee Young-348/+0
2025-06-09tests: bless unsupported_calling_conventions linting on some fn_ptrsJubilee Young-166/+182
2025-06-09Auto merge of #141435 - RalfJung:unsupported_calling_conventions, ↵bors-304/+1346
r=workingjubilee Add (back) `unsupported_calling_conventions` lint to reject more invalid calling conventions This adds back the `unsupported_calling_conventions` lint that was removed in https://github.com/rust-lang/rust/pull/129935, in order to start the process of dealing with https://github.com/rust-lang/rust/issues/137018. Specifically, we are going for the plan laid out [here](https://github.com/rust-lang/rust/issues/137018#issuecomment-2672118326): - thiscall, stdcall, fastcall, cdecl should only be accepted on x86-32 - vectorcall should only be accepted on x86-32 and x86-64 The difference to the status quo is that: - We stop accepting stdcall, fastcall on targets that are windows && non-x86-32 (we already don't accept these on targets that are non-windows && non-x86-32) - We stop accepting cdecl on targets that are non-x86-32 - (There is no difference for thiscall, this was already a hard error on non-x86-32) - We stop accepting vectorcall on targets that are windows && non-x86-* Vectorcall is an unstable ABI so we can just make this a hard error immediately. The others are stable, so we emit the `unsupported_calling_conventions` forward-compat lint. I set up the lint to show up in dependencies via cargo's future-compat report immediately, but we could also make it show up just for the local crate first if that is preferred. try-job: i686-msvc-1 try-job: x86_64-msvc-1 try-job: test-various
2025-06-08Remove rustc's notion of "preferred" alignment AKA `__alignof`Jubilee Young-76/+38
In PR 90877 T-lang decided not to remove `intrinsics::pref_align_of`. However, the intrinsic and its supporting code 1. is a nightly feature, so can be removed at compiler/libs discretion 2. requires considerable effort in the compiler to support, as it necessarily complicates every single site reasoning about alignment 3. has been justified based on relevance to codegen, but it is only a requirement for C++ (not C, not Rust) stack frame layout for AIX, in ways Rust would not consider even with increased C++ interop 4. is only used by rustc to overalign some globals, not correctness 5. can be adequately replaced by other rules for globals, as it mostly affects alignments for a few types under 16 bytes of alignment 6. has only one clear benefactor: automating C -> Rust translation for GNU extensions like `__alignof` 7. such code was likely intended to be `alignof` or `_Alignof`, because the GNU extension is a "false friend" of the C keyword, which makes the choice to support such a mapping very questionable 8. makes it easy to do incorrect codegen in the compiler by its mere presence as usual Rust rules of alignment (e.g. `size == align * N`) do not hold with preferred alignment The implementation is clearly damaging the code quality of the compiler. Thus it is within the compiler team's purview to simply rip it out. If T-lang wishes to have this intrinsic restored for c2rust's benefit, it would have to use a radically different implementation that somehow does not cause internal incorrectness. Until then, remove the intrinsic and its supporting code, as one tool and an ill-considered GCC extension cannot justify risking correctness. Because we touch a fair amount of the compiler to change this at all, and unfortunately the duplication of AbiAndPrefAlign is deep-rooted, we keep an "AbiAlign" type which we can wean code off later.
2025-06-08add specific help messages for stdcall and cdeclRalf Jung-102/+353
2025-06-08avoid repeating error annotations in test fileRalf Jung-418/+290
2025-06-08raw dylib: ensure that we have applied standard ABI checksRalf Jung-1/+27
also unify error messages that do not seem to have a good reason to be different
2025-06-08add (back) unsupported_calling_conventions lint to reject more invalid ↵Ralf Jung-212/+1105
calling conventions
2025-06-03bless test for CanonAbi::X86(SysV64) changeJubilee Young-1/+3
2025-05-18Remove uses of `#[feature(avx512_target_feature)]`sayantn-15/+12
2025-05-06tests: don't ignore compiler stderr in `lib-defaults.rs`Jieyou Xu-15/+0
And also: - Document test intent. - Move under `link-native-libs/` instead.
2025-05-01Remove redundant min-llvm-version annotations for LoongArch testsWANG Rui-1/+0
2025-04-20make abi_unsupported_vector_types a hard errorRalf Jung-852/+81
2025-04-17Replace infallible `name_or_empty` methods with fallible `name` methods.Nicholas Nethercote-2/+2
I'm removing empty identifiers everywhere, because in practice they always mean "no identifier" rather than "empty identifier". (An empty identifier is impossible.) It's better to use `Option` to mean "no identifier" because you then can't forget about the "no identifier" possibility. Some specifics: - When testing an attribute for a single name, the commit uses the `has_name` method. - When testing an attribute for multiple names, the commit uses the new `has_any_name` method. - When using `match` on an attribute, the match arms now have `Some` on them. In the tests, we now avoid printing empty identifiers by not printing the identifier in the `error:` line at all, instead letting the carets point out the problem.
2025-04-17Augment some tests involving attributes.Nicholas Nethercote-1/+10
This shows places where the use of `name_or_empty` causes problems, i.e. we print empty identifiers in error messages: ``` error: unrecognized field name `` error: `` isn't a valid `#[macro_export]` argument `#[no_sanitize()]` should be applied to a function ``` (The last one is about an attribute `#[no_sanitize("address")]`.) The next commit will fix these.