@@ -209,20 +209,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
209209 ) -> InterpResult < ' tcx , Option < & ' mir mir:: Body < ' tcx > > > {
210210 let this = self . eval_context_mut ( ) ;
211211 let attrs = this. tcx . get_attrs ( def_id) ;
212- let link_name_sym = this
212+ let link_name = this
213213 . tcx
214214 . sess
215215 . first_attr_value_str_by_name ( & attrs, sym:: link_name)
216216 . unwrap_or_else ( || this. tcx . item_name ( def_id) ) ;
217- let link_name = link_name_sym. as_str ( ) ;
218217 let tcx = this. tcx . tcx ;
219218
220219 // First: functions that diverge.
221220 let ( dest, ret) = match ret {
222- None => match & * link_name {
221+ None => match & * link_name. as_str ( ) {
223222 "miri_start_panic" => {
224223 // `check_shim` happens inside `handle_miri_start_panic`.
225- this. handle_miri_start_panic ( abi, link_name_sym , args, unwind) ?;
224+ this. handle_miri_start_panic ( abi, link_name , args, unwind) ?;
226225 return Ok ( None ) ;
227226 }
228227 // This matches calls to the foreign item `panic_impl`.
@@ -231,7 +230,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
231230 // We don't use `check_shim` here because we are just forwarding to the lang
232231 // item. Argument count checking will be performed when the returned `Body` is
233232 // called.
234- this. check_abi_and_shim_symbol_clash ( abi, Abi :: Rust , link_name_sym ) ?;
233+ this. check_abi_and_shim_symbol_clash ( abi, Abi :: Rust , link_name ) ?;
235234 let panic_impl_id = tcx. lang_items ( ) . panic_impl ( ) . unwrap ( ) ;
236235 let panic_impl_instance = ty:: Instance :: mono ( tcx, panic_impl_id) ;
237236 return Ok ( Some ( & * this. load_mir ( panic_impl_instance. def , None ) ?) ) ;
@@ -240,25 +239,24 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
240239 | "exit"
241240 | "ExitProcess"
242241 => {
243- let exp_abi = if link_name == "exit" {
242+ let exp_abi = if link_name. as_str ( ) == "exit" {
244243 Abi :: C { unwind : false }
245244 } else {
246245 Abi :: System { unwind : false }
247246 } ;
248- let & [ ref code] = this. check_shim ( abi, exp_abi, link_name_sym , args) ?;
247+ let & [ ref code] = this. check_shim ( abi, exp_abi, link_name , args) ?;
249248 // it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
250249 let code = this. read_scalar ( code) ?. to_i32 ( ) ?;
251250 throw_machine_stop ! ( TerminationInfo :: Exit ( code. into( ) ) ) ;
252251 }
253252 "abort" => {
254- let & [ ] =
255- this. check_shim ( abi, Abi :: C { unwind : false } , link_name_sym, args) ?;
253+ let & [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
256254 throw_machine_stop ! ( TerminationInfo :: Abort (
257255 "the program aborted execution" . to_owned( )
258256 ) )
259257 }
260258 _ => {
261- if let Some ( body) = this. lookup_exported_symbol ( link_name_sym ) ? {
259+ if let Some ( body) = this. lookup_exported_symbol ( link_name ) ? {
262260 return Ok ( Some ( body) ) ;
263261 }
264262 this. handle_unsupported ( format ! (
@@ -272,14 +270,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
272270 } ;
273271
274272 // Second: functions that return.
275- match this. emulate_foreign_item_by_name ( link_name_sym , abi, args, dest, ret) ? {
273+ match this. emulate_foreign_item_by_name ( link_name , abi, args, dest, ret) ? {
276274 EmulateByNameResult :: NeedsJumping => {
277275 trace ! ( "{:?}" , this. dump_place( * * dest) ) ;
278276 this. go_to_block ( ret) ;
279277 }
280278 EmulateByNameResult :: AlreadyJumped => ( ) ,
281279 EmulateByNameResult :: NotSupported => {
282- if let Some ( body) = this. lookup_exported_symbol ( link_name_sym ) ? {
280+ if let Some ( body) = this. lookup_exported_symbol ( link_name ) ? {
283281 return Ok ( Some ( body) ) ;
284282 }
285283
0 commit comments