You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(phase)]
#[phase(plugin)]
extern crate regex_macros;
extern crate regex;
fn main() {
let re = regex!(r#"([AB])"#);
println!("\n1 {}", re);
for cap in re.captures_iter("AABBAB") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\x{5b}])"#);
println!("\n2 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\[])"#);
println!("\n3 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\x{5d}])"#);
println!("\n4 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\]])"#);
println!("\n5 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\x{5b}\x{5d}])"#);
println!("\n6 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\x{5d}\x{5b}])"#);
println!("\n7 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\[\]])"#);
println!("\n8 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"([\]\[])"#);
println!("\n9 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
let re = regex!(r#"\[|\]"#);
println!("\n10 {}", re);
for cap in re.captures_iter("[[]][]") {
println!("0: {}, 1: {}", cap.at(0), cap.at(1));
}
}
I expect case 6, 7, 8, and 9 to behave like 1 and 10. It looks like something about having both a left and right quoted bracket within a character set is causing the regex engine to treat the character set as
a literal "[]" that matches a single time (even though that sequence appears twice in the text).
The same behavior happens with Regex::new instead of regex! macro.
The text was updated successfully, but these errors were encountered:
feat: generate names for tuple-struct in add-missing-match-arms
fixrust-lang#18034.
This PR includes the following enhancement:
- Introduced a `NameGenerator` in `suggest_name`, which implements an automatic renaming algorithm to avoid name conflicts. Here are a few examples:
```rust
let mut generator = NameGenerator::new();
assert_eq!(generator.suggest_name("a"), "a");
assert_eq!(generator.suggest_name("a"), "a1");
assert_eq!(generator.suggest_name("a"), "a2");
assert_eq!(generator.suggest_name("b"), "b");
assert_eq!(generator.suggest_name("b"), "b1");
assert_eq!(generator.suggest_name("b2"), "b2");
assert_eq!(generator.suggest_name("b"), "b3");
assert_eq!(generator.suggest_name("b"), "b4");
assert_eq!(generator.suggest_name("b3"), "b5");
```
- Updated existing testcases in ide-assists for the new `NameGenerator` (only modified generated names).
- Generate names for tuple structs instead of using wildcard patterns in `add-missing-match-arms`.
Here is my test code:
Results:
I expect case 6, 7, 8, and 9 to behave like 1 and 10. It looks like something about having both a left and right quoted bracket within a character set is causing the regex engine to treat the character set as
a literal "[]" that matches a single time (even though that sequence appears twice in the text).
The same behavior happens with Regex::new instead of regex! macro.
The text was updated successfully, but these errors were encountered: