rust/compiler
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
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Auto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgr 2022-08-01 15:40:43 +00:00
rustc_ast_lowering Store associated item defaultness in impl_defaultness. 2022-08-01 21:38:16 +02:00
rustc_ast_passes
rustc_ast_pretty
rustc_attr
rustc_borrowck Improve cannot move out of error message 2022-07-31 21:06:43 +03:00
rustc_builtin_macros Rollup merge of #100045 - Amanieu:global_asm_may_unwind, r=tmiasko 2022-08-02 17:17:34 +02:00
rustc_codegen_cranelift
rustc_codegen_gcc
rustc_codegen_llvm
rustc_codegen_ssa Auto merge of #99944 - bjorn3:hide_proc_macro_symbols, r=eddyb 2022-08-01 03:58:52 +00:00
rustc_const_eval Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_data_structures
rustc_driver
rustc_error_codes
rustc_error_messages
rustc_errors
rustc_expand
rustc_feature
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
rustc_hir_pretty
rustc_incremental Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_index Auto merge of #99052 - tmiasko:bitset-clone-from, r=Mark-Simulacrum 2022-07-31 21:40:21 +00:00
rustc_infer Auto merge of #100032 - BoxyUwU:no_ty_in_placeholder_const, r=compiler-errors 2022-08-02 13:10:49 +00:00
rustc_interface Rollup merge of #99519 - Urgau:check-cfg-implicit, r=petrochenkov 2022-07-31 23:39:38 +02:00
rustc_lexer Shrink Token. 2022-08-01 08:53:04 +10:00
rustc_lint Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
rustc_lint_defs
rustc_llvm
rustc_log
rustc_macros
rustc_metadata Auto merge of #95884 - cjgillot:assoc-item, r=lcnr 2022-08-01 21:43:35 +00:00
rustc_middle Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
rustc_mir_build Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_mir_dataflow Remove redundant TransferWrapper struct 2022-08-01 17:08:19 +02:00
rustc_mir_transform
rustc_monomorphize
rustc_parse Rollup merge of #100011 - compiler-errors:let-chain-restriction, r=fee1-dead 2022-08-02 07:30:44 +02:00
rustc_parse_format
rustc_passes Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_plugin_impl
rustc_privacy Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
rustc_query_impl
rustc_query_system
rustc_resolve
rustc_save_analysis Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
rustc_serialize
rustc_session Rollup merge of #99620 - hudson-ayers:fix-location-detail, r=davidtwco 2022-07-31 23:39:40 +02:00
rustc_smir
rustc_span Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
rustc_symbol_mangling
rustc_target Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
rustc_trait_selection Auto merge of #92268 - jswrenn:transmute, r=oli-obk 2022-08-02 21:17:31 +00:00
rustc_traits Auto merge of #100032 - BoxyUwU:no_ty_in_placeholder_const, r=compiler-errors 2022-08-02 13:10:49 +00:00
rustc_transmute safe transmute: fix broken intradoc link 2022-08-02 14:44:23 +00:00
rustc_ty_utils Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
rustc_type_ir
rustc_typeck remove a SourceMap::guess_head_span 2022-08-02 11:40:23 +09:00