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

ICE when using struct constructor with explicit const generic arguments #60818

Closed
jplatte opened this issue May 14, 2019 · 2 comments · Fixed by #60839
Closed

ICE when using struct constructor with explicit const generic arguments #60818

jplatte opened this issue May 14, 2019 · 2 comments · Fixed by #60839
Assignees
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

@jplatte
Copy link
Contributor

jplatte commented May 14, 2019

This very simple example (Playground link):

#![feature(const_generics)]

struct Generic<const V: usize>;

fn main() {
    let _ = Generic::<0>;
}

results in: error: internal compiler error: src/librustc_typeck/collect.rs:1407: unexpected const parent path def Def(Ctor(Struct, Const), DefId(0:13 ~ playground[d52b]::Generic[0]::{{constructor}}[0])). Changing it to use curly braces around 0 does not help.

@DutchGhost
Copy link
Contributor

This does work:

#![feature(const_generics)]

struct Generic<const V: usize>;

fn main() {
    let _ = Generic::<{0}>{};
}

@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. labels May 14, 2019
@varkor varkor self-assigned this May 14, 2019
@davidtwco
Copy link
Member

@varkor I was actually just experimenting locally to see if I could fix this and I think I have, I could put a PR up in a few minutes.

Centril added a commit to Centril/rust that referenced this issue May 30, 2019
…r, r=varkor

Fix ICE with struct ctors and const generics.

Fixes rust-lang#60818.

r? @varkor
Centril added a commit to Centril/rust that referenced this issue May 30, 2019
…r, r=varkor

Fix ICE with struct ctors and const generics.

Fixes rust-lang#60818.

r? @varkor
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.

5 participants