-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sanity check field offsets in unsizeable structs #113245
Conversation
This comment has been minimized.
This comment has been minimized.
@rustbot author |
35b0183
to
8ce4a75
Compare
This comment has been minimized.
This comment has been minimized.
c9059e9
to
5e9cb60
Compare
let maybe_unsized = def.is_struct() | ||
&& def.non_enum_variant().fields.raw.last().is_some_and(|last_field| { | ||
let param_env = tcx.param_env(def.did()); | ||
!tcx.type_of(last_field.did).subst_identity().is_sized(tcx, param_env) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will now pass always_sized = true
to layout_of_struct_or_enum
for enums and structs with no fields, but it shouldn't change behavior.
I didn't find a good solution for #113245 (comment). Instead I moved this check back to where the actual layout computation happens, so we can directly replace the tail type instead of messing with the generic parameters (substs) of the struct. This also means that replacing the tail will not change the other struct fields. @rustbot ready |
side note: The value passed for rust/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs Lines 102 to 107 in 131a036
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
4e2ca12
to
a28bb14
Compare
@bors r+ |
📌 Commit a28bb14982a9b469a998279ce0bc60a37c58d959 has been approved by It is now in the queue for this repository. |
Hrmm, that test looks like it might be hitting the network and maybe the number of requests differ because it had to retry one, not sure. @bors r+ rollup=iffy |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit a28bb14982a9b469a998279ce0bc60a37c58d959 has been approved by It is now in the queue for this repository. |
⌛ Testing commit a28bb14982a9b469a998279ce0bc60a37c58d959 with merge e3f0b86d0879138b8f4e8b755205c729f45870fc... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
a28bb14
to
7aa5f39
Compare
rebased onto #113377 |
@bors retry |
I don't see this PR in the queue. I think you need to r+ again, because I pushed new commits. |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (cb80ff1): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 657.311s -> 655.85s (-0.22%) |
As promised in #112062 (comment), this PR extends the layout sanity checks to ensure that structs fields don't move around when unsizing and prevent issues like #112048 in the future. Like most other layout sanity checks, this only runs on compilers with debug assertions enabled.
Here is how it looks when it fails:
r? @the8472