rust/library/core/src/mem
bors 8521a8c92d Auto merge of #100726 - jswrenn:transmute, r=oli-obk
safe transmute: use `Assume` struct to provide analysis options

This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411).

**Before:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<
    Src,
    Context,
    const ASSUME_ALIGNMENT: bool,
    const ASSUME_LIFETIMES: bool,
    const ASSUME_VALIDITY: bool,
    const ASSUME_VISIBILITY: bool,
> where
    Src: ?Sized,
{}
```
**After:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
where
    Src: ?Sized,
{}
```

`Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change).

r? `@oli-obk`

---

Related:
- https://github.com/rust-lang/compiler-team/issues/411
- https://github.com/rust-lang/rust/issues/99571
2022-09-04 07:55:44 +00:00
..
manually_drop.rs Rollup merge of #88375 - joshlf:patch-3, r=dtolnay 2022-03-28 04:12:09 +02:00
maybe_uninit.rs Creating uninitialized integers is UB 2022-08-26 21:13:33 +01:00
mod.rs Re-add some justification 2022-08-26 21:13:33 +01:00
transmutability.rs safe transmute: use Assume struct to provide analysis options 2022-08-22 18:37:54 +00:00
valid_align.rs Re-optimize Layout::array 2022-07-13 17:07:41 -07:00