Uh oh!
There was an error while loading. Please reload this page.
Prevent bumping the parser past the EOF. - #32479
Conversation
nikomatsakis
commented
Mar 25, 2016
@bors r+ |
bors
commented
Mar 25, 2016
📌 Commit 4b00d0c has been approved by |
nikomatsakis
commented
Mar 25, 2016
@bors r- |
nikomatsakis
commented
Mar 25, 2016
starting a crater run |
There was a problem hiding this comment.
To me it feels like at this point converting this chain to a match would be better here.
There was a problem hiding this comment.
I wish loop-match was a bit more first-class, but I agree.
nikomatsakis
commented
Mar 25, 2016
Crater report: https://gist.github.com/nikomatsakis/416a719bf29fb0fa8028 haven't investigated yet. |
eddyb
commented
Mar 25, 2016
Looks like this breaks syntax extensions ( |
88c6a99 to
27a3e24Comparenikomatsakis
commented
Mar 26, 2016
cc @BurntSushi@kevinmehall -- curious to get your take here. In response to various bugs where the parser was looping infinitely, @eddyb implemented a change that caused the @eddyb, I know you were attempting to modify the PR to only abort if we bumped past EOF multiple times, what was the outcome of those experiments? |
eddyb
commented
Mar 26, 2016
@nikomatsakis Actually, that's the current state, but I realize right now that I can just handle the error case by not bumping, and I just pushed that change. EDIT: Hah, it's not that easy, you can have both errors and a |
8012a49 to
64936b9CompareBurntSushi
commented
Mar 26, 2016
@nikomatsakis I'm totally fine with breakage of plugins if there's a path to fixing them. With that said, what part of the parsing code would break? Regex's interaction with the parser is quite small: https://github.com/rust-lang-nursery/regex/blob/master/regex_macros/src/lib.rs#L567 I guess it's clearer where it breaks in docopt: https://github.com/docopt/docopt.rs/blob/master/docopt_macros/src/macro.rs#L234 |
eddyb
commented
Mar 26, 2016
@BurntSushi The original changes would make |
kevinmehall
commented
Mar 26, 2016
|
eddyb
commented
Mar 26, 2016
@kevinmehall Changing that shouldn't be necessary with my latest attempt - just waiting for travis to confirm everything's good with the tests before starting another crater run. |
eddyb
commented
Mar 26, 2016
@nrc See my changes to { option.map(|some| 42;}It currently parses as the following TTs: { option.map(|some| 42;)}It accidentally gave relatively sane errors because { option.map(|some| 42))}I fixed that so it behaves as it should, given what TTs we end up with, but if we didn't parse it to TTs, we could recover a statement based on { option.map(|some| 42);}Which is arguably what the intention was, and save for a single parse error, the compilation could continue unhindered. |
nikomatsakis
commented
Mar 27, 2016
Sounds good On Sat, Mar 26, 2016 at 05:31:54AM -0700, Eduard-Mihai Burtescu wrote:
|
nrc
commented
Mar 28, 2016
lgtm |
eddyb
commented
Mar 28, 2016
@bors r=nikomatsakis |
bors
commented
Mar 28, 2016
📌 Commit 221d0fb has been approved by |
bors
commented
Mar 29, 2016
Prevent bumping the parser past the EOF. Makes `Parser::bump` after EOF into an ICE, forcing callers to avoid repeated EOF bumps. This ICE is intended to break infinite loops where EOF wasn't stopping the loop. For example, the handling of EOF in `parse_trait_items`' recovery loop fixes#32446. But even without this specific fix, the ICE is triggered, which helps diagnosis and UX. This is a `[breaking-change]` for plugins authors who eagerly eat multiple EOFs. See docopt/docopt.rs#171 for such an example and the necessary fix.
Makes
Parser::bumpafter EOF into an ICE, forcing callers to avoid repeated EOF bumps.This ICE is intended to break infinite loops where EOF wasn't stopping the loop.
For example, the handling of EOF in
parse_trait_items' recovery loop fixes#32446.But even without this specific fix, the ICE is triggered, which helps diagnosis and UX.
This is a
[breaking-change]for plugins authors who eagerly eat multiple EOFs.See docopt/docopt.rs#171 for such an example and the necessary fix.