Skip to content

Complex layout phase 2 - #159981

Draft
folkertdev wants to merge 25 commits into
rust-lang:mainfrom
folkertdev:complex-layout-phase-2
Draft

Complex layout phase 2#159981
folkertdev wants to merge 25 commits into
rust-lang:mainfrom
folkertdev:complex-layout-phase-2

Conversation

@folkertdev

Copy link
Copy Markdown
Contributor

tracking issue: #154023

Follow-up to #158885

@folkertdev folkertdev added the F-complex_numbers `#![feature(complex_numbers)]` label Jul 26, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 26, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 26, 2026

@programmerjake programmerjake Jul 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll also want tests for functions like safe fn complex_float_align2(_: c_float, value: Complex<c_float>) -> Complex<c_float>

also tests for properly handling complex arguments that could be split between registers and the stack (so the previous args take all but 1 fp or int reg), since different ABIs say to do different things (e.g. keep them together on the stack or split between registers and the stack)

View changes since the review

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/attributes/attr-on-mac-call.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/attributes/attr-on-mac-call/attr-on-mac-call.stderr`
diff of stderr:

36    = help: add `#![feature(repr_complex)]` to the crate attributes to enable
37    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
38 
- error: `#[repr(complex)]` attribute cannot be used on macro calls
-   --> $DIR/attr-on-mac-call.rs:110:5
+ error: the `repr(complex)` attribute cannot be used on macro calls
+   --> $DIR/attr-on-mac-call.rs:110:7
---
-    = help: `#[repr(complex)]` can only be applied to structs
+    = help: the `repr(complex)` attribute can only be applied to structs
46    = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute
47 
48 error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:110:7
+ error: the `repr(complex)` attribute cannot be used on macro calls
+   --> $DIR/attr-on-mac-call.rs:110:7
---
To only update this specific test, also pass `--test-args attributes/attr-on-mac-call.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/attributes/attr-on-mac-call.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/attributes/attr-on-mac-call" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: the `sanitize` attribute cannot be used on macro calls
##[error]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:77:7
   |
---
LL |     #[repr(simd)]
   |            ^^^^
   |
   = note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information
   = help: add `#![feature(repr_simd)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: the `repr(simd)` attribute cannot be used on macro calls
##[error]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:106:7
   |
LL |     #[repr(simd)]
---
LL |     #[repr(complex)]
   |            ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: the `repr(complex)` attribute cannot be used on macro calls
##[error]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:110:7
   |
LL |     #[repr(complex)]
   |       ^^^^^^^^^^^^^
   |
   = help: the `repr(complex)` attribute can only be applied to structs
   = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute

error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![register_tool]`
##[error]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:114:5
   |
LL |     #[register_tool(xyz)]
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
note: this attribute does not have an `!`, which means it is applied to this macro call
  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:116:5
   |
---

warning: the `target_feature` attribute cannot be used on macro calls
##[warning]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:20:7
   |
LL |     #[target_feature(enable = "x")]
   |       ^^^^^^^^^^^^^^
   |
   = help: the `target_feature` attribute can only be applied to functions
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute
---

warning: the `link_section` attribute cannot be used on macro calls
##[warning]  --> /checkout/tests/ui/attributes/attr-on-mac-call.rs:32:7
   |
LL |     #[link_section = "__TEXT,__text"]
   |       ^^^^^^^^^^^^
   |
   = help: the `link_section` attribute can be applied to functions and statics
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute
---
---- [ui] tests/ui/feature-gates/feature-gate-repr-complex.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-repr-complex/feature-gate-repr-complex.stderr`
diff of stderr:

38    = help: add `#![feature(repr_complex)]` to the crate attributes to enable
39    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40 
- error: `#[repr(complex)]` attribute cannot be used on unions
-   --> $DIR/feature-gate-repr-complex.rs:16:1
+ error: the `repr(complex)` attribute cannot be used on unions
+   --> $DIR/feature-gate-repr-complex.rs:16:3
---
48 
49 error[E0658]: `repr(complex)` is experimental
50   --> $DIR/feature-gate-repr-complex.rs:23:8

56    = help: add `#![feature(repr_complex)]` to the crate attributes to enable
57    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
58 
- error: `#[repr(complex)]` attribute cannot be used on enums
-   --> $DIR/feature-gate-repr-complex.rs:23:1
+ error: the `repr(complex)` attribute cannot be used on enums
+   --> $DIR/feature-gate-repr-complex.rs:23:3
---
To only update this specific test, also pass `--test-args feature-gates/feature-gate-repr-complex.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-repr-complex" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0658]: `repr(complex)` is experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:1:8
   |
LL | #[repr(complex)] //~ ERROR: `repr(complex)` is experimental
   |        ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `repr(complex)` is experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:7:8
   |
LL | #[repr(complex)] //~ ERROR: `repr(complex)` is experimental
   |        ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `repr(complex)` is experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:13:8
   |
LL | #[repr(complex)] //~ ERROR: `repr(complex)` is experimental
   |        ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `repr(complex)` is experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:16:8
   |
LL | #[repr(complex)]
   |        ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: the `repr(complex)` attribute cannot be used on unions
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:16:3
   |
LL | #[repr(complex)]
---
LL | #[repr(complex)]
   |        ^^^^^^^
   |
   = note: see issue #154023 <https://github.com/rust-lang/rust/issues/154023> for more information
   = help: add `#![feature(repr_complex)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: the `repr(complex)` attribute cannot be used on enums
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-repr-complex.rs:23:3
   |
LL | #[repr(complex)]
---
   |
LL | #[repr(C)]
   |        ^
...
LL | #[repr(complex)] //~ ERROR: `repr(complex)` is experimental
   |        ^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
   = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
---
   |
LL | #[repr(C)]
   |        ^
...
LL | #[repr(complex)] //~ ERROR: `repr(complex)` is experimental
   |        ^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585>
   = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` F-complex_numbers `#![feature(complex_numbers)]` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants