Skip to content

Instantly share code, notes, and snippets.

@remexre
Created March 16, 2017 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remexre/91fdb486c616219e37eea60360723de1 to your computer and use it in GitHub Desktop.
Save remexre/91fdb486c616219e37eea60360723de1 to your computer and use it in GitHub Desktop.
use std::collections::btree_map::{BTreeMap, Entry};
fn main() {
let mut m: BTreeMap<&'static str, i32> = BTreeMap::new();
m.insert("foo", 4);
println!("=== Starting Foo ===");
match m.entry("foo") {
Entry::Vacant(entry) => {
println!("{:?}", entry)
}
Entry::Occupied(entry) => {
println!("{:?}", entry)
},
}
println!("=== Starting Bar ===");
match m.entry("bar") {
Entry::Vacant(entry) => {
println!("{:?}", entry)
}
Entry::Occupied(entry) => {
println!("{:?}", entry)
},
}
println!("=== Done ===");
}
=== Starting Foo ===
Uninitialized bytes in __interceptor_memrchr at offset 0 inside [0x7ffc81036e54, 1)
==1967==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55b703c9e5b2 in std::sys::imp::memchr::memrchr::memrchr_specific /checkout/src/libstd/sys/unix/memchr.rs:39
#1 0x55b703c9e5b2 in std::sys::imp::memchr::memrchr /checkout/src/libstd/sys/unix/memchr.rs:56
#2 0x55b703c9e5b2 in std::memchr::memrchr /checkout/src/libstd/memchr.rs:55
#3 0x55b703c9e5b2 in std::io::buffered::{{impl}}::write<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>> /checkout/src/libstd/io/buffered.rs:784
#4 0x55b703c9e5b2 in _$LT$std..io..stdio..StdoutLock$LT$$u27$a$GT$$u20$as$u20$std..io..Write$GT$::write::hcf3a42a5628e1e99 /checkout/src/libstd/io/stdio.rs:466
#5 0x55b703c9eceb in std::io::Write::write_all::he0d0c3e37bfbe6eb /checkout/src/libstd/io/mod.rs:944
#6 0x55b703c9f16b in _$LT$std..io..Write..write_fmt..Adaptor$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5166363d4a635f98 /checkout/src/libstd/io/mod.rs:1004
#7 0x55b703c9b438 in core::fmt::Write::write_char::hb695c282bbd11844 /checkout/src/libcore/fmt/mod.rs:138
#8 0x55b703cb08fc in core::fmt::{{impl}}::write_char /checkout/src/libcore/fmt/mod.rs:1426
#9 0x55b703cb08fc in _$LT$str$u20$as$u20$core..fmt..Debug$GT$::fmt::h4aea6fdb15831f28 /checkout/src/libcore/fmt/mod.rs:1491
#10 0x55b703c0cb53 in _$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Debug$GT$::fmt::h1ba1642d84a9db09 (/home/nathan/go/src/github.com/oftlisp/oftlisp-bootstrap-rs/main+0x27b53)
#11 0x55b703cafdd5 in core::fmt::write::h073a5af24f16eb5d /checkout/src/libcore/fmt/mod.rs:931
#12 0x55b703caf399 in core::fmt::{{impl}}::write_fmt /checkout/src/libcore/fmt/mod.rs:1235
#13 0x55b703caf399 in core::fmt::builders::{{impl}}::field::{{closure}} /checkout/src/libcore/fmt/builders.rs:91
#14 0x55b703caf399 in core::result::{{impl}}::and_then<(),core::fmt::Error,(),closure> /checkout/src/libcore/result.rs:601
#15 0x55b703caf399 in core::fmt::builders::DebugStruct::field::hef93a01166b6791e /checkout/src/libcore/fmt/builders.rs:79
#16 0x55b703bf1b72 in _$LT$collections..btree..map..OccupiedEntry$LT$$u27$a$C$$u20$K$C$$u20$V$GT$$u20$as$u20$core..fmt..Debug$GT$::fmt::hfa00133adafec303 (/home/nathan/go/src/github.com/oftlisp/oftlisp-bootstrap-rs/main+0xcb72)
#17 0x55b703cafdd5 in core::fmt::write::h073a5af24f16eb5d /checkout/src/libcore/fmt/mod.rs:931
#18 0x55b703c9e284 in std::io::Write::write_fmt<std::io::stdio::StdoutLock> /checkout/src/libstd/io/mod.rs:1015
#19 0x55b703c9e284 in _$LT$std..io..stdio..Stdout$u20$as$u20$std..io..Write$GT$::write_fmt::he09df201429303e6 /checkout/src/libstd/io/stdio.rs:460
#20 0x55b703c9e909 in std::io::stdio::_print::h0fc18ea78cf443a5 /checkout/src/libstd/io/stdio.rs:680
#21 0x55b703c1ca22 in main::main::h7f102e58bcc3278c (/home/nathan/go/src/github.com/oftlisp/oftlisp-bootstrap-rs/main+0x37a22)
#22 0x55b703ca5bc5 in std::panicking::try::do_call::h689a21caeeef92aa /checkout/src/libstd/panicking.rs:454
#23 0x55b703cad86a in __rust_maybe_catch_panic /checkout/src/libpanic_unwind/lib.rs:98
#24 0x55b703ca63b6 in std::panicking::try<(),fn()> /checkout/src/libstd/panicking.rs:433
#25 0x55b703ca63b6 in std::panic::catch_unwind<fn(),()> /checkout/src/libstd/panic.rs:361
#26 0x55b703ca63b6 in std::rt::lang_start::hf63d494cb7dd034c /checkout/src/libstd/rt.rs:57
#27 0x55b703c1d00f in main (/home/nathan/go/src/github.com/oftlisp/oftlisp-bootstrap-rs/main+0x3800f)
#28 0x7f445defd510 in __libc_start_main (/usr/lib/libc.so.6+0x20510)
#29 0x55b703beea49 in _start (/home/nathan/go/src/github.com/oftlisp/oftlisp-bootstrap-rs/main+0x9a49)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /checkout/src/libstd/sys/unix/memchr.rs:39 in std::sys::imp::memchr::memrchr::memrchr_specific
Exiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment