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 w/ default generic type parameter and const parameter #67858

Closed
petertodd opened this issue Jan 4, 2020 · 1 comment
Closed

ICE w/ default generic type parameter and const parameter #67858

petertodd opened this issue Jan 4, 2020 · 1 comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@petertodd
Copy link
Contributor

#![feature(const_generics)]
#![allow(incomplete_features)]

pub trait Trait {
    type Associated;
}

pub struct Foo<T, A = <T as Trait>::Associated, const N: u8>(T, A);

impl<T: Trait, const N: u8> Foo<T, N> {
}

fn main() {
}

results in:

error: internal compiler error: potentially unconstrained type parameters weren't evaluated
  --> potentially-unconstrained.rs:10:1
   |
10 | / impl<T: Trait, const N: u8> Foo<T, N> {
11 | | }
   | |_^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:345:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (c5840f9d2 2020-01-03) running on x86_64-unknown-linux-gnu

Heck, this seems like an unfortunate design-level thing; the ICE aside, is there a way to specify a const generic parameter while using the default?

@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` 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. requires-nightly This issue requires a nightly compiler in some way. labels Jan 4, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jan 5, 2020
@JohnTitor
Copy link
Member

JohnTitor commented Feb 28, 2020

It has been fixed by #68434. I think the tests added in that PR cover this case but feel free to re-open and label E-needstest if needed.

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. F-const_generics `#![feature(const_generics)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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