Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacked Borrows cannot properly handle extern type #276

Open
RalfJung opened this issue Feb 27, 2021 · 2 comments
Open

Stacked Borrows cannot properly handle extern type #276

RalfJung opened this issue Feb 27, 2021 · 2 comments
Labels
A-aliasing-model Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)

Comments

@RalfJung
Copy link
Member

While working on rust-lang/miri#1725, I realized that Stacked Borrows does not really work properly when extern type is used: on a reborrow, the newly created reference is only valid for the memory range that Miri can actually know belongs to this reference. So a reference with an extern type tail would be reborrowed in a way that that tail becomes inaccessible. This is incompatible with e.g. how the standard library format string machinery uses extern type as its implementation for Opaque.

In a sense this is a variant of #134, but it felt worth pointing out separately.

@RalfJung RalfJung added the A-aliasing-model Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows) label Feb 27, 2021
@CAD97
Copy link

CAD97 commented Mar 12, 2021

#256 seems also worth noting as related. (It seems a more dynamic concept of how much memory pointers have provenance over would improve a lot of use cases...)

@RalfJung
Copy link
Member Author

Yeah, #256 is essentially a duplicate of #134.

(It seems a more dynamic concept of how much memory pointers have provenance over would improve a lot of use cases...)

Very much agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliasing-model Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)
Projects
None yet
Development

No branches or pull requests

2 participants