File tree 2 files changed +12
-8
lines changed
rustc_data_structures/src/sync
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,16 @@ impl<T> FreezeLock<T> {
45
45
}
46
46
}
47
47
48
+ /// Clones the inner value along with the frozen state.
49
+ #[ inline]
50
+ pub fn clone ( & self ) -> Self
51
+ where
52
+ T : Clone ,
53
+ {
54
+ let lock = self . read ( ) ;
55
+ Self :: with ( lock. clone ( ) , self . is_frozen ( ) )
56
+ }
57
+
48
58
#[ inline]
49
59
pub fn is_frozen ( & self ) -> bool {
50
60
self . frozen . load ( Ordering :: Acquire )
Original file line number Diff line number Diff line change @@ -1367,16 +1367,10 @@ impl Clone for SourceFile {
1367
1367
name : self . name . clone ( ) ,
1368
1368
src : self . src . clone ( ) ,
1369
1369
src_hash : self . src_hash ,
1370
- external_src : {
1371
- let lock = self . external_src . read ( ) ;
1372
- FreezeLock :: with ( lock. clone ( ) , self . external_src . is_frozen ( ) )
1373
- } ,
1370
+ external_src : self . external_src . clone ( ) ,
1374
1371
start_pos : self . start_pos ,
1375
1372
source_len : self . source_len ,
1376
- lines : {
1377
- let lock = self . lines . read ( ) ;
1378
- FreezeLock :: with ( lock. clone ( ) , self . lines . is_frozen ( ) )
1379
- } ,
1373
+ lines : self . lines . clone ( ) ,
1380
1374
multibyte_chars : self . multibyte_chars . clone ( ) ,
1381
1375
non_narrow_chars : self . non_narrow_chars . clone ( ) ,
1382
1376
normalized_pos : self . normalized_pos . clone ( ) ,
You can’t perform that action at this time.
0 commit comments