rust/compiler
Jubilee 9498d5cf2f
Rollup merge of #126787 - Strophox:get-bytes, r=RalfJung
Add direct accessors for memory addresses in `Machine` (for Miri)

The purpose of this PR is to enable direct (immutable) access to memory addresses in `Machine`, which will be needed for further extension of Miri.

This is done by adding (/completing missings pairs of) accessor functions, with the relevant signatures as follows:
```rust
/* rust/compiler/rustc_middle/src/mir/interpret/allocation.rs */

pub trait AllocBytes {
  // ..

  fn as_ptr(&self) -> *const u8;
/*fn as_mut_ptr(&mut self) -> *mut u8; -- Already in the compiler*/
}

impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes> {
  // ..

  pub fn get_bytes_unchecked_raw(&self) -> *const u8;
/*pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8; -- Already in the compiler*/
}
```
```rust
/* rust/compiler/rustc_const_eval/src/interpret/memory.rs */

impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
  // ..

  pub fn get_alloc_bytes_unchecked_raw(&self, id: AllocId) -> InterpResult<'tcx, *const u8>;
  pub fn get_alloc_bytes_unchecked_raw_mut(&mut self, id: AllocId) -> InterpResult<'tcx, *mut u8>;
}
```

r? ``@RalfJung``
2024-06-21 21:02:27 -07:00
..
rustc
rustc_abi Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_arena Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_ast Rollup merge of #126767 - compiler-errors:static-foreign-item, r=spastorino 2024-06-21 09:12:37 +02:00
rustc_ast_ir Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_ast_lowering StaticForeignItem and StaticItem are the same 2024-06-20 19:51:09 -04:00
rustc_ast_passes Do not allow safe usafe on static and fn items 2024-06-21 09:12:13 -03:00
rustc_ast_pretty StaticForeignItem and StaticItem are the same 2024-06-20 19:51:09 -04:00
rustc_attr Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_baked_icu_data Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_borrowck Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_builtin_macros Convert some module-level // and /// comments to //!. 2024-06-20 09:23:18 +10:00
rustc_codegen_cranelift bug! more uses of these in runtime stuff 2024-06-19 10:44:01 -07:00
rustc_codegen_gcc Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
rustc_codegen_llvm Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=Amanieu 2024-06-21 21:02:26 -07:00
rustc_codegen_ssa More GVN for PtrMetadata 2024-06-20 22:16:59 -07:00
rustc_const_eval Rollup merge of #126787 - Strophox:get-bytes, r=RalfJung 2024-06-21 21:02:27 -07:00
rustc_data_structures Convert some module-level // and /// comments to //!. 2024-06-20 09:23:18 +10:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_error_codes Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee 2024-06-12 11:10:50 +00:00
rustc_error_messages Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_errors Fix another assertion failure for some Expect diagnostics. 2024-06-21 14:29:25 +10:00
rustc_expand Rollup merge of #126700 - compiler-errors:fragment, r=fmease 2024-06-21 09:12:36 +02:00
rustc_feature Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJung 2024-06-20 11:22:59 +00:00
rustc_fluent_macro Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_fs_util Remove useless tidy-alphabetical markers. 2024-06-20 09:23:20 +10:00
rustc_graphviz Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_hir local_def_path_hash_to_def_id can fail 2024-06-19 07:45:47 -04:00
rustc_hir_analysis Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_hir_pretty Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
rustc_hir_typeck Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_incremental Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_index Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_index_macros rustc_span: Minor improvements 2024-06-16 14:08:25 +03:00
rustc_infer Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_interface Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwco 2024-06-18 16:49:19 +00:00
rustc_lexer Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_lint Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_lint_defs Remove useless tidy-alphabetical markers. 2024-06-20 09:23:20 +10:00
rustc_llvm Auto merge of #125141 - SergioGasquez:feat/no_std-xtensa, r=davidtwco 2024-06-12 13:43:31 +00:00
rustc_log Bump tracing-tree and allow rendering lines again 2024-06-12 10:11:41 +00:00
rustc_macros Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_metadata Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_middle Rollup merge of #126787 - Strophox:get-bytes, r=RalfJung 2024-06-21 21:02:27 -07:00
rustc_mir_build [GVN] Add tests for generic pointees with PtrMetadata 2024-06-20 22:16:59 -07:00
rustc_mir_dataflow Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
rustc_mir_transform Auto merge of #125853 - tesuji:promote-fail-fast, r=cjgillot 2024-06-21 16:00:14 +00:00
rustc_monomorphize Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_next_trait_solver Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_parse Rollup merge of #126767 - compiler-errors:static-foreign-item, r=spastorino 2024-06-21 09:12:37 +02:00
rustc_parse_format Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_passes Rollup merge of #124580 - gurry:124556-suggest-remove-tuple-field, r=jackh726 2024-06-19 09:51:59 +02:00
rustc_pattern_analysis Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
rustc_privacy Do not ICE in privacy when type inference fails. 2024-06-17 10:09:27 +00:00
rustc_query_impl Allow tracing through item_bounds query invocations on opaques 2024-06-19 08:47:55 +00:00
rustc_query_system Allow for try_force_from_dep_node to fail 2024-06-19 07:21:41 -04:00
rustc_resolve Rollup merge of #126767 - compiler-errors:static-foreign-item, r=spastorino 2024-06-21 09:12:37 +02:00
rustc_sanitizers Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_serialize Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_session Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
rustc_smir Add method to get FnAbi of function pointer 2024-06-21 14:50:56 +08:00
rustc_span Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=Amanieu 2024-06-21 21:02:26 -07:00
rustc_symbol_mangling Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_target Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=Amanieu 2024-06-21 21:02:26 -07:00
rustc_trait_selection Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_traits Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_transmute safe transmute: support non-ZST, variantful, uninhabited enums 2024-06-14 21:11:08 +00:00
rustc_ty_utils Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
rustc_type_ir Rename a bunch of things 2024-06-21 12:32:05 -04:00
rustc_type_ir_macros
stable_mir Add method to get FnAbi of function pointer 2024-06-21 14:50:56 +08:00