Skip to content

Fix compatibility with RE2 2023-07-01. - #3134

Open
BillyONeal wants to merge 2 commits into
google:masterfrom
BillyONeal:re2-2023-07-01
Open

Fix compatibility with RE2 2023-07-01.#3134
BillyONeal wants to merge 2 commits into
google:masterfrom
BillyONeal:re2-2023-07-01

Conversation

@BillyONeal

@BillyONeal BillyONeal commented Jul 26, 2023

Copy link
Copy Markdown

First discovered in microsoft/vcpkg#32595 , Google RE2 no longer provides their own custom StringPiece type, and instead uses abseil::string_view (which may end up being std::string_view).

google/re2@2d39b70 made StringPiece convertible to std::string and RE2 internally appears to have been changed over to use such conversions.

However, if we made the same change RE2 did internally, that would break compatibility with older versions of RE2. Both the old StringPiece and the new string_view have data() and size() members with which we can construct a new std::string without care for which one we got.

First discovered in microsoft/vcpkg#32595 , Google RE2 no longer provides their own custom StringPiece type, and instead use abseil::string_view (which may end up being std::string_view).

google/re2@2d39b70 made StringPiece convertible to std::string and RE2 internally appears to have been changed over to use such conversions.

However, if we made the same change RE2 did internally, that would break compatibility with older versions of RE2.

There appear to be 2 ways  to fix this:
1. Both the old StringPiece and the new string_view have data() and size() members with which we can construct a new std::string without care for which one we got.
2. We can just copy the string_ member we already have.

This change does 2 but 1 would be reasonable if the authors wish for that resolution.
@BillyONeal
BillyONeal requested a review from a team as a code owner July 26, 2023 06:02
@BillyONeal

Copy link
Copy Markdown
Author

I just realized that there is a mutable pointer passed out so I'm changing this to #1.

@google google deleted a comment from lonnieashley72 Jul 27, 2023
@tvislavski
tvislavski requested a review from katbohm December 5, 2023 12:18
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.

1 participant