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

Fix ICE with 'while let Some(..) = x.iter()' #2968

Merged
merged 1 commit into from Aug 1, 2018

Conversation

Projects
None yet
2 participants
@phansch
Collaborator

phansch commented Jul 28, 2018

This fixes an ICE when using only a range as a pattern argument:

fn main() {
    let mut iter = [1].iter();
    while let Some(..) = iter.next() {
    }
}

Fixes #2965

@phansch phansch force-pushed the phansch:first_an_ICE_and_then_some_ice_cream branch from c196675 to 2143a71 Jul 28, 2018

@phansch phansch changed the title from WIP: Fix ICE with 'while let (..) = x.iter()' to Fix ICE with 'while let (..) = x.iter()' Jul 28, 2018

@phansch phansch changed the title from Fix ICE with 'while let (..) = x.iter()' to Fix ICE with 'while let Some(..) = x.iter()' Jul 28, 2018

@mikerite

This comment has been minimized.

Contributor

mikerite commented Jul 28, 2018

This fixes the crash but shouldn't it be suggesting for _ in iter { .. }?
It would make sense to treat Some(..) the same as Some(_).

@phansch phansch force-pushed the phansch:first_an_ICE_and_then_some_ice_cream branch from 2143a71 to 946340a Jul 29, 2018

@phansch

This comment has been minimized.

Collaborator

phansch commented Jul 29, 2018

You're right. I updated the PR with a version that suggests for _ in iter { ... } 👍

@phansch

This comment has been minimized.

Collaborator

phansch commented Jul 31, 2018

@mikerite Would you like to have another look?

@mikerite

This comment has been minimized.

Contributor

mikerite commented Aug 1, 2018

Looks good to me.

@phansch phansch merged commit d7ffaab into rust-lang:master Aug 1, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@phansch phansch deleted the phansch:first_an_ICE_and_then_some_ice_cream branch Aug 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment