@@ -884,7 +884,7 @@ pub struct OffsetOverflowError;
884
884
/// A single source in the `SourceMap`.
885
885
#[ derive( Clone ) ]
886
886
pub struct SourceFile {
887
- /// The name of the file that the source came from, source that doesn't
887
+ /// The name of the file that the source came from. Source that doesn't
888
888
/// originate from files has names between angle brackets by convention
889
889
/// (e.g., `<anon>`).
890
890
pub name : FileName ,
@@ -922,9 +922,9 @@ impl Encodable for SourceFile {
922
922
s. emit_struct_field ( "name" , 0 , |s| self . name . encode ( s) ) ?;
923
923
s. emit_struct_field ( "name_was_remapped" , 1 , |s| self . name_was_remapped . encode ( s) ) ?;
924
924
s. emit_struct_field ( "src_hash" , 2 , |s| self . src_hash . encode ( s) ) ?;
925
- s. emit_struct_field ( "start_pos" , 4 , |s| self . start_pos . encode ( s) ) ?;
926
- s. emit_struct_field ( "end_pos" , 5 , |s| self . end_pos . encode ( s) ) ?;
927
- s. emit_struct_field ( "lines" , 6 , |s| {
925
+ s. emit_struct_field ( "start_pos" , 3 , |s| self . start_pos . encode ( s) ) ?;
926
+ s. emit_struct_field ( "end_pos" , 4 , |s| self . end_pos . encode ( s) ) ?;
927
+ s. emit_struct_field ( "lines" , 5 , |s| {
928
928
let lines = & self . lines [ ..] ;
929
929
// Store the length.
930
930
s. emit_u32 ( lines. len ( ) as u32 ) ?;
@@ -970,13 +970,13 @@ impl Encodable for SourceFile {
970
970
971
971
Ok ( ( ) )
972
972
} ) ?;
973
- s. emit_struct_field ( "multibyte_chars" , 7 , |s| {
973
+ s. emit_struct_field ( "multibyte_chars" , 6 , |s| {
974
974
self . multibyte_chars . encode ( s)
975
975
} ) ?;
976
- s. emit_struct_field ( "non_narrow_chars" , 8 , |s| {
976
+ s. emit_struct_field ( "non_narrow_chars" , 7 , |s| {
977
977
self . non_narrow_chars . encode ( s)
978
978
} ) ?;
979
- s. emit_struct_field ( "name_hash" , 9 , |s| {
979
+ s. emit_struct_field ( "name_hash" , 8 , |s| {
980
980
self . name_hash . encode ( s)
981
981
} )
982
982
} )
@@ -985,17 +985,16 @@ impl Encodable for SourceFile {
985
985
986
986
impl Decodable for SourceFile {
987
987
fn decode < D : Decoder > ( d : & mut D ) -> Result < SourceFile , D :: Error > {
988
-
989
988
d. read_struct ( "SourceFile" , 8 , |d| {
990
989
let name: FileName = d. read_struct_field ( "name" , 0 , |d| Decodable :: decode ( d) ) ?;
991
990
let name_was_remapped: bool =
992
991
d. read_struct_field ( "name_was_remapped" , 1 , |d| Decodable :: decode ( d) ) ?;
993
992
let src_hash: u128 =
994
993
d. read_struct_field ( "src_hash" , 2 , |d| Decodable :: decode ( d) ) ?;
995
994
let start_pos: BytePos =
996
- d. read_struct_field ( "start_pos" , 4 , |d| Decodable :: decode ( d) ) ?;
997
- let end_pos: BytePos = d. read_struct_field ( "end_pos" , 5 , |d| Decodable :: decode ( d) ) ?;
998
- let lines: Vec < BytePos > = d. read_struct_field ( "lines" , 6 , |d| {
995
+ d. read_struct_field ( "start_pos" , 3 , |d| Decodable :: decode ( d) ) ?;
996
+ let end_pos: BytePos = d. read_struct_field ( "end_pos" , 4 , |d| Decodable :: decode ( d) ) ?;
997
+ let lines: Vec < BytePos > = d. read_struct_field ( "lines" , 5 , |d| {
999
998
let num_lines: u32 = Decodable :: decode ( d) ?;
1000
999
let mut lines = Vec :: with_capacity ( num_lines as usize ) ;
1001
1000
@@ -1024,18 +1023,18 @@ impl Decodable for SourceFile {
1024
1023
Ok ( lines)
1025
1024
} ) ?;
1026
1025
let multibyte_chars: Vec < MultiByteChar > =
1027
- d. read_struct_field ( "multibyte_chars" , 7 , |d| Decodable :: decode ( d) ) ?;
1026
+ d. read_struct_field ( "multibyte_chars" , 6 , |d| Decodable :: decode ( d) ) ?;
1028
1027
let non_narrow_chars: Vec < NonNarrowChar > =
1029
- d. read_struct_field ( "non_narrow_chars" , 8 , |d| Decodable :: decode ( d) ) ?;
1028
+ d. read_struct_field ( "non_narrow_chars" , 7 , |d| Decodable :: decode ( d) ) ?;
1030
1029
let name_hash: u128 =
1031
- d. read_struct_field ( "name_hash" , 9 , |d| Decodable :: decode ( d) ) ?;
1030
+ d. read_struct_field ( "name_hash" , 8 , |d| Decodable :: decode ( d) ) ?;
1032
1031
Ok ( SourceFile {
1033
1032
name,
1034
1033
name_was_remapped,
1035
1034
unmapped_path : None ,
1036
1035
// `crate_of_origin` has to be set by the importer.
1037
- // This value matches up with rustc::hir::def_id::INVALID_CRATE.
1038
- // That constant is not available here unfortunately :(
1036
+ // This value matches up with ` rustc::hir::def_id::INVALID_CRATE` .
1037
+ // That constant is not available here, unfortunately.
1039
1038
crate_of_origin : std:: u32:: MAX - 1 ,
1040
1039
start_pos,
1041
1040
end_pos,
0 commit comments