Skip to content

Make regex! generate a constant Regex #19264

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed

Make regex! generate a constant Regex #19264

wants to merge 1 commit into from

Conversation

aochagavia
Copy link
Contributor

Fixes #18427

@alexcrichton
Copy link
Member

I r-'d this because there are a large number of test failures (found in the recent rollup) along the lines of:

/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25:17: 25:31 error: borrowed value does not live long enough
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25     let fubar = regex!("abc"); //~ ERROR unused variable: `fubar`
                                                                                                         ^~~~~~~~~~~~~~
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:13:1: 26:1 note: in expansion of regex!
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25:17: 25:31 note: expansion site
note: reference must be valid for the static lifetime...
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25:5: 25:30 note: ...but borrowed value is only valid for the statement at 25:4
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25     let fubar = regex!("abc"); //~ ERROR unused variable: `fubar`
                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25:5: 25:30 help: consider using a `let` binding to increase its lifetime
/home/alex/code/rust2/src/test/compile-fail-fulldeps/syntax-extension-regex-unused.rs:25     let fubar = regex!("abc"); //~ ERROR unused variable: `fubar`
                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with tests fixed!

@aochagavia aochagavia deleted the regex branch February 13, 2015 13:43
lnicola added a commit to lnicola/rust that referenced this pull request Mar 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regex!("...") should generate a const instead of a static
2 participants