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 into_iter() is called on a const generic array of type T where size is unkown. #64087

Closed
goddessfreya opened this issue Sep 2, 2019 · 1 comment · Fixed by #65652
Labels
A-const-generics Area: const generics (parameters and arguments) A-incr-comp Area: Incremental compilation F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.

Comments

@goddessfreya
Copy link
Contributor

goddessfreya commented Sep 2, 2019

Might be similar to #60744, idk.

This causes an ICE:

#![feature(const_generics)]

fn combinator<T, const S: usize>() -> [T; S] {}

fn main() {
    combinator().into_iter();
}

Backtrace: https://gist.github.com/ZeGentzy/d8a1eaa26fe3551e0c5590885265884a

So does this:

#![feature(const_generics)]

fn combinator<T, const S: usize>(a: T) -> [T; S] {}

fn main() {
    let a = 1u8;
    combinator(a).into_iter();
}

Backtrace: https://gist.github.com/ZeGentzy/5ab1bd3ebdd272ad7d51d71fa5a564ec

This does not:

#![feature(const_generics)]

fn combinator<T, const S: usize>() -> [T; S] {}

fn main() {
    combinator::<_, {3}>().into_iter();
}

Nor does this:

#![feature(const_generics)]

fn combinator<T, const S: usize>() -> [T; S] {}

fn main() {
    combinator::<u8, {3}>().into_iter();
}

But this does produce an ICE:

#![feature(const_generics)]

fn combinator<T, const S: usize>() -> [T; S] {}

fn main() {
    combinator::<u8>().into_iter();
}

Backtrace: https://gist.github.com/ZeGentzy/daca993eabfa2e2fe1f340384f93cdb2

System info:

$ clang --version
clang version 10.0.0 (/startdir/llvm-project64 20b2708c18258efe01bc9b785e413362bcc1961c)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ rustc --version      
rustc 1.39.0-nightly (4295eea90 2019-08-30)

This ICE could not be reproduced on the playground's version:

@goddessfreya goddessfreya changed the title ICE when into_iter() is called on a const generic array of type T where type T is unkown. ICE when into_iter() is called on a const generic array of type T where size is unkown. Sep 2, 2019
@goddessfreya
Copy link
Contributor Author

Related: #62536

Turning off CARGO_INCREMENTAL, then calling cargo clean seams to fix this. 🤔

@Centril Centril added A-const-generics Area: const generics (parameters and arguments) F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. A-incr-comp Area: Incremental compilation labels Sep 2, 2019
@bors bors closed this as completed in 1c94a44 Oct 21, 2019
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) A-incr-comp Area: Incremental compilation F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants