about summary refs log tree commit diff
path: root/src/tools/miri/tests
AgeCommit message (Collapse)AuthorLines
2024-06-17show proper UB when making a too large allocation requestRalf Jung-0/+25
2024-06-16std: move `sys_common::backtrace` to `sys`joboet-17/+17
2024-06-15std: refactor the TLS implementationjoboet-3/+3
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-06-15Auto merge of #126518 - matthiaskrgr:rollup-wb70rzq, r=matthiaskrgrbors-98/+51
Rollup of 9 pull requests Successful merges: - #125829 (rustc_span: Add conveniences for working with span formats) - #126361 (Unify intrinsics body handling in StableMIR) - #126417 (Add `f16` and `f128` inline ASM support for `x86` and `x86-64`) - #126424 ( Also sort `crt-static` in `--print target-features` output) - #126428 (Polish `std::path::absolute` documentation.) - #126429 (Add `f16` and `f128` const eval for binary and unary operationations) - #126448 (End support for Python 3.8 in tidy) - #126488 (Use `std::path::absolute` in bootstrap) - #126511 (.mailmap: Associate both my work and my private email with me) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-14Add `f16` and `f128` support to MiriTrevor Gross-98/+51
2024-06-14add Miri testsRalf Jung-0/+61
2024-06-13Auto merge of #3622 - TDecking:sse4_2, r=RalfJungbors-0/+443
Implement LLVM x86 SSE4.2 intrinsics SSE4.2 is arguably the least important SIMD extension for the x86 ISA, but it should still be supported for the sake of completeness.
2024-06-13add some more CRC testsRalf Jung-0/+20
2024-06-13Implement LLVM x86 SSE4.2 intrinsicsTobias Decking-0/+423
2024-06-13fmtThe Miri Cronjob Bot-6/+12
2024-06-13Merge from rustcThe Miri Cronjob Bot-2/+167
2024-06-12Rollup merge of #126232 - RalfJung:dyn-trait-equality, r=oli-obkGuillaume Gomez-2/+42
interpret: dyn trait metadata check: equate traits in a proper way Hopefully fixes https://github.com/rust-lang/miri/issues/3541... unfortunately we don't have a testcase. The first commit is just a refactor without functional change. r? `@oli-obk`
2024-06-11interpret: ensure we check bool/char for validity when they are used in a castRalf Jung-0/+125
2024-06-11interpret: dyn trait metadata check: equate traits in a proper wayRalf Jung-0/+40
2024-06-11check for correct trait in size_and_align_ofRalf Jung-2/+2
2024-06-11Merge from rustcRalf Jung-0/+21
2024-06-10Rollup merge of #126184 - RalfJung:interpret-simd-nonpow2, r=oli-obkMatthias Krüger-0/+21
interpret: do not ICE on padded non-pow2 SIMD vectors Fixes https://github.com/rust-lang/miri/issues/3458 r? ``@oli-obk``
2024-06-10Add socketpair shimtiif-0/+180
2024-06-09Follow up fix for eventfd shimtiif-10/+15
2024-06-09interpret: do not ICE on padded non-pow2 SIMD vectorsRalf Jung-1/+22
2024-06-09simd_bitmask: work correctly for sizes like 24Ralf Jung-16/+55
2024-06-08Auto merge of #3655 - RalfJung:simd-bitmask, r=RalfJungbors-1/+39
portable-simd: add test for non-power-of-2 bitmask `@calebzulawski` is that the intended behavior? Specifically for arrays, the bitmask `[1, 0, 0, 1, 0, 0, 1, 0, 1, 0]` becomes - `[0b01001001, 0b01]` on little endian - `[0b10010010, 0b10]` on big endian
2024-06-08portable-simd: add test for non-power-of-2 bitmaskRalf Jung-1/+39
2024-06-08add support for `pclmulqdq`Folkert-0/+48
2024-06-08Add eventfd shimtiif-0/+163
2024-06-07Merge from rustcThe Miri Cronjob Bot-2/+14
2024-06-05Rollup merge of #125672 - Lokathor:update-miri-result-ffi, r=RalfJungMatthias Krüger-2/+14
Add more ABI test cases to miri (RFC 3391) Part of https://github.com/rust-lang/rust/issues/110503 cc `@RalfJung`
2024-06-05fmtThe Miri Cronjob Bot-3/+1
2024-06-05Merge from rustcThe Miri Cronjob Bot-52/+41
2024-06-03Add more ABI test cases.Lokathor-2/+14
2024-06-03Make WHERE_CLAUSES_OBJECT_SAFETY a regular object safety violationMichael Goulet-34/+0
2024-06-03Reformat `mir!` macro invocations to use braces.Nicholas Nethercote-18/+24
The `mir!` macro has multiple parts: - An optional return type annotation. - A sequence of zero or more local declarations. - A mandatory starting anonymous basic block, which is brace-delimited. - A sequence of zero of more additional named basic blocks. Some `mir!` invocations use braces with a "block" style, like so: ``` mir! { let _unit: (); { let non_copy = S(42); let ptr = std::ptr::addr_of_mut!(non_copy); // Inside `callee`, the first argument and `*ptr` are basically // aliasing places! Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { Return() } } ``` Some invocations use parens with a "block" style, like so: ``` mir!( let x: [i32; 2]; let one: i32; { x = [42, 43]; one = 1; x = [one, 2]; RET = Move(x); Return() } ) ``` And some invocations uses parens with a "tighter" style, like so: ``` mir!({ SetDiscriminant(*b, 0); Return() }) ``` This last style is generally used for cases where just the mandatory starting basic block is present. Its braces are placed next to the parens. This commit changes all `mir!` invocations to use braces with a "block" style. Why? - Consistency is good. - The contents of the invocation is a block of code, so it's odd to use parens. They are more normally used for function-like macros. - Most importantly, the next commit will enable rustfmt for `tests/mir-opt/`. rustfmt is more aggressive about formatting macros that use parens than macros that use braces. Without this commit's changes, rustfmt would break a couple of `mir!` macro invocations that use braces within `tests/mir-opt` by inserting an extraneous comma. E.g.: ``` mir!(type RET = (i32, bool);, { // extraneous comma after ';' RET.0 = 1; RET.1 = true; Return() }) ``` Switching those `mir!` invocations to use braces avoids that problem, resulting in this, which is nicer to read as well as being valid syntax: ``` mir! { type RET = (i32, bool); { RET.0 = 1; RET.1 = true; Return() } } ```
2024-05-31Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obkbors-0/+5
Implement `needs_async_drop` in rustc and optimize async drop glue This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948. Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](https://github.com/zetanumbers/rust/blob/67980dd6fb11917d23d01a19c2cf4cfc3978aac8/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-30explain what the open questions are, and add a Miri test for thatRalf Jung-0/+12
2024-05-30make env/var test deterministicRalf Jung-0/+3
2024-05-29Auto merge of #125360 - RalfJung:packed-field-reorder, r=fmeasebors-2/+2
don't inhibit random field reordering on repr(packed(1)) `inhibit_struct_field_reordering_opt` being false means we exclude this type from random field shuffling. However, `packed(1)` types can still be shuffled! The logic was added in https://github.com/rust-lang/rust/pull/48528 since it's pointless to reorder fields in packed(1) types (there's no padding that could be saved) -- but that shouldn't inhibit `-Zrandomize-layout` (which did not exist at the time). We could add an optimization elsewhere to not bother sorting the fields for `repr(packed)` types, but I don't think that's worth the effort. This *does* change the behavior in that we may now reorder fields of `packed(1)` structs (e.g. if there are niches, we'll try to move them to the start/end, according to `NicheBias`). We were always allowed to do that but so far we didn't. Quoting the [reference](https://doc.rust-lang.org/reference/type-layout.html): > On their own, align and packed do not provide guarantees about the order of fields in the layout of a struct or the layout of an enum variant, although they may be combined with representations (such as C) which do provide such guarantees.
2024-05-29Revert miri async drop test but add warnings to each async drop testDaria Sukhonina-50/+34
2024-05-29Bless new async destructor sizes in async drop testsDaria Sukhonina-5/+5
2024-05-29Add size check inside of the async drop testsDaria Sukhonina-29/+50
2024-05-28Add Miri smoke pass test for ptr_metadata intrinsicScott McMurray-1/+7
2024-05-28Add Miri tests for `PtrMetadata` UBScott McMurray-0/+142
2024-05-27MIR validation: ensure that downcast projection is followed by field projectionRalf Jung-1/+1
2024-05-25Merge from rustcThe Miri Cronjob Bot-1/+1
2024-05-24miri: receive the blessings of validate.rsJubilee Young-1/+1
2024-05-24Auto merge of #3626 - devnexen:pthread_name_illumos, r=oli-obkbors-1/+1
solaris add support for threadname. from std::unix::thread::set_name, pthread_setname_np is a weak symbol (not always had been available). Other than that, similar to linux only having twice of its buffer limit.
2024-05-24Merge from rustcThe Miri Cronjob Bot-24/+24
2024-05-23solaris add suport for threadname.David Carlier-1/+1
from std::unix::thread::set_name, pthread_setname_np is a weak symbol (not always had been available). Other than that, similar to linux only having twice of its buffer limit.
2024-05-23Merge from rustcThe Miri Cronjob Bot-342/+79
2024-05-23Auto merge of #125359 - RalfJung:interpret-overflowing-ops, r=oli-obkbors-24/+24
interpret: make overflowing binops just normal binops Follow-up to https://github.com/rust-lang/rust/pull/125173 (Cc `@scottmcm)`
2024-05-22Rollup merge of #124896 - RalfJung:miri-intrinsic-fallback, r=oli-obkLeón Orell Valerian Liehr-15/+15
miri: rename intrinsic_fallback_checks_ub to intrinsic_fallback_is_spec Checking UB is not the only concern, we also have to make sure we are not losing out on non-determinism. r? ``@oli-obk`` (not urgent, take your time)