Skip to content

Commit b204732

Browse files
author
bors-servo
authored
Auto merge of #157 - upsuper:source-location, r=SimonSapin
Use u32 for SourceLocation I suppose nothing is going to be happy if a CSS file can contain over 4G lines or columns... All Servo rules have `SourceLocation` stored, so reducing its size is probably worth. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/157) <!-- Reviewable:end -->
2 parents 60f4951 + 07636d9 commit b204732

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tokenizer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'a> Tokenizer<'a> {
309309
location.column = 1;
310310
}
311311
debug_assert!(position <= target);
312-
location.column += target - position;
312+
location.column += (target - position) as u32;
313313
self.last_known_source_location.set((SourcePosition(target), location));
314314
location
315315
}
@@ -383,10 +383,10 @@ pub struct SourcePosition(usize);
383383
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
384384
pub struct SourceLocation {
385385
/// The line number, starting at 1 for the first line.
386-
pub line: usize,
386+
pub line: u32,
387387

388388
/// The column number within a line, starting at 1 for first the character of the line.
389-
pub column: usize,
389+
pub column: u32,
390390
}
391391

392392

0 commit comments

Comments
 (0)