about summary refs log tree commit diff
path: root/src/test/ui/structs-enums/tuple-struct-construct.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-02 21:17:31 +0000
committerbors <bors@rust-lang.org>2022-08-02 21:17:31 +0000
commite4417cf020fbcd6182c11637bc6b8694434bd81a (patch)
tree0e57100d6b7d73ba497ea478b1aeb94739b85776 /src/test/ui/structs-enums/tuple-struct-construct.rs
parent4493a0f4724c0bae1436242d76cccc9c0a287b80 (diff)
parent965ffb0b5cf3372900ce473f244ec33270058888 (diff)
downloadrust-e4417cf020fbcd6182c11637bc6b8694434bd81a.tar.gz
rust-e4417cf020fbcd6182c11637bc6b8694434bd81a.zip
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.
Diffstat (limited to 'src/test/ui/structs-enums/tuple-struct-construct.rs')
0 files changed, 0 insertions, 0 deletions