File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
rustc_data_structures/src/sync Expand file tree Collapse file tree 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> {
4545 }
4646 }
4747
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+
4858 #[ inline]
4959 pub fn is_frozen ( & self ) -> bool {
5060 self . frozen . load ( Ordering :: Acquire )
Original file line number Diff line number Diff line change @@ -1367,16 +1367,10 @@ impl Clone for SourceFile {
13671367 name : self . name . clone ( ) ,
13681368 src : self . src . clone ( ) ,
13691369 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 ( ) ,
13741371 start_pos : self . start_pos ,
13751372 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 ( ) ,
13801374 multibyte_chars : self . multibyte_chars . clone ( ) ,
13811375 non_narrow_chars : self . non_narrow_chars . clone ( ) ,
13821376 normalized_pos : self . normalized_pos . clone ( ) ,
You can’t perform that action at this time.
0 commit comments