-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Labels
Milestone
Description
页码与行数
- 代码清单 12-52 第 8 行
代码错误
#![feature(proc_macro_hygiene)]
#[test]
fn test_hashmap() {
let hm = hashmap!{ "a": 1, "b": 2 };
assert_eq!(hm["a"], 1);
let hm = hashmap!{ "a" => 1, "b" => 2, "c" => 3 };
assert_eq!(hm["d"], 4); // 此处断言不通过
}
Rust版本
$ rustc -V
rustc 1.34.0-nightly (d17318011 2019-02-07)
错误信息
thread 'test_hashmap' panicked at 'no entry found for key', src/libcore/option.rs:1038:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.