Skip to content

Macro codegen hangs forever when trying to mix Unicase and normal strings #299

@DelSkayn

Description

@DelSkayn

When trying to use the proc macro to build a map, whenever you try to mix strings and unicase strings the macro generates a compile error.

However when a unicase string matches a normal string the macro just runs forever without progressing.

I know what I tried to do is probably not supported but because the macro kept running forever it prevented the code from compiling and it took me quite a while to figure out what was happening. So it would be nice if this was fixed.

Below a minimal reproduction.

use phf::phf_map;
use unicase::UniCase;

pub(crate) static KEYWORDS: phf::Map<UniCase<&'static str>, usize> = phf_map! {
    "foo" => 0,
    UniCase::ascii("FOO") => 0
};

fn main(){
    KEYWORDS.get("foo").unwap();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions