Skip to content

Do not ICE on generic type mismatch in anonymous const #80278

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

Closed

Conversation

LeSeulArtichaut
Copy link
Contributor

Fixes #80062.

@rust-highfive
Copy link
Contributor

r? @varkor

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 22, 2020
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@LeSeulArtichaut
Copy link
Contributor Author

👆 This is what I get for being lazy and trying to avoid building the compiler 😅

self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| {
self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id })
});

if let hir::def::DefKind::AnonConst = self.tcx.hir().def_kind(body_owner_def_id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems quite subtle, for instance in being sure that AnonConst is the only special case. Are there no general methods for doing this (and should there be, if this pattern is used elsewhere)?

Copy link
Contributor Author

@LeSeulArtichaut LeSeulArtichaut Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC a DefId can be given to any of the variants of DefKind. Maybe closures/generators can cause problems too?

@varkor

This comment has been minimized.

@bors

This comment has been minimized.

@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 Dec 30, 2020
@varkor
Copy link
Member

varkor commented Dec 30, 2020

@bors r-

Just noticed the original ICE (#80062) is already fixed on nightly. Perhaps this was already fixed by min_const_generics? It might be sufficient simply to add a test case for the ICE.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 30, 2020
@LeSeulArtichaut LeSeulArtichaut deleted the issue-80062 branch December 30, 2020 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14
5 participants