Skip to content

Uninitialized memory management in lax crate #327

Closed
@termoshtt

Description

@termoshtt

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions