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

Remove runtime failure from pattern matching #15700

Merged
merged 1 commit into from Jul 21, 2014
Merged

Remove runtime failure from pattern matching #15700

merged 1 commit into from Jul 21, 2014

Conversation

ghost
Copy link

@ghost ghost commented Jul 15, 2014

It's an artifact of the old refutable version of match and is no longer necessary.

dynamic_failure_handler.handle_fail()
}
Infallible =>
fail!("attempted to fail in infallible failure handler!"),
Copy link
Member

Choose a reason for hiding this comment

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

I assume "attempted to fail" doesn't mean fail!(), but rather "attempted to not match". (aka "infallable" is being used as a synonym for "irrefutable" here?)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, where irrefutable refers to a specific branch of the decision tree. Unless guards or slice patterns are involved, only one branch in the tree has to be explored. And not matching is impossible because of the exhaustiveness guarantee. It is possible when guards or var-length slice patterns are involved, however, in which case it will jump to the next appropriate branch.

It's an artifact of the old refutable version of `match`
and is no longer necessary.
bors added a commit that referenced this pull request Jul 21, 2014
It's an artifact of the old refutable version of `match` and is no longer necessary.
@bors bors closed this Jul 21, 2014
@bors bors merged commit 5819ee1 into rust-lang:master Jul 21, 2014
@ghost ghost deleted the match-fail-removal branch August 18, 2014 18:19
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 13, 2023
…eykril

feat: add assist for applying De Morgan's law to `Iterator::all` and `Iterator::any`

This PR adds an assist for transforming expressions of the form `!iter.any(|x| predicate(x))` into `iter.all(|x| !predicate(x))` and vice versa.

[IteratorDeMorgans.webm](https://github.com/rust-lang/rust-analyzer/assets/52933714/aad1a299-6620-432b-9106-aafd2a7fa9f5)

Closes rust-lang#15694
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.

2 participants