diff options
author | Andrew Gallant <jamslam@gmail.com> | 2021-01-25 10:36:53 -0500 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2021-01-25 10:38:05 -0500 |
commit | 7899a4b9312e97bcb684a474ce57e5b5fa0f06dd (patch) | |
tree | dc390d61457d0beb1360824c07a303ebcd194893 | |
parent | ae55a4e8724296ae11aad434274b4987f6ce4142 (diff) |
regex: s/CachedThreadLocal/ThreadLocal
CachedThreadLocal has been deprecated. We bump thread_local's minimal
version corresponding to that deprecation as well.
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | crates/regex/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/regex/src/word.rs | 12 |
3 files changed, 16 insertions, 10 deletions
@@ -370,6 +370,12 @@ dependencies = [ ] [[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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -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<String, usize>, /// A reusable buffer for finding the match location of the inner group. - locs: Arc<CachedThreadLocal<RefCell<CaptureLocations>>>, + locs: Arc<ThreadLocal<RefCell<CaptureLocations>>>, } 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() { |