Mercurial > public > mercurial-scm > hg
comparison rust/hg-core/src/lib.rs @ 44870:9f96beb9bafe
rust: remove support for `re2`
With the performance issues with `regex` figured out and fixed in previous
patches and `regex` newly gaining support for empty alternations, there is no
reason to keep `re2` around anymore. It's only *marginally* faster at creating
the regex which saves at most a couple of ms, but gets beaten by `regex` in
every other aspect.
This removes the Rust/C/C++ bridge (hooray!), the `with-re2` feature, the
conditional code that goes with it, the documentation and relevant part of the
debug/module output.
Differential Revision: https://phab.mercurial-scm.org/D8594
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Fri, 29 May 2020 12:17:59 +0200 |
parents | f8427841c8fc |
children | a46e36b82461 |
comparison
equal
deleted
inserted
replaced
44869:4313a0d7540d | 44870:9f96beb9bafe |
---|---|
21 }; | 21 }; |
22 mod filepatterns; | 22 mod filepatterns; |
23 pub mod matchers; | 23 pub mod matchers; |
24 pub mod revlog; | 24 pub mod revlog; |
25 pub use revlog::*; | 25 pub use revlog::*; |
26 #[cfg(feature = "with-re2")] | |
27 pub mod re2; | |
28 pub mod utils; | 26 pub mod utils; |
29 | 27 |
30 // Remove this to see (potential) non-artificial compile failures. MacOS | 28 // Remove this to see (potential) non-artificial compile failures. MacOS |
31 // *should* compile, but fail to compile tests for example as of 2020-03-06 | 29 // *should* compile, but fail to compile tests for example as of 2020-03-06 |
32 #[cfg(not(target_os = "linux"))] | 30 #[cfg(not(target_os = "linux"))] |
139 TooLong(usize), | 137 TooLong(usize), |
140 IO(std::io::Error), | 138 IO(std::io::Error), |
141 /// Needed a pattern that can be turned into a regex but got one that | 139 /// Needed a pattern that can be turned into a regex but got one that |
142 /// can't. This should only happen through programmer error. | 140 /// can't. This should only happen through programmer error. |
143 NonRegexPattern(IgnorePattern), | 141 NonRegexPattern(IgnorePattern), |
144 /// This is temporary, see `re2/mod.rs`. | |
145 /// This will cause a fallback to Python. | |
146 Re2NotInstalled, | |
147 } | 142 } |
148 | 143 |
149 impl ToString for PatternError { | 144 impl ToString for PatternError { |
150 fn to_string(&self) -> String { | 145 fn to_string(&self) -> String { |
151 match self { | 146 match self { |
163 } | 158 } |
164 PatternError::IO(e) => e.to_string(), | 159 PatternError::IO(e) => e.to_string(), |
165 PatternError::Path(e) => e.to_string(), | 160 PatternError::Path(e) => e.to_string(), |
166 PatternError::NonRegexPattern(pattern) => { | 161 PatternError::NonRegexPattern(pattern) => { |
167 format!("'{:?}' cannot be turned into a regex", pattern) | 162 format!("'{:?}' cannot be turned into a regex", pattern) |
168 } | |
169 PatternError::Re2NotInstalled => { | |
170 "Re2 is not installed, cannot use regex functionality." | |
171 .to_string() | |
172 } | 163 } |
173 } | 164 } |
174 } | 165 } |
175 } | 166 } |
176 | 167 |