Skip to content

internal drop_in_place shim should take &mut arguments #154274

@RalfJung

Description

@RalfJung

The signature of drop_in_place says that it takes a raw pointer, but we have hacks in place to actually treat that argument as-if it was a mutable reference. These hacks are now part of the MIR semantics and have to be replicated in every MIR consumer that cares about aliasing, i.e., Miri will need a similar logic (as part of a refactor where we no longer use Retag statements).

This is obviously not great; if we want the argument of those functions to be &mut T we should just change it to literally have that type. We can keep the public method in std::ptr unchanged, it can dispatch to the actual function that does take a mutable reference.

I wonder why those hacks were added in the first place instead of properly changing the signature?
This was apparently done in #111807.
Cc @pcwalton @erikdesjardins @oli-obk @WaffleLapkin @scottmcm

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions