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

Fix/remove mem uninitialized #2137

Merged
merged 4 commits into from
Aug 7, 2019

Conversation

weiznich
Copy link
Member

@weiznich weiznich commented Aug 6, 2019

Follow up to #2117

Closes #2089
Closes #2136

@weiznich weiznich requested a review from a team August 6, 2019 20:22
@weiznich weiznich force-pushed the fix/remove_mem_uninitialized branch from 3328cbd to 6cc5f0d Compare August 6, 2019 20:24
@@ -76,7 +76,7 @@ impl<DB: TypeMetadata> Output<'static, Vec<u8>, DB> {
/// Unsafe to use for testing types which perform dynamic metadata lookup.
pub fn test() -> Self {
use std::mem;
#[allow(clippy::invalid_ref)]
#[allow(clippy::invalid_ref, deprecated)]
Copy link
Member

Choose a reason for hiding this comment

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

Why do we allow this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The alternative for the line below would be Self::new(Vec::new(), unsafe { mem::MaybeUninit::uninit().assume_init() }) which would basically be also UB.
Therefore I think it is not worth changing it.
(cc @diesel-rs/core just in case)

Copy link
Member

Choose a reason for hiding this comment

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

Ah okay, I got it. Could we add a comment about it?

Copy link
Member Author

Choose a reason for hiding this comment

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

A comment for what exactly? There is already a comment describing what this function tries to achieve.

Copy link
Member

Choose a reason for hiding this comment

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

I mean it's reasonable to leave a comment on why we use the deprecated method, what about?

@weiznich weiznich merged commit b649a86 into diesel-rs:master Aug 7, 2019
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.

Remove cyclomatic-complexity-threshold from clippy.toml
2 participants