rust/src/librustc_parse/parser
Dylan DPC ec24833325
Rollup merge of #68845 - dwrensha:fix-68783, r=estebank
stop using BytePos for computing spans in librustc_parse/parser/mod.rs

Computing spans using logic such as `self.token.span.lo() + BytePos(1)` can cause internal compiler errors like #68730 when non-ascii characters are given as input.

#68735 partially addressed this problem, but only for one case. Moreover, its usage of `next_point()` does not actually align with what `bump_with()` expects. For example, given the token `>>=`, we should pass the span consisting of the final two characters `>=`, but `next_point()` advances the span beyond the end of the `=`.

This pull request instead computes the start of the new span by doing `start_point(self.token.span).hi()`. This matches `self.token.span.lo() + BytePos(1)` in the common case where the characters are ascii, and it gracefully handles multibyte characters.

Fixes #68783.
2020-02-06 15:37:47 +01:00
..
attr.rs syntax::print -> new crate rustc_ast_pretty 2020-02-01 18:59:49 +01:00
diagnostics.rs parser: merge fn grammars wrt. bodies & headers 2020-02-05 01:27:09 +01:00
expr.rs parse_ty_common: use enums instead of bools. 2020-02-05 01:27:08 +01:00
generics.rs Use more appropriate spans on object unsafe traits and provide structured suggestions when possible 2020-02-02 11:53:10 -08:00
item.rs parser: merge fn grammars wrt. bodies & headers 2020-02-05 01:27:09 +01:00
mod.rs stop using BytePos for computing spans in librustc_parse/parser/mod.rs 2020-02-04 23:04:29 -05:00
module.rs restore some rustc_parse visibilities 2020-01-11 13:19:57 -06:00
pat.rs syntax::print -> new crate rustc_ast_pretty 2020-02-01 18:59:49 +01:00
path.rs parse_ty_common: use enums instead of bools. 2020-02-05 01:27:08 +01:00
stmt.rs parser: merge fn grammars wrt. bodies & headers 2020-02-05 01:27:09 +01:00
ty.rs parser: merge fn grammars wrt. bodies & headers 2020-02-05 01:27:09 +01:00