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 safety information about the Readable trait. #1761

Closed
Razican opened this issue Dec 24, 2021 · 1 comment · Fixed by #1747
Closed

Add safety information about the Readable trait. #1761

Razican opened this issue Dec 24, 2021 · 1 comment · Fixed by #1747
Labels
enhancement New feature or request
Milestone

Comments

@Razican
Copy link
Member

Razican commented Dec 24, 2021

Currently, in the VM Readable trait we have a # Safety section but no safety information. Let's add it.

@Razican Razican added the enhancement New feature or request label Dec 24, 2021
@Razican Razican added this to the v0.14.0 milestone Dec 24, 2021
@HalidOdat
Copy link
Member

It's unsafe because it should only be implemented on type that don't implement Drop, since primitives like u32, f64 don't implement Drop we can "safely" implement unsafe Readable. Currently rust stable does not support negative trait bounds we could call drop on a type twice, or more or not at all. We could potentially go around this with ManuallyDrop, but then we have to handle destruction somewhere else. In any case we currently don't need to have objects that implement Drop as opcode operand.

@Razican Razican linked a pull request Dec 25, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants