Add an intrinsic for `ptr::from_raw_parts(_mut)` by scottmcm · Pull Request #123840 · rust-lang/rust

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Apr 12, 2024

scottmcm

scottmcm

scottmcm

RalfJung

RalfJung

cjgillot

scottmcm

saethlin

saethlin

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Apr 21, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 21, 2024

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Apr 21, 2024
Rollup merge of rust-lang#123840 - scottmcm:aggregate-kind-rawptr, r=cjgillot

Add an intrinsic for `ptr::from_raw_parts(_mut)`

Fixes rust-lang#123174
cc `@CAD97` `@saethlin`
r? `@cjgillot`

As suggested in rust-lang#123190 (comment), this adds a new `AggregateKind::RawPtr` for creating a pointer from its data pointer and its metadata.

That means that `slice::from_raw_parts` and friends no longer need to hard-code pointer layout into `libcore`, and because it no longer does union hacks the MIR is shorter and more amenable to optimizations.

@scottmcm scottmcm deleted the aggregate-kind-rawptr branch

April 21, 2024 23:14

This was referenced

May 6, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 7, 2024
…ts, r=<try>

Avoid a cast in `ptr::slice_from_raw_parts(_mut)`

Casting to `*const ()` or `*mut ()` is no longer needed after rust-lang#123840 so let's make the MIR smaller (and more inline-able, as seen in the tests).

If [ACP#362](rust-lang/libs-team#362) goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 8, 2024
…ts, r=joboet

Avoid a cast in `ptr::slice_from_raw_parts(_mut)`

Casting to `*const ()` or `*mut ()` is no longer needed after rust-lang#123840 so let's make the MIR smaller (and more inline-able, as seen in the tests).

If [ACP#362](rust-lang/libs-team#362) goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 13, 2024
Unify `Rvalue::Aggregate` paths in cg_ssa

In rust-lang#123840 and rust-lang#123886 I added two different codepaths for `Rvalue::Aggregate` in `cg_ssa`.

This merges them into one, since raw pointers are also immediates that can be built from the immediates of their "fields".

zhassan-aws added a commit to model-checking/kani that referenced this pull request

May 14, 2024
Addresses the new `AggregateKind::RawPtr` added in
rust-lang/rust#123840.

Resolves #3161 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Kareem Khazem <karkhaz@amazon.com>
Co-authored-by: Michael Tautschnig <tautschn@amazon.com>

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

May 18, 2024

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

May 18, 2024

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

May 28, 2024

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

May 28, 2024

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

May 29, 2024

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

May 29, 2024

bjorn3 pushed a commit to bjorn3/rust that referenced this pull request

Jun 30, 2024