Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on beta: three dots in a trait leads to an infinite loop(?) #32446

Closed
nodakai opened this Issue Mar 23, 2016 · 7 comments

Comments

Projects
None yet
6 participants
@nodakai
Copy link
Contributor

nodakai commented Mar 23, 2016

trait T { ... }

(Yes, just a single line.)

$ ulimit -t 3
$ multirust run stable rustc ~tmp/lone-incl-range-in-trait.rs
/tmp/nodakai//lone-incl-range-in-trait.rs:1:11: 1:14 error: expected one of `const`, `extern`, `fn`, `type`, or `unsafe`, found `...`
/tmp/nodakai//lone-incl-range-in-trait.rs:1 trait T { ... }
                                                      ^~~
error: aborting due to previous error
$ multirust run stable rustc --version
rustc 1.7.0 (a5d1e7a59 2016-02-29)
$ multirust run beta rustc ~tmp/lone-incl-range-in-trait.rs
zsh: cpu limit exceeded  multirust run beta rustc ~tmp/lone-incl-range-in-trait.rs
$ multirust run beta rustc --version
rustc 1.8.0-beta.1 (facbfdd71 2016-03-02)
$ multirust run nightly rustc ~tmp/lone-incl-range-in-trait.rs
zsh: cpu limit exceeded  multirust run nightly rustc ~tmp/lone-incl-range-in-trait.rs
$ multirust run nightly rustc --version
rustc 1.9.0-nightly (21922e1f4 2016-03-21)

Possibly related to #32245 ?

Like #32445 , it was found during make check-docs. One doctest contained three dots probably just to mean some codes had been omitted.

nodakai added a commit to nodakai/rust that referenced this issue Mar 23, 2016

Remove ungrammatical dots from the error index.
They were probably meant as a shorthand for omitted code.

Part of rust-lang#32446 but there should be a separate fix for the issue.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
@nodakai

This comment has been minimized.

Copy link
Contributor Author

nodakai commented Mar 23, 2016

Rustdoc not only falls into an infinite loop but also consumes infinitely growing amount of memory (only) when the bad trait with dots is surrounded by definitions:

```
const X: i32 = 0;
trait T { ... }
const Y: i32 = 0;
```

This must have caused the Travis failure in #31689

@durka

This comment has been minimized.

Copy link
Contributor

durka commented Mar 23, 2016

#32267 (the fix for #32245) does not fix this.

@durka

This comment has been minimized.

Copy link
Contributor

durka commented Mar 23, 2016

I don't think this is about inclusive ranges. trait T { .. } or even trait T { . } seems to do the trick as well.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 23, 2016

triage: I-nominated

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 24, 2016

cc @nrc

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 24, 2016

triage: P-high

@rust-highfive rust-highfive added P-high and removed I-nominated labels Mar 24, 2016

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 24, 2016

My guess is that we are trying to recover from an invalid token but forgetting to bump or eat the token.

@eddyb eddyb self-assigned this Mar 24, 2016

Manishearth added a commit to Manishearth/rust that referenced this issue Mar 26, 2016

Rollup merge of rust-lang#32447 - nodakai:dots-in-err-idx, r=Manishearth
Remove ungrammatical dots from the error index.

They were probably meant as a shorthand for omitted code.

Part of rust-lang#32446 but there should be a separate fix for the issue.

Manishearth added a commit to Manishearth/rust that referenced this issue Mar 26, 2016

Rollup merge of rust-lang#32447 - nodakai:dots-in-err-idx, r=Manishearth
Remove ungrammatical dots from the error index.

They were probably meant as a shorthand for omitted code.

Part of rust-lang#32446 but there should be a separate fix for the issue.

Manishearth added a commit to Manishearth/rust that referenced this issue Mar 26, 2016

Rollup merge of rust-lang#32447 - nodakai:dots-in-err-idx, r=Manishearth
Remove ungrammatical dots from the error index.

They were probably meant as a shorthand for omitted code.

Part of rust-lang#32446 but there should be a separate fix for the issue.

bors added a commit that referenced this issue Mar 29, 2016

Auto merge of #32479 - eddyb:eof-not-even-twice, r=nikomatsakis
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.

@bors bors closed this in #32479 Mar 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.