@@ -884,7 +884,7 @@ pub struct OffsetOverflowError;
884884/// A single source in the `SourceMap`.
885885#[derive(Clone)]
886886pub 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
888888 /// originate from files has names between angle brackets by convention
889889 /// (e.g., `<anon>`).
890890 pub name: FileName,
@@ -922,9 +922,9 @@ impl Encodable for SourceFile {
922922 s.emit_struct_field("name", 0, |s| self.name.encode(s))?;
923923 s.emit_struct_field("name_was_remapped", 1, |s| self.name_was_remapped.encode(s))?;
924924 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| {
928928 let lines = &self.lines[..];
929929 // Store the length.
930930 s.emit_u32(lines.len() as u32)?;
@@ -970,13 +970,13 @@ impl Encodable for SourceFile {
970970
971971 Ok(())
972972 })?;
973- s.emit_struct_field("multibyte_chars", 7 , |s| {
973+ s.emit_struct_field("multibyte_chars", 6 , |s| {
974974 self.multibyte_chars.encode(s)
975975 })?;
976- s.emit_struct_field("non_narrow_chars", 8 , |s| {
976+ s.emit_struct_field("non_narrow_chars", 7 , |s| {
977977 self.non_narrow_chars.encode(s)
978978 })?;
979- s.emit_struct_field("name_hash", 9 , |s| {
979+ s.emit_struct_field("name_hash", 8 , |s| {
980980 self.name_hash.encode(s)
981981 })
982982 })
@@ -985,17 +985,16 @@ impl Encodable for SourceFile {
985985
986986impl Decodable for SourceFile {
987987 fn decode<D: Decoder>(d: &mut D) -> Result<SourceFile, D::Error> {
988-
989988 d.read_struct("SourceFile", 8, |d| {
990989 let name: FileName = d.read_struct_field("name", 0, |d| Decodable::decode(d))?;
991990 let name_was_remapped: bool =
992991 d.read_struct_field("name_was_remapped", 1, |d| Decodable::decode(d))?;
993992 let src_hash: u128 =
994993 d.read_struct_field("src_hash", 2, |d| Decodable::decode(d))?;
995994 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| {
999998 let num_lines: u32 = Decodable::decode(d)?;
1000999 let mut lines = Vec::with_capacity(num_lines as usize);
10011000
@@ -1024,18 +1023,18 @@ impl Decodable for SourceFile {
10241023 Ok(lines)
10251024 })?;
10261025 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))?;
10281027 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))?;
10301029 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))?;
10321031 Ok(SourceFile {
10331032 name,
10341033 name_was_remapped,
10351034 unmapped_path: None,
10361035 // `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.
10391038 crate_of_origin: std::u32::MAX - 1,
10401039 start_pos,
10411040 end_pos,
0 commit comments