rust/tests/assembly
bors 86d0aef804 Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
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-17 15:08:50 +00:00
..
asm Add f16 inline asm support for LoongArch 2025-06-14 09:39:30 +08:00
auxiliary Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
compiletest-self-test tests/assembly: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
libs add regression test for 140207 2025-05-11 14:29:24 +02:00
naked-functions Test naked asm for wasm32-unknown-unknown 2025-06-16 08:26:17 +00:00
nvptx-kernel-abi tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
sanitizer/kcfi KCFI: Add KCFI arity indicator support 2025-04-05 04:05:04 +00:00
simd tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
stack-protector Unimplement unsized_locals 2025-06-13 01:16:36 +02:00
targets Add new Tier-3 targets: loongarch32-unknown-none* 2025-06-06 08:19:38 +08:00
aarch64-pointer-auth.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
aarch64-xray.rs Add compiler tests for xray 2025-05-26 00:39:23 +08:00
align_offset.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
breakpoint.rs Add core::arch::breakpoint and test 2024-12-02 23:56:24 -08:00
closure-inherit-target-feature.rs x86-sse2 ABI: use SSE registers for floats and SIMD 2025-02-18 16:11:41 +01:00
cmse.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
cstring-merging.rs Make C string merging test work on MIPS 2025-04-17 16:08:22 +02:00
dwarf-mixed-versions-lto.rs Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
dwarf4.rs Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
dwarf5.rs Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
is_aligned.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
issue-83585-small-pod-struct-equality.rs Fix tests for 32 bits targets 2024-06-11 07:45:16 +00:00
manual-eq-efficient.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
niche-prefer-zero.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-default.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-emit-asm.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-arch-link-arg.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-arch-target-cpu.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
nvptx-atomics.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-c-abi-arg-v7.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
nvptx-c-abi-ret-v7.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
nvptx-internalizing.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-binary.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-linking-cdylib.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
nvptx-safe-naming.rs NVPTX: Enable previously disabled tests 2024-03-11 13:35:58 +01:00
panic-no-unwind-no-uwtable.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
panic-unwind-no-uwtable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pic-relocation-model.rs Apply ABI attributes on return types in rustc_codegen_cranelift 2025-06-12 00:47:01 +01:00
pie-relocation-model.rs Apply ABI attributes on return types in rustc_codegen_cranelift 2025-06-12 00:47:01 +01:00
powerpc64-struct-abi.rs Use explicit cpu in some asm and codegen tests. 2025-03-19 19:45:46 +01:00
riscv-float-struct-abi.rs Fix RISC-V C function ABI when passing/returning structs containing floats 2025-06-16 10:14:07 +01:00
riscv-soft-abi-with-float-features.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
rust-abi-arg-attr.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
s390x-backchain-toggle.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
s390x-vector-abi.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
simd-bitmask.rs make abi_unsupported_vector_types a hard error 2025-04-20 11:34:56 +02:00
simd-intrinsic-gather.rs update/bless tests 2025-04-06 21:41:47 +02:00
simd-intrinsic-mask-load.rs update/bless tests 2025-04-06 21:41:47 +02:00
simd-intrinsic-mask-reduce.rs update/bless tests 2025-04-06 21:41:47 +02:00
simd-intrinsic-mask-store.rs update/bless tests 2025-04-06 21:41:47 +02:00
simd-intrinsic-scatter.rs update/bless tests 2025-04-06 21:41:47 +02:00
simd-intrinsic-select.rs make abi_unsupported_vector_types a hard error 2025-04-20 11:34:56 +02:00
slice-is_ascii.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
small_data_threshold.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
sparc-struct-abi.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
stack-probes.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
static-relocation-model.rs Update the minimum external LLVM to 19 2025-04-05 11:44:38 -07:00
strict_provenance.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
target-feature-multiple.rs tests: use minicore more 2025-02-24 09:26:54 +00:00
wasm_exceptions.rs Fix wasm_exceptions test 2024-06-19 21:26:48 +01:00
x86-return-float.rs tests: account for CFI directives in tests/assembly/x86-return-float.rs 2025-04-23 17:11:49 +08:00
x86_64-array-pair-load-store-merge.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
x86_64-bigint-helpers.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
x86_64-cmp.rs Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics 2025-03-06 22:29:05 +08:00
x86_64-floating-point-clamp.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
x86_64-fortanix-unknown-sgx-lvi-generic-load.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-function-return.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
x86_64-no-jump-tables.rs tests/assembly: use -Copt-level=3 instead of -O 2025-02-08 19:02:32 -08:00
x86_64-sse_crc.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
x86_64-typed-swap.rs Ensure swap_nonoverlapping is really always untyped 2025-04-09 09:09:37 -07:00
x86_64-windows-float-abi.rs tests: adjust expectation for f128 abi on Windows 2025-04-10 15:28:56 -04:00
x86_64-windows-i128-abi.rs x86_win64 ABI: do not use xmm0 with softfloat ABI 2025-02-19 08:41:19 +01:00
x86_64-xray.rs Add compiler tests for xray 2025-05-26 00:39:23 +08:00