Commit Graph

6080 Commits

Author SHA1 Message Date
David Tolnay
2ca7f3b45d
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
2022-04-29 15:43:14 -07:00
David Tolnay
16c2400737
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
2022-04-29 15:39:56 -07:00
David Tolnay
168e87682f
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
2022-04-29 15:38:42 -07:00
David Tolnay
1fa63f1e9b
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
2022-04-29 15:38:12 -07:00
David Tolnay
9125cc1c28
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
2022-04-29 15:37:35 -07:00
David Tolnay
0389745203
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
2022-04-29 15:36:58 -07:00
David Tolnay
b0a51720c6
Suppress all currently triggered clippy lints 2022-04-29 15:26:54 -07:00
Oli Scherer
5e26cdaf3a Add readme entry 2022-04-26 09:36:02 +00:00
Oli Scherer
a192a199a8 Rename flag, datastructure and messaging around muting stdout and stderr 2022-04-26 09:33:20 +00:00
bors
a71a008393 Auto merge of #2086 - nbdd0121:master, r=RalfJung
Update export_symbols

Follow up to rust-lang/rust#96402
2022-04-25 21:17:52 +00:00
Gary Guo
f8f776fee9 Update export_symbols 2022-04-25 22:12:57 +01:00
Oli Scherer
1d0fe1b6bb Implement the output dropping for windows, too 2022-04-25 14:22:55 +00:00
Oli Scherer
4d4855c762 Add a command line flag to avoid printing to stdout and stderr 2022-04-25 13:12:55 +00:00
bors
3ac7ca4c19 Auto merge of #2075 - y86-dev:master, r=RalfJung
Allow to track multiple alloc-ids, call-ids and pointer tags

Closes #2073.
2022-04-21 14:34:02 +00:00
Ralf Jung
b472ef5bd8
be explicit about types 2022-04-21 16:19:28 +02:00
bors
2e419e4ff6 Auto merge of #2080 - RalfJung:2phase, r=RalfJung
make sure 2-phase borows work even with raw ptr tagging
2022-04-21 14:10:20 +00:00
Ralf Jung
3ca59d2fbf make sure 2-phase borows work even with raw ptr tagging 2022-04-21 16:09:35 +02:00
y86-dev
bf17dbebc9 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
2022-04-21 10:40:11 +02:00
bors
edd4858846 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...
2022-04-20 21:46:55 +00:00
Ralf Jung
432015d1f6 rustup 2022-04-20 17:46:31 -04:00
bors
ba24c311ee Auto merge of #2077 - RalfJung:more-test, r=RalfJung
add some more tests
2022-04-20 14:52:53 +00:00
Ralf Jung
e214e6db98 add mut_below_shr test 2022-04-20 10:52:25 -04:00
Ralf Jung
d4a85f6305 add another test for #2068 2022-04-20 10:39:17 -04:00
bors
c9039de613 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
2022-04-20 12:44:39 +00:00
Ralf Jung
b5a76c7ff0 add test for https://github.com/rust-lang/miri/issues/2068 2022-04-20 08:44:10 -04:00
Ralf Jung
dd968a89bf rustup 2022-04-20 08:44:06 -04:00
Ralf Jung
f1023fbdc9 avoid into_pointer_or_addr and into_parts in visit_freeze_sensitive 2022-04-20 08:40:19 -04:00
Ralf Jung
ec1dc749a3 adjust for provenance cleanup 2022-04-20 08:40:19 -04:00
bors
598ae7418b 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
2022-04-19 18:56:58 +00:00
Ralf Jung
763ff1c49f do not consider thread-local allocations read-only 2022-04-19 14:56:07 -04:00
bors
9d47a5633a Auto merge of #2070 - RalfJung:size-assert, r=RalfJung
add size assertions for some core types
2022-04-18 01:58:52 +00:00
Ralf Jung
5a3ec3780e add size assertions for some core types 2022-04-17 21:58:36 -04:00
bors
35aeba78db Auto merge of #2067 - RalfJung:strerror_r, r=RalfJung
implement strerror_r

This isn't perfect; we end up using [this match](72a25d05bf/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
2022-04-17 02:54:53 +00:00
Ralf Jung
db2c4b6dfa implement strerror_r 2022-04-16 22:54:38 -04:00
bors
d1f31f913c Auto merge of #2065 - RalfJung:readme, r=RalfJung
readme

We support SIMD these days. :D At least via portable-simd.
2022-04-16 13:17:56 +00:00
Ralf Jung
efe871f208 readme 2022-04-16 09:17:01 -04:00
bors
1ef91e1227 Auto merge of #2064 - RalfJung:rustup, r=RalfJung
rustup
2022-04-16 12:42:58 +00:00
Ralf Jung
0669b22759 rustup 2022-04-16 08:41:34 -04:00
bors
05bbfe84a9 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.
2022-04-10 15:24:33 +00:00
Ralf Jung
3f1d3aedcd increase slack for timeout test 2022-04-10 11:23:56 -04:00
bors
8a9ef3c248 Auto merge of #2062 - RalfJung:rustup, r=RalfJung
rustup

https://github.com/rust-lang/rust/pull/95621 made channels strict provenance compliant. :)
2022-04-10 13:37:33 +00:00
Ralf Jung
ebb70da4c6 rustup 2022-04-10 09:36:30 -04:00
bors
a4a667b3ce 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. ;)
2022-04-09 16:45:09 +00:00
Ralf Jung
507c09f45f use new format string syntax in some places 2022-04-09 11:32:49 -04:00
Ralf Jung
855af088b8 remove no longer needed imports 2022-04-09 11:32:49 -04:00
Ralf Jung
a57c30118a port cargo-miri to edition 2021 2022-04-09 11:17:16 -04:00
Ralf Jung
af3f683ba6 port Miri to edition 2021 2022-04-09 11:16:50 -04:00
bors
c568f32f16 Auto merge of #2060 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/95844
2022-04-09 13:42:12 +00:00
Ralf Jung
d2cb11cc15 rustup 2022-04-09 09:41:29 -04:00
bors
be72564a64 Auto merge of #2055 - RalfJung:rustup, r=RalfJung
Rustup

Fixes https://github.com/rust-lang/miri/issues/1717
2022-04-08 13:57:45 +00:00