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

Nightly compiler fails with ICE if const parameter is used to define type of function input #60632

Closed
newpavlov opened this issue May 8, 2019 · 5 comments · Fixed by #60742
Closed
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@newpavlov
Copy link
Contributor

Code:

fn foo<const N: usize>(val: &[u8; N]) { }

Error:

error: internal compiler error: array length could not be evaluated

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:356:17
@newpavlov
Copy link
Contributor Author

Possibly duplicate of #60619?

@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels May 8, 2019
@varkor varkor removed the I-nominated label May 8, 2019
@varkor
Copy link
Member

varkor commented May 11, 2019

This is one of the FIXMEs:

// FIXME(const_generics): this doesn't work right now,
// because it tries to relate an `Infer` to a `Param`.

That said, it's useful to have a dedicated issue for this. It essentially means arrays with const generics are broken at the moment.

@varkor
Copy link
Member

varkor commented May 11, 2019

#60742 fixes this particular issue, though there are still remaining issues with arrays and const generics.

@harrysarson
Copy link
Contributor

This is #60632?

@varkor
Copy link
Member

varkor commented May 11, 2019

This is #60632?

Fixed the link. I'm not doing very well at pasting links today 😄

Centril added a commit to Centril/rust that referenced this issue May 28, 2019
…eddyb

Allow const parameters in array sizes to be unified

Fixes rust-lang#60632.
Fixes rust-lang#60744.
Fixes rust-lang#60923.
(The last commit should probably be viewed in isolation, as it just renames things from `type` to `kind`.)

r? @eddyb
Centril added a commit to Centril/rust that referenced this issue May 28, 2019
…eddyb

Allow const parameters in array sizes to be unified

Fixes rust-lang#60632.
Fixes rust-lang#60744.
Fixes rust-lang#60923.
(The last commit should probably be viewed in isolation, as it just renames things from `type` to `kind`.)

r? @eddyb
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-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants