about summary refs log tree commit diff
path: root/src/tools/miri
AgeCommit message (Collapse)AuthorLines
2025-02-06remove use of `feature(trait_upcasting)` from miriWaffle Lapkin-9/+2
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-15/+15
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-02-06Merge pull request #4181 from tiif/check_shim_variadicRalf Jung-101/+129
Throw ub error when invoking non-vararg shim with vararg import
2025-02-06some more argument checking cleanupRalf Jung-70/+77
2025-02-06inline a once-used functionRalf Jung-29/+16
2025-02-06Throw ub error when invoking non-vararg shim with vararg importtiif-2/+36
2025-02-06Auto merge of #136471 - safinaskar:parallel, r=SparrowLiibors-3/+2
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` This is continuation of https://github.com/rust-lang/rust/pull/132282 . I'm pretty sure I did everything right. In particular, I searched all occurrences of `Lrc` in submodules and made sure that they don't need replacement. There are other possibilities, through. We can define `enum Lrc<T> { Rc(Rc<T>), Arc(Arc<T>) }`. Or we can make `Lrc` a union and on every clone we can read from special thread-local variable. Or we can add a generic parameter to `Lrc` and, yes, this parameter will be everywhere across all codebase. So, if you think we should take some alternative approach, then don't merge this PR. But if it is decided to stick with `Arc`, then, please, merge. cc "Parallel Rustc Front-end" ( https://github.com/rust-lang/rust/issues/113349 ) r? SparrowLii `@rustbot` label WG-compiler-parallel
2025-02-06Merge pull request #4179 from rayslava/masterRalf Jung-1/+6
allow code to call geteuid()
2025-02-06Merge from rustcThe Miri Cronjob Bot-0/+5
2025-02-06Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-06allow code to call geteuid()Slava Barinov-1/+6
2025-02-05Merge pull request #4178 from RalfJung/rustupRalf Jung-3/+23
Rustup
2025-02-05bump default max parallelism up to 20Ralf Jung-2/+2
2025-02-05Merge from rustcRalf Jung-0/+20
2025-02-05Preparing for merge from rustcRalf Jung-1/+1
2025-02-05Merge pull request #4177 from psumbera/solaris-no-flockRalf Jung-77/+77
Use fcntl locking on Solaris instead of flock which is missing there.
2025-02-05use cfg_matchRalf Jung-82/+77
2025-02-05Fix build on Solaris where is no flock().Petr Sumbera-3/+8
2025-02-05Rollup merge of #128045 - pnkfelix:rustc-contracts, r=oli-obkLeón Orell Valerian Liehr-0/+5
#[contracts::requires(...)] + #[contracts::ensures(...)] cc https://github.com/rust-lang/rust/issues/128044 Updated contract support: attribute syntax for preconditions and postconditions, implemented via a series of desugarings that culminates in: 1. a compile-time flag (`-Z contract-checks`) that, similar to `-Z ub-checks`, attempts to ensure that the decision of enabling/disabling contract checks is delayed until the end user program is compiled, 2. invocations of lang-items that handle invoking the precondition, building a checker for the post-condition, and invoking that post-condition checker at the return sites for the function, and 3. intrinsics for the actual evaluation of pre- and post-condition predicates that third-party verification tools can intercept and reinterpret for their own purposes (e.g. creating shims of behavior that abstract away the function body and replace it solely with the pre- and post-conditions). Known issues: * My original intent, as described in the MCP (https://github.com/rust-lang/compiler-team/issues/759) was to have a rustc-prefixed attribute namespace (like rustc_contracts::requires). But I could not get things working when I tried to do rewriting via a rustc-prefixed builtin attribute-macro. So for now it is called `contracts::requires`. * Our attribute macro machinery does not provide direct support for attribute arguments that are parsed like rust expressions. I spent some time trying to add that (e.g. something that would parse the attribute arguments as an AST while treating the remainder of the items as a token-tree), but its too big a lift for me to undertake. So instead I hacked in something approximating that goal, by semi-trivially desugaring the token-tree attribute contents into internal AST constucts. This may be too fragile for the long-term. * (In particular, it *definitely* breaks when you try to add a contract to a function like this: `fn foo1(x: i32) -> S<{ 23 }> { ... }`, because its token-tree based search for where to inject the internal AST constructs cannot immediately see that the `{ 23 }` is within a generics list. I think we can live for this for the short-term, i.e. land the work, and continue working on it while in parallel adding a new attribute variant that takes a token-tree attribute alongside an AST annotation, which would completely resolve the issue here.) * the *intent* of `-Z contract-checks` is that it behaves like `-Z ub-checks`, in that we do not prematurely commit to including or excluding the contract evaluation in upstream crates (most notably, `core` and `std`). But the current test suite does not actually *check* that this is the case. Ideally the test suite would be extended with a multi-crate test that explores the matrix of enabling/disabling contracts on both the upstream lib and final ("leaf") bin crates.
2025-02-04Auto merge of #135760 - scottmcm:disjoint-bitor, r=WaffleLapkinbors-0/+20
Add `unchecked_disjoint_bitor` per ACP373 Following the names from libs-api in https://github.com/rust-lang/libs-team/issues/373#issuecomment-2085686057 Includes a fallback implementation so this doesn't have to update cg_clif or cg_gcc, and overrides it in cg_llvm to use `or disjoint`, which [is available in LLVM 18](https://releases.llvm.org/18.1.0/docs/LangRef.html#or-instruction) so hopefully we don't need any version checks.
2025-02-04intrinsics: unify rint, roundeven, nearbyint in a single round_ties_even ↵Ralf Jung-8/+8
intrinsic
2025-02-04update JSON target spec to declare softfloat ABIRalf Jung-0/+1
2025-02-04Merge from rustcThe Miri Cronjob Bot-3/+45
2025-02-04Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-03Contracts core intrinsics.Felix S. Klock II-0/+5
These are hooks to: 1. control whether contract checks are run 2. allow 3rd party tools to intercept and reintepret the results of running contracts.
2025-02-03Rollup merge of #136438 - RalfJung:offset_from_ub_errors, r=oli-obk许杰友 Jieyou Xu (Joe)-3/+45
miri: improve error when offset_from preconditions are violated Fixes https://github.com/rust-lang/miri/issues/4143
2025-02-03tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`Askar Safin-3/+2
2025-02-03Merge from rustcThe Miri Cronjob Bot-5/+3
2025-02-03Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-02Rollup merge of #136452 - RalfJung:miri-sync, r=RalfJungMatthias Krüger-545/+1347
Miri subtree update r? `@ghost` Unblocks https://github.com/rust-lang/rust/pull/122408 from the Miri side
2025-02-02Merge pull request #4142 from joboet/apple-futexRalf Jung-53/+626
shim Apple's futex primitives
2025-02-02shim Apple's futex primitivesjoboet-53/+626
This is necessary to unblock rust-lang/rust#122408. The documentation for these is available [here](https://developer.apple.com/documentation/os/os_sync_wait_on_address?language=objc). Because the futex wait operations (`os_sync_wait_on_address` et al.) return the number of remaining waiters after returning, this required some changes to the common futex infrastructure, which I've changed to take a callback instead of precalculating the return values.
2025-02-02Merge pull request #4172 from RalfJung/miri_get_backtraceRalf Jung-51/+14
miri_get_backtrace: stop supporting the v0 protocol
2025-02-02files: make write take callback to store result, rather than writing to ↵Ralf Jung-69/+72
'dest' directly
2025-02-02files: make read take callback to store result, rather than writing to ↵Ralf Jung-69/+86
'dest' directly
2025-02-02Some cleanups around EarlyDiagCtxtbjorn3-5/+3
All callers of EarlyDiagCtxt::early_error now emit a fatal error.
2025-02-02fix use of deprecated rand APIRalf Jung-1/+1
2025-02-02Merge from rustcRalf Jung-4/+44
2025-02-02Preparing for merge from rustcRalf Jung-1/+1
2025-02-02miri_get_backtrace: stop supporting the v0 protocolRalf Jung-51/+14
2025-02-02miri: improve error when offset_from preconditions are violatedRalf Jung-3/+45
2025-02-01Test getrandom 0.3Eduardo Sánchez Muñoz-1/+35
2025-02-01Bump rand to 0.9 and getrandom to 0.3Eduardo Sánchez Muñoz-35/+99
2025-01-31PR feedbackScott McMurray-0/+20
2025-02-01fmtThe Miri Cronjob Bot-72/+93
2025-02-01Merge from rustcThe Miri Cronjob Bot-1/+55
2025-02-01Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-02-01Rollup merge of #136348 - RalfJung:miri-float-min-max, r=oli-obkMatthias Krüger-4/+44
miri: make float min/max non-deterministic This makes Miri match the documentation that landed in https://github.com/rust-lang/rust/pull/136296. r? ``@oli-obk``
2025-01-31interpret: adjust vtable validity check for higher-ranked typesLukas Markeffsky-0/+75
2025-01-31Auto merge of #134424 - 1c3t3a:null-checks, r=saethlinbors-1/+1
Insert null checks for pointer dereferences when debug assertions are enabled Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a `MirPass`. This inserts checks in the same places as the `CheckAlignment` pass and additionally also inserts checks for `Borrows`, so code like ```rust let ptr: *const u32 = std::ptr::null(); let val: &u32 = unsafe { &*ptr }; ``` will have a check inserted on dereference. This is done because null references are UB. The alignment check doesn't cover these places, because in `&(*ptr).field`, the exact requirement is that the final reference must be aligned. This is something to consider further enhancements of the alignment check. For now this is implemented as a separate `MirPass`, to make it easy to disable this check if necessary. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177. r? `@saethlin`