]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #2113 - RalfJung:rustc-log, r=RalfJung
bors [Wed, 11 May 2022 09:29:43 +0000 (09:29 +0000)]
Auto merge of #2113 - RalfJung:rustc-log, r=RalfJung

when MIRI_LOG is set, set RUSTC_LOG_ENTRY_EXIT

This will be useful once https://github.com/rust-lang/rust/pull/96898 landed.

2 years agowhen MIRI_LOG is set, set RUSTC_LOG_ENTRY_EXIT
Ralf Jung [Wed, 11 May 2022 08:03:56 +0000 (10:03 +0200)]
when MIRI_LOG is set, set RUSTC_LOG_ENTRY_EXIT

2 years agoAuto merge of #2112 - y86-dev:clarify-custom-rustc-issues, r=RalfJung
bors [Tue, 10 May 2022 19:38:52 +0000 (19:38 +0000)]
Auto merge of #2112 - y86-dev:clarify-custom-rustc-issues, r=RalfJung

Clarified issues when building miri with a custom rustc

I came across these issues (see zulip threads [here](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20Changes.20not.20in.20effect) and [here](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Missing.20.2Elibrustc.2Estamp), issue [here](https://github.com/rust-lang/rust/issues/90244)) and would like to add this small bit to the docs. Feel free to change the wording.

2 years agotweak wording
Ralf Jung [Tue, 10 May 2022 19:38:32 +0000 (21:38 +0200)]
tweak wording

2 years agoClarified issues when building miri with a custom rustc
y86-dev [Tue, 10 May 2022 18:46:12 +0000 (20:46 +0200)]
Clarified issues when building miri with a custom rustc

Co-authored-by: Ralf Jung <post@ralfj.de>
2 years agoAuto merge of #2111 - RalfJung:python, r=RalfJung
bors [Tue, 10 May 2022 10:21:33 +0000 (10:21 +0000)]
Auto merge of #2111 - RalfJung:python, r=RalfJung

stop relying on python being in the PATH

Even Debian removed the package that provides `/usr/bin/python`; I guess it is time to move on.

2 years agorustfmt
Ralf Jung [Tue, 10 May 2022 10:21:01 +0000 (12:21 +0200)]
rustfmt

2 years agostop relying on python being in the PATH
Ralf Jung [Tue, 10 May 2022 10:14:47 +0000 (12:14 +0200)]
stop relying on python being in the PATH

2 years agoAuto merge of #2084 - rust-lang:silence, r=RalfJung
bors [Tue, 10 May 2022 07:24:07 +0000 (07:24 +0000)]
Auto merge of #2084 - rust-lang:silence, r=RalfJung

Add a command line flag to avoid printing to stdout and stderr

This is practical for tests that don't actually care about the output and thus don't want it intermingled with miri's warnings, errors or ICEs

fixes #2083

2 years agoWording nit
Oli Scherer [Tue, 10 May 2022 07:23:50 +0000 (07:23 +0000)]
Wording nit

2 years agoUse alphabetical order for miri flags
Oli Scherer [Tue, 10 May 2022 07:23:03 +0000 (07:23 +0000)]
Use alphabetical order for miri flags

2 years agoAuto merge of #2109 - RalfJung:fmt, r=RalfJung
bors [Mon, 9 May 2022 09:18:52 +0000 (09:18 +0000)]
Auto merge of #2109 - RalfJung:fmt, r=RalfJung

rustfmt

2 years agorustfmt
Ralf Jung [Mon, 9 May 2022 09:17:48 +0000 (11:17 +0200)]
rustfmt

2 years agoAuto merge of #2108 - RalfJung:rustup, r=RalfJung
bors [Mon, 9 May 2022 08:22:07 +0000 (08:22 +0000)]
Auto merge of #2108 - RalfJung:rustup, r=RalfJung

rustup

Adjusts for https://github.com/rust-lang/rust/pull/96657. For now we use the fallback path in libstd.

2 years agorustup
Ralf Jung [Mon, 9 May 2022 08:21:15 +0000 (10:21 +0200)]
rustup

2 years agoAuto merge of #2107 - RalfJung:err, r=RalfJung
bors [Sun, 8 May 2022 15:57:22 +0000 (15:57 +0000)]
Auto merge of #2107 - RalfJung:err, r=RalfJung

test for "erroneous constant used" post-monomorphization error

Fixes https://github.com/rust-lang/miri/issues/2106

2 years agotest for "erroneous constant used" post-monomorphization error
Ralf Jung [Sun, 8 May 2022 15:56:09 +0000 (17:56 +0200)]
test for "erroneous constant used" post-monomorphization error

2 years agoAuto merge of #2103 - RalfJung:rustup, r=RalfJung
bors [Fri, 6 May 2022 15:28:39 +0000 (15:28 +0000)]
Auto merge of #2103 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Fri, 6 May 2022 15:28:01 +0000 (17:28 +0200)]
rustup

2 years agoAuto merge of #2100 - RalfJung:readme, r=RalfJung
bors [Thu, 5 May 2022 08:29:12 +0000 (08:29 +0000)]
Auto merge of #2100 - RalfJung:readme, r=RalfJung

tweak MIRI_SYSROOT docs

2 years agotweak MIRI_SYSROOT docs
Ralf Jung [Thu, 5 May 2022 08:28:40 +0000 (10:28 +0200)]
tweak MIRI_SYSROOT docs

2 years agoAuto merge of #2098 - RalfJung:papers, r=RalfJung
bors [Sun, 1 May 2022 11:45:31 +0000 (11:45 +0000)]
Auto merge of #2098 - RalfJung:papers, r=RalfJung

mention some papers that use Miri

2 years agomention some papers that use Miri
Ralf Jung [Sun, 1 May 2022 11:44:12 +0000 (13:44 +0200)]
mention some papers that use Miri

2 years agoAuto merge of #2094 - dtolnay-contrib:truncate, r=RalfJung
bors [Sun, 1 May 2022 07:06:57 +0000 (07:06 +0000)]
Auto merge of #2094 - dtolnay-contrib:truncate, r=RalfJung

Replace `as` casts in llvm.x86.addcarry.64 implementation

Recommended in https://github.com/rust-lang/miri/pull/2090#pullrequestreview-958491177.

2 years agoAuto merge of #2095 - dtolnay-contrib:ref, r=RalfJung
bors [Sun, 1 May 2022 06:34:32 +0000 (06:34 +0000)]
Auto merge of #2095 - dtolnay-contrib:ref, r=RalfJung

Replace unneeded use of `ref` in favor of "match ergonomics"

The signature of `check_shim` is very amenable to this.

```rust
fn check_shim<'a, const N: usize>(…) -> InterpResult<'tcx, &'a [OpTy<'tcx, Tag>; N]>
```

Instead of:

```rust
let &[ref ptr, ref flags] = this.check_shim(…)?;
```

we can write it just as:

```rust
let [ptr, flags] = this.check_shim(…)?;
```

2 years agoAuto merge of #2096 - dtolnay-contrib:whitespace, r=RalfJung
bors [Sat, 30 Apr 2022 17:48:56 +0000 (17:48 +0000)]
Auto merge of #2096 - dtolnay-contrib:whitespace, r=RalfJung

Clean up all trailing whitespace

Editors commonly strip trailing whitespace from source code on save, because it's almost always undesired, and that leads to spurious diffs in these files when working with them in such an editor.

2 years agoClean up all trailing whitespace
David Tolnay [Sat, 30 Apr 2022 17:40:35 +0000 (10:40 -0700)]
Clean up all trailing whitespace

2 years agoReplace `as` casts in llvm.x86.addcarry.64 implementation
David Tolnay [Sat, 30 Apr 2022 17:06:19 +0000 (10:06 -0700)]
Replace `as` casts in llvm.x86.addcarry.64 implementation

2 years agoReplace unneeded use of `ref` in favor of "match ergonomics"
David Tolnay [Sat, 30 Apr 2022 17:14:24 +0000 (10:14 -0700)]
Replace unneeded use of `ref` in favor of "match ergonomics"

2 years agoAuto merge of #2093 - RalfJung:post-mono, r=RalfJung
bors [Sat, 30 Apr 2022 15:10:05 +0000 (15:10 +0000)]
Auto merge of #2093 - RalfJung:post-mono, r=RalfJung

gracefully handle type-too-large layout errors

Fixes https://github.com/rust-lang/miri/issues/2088

2 years agogracefully handle type-too-large layout errors
Ralf Jung [Sat, 30 Apr 2022 15:06:50 +0000 (17:06 +0200)]
gracefully handle type-too-large layout errors

2 years agoAuto merge of #2090 - dtolnay-contrib:addcarry, r=oli-obk
bors [Sat, 30 Apr 2022 09:07:16 +0000 (09:07 +0000)]
Auto merge of #2090 - dtolnay-contrib:addcarry, r=oli-obk

Implement llvm.x86.addcarry.64

This is the only new shim I need for https://github.com/dtolnay/precise/issues/2. It's used by the `num-bigint` crate for bigint addition.

2 years agoAuto merge of #2091 - dtolnay-contrib:clippy, r=oli-obk
bors [Sat, 30 Apr 2022 06:52:13 +0000 (06:52 +0000)]
Auto merge of #2091 - dtolnay-contrib:clippy, r=oli-obk

Resolve some clippy lints, ignore the rest

`cargo clippy` finishes cleanly after this. I stuck to only what I think are the least objectionable lints: cleaning up useless identity conversions that do `from`/`try_from`/`into` going from T-&gt;T, extraneous `&` on expressions that are already a reference, unused lifetime parameters, and similar.

Below in the \<details\> is the complete remaining output of `cargo clippy` with the `allow` attribute removed. I think all the lints left are fine to keep ignoring.

<details>
<summary><code>$ cargo clippy -- -Dclippy::all</code></summary>

```console
error: this `else { if .. }` block can be collapsed
   --> src/data_race.rs:559:16
    |
559 |           } else {
    |  ________________^
560 | |             if lt { &rhs } else { &old }
561 | |         };
    | |_________^ help: collapse nested if block: `if lt { &rhs } else { &old }`
    |
    = note: `-D clippy::collapsible-else-if` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if

error: this `if` statement can be collapsed
   --> src/range_map.rs:166:17
    |
166 | /                 if successful_merge_count > 0 {
167 | |                     if done || self.v[end_idx].data != self.v[equal_since_idx].data {
168 | |                         // Everything in `equal_since..end` was equal. Make them just one element covering
169 | |                         // the entire range.
...   |
187 | |                     }
188 | |                 }
    | |_________________^
    |
    = note: `-D clippy::collapsible-if` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
    |
166 ~                 if successful_merge_count > 0 && (done || self.v[end_idx].data != self.v[equal_since_idx].data) {
167 +                     // Everything in `equal_since..end` was equal. Make them just one element covering
168 +                     // the entire range.
169 +                     let removed_elems = end_idx - equal_since_idx - 1; // number of elements that we would remove
170 +                     if removed_elems > 0 {
171 +                         // Adjust the range of the first element to cover all of them.
  ...

error: this `else { if .. }` block can be collapsed
   --> src/shims/foreign_items.rs:114:16
    |
114 |           } else {
    |  ________________^
115 | |             if new_size == 0 {
116 | |                 this.deallocate_ptr(old_ptr, None, kind.into())?;
117 | |                 Ok(Pointer::null())
...   |
127 | |             }
128 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
114 ~         } else if new_size == 0 {
115 +             this.deallocate_ptr(old_ptr, None, kind.into())?;
116 +             Ok(Pointer::null())
117 +         } else {
118 +             let new_ptr = this.reallocate_ptr(
119 +                 old_ptr,
  ...

error: this `else { if .. }` block can be collapsed
   --> src/shims/posix/sync.rs:459:20
    |
459 |               } else {
    |  ____________________^
460 | |                 if is_mutex_kind_default(this, kind)?
461 | |                     || is_mutex_kind_normal(this, kind)?
462 | |                     || kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")?
...   |
472 | |                 }
473 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
459 ~             } else if is_mutex_kind_default(this, kind)?
460 +                 || is_mutex_kind_normal(this, kind)?
461 +                 || kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")?
462 +             {
463 +                 this.eval_libc_i32("EBUSY")
464 +             } else if kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")? {
  ...

error: this `if` statement can be collapsed
   --> src/thread.rs:132:9
    |
132 | /         if self.state == ThreadState::Enabled {
133 | |             if self.stack.is_empty() {
134 | |                 self.state = ThreadState::Terminated;
135 | |                 return true;
136 | |             }
137 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
    |
132 ~         if self.state == ThreadState::Enabled && self.stack.is_empty() {
133 +             self.state = ThreadState::Terminated;
134 +             return true;
135 +         }
    |

error: this `if` statement can be collapsed
   --> src/thread.rs:523:13
    |
523 | /             if thread.state == ThreadState::Enabled {
524 | |                 if !self.yield_active_thread || id != self.active_thread {
525 | |                     self.active_thread = id;
526 | |                     if let Some(data_race) = data_race {
...   |
530 | |                 }
531 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
    |
523 ~             if thread.state == ThreadState::Enabled && (!self.yield_active_thread || id != self.active_thread) {
524 +                 self.active_thread = id;
525 +                 if let Some(data_race) = data_race {
526 +                     data_race.thread_set_active(self.active_thread);
527 +                 }
528 +                 break;
  ...

error: you should consider adding a `Default` implementation for `GlobalState`
    --> src/data_race.rs:1132:5
     |
1132 | /     pub fn new() -> Self {
1133 | |         let mut global_state = GlobalState {
1134 | |             multi_threaded: Cell::new(false),
1135 | |             vector_clocks: RefCell::new(IndexVec::new()),
...    |
1155 | |         global_state
1156 | |     }
     | |_____^
     |
     = note: `-D clippy::new-without-default` implied by `-D clippy::all`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
     |
1129 + impl Default for GlobalState {
1130 +     fn default() -> Self {
1131 +         Self::new()
1132 +     }
1133 + }
     |

error: useless use of `format!`
   --> src/diagnostics.rs:155:32
    |
155 |                         (None, format!("pass the flag `-Zmiri-disable-isolation` to disable isolation;")),
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"pass the flag `-Zmiri-disable-isolation` to disable isolation;".to_string()`
    |
    = note: `-D clippy::useless-format` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:156:32
    |
156 | ...e, format!("or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning"...
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:161:32
    |
161 | ...e, format!("this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental"...
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:197:33
    |
197 | ...e, format!("this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support")...
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:202:32
    |
202 | ...  (None, format!("this usually indicates that your program performed an invalid operation and caused Undefined Behavior")),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"this usually indicates that your program performed an invalid operation and caused Undefined Behavior".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:203:32
    |
203 |                         (None, format!("but due to `-Zmiri-symbolic-alignment-check`, alignment errors can also be false positives")),
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"but due to `-Zmiri-symbolic-alignment-check`, alignment errors can also be false positives".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:207:32
    |
207 | ...  (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: useless use of `format!`
   --> src/diagnostics.rs:208:32
    |
208 | ...(None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")),
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/diagnostics.rs:247:5
    |
247 | /     match e.kind() {
248 | |         UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => {
249 | |             eprintln!(
250 | |                 "Uninitialized read occurred at offsets 0x{:x}..0x{:x} into this allocation:",
...   |
256 | |         _ => {}
257 | |     }
    | |_____^
    |
    = note: `-D clippy::single-match` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
247 ~     if let UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) = e.kind() {
248 +         eprintln!(
249 +             "Uninitialized read occurred at offsets 0x{:x}..0x{:x} into this allocation:",
250 +             access.uninit_offset.bytes(),
251 +             access.uninit_offset.bytes() + access.uninit_size.bytes(),
252 +         );
  ...

error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
  --> src/machine.rs:92:1
   |
92 | impl Into<MemoryKind<MiriMemoryKind>> for MiriMemoryKind {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::from-over-into` implied by `-D clippy::all`
   = help: consider to implement `From<machine::MiriMemoryKind>` instead
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into

error: manual implementation of `Option::map`
   --> src/machine.rs:570:22
    |
570 |           let stacks = if let Some(stacked_borrows) = &ecx.machine.stacked_borrows {
    |  ______________________^
571 | |             Some(Stacks::new_allocation(id, alloc.size(), stacked_borrows, kind))
572 | |         } else {
573 | |             None
574 | |         };
    | |_________^ help: try this: `ecx.machine.stacked_borrows.as_ref().map(|stacked_borrows| Stacks::new_allocation(id, alloc.size(), stacked_borrows, kind))`
    |
    = note: `-D clippy::manual-map` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map

error: manual implementation of `Option::map`
   --> src/machine.rs:575:26
    |
575 |           let race_alloc = if let Some(data_race) = &ecx.machine.data_race {
    |  __________________________^
576 | |             Some(data_race::AllocExtra::new_allocation(data_race, alloc.size(), kind))
577 | |         } else {
578 | |             None
579 | |         };
    | |_________^ help: try this: `ecx.machine.data_race.as_ref().map(|data_race| data_race::AllocExtra::new_allocation(data_race, alloc.size(), kind))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map

error: variant name ends with the enum's name
   --> src/shims/intrinsics.rs:354:21
    |
354 |                     MirOp(mir::UnOp),
    |                     ^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::enum-variant-names` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

error: variant name ends with the enum's name
   --> src/shims/intrinsics.rs:453:21
    |
453 |                     MirOp(BinOp),
    |                     ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

error: variant name ends with the enum's name
   --> src/shims/intrinsics.rs:454:21
    |
454 |                     SaturatingOp(BinOp),
    |                     ^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

error: variant name ends with the enum's name
   --> src/shims/intrinsics.rs:580:21
    |
580 |                     MirOp(BinOp),
    |                     ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
    --> src/shims/intrinsics.rs:1391:1
     |
1391 | fn simd_element_to_bool<'tcx>(elem: ImmTy<'tcx, Tag>) -> InterpResult<'tcx, bool> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `-D clippy::needless-lifetimes` implied by `-D clippy::all`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

error: this `if` has identical blocks
   --> src/shims/posix/sync.rs:503:75
    |
503 |               } else if kind == this.eval_libc("PTHREAD_MUTEX_ERRORCHECK")? {
    |  ___________________________________________________________________________^
504 | |                 this.eval_libc_i32("EPERM")
505 | |             } else if kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")? {
    | |_____________^
    |
    = note: `-D clippy::if-same-then-else` implied by `-D clippy::all`
note: same as this
   --> src/shims/posix/sync.rs:505:74
    |
505 |               } else if kind == this.eval_libc("PTHREAD_MUTEX_RECURSIVE")? {
    |  __________________________________________________________________________^
506 | |                 this.eval_libc_i32("EPERM")
507 | |             } else {
    | |_____________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else

error: this `if` has identical blocks
   --> src/shims/posix/sync.rs:610:57
    |
610 |           if this.rwlock_reader_unlock(id, active_thread) {
    |  _________________________________________________________^
611 | |             Ok(0)
612 | |         } else if this.rwlock_writer_unlock(id, active_thread) {
    | |_________^
    |
note: same as this
   --> src/shims/posix/sync.rs:612:64
    |
612 |           } else if this.rwlock_writer_unlock(id, active_thread) {
    |  ________________________________________________________________^
613 | |             Ok(0)
614 | |         } else {
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else

error: useless use of `format!`
   --> src/stacked_borrows.rs:228:14
    |
228 |           url: format!(
    |  ______________^
229 | |             "https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md"
230 | |         ),
    | |_________^ help: consider using `.to_string()`: `"https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md".to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

error: field assignment outside of initializer for an instance created with Default::default()
   --> src/thread.rs:234:9
    |
234 |         main_thread.join_status = ThreadJoinStatus::Detached;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::field-reassign-with-default` implied by `-D clippy::all`
note: consider initializing the variable with `Thread::<'_, '_> { join_status: ThreadJoinStatus::Detached, ..Default::default() }` and removing relevant reassignments
   --> src/thread.rs:232:9
    |
232 |         let mut main_thread = Thread::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

error: `if` chain can be rewritten with `match`
   --> src/vector_clock.rs:224:17
    |
224 | /                 if l > r {
225 | |                     return false;
226 | |                 } else if l < r {
227 | |                     equal = false;
228 | |                 }
    | |_________________^
    |
    = note: `-D clippy::comparison-chain` implied by `-D clippy::all`
    = help: consider rewriting the `if` chain to use `cmp` and `match`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: `if` chain can be rewritten with `match`
   --> src/vector_clock.rs:278:17
    |
278 | /                 if l < r {
279 | |                     return false;
280 | |                 } else if l > r {
281 | |                     equal = false;
282 | |                 }
    | |_________________^
    |
    = help: consider rewriting the `if` chain to use `cmp` and `match`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain

error: manual `RangeInclusive::contains` implementation
   --> src/bin/miri.rs:473:37
    |
473 |                         Ok(rate) if rate >= 0.0 && rate <= 1.0 => rate,
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0.0..=1.0).contains(&rate)`
    |
    = note: `-D clippy::manual-range-contains` implied by `-D clippy::all`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
```
</details>

2 years agoAuto merge of #2092 - dtolnay-contrib:checkoutv3, r=oli-obk
bors [Sat, 30 Apr 2022 05:10:05 +0000 (05:10 +0000)]
Auto merge of #2092 - dtolnay-contrib:checkoutv3, r=oli-obk

Update GitHub Actions actions/checkout@v2 to v3

The v2 implementation uses Node 12, which is end-of-life on April 30, 2022. See https://nodejs.org/en/about/releases/. Update to v3, which is based on Node 16 whose support lasts until April 30, 2024.

2 years agoUpdate GitHub Actions actions/checkout@v2 to v3
David Tolnay [Sat, 30 Apr 2022 03:25:04 +0000 (20:25 -0700)]
Update GitHub Actions actions/checkout@v2 to v3

The v2 implementation uses Node 12, which is end-of-life on April 30, 2022.
See https://nodejs.org/en/about/releases/. Update to v3, which is based on
Node 16 whose support lasts until April 30, 2024.

2 years agoKeep remaining clippy ignores
David Tolnay [Fri, 29 Apr 2022 23:03:38 +0000 (16:03 -0700)]
Keep remaining clippy ignores

2 years agoResolve clippy::useless_conversion
David Tolnay [Fri, 29 Apr 2022 22:59:42 +0000 (15:59 -0700)]
Resolve clippy::useless_conversion

    error: useless conversion to the same type: `rustc_const_eval::interpret::Pointer<std::option::Option<machine::Tag>>`
       --> src/helpers.rs:668:36
        |
    668 |                 this.get_ptr_alloc(ptr.offset(len, this)?.into(), size1, Align::ONE)?.unwrap(); // not a ZST, so we will get a result
        |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `ptr.offset(len, this)?`
        |
        = note: `-D clippy::useless-conversion` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `rustc_const_eval::interpret::Pointer<std::option::Option<machine::Tag>>`
       --> src/helpers.rs:678:29
        |
    678 |         this.read_bytes_ptr(ptr.into(), len)
        |                             ^^^^^^^^^^ help: consider removing `.into()`: `ptr`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `rustc_const_eval::interpret::Pointer<std::option::Option<machine::Tag>>`
       --> src/helpers.rs:690:44
        |
    690 |             let alloc = this.get_ptr_alloc(ptr.into(), size2, align2)?.unwrap(); // not a ZST, so we will get a result
        |                                            ^^^^^^^^^^ help: consider removing `.into()`: `ptr`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `rustc_const_eval::interpret::OpTy<machine::Tag>`
       --> src/shims/intrinsics.rs:778:42
        |
    778 |                         .read_immediate(&this.operand_index(index, i)?.into())?
        |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `this.operand_index(index, i)?`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `u32`
        --> src/shims/posix/fs.rs:1171:26
         |
    1171 |             builder.mode(mode.into());
         |                          ^^^^^^^^^^^ help: consider removing `.into()`: `mode`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `std::ffi::OsString`
      --> src/shims/env.rs:67:53
       |
    67 |                     ecx.machine.env_vars.map.insert(OsString::from(name), var_ptr);
       |                                                     ^^^^^^^^^^^^^^^^^^^^ help: consider removing `OsString::from()`: `name`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `rustc_const_eval::interpret::Scalar<machine::Tag>`
       --> src/shims/tls.rs:102:44
        |
    102 |                 Ok(value.unwrap_or_else(|| Scalar::null_ptr(cx).into()))
        |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `Scalar::null_ptr(cx)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

    error: useless conversion to the same type: `u32`
      --> src/thread.rs:73:26
       |
    73 |         Scalar::from_u32(u32::try_from(self.0).unwrap())
       |                          ^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider removing `u32::try_from()`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

2 years agoResolve clippy::unnecessary_mut_passed
David Tolnay [Fri, 29 Apr 2022 22:59:03 +0000 (15:59 -0700)]
Resolve clippy::unnecessary_mut_passed

    error: the method `validate_lock_acquire` doesn't need a mutable reference
       --> src/sync.rs:477:49
        |
    477 |                 data_race.validate_lock_acquire(&mut condvar.data_race, waiter.thread);
        |                                                 ^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::unnecessary-mut-passed` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

2 years agoResolve clippy::single_char_pattern
David Tolnay [Fri, 29 Apr 2022 22:58:13 +0000 (15:58 -0700)]
Resolve clippy::single_char_pattern

    error: single-character string constant used as pattern
       --> src/helpers.rs:805:36
        |
    805 |         .map(|crates| crates.split(",").map(|krate| krate.to_string()).collect::<Vec<_>>())
        |                                    ^^^ help: try using a `char` instead: `','`
        |
        = note: `-D clippy::single-char-pattern` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

2 years agoResolve clippy::single_char_add_str
David Tolnay [Fri, 29 Apr 2022 22:57:35 +0000 (15:57 -0700)]
Resolve clippy::single_char_add_str

    error: calling `push_str()` using a single-character string literal
       --> src/diagnostics.rs:299:9
        |
    299 |         helps.last_mut().unwrap().1.push_str("\n");
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `helps.last_mut().unwrap().1.push('\n')`
        |
        = note: `-D clippy::single-char-add-str` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str

2 years agoResolve clippy::redundant_field_names
David Tolnay [Fri, 29 Apr 2022 22:56:46 +0000 (15:56 -0700)]
Resolve clippy::redundant_field_names

    error: redundant field names in struct initialization
       --> src/helpers.rs:199:34
        |
    199 |         let place = mir::Place { local: local, projection: List::empty() };
        |                                  ^^^^^^^^^^^^ help: replace it with: `local`
        |
        = note: `-D clippy::redundant-field-names` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

    error: redundant field names in struct initialization
       --> src/thread.rs:238:13
        |
    238 |             threads: threads,
        |             ^^^^^^^^^^^^^^^^ help: replace it with: `threads`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

2 years agoResolve clippy::redundant_closure
David Tolnay [Fri, 29 Apr 2022 22:55:55 +0000 (15:55 -0700)]
Resolve clippy::redundant_closure

    error: redundant closure
       --> src/data_race.rs:787:18
        |
    787 |             .map(|idx| VectorIdx::new(idx))
        |                  ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `VectorIdx::new`
        |
        = note: `-D clippy::redundant-closure` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

    error: redundant closure
      --> src/thread.rs:61:31
       |
    61 |         u32::try_from(id).map(|id_u32| Self(id_u32))
       |                               ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Self`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

2 years agoResolve clippy::op_ref
David Tolnay [Fri, 29 Apr 2022 22:54:09 +0000 (15:54 -0700)]
Resolve clippy::op_ref

    error: taken reference of right operand
      --> src/shims/env.rs:53:63
       |
    53 |                     true => !excluded_env_vars.iter().any(|v| v.as_str() == &name),
       |                                                               ^^^^^^^^^^^^^^-----
       |                                                                             |
       |                                                                             help: use the right value directly: `name`
       |
       = note: `-D clippy::op-ref` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref

    error: taken reference of right operand
      --> src/shims/env.rs:54:71
       |
    54 |                     false => config.forwarded_env_vars.iter().any(|v| v.as_str() == &name),
       |                                                                       ^^^^^^^^^^^^^^-----
       |                                                                                     |
       |                                                                                     help: use the right value directly: `name`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref

2 years agoResolve clippy::needless_return
David Tolnay [Fri, 29 Apr 2022 22:48:24 +0000 (15:48 -0700)]
Resolve clippy::needless_return

    error: unneeded `return` statement
       --> src/helpers.rs:734:13
        |
    734 |             return Ok(());
        |             ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
        |
        = note: `-D clippy::needless-return` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/range_map.rs:113:9
        |
    113 |         return true;
        |         ^^^^^^^^^^^^ help: remove `return`: `true`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/shims/posix/fs.rs:648:25
        |
    648 |                 None => return this.handle_not_found(),
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `this.handle_not_found()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
      --> src/shims/panic.rs:62:9
       |
    62 |         return Ok(());
       |         ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/shims/panic.rs:115:9
        |
    115 |         return Ok(());
        |         ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/thread.rs:477:9
        |
    477 |         return free_tls_statics;
        |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `free_tls_statics`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

    error: unneeded `return` statement
       --> src/thread.rs:459:17
        |
    459 |                 return false;
        |                 ^^^^^^^^^^^^^ help: remove `return`: `false`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

2 years agoImplement llvm.x86.addcarry.64
David Tolnay [Fri, 29 Apr 2022 21:37:54 +0000 (14:37 -0700)]
Implement llvm.x86.addcarry.64

2 years agoResolve clippy::needless_question_mark
David Tolnay [Fri, 29 Apr 2022 22:47:57 +0000 (15:47 -0700)]
Resolve clippy::needless_question_mark

    error: question mark operator is useless here
      --> src/helpers.rs:86:16
       |
    86 |         return Ok(const_val.check_init()?);
       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `const_val.check_init()`
       |
       = note: `-D clippy::needless-question-mark` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark

2 years agoResolve clippy::needless_lifetimes
David Tolnay [Fri, 29 Apr 2022 22:43:36 +0000 (15:43 -0700)]
Resolve clippy::needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
      --> src/range_map.rs:66:5
       |
    66 |     pub fn iter<'a>(&'a self, offset: Size, len: Size) -> impl Iterator<Item = (Size, &'a T)> + 'a {
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `-D clippy::needless-lifetimes` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
      --> src/range_map.rs:86:5
       |
    86 |     pub fn iter_mut_all<'a>(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a {
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
       --> src/range_map.rs:122:5
        |
    122 | /     pub fn iter_mut<'a>(
    123 | |         &'a mut self,
    124 | |         offset: Size,
    125 | |         len: Size,
    126 | |     ) -> impl Iterator<Item = (Size, &'a mut T)> + 'a
        | |_____________________________________________________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
        --> src/shims/intrinsics.rs:1391:1
         |
    1391 | fn simd_element_to_bool<'tcx>(elem: ImmTy<'tcx, Tag>) -> InterpResult<'tcx, bool> {
         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

2 years agoResolve clippy::needless_borrow
David Tolnay [Fri, 29 Apr 2022 22:40:28 +0000 (15:40 -0700)]
Resolve clippy::needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/data_race.rs:565:34
        |
    565 |         this.validate_atomic_rmw(&place, atomic)?;
        |                                  ^^^^^^ help: change this to: `place`
        |
        = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/data_race.rs:1413:27
         |
    1413 |         clocks.clock.join(&lock);
         |                           ^^^^^ help: change this to: `lock`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/helpers.rs:326:51
        |
    326 |                         .size_and_align_of_mplace(&place)?
        |                                                   ^^^^^^ help: change this to: `place`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/helpers.rs:365:17
        |
    365 |                 &self.ecx
        |                 ^^^^^^^^^ help: change this to: `self.ecx`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/helpers.rs:634:47
        |
    634 |         let seconds_place = this.mplace_field(&tp, 0)?;
        |                                               ^^^ help: change this to: `tp`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/helpers.rs:637:51
        |
    637 |         let nanoseconds_place = this.mplace_field(&tp, 1)?;
        |                                                   ^^^ help: change this to: `tp`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/machine.rs:547:73
        |
    547 |         let link_name = match ecx.tcx.sess.first_attr_value_str_by_name(&attrs, sym::link_name) {
        |                                                                         ^^^^^^ help: change this to: `attrs`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/machine.rs:576:56
        |
    576 |             Some(data_race::AllocExtra::new_allocation(&data_race, alloc.size(), kind))
        |                                                        ^^^^^^^^^^ help: change this to: `data_race`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/foreign_items.rs:241:43
        |
    241 |             .first_attr_value_str_by_name(&attrs, sym::link_name)
        |                                           ^^^^^^ help: change this to: `attrs`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/intrinsics.rs:778:61
        |
    778 |                         .read_immediate(&this.operand_index(&index, i)?.into())?
        |                                                             ^^^^^^ help: change this to: `index`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/shims/intrinsics.rs:1195:44
         |
    1195 |                 this.write_immediate(*old, &dest)?; // old value is returned
         |                                            ^^^^^ help: change this to: `dest`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/shims/intrinsics.rs:1200:44
         |
    1200 |                 this.write_immediate(*old, &dest)?; // old value is returned
         |                                            ^^^^^ help: change this to: `dest`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
      --> src/shims/posix/fs.rs:54:12
       |
    54 |         Ok(&self)
       |            ^^^^^ help: change this to: `self`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/posix/fs.rs:654:49
        |
    654 |                 let io_result = maybe_sync_file(&file, *writable, File::sync_all);
        |                                                 ^^^^^ help: change this to: `file`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/posix/fs.rs:746:52
        |
    746 |                 file_descriptor.write(communicate, &bytes)?.map(|c| i64::try_from(c).unwrap());
        |                                                    ^^^^^^ help: change this to: `bytes`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/shims/posix/fs.rs:1494:45
         |
    1494 |             let io_result = maybe_sync_file(&file, *writable, File::sync_all);
         |                                             ^^^^^ help: change this to: `file`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/shims/posix/fs.rs:1516:45
         |
    1516 |             let io_result = maybe_sync_file(&file, *writable, File::sync_data);
         |                                             ^^^^^ help: change this to: `file`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> src/shims/posix/fs.rs:1561:45
         |
    1561 |             let io_result = maybe_sync_file(&file, *writable, File::sync_data);
         |                                             ^^^^^ help: change this to: `file`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/env.rs:232:65
        |
    232 |             let var_ptr = alloc_env_var_as_c_str(&name, &value, &mut this)?;
        |                                                                 ^^^^^^^^^ help: change this to: `this`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/env.rs:277:68
        |
    277 |             let var_ptr = alloc_env_var_as_wide_str(&name, &value, &mut this)?;
        |                                                                    ^^^^^^^^^ help: change this to: `this`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/env.rs:328:37
        |
    328 |         let buf = this.read_pointer(&buf_op)?;
        |                                     ^^^^^^^ help: change this to: `buf_op`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
       --> src/shims/env.rs:329:37
        |
    329 |         let size = this.read_scalar(&size_op)?.to_machine_usize(&*this.tcx)?;
        |                                     ^^^^^^^^ help: change this to: `size_op`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

2 years agoResolve clippy::mem_replace_with_default
David Tolnay [Fri, 29 Apr 2022 22:39:51 +0000 (15:39 -0700)]
Resolve clippy::mem_replace_with_default

    error: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
      --> src/helpers.rs:54:29
       |
    54 |                 for item in mem::replace(&mut items, Default::default()).iter() {
       |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut items)`
       |
       = note: `-D clippy::mem-replace-with-default` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default

2 years agoResolve clippy::len_zero
David Tolnay [Fri, 29 Apr 2022 22:33:45 +0000 (15:33 -0700)]
Resolve clippy::len_zero

    error: length comparison to one
       --> src/shims/posix/thread.rs:102:12
        |
    102 |         if args.len() < 1 {
        |            ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `args.is_empty()`
        |
        = note: `-D clippy::len-zero` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

2 years agoResolve clippy::extra_unused_lifetimes
David Tolnay [Fri, 29 Apr 2022 22:29:01 +0000 (15:29 -0700)]
Resolve clippy::extra_unused_lifetimes

    error: this lifetime isn't used in the function definition
      --> src/helpers.rs:46:20
       |
    46 | fn try_resolve_did<'mir, 'tcx>(tcx: TyCtxt<'tcx>, path: &[&str]) -> Option<DefId> {
       |                    ^^^^
       |
       = note: `-D clippy::extra-unused-lifetimes` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

    error: this lifetime isn't used in the function definition
      --> src/shims/posix/fs.rs:49:12
       |
    49 |     fn dup<'tcx>(&mut self) -> io::Result<Box<dyn FileDescriptor>>;
       |            ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

    error: this lifetime isn't used in the function definition
      --> src/shims/os_str.rs:81:41
       |
    81 |         pub fn u16vec_to_osstring<'tcx, 'a>(u16_vec: Vec<u16>) -> InterpResult<'tcx, OsString> {
       |                                         ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

    error: this lifetime isn't used in the function definition
      --> src/thread.rs:72:26
       |
    72 |     pub fn to_u32_scalar<'tcx>(&self) -> Scalar<Tag> {
       |                          ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

2 years agoResolve clippy::clone_on_copy
David Tolnay [Fri, 29 Apr 2022 22:26:28 +0000 (15:26 -0700)]
Resolve clippy::clone_on_copy

    error: using `clone` on type `std::option::Option<u128>` which implements the `Copy` trait
       --> src/shims/tls.rs:307:24
        |
    307 |         let last_key = this.machine.tls.dtors_running[&active_thread].last_dtor_key.clone();
        |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `this.machine.tls.dtors_running[&active_thread].last_dtor_key`
        |
        = note: `-D clippy::clone-on-copy` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

    error: using `clone` on type `stacked_borrows::Item` which implements the `Copy` trait
       --> src/stacked_borrows.rs:317:21
        |
    317 |                     item.clone(),
        |                     ^^^^^^^^^^^^ help: try dereferencing it: `*item`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

2 years agoResolve clippy::assign_op_pattern
David Tolnay [Fri, 29 Apr 2022 22:25:38 +0000 (15:25 -0700)]
Resolve clippy::assign_op_pattern

    error: manual implementation of an assign operation
       --> src/helpers.rs:673:17
        |
    673 |                 len = len + size1;
        |                 ^^^^^^^^^^^^^^^^^ help: replace it with: `len += size1`
        |
        = note: `-D clippy::assign-op-pattern` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

2 years agoSuppress all currently triggered clippy lints
David Tolnay [Fri, 29 Apr 2022 22:25:10 +0000 (15:25 -0700)]
Suppress all currently triggered clippy lints

2 years agoAdd readme entry
Oli Scherer [Tue, 26 Apr 2022 09:36:02 +0000 (09:36 +0000)]
Add readme entry

2 years agoRename flag, datastructure and messaging around muting stdout and stderr
Oli Scherer [Tue, 26 Apr 2022 09:33:20 +0000 (09:33 +0000)]
Rename flag, datastructure and messaging around muting stdout and stderr

2 years agoAuto merge of #2086 - nbdd0121:master, r=RalfJung
bors [Mon, 25 Apr 2022 21:17:52 +0000 (21:17 +0000)]
Auto merge of #2086 - nbdd0121:master, r=RalfJung

Update export_symbols

Follow up to rust-lang/rust#96402

2 years agoUpdate export_symbols
Gary Guo [Mon, 25 Apr 2022 20:34:40 +0000 (21:34 +0100)]
Update export_symbols

2 years agoImplement the output dropping for windows, too
Oli Scherer [Mon, 25 Apr 2022 14:22:55 +0000 (14:22 +0000)]
Implement the output dropping for windows, too

2 years agoAdd a command line flag to avoid printing to stdout and stderr
Oli Scherer [Mon, 25 Apr 2022 13:12:55 +0000 (13:12 +0000)]
Add a command line flag to avoid printing to stdout and stderr

2 years agoAuto merge of #2075 - y86-dev:master, r=RalfJung
bors [Thu, 21 Apr 2022 14:34:02 +0000 (14:34 +0000)]
Auto merge of #2075 - y86-dev:master, r=RalfJung

Allow to track multiple alloc-ids, call-ids and pointer tags

Closes #2073.

2 years agobe explicit about types
Ralf Jung [Thu, 21 Apr 2022 14:19:28 +0000 (16:19 +0200)]
be explicit about types

2 years agoAuto merge of #2080 - RalfJung:2phase, r=RalfJung
bors [Thu, 21 Apr 2022 14:10:20 +0000 (14:10 +0000)]
Auto merge of #2080 - RalfJung:2phase, r=RalfJung

make sure 2-phase borows work even with raw ptr tagging

2 years agomake sure 2-phase borows work even with raw ptr tagging
Ralf Jung [Thu, 21 Apr 2022 14:09:35 +0000 (16:09 +0200)]
make sure 2-phase borows work even with raw ptr tagging

2 years agoAdded support for multiple tracked pointers, allocs and calls
y86-dev [Wed, 20 Apr 2022 09:10:59 +0000 (11:10 +0200)]
Added support for multiple tracked pointers, allocs and calls

- Changed arg parsing to handle comma seperated list of `u64`'s.
- Changed type and field names of config, executor and global state
  to hold a set of tracked ids.
- Adjusted Readme:
    - explained list format
    - arguments do not overwrite, instead append
    - no effect on duplication
- Created a parsing function for comma separated lists
- Added error printing to alloc_id parsing

2 years agoAuto merge of #2078 - RalfJung:rustup, r=RalfJung
bors [Wed, 20 Apr 2022 21:46:55 +0000 (21:46 +0000)]
Auto merge of #2078 - RalfJung:rustup, r=RalfJung

rustup

https://github.com/rust-lang/rust/pull/93313 somehow made it so that this does not have to be mutable any more...

2 years agorustup
Ralf Jung [Wed, 20 Apr 2022 21:41:09 +0000 (17:41 -0400)]
rustup

2 years agoAuto merge of #2077 - RalfJung:more-test, r=RalfJung
bors [Wed, 20 Apr 2022 14:52:53 +0000 (14:52 +0000)]
Auto merge of #2077 - RalfJung:more-test, r=RalfJung

add some more tests

2 years agoadd mut_below_shr test
Ralf Jung [Wed, 20 Apr 2022 14:47:22 +0000 (10:47 -0400)]
add mut_below_shr test

2 years agoadd another test for #2068
Ralf Jung [Wed, 20 Apr 2022 14:39:17 +0000 (10:39 -0400)]
add another test for #2068

2 years agoAuto merge of #2071 - RalfJung:provenance, r=RalfJung
bors [Wed, 20 Apr 2022 12:44:39 +0000 (12:44 +0000)]
Auto merge of #2071 - RalfJung:provenance, r=RalfJung

adjust for provenance cleanup

This is the Miri side of https://github.com/rust-lang/rust/pull/96165

2 years agoadd test for https://github.com/rust-lang/miri/issues/2068
Ralf Jung [Wed, 20 Apr 2022 12:44:10 +0000 (08:44 -0400)]
add test for https://github.com/rust-lang/miri/issues/2068

2 years agorustup
Ralf Jung [Wed, 20 Apr 2022 12:44:06 +0000 (08:44 -0400)]
rustup

2 years agoavoid into_pointer_or_addr and into_parts in visit_freeze_sensitive
Ralf Jung [Mon, 18 Apr 2022 16:38:26 +0000 (12:38 -0400)]
avoid into_pointer_or_addr and into_parts in visit_freeze_sensitive

2 years agoadjust for provenance cleanup
Ralf Jung [Mon, 18 Apr 2022 14:20:11 +0000 (10:20 -0400)]
adjust for provenance cleanup

2 years agoAuto merge of #2074 - RalfJung:tls-ro, r=RalfJung
bors [Tue, 19 Apr 2022 18:56:58 +0000 (18:56 +0000)]
Auto merge of #2074 - RalfJung:tls-ro, r=RalfJung

do not consider thread-local allocations read-only

They are not in read-only memory the way regular `static`s are.

Fixes https://github.com/rust-lang/rust/issues/96191

2 years agodo not consider thread-local allocations read-only
Ralf Jung [Tue, 19 Apr 2022 18:56:07 +0000 (14:56 -0400)]
do not consider thread-local allocations read-only

2 years agoAuto merge of #2070 - RalfJung:size-assert, r=RalfJung
bors [Mon, 18 Apr 2022 01:58:52 +0000 (01:58 +0000)]
Auto merge of #2070 - RalfJung:size-assert, r=RalfJung

add size assertions for some core types

2 years agoadd size assertions for some core types
Ralf Jung [Mon, 18 Apr 2022 01:46:42 +0000 (21:46 -0400)]
add size assertions for some core types

2 years agoAuto merge of #2067 - RalfJung:strerror_r, r=RalfJung
bors [Sun, 17 Apr 2022 02:54:53 +0000 (02:54 +0000)]
Auto merge of #2067 - RalfJung:strerror_r, r=RalfJung

implement strerror_r

This isn't perfect; we end up using [this match](https://github.com/rust-lang/rust/blob/72a25d05bf1a4b155d74139ef700ff93af6d8e22/library/std/src/io/error.rs#L380) rather than the platform-specific messages, but at least we show something -- this is mostly informational anyway.

Cc https://github.com/rust-lang/miri/issues/2057

2 years agoimplement strerror_r
Ralf Jung [Sun, 17 Apr 2022 02:50:46 +0000 (22:50 -0400)]
implement strerror_r

2 years agoAuto merge of #2065 - RalfJung:readme, r=RalfJung
bors [Sat, 16 Apr 2022 13:17:56 +0000 (13:17 +0000)]
Auto merge of #2065 - RalfJung:readme, r=RalfJung

readme

We support SIMD these days. :D At least via portable-simd.

2 years agoreadme
Ralf Jung [Sat, 16 Apr 2022 13:13:40 +0000 (09:13 -0400)]
readme

2 years agoAuto merge of #2064 - RalfJung:rustup, r=RalfJung
bors [Sat, 16 Apr 2022 12:42:58 +0000 (12:42 +0000)]
Auto merge of #2064 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Sat, 16 Apr 2022 12:41:34 +0000 (08:41 -0400)]
rustup

2 years agoAuto merge of #2063 - RalfJung:macos-timeout, r=RalfJung
bors [Sun, 10 Apr 2022 15:24:33 +0000 (15:24 +0000)]
Auto merge of #2063 - RalfJung:macos-timeout, r=RalfJung

increase slack for timeout test

This still sometimes fails on macOS, so let's increase the slack.

2 years agoincrease slack for timeout test
Ralf Jung [Sun, 10 Apr 2022 15:23:56 +0000 (11:23 -0400)]
increase slack for timeout test

2 years agoAuto merge of #2062 - RalfJung:rustup, r=RalfJung
bors [Sun, 10 Apr 2022 13:37:33 +0000 (13:37 +0000)]
Auto merge of #2062 - RalfJung:rustup, r=RalfJung

rustup

https://github.com/rust-lang/rust/pull/95621 made channels strict provenance compliant. :)

2 years agorustup
Ralf Jung [Sun, 10 Apr 2022 13:36:30 +0000 (09:36 -0400)]
rustup

2 years agoAuto merge of #2061 - RalfJung:edition, r=RalfJung
bors [Sat, 9 Apr 2022 16:45:09 +0000 (16:45 +0000)]
Auto merge of #2061 - RalfJung:edition, r=RalfJung

port Miri to edition 2021

`cargo fix --edition` didn't change anything for either of these crates, so this looks like a very simple port. And then we can remove a bunch of annoying imports. :)

I thought this also unlocks the named format string stuff, but it seems that works on all editions except for that problem around `panic!`. Whatever. ;)

2 years agouse new format string syntax in some places
Ralf Jung [Sat, 9 Apr 2022 15:22:18 +0000 (11:22 -0400)]
use new format string syntax in some places

2 years agoremove no longer needed imports
Ralf Jung [Sat, 9 Apr 2022 15:20:32 +0000 (11:20 -0400)]
remove no longer needed imports

2 years agoport cargo-miri to edition 2021
Ralf Jung [Sat, 9 Apr 2022 15:17:16 +0000 (11:17 -0400)]
port cargo-miri to edition 2021

2 years agoport Miri to edition 2021
Ralf Jung [Sat, 9 Apr 2022 15:16:50 +0000 (11:16 -0400)]
port Miri to edition 2021

2 years agoAuto merge of #2060 - RalfJung:rustup, r=RalfJung
bors [Sat, 9 Apr 2022 13:42:12 +0000 (13:42 +0000)]
Auto merge of #2060 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/95844

2 years agorustup
Ralf Jung [Sat, 9 Apr 2022 13:41:29 +0000 (09:41 -0400)]
rustup

2 years agoAuto merge of #2055 - RalfJung:rustup, r=RalfJung
bors [Fri, 8 Apr 2022 13:57:45 +0000 (13:57 +0000)]
Auto merge of #2055 - RalfJung:rustup, r=RalfJung

Rustup

Fixes https://github.com/rust-lang/miri/issues/1717

2 years agorustup
Ralf Jung [Fri, 8 Apr 2022 12:01:19 +0000 (08:01 -0400)]
rustup

2 years agothread name setting works with strict provenance now :)
Ralf Jung [Thu, 7 Apr 2022 20:39:18 +0000 (16:39 -0400)]
thread name setting works with strict provenance now :)

2 years agofix Windows stdout/stderr
Ralf Jung [Thu, 7 Apr 2022 19:03:57 +0000 (15:03 -0400)]
fix Windows stdout/stderr