Skip to content

Uninitialized memory management in lax crate #327

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

Closed
termoshtt opened this issue Aug 31, 2022 · 0 comments · Fixed by #329
Closed

Uninitialized memory management in lax crate #327

termoshtt opened this issue Aug 31, 2022 · 0 comments · Fixed by #329
Assignees

Comments

@termoshtt
Copy link
Member

termoshtt commented Aug 31, 2022

From #321 (comment)

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
Error:    --> lax/src/lib.rs:179:5
    |
179 |     let mut v = Vec::with_capacity(n);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180 |     v.set_len(n);
    |     ^^^^^^^^^^^^
    |
    = note: `#[deny(clippy::uninit_vec)]` on by default
    = help: initialize the buffer or wrap the content in `MaybeUninit`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec

as noted in the clippy URL https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec we should use Vec<MaybeUninit<T>> here, but it is not compatible with lapack crate API which requires &[T] which must be initialized.

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 a pull request may close this issue.

1 participant