Skip to content

fix(dfa): off-by-one error - #1407

Merged
BurntSushi merged 1 commit into
rust-lang:masterfrom
lerboe:master
Oct 27, 2026
Merged

BurntSushi merged 1 commit into
rust-lang:masterfrom
lerboe:master

Conversation

@lerboe

@lerboe lerboe commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

resolves #1406

@BurntSushi BurntSushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

} else if dfa.is_accel_state(sid) {
let needs = dfa.accelerator(sid);
at = accel::find_fwd(needs, input.haystack(), at)
at = accel::find_fwd(needs, input.haystack(), at + 1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah yeah okay, this looks consistent with the main DFA search routine:

} else if dfa.is_accel_state(sid) {
let needs = dfa.accelerator(sid);
at = accel::find_fwd(needs, input.haystack(), at + 1)
.unwrap_or(input.end());
continue;

@BurntSushi
BurntSushi merged commit ad23cc2 into rust-lang:master Oct 27, 2026
20 checks passed
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.

FP and FN when matching with full DFA

2 participants