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

Fix ICE on type alias in recursion #108168

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

clubby789
Copy link
Contributor

Fixes #108160

@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 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 Feb 17, 2023
@compiler-errors
Copy link
Member

This could use more information about why the recursion happens, either in the PR or the code itself, since the fix is not exactly self-documenting. But I think I understand it.

Do you mind doing that?

@clubby789
Copy link
Contributor Author

I'm not 100% certain of the issue, but as I understand it, params_in_repr isn't encoded for TyAlias

if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
self.encode_info_for_adt(def_id);
}

find_item_ty_spans doesn't check whether it's behind an alias, so panics when it tries to query that.
Just after the top-level call to the function there's a comment mentioning type aliases
// Couldn't find the type. Maybe it's behind a type alias?
// In any case, we'll just suggest boxing the whole field.

which suggests that maybe this check was just forgotten

@compiler-errors
Copy link
Member

I understand the bug now. Yeah, it makes sense to filter out type aliases here -- params_in_repr probably doesn't make sense for that. It's a shame that we can't poke past the type alias and provide better spans in the case we're behind a type alias, but it probably doesn't matter.

@bors r+

@bors
Copy link
Contributor

bors commented Feb 22, 2023

📌 Commit 21bcd2e has been approved by compiler-errors

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 Feb 22, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 22, 2023
…compiler-errors

Fix ICE on type alias in recursion

Fixes rust-lang#108160
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2023
…llaumeGomez

Rollup of 8 pull requests

Successful merges:

 - rust-lang#108110 (Move some `InferCtxt` methods to `EvalCtxt` in new solver)
 - rust-lang#108168 (Fix ICE on type alias in recursion)
 - rust-lang#108230 (Convert a hard-warning about named static lifetimes into lint "unused_lifetimes")
 - rust-lang#108239 (Fix overlapping spans in removing extra arguments)
 - rust-lang#108246 (Add an InstCombine for redundant casts)
 - rust-lang#108264 (no-fail-fast support for tool testsuites)
 - rust-lang#108310 (rustdoc: Fix duplicated attributes for first reexport)
 - rust-lang#108318 (Remove unused FileDesc::get_cloexec)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 89c201e into rust-lang:master Feb 22, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 22, 2023
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.

error: internal compiler error[E0391]: cycle detected when checking if `` is representable
5 participants