Skip to content

Commit 726126f

Browse files
committed
Adapt ModelPattern to unsafe trait Pattern on nightly-2026-11-19
1 parent 764927a commit 726126f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎library/core/src/str/iter.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,9 +1951,10 @@ pub(super) mod verify {
19511951
pub nmb_res: [Option<(usize, usize)>; 2],
19521952
}
19531953

1954-
// See verify-rust-std#753 (rust-lang/rust#165681): `Pattern` is still a safe trait on
1955-
// the pinned toolchain; update to `unsafe impl Pattern for ModelPattern` once synced past rust#165681.
1956-
impl Pattern for ModelPattern {
1954+
// SAFETY: `into_searcher` constructs a `ModelSearcher` storing the exact `haystack`
1955+
// slice passed in (`Searcher::haystack()` returns that same slice), with `front = 0`
1956+
// and `back = haystack.len()`.
1957+
unsafe impl Pattern for ModelPattern {
19571958
type Searcher<'a> = ModelSearcher<'a>;
19581959
fn into_searcher(self, haystack: &str) -> ModelSearcher<'_> {
19591960
ModelSearcher {

0 commit comments

Comments
 (0)