rust/compiler
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
..
rustc
rustc_abi
rustc_arena
rustc_ast
rustc_ast_ir
rustc_ast_lowering Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #128712 - compiler-errors:normalize-borrowck, r=lcnr 2024-08-12 23:10:50 +02:00
rustc_builtin_macros
rustc_codegen_cranelift Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,Jubilee 2024-08-12 17:09:14 +02:00
rustc_codegen_gcc Rollup merge of #128537 - Jamesbarford:118980-const-vector, r=RalfJung,nikic 2024-08-12 17:09:15 +02:00
rustc_codegen_llvm Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_codegen_ssa Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_const_eval Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlin 2024-08-13 04:32:34 +00:00
rustc_data_structures Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_driver
rustc_driver_impl
rustc_error_codes
rustc_error_messages
rustc_errors Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_expand Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_feature
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir
rustc_hir_analysis Rollup merge of #128912 - compiler-errors:do-not-recommend-impl, r=lcnr 2024-08-12 23:10:51 +02:00
rustc_hir_pretty
rustc_hir_typeck Remove struct_tail_no_normalization 2024-08-11 19:40:03 -04:00
rustc_incremental
rustc_index
rustc_index_macros
rustc_infer Use assert_matches around the compiler 2024-08-11 12:25:39 -04:00
rustc_interface
rustc_lexer
rustc_lint Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_lint_defs
rustc_llvm Auto merge of #128371 - andjo403:rangeAttribute, r=nikic 2024-08-12 10:20:00 +00:00
rustc_log
rustc_macros
rustc_metadata Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_middle Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlin 2024-08-13 04:32:34 +00:00
rustc_mir_build Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlin 2024-08-13 04:32:34 +00:00
rustc_mir_dataflow Use assert_matches around the compiler 2024-08-11 12:25:39 -04:00
rustc_mir_transform Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_monomorphize
rustc_next_trait_solver
rustc_parse Rollup merge of #128994 - nnethercote:fix-Parser-look_ahead-more, r=compiler-errors 2024-08-12 17:09:20 +02:00
rustc_parse_format
rustc_passes Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote 2024-08-12 17:09:17 +02:00
rustc_pattern_analysis
rustc_privacy
rustc_query_impl
rustc_query_system
rustc_resolve Rollup merge of #128875 - bvanjoi:cleanup-import-used, r=petrochenkov 2024-08-11 07:51:52 +02:00
rustc_sanitizers
rustc_serialize
rustc_session
rustc_smir
rustc_span
rustc_symbol_mangling
rustc_target Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu 2024-08-12 17:09:19 +02:00
rustc_trait_selection Rollup merge of #128912 - compiler-errors:do-not-recommend-impl, r=lcnr 2024-08-12 23:10:51 +02:00
rustc_traits
rustc_transmute
rustc_ty_utils Rollup merge of #128712 - compiler-errors:normalize-borrowck, r=lcnr 2024-08-12 23:10:50 +02:00
rustc_type_ir
rustc_type_ir_macros
stable_mir