File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -4315,10 +4315,11 @@ impl<'test> TestCx<'test> {
43154315 let mut seen_allocs = indexmap:: IndexSet :: new ( ) ;
43164316
43174317 // The alloc-id appears in pretty-printed allocations.
4318- let re =
4318+ static ALLOC_ID_PP_RE : Lazy < Regex > = Lazy :: new ( || {
43194319 Regex :: new ( r"╾─*a(lloc)?([0-9]+)(\+0x[0-9]+)?(<imm>)?( \([0-9]+ ptr bytes\))?─*╼" )
4320- . unwrap ( ) ;
4321- normalized = re
4320+ . unwrap ( )
4321+ } ) ;
4322+ normalized = ALLOC_ID_PP_RE
43224323 . replace_all ( & normalized, |caps : & Captures < ' _ > | {
43234324 // Renumber the captured index.
43244325 let index = caps. get ( 2 ) . unwrap ( ) . as_str ( ) . to_string ( ) ;
@@ -4331,8 +4332,9 @@ impl<'test> TestCx<'test> {
43314332 . into_owned ( ) ;
43324333
43334334 // The alloc-id appears in a sentence.
4334- let re = Regex :: new ( r"\balloc([0-9]+)\b" ) . unwrap ( ) ;
4335- normalized = re
4335+ static ALLOC_ID_RE : Lazy < Regex > =
4336+ Lazy :: new ( || Regex :: new ( r"\balloc([0-9]+)\b" ) . unwrap ( ) ) ;
4337+ normalized = ALLOC_ID_RE
43364338 . replace_all ( & normalized, |caps : & Captures < ' _ > | {
43374339 let index = caps. get ( 1 ) . unwrap ( ) . as_str ( ) . to_string ( ) ;
43384340 let ( index, _) = seen_allocs. insert_full ( index) ;
You can’t perform that action at this time.
0 commit comments