Commit Graph

9 Commits

Author SHA1 Message Date
Aleksey Kladov
5326361fc0 Remove trivia tokens 2020-09-01 11:39:11 +02:00
Aleksey Kladov
8f24c2ec9d Don't emit trivia tokens 2020-09-01 11:39:11 +02:00
Aleksey Kladov
30ce15f1fa Make StringReader private
After the recent refactorings, we can actually completely hide this
type. It should help with #63689.
2020-08-31 18:01:01 +02:00
Aleksey Kladov
d8eb30127b
Rollup merge of #76115 - calebcartwright:parser-fn-visibility, r=matklad
Restore public visibility on some parsing functions for rustfmt

In #74826 the visibility of several parsing functions was reduced. However, rustfmt is an external consumer of some of these functions as well and needs the visibility to be public, similar to other elements in rustc_parse such as `parse_ident`

db534b3ac2/src/librustc_parse/parser/mod.rs (L433-L436)
2020-08-31 15:22:43 +02:00
Aleksey Kladov
7d2460e5c4
Rollup merge of #76050 - matklad:pos, r=petrochenkov
Remove unused function
2020-08-31 15:22:40 +02:00
Sasha
f6d18db402 Use string literal directly when available in format
Previous implementation used the `Parser::parse_expr` function in order
to extract the format expression. If the first comma following the
format expression was mistakenly replaced with a dot, then the next
format expression was eaten by the function, because it looked as a
syntactically valid expression, which resulted in incorrectly spanned
error messages.

The way the format expression is exctracted is changed: we first look at
the first available token in the first argument supplied to the
`format!` macro call. If it is a string literal, then it is promoted as
a format expression immediatly, otherwise we fall back to the original
`parse_expr`-related method.

This allows us to ensure that the parser won't consume too much tokens
when a typo is made.

A test has been created so that it is ensured that the issue is properly
fixed.
2020-08-30 22:09:58 +02:00
Caleb Cartwright
883b1e7592 parser: restore some fn visibility for rustfmt 2020-08-30 13:04:36 -05:00
Aleksey Kladov
518cac9190 Remove unused function 2020-08-30 19:54:45 +02:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00