Don't unwrap() in in_std()

This commit is contained in:
hyd-dev 2021-06-03 21:26:11 +08:00
parent 879000b133
commit 545101040d
No known key found for this signature in database
GPG Key ID: 74FA7FD5B8DA14B8

View File

@ -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
})
}
}