ICE While Testing generic_const_exprs, adt_const_params, & const_fn_trait_bound features #89022
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-adt_const_params
`#![feature(adt_const_params)]`
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.
I was testing the limits of Rust's experimental const generics capabilities, and I came across this bug. The bug seems to occur only when remove_key is used.
I've had trouble minimizing this bug, so for context, I'll explain the program's purpose. The goal is to create a HashMap that has compile-time restrictions on what keys can be inserted. The first part of this program establishes a compile-time-checkable list of keys that can be any value that can be a const generic. In this case I've replaced my "Key" type alias with
&'static str
because that's where the error came up, as well as for readability. The second part of the program makes up the definition of the hashmap itself, which relies on the invariant that its "schema" contains a specific const-evaluable key in order to insert or remove a value. This also requires being able to build out a schema by adding and removing keys, producing a new type in the process because the types are what track the schema. The third part of the program is a small test for adding and removing keys, and it's when these tests are run that the error occurs.This code compiles and runs if we do not run the test involving removing a key from a map that has already been created. Something about resolving the requirements in that test produces an error in the compiler.
Code (playground link)
Meta
rustc --version --verbose
:This ICE also appears on the playground.
Error output
Different ICE upon minimalization (playground link) (the error appears differently on the playground than on my local machine)
While attempting to minimize this example, I came across a different ICE when I removed the
new
function (since it was not used in the test) and made thecontains_key_helper_helper
function public. (For context, this function was just made to handle complaints that certain const expressions were too complex). The definitions for this ICE look like this:The error message looks like this on my computer (but is different on the Playground):
The error on my computer appears to be from the same place as #88975
The text was updated successfully, but these errors were encountered: