rust/library/alloc/tests
bors 591ecb88df Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlin
miri: make vtable addresses not globally unique

Miri currently gives vtables a unique global address. That's not actually matching reality though. So this PR enables Miri to generate different addresses for the same type-trait pair.

To avoid generating an unbounded number of `AllocId` (and consuming unbounded amounts of memory), we use the "salt" technique that we also already use for giving constants non-unique addresses: the cache is keyed on a "salt" value n top of the actually relevant key, and Miri picks a random salt (currently in the range `0..16`) each time it needs to choose an `AllocId` for one of these globals -- that means we'll get up to 16 different addresses for each vtable. The salt scheme is integrated into the global allocation deduplication logic in `tcx`, and also used for functions and string literals. (So this also fixes the problem that casting the same function to a fn ptr over and over will consume unbounded memory.)

r? `@saethlin`
Fixes https://github.com/rust-lang/miri/issues/3737
2024-08-13 04:32:34 +00:00
..
arc.rs PinCoerceUnsized trait into core 2024-07-31 17:10:55 +08:00
autotraits.rs apply fmt 2024-01-11 15:04:48 +03:00
borrow.rs remove redundant imports 2023-12-10 10:56:22 +08:00
boxed.rs PinCoerceUnsized trait into core 2024-07-31 17:10:55 +08:00
btree_set_hash.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
c_str.rs Remove use of reverted std::ffi::c_char 2022-04-27 14:01:04 -07:00
const_fns.rs fix library and rustdoc tests 2023-04-16 11:38:52 +00:00
cow_str.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
fmt.rs Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
heap.rs Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
lib.rs PinCoerceUnsized trait into core 2024-07-31 17:10:55 +08:00
linked_list.rs Classify BinaryHeap & LinkedList unit tests as such 2022-03-11 11:33:59 +01:00
rc.rs PinCoerceUnsized trait into core 2024-07-31 17:10:55 +08:00
slice.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
str.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
string.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
task.rs ignore some vtable/fn ptr equality tests in Miri, their result is not fully predictable 2024-08-12 10:39:11 +02:00
thin_box.rs Make use of pointer::is_aligned[_to] 2022-08-21 15:46:03 +04:00
vec_deque_alloc_error.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
vec_deque.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
vec.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00