$ rustc --test mapAsMapKey.rs
mapAsMapKey.rs:18:43: 18:52 error: mismatched types: expected `fn@(&&@map_a) -> uint` but found `extern fn(@map_a) -> uint` (expected argument mode ++ but found &&)
mapAsMapKey.rs:18 let b: map_b = hashmap::<@map_a, uint>(rmap_hash, rmap_eqer);
^~~~~~~~~
mapAsMapKey.rs:18:54: 18:63 error: mismatched types: expected `fn@(&&@map_a, &&@map_a) -> bool` but found `extern fn(@map_a, @map_b) -> bool` (expected argument mode ++ but found &&)
mapAsMapKey.rs:18 let b: map_b = hashmap::<@map_a, uint>(rmap_hash, rmap_eqer);
^~~~~~~~~
error: aborting due to 2 previous errors
防锈功能:
fn rmap_hash (m: @map_a) -> uint { 0 }
fn rmap_eqer (m1: @map_a, m2: @map_b) -> bool { true }
线路触发:
let b: map_b = hashmap::<@map_a, uint>(rmap_hash, rmap_eqer);