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

ICE when fold accumulator type annotation is incorrect #951

Closed
RyanAlameddine opened this issue Oct 30, 2023 · 1 comment
Closed

ICE when fold accumulator type annotation is incorrect #951

RyanAlameddine opened this issue Oct 30, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RyanAlameddine
Copy link
Contributor

The following code snippet causes an internal compiler error on my version of rust (rustc 1.75.0-nightly):

source_iter(vec![1]) 
    -> fold(Vec::new, |accum: Vec<usize>, elem| {accum.push(elem)}) 
    -> assert_eq([vec![1]]);

Note that the mistake is is that accum: Vec<usize> should be accum: &mut Vec<usize>.

Also, I'm curious why the type of accum can't be inferred.

@MingweiSamuel MingweiSamuel self-assigned this Oct 30, 2023
@MingweiSamuel MingweiSamuel added the bug Something isn't working label Oct 30, 2023
@MingweiSamuel
Copy link
Member

Maybe rust-lang/rust#116658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants