-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
@bors r+ rollup |
📌 Commit dcd91d5 has been approved by |
r? @pnkfelix |
parser: don't use `unreachable!()` in `fn unexpected`. Fixes rust-lang#66357 r? @estebank
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
☔ The latest upstream changes (presumably #66403) made this pull request unmergeable. Please resolve the merge conflicts. |
Ok(_) => unreachable!(), | ||
// We can get `Ok(true)` from `recover_closing_delimiter` | ||
// which is called in `expected_one_of_not_found`. | ||
Ok(_) => FatalError.raise(), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
beta-accepted (last week, sorry for delay!) |
[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
[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
Fixes #66357
r? @estebank