Skip to content

Commit

Permalink
Auto merge of rust-lang#2216 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
rustup

Locally I see lots of new clippy failures, but did clippy really add a bunch of new lints recently?
  • Loading branch information
bors committed Jun 8, 2022
2 parents eedc78d + 295e18d commit b8d5ee0
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ install that exact version of rustc as a toolchain:
This will set up a rustup toolchain called `miri` and set it as an override for
the current directory.

If you want to also have `clippy` installed, you need to run this:
```
./rustup-toolchain "" -c clippy
```

[`rustup-toolchain-install-master`]: https://github.com/kennytm/rustup-toolchain-install-master

## Building and testing Miri
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d20fd109809f20c049d6895a5be27a1fbd39daa
e45d9973b2665897a768312e971b82cc62633103
7 changes: 2 additions & 5 deletions src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,7 @@ impl MemoryCellClocks {
/// 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
Expand Down Expand Up @@ -1482,7 +1479,7 @@ impl GlobalState {
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())
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
}

// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/mono_hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<K: Hash + Eq, V> AllocMap<K, V> for MonoHashMap<K, V> {

#[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
Expand Down
14 changes: 7 additions & 7 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// 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)?;
Expand All @@ -259,7 +259,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
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,
)));
}
Expand Down Expand Up @@ -361,7 +361,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

// 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)?;
Expand Down Expand Up @@ -573,7 +573,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
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(),
Expand All @@ -596,7 +596,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// 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!(),
Expand All @@ -615,7 +615,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
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(),
Expand All @@ -636,7 +636,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// 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!(),
Expand Down
2 changes: 1 addition & 1 deletion src/shims/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
}

// 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
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
) -> 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)?;
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, '
}
}
Err(e) =>
return match e.raw_os_error() {
match e.raw_os_error() {
Some(error) => Ok(error),
None =>
throw_unsup_format!(
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/linux/dlsym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl Dlsym {
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/linux/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
) -> 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)?;
Expand Down
2 changes: 1 addition & 1 deletion src/shims/unix/macos/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
) -> 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)?;
Expand Down
2 changes: 1 addition & 1 deletion src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// 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] =
Expand Down

0 comments on commit b8d5ee0

Please sign in to comment.