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

Don't ICE on unnormalized struct tail in layout computation #112810

Merged
merged 2 commits into from
Jun 23, 2023

Conversation

compiler-errors
Copy link
Member

  1. We try to compute a SizeSkeleton even if a layout error occurs, but we really only need to do this if we get LayoutError::Unknown, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like LayoutError::NormalizationError or LayoutError::Cycle, then we can't really make any progress, since this represents an actual error.
  2. Avoid using normalize_erasing_regions and struct_tail_erasing_lifetimes since those ICE on normalization errors, and since we may call layout_of in HIR typeck, we don't know for certain that we're on the happy path.

Fixes #112736

@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Jun 19, 2023
@wesleywiser
Copy link
Member

Thanks @compiler-errors!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 23, 2023

📌 Commit 32f83e1 has been approved by wesleywiser

It is now in the queue for this repository.

@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 Jun 23, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…yout, r=wesleywiser

Don't ICE on unnormalized struct tail in layout computation

1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error.
2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path.

Fixes rust-lang#112736
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…yout, r=wesleywiser

Don't ICE on unnormalized struct tail in layout computation

1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error.
2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path.

Fixes rust-lang#112736
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…yout, r=wesleywiser

Don't ICE on unnormalized struct tail in layout computation

1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error.
2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path.

Fixes rust-lang#112736
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 23, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#112616 (Improve tests on targets without unwinding)
 - rust-lang#112643 (Always register sized obligation for argument)
 - rust-lang#112740 (Add link to rustdoc book search chapter in help popover)
 - rust-lang#112810 (Don't ICE on unnormalized struct tail in layout computation)
 - rust-lang#112870 (Migrate `item_bounds` to `ty::Clause`)
 - rust-lang#112925 (Stop hiding const eval limit in external macros)
 - rust-lang#112960 ([tests/rustdoc] Add `@files` command)
 - rust-lang#112962 (Fix rustdoc gui tester)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cea5ae0 into rust-lang:master Jun 23, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 23, 2023
@compiler-errors compiler-errors deleted the dont-ice-on-bad-layout branch August 11, 2023 19:59
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.

ICE failed to normalize
4 participants