Skip to content

Change regex! macro to expand to a constexpr, allowing to put it in a static #14423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Kimundi
Copy link
Member

@Kimundi Kimundi commented May 25, 2014

This patch changes the internals of Regex and regex!() such that

static RE: Regex = regex!(...);

is valid. It doesn't change anything about the actual regex implementation, it just changes the type to something that can be constructed as a const expression.


#[doc(hidden)]
#[allow(visible_private_types)]
pub fn names_iter<'a>(&'a self) -> NamesIter<'a> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to doc(hidden), can you make this #[experimental]?

@alexcrichton
Copy link
Member

This looks pretty awesome to me, nice work! Just a minor nit, otherwise r=me

@Kimundi
Copy link
Member Author

Kimundi commented May 25, 2014

Nit resolved ;)

bors added a commit that referenced this pull request May 25, 2014
This patch changes the internals of `Regex` and `regex!()` such that

```rust
static RE: Regex = regex!(...);
```

is valid. It doesn't change anything about the actual regex implementation, it just changes the type to something that can be constructed as a const expression.
@bors bors closed this May 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants