Skip to content

regex!("...") should generate a const instead of a static #18427

Closed
@aochagavia

Description

@aochagavia

I am not completely sure about this, but it was strange to get a compiler error when trying to do:

const re: Regex = regex!("42");

The error message is (copied from the plapen):

<anon>:8:19: 8:32 error: constants cannot refer to other statics, insert an intermediate constant instead
<anon>:8 const re: Regex = regex!("42");
                           ^~~~~~~~~~~~~
<anon>:1:1: 12:1 note: in expansion of regex!
<anon>:8:19: 8:32 note: expansion site
error: aborting due to previous error

Shouldn't this work?

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