Skip to content

Rollup of 10 pull requests#155843

Closed
JonathanBrouwer wants to merge 35 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-d6xHqF5
Closed

Rollup of 10 pull requests#155843
JonathanBrouwer wants to merge 35 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-d6xHqF5

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

Flakebi and others added 30 commits December 29, 2025 21:56
Targets that set `requires_lto = true` were not actually using lto when
compiling with cargo by default. They needed an extra `lto = true` in
`Cargo.toml` to work.

Fix this by letting lto take precedence over the `embed_bitcode` flag
when lto is required by a target.

If both these flags would be supplied by the user, an error is
generated. However, this did not happen when lto was requested by the
target instead of the user.
For now, this is a 1-to-1 copy of `LayoutData`, but this will change.
It was always set to `Variants::Single`.
Enum variants always have `Arbitrary` layout, so the enum isn't needed.
This field is only used during layout calculations, so re-synthetized
`LayoutData`s for enum variants can use a dummy value instead.
Reusing the alignment of the enclosing enum in `LayoutData::for_variant`
doesn't appear to cause any issues.
The only place inspecting the niches of a variant layout is
`compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs`, which can
be rewritten to use the niches of the enclosing enum instead.
Commit cb37ee2 ("make field representing types invariant over the
base type") made the auto-trait impl work even if `T: !Send` or `T:
!Sync` thus we can remove these explicit unsafe impls while FRTs still
implement `Send` and `Sync`.
Using the reflection experiment, we can print the actual names of the
field that an FRT is referring to. In case this breaks, there is an
alternative implementation in the note comment.
Eliminate `cursor` and `ibuf` as named variables, as their presence
makes things more confusing.
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Remove redundant information in `rustc_abi::Variants`

Follow-up to rust-lang#151040; partially addresses rust-lang#113988.

Replaces the nested `LayoutData` in `Variants::Multiple` by a new, smaller `VariantLayout` struct, and adjust `LayoutData::for_variant`and the layout algorithm in consequence.
This PR is best reviewed commit-by-commit.
Fix requires_lto targets needing lto set in cargo

Targets that set `requires_lto = true` were not actually using lto when compiling with cargo by default. They needed an extra `lto = true` in `Cargo.toml` to work.

Fix this by letting lto take precedence over the `embed_bitcode` flag when lto is required by a target.

If both these flags would be supplied by the user, an error is generated. However, this did not happen when lto was requested by the target instead of the user.

Fixes rust-lang#148514
Tracking issue: rust-lang#135024
…_hw_and_isa, r=ZuseZ4

NVPTX: Drop support for old architectures and old ISAs

This is the implementation of [this MCP](rust-lang/compiler-team#965 (comment))

I believe it was said that no FCP was needed, but if that is incorrect then the FCP is anyway scheduled to finish in 2 days so it can in any case be merged then.
…lacrum

`std::io::Take`: Clarify & optimize `BorrowedBuf::set_init` usage.

Don't initialize `buf` if it was already initialized. Clarify safety comments.

Move the `buf.advance()` call to make the initialization more like
calling `buf.ensure_init()`, then clarify how the code here is an
optimized variant of `ensure_init`.
…ulacrum

Implement more traits for FRTs

From rust-lang#154927 (comment).

FRTs now implement the following traits: `Sized + Freeze + RefUnwindSafe + Send + Sync + Unpin + UnsafeUnpin + UnwindSafe + Copy + Debug + Default + Eq + Hash + Ord`.

Let me know if there is any trait missing.

I also removed the explicit  `Send` and `Sync` impls, since commit cb37ee2 ("make field representing types invariant over the base type") made the auto-trait impl work even if `T: !Send` or `T: !Sync`. Very happy to see unsafe impls get dropped :)

Note that I used the reflection feature (cc @oli-obk) to print the actual field names in the debug implementation. I think this is a cool way to use it, but if it isn't ready for that, I'm happy to change it to the alternative implementation I gave in the note comment (it's essentially Mark's suggestion but printing `T`'s name instead of `Self`'s).

Since this is a library change, I'll give this to Mark; feel free to also take a look/leave comments, Oli :)

r? @Mark-Simulacrum
Add boxing suggestions for `impl Trait` return type mismatches

A sort of a follow up pr to this -> rust-lang#155546
…re-return-note, r=wesleywiser

Avoid misleading closure return type note

Fixes rust-lang#155670
…=mejrs

Convert attribute `FinalizeFn` to fn pointer
rustc_attr_parsing: use a `try {}` in `or_malformed`
… r=wesleywiser

couple of `crate_name` cleanups

Split out from rust-lang#153924; these changes should be uncontroversial.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Apr 26, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Apr 26, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

📌 Commit d33e6e2 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

⌛ Trying commit d33e6e2 with merge c4789e8

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/24966420984

rust-bors Bot pushed a commit that referenced this pull request Apr 26, 2026
Rollup of 10 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-2
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/target-cpu/explicit-target-cpu.rs#amdgcn_nocpu ... ok
test [ui] tests/ui/target-feature/aarch64-neon-works.rs ... ignored, only executed when the architecture is aarch64
test [ui] tests/ui/target-cpu/explicit-target-cpu.rs#avr_nocpu ... ok
test [ui] tests/ui/sync/track-caller-for-once-87707.rs ... ok
test [ui] tests/ui/target-cpu/unsupported-target-cpu.rs#nvptx-sm60 ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute-fcw.rs ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs#riscv ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs#riscv ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs#x86 ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs#x86 ... ok
---
630                        uninhabited: false,
-                        variants: Single {
-                            index: 0,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
637                    },
-                    Layout {
+                    VariantLayout {
639                        size: Size(1 bytes),
-                        align: AbiAlign {
---
670                        uninhabited: false,
-                        variants: Single {
-                            index: 1,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
677                    },
678                ],
679            },

734                },
---
750                        uninhabited: false,
-                        variants: Single {
-                            index: 0,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
757                    },
-                    Layout {
+                    VariantLayout {
759                        size: Size(4 bytes),
-                        align: AbiAlign {
---
790                        uninhabited: false,
-                        variants: Single {
-                            index: 1,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(4 bytes),
-                        randomization_seed: $SEED,
797                    },
798                ],
799            },


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args layout/debug.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/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/ui/layout/debug.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/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-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/x86_64-unknown-linux-gnu/test/ui/layout/debug" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: unions cannot have zero fields
##[error]  --> /checkout/tests/ui/layout/debug.rs:84:1
   |
LL | union EmptyUnion {} //~ ERROR: has an unknown layout
   | ^^^^^^^^^^^^^^^^^^^

error: `#[rustc_dump_layout]` attribute cannot be used on constants
##[error]  --> /checkout/tests/ui/layout/debug.rs:71:1
   |
LL | #[rustc_dump_layout(debug)] //~ ERROR: cannot be used on constants
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_dump_layout]` can be applied to data types and type aliases

error: `#[rustc_dump_layout]` attribute cannot be used on associated consts
##[error]  --> /checkout/tests/ui/layout/debug.rs:75:5
   |
LL |     #[rustc_dump_layout(debug)] //~ ERROR: cannot be used on associated consts
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_dump_layout]` can be applied to data types and type aliases

error: layout_of(E) = Layout {
---
           randomization_seed: 8948199692932498620,
       }
  --> /checkout/tests/ui/layout/debug.rs:8:1
   |
LL | enum E { Foo, Bar(!, i32, i32) } //~ ERROR: layout_of
   | ^^^^^^

error: layout_of(S) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
---
           randomization_seed: 7923229307993029604,
       }
  --> /checkout/tests/ui/layout/debug.rs:11:1
   |
LL | struct S { f1: i32, f2: (), f3: i32 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(U) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
---
           randomization_seed: 2298313394506366486,
       }
  --> /checkout/tests/ui/layout/debug.rs:14:1
   |
LL | union U { f1: (i32, i32), f3: i32 } //~ ERROR: layout_of
   | ^^^^^^^

error: layout_of(Result<i32, i32>) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: ScalarPair(
               Initialized {
                   value: Int(
                       I32,
---
           randomization_seed: 1755926635337735134,
       }
  --> /checkout/tests/ui/layout/debug.rs:17:1
   |
LL | type Test = Result<i32, i32>; //~ ERROR: layout_of
   | ^^^^^^^^^

error: layout_of(i32) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I32,
---
           randomization_seed: 18446462603027873795,
       }
  --> /checkout/tests/ui/layout/debug.rs:20:1
   |
LL | type T = impl std::fmt::Debug; //~ ERROR: layout_of
   | ^^^^^^

error: layout_of(V) = Layout {
           size: Size(2 bytes),
           align: AbiAlign {
---
           randomization_seed: 178675646668603130,
       }
  --> /checkout/tests/ui/layout/debug.rs:27:1
   |
LL | pub union V { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(W) = Layout {
           size: Size(2 bytes),
           align: AbiAlign {
               abi: Align(2 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 17258428822019709731,
       }
  --> /checkout/tests/ui/layout/debug.rs:33:1
   |
LL | pub union W { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(Y) = Layout {
           size: Size(0 bytes),
           align: AbiAlign {
               abi: Align(2 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 508099872518211379,
       }
  --> /checkout/tests/ui/layout/debug.rs:39:1
   |
LL | pub union Y { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(P1) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 17761616921056340373,
       }
  --> /checkout/tests/ui/layout/debug.rs:46:1
   |
LL | union P1 { x: u32 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P2) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 3276214648884461513,
       }
  --> /checkout/tests/ui/layout/debug.rs:50:1
   |
LL | union P2 { x: (u32, u32) } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P3) = Layout {
           size: Size(16 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 16350645825483038784,
       }
  --> /checkout/tests/ui/layout/debug.rs:58:1
   |
LL | union P3 { x: F32x4 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P4) = Layout {
           size: Size(12 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 6854031362515018330,
       }
  --> /checkout/tests/ui/layout/debug.rs:62:1
   |
LL | union P4 { x: E } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P5) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Union {
                   value: Int(
                       I8,
---
           randomization_seed: 12952539985517631705,
       }
  --> /checkout/tests/ui/layout/debug.rs:66:1
   |
LL | union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(MaybeUninit<u8>) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Union {
                   value: Int(
                       I8,
---
           randomization_seed: 407490073504725818,
       }
  --> /checkout/tests/ui/layout/debug.rs:69:1
   |
LL | type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
   | ^^^^^^

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/layout/debug.rs:80:19
   |
LL | type Impossible = (str, str); //~ ERROR: cannot be known at compilation time
   |                   ^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: only the last element of a tuple may have a dynamically sized type

---

error: the type `T` does not have a fixed layout
##[error]  --> /checkout/tests/ui/layout/debug.rs:90:1
   |
LL | type TooGeneric<T> = T; //~ ERROR: does not have a fixed layout
   | ^^^^^^^^^^^^^^^^^^

error: layout_of(Option<bool>) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I8,
---
           randomization_seed: 1197436388863682962,
       }
  --> /checkout/tests/ui/layout/debug.rs:93:1
   |
LL | type OptBool = Option<bool>; //~ ERROR: layout_of
   | ^^^^^^^^^^^^

error: layout_of(Option<char>) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
           ),
           fields: Arbitrary {
               offsets: [
                   Size(0 bytes),
---
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
           ),
           uninhabited: false,
           variants: Multiple {
               tag: Initialized {
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
               tag_encoding: Niche {
                   untagged_variant: 1,
                   niche_variants: 0..=0,
                   niche_start: 4294967295,
---
           randomization_seed: 1196873438910261669,
       }
  --> /checkout/tests/ui/layout/debug.rs:96:1
   |
LL | type OptChar = Option<char>; //~ ERROR: layout_of
   | ^^^^^^^^^^^^

error: aborting due to 22 previous errors

For more information about this error, try `rustc --explain E0277`.

@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)
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-04-14/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
test [ui] tests/ui/target-cpu/explicit-target-cpu.rs#avr_cpu ... ok
test [ui] tests/ui/target-cpu/explicit-target-cpu.rs#amdgcn_nocpu ... ok
test [ui] tests/ui/target-cpu/explicit-target-cpu.rs#avr_nocpu ... ok
test [ui] tests/ui/sync/track-caller-for-once-87707.rs ... ok
test [ui] tests/ui/target-cpu/unsupported-target-cpu.rs#nvptx-sm60 ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs#riscv ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute-fcw.rs ... ok
test [ui] tests/ui/target-feature/aarch64-neon-works.rs ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-attribute.rs#x86 ... ok
test [ui] tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs#x86 ... ok
---
630                        uninhabited: false,
-                        variants: Single {
-                            index: 0,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
637                    },
-                    Layout {
+                    VariantLayout {
639                        size: Size(1 bytes),
-                        align: AbiAlign {
---
670                        uninhabited: false,
-                        variants: Single {
-                            index: 1,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
677                    },
678                ],
679            },

734                },
---
750                        uninhabited: false,
-                        variants: Single {
-                            index: 0,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(1 bytes),
-                        randomization_seed: $SEED,
757                    },
-                    Layout {
+                    VariantLayout {
759                        size: Size(4 bytes),
-                        align: AbiAlign {
---
790                        uninhabited: false,
-                        variants: Single {
-                            index: 1,
-                        },
-                        max_repr_align: None,
-                        unadjusted_abi_align: Align(4 bytes),
-                        randomization_seed: $SEED,
797                    },
798                ],
799            },


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args layout/debug.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/layout/debug.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/layout/debug" "-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: unions cannot have zero fields
##[error]  --> /checkout/tests/ui/layout/debug.rs:84:1
   |
LL | union EmptyUnion {} //~ ERROR: has an unknown layout
   | ^^^^^^^^^^^^^^^^^^^

error: `#[rustc_dump_layout]` attribute cannot be used on constants
##[error]  --> /checkout/tests/ui/layout/debug.rs:71:1
   |
LL | #[rustc_dump_layout(debug)] //~ ERROR: cannot be used on constants
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_dump_layout]` can be applied to data types and type aliases

error: `#[rustc_dump_layout]` attribute cannot be used on associated consts
##[error]  --> /checkout/tests/ui/layout/debug.rs:75:5
   |
LL |     #[rustc_dump_layout(debug)] //~ ERROR: cannot be used on associated consts
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_dump_layout]` can be applied to data types and type aliases

error: layout_of(E) = Layout {
---
           randomization_seed: 8948199692932498620,
       }
  --> /checkout/tests/ui/layout/debug.rs:8:1
   |
LL | enum E { Foo, Bar(!, i32, i32) } //~ ERROR: layout_of
   | ^^^^^^

error: layout_of(S) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
---
           randomization_seed: 7923229307993029604,
       }
  --> /checkout/tests/ui/layout/debug.rs:11:1
   |
LL | struct S { f1: i32, f2: (), f3: i32 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(U) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
---
           randomization_seed: 2298313394506366486,
       }
  --> /checkout/tests/ui/layout/debug.rs:14:1
   |
LL | union U { f1: (i32, i32), f3: i32 } //~ ERROR: layout_of
   | ^^^^^^^

error: layout_of(Result<i32, i32>) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: ScalarPair(
               Initialized {
                   value: Int(
                       I32,
---
           randomization_seed: 14823310932481726669,
       }
  --> /checkout/tests/ui/layout/debug.rs:17:1
   |
LL | type Test = Result<i32, i32>; //~ ERROR: layout_of
   | ^^^^^^^^^

error: layout_of(i32) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I32,
---
           randomization_seed: 18446462603027873795,
       }
  --> /checkout/tests/ui/layout/debug.rs:20:1
   |
LL | type T = impl std::fmt::Debug; //~ ERROR: layout_of
   | ^^^^^^

error: layout_of(V) = Layout {
           size: Size(2 bytes),
           align: AbiAlign {
---
           randomization_seed: 178675646668603130,
       }
  --> /checkout/tests/ui/layout/debug.rs:27:1
   |
LL | pub union V { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(W) = Layout {
           size: Size(2 bytes),
           align: AbiAlign {
               abi: Align(2 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 17258428822019709731,
       }
  --> /checkout/tests/ui/layout/debug.rs:33:1
   |
LL | pub union W { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(Y) = Layout {
           size: Size(0 bytes),
           align: AbiAlign {
               abi: Align(2 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 508099872518211379,
       }
  --> /checkout/tests/ui/layout/debug.rs:39:1
   |
LL | pub union Y { //~ ERROR: layout_of
   | ^^^^^^^^^^^

error: layout_of(P1) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 17761616921056340373,
       }
  --> /checkout/tests/ui/layout/debug.rs:46:1
   |
LL | union P1 { x: u32 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P2) = Layout {
           size: Size(8 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 3276214648884461513,
       }
  --> /checkout/tests/ui/layout/debug.rs:50:1
   |
LL | union P2 { x: (u32, u32) } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P3) = Layout {
           size: Size(16 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 16350645825483038784,
       }
  --> /checkout/tests/ui/layout/debug.rs:58:1
   |
LL | union P3 { x: F32x4 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P4) = Layout {
           size: Size(12 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Memory {
               sized: true,
           },
           fields: Union(
---
           randomization_seed: 6854031362515018330,
       }
  --> /checkout/tests/ui/layout/debug.rs:62:1
   |
LL | union P4 { x: E } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(P5) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Union {
                   value: Int(
                       I8,
---
           randomization_seed: 12952539985517631705,
       }
  --> /checkout/tests/ui/layout/debug.rs:66:1
   |
LL | union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
   | ^^^^^^^^

error: layout_of(MaybeUninit<u8>) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Union {
                   value: Int(
                       I8,
---
           randomization_seed: 17247714104153524144,
       }
  --> /checkout/tests/ui/layout/debug.rs:69:1
   |
LL | type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
   | ^^^^^^

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/layout/debug.rs:80:19
   |
LL | type Impossible = (str, str); //~ ERROR: cannot be known at compilation time
   |                   ^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: only the last element of a tuple may have a dynamically sized type

---

error: the type `T` does not have a fixed layout
##[error]  --> /checkout/tests/ui/layout/debug.rs:90:1
   |
LL | type TooGeneric<T> = T; //~ ERROR: does not have a fixed layout
   | ^^^^^^^^^^^^^^^^^^

error: layout_of(Option<bool>) = Layout {
           size: Size(1 bytes),
           align: AbiAlign {
               abi: Align(1 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I8,
---
           randomization_seed: 5180726684345196402,
       }
  --> /checkout/tests/ui/layout/debug.rs:93:1
   |
LL | type OptBool = Option<bool>; //~ ERROR: layout_of
   | ^^^^^^^^^^^^

error: layout_of(Option<char>) = Layout {
           size: Size(4 bytes),
           align: AbiAlign {
               abi: Align(4 bytes),
           },
           backend_repr: Scalar(
               Initialized {
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
           ),
           fields: Arbitrary {
               offsets: [
                   Size(0 bytes),
---
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
           ),
           uninhabited: false,
           variants: Multiple {
               tag: Initialized {
                   value: Int(
                       I32,
                       false,
                   ),
                   valid_range: (..=1114111) | (4294967295..),
               },
               tag_encoding: Niche {
                   untagged_variant: 1,
                   niche_variants: 0..=0,
                   niche_start: 4294967295,
---
           randomization_seed: 5180163734391775109,
       }
  --> /checkout/tests/ui/layout/debug.rs:96:1
   |
LL | type OptChar = Option<char>; //~ ERROR: layout_of
   | ^^^^^^^^^^^^

error: aborting due to 22 previous errors

For more information about this error, try `rustc --explain E0277`.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 26, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

PR #151742, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 26, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors try cancel

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

Try build cancelled. Cancelled workflows:

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs rollup A PR which is a rollup 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.