E4205#
Compiler diagnostic name: regex_map_key_not_supported.
Regex literal is not supported as a map key.
Map literals require ordinary key values. A re"..." literal creates a Regex,
and regex values are not valid map keys.
Erroneous example#
fn build_map() -> Unit {
let _ = { re"a+": 1, "b": 2 }
}
Suggestion#
Use a string key if you want to store the pattern text, or store regex values as map values instead of keys.
fn build_map() -> Unit {
let _ = { "a+": 1, "b": 2 }
}