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 · Fixed by #32479
Closed

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

nodakai opened this issue Mar 23, 2016 · 7 comments · Fixed by #32479
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@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
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
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
Copy link
Contributor

durka commented Mar 23, 2016

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

@durka
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 alexcrichton added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Mar 23, 2016
@alexcrichton
Copy link
Member

triage: I-nominated

@alexcrichton alexcrichton added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 23, 2016
@nikomatsakis
Copy link
Contributor

cc @nrc

@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Mar 24, 2016
@nikomatsakis
Copy link
Contributor

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
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
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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants