@@ -1109,7 +1109,7 @@ impl fmt::Debug for SpanData {
11091109/// Identifies an offset of a multi-byte character in a `SourceFile`.
11101110#[ derive( Copy , Clone , Encodable , Decodable , Eq , PartialEq , Debug , HashStable_Generic ) ]
11111111pub struct MultiByteChar {
1112- /// The absolute offset of the character in the `SourceMap `.
1112+ /// The relative offset of the character in the `SourceFile `.
11131113 pub pos : RelativeBytePos ,
11141114 /// The number of bytes, `>= 2`.
11151115 pub bytes : u8 ,
@@ -1136,7 +1136,7 @@ impl NonNarrowChar {
11361136 }
11371137 }
11381138
1139- /// Returns the absolute offset of the character in the `SourceMap `.
1139+ /// Returns the relative offset of the character in the `SourceFile `.
11401140 pub fn pos ( & self ) -> RelativeBytePos {
11411141 match * self {
11421142 NonNarrowChar :: ZeroWidth ( p) | NonNarrowChar :: Wide ( p) | NonNarrowChar :: Tab ( p) => p,
@@ -1180,7 +1180,7 @@ impl Sub<RelativeBytePos> for NonNarrowChar {
11801180/// Identifies an offset of a character that was normalized away from `SourceFile`.
11811181#[ derive( Copy , Clone , Encodable , Decodable , Eq , PartialEq , Debug , HashStable_Generic ) ]
11821182pub struct NormalizedPos {
1183- /// The absolute offset of the character in the `SourceMap `.
1183+ /// The relative offset of the character in the `SourceFile `.
11841184 pub pos : RelativeBytePos ,
11851185 /// The difference between original and normalized string at position.
11861186 pub diff : u32 ,
@@ -1351,7 +1351,7 @@ pub struct SourceFile {
13511351 pub external_src : Lock < ExternalSource > ,
13521352 /// The start position of this source in the `SourceMap`.
13531353 pub start_pos : BytePos ,
1354- /// The end position of this source in the `SourceMap` .
1354+ /// The byte length of this source.
13551355 pub source_len : RelativeBytePos ,
13561356 /// Locations of lines beginnings in the source code.
13571357 pub lines : Lock < SourceFileLines > ,
@@ -1794,7 +1794,7 @@ impl SourceFile {
17941794 BytePos :: from_u32 ( self . start_pos . 0 + offset - diff)
17951795 }
17961796
1797- /// Converts an absolute `BytePos ` to a `CharPos` relative to the `SourceFile`.
1797+ /// Converts an relative `RelativeBytePos ` to a `CharPos` relative to the `SourceFile`.
17981798 fn bytepos_to_file_charpos ( & self , bpos : RelativeBytePos ) -> CharPos {
17991799 // The number of extra bytes due to multibyte chars in the `SourceFile`.
18001800 let mut total_extra_bytes = 0 ;
@@ -1818,7 +1818,7 @@ impl SourceFile {
18181818 }
18191819
18201820 /// Looks up the file's (1-based) line number and (0-based `CharPos`) column offset, for a
1821- /// given `BytePos `.
1821+ /// given `RelativeBytePos `.
18221822 fn lookup_file_pos ( & self , pos : RelativeBytePos ) -> ( usize , CharPos ) {
18231823 let chpos = self . bytepos_to_file_charpos ( pos) ;
18241824 match self . lookup_line ( pos) {
@@ -2028,8 +2028,6 @@ impl_pos! {
20282028 pub struct BytePos ( pub u32 ) ;
20292029
20302030 /// A byte offset relative to file beginning.
2031- ///
2032- /// Keep this small (currently 32-bits), as AST contains a lot of them.
20332031 #[ derive( Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord , Debug ) ]
20342032 pub struct RelativeBytePos ( pub u32 ) ;
20352033
0 commit comments