rust/library/core/src
bors 35a0617248 Auto merge of #98674 - RalfJung:miri-stacktrace-pruning, r=Mark-Simulacrum
miri: prune some atomic operation and raw pointer details from stacktrace

Since Miri removes `track_caller` frames from the stacktrace, adding that attribute can help make backtraces more readable (similar to how it makes panic locations better). I made them only show up with `cfg(miri)` to make sure the extra arguments induced by `track_caller` do not cause any runtime performance trouble.

This is also testing the waters for whether the libs team is okay with having these attributes in their code, or whether you'd prefer if we find some other way to do this. If you are fine with this, we will probably want to add it to a lot more functions (all the other atomic operations, to start).

Before:
```
error: Undefined Behavior: Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
    --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2594:23
     |
2594 |             SeqCst => intrinsics::atomic_load_seqcst(dst),
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
     |
     = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
     = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

     = note: inside `std::sync::atomic::atomic_load::<usize>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2594:23
     = note: inside `std::sync::atomic::AtomicUsize::load` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:1719:26
note: inside closure at ../miri/tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
    --> ../miri/tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
     |
22   |             (&*c.0).load(Ordering::SeqCst)
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

After:
```
error: Undefined Behavior: Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
  --> tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
   |
22 |             (&*c.0).load(Ordering::SeqCst)
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at alloc1727 (current vector clock = VClock([9, 0, 6]), conflicting timestamp = VClock([0, 6]))
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

   = note: inside closure at tests/fail/data_race/atomic_read_na_write_race1.rs:22:13
```
2022-07-24 06:46:46 +00:00
..
alloc Remove duplication of layout size check 2022-07-11 17:58:42 -04:00
array Add Iterator::next_chunk 2022-06-21 08:57:02 +02:00
async_iter Add Stream alias for AsyncIterator 2022-03-15 20:59:13 -07:00
cell Move/rename lazy::{OnceCell, Lazy} to cell::{OnceCell, LazyCell} 2022-06-16 19:53:59 +04:00
char Fix links in std/core documentation 2022-07-05 21:33:39 +02:00
convert Warn on unused doc(hidden) on trait impl items 2022-05-08 22:53:14 +02:00
ffi Stabilize core::ffi::CStr, alloc::ffi::CString, and friends 2022-07-15 03:10:35 -07:00
fmt rustdoc: extend #[doc(tuple_variadic)] to fn pointers 2022-07-17 16:32:06 -07:00
future Stabilize future_poll_fn 2022-07-16 10:04:14 +09:00
hash rustdoc: extend #[doc(tuple_variadic)] to fn pointers 2022-07-17 16:32:06 -07:00
iter Fix Skip::next for non-fused inner iterators 2022-07-18 21:10:47 +02:00
macros add rt flag to allowed internal unstable for RustcEncodable/Decodable 2022-07-08 21:18:15 +00:00
mem Rollup merge of #98839 - 5225225:assert_transmute_copy_size, r=thomcc 2022-07-18 21:14:42 +05:30
num Rollup merge of #99452 - Stargateur:fix/typo, r=JohnTitor 2022-07-20 11:29:40 +05:30
ops Add map_continue and continue_value combinators to ControlFlow 2022-07-20 16:32:09 -04:00
panic Update integer_atomics tracking issue 2022-07-08 17:52:04 -04:00
prelude Create 2024 edition 2022-04-02 02:45:49 -04:00
ptr Auto merge of #98674 - RalfJung:miri-stacktrace-pruning, r=Mark-Simulacrum 2022-07-24 06:46:46 +00:00
slice Auto merge of #93397 - joshtriplett:sort-floats, r=Amanieu 2022-07-23 02:47:54 +00:00
str Use split_once in FromStr docs 2022-07-18 08:57:43 +02:00
sync miri: prune some atomic operation details from stacktrace 2022-07-20 16:34:24 -04:00
task stabilize core::task::ready! 2022-07-18 16:04:52 +02:00
unicode revert changes to unicode stability 2022-07-08 21:18:15 +00:00
any.rs core::any: replace some unstable generic types with impl Trait 2022-07-05 15:06:31 +01:00
ascii.rs Inline <EscapeDefault as Iterator>::next 2022-03-10 15:35:22 +01:00
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
bool.rs Stabilize bool::then_some 2022-05-04 13:22:08 +02:00
borrow.rs Make Borrow and BorrowMut impls const 2021-12-04 21:57:39 +09:00
cell.rs adjust UnsafeCell documentation 2022-07-22 14:25:41 -04:00
clone.rs update cfg(bootstrap)s 2022-07-01 15:48:23 +02:00
cmp.rs update cfg(bootstrap)s 2022-07-01 15:48:23 +02:00
default.rs Add documentation 2022-04-07 20:03:24 -04:00
hint.rs Clarify unreachable_unchecked docs 2022-05-06 09:34:41 +02:00
internal_macros.rs ignore a doctest for the non-exported macro 2022-05-03 18:33:56 +09:00
intrinsics.rs Auto merge of #98674 - RalfJung:miri-stacktrace-pruning, r=Mark-Simulacrum 2022-07-24 06:46:46 +00:00
lazy.rs Move/rename lazy::{OnceCell, Lazy} to cell::{OnceCell, LazyCell} 2022-06-16 19:53:59 +04:00
lib.rs Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb 2022-07-13 19:32:34 +05:30
marker.rs docs: show Clone and Copy on () doc pages 2022-06-07 12:12:49 -07:00
option.rs Fix links in std/core documentation 2022-07-05 21:33:39 +02:00
panic.rs resolve the conflict in compiler/rustc_session/src/parse.rs 2022-03-16 20:12:30 +08:00
panicking.rs trivial cfg(bootstrap) changes 2022-04-05 23:18:40 +02:00
pin.rs Fix the generator example for pin!() 2022-05-05 09:58:13 +10:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
primitive_docs.rs Improve the function pointer docs 2022-07-19 08:52:24 -07:00
result.rs add same warning to Result::expect as Result::unwrap 2022-07-21 18:15:24 -06:00
time.rs Rollup merge of #96051 - newpavlov:duration_rounding, r=nagisa,joshtriplett 2022-05-26 20:15:07 -07:00
tuple.rs rustdoc: extend #[doc(tuple_variadic)] to fn pointers 2022-07-17 16:32:06 -07:00
unit.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00