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 with const_evaluatable_checked #82418

Closed
lukaslueg opened this issue Feb 22, 2021 · 1 comment
Closed

ICE with const_evaluatable_checked #82418

lukaslueg opened this issue Feb 22, 2021 · 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)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. 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

@lukaslueg
Copy link
Contributor

lukaslueg commented Feb 22, 2021

The following code will cause an ICE (playground) with const_evaluatable_checked. There are warnings that crashes are about to be expected, I'm reporting nevertheless.

cc #44580, #76560

#![feature(const_generics)]
#![feature(const_evaluatable_checked)]

pub struct Foobar<T, const N: usize> {
    t: T,
}

pub trait Footrait {
    const N: usize;
}

impl<T> Footrait for T {
    const N: usize = 0;
}

pub fn new_foo<T>(t: T) -> Foobar<T, { <T as Footrait>::N }>
where
    T: Footrait,
{
    Foobar { t }
}

fn main() {
    let foo = new_foo(0);
}

rustc --version --verbose:

rustc 1.52.0-nightly (3e826bb11 2021-02-21)

Error output

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `Footrait` fulfills its obligations
thread 'rustc' panicked at 'substs of instance DefId(0:8 ~ playground[3b56]::Footrait::N) not normalized for codegen: [^0]', compiler/rustc_middle/src/ty/instance.rs:284:9
...
@lukaslueg lukaslueg added 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 Feb 22, 2021
@jonas-schievink jonas-schievink added F-generic_const_exprs `#![feature(generic_const_exprs)]` F-const_generics `#![feature(const_generics)]` requires-nightly This issue requires a nightly compiler in some way. labels Feb 22, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Feb 26, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 27, 2021
@JohnTitor JohnTitor added A-const-generics Area: const generics (parameters and arguments) and removed requires-nightly This issue requires a nightly compiler in some way. labels Mar 4, 2021
@lcnr
Copy link
Contributor

lcnr commented Mar 20, 2021

same underlying issue as #83249, closing in favor of that one

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)]` F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. 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

No branches or pull requests

5 participants