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 first_an_ICE_and_then_some_ice_cream branch from c196675 to 2143a71 Compare July 28, 2018 10:09
@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
@ghost
Copy link

ghost 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 first_an_ICE_and_then_some_ice_cream branch from 2143a71 to 946340a Compare July 29, 2018 09:00
@phansch
Copy link
Member Author

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 commented Jul 31, 2018

@mikerite Would you like to have another look?

@ghost
Copy link

ghost commented Aug 1, 2018

Looks good to me.

@phansch phansch merged commit d7ffaab into rust-lang:master Aug 1, 2018
@phansch phansch deleted the first_an_ICE_and_then_some_ice_cream branch August 1, 2018 05:18
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.

crashes checking cargo tests
1 participant