Commit Graph

183 Commits

Author SHA1 Message Date
Moulins 75015f405a Remove per-variant alignment in VariantLayout
Reusing the alignment of the enclosing enum in `LayoutData::for_variant`
doesn't appear to cause any issues.
2026-05-15 04:34:51 +02:00
Moulins 3459964408 Remove unused VariantLayout.randomization_seed field
This field is only used during layout calculations, so re-synthetized
`LayoutData`s for enum variants can use a dummy value instead.
2026-05-15 04:34:51 +02:00
Moulins 0569574938 Store FieldsShape::Arbitrary fields directly in VariantLayout
Enum variants always have `Arbitrary` layout, so the enum isn't needed.
2026-05-15 04:34:51 +02:00
Moulins 1162bdc1f3 Remove redundant VariantLayout.variants field
It was always set to `Variants::Single`.
2026-05-15 04:34:48 +02:00
Moulins 464dc07de2 Introduce VariantLayout struct
For now, this is a 1-to-1 copy of `LayoutData`, but this will change.
2026-05-15 04:34:17 +02:00
John Kåre Alsaker 25e018de2d Add better default spans for the Ty impl of QueryKey 2026-05-04 16:56:59 +02:00
Oli Scherer 11d88ee42b Rip out rustc_layout_scalar_valid_range_* attribute support 2026-05-03 10:59:52 +02:00
Scott McMurray ba1a33e105 Prefer -1 for None
Currently we pick "weird" numbers like `1114112` for `None::<char>`.  While that's not *wrong*, it's kinda *unnatural* -- a human wouldn't make that choice.

This PR instead picks `-1` for thinge like `None::<char>` -- like clang's `WEOF` -- and `None::<bool>` and such.

Any enums with more than one niched value (so not `Result` nor `Option`) remain as they were before.
2026-04-25 14:57:23 -07:00
Scott McMurray 9bc1313507 Add dump_layout tests for options of bool and char 2026-04-25 13:46:42 -07:00
León Orell Valerian Liehr 7025605b8c Rename #[rustc_dump_layout]'s abi option to backend_repr
Moreover, dereference `ty_layout.align` for `#[rustc_dump_layout(align)]`
to render `align: Align($N bytes)` instead of `align: AbiAlign { abi: Align($N bytes) }`
which contains the same amount of information but it more concise and legible.
2026-04-10 12:13:52 +02:00
León Orell Valerian Liehr 357f670fde Rename #[rustc_layout] to #[rustc_dump_layout] 2026-04-10 12:13:48 +02:00
Jonathan Brouwer 0b7a11ff96 Rollup merge of #154615 - aryannrd:moving-issues, r=Kivooeo
Moving issues
2026-04-02 22:13:56 +02:00
Aryan Dubey 147d11099f fixing tidy issues 2026-03-31 15:36:37 -04:00
Aryan Dubey 49ea8ce8f5 Added link and test description for opt-repr-i32-min.rs 2026-03-28 21:03:45 -04:00
Aryan Dubey 09e48be115 Moved and renamed issue-49973.rs to layout/opt-repr-i32-min.rs 2026-03-28 20:58:22 -04:00
John Kåre Alsaker 043bd76768 Make layout_of cycles fatal errors 2026-03-24 18:25:21 +01:00
cyrgani 9b0be7857a allow incomplete_features in most UI tests 2026-03-21 20:10:07 +00:00
cyrgani 72732f2013 move tests/ui/invalid tests to new folders 2026-03-17 10:07:52 +00:00
Jonathan Brouwer b42920d71f Rollup merge of #146989 - zachs18:fix-146984, r=SparrowLii
Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/146989)*

Fixes https://github.com/rust-lang/rust/issues/146984
2026-02-28 19:55:49 +01:00
lcnr b3d9fbc172 ICE to delayed bug 2026-02-13 13:50:43 +00:00
lcnr b4f38c1da4 add regression test 2026-02-13 13:50:43 +00:00
Jacob Pratt 3db13e22b7 Rollup merge of #151814 - lcnr:silent-layout-error, r=jackh726
layout: handle rigid aliases without params

fixes rust-lang/rust#151791

r? types
2026-02-12 00:41:07 -05:00
Jonathan Brouwer c1091da34c Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
Jamie Hill-Daniel 72338fafb2 Port rustc_layout to attribute parser 2026-01-29 22:23:58 +00:00
lcnr d4454e59d3 add regression test 2026-01-29 11:55:26 +01:00
Esteban Küber cafe91749f On unmet trait bound, mention if trait is unstable 2026-01-13 01:16:58 +00:00
Oli Scherer a3359bdd4f Compile-Time Reflection MVP: tuples 2026-01-08 11:41:00 +00:00
Moulins b31ee3af9c layout: Store inverse memory index in FieldsShape::Arbitrary
All usages of `memory_index` start by calling `invert_bijective_mapping`, so
storing the inverted mapping directly saves some work and simplifies the code.
2025-12-18 22:25:34 +01:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Ralf Jung 3796f7de57 compiletest: rename add-core-stubs to add-minicore 2025-11-02 16:20:06 +01:00
Oli Scherer cac6f8760a Do not emit solver errors that contain error types 2025-10-31 08:17:44 +00:00
Camille Gillot 5dfbf67f94 Replace NullOp::SizeOf and NullOp::AlignOf by lang items. 2025-10-23 00:38:28 +00:00
David Wood efaeacfc96 revert: PR144016 - MetaSized does not always hold 2025-10-15 09:35:04 +01:00
Guillaume Gomez a8051a6ca3 Ignore more failing ui tests for GCC backend 2025-10-13 15:30:26 +02:00
Folkert de Vries 5a0ea3bfba power align: ignore repr(C) unions and enums 2025-10-05 14:18:17 +02:00
Folkert de Vries 87e8ec8114 power align: format test file 2025-10-05 14:15:40 +02:00
Zachary S 85872cfaa2 Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C). 2025-09-28 15:22:05 -05:00
tiif 0bd2ee3a0c Fix the testcases to not use UnsizedConstParamTy 2025-09-15 09:01:22 +00:00
Camille Gillot a3c878f813 Separate transmute checking from typeck. 2025-08-22 20:10:27 +00:00
Trevor Gross 289fe36d37 Print thread ID in panic message if thread name is unknown
`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
2025-08-06 23:59:47 +00:00
Camille GILLOT 7c6496145f Check statics' type in type_of. 2025-07-25 23:39:26 +00:00
Camille GILLOT 1987471d05 Consider parent predicates in ImpossiblePredicates pass. 2025-07-20 22:45:07 +00:00
David Wood 8d64937dc2 trait_sel: MetaSized always holds temporarily
As a temporary measure while a proper fix for
`tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs`
is implemented, make `MetaSized` obligations always hold. In effect,
temporarily reverting the `sized_hierarchy` feature. This is a small
change that can be backported.
2025-07-16 12:35:44 +00:00
Jubilee 19a7f0fb7d Rollup merge of #143296 - Kivooeo:tf21, r=tgross35
`tests/ui`: A New Order [21/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? `@tgross35`
2025-07-04 23:26:21 -07:00
Kivooeo 62ada47328 cleaned up some tests 2025-07-05 01:25:48 +05:00
Kivooeo 9ad98f78d4 moved tests 2025-07-05 00:39:50 +05:00
Oli Scherer 9b5d57d0a9 Unconditionally run check_item_type on all items 2025-06-30 08:06:08 +00:00
David Wood cb711504bd tests: update tests with unconstrained parameters
With the addition of new bounds to the unconstrained parameters, there
are more errors which just need blessed.
2025-06-16 23:04:35 +00:00
Ralf Jung 62418f4c56 intrinsics: rename min_align_of to align_of 2025-06-12 17:50:25 +02:00
bors 334ba81275 Auto merge of #142220 - workingjubilee:rollup-idgfpof, r=workingjubilee
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#141803 (Remove rustc's notion of "preferred" alignment AKA `__alignof`)
 - rust-lang/rust#142053 (Add new Tier-3 targets: `loongarch32-unknown-none*`)
 - rust-lang/rust#142089 (Replace all uses of sysroot_candidates with get_or_default_sysroot)
 - rust-lang/rust#142108 (compiler: Add track_caller to AbiMapping::unwrap)
 - rust-lang/rust#142132 (`tests/ui`: A New Order [6/N])
 - rust-lang/rust#142162 (UnsafePinned: update get() docs and signature to allow shared mutation)
 - rust-lang/rust#142171 (`tests/ui`: A New Order [7/N])
 - rust-lang/rust#142179 (store `target.min_global_align` as an `Align`)
 - rust-lang/rust#142183 (Added test for 30904)
 - rust-lang/rust#142194 (Remove all unused feature gates from the compiler)
 - rust-lang/rust#142199 (Do not free disk space in the `mingw-check-tidy` job)
 - rust-lang/rust#142210 (Run `mingw-check-tidy` on auto builds)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-09 02:20:44 +00:00