Skip to content

Aliasing rules for Box<T> #258

Closed
Closed
@RalfJung

Description

@RalfJung

What should the aliasing rules for Box be? Stacked Borrows says they are the same as &mut T. (With the exception that no protectors are being added, so a Box<T> may actually be deallocated while a function is running. However, if we adopt #252, then even this difference will probably disappear.)

However, @jonhoo has a usecase that is in conflict with this. @jonhoo maybe you could briefly summarize what that is about? In particular I am wondering if you think you should be able to pull the same tricks with &mut-- so far I treated it as a given that both Box and &mut should require uniqueness in pretty much the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)A-provenanceTopic: Related to when which values have which provenance (but not which alias restrictions follow)C-open-questionCategory: An open question that we should revisit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions