Commit Graph

27 Commits

Author SHA1 Message Date
Ralf Jung
d6cbe5d014 ensure that RangeMap panics on OOB 2022-07-14 15:09:20 -04:00
David Tolnay
519755a823
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
2022-04-29 15:53:48 -07:00
David Tolnay
c6bd81bbf3
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
2022-04-29 15:47:19 -07:00
Ralf Jung
4e231bab5e format much of Miri 2021-05-16 11:48:28 +02:00
Ralf Jung
39f7b35327 Stacked Borrows: print affected memory location on errors 2020-10-28 12:04:39 +01:00
Ralf Jung
9f3383d55d rustup for import changes 2020-04-03 00:05:35 +02:00
Ralf Jung
8948a29a4c adjust for librustc rename; reduce 'extern crate' to rustc crates 2020-03-30 11:07:32 +02:00
Oliver Scherer
7ead530841 Rustfmt all the things 2019-12-23 12:56:23 +01:00
Ralf Jung
5e022773f3 fix unused variable warning 2019-07-06 09:32:35 +02:00
Ralf Jung
aa5a9bc152 some module comments 2019-06-29 14:15:05 +02:00
Alexander Regueiro
205490b85c Fixed nits raised in review. 2019-02-26 18:37:46 +00:00
Alexander Regueiro
12d3ecbaff Various cosmetic improvements. 2019-02-26 18:37:46 +00:00
Ralf Jung
c54d7eef07 expand docs 2019-01-07 19:41:18 +01:00
Ralf Jung
a957a36ddc tweak merging to give up if we don't make any progress 2019-01-07 19:36:25 +01:00
Ralf Jung
17d11ebe6e be explicit about doing a binary search; fix out-of-bounds check 2019-01-07 15:10:22 +01:00
Ralf Jung
4f9c14c256 deduplicate RangeMap elements in iter_mut
This cuts down execution time of the benchmark in the OP of https://github.com/solson/miri/issues/593 by another 25%, and it cuts max-RSS by 90% (!)
2019-01-07 15:10:22 +01:00
Ralf Jung
f24d0354f9 rewrite RangeMap to use a sorted Vec instead of a RangeMap
This gives us a 20% perf improve for the benchmark from https://github.com/solson/miri/issues/593
2019-01-07 15:10:22 +01:00
Ralf Jung
6c9e702d9b range_map: also test size of the internal representation 2019-01-07 15:10:22 +01:00
Ralf Jung
e9370d2b74 adjust for memory_allocated hook, make RangeMap preallocated with a fixed size 2018-11-27 14:25:20 +01:00
Ralf Jung
d4b78b36ab stacked borrows: enforcement at memory accesses 2018-10-17 15:15:53 +02:00
Ralf Jung
66b4bb7cf2 stacked borrows: track refs and derefs 2018-10-16 18:35:27 +02:00
Ralf Jung
259cc6e3dc rustup for big refactor; kill most of validation 2018-08-16 10:30:43 +02:00
Ralf Jung
a2f4d84f73
Merge branch 'master' into eq-hash 2018-07-13 08:29:42 +02:00
bjorn3
52bf4732fd Fix some clippy lints 2018-07-10 17:32:38 +02:00
bjorn3
f321593655 Workaround for rustc bug 2018-07-10 17:20:07 +02:00
Dylan MacKenzie
5a7f4412ee Implement Eq and Hash for MemoryData and Evaluator
In order to implement infinite loop detection while executing MIR, both
the implementor of `Machine` (`Evaluator`) and its associated type
(`MemoryData`), must implement `Eq` and `Hash`. This PR adds the
required trait implementations.

It's possible that the `Hash` implementations need to be improved; only
the `env_vars` field of `Evaluator` and the `thread_local` field of
`MemoryData` are actually being hashed. Omitting fields from a `Hash`
implementation is not incorrect, but could lead to collisions if the
ignored fields are changing constantly. Perhaps I should instead derive
`Hash` on a few more fields related to MIR validation?
2018-06-29 17:50:57 -07:00
Oliver Schneider
27fe263669
Move back to a normal folder structure 2018-05-09 14:37:00 +02:00