rust/library
bors 95e77648e4 Auto merge of #97522 - xfix:stabilize-slice-from-raw-parts, r=dtolnay
Partially stabilize const_slice_from_raw_parts

This doesn't stabilize methods working on mutable pointers.

This pull request continues from #94946.

Pinging `@rust-lang/wg-const-eval` this because I use `rustc_allow_const_fn_unstable`. I believe this is justifiable as it's already possible to use `slice::from_raw_parts` in stable by abusing `transmute`. The stable alternative to this would be to provide a stable const implementation of `std::ptr::from_raw_parts` (as it can already be implemented in stable).

```rust
use std::mem;

#[repr(C)]
struct Slice<T> {
    data: *const T,
    len: usize,
}

fn main() {
    let data: *const i32 = [1, 2, 3, 4].as_ptr();
    let len = 4;
    println!("{:?}", unsafe {
        mem::transmute::<Slice<i32>, &[i32]>(Slice { data, len })
    });
}
```

`@rustbot` modify labels: +T-libs-api
2022-07-10 06:26:03 +00:00
..
alloc Intra-doc-link-ify reference to Clone::clone_from 2022-07-08 22:47:07 +02:00
backtrace@4e5a3f7292
core Partially stabilize const_slice_from_raw_parts 2022-07-09 23:20:02 +02:00
panic_abort
panic_unwind
portable-simd
proc_macro review changes 2022-06-28 09:54:29 -04:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Auto merge of #98950 - ChrisDenton:getoverlapped-io, r=thomcc 2022-07-09 22:37:56 +00:00
stdarch@28335054b1
test
unwind update cfg(bootstrap)s 2022-07-01 15:48:23 +02:00