-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix/remove mem uninitialized #2137
Conversation
3328cbd
to
6cc5f0d
Compare
@@ -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)] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Follow up to #2117
Closes #2089
Closes #2136