/// Load the internal atomic memory cells if they exist.
#[inline]
fn atomic(&self) -> Option<&AtomicMemoryCellClocks> {
- match &self.atomic_ops {
- Some(op) => Some(&*op),
- None => None,
- }
+ self.atomic_ops.as_deref()
}
/// Load or create the internal atomic memory metadata
let thread_name = &self.thread_info.borrow()[thread].thread_name;
if let Some(name) = thread_name {
let name: &str = name;
- format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), &*name)
+ format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), name)
} else {
format!("Thread(id = {:?})", thread.to_u32())
}
}
// Push frame.
- let mir = &*this.load_mir(f.def, None)?;
+ let mir = this.load_mir(f.def, None)?;
this.push_stack_frame(f, mir, dest, stack_pop)?;
// Initialize arguments.
#[inline(always)]
fn filter_map_collect<T>(&self, mut f: impl FnMut(&K, &V) -> Option<T>) -> Vec<T> {
- self.0.borrow().iter().filter_map(move |(k, v)| f(k, &*v)).collect()
+ self.0.borrow().iter().filter_map(move |(k, v)| f(k, v)).collect()
}
/// The most interesting method: Providing a shared reference without
// First: functions that diverge.
let ret = match ret {
None =>
- match &*link_name.as_str() {
+ match link_name.as_str() {
"miri_start_panic" => {
// `check_shim` happens inside `handle_miri_start_panic`.
this.handle_miri_start_panic(abi, link_name, args, unwind)?;
let panic_impl_id = tcx.lang_items().panic_impl().unwrap();
let panic_impl_instance = ty::Instance::mono(tcx, panic_impl_id);
return Ok(Some((
- &*this.load_mir(panic_impl_instance.def, None)?,
+ this.load_mir(panic_impl_instance.def, None)?,
panic_impl_instance,
)));
}
// Here we dispatch all the shims for foreign functions. If you have a platform specific
// shim, add it to the corresponding submodule.
- match &*link_name.as_str() {
+ match link_name.as_str() {
// Miri-specific extern functions
"miri_static_root" => {
let [ptr] = this.check_shim(abi, Abi::Rust, link_name, args)?;
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
// FIXME: Using host floats.
let f = f32::from_bits(this.read_scalar(f)?.to_u32()?);
- let f = match &*link_name.as_str() {
+ let f = match link_name.as_str() {
"cbrtf" => f.cbrt(),
"coshf" => f.cosh(),
"sinhf" => f.sinh(),
// FIXME: Using host floats.
let f1 = f32::from_bits(this.read_scalar(f1)?.to_u32()?);
let f2 = f32::from_bits(this.read_scalar(f2)?.to_u32()?);
- let n = match &*link_name.as_str() {
+ let n = match link_name.as_str() {
"_hypotf" | "hypotf" => f1.hypot(f2),
"atan2f" => f1.atan2(f2),
_ => bug!(),
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
// FIXME: Using host floats.
let f = f64::from_bits(this.read_scalar(f)?.to_u64()?);
- let f = match &*link_name.as_str() {
+ let f = match link_name.as_str() {
"cbrt" => f.cbrt(),
"cosh" => f.cosh(),
"sinh" => f.sinh(),
// FIXME: Using host floats.
let f1 = f64::from_bits(this.read_scalar(f1)?.to_u64()?);
let f2 = f64::from_bits(this.read_scalar(f2)?.to_u64()?);
- let n = match &*link_name.as_str() {
+ let n = match link_name.as_str() {
"_hypot" | "hypot" => f1.hypot(f2),
"atan2" => f1.atan2(f2),
_ => bug!(),
}
// Otherwise, load the MIR.
- Ok(Some((&*this.load_mir(instance.def, None)?, instance)))
+ Ok(Some((this.load_mir(instance.def, None)?, instance)))
}
/// Returns `true` if the computation was performed, and `false` if we should just evaluate
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
let this = self.eval_context_mut();
- match &*link_name.as_str() {
+ match link_name.as_str() {
// Environment related shims
"getenv" => {
let [name] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
}
}
Err(e) =>
- return match e.raw_os_error() {
+ match e.raw_os_error() {
Some(error) => Ok(error),
None =>
throw_unsup_format!(
// Returns an error for unsupported symbols, and None if this symbol
// should become a NULL pointer (pretend it does not exist).
pub fn from_str<'tcx>(name: &str) -> InterpResult<'tcx, Option<Dlsym>> {
- Ok(match &*name {
+ Ok(match name {
"__pthread_get_minstack" => None,
"getrandom" => None, // std falls back to syscall(SYS_getrandom, ...) when this is NULL.
"statx" => None, // std falls back to syscall(SYS_statx, ...) when this is NULL.
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
let this = self.eval_context_mut();
- match &*link_name.as_str() {
+ match link_name.as_str() {
// errno
"__errno_location" => {
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
let this = self.eval_context_mut();
- match &*link_name.as_str() {
+ match link_name.as_str() {
// errno
"__error" => {
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
// DWORD = ULONG = u32
// BOOL = i32
// BOOLEAN = u8
- match &*link_name.as_str() {
+ match link_name.as_str() {
// Environment related shims
"GetEnvironmentVariableW" => {
let [name, buf, size] =