From 545101040df050dcc412d714640c95f417194600 Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Thu, 3 Jun 2021 21:26:11 +0800 Subject: [PATCH] Don't `unwrap()` in `in_std()` --- src/helpers.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index 7f99aa19970..a9cafd2a9e3 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -631,8 +631,10 @@ fn check_abi<'a>(&self, abi: Abi, exp_abi: Abi) -> InterpResult<'a, ()> { fn in_std(&self) -> bool { let this = self.eval_context_ref(); - this.tcx.def_path(this.frame().instance.def_id()).krate - == this.tcx.def_path(this.tcx.lang_items().start_fn().unwrap()).krate + this.tcx.lang_items().start_fn().map_or(false, |start_fn| { + this.tcx.def_path(this.frame().instance.def_id()).krate + == this.tcx.def_path(start_fn).krate + }) } }