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

add #[non_owned] and #[non_const] attributes #5601

Closed
thestinger opened this issue Mar 28, 2013 · 0 comments
Closed

add #[non_owned] and #[non_const] attributes #5601

thestinger opened this issue Mar 28, 2013 · 0 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@thestinger
Copy link
Contributor

This is needed to wrap external libraries with reference counted but not inherently thread-safe types, and could be used to implemented a reference counted pointer as a library feature. It prevents the type from being sendable, and it could only allow Owned types to be contained in it, preventing cycles from ever occurring.

The #[non_const] attribute is needed to make Cell safe if we were using llvm.invariant intrinsics on frozen Const types, and for mutable reference counted pointers.

For now I've worked around the issue for reference counted pointers by making them contain Option<@()> and Option<@mut ()> and just setting those to None.

bors added a commit that referenced this issue May 7, 2013
To provide a reference counted pointer type with deterministic
destruction once managed boxes are switched over to a garbage
collector. Unlike managed boxes, these can be moved instead of just
copied/cloned which is helpful for avoiding reference counts.

Needs #5601 to be fixed in order for safety to be provided without the current ugly workaround of making the pointers contain `Option<@()>` and `Option<@mut ()>` (which are just set to `None`).

@brson: r?
calebcartwright pushed a commit to calebcartwright/rust that referenced this issue Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

1 participant