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

parser: don't use unreachable!() in fn unexpected. #66361

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Nov 13, 2019

Fixes #66357

r? @estebank

@Centril Centril added beta-nominated Nominated for backporting to the compiler in the beta channel. stable-nominated Nominated for backporting to the compiler in the stable channel. labels Nov 13, 2019
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 13, 2019
@pnkfelix
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 13, 2019

📌 Commit dcd91d5 has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2019
@Centril
Copy link
Contributor Author

Centril commented Nov 13, 2019

r? @pnkfelix

@rust-highfive rust-highfive assigned pnkfelix and unassigned estebank Nov 13, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Nov 14, 2019
parser: don't use `unreachable!()` in `fn unexpected`.

Fixes rust-lang#66357

r? @estebank
bors added a commit that referenced this pull request Nov 14, 2019
Rollup of 9 pull requests

Successful merges:

 - #66253 (Improve errors after re rebalance coherence)
 - #66264 (fix an ICE in macro's diagnostic message)
 - #66349 (expand source_util macros with def-site context)
 - #66351 (Tweak non-char/numeric in range pattern diagnostic)
 - #66360 (Fix link to Exten in Vec::set_len)
 - #66361 (parser: don't use `unreachable!()` in `fn unexpected`.)
 - #66363 (Improve error message in make_tests)
 - #66369 (compiletest: Obtain timestamps for common inputs only once)
 - #66372 (Fix broken links in Ipv4Addr::is_benchmarking docs)

Failed merges:

r? @ghost
@bors bors merged commit dcd91d5 into rust-lang:master Nov 14, 2019
@bors
Copy link
Contributor

bors commented Nov 14, 2019

☔ The latest upstream changes (presumably #66403) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 14, 2019
@Centril Centril deleted the 66357 branch November 14, 2019 11:23
@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 14, 2019
Ok(_) => unreachable!(),
// We can get `Ok(true)` from `recover_closing_delimiter`
// which is called in `expected_one_of_not_found`.
Ok(_) => FatalError.raise(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Remind me -- this is used in the parser as a form of panic? I remember seeing some pretty bad output that resulted from using FatalError.raise() on occasion (I think rustc just failed with no output at all) -- can we not use some other method here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, if this is the "current error handling mechanism" seems fine. I'm just asking for my own edification.

Copy link
Contributor

@estebank estebank Nov 14, 2019

Choose a reason for hiding this comment

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

It says "stop the world". The reason we aggressively removed their usages was to enable recovery and plow ahead to type checking even in the face of malformed code. It is a valid strategy to stop the world when a condition that could only have been caused by prior malformed code is met, as at that point continuing with our recovery is a liability, and we will have had errors emitted beforehand.

We might want to have a delay_span_bug as a guardrail, but this should be fine.

@pnkfelix
Copy link
Member

beta-accepted (last week, sorry for delay!)

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Nov 21, 2019
@pnkfelix
Copy link
Member

stable-accepted

@pnkfelix pnkfelix added the stable-accepted Accepted for backporting to the compiler in the stable channel. label Nov 21, 2019
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 5, 2019
bors added a commit that referenced this pull request Dec 7, 2019
[beta] backports

This pull request backports the following pull requests, which have all been beta-accepted by the
compiler team.

 * Handle non_exhaustive in borrow checking #66722
 * Do not ICE on trait aliases with missing obligations #66392
 * Do not ICE in `if` without `else` in `async fn` #66391
 * Fix ICE when trying to suggest `Type<>` instead of `Type()` #66390
 * Do not ICE on recovery from unmet associated type bound obligation #66388
 * find_deprecation: deprecation attr may be ill-formed meta. #66381
 * parser: don't use `unreachable!()` in `fn unexpected`. #66361
 * Undo an assert causing an ICE until we fix the underlying problem #66250
 * Do not ICE with a precision flag in formatting str and no format arguments #66093
 * Fix two OOM issues related to `ConstProp` #66394
bors added a commit that referenced this pull request Dec 8, 2019
[beta] backports

This pull request backports the following pull requests, which have all been beta-accepted by the
compiler team.

 * Handle non_exhaustive in borrow checking #66722
 * Do not ICE on trait aliases with missing obligations #66392
 * Do not ICE in `if` without `else` in `async fn` #66391
 * Fix ICE when trying to suggest `Type<>` instead of `Type()` #66390
 * Do not ICE on recovery from unmet associated type bound obligation #66388
 * find_deprecation: deprecation attr may be ill-formed meta. #66381
 * parser: don't use `unreachable!()` in `fn unexpected`. #66361
 * Undo an assert causing an ICE until we fix the underlying problem #66250
 * Do not ICE with a precision flag in formatting str and no format arguments #66093
 * Fix two OOM issues related to `ConstProp` #66394
@Mark-Simulacrum Mark-Simulacrum removed stable-accepted Accepted for backporting to the compiler in the stable channel. stable-nominated Nominated for backporting to the compiler in the stable channel. labels Dec 14, 2019
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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Internal Compiler Error @ parser.rs:446:22
7 participants