From 7899a4b9312e97bcb684a474ce57e5b5fa0f06dd Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Mon, 25 Jan 2021 10:36:53 -0500 Subject: [PATCH] regex: s/CachedThreadLocal/ThreadLocal CachedThreadLocal has been deprecated. We bump thread_local's minimal version corresponding to that deprecation as well. --- Cargo.lock | 12 +++++++++--- crates/regex/Cargo.toml | 2 +- crates/regex/src/word.rs | 12 ++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c38407a..454e6ae9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -369,6 +369,12 @@ dependencies = [ "libc", ] +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + [[package]] name = "packed_simd_2" version = "0.3.4" @@ -553,11 +559,11 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] diff --git a/crates/regex/Cargo.toml b/crates/regex/Cargo.toml index 9bf03af1..8e27fb71 100644 --- a/crates/regex/Cargo.toml +++ b/crates/regex/Cargo.toml @@ -19,4 +19,4 @@ grep-matcher = { version = "0.1.2", path = "../matcher" } log = "0.4.5" regex = "1.1" regex-syntax = "0.6.5" -thread_local = "1" +thread_local = "1.1.2" diff --git a/crates/regex/src/word.rs b/crates/regex/src/word.rs index 18e2fe6d..8f744516 100644 --- a/crates/regex/src/word.rs +++ b/crates/regex/src/word.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use grep_matcher::{Match, Matcher, NoError}; use regex::bytes::{CaptureLocations, Regex}; -use thread_local::CachedThreadLocal; +use thread_local::ThreadLocal; use config::ConfiguredHIR; use error::Error; @@ -21,19 +21,19 @@ pub struct WordMatcher { /// A map from capture group name to capture group index. names: HashMap, /// A reusable buffer for finding the match location of the inner group. - locs: Arc>>, + locs: Arc>>, } impl Clone for WordMatcher { fn clone(&self) -> WordMatcher { - // We implement Clone manually so that we get a fresh CachedThreadLocal - // such that it can set its own thread owner. This permits each thread + // We implement Clone manually so that we get a fresh ThreadLocal such + // that it can set its own thread owner. This permits each thread // usings `locs` to hit the fast path. WordMatcher { regex: self.regex.clone(), original: self.original.clone(), names: self.names.clone(), - locs: Arc::new(CachedThreadLocal::new()), + locs: Arc::new(ThreadLocal::new()), } } } @@ -53,7 +53,7 @@ impl WordMatcher { pat })?; let regex = word_expr.regex()?; - let locs = Arc::new(CachedThreadLocal::new()); + let locs = Arc::new(ThreadLocal::new()); let mut names = HashMap::new(); for (i, optional_name) in regex.capture_names().enumerate() {