diff options
| author | bors <bors@rust-lang.org> | 2021-04-09 18:47:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-09 18:47:52 +0000 |
| commit | 8513e78dbbbdd7cd5eaf2e8eb0bccb8c15a99a25 (patch) | |
| tree | 025f554f6a78716577dd3845ac9995d86e9db31e | |
| parent | da0b9b6485585a3557e882acbf5054e826625031 (diff) | |
| parent | 8c7b7dd041d46248950d5eca640431eaf2545972 (diff) | |
| download | rust-8513e78dbbbdd7cd5eaf2e8eb0bccb8c15a99a25.tar.gz rust-8513e78dbbbdd7cd5eaf2e8eb0bccb8c15a99a25.zip | |
Auto merge of #84034 - jyn514:regex-in-loop, r=Mark-Simulacrum
Fix perf regression in rustdoc::bare_urls This regressed in #81764. After that PR, rustdoc compiled the regex for every single item in the crate: https://perf.rust-lang.org/compare.html?start=125505306744a0a5bb01d62337260a95d9ff8d57&end=2e495d2e845cf27740e3665f718acfd3aa17253e&stat=instructions%3Au This would have been caught by `clippy::declare_interior_mutable_const` (cc https://github.com/rust-lang/rust/issues/77983).
| -rw-r--r-- | src/librustdoc/passes/bare_urls.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/passes/bare_urls.rs b/src/librustdoc/passes/bare_urls.rs index 3f2e1c68c55..524f266bcad 100644 --- a/src/librustdoc/passes/bare_urls.rs +++ b/src/librustdoc/passes/bare_urls.rs @@ -16,7 +16,7 @@ crate const CHECK_BARE_URLS: Pass = Pass { description: "detects URLs that are not hyperlinks", }; -const URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { +static URL_REGEX: SyncLazy<Regex> = SyncLazy::new(|| { Regex::new(concat!( r"https?://", // url scheme r"([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+", // one or more subdomains |
