diff options
Diffstat (limited to 'src/libsyntax/parse/lexer.rs')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 573c36e619b..1574a037a46 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -157,11 +157,13 @@ fn byte_offset(rdr: string_reader) -> BytePos { (rdr.pos - rdr.filemap.start_pos) } -fn get_str_from(rdr: string_reader, start: BytePos) -> ~str unsafe { - // I'm pretty skeptical about this subtraction. What if there's a - // multi-byte character before the mark? - return str::slice(*rdr.src, start.to_uint() - 1u, - byte_offset(rdr).to_uint() - 1u); +fn get_str_from(rdr: string_reader, start: BytePos) -> ~str { + unsafe { + // I'm pretty skeptical about this subtraction. What if there's a + // multi-byte character before the mark? + return str::slice(*rdr.src, start.to_uint() - 1u, + byte_offset(rdr).to_uint() - 1u); + } } fn bump(rdr: string_reader) { |
