rust/compiler/rustc_middle/src
bors e4417cf020 Auto merge of #92268 - jswrenn:transmute, r=oli-obk
Initial implementation of transmutability trait.

*T'was the night before Christmas and all through the codebase, not a miri was stirring — no hint of `unsafe`!*

This PR provides an initial, **incomplete** implementation of *[MCP 411: Lang Item for Transmutability](https://github.com/rust-lang/compiler-team/issues/411)*. The `core::mem::BikeshedIntrinsicFrom` trait provided by this PR is implemented on-the-fly by the compiler for types `Src` and `Dst` when the bits of all possible values of type `Src` are safely reinterpretable as a value of type `Dst`.

What this PR provides is:
- [x] [support for transmutations involving primitives](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/primitives)
- [x] [support for transmutations involving arrays](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/arrays)
- [x] [support for transmutations involving structs](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/structs)
- [x] [support for transmutations involving enums](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/enums)
- [x] [support for transmutations involving unions](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/unions)
- [x] [support for weaker validity checks](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs) (i.e., `Assume::VALIDITY`)
- [x] visibility checking

What isn't yet implemented:
- [ ] transmutability options passed using the `Assume` struct
- [ ] [support for references](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/references.rs)
- [ ] smarter error messages

These features will be implemented in future PRs.
2022-08-02 21:17:31 +00:00
..
dep_graph Use a dedicated DepKind for the forever-red node. 2022-07-06 23:20:12 +02:00
hir Change enclosing_body_owner to return LocalDefId 2022-07-29 18:26:10 -04:00
infer make PlaceholderConst not store the type of the const 2022-08-01 15:42:38 +01:00
middle Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov 2022-07-27 17:55:07 +02:00
mir Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd 2022-08-01 16:49:33 +02:00
query Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
thir Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr 2022-07-14 19:24:04 +05:30
traits Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
ty Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
util span: move MultiSpan 2022-04-05 07:01:00 +01:00
arena.rs arena > Rc for query results 2022-07-12 15:27:24 +02:00
lib.rs Stabilize let_chains 2022-07-16 20:17:58 -03:00
lint.rs Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
macros.rs impl TypeVisitable in type traversal macros 2022-07-05 22:25:33 +01: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 Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd 2022-08-01 16:49:33 +02:00