mirror of
https://github.com/openharmony/third_party_rust_tinyvec.git
synced 2026-07-18 12:25:35 -04:00
478a8a01249f79c0766041871024ef97734ed336
* Make capacity() methods not rely on Array::CAPACITY Because Array isn't an unsafe trait, unsafe code cannot depend on the length of a slice produced by Array::as_slice to be at least as long as Array::CAPACITY. This means that unsafe code also cannot depend on capacity() methods that return Array::CAPACITY. Returning the result of a slice len() call ensures that if nothing else, with a sound implementation of Array, capacity() methods will return a valid length for a sub-slice of the backing array. * Add comments explaining choice against using Array::CAPACITY
Description
Languages
Rust
99.5%
Python
0.3%
Shell
0.2%