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

remove transmute and fix rust warning #361

Closed
wants to merge 1 commit into from

Conversation

petrosagg
Copy link
Contributor

while () is a ZST the potentially dangling reference is still undefined behaviour. Making it a static is a trivial fix.

@petrosagg petrosagg force-pushed the remove-transmute branch 2 times, most recently from 11caa61 to efc031b Compare March 30, 2022 10:32
while `()` is a ZST the potentially dangling reference is still
undefined behaviour. Making it a static is a trivial fix.

Signed-off-by: Petros Angelatos <[email protected]>
@@ -650,7 +648,7 @@ where
type Storage = OrdKeyBatch<K, T, R, O>;

fn key<'a>(&self, storage: &'a Self::Storage) -> &'a K { &self.cursor.key(&storage.layer) }
fn val<'a>(&self, _storage: &'a Self::Storage) -> &'a () { unsafe { ::std::mem::transmute(&self.empty) } }
fn val<'a>(&self, _storage: &'a Self::Storage) -> &'a () { &() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

@petrosagg
Copy link
Contributor Author

petrosagg commented May 23, 2022

superseded by #367

@petrosagg petrosagg closed this May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants