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

Do not ICE on incorrect const generic #60281

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

Fix #60264.

r? @varkor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2019
@@ -541,6 +541,8 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> {
let opt_ty = self.substs.get(p.idx as usize).map(|k| k.unpack());
let ty = match opt_ty {
Some(UnpackedKind::Type(ty)) => ty,
Some(UnpackedKind::Const(ty::Const { ty, ..})) => ty,
None => source_ty,
Copy link
Contributor Author

@estebank estebank Apr 25, 2019

Choose a reason for hiding this comment

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

This is incredibly suspect, but it is the branch that does fail (I think after adding the one above).

We could replace it with a delay_span_bug instead.

Copy link
Member

Choose a reason for hiding this comment

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

I think this hides the issue without actually fixing it. What we want to do is forbid const parameters to have type parameters as their types. These used to be forbidden, but it hasn't been merged yet.

@varkor
Copy link
Member

varkor commented Apr 25, 2019

I think #60284 is the correct fix for this issue. Thanks for looking into it, though :)

@estebank estebank closed this Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Const generic ICE on stable, beta and nightly
3 participants