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

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

Merged

Conversation

@phansch
Copy link
Member

@phansch 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 WIP: Fix ICE with 'while let (..) = x.iter()' Fix ICE with 'while let (..) = x.iter()' Jul 28, 2018
@phansch phansch changed the title Fix ICE with 'while let (..) = x.iter()' Fix ICE with 'while let Some(..) = x.iter()' Jul 28, 2018
@mikerite
Copy link
Contributor

@mikerite 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
Copy link
Member Author

@phansch phansch commented Jul 29, 2018

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

@phansch
Copy link
Member Author

@phansch phansch commented Jul 31, 2018

@mikerite Would you like to have another look?

@mikerite
Copy link
Contributor

@mikerite mikerite commented Aug 1, 2018

Looks good to me.

@phansch phansch merged commit d7ffaab into rust-lang:master Aug 1, 2018
2 checks passed
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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants