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

Some fixes for error recovery in the compiler #32435

Merged
merged 3 commits into from
Mar 26, 2016

Conversation

nrc
Copy link
Member

@nrc nrc commented Mar 22, 2016

No description provided.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@sanxiyn
Copy link
Member

sanxiyn commented Mar 23, 2016

Travis failed.

failures:
    [parse-fail] parse-fail/issue-10636-2.rs
    [parse-fail] parse-fail/issue-2354-1.rs
    [parse-fail] parse-fail/macro-mismatched-delim-paren-brace.rs

@nrc nrc added beta-nominated Nominated for backporting to the compiler in the beta channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 24, 2016
// Expand to cover the entire delimited token tree
let span = Span { hi: close_span.hi, ..pre_span };

match self.token {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this code specific to macros? if so, I don't see any tests below that would exercise it.

@nikomatsakis
Copy link
Contributor

I realize now this was targeting primarily #31804 -- does it also aim to address #31994 ?

if let Some(&(_, sp)) = self.open_braces.last() {
err.span_note(sp, "unclosed delimiter");
};
err.emit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like once we emit one unclosed delimeter error, we should try to avoid reporting any further ones, since all further delimeters are pretty suspect.

@nikomatsakis
Copy link
Contributor

@eddyb tells me that we parse all things as token trees first -- I didn't realize that! Disregard my comments, will re-review.

@nikomatsakis
Copy link
Contributor

Just for reference, the output from @brson's test in #31994 is https://gist.github.com/nikomatsakis/e6058b1e264e28d4885c -- still quite a lot. WRONG!

@nikomatsakis
Copy link
Contributor

Oops, totally ran that with the wrong branch. The output is:

/home/nmatsakis/tmp/error-spew.rs:843:9: 843:10 error: incorrect close delimiter: `}`
/home/nmatsakis/tmp/error-spew.rs:843         } else {
                                              ^
/home/nmatsakis/tmp/error-spew.rs:841:21: 841:22 note: unclosed delimiter
/home/nmatsakis/tmp/error-spew.rs:841             callback(path.as_ref(); // MISSING )
                                                          ^
/home/nmatsakis/tmp/error-spew.rs:841:35: 841:36 error: expected one of `,`, `.`, `?`, or an operator, found `;`
/home/nmatsakis/tmp/error-spew.rs:841             callback(path.as_ref(); // MISSING )
                                                                        ^
/home/nmatsakis/tmp/error-spew.rs:842:13: 842:15 error: expected one of `.`, `;`, `?`, `}`, or an operator, found `fs`
/home/nmatsakis/tmp/error-spew.rs:842             fs::create_dir_all(path.as_ref()).map(|()| true)
                                                  ^~
/home/nmatsakis/tmp/error-spew.rs:841:13: 841:36 error: mismatched types:
 expected `core::result::Result<bool, std::io::error::Error>`,
    found `()`
(expected enum `core::result::Result`,
    found ()) [E0308]
/home/nmatsakis/tmp/error-spew.rs:841             callback(path.as_ref(); // MISSING )
                                                  ^~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/error-spew.rs:841:13: 841:36 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 25, 2016

📌 Commit 180d6b5 has been approved by nikomatsakis

@nikomatsakis
Copy link
Contributor

Seems good to me. :)

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 26, 2016
Some fixes for error recovery in the compiler
bors added a commit that referenced this pull request Mar 26, 2016
Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 26, 2016
Some fixes for error recovery in the compiler
bors added a commit that referenced this pull request Mar 26, 2016
Rollup of 11 pull requests

- Successful merges: #32131, #32199, #32257, #32325, #32435, #32447, #32448, #32456, #32469, #32476, #32482
- Failed merges: #32240
@bors bors merged commit 180d6b5 into rust-lang:master Mar 26, 2016
@pnkfelix
Copy link
Member

discussion leads to conclusion that we will land
only first commit from #32435 (3ee841c)
since #32494 will cover the spew otherwise
for beta

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Mar 31, 2016
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants