File tree 1 file changed +7
-5
lines changed
src/tools/compiletest/src
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> {
4315
4315
let mut seen_allocs = indexmap:: IndexSet :: new ( ) ;
4316
4316
4317
4317
// The alloc-id appears in pretty-printed allocations.
4318
- let re =
4318
+ static ALLOC_ID_PP_RE : Lazy < Regex > = Lazy :: new ( || {
4319
4319
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
4322
4323
. replace_all ( & normalized, |caps : & Captures < ' _ > | {
4323
4324
// Renumber the captured index.
4324
4325
let index = caps. get ( 2 ) . unwrap ( ) . as_str ( ) . to_string ( ) ;
@@ -4331,8 +4332,9 @@ impl<'test> TestCx<'test> {
4331
4332
. into_owned ( ) ;
4332
4333
4333
4334
// 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
4336
4338
. replace_all ( & normalized, |caps : & Captures < ' _ > | {
4337
4339
let index = caps. get ( 1 ) . unwrap ( ) . as_str ( ) . to_string ( ) ;
4338
4340
let ( index, _) = seen_allocs. insert_full ( index) ;
You can’t perform that action at this time.
0 commit comments