about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail
AgeCommit message (Collapse)AuthorLines
2025-09-22TB: rename Active → Unique to match paperRalf Jung-59/+26
2025-09-17Merge ref '3f1552a273e4' from rust-lang/rustThe Miri Cronjob Bot-7/+44
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 3f1552a273e43e15f6ed240d00e1efdd6a53e65e Filtered ref: fbfa7b30a3ad5abd6a5db7e3ef15adc8da1ecc37 Upstream diff: https://github.com/rust-lang/rust/compare/9d82de19dfae60e55c291f5f28e28cfc2c1b9630...3f1552a273e43e15f6ed240d00e1efdd6a53e65e This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-11Fix miri issue 4579 by checking if the strong protector is actually "active".Johannes Hostert-65/+0
Where "active" means that the accessed bit is set. This also reverts miri PR 3831.
2025-09-10interpret: fix overlapping aggregate initializationRalf Jung-7/+44
2025-09-04Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35Jacob Pratt-0/+44
Implement Integer funnel shifts Tracking issue: rust-lang/rust#145686 ACP: https://github.com/rust-lang/libs-team/issues/642 This implements funnel shifts on primitive integer types. Implements this for cg_llvm, with a fallback impl for everything else Thanks `@folkertdev` for the fixes and tests cc `@rust-lang/libs-api`
2025-09-03Add `funnel_sh{l,r}` functions and intrinsicssayantn-0/+44
- Add a fallback implementation for the intrinsics - Add LLVM backend support for funnel shifts Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-09-03Merge ref '51ff895062ba' from rust-lang/rustThe Miri Cronjob Bot-88/+49
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 51ff895062ba60a7cba53f57af928c3fb7b0f2f4 Filtered ref: 5057370cda58bcaad24ea094ec11c8c01b24c2bc This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-02improve process::abort rendering in Miri backtracesRalf Jung-88/+49
2025-08-25Merge ref 'a1dbb443527b' from rust-lang/rustThe Miri Cronjob Bot-0/+7
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: a1dbb443527bd126452875eb5d5860c1d001d761 Filtered ref: e644bd7324c7e071785356fcaad5bd89e671366b This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-24Merge ref 'f6d23413c399' from rust-lang/rustThe Miri Cronjob Bot-0/+95
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: f6d23413c399fb530be362ebcf25a4e788e16137 Filtered ref: fc132ae45e682a2556f99caed7bca9b8a2e909c8 This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-23Rollup merge of #144531 - Urgau:int_to_ptr_transmutes, r=jackh726Jacob Pratt-0/+7
Add lint against integer to pointer transmutes # `integer_to_ptr_transmutes` *warn-by-default* The `integer_to_ptr_transmutes` lint detects integer to pointer transmutes where the resulting pointers are undefined behavior to dereference. ### Example ```rust fn foo(a: usize) -> *const u8 { unsafe { std::mem::transmute::<usize, *const u8>(a) } } ``` ``` warning: transmuting an integer to a pointer creates a pointer without provenance --> a.rs:1:9 | 158 | std::mem::transmute::<usize, *const u8>(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this is dangerous because dereferencing the resulting pointer is undefined behavior = note: exposed provenance semantics can be used to create a pointer based on some previously exposed provenance = help: if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut` = help: for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers> = help: for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance> = note: `#[warn(integer_to_ptr_transmutes)]` on by default help: use `std::ptr::with_exposed_provenance` instead to use a previously exposed provenance | 158 - std::mem::transmute::<usize, *const u8>(a) 158 + std::ptr::with_exposed_provenance::<u8>(a) | ``` ### Explanation Any attempt to use the resulting pointers are undefined behavior as the resulting pointers won't have any provenance. Alternatively, `std::ptr::with_exposed_provenance` should be used, as they do not carry the provenance requirement or if the wanting to create pointers without provenance `std::ptr::without_provenance_mut` should be used. See [std::mem::transmute] in the reference for more details. [std::mem::transmute]: https://doc.rust-lang.org/std/mem/fn.transmute.html -------- People are getting tripped up on this, see https://github.com/rust-lang/rust/issues/128409 and https://github.com/rust-lang/rust/issues/141220. There are >90 cases like these on [GitHub search](https://github.com/search?q=lang%3Arust+%2Ftransmute%3A%3A%3Cu%5B0-9%5D*.*%2C+%5C*const%2F&type=code). Fixes https://github.com/rust-lang/rust-clippy/issues/13140 Fixes https://github.com/rust-lang/rust/issues/141220 Fixes https://github.com/rust-lang/rust/issues/145523 `@rustbot` labels +I-lang-nominated +T-lang cc `@traviscross` r? compiler
2025-08-24Allow `integer_to_ptr_transmutes` in testsUrgau-0/+7
2025-08-23tree borrows: refactor new-permission logicRalf Jung-0/+30
2025-08-22miri: also detect aliasing of in-place argument and return placeRalf Jung-0/+95
2025-08-20bless new testsRalf Jung-0/+1
2025-08-20Merge ref 'f605b57042ff' from rust-lang/rustThe Miri Cronjob Bot-37/+129
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: f605b57042ffeb320d7ae44490113a827139b766 Filtered ref: c69d2743ed4676c4529ebb60b258f6c1273c9145 This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-19God bless the testsJohannes Hostert-0/+53
2025-08-19Rollup merge of #145585 - RalfJung:miri-inplace-arg-checks, r=compiler-errors许杰友 Jieyou Xu (Joe)-37/+129
Miri: fix handling of in-place argument and return place handling This fixes two separate bugs (in two separate commits): - If the return place is `_local` and not `*ptr`, we didn't always properly protect it if there were other pointers pointing to that return place. - If two in-place arguments are *the same* local variable, we didn't always detect that aliasing.
2025-08-19miri: detect passing the same local twice as an in-place argumentRalf Jung-0/+92
2025-08-18interpret: fix in-place return place semantics when the return place ↵Ralf Jung-37/+37
expression is a local variable
2025-08-17Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obkbors-7/+96
const-eval: full support for pointer fragments This fixes https://github.com/rust-lang/const-eval/issues/72 and makes `swap_nonoverlapping` fully work in const-eval by enhancing per-byte provenance tracking with tracking of *which* of the bytes of the pointer this one is. Later, if we see all the same bytes in the exact same order, we can treat it like a whole pointer again without ever risking a leak of the data bytes (that encode the offset into the allocation). This lifts the limitation that was discussed quite a bit in https://github.com/rust-lang/rust/pull/137280. For a concrete piece of code that used to fail and now works properly consider this example doing a byte-for-byte memcpy in const without using intrinsics: ```rust use std::{mem::{self, MaybeUninit}, ptr}; type Byte = MaybeUninit<u8>; const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) { let mut i = 0; while i < n { *dst.add(i) = *src.add(i); i += 1; } } const _MEMCPY: () = unsafe { let ptr = &42; let mut ptr2 = ptr::null::<i32>(); // Copy from ptr to ptr2. memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>()); assert!(*ptr2 == 42); }; ``` What makes this code tricky is that pointers are "opaque blobs" in const-eval, we cannot just let people look at the individual bytes since *we don't know what those bytes look like* -- that depends on the absolute address the pointed-to object will be placed at. The code above "breaks apart" a pointer into individual bytes, and then puts them back together in the same order elsewhere. This PR implements the logic to properly track how those individual bytes relate to the original pointer, and to recognize when they are in the right order again. We still reject constants where the final value contains a not-fully-put-together pointer: I have no idea how one could construct an LLVM global where one byte is defined as "the 3rd byte of a pointer to that other global over there" -- and even if LLVM supports this somehow, we can leave implementing that to a future PR. It seems unlikely to me anyone would even want this, but who knows.^^ This also changes the behavior of Miri, by tracking the order of bytes with provenance and only considering a pointer to have valid provenance if all bytes are in the original order again. This is related to https://github.com/rust-lang/unsafe-code-guidelines/issues/558. It means one cannot implement XOR linked lists with strict provenance any more, which is however only of theoretical interest. Practically I am curious if anyone will show up with any code that Miri now complains about - that would be interesting data. Cc `@rust-lang/opsem`
2025-08-08Rollup merge of #144579 - joshtriplett:mbe-attr, r=petrochenkovTrevor Gross-1/+1
Implement declarative (`macro_rules!`) attribute macros (RFC 3697) This implements [RFC 3697](https://github.com/rust-lang/rust/issues/143547), "Declarative (`macro_rules!`) attribute macros". I would suggest reading this commit-by-commit. This first introduces the feature gate, then adds parsing for attribute rules (doing nothing with them), then adds the ability to look up and apply `macro_rules!` attributes by path, then adds support for local attributes, then adds a test, and finally makes various improvements to errors.
2025-08-08mbe: In error messages, don't assume attributes are always proc macrosJosh Triplett-1/+1
Now that `macro_rules` macros can define attribute rules, make sure error messages account for that.
2025-08-07Rollup merge of #144903 - Kivooeo:panic_handler-is-not-begin, r=m-ou-seTrevor Gross-22/+22
Rename `begin_panic_handler` to `panic_handler` Part of https://github.com/rust-lang/rust/issues/116005
2025-08-06Print thread ID in panic message if thread name is unknownTrevor Gross-24/+24
`panic!` does not print any identifying information for threads that are unnamed. However, in many cases, the thread ID can be determined. This changes the panic message from something like this: thread '<unnamed>' panicked at src/main.rs:3:5: explicit panic To something like this: thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5: explicit panic Stack overflow messages are updated as well. This change applies to both named and unnamed threads. The ID printed is the OS integer thread ID rather than the Rust thread ID, which should also be what debuggers print.
2025-08-04remove begin prefixKivooeo-22/+22
2025-08-04Rollup merge of #144853 - Kivooeo:rust_-cleanup, r=Mark-SimulacrumStuart Cook-11/+11
Remove unnecessary `rust_` prefixes part of https://github.com/rust-lang/rust/issues/116005 Honestly, not sure if this can affect linking somehow, also I didn't touched things like `__rust_panic_cleanup` and `__rust_start_panic` which very likely will break something, so just small cleanup here also didn't changed `rust_panic_without_hook` because it was renamed here https://github.com/rust-lang/rust/pull/144852 r? libs
2025-08-03remove rust_ prefixesKivooeo-11/+11
2025-07-31Allow `dangling_pointers_from_locals` lint in testsUrgau-0/+3
2025-07-30const-eval: full support for pointer fragmentsRalf Jung-7/+96
2025-07-28revert accidental changeRalf Jung-0/+4
2025-07-28Merge commit 'abd9cba5acbcc35fb4cc59ce25580fa1624b5571'Ralf Jung-21/+17
2025-07-27miri: for ABI mismatch errors, say which argument is the problemRalf Jung-21/+17
2025-07-27call_function helper: dont ICE on return type mismatchesRalf Jung-0/+51
2025-07-18Show the memory of uninit readsOli Scherer-43/+50
2025-07-17Report the range of uninit bytes in CTFE errorsOli Scherer-19/+103
2025-07-09miri: fix out-of-bounds error for ptrs with negative offsetsRalf Jung-0/+53
2025-07-02miri: improve errors for type validity assertion failuresRalf Jung-58/+19
2025-06-27Update dangling_pointer_to_raw_pointer.rsleopardracer-1/+1
2025-06-16miri: bless testsDavid Wood-4/+4
These error messages include lines of the standard library which have changed and so need updated.
2025-06-15Merge from rustcRalf Jung-37/+0
2025-06-13Unimplement unsized_localsmejrs-37/+0
2025-06-11Merge pull request #4384 from RalfJung/diag-no-repeatOli Scherer-700/+541
diagnostics: do not repeat the entire message in the span label
2025-06-07bless non-Linux testsRalf Jung-4/+2
2025-06-07make better use of label for data-race and some other errorsRalf Jung-283/+129
2025-06-07diagnostics: do not repeat the entire message in the span labelRalf Jung-508/+505
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-2/+2
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-05Rollup merge of #140638 - RalfJung:unsafe-pinned-shared-aliased, ↵Matthias Krüger-0/+115
r=workingjubilee UnsafePinned: also include the effects of UnsafeCell This tackles https://github.com/rust-lang/rust/issues/137750 by including an `UnsafeCell` in `UnsafePinned`, thus imbuing it with all the usual properties of interior mutability (no `noalias` nor `dereferenceable` on shared refs, special treatment by Miri's aliasing model). The soundness issue is not fixed yet because coroutine lowering does not use `UnsafePinned`. The RFC said that `UnsafePinned` would not permit mutability on shared references, but since then, https://github.com/rust-lang/rust/issues/137750 has demonstrated that this is not tenable. In the face of those examples, I propose that we do the "obvious" thing and permit shared mutable state inside `UnsafePinned`. This seems loosely consistent with the fact that we allow going from `Pin<&mut T>` to `&T` (where the former can be aliased with other pointers that perform mutation, and hence the same goes for the latter) -- but the `as_ref` example shows that we in fact would need to add this `UnsafeCell` even if we didn't have a safe conversion to `&T`, since for the compiler and Miri, `&T` and `Pin<&T>` are basically the same type. To make this possible, I had to remove the `Copy` and `Clone` impls for `UnsafePinned`. Tracking issue: https://github.com/rust-lang/rust/issues/125735 Cc ``@rust-lang/lang`` ``@rust-lang/opsem`` ``@Sky9x`` I don't think this needs FCP since the type is still unstable -- we'll finally decide whether we like this approach when `UnsafePinned` is moved towards stabilization (IOW, this PR is reversible). However, I'd still like to make sure that the lang team is okay with the direction I am proposing here.
2025-06-03Rollup merge of #141698 - oli-obk:ctfe-err-flip, r=RalfJungMatthias Krüger-9/+9
Use the informative error as the main const eval error message r? `@RalfJung` I only did the minimal changes necessary to the const eval error machinery. I'd prefer not to mix test changes with refactorings 😆
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-3/+3