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

Check existing uses of unwrap_usize for ty::Array #61381

Closed
varkor opened this issue May 30, 2019 · 4 comments
Closed

Check existing uses of unwrap_usize for ty::Array #61381

varkor opened this issue May 30, 2019 · 4 comments
Labels
A-const-generics Area: const generics (parameters and arguments) C-enhancement Category: An issue proposing an enhancement or a PR with one. F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@varkor
Copy link
Member

varkor commented May 30, 2019

Generally, we should be using assert_usize, which will fail gracefully if we have a generic parameter as an array length instead, and handling that case specially. Using unwrap_usize has caused issues in the past: #61380.

ICEs resulting from this issue have the form:

error: internal compiler error: src/librustc/ty/sty.rs:2311: expected constant usize, got Const {
    ty: usize,
    val: Param(
        N/#0,
    ),
}
@varkor varkor added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-generics Area: const generics (parameters and arguments) labels May 30, 2019
@Centril Centril added F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. labels Aug 6, 2019
@yodaldevoid
Copy link
Contributor

unwrap_usize was renamed to eval_usize in commit 9b87d22.

@lcnr lcnr added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 16, 2020
@lcnr
Copy link
Contributor

lcnr commented Jul 16, 2020

What's our current status here?

@varkor
Copy link
Member Author

varkor commented Jul 16, 2020

I don't think anyone did a formal triage, but I skimmed through at some point, and there weren't any more worrying uses. It might be safe to close this, and reopen if we hit the same ICE again.

@lcnr
Copy link
Contributor

lcnr commented Jul 16, 2020

I also looked over this in the past and didn't see anything obviously incorrect. So let's go ahead with closing this
and and look into this a bit more if it causes another ICE.

@lcnr lcnr closed this as completed Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-enhancement Category: An issue proposing an enhancement or a PR with one. F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants