You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::collections::HashMap;fnmain(){letmut map = HashMap::new();
map.insert(1,"a");println!("map = {:?}", map);}
error: Undefined Behavior: out-of-bounds pointer arithmetic: alloc1009 has size 60, so pointer to 12 bytes starting at offset -12 is out-of-bounds
--> /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.0/src/raw/mod.rs:510:22
|
510 | unsafe { self.ptr.as_ptr().sub(1) }
| ^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: alloc1009 has size 60, so pointer to 12 bytes starting at offset -12 is out-of-bounds
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
help: alloc1009 was allocated here:
--> src/main.rs:5:5
|
5 | map.insert(1, "a");
| ^^^^^^^^^^^^^^^^^^
= note: BACKTRACE (of the first span):
= note: inside `hashbrown::raw::Bucket::<(i32, &str)>::as_ptr` at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.0/src/raw/mod.rs:510:22: 510:46
= note: inside `hashbrown::raw::Bucket::<(i32, &str)>::as_ref::<'_>` at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.0/src/raw/mod.rs:674:11: 674:24
= note: inside `<hashbrown::map::Iter<'_, i32, &str> as std::iter::Iterator>::next` at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.0/src/map.rs:4737:25: 4737:35
= note: inside `<std::collections::hash_map::Iter<'_, i32, &str> as std::iter::Iterator>::next` at /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:2232:9: 2232:25
= note: inside `std::fmt::DebugMap::<'_, '_>::entries::<&i32, &&str, std::collections::hash_map::Iter<'_, i32, &str>>` at /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/builders.rs:893:23: 893:30
= note: inside `<std::collections::HashMap<i32, &str> as std::fmt::Debug>::fmt` at /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:1309:9: 1309:43
rust-lang/rust#116880
The text was updated successfully, but these errors were encountered: