rust/compiler/rustc_middle/src
bors 9d20fd1098 Auto merge of #97684 - RalfJung:better-provenance-control, r=oli-obk
interpret: better control over whether we read data with provenance

The resolution in https://github.com/rust-lang/unsafe-code-guidelines/issues/286 seems to be that when we load data at integer type, we implicitly strip provenance. So let's implement that in Miri at least for scalar loads. This makes use of the fact that `Scalar` layouts distinguish pointer-sized integers and pointers -- so I was expecting some wild bugs where layouts set this incorrectly, but so far that does not seem to happen.

This does not entirely implement the solution to https://github.com/rust-lang/unsafe-code-guidelines/issues/286; we still do the wrong thing for integers in larger types: we will `copy_op` them and then do validation, and validation will complain about the provenance. To fix that we need mutating validation; validation needs to strip the provenance rather than complaining about it. This is a larger undertaking (but will also help resolve https://github.com/rust-lang/miri/issues/845 since we can reset padding to `Uninit`).

The reason this is useful is that we can now implement `addr` as a `transmute` from a pointer to an integer, and actually get the desired behavior of stripping provenance without exposing it!
2022-06-06 13:28:58 +00:00
..
dep_graph Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
hir Make hir().get_generics and generics_of consistent. 2022-06-03 23:07:04 +02:00
infer fix most compiler/ doctests 2022-05-02 17:40:30 -07:00
middle Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin 2022-06-05 09:30:53 +00:00
mir Auto merge of #97684 - RalfJung:better-provenance-control, r=oli-obk 2022-06-06 13:28:58 +00:00
query Rollup merge of #97609 - Elliot-Roberts:unused-trait-refactor, r=cjgillot 2022-06-04 23:42:00 +02:00
thir Reimplement lowering of sym operands for asm! so that it also works with global_asm! 2022-04-14 15:32:03 +01:00
traits Lifetime variance fixes for rustc 2022-05-22 14:29:32 -07:00
ty Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin 2022-06-05 09:30:53 +00:00
util span: move MultiSpan 2022-04-05 07:01:00 +01:00
arena.rs try to cache region_scope_tree as a query 2022-05-25 13:52:32 +08:00
lib.rs Finish bumping stage0 2022-05-27 07:36:17 -04:00
lint.rs Move lint expectation checking into a separate query (RFC 2383) 2022-05-08 14:37:14 +02:00
macros.rs Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
metadata.rs resolve/metadata: Stop encoding macros as reexports 2022-02-24 22:55:40 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs correctly deal with user type ascriptions in pat 2022-05-21 08:13:17 +02:00