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 const generic and iterator #88022

Closed
SephVelut opened this issue Aug 14, 2021 · 0 comments · Fixed by #88166
Closed

ICE const generic and iterator #88022

SephVelut opened this issue Aug 14, 2021 · 0 comments · Fixed by #88166
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)]`

Comments

@SephVelut
Copy link

SephVelut commented Aug 14, 2021

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

struct Buffer<T, const S: usize>
where
    [(); {S * 2}]: Default,
{
    data:         [T; {S * 2}],
}

struct BufferIter<'a, T, const S: usize>(&'a Buffer<T, S>)
where
    [(); {S * 2}]: Default;

impl<'a, T, const S: usize> Iterator for BufferIter<'a, T, S> {
    type Item = &'a T;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

Compiler panics
error: internal compiler error: compiler/rustc_middle/src/ich/impls_ty.rs:94:17: StableHasher: unexpected region '_#0r
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1115:9

It's the iterator impl that's causing it.
rustc 1.56.0-nightly (0fa319039 2021-08-12)
compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

@SephVelut SephVelut added the C-bug Category: This is a bug. label Aug 14, 2021
@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` F-const_generics `#![feature(const_generics)]` labels Aug 14, 2021
@bors bors closed this as completed in 91f9806 Aug 22, 2021
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)]`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants