Skip to content

ICE const generic and iterator  #88022

Closed
@SephVelut

Description

@SephVelut
#![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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`F-generic_const_exprs`#![feature(generic_const_exprs)]`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions