Fix unicode regexen with bytes::Regex

fixes #6005
This commit is contained in:
Andre Bogus 2020-10-08 01:07:00 +02:00
parent 277191890b
commit 11672577de
2 changed files with 4 additions and 1 deletions

View File

@ -143,7 +143,7 @@ fn check_set<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, utf8: bool) {
fn check_regex<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, utf8: bool) {
let mut parser = regex_syntax::ParserBuilder::new()
.unicode(utf8)
.unicode(true)
.allow_invalid_utf8(!utf8)
.build();

View File

@ -71,6 +71,9 @@ fn trivial_regex() {
let non_trivial_ends_with = Regex::new("foo|bar");
let non_trivial_binary = BRegex::new("foo|bar");
let non_trivial_binary_builder = BRegexBuilder::new("foo|bar");
// #6005: unicode classes in bytes::Regex
let a_byte_of_unicode = BRegex::new(r"\p{C}");
}
fn main() {