Skip to content
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

Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs #135520

Merged

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jan 15, 2025

Absolutely clueless mistake of mine. Whoops.

When eagerly collecting mono items, when we encounter an ADT, we try to monomorphize its drop glue. In #135313, I made it so that this acts more like eagerly monomorphizing functions, where we allow (in this case) ADTs with lifetimes, since those can be erased by codegen.

However, I did not account for the call to instantiate_and_check_impossible_predicates, which was still passing an empty set of args. This means that if the ADT in question had any predicates, we'd get an index out of bounds panic.

This PR creates the correct set of args for the ADT.

Fixes #135515. I assume that this manifests in that issue because of -Clink-dead-code or something.

@compiler-errors compiler-errors changed the title Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for structs Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs Jan 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added 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. labels Jan 15, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 15, 2025

w

@bors r+ rollup
r? @BoxyUwU

@bors
Copy link
Contributor

bors commented Jan 15, 2025

📌 Commit c89ee08 has been approved by BoxyUwU

It is now in the queue for this repository.

@rustbot rustbot assigned BoxyUwU and unassigned lcnr Jan 15, 2025
@bors bors 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 Jan 15, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#132397 (Make missing_abi lint warn-by-default.)
 - rust-lang#133807 (ci: Enable opt-dist for dist-aarch64-linux builds)
 - rust-lang#134143 (Convert `struct FromBytesWithNulError` into enum)
 - rust-lang#134338 (Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics)
 - rust-lang#134678 (Update `ReadDir::next` in `std::sys::pal::unix::fs` to use `&raw const (*p).field` instead of `p.byte_offset().cast()`)
 - rust-lang#135424 (Detect unstable lint docs that dont enable their feature)
 - rust-lang#135520 (Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8e91327 into rust-lang:master Jan 15, 2025
6 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2025
Rollup merge of rust-lang#135520 - compiler-errors:mono-impossible-drop-with-lifetimes, r=BoxyUwU

Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs

Absolutely clueless mistake of mine. Whoops.

When eagerly collecting mono items, when we encounter an ADT, we try to monomorphize its drop glue. In rust-lang#135313, I made it so that this acts more like eagerly monomorphizing functions, where we allow (in this case) ADTs with lifetimes, since those can be erased by codegen.

However, I did not account for the call to `instantiate_and_check_impossible_predicates`, which was still passing an empty set of args. This means that if the ADT in question had any predicates, we'd get an index out of bounds panic.

This PR creates the correct set of args for the ADT.

Fixes rust-lang#135515. I assume that this manifests in that issue because of `-Clink-dead-code` or something.
@rustbot rustbot added this to the 1.86.0 milestone Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

socket2 failed to complie: const parameter 'bufs/#1 ('bufs/#1/1) out of range when instantiating args=[]
5 participants