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

Error correction for missing idents #31065

Merged
merged 6 commits into from
Jan 26, 2016
Merged

Error correction for missing idents #31065

merged 6 commits into from
Jan 26, 2016

Conversation

nrc
Copy link
Member

@nrc nrc commented Jan 20, 2016

This PR adds some minor error correction to the parser - if there is a missing ident, we recover and carry on. It also makes compilation more robust so that non-fatal errors (which is still most of them, unfortunately) in parsing do not cause us to abort compilation. The effect is that a program with a missing or incorrect ident can get all the way to type checking.

@rust-highfive
Copy link
Collaborator

r? @jroesch

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

@nrc
Copy link
Member Author

nrc commented Jan 20, 2016

r? @pnkfelix

@@ -282,10 +282,6 @@ pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
if c == '_' { continue }
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
Copy link
Member

Choose a reason for hiding this comment

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

heh, I take it from your changes above that we're better off just dying as soon as we see the first invalid character rather than printing them all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, that was not intentional. I'll fix this.

@pnkfelix
Copy link
Member

@nrc seems like a win overall. r=me after you decide whether or not to take my suggestion about the name of fn abort_if_new_errors.

@nrc
Copy link
Member Author

nrc commented Jan 25, 2016

@bors: r=pnkfelix

@bors
Copy link
Contributor

bors commented Jan 25, 2016

📌 Commit 43b3681 has been approved by pnkfelix

@bors
Copy link
Contributor

bors commented Jan 25, 2016

⌛ Testing commit 43b3681 with merge 6ff8f62...

@bors
Copy link
Contributor

bors commented Jan 25, 2016

💔 Test failed - auto-mac-64-opt

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Jan 25, 2016 at 12:42 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-mac-64-opt
http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/7800


Reply to this email directly or view it on GitHub
#31065 (comment).

@bors
Copy link
Contributor

bors commented Jan 26, 2016

⌛ Testing commit 43b3681 with merge faf6d1e...

bors added a commit that referenced this pull request Jan 26, 2016
This PR adds some minor error correction to the parser - if there is a missing ident, we recover and carry on. It also makes compilation more robust so that non-fatal errors (which is still most of them, unfortunately) in parsing do not cause us to abort compilation. The effect is that a program with a missing or incorrect ident can get all the way to type checking.
@bors bors merged commit 43b3681 into rust-lang:master Jan 26, 2016
bors added a commit that referenced this pull request Jan 29, 2016
This fixes an ICE introduced by #31065 that occurs when a path cannot be resolved because of a certain class of unresolved import (`Indeterminate` imports).
For example, this currently causes an ICE:
```rust
mod foo { pub use self::*; }
fn main() { foo::f() }
```

r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants