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

Internal compiler error #9122

Closed
alexjg opened this issue Sep 11, 2013 · 1 comment
Closed

Internal compiler error #9122

alexjg opened this issue Sep 11, 2013 · 1 comment

Comments

@alexjg
Copy link

alexjg commented Sep 11, 2013

I'm running rust 0.7-1, the following program:

use std::hashmap::{HashMap, Map};


fn do_something<'input, M: Map<int, &'self str>> (key: int, map: &'input M){
    match map.find(key){
        Some(result) => println(fmt!("%s", result)),
        None => println("no match")
    };
}

fn main(){
    let  map : HashMap<int, &str> = HashMap::new();
    map.insert(1, "one");
    do_something(1, map);
}

Causes rustc to fail with the following message

rust: task failed at 'assertion failed: rp.is_none()', /build/rust/src/rust-0.7/src/librustc/middle/typeck/collect.rs:1040
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /build/rust/src/rust-0.7/src/librustc/rustc.rs:354
rust: domain main @0x1552d70 root task failed
@alexcrichton
Copy link
Member

Closed by #10153, relevant tests already appear to be checked in.

flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 21, 2023
[`map_identity`]: allow closure with type annotations

Fixes rust-lang#9122

`.map(|a: u32| a)` can help type inference, so we should probably allow this and not warn about "unnecessary map of the identity function"

changelog: [`map_identity`]: allow closure with type annotations
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

No branches or pull requests

2 participants