@@ -1723,8 +1723,8 @@ pub struct SourceFile {
17231723 pub external_src : FreezeLock < ExternalSource > ,
17241724 /// The start position of this source in the `SourceMap`.
17251725 pub start_pos : BytePos ,
1726- /// The byte length of this source.
1727- pub source_len : RelativeBytePos ,
1726+ /// The byte length of this source after normalization .
1727+ pub normalized_source_len : RelativeBytePos ,
17281728 /// Locations of lines beginnings in the source code.
17291729 pub lines : FreezeLock < SourceFileLines > ,
17301730 /// Locations of multi-byte characters in the source code.
@@ -1748,7 +1748,7 @@ impl Clone for SourceFile {
17481748 checksum_hash : self . checksum_hash ,
17491749 external_src : self . external_src . clone ( ) ,
17501750 start_pos : self . start_pos ,
1751- source_len : self . source_len ,
1751+ normalized_source_len : self . normalized_source_len ,
17521752 lines : self . lines . clone ( ) ,
17531753 multibyte_chars : self . multibyte_chars . clone ( ) ,
17541754 normalized_pos : self . normalized_pos . clone ( ) ,
@@ -1764,7 +1764,7 @@ impl<S: SpanEncoder> Encodable<S> for SourceFile {
17641764 self . src_hash . encode ( s) ;
17651765 self . checksum_hash . encode ( s) ;
17661766 // Do not encode `start_pos` as it's global state for this session.
1767- self . source_len . encode ( s) ;
1767+ self . normalized_source_len . encode ( s) ;
17681768
17691769 // We are always in `Lines` form by the time we reach here.
17701770 assert ! ( self . lines. read( ) . is_lines( ) ) ;
@@ -1837,7 +1837,7 @@ impl<D: SpanDecoder> Decodable<D> for SourceFile {
18371837 let name: FileName = Decodable :: decode ( d) ;
18381838 let src_hash: SourceFileHash = Decodable :: decode ( d) ;
18391839 let checksum_hash: Option < SourceFileHash > = Decodable :: decode ( d) ;
1840- let source_len : RelativeBytePos = Decodable :: decode ( d) ;
1840+ let normalized_source_len : RelativeBytePos = Decodable :: decode ( d) ;
18411841 let lines = {
18421842 let num_lines: u32 = Decodable :: decode ( d) ;
18431843 if num_lines > 0 {
@@ -1859,7 +1859,7 @@ impl<D: SpanDecoder> Decodable<D> for SourceFile {
18591859 SourceFile {
18601860 name,
18611861 start_pos : BytePos :: from_u32 ( 0 ) ,
1862- source_len ,
1862+ normalized_source_len ,
18631863 src : None ,
18641864 src_hash,
18651865 checksum_hash,
@@ -1962,9 +1962,8 @@ impl SourceFile {
19621962 let normalized_pos = normalize_src ( & mut src) ;
19631963
19641964 let stable_id = StableSourceFileId :: from_filename_in_current_crate ( & name) ;
1965- let source_len = src. len ( ) ;
1966- let source_len = u32:: try_from ( source_len) . map_err ( |_| OffsetOverflowError ) ?;
1967- if source_len > Self :: MAX_FILE_SIZE {
1965+ let normalized_source_len = u32:: try_from ( src. len ( ) ) . map_err ( |_| OffsetOverflowError ) ?;
1966+ if normalized_source_len > Self :: MAX_FILE_SIZE {
19681967 return Err ( OffsetOverflowError ) ;
19691968 }
19701969
@@ -1977,7 +1976,7 @@ impl SourceFile {
19771976 checksum_hash,
19781977 external_src : FreezeLock :: frozen ( ExternalSource :: Unneeded ) ,
19791978 start_pos : BytePos :: from_u32 ( 0 ) ,
1980- source_len : RelativeBytePos :: from_u32 ( source_len ) ,
1979+ normalized_source_len : RelativeBytePos :: from_u32 ( normalized_source_len ) ,
19811980 lines : FreezeLock :: frozen ( SourceFileLines :: Lines ( lines) ) ,
19821981 multibyte_chars,
19831982 normalized_pos,
@@ -2161,7 +2160,7 @@ impl SourceFile {
21612160
21622161 #[ inline]
21632162 pub fn end_position ( & self ) -> BytePos {
2164- self . absolute_position ( self . source_len )
2163+ self . absolute_position ( self . normalized_source_len )
21652164 }
21662165
21672166 /// Finds the line containing the given position. The return value is the
@@ -2197,7 +2196,7 @@ impl SourceFile {
21972196
21982197 #[ inline]
21992198 pub fn is_empty ( & self ) -> bool {
2200- self . source_len . to_u32 ( ) == 0
2199+ self . normalized_source_len . to_u32 ( ) == 0
22012200 }
22022201
22032202 /// Calculates the original byte position relative to the start of the file
0 commit comments