about summary refs log tree commit diff
path: root/src/tools/miri
AgeCommit message (Collapse)AuthorLines
2024-06-09Use modulo operation to convert nanosecond to Durationtiif-7/+8
2024-06-09Remove testtiif-16/+0
2024-06-09Convert u128 to nanosecondtiif-12/+8
2024-06-09First attempttiif-7/+34
2024-06-09interpret: do not ICE on padded non-pow2 SIMD vectorsRalf Jung-1/+22
2024-06-09use strict ops in some placesRalf Jung-9/+8
2024-06-09simd_bitmask: work correctly for sizes like 24Ralf Jung-42/+122
2024-06-09simd_select_bitmask: fix intrinsic name in errorRalf Jung-2/+2
2024-06-09simd_bitmask: nicer error when the mask is too bigRalf Jung-2/+10
2024-06-08Preparing for merge from rustcRalf Jung-1/+1
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-08comment nitsRalf Jung-5/+5
2024-06-08add support for `pclmulqdq`Folkert-0/+117
2024-06-08Add eventfd shimtiif-19/+257
2024-06-07Remove --stage entirely from contributingNilstrieb-1/+1
2024-06-07Fix stage in contributingNilstrieb-2/+2
2024-06-07Merge from rustcThe Miri Cronjob Bot-4/+17
2024-06-07Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2024-06-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-2/+2
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-06-06Auto merge of #125958 - BoxyUwU:remove_const_ty, r=lcnrbors-0/+1
Remove the `ty` field from type system `Const`s Fixes #125556 Fixes #122908 Part of the work on `adt_const_params`/`generic_const_param_types`/`min_generic_const_exprs`/generally making the compiler nicer. cc rust-lang/project-const-generics#44 Please review commit-by-commit otherwise I wasted a lot of time not just squashing this into a giant mess (and also it'll be SO much nicer because theres a lot of fluff changes mixed in with other more careful changes if looking via File Changes --- Why do this? - The `ty` field keeps causing ICEs and weird behaviour due to it either being treated as "part of the const" or it being forgotten about leading to ICEs. - As we move forward with `adt_const_params` and a potential `min_generic_const_exprs` it's going to become more complex to actually lower the correct `Ty<'tcx>` - It muddles the idea behind how we check `Const` arguments have the correct type. By having the `ty` field it may seem like we ought to be relating it when we relate two types, or that its generally important information about the `Const`. - Brings the compiler more in line with `a-mir-formality` as that also tracks the type of type system `Const`s via `ConstArgHasType` bounds in the env instead of on the `Const` itself. - A lot of stuff is a lot nicer when you dont have to pass around the type of a const lol. Everywhere we construct `Const` is now significantly nicer :sweat_smile: See #125671's description for some more information about the `ty` field --- General summary of changes in this PR: - Add `Ty` to `ConstKind::Value` as otherwise there is no way to implement `ConstArgHasType` to ensure that const arguments are correctly typed for the parameter when we stop creating anon consts for all const args. It's also just incredibly difficult/annoying to thread the correct `Ty` around to a bunch of ctfe functions otherwise. - Fully implement `ConstArgHasType` in both the old and new solver. Since it now has no reliance on the `ty` field it serves its originally intended purpose of being able to act as a double check that trait vs impls have correctly typed const parameters. It also will now be able to be responsible for checking types of const arguments to parameters under `min_generic_const_exprs`. - Add `Ty` to `mir::Const::Ty`. I dont have a great understanding of why mir constants are setup like this to be honest. Regardless they need to be able to determine the type of the const and the easiest way to make this happen was to simply store the `Ty` along side the `ty::Const`. Maybe we can do better here in the future but I'd have to spend way more time looking at everywhere we use `mir::Const`. - rustdoc has its own `Const` which also has a `ty` field. It was relatively easy to remove this. --- r? `@lcnr` `@compiler-errors`
2024-06-05Misc fixes to cranelift/clippy/miriBoxy-0/+1
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-05Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
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-30Auto merge of #3644 - narpfel:local-crates-metadata-format-update, r=RalfJungbors-12/+28
Fix "local crate" detection `PackageId` is an opaque identifier whose internal format is subject to change, so looking up the names of local crates by ID is more robust than parsing the ID. Resolves #3643.
2024-05-30add a commentRalf Jung-0/+2
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-30fmtThe Miri Cronjob Bot-1/+2
2024-05-30Merge from rustcThe Miri Cronjob Bot-40/+170
2024-05-30Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2024-05-29add tests for local crate detectionPaul Gey-1/+17
2024-05-29Auto merge of #3638 - saethlin:big-alloc-bench, r=RalfJungbors-0/+28
Add a benchmark for creating large uninit allocations Extracted from https://github.com/rust-lang/miri/issues/3637 I used this program to confirm that https://github.com/rust-lang/rust/pull/125633 has the desired effect.
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-29Rollup merge of #125633 - RalfJung:miri-no-copy, r=saethlin许杰友 Jieyou Xu (Joe)-37/+19
miri: avoid making a full copy of all new allocations Hopefully fixes https://github.com/rust-lang/miri/issues/3637 r? ``@saethlin``
2024-05-28Add a benchmark for creating large uninit allocationsBen Kimock-0/+28
2024-05-28Fix "local crate" detectionPaul Gey-11/+9
`PackageId` is an opaque identifier whose internal format is subject to change, so looking up the names of local crates by ID is more robust than parsing the ID. Resolves #3643.
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-28move ./miri environment variables to CONTRIBUTINGRalf Jung-16/+22
2024-05-28Merge from rustcThe Miri Cronjob Bot-1/+1