From 340267525c9bfdd0b7bdca51f4a36e7857a05b25 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 6 Jul 2021 10:09:53 +0200 Subject: [PATCH] exported_symbols_cache: ensure we do not overwrite anything --- src/shims/foreign_items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 5d46f3c05c3..2de0baf2947 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -194,7 +194,7 @@ fn lookup_exported_symbol( let instance = instance_and_crate.map(|ic| ic.0); // Cache it and load its MIR, if found. - this.machine.exported_symbols_cache.insert(link_name, instance); + this.machine.exported_symbols_cache.try_insert(link_name, instance).unwrap(); instance.map(|instance| this.load_mir(instance.def, None)).transpose() }