Skip to content

SB: Allowing function argument references to dangle under some circumstances #252

Open
@Diggsey

Description

@Diggsey

Continuing discussion from rust-lang/rust#55005 (comment)

Currently references in function arguments are special in that they must remain valid even after their last use. @RalfJung gave an example of a powerful optimization that relies on this behaviour.

Quoting the SB page:

Deallocating memory

Memory deallocation first acts like a write access through the pointer used for deallocation. After that is done, we additionally check all protectors remaining in the stack: if any of them is still active, we have undefined behavior.

What would be the impact of changing this to:

Deallocating memory

Memory deallocation first acts like a write access through the pointer used for deallocation. After that is done, we clear the stack,

It seems like the specific optimisation @RalfJung mentioned should still be valid, but perhaps there are other optimizations that would be prevented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)A-dereferenceableTopic: when exactly does a reference need to point to regular dereferenceable memory?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions