Matthias Krüger
a3c2d752bd
add test for ICE: failed to get layout for [type error] #92979
...
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25 20:35:51 +01:00
Matthias Krüger
5f95fc1dff
add test for Compiler panic using fn_traits #81974
...
Fixes https://github.com/rust-lang/rust/issues/81974
2024-03-25 20:15:28 +01:00
bors
3cbb93223f
Auto merge of #121668 - erikdesjardins:commonprim, r=scottmcm,oli-obk
...
Represent `Result<usize, Box<T>>` as ScalarPair(i64, ptr)
This allows types like `Result<usize, std::io::Error>` (and integers of differing sign, e.g. `Result<u64, i64>`) to be passed in a pair of registers instead of through memory, like `Result<u64, u64>` or `Result<Box<T>, Box<U>>` are today.
Fixes #97540 .
r? `@ghost`
2024-03-13 15:25:35 +00:00
Gurinder Singh
ace436743f
Check that return type is WF in typeck
...
Without it non-WF types could pass typeck and then
later fail in MIR/const eval
2024-03-06 16:51:17 +05:30
Erik Desjardins
8e40b17b6b
fix test failure due to differing u64 alignment on different targets
2024-02-28 18:48:14 -05:00
Erik Desjardins
4dabbcb23b
allow using scalarpair with a common prim of ptr/ptr-sized-int
2024-02-27 00:09:12 -05:00
Markus Reiter
b2fbb8a053
Use generic NonZero
in tests.
2024-02-25 12:03:48 +01:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from //
to //@
directives
2024-02-16 20:02:50 +00:00
Oli Scherer
5f6390f947
Continue compilation after check_mod_type_wf errors
2024-02-14 11:00:30 +00:00
Markus Reiter
021739c840
Update tests.
2024-01-27 16:38:57 +01:00
George Bateman
803b810eac
Remove feature(offset_of) from tests
2024-01-19 20:38:51 +00:00
Jake Goulding
92cc57bafc
Remove no-longer-needed allow(dead_code)
from the tests
...
`repr(transparent)` now silences the lint.
2024-01-18 13:16:09 -05:00
Oli Scherer
af7f8f9811
Silence follow up errors if astconv already errored
2024-01-11 09:03:26 +00:00
bors
5113ed28ea
Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkin
...
Merge `unused_tuple_struct_fields` into `dead_code`
This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group.
[Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn )
2024-01-05 04:51:55 +00:00
Jake Goulding
53eca9fa87
Adjust compiler tests for unused_tuple_struct_fields -> dead_code
2024-01-02 15:34:37 -05:00
Oli Scherer
cd4c352fb4
Reorder check_item_type
diagnostics so they occur next to the corresponding check_well_formed
diagnostics
2024-01-02 14:17:56 +00:00
Nilstrieb
41e8d152dc
Show number in error message even for one error
...
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Ralf Jung
2ef5897a89
fix failure to detect a too-big-type after adding padding
2023-10-27 18:07:53 +02:00
Oli Scherer
beaf46f7e5
Work around the fact that check_mod_type_wf
may spuriously return ErrorGuaranteed
, even if that error is only emitted by check_modwitem_types
2023-10-25 12:04:54 +00:00
Oli Scherer
fd9ef69adf
Avoid a track_errors
by bubbling up most errors from check_well_formed
2023-10-20 08:46:27 +00:00
Matthias Krüger
279e2576a0
Rollup merge of #115708 - RalfJung:homogeneous, r=davidtwco
...
fix homogeneous_aggregate not ignoring some ZST
This is an ABI-breaking change, because it fixes bugs in our ABI code. I'm not sure what that means for this PR, we don't really have a process for such changes, do we? I can only hope nobody relied on the old buggy behavior.
Fixes https://github.com/rust-lang/rust/issues/115664
2023-09-11 21:16:22 +02:00
Nicholas Nethercote
64ea8eb1a9
Disentangle Debug
and Display
for Ty
.
...
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This
is surprising and annoying. In particular, it means `Debug` doesn't show
as much information as `Debug` for `TyKind` does. And `Debug` is used in
some user-facing error messages, which seems bad.
This commit changes the `Debug` impl for `Ty` to call the `Debug` impl
for `TyKind`. It also does a number of follow-up changes to preserve
existing output, many of which involve inserting
`with_no_trimmed_paths!` calls. It also adds `Display` impls for
`UserType` and `Canonical`.
Some tests have changes to expected output:
- Those that use the `rustc_abi(debug)` attribute.
- Those that use the `EMIT_MIR` annotation.
In each case the output is slightly uglier than before. This isn't
ideal, but it's pretty weird (particularly for the attribute) that the
output is using `Debug` in the first place. They're fairly obscure
attributes (I hadn't heard of them) so I'm not worried by this.
For `async-is-unwindsafe.stderr`, there is one line that now lacks a
full path. This is a consistency improvement, because all the other
mentions of `Context` in this test lack a path.
2023-09-11 12:51:07 +10:00
Ralf Jung
254e13d9f9
fix homogeneous_aggregate not ignoring some 1-ZST
2023-09-10 07:38:03 +02:00
Ralf Jung
3bd8bcb8bb
better spans for WF errors
2023-09-09 18:00:13 +02:00
Ralf Jung
c2a7e684cd
use hir_crate_items(()).definitions() instead of hir().items()
2023-09-09 17:39:53 +02:00
Ralf Jung
a5b0311367
rustc_layout, rustc_abi: make sure the types are well-formed
2023-09-09 17:32:12 +02:00
Ralf Jung
e66913f8fe
rustc_layout/abi: error when attribute is applied to the wrong thing
2023-09-06 11:11:06 +02:00
Matthias Krüger
56d7d93a4b
Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk
...
Don't ICE on layout computation failure
Fixes #111176 regression.
r? `@oli-obk`
2023-08-29 20:49:02 +02:00
Ralf Jung
bf91321e0f
there seems to be no reason to treat ZST specially in these cases
2023-08-29 08:58:58 +02:00
Ralf Jung
0da9409e08
rustc_abi: audit uses of is_zst; fix a case of giving an enum insufficient alignment
2023-08-29 08:58:58 +02:00
Katherine Philip
56b767322b
Don't ICE on layout computation failure
2023-08-28 12:40:39 -07:00
Ralf Jung
abe2148aee
add rustc_abi debugging attribute
2023-08-27 11:55:49 +02:00
Mara Bos
0e729404da
Change default panic handler message format.
2023-07-29 11:42:50 +02:00
Michael Goulet
37076c9b4e
Don't attempt to compute layout of type referencing error
2023-07-27 18:24:08 +00:00
Matthias Krüger
b7183bd167
Rollup merge of #113957 - Urgau:regression-test-issue-113941, r=dtolnay
...
Add regression test for issue #113941 - naive layout isn't refined
This PR adds a regression test for issue #113941 - `the naive layout isn't refined by the actual layout` based on the minimized repro https://github.com/rust-lang/rust/issues/113941#issuecomment-1646446769 .
2023-07-22 19:57:37 +02:00
Urgau
ffa4b6f422
Add regression test for issue #113941 - naive layout isn't refined
2023-07-22 13:02:59 +02:00
David Tolnay
5bbf0a8306
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
...
This reverts commit 557359f925
, reversing
changes made to 1e6c09a803
.
2023-07-21 22:35:57 -07:00
Moulins
7f109086ee
Track (partial) niche information in NaiveLayout
...
Still more complexity, but this allows computing exact `NaiveLayout`s
for null-optimized enums, and thus allows calls like
`transmute::<Option<&T>, &U>()` to work in generic contexts.
2023-07-21 14:23:23 +02:00
Moulins
30ae640a3c
properly handle arrays and wide pointers in naive_layout_of
2023-07-21 03:31:45 +02:00
Moulins
cb8b1d1bc9
add naive_layout_of
query
2023-07-21 03:31:45 +02:00
Erik Desjardins
2daacf5af9
i686-windows: make requested alignment > 4 special case apply transitively
2023-07-14 17:48:13 -04:00
Erik Desjardins
d1e764cb3b
aarch64-linux: properly handle 128bit aligned aggregates
2023-07-10 19:19:40 -04:00
Erik Desjardins
7e933b4e26
repr(align) <= 4 should still be byval
2023-07-10 19:19:40 -04:00
Erik Desjardins
4c1dbc3aec
bless layout tests for has_repr_align in debug output
2023-07-10 19:19:39 -04:00
Michael Goulet
32f83e18ab
Better error message
2023-06-19 20:00:41 +00:00
Michael Goulet
dd620aa73a
Don't ICE on unnormalized struct tail in layout computation
2023-06-19 20:00:41 +00:00
Wesley Wiser
b982f3a988
Add test case for unsizing with niche
2023-06-13 15:32:42 -04:00
Lukas Markeffsky
381b778d27
Make struct layout not depend on unsizeable tail
2023-05-29 14:54:48 +02:00
Luqman Aden
f2d81defa1
Add additional test case for repr(packed) allowing union abi opt to kick in.
2023-05-05 16:05:04 -07:00
Luqman Aden
d5ab3a06d2
Add test cases for #104802 .
2023-05-05 16:05:03 -07:00