Re:Rust in the 6.2 Kernel
by tialaramex on Friday November 18, 2022 @01:15PM
(#33659161)
No, you can't - they don't exist in Rust for Linux.
In Rust the alloc library's Vec has a function Vec::push(&mut self, value: T)
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pus...
In Rust for Linux their custom alloc library does not have that function offering instead Vec::try_push(&mut self, value: T) -> Result<(), TryReserveError>
https://rust-for-linux.github.io/docs/alloc/vec/struct.Vec.h...
What’s up with the Allocator API? Then it could be Vec::push<Allocator>(..), giving it an always-failing one for example.
Re:Rust in the 6.2 Kernel
by tialaramex on Saturday November 19, 2022 @02:37PM
(#33673785)
Vec::push<Allocator>(..) makes no sense, the Allocator is a parameter to the Vec type.
That’s what I meant to write
Re:Rust in the 6.2 Kernel
by tialaramex on Tuesday November 22, 2022 @04:15AM
(#33703713)
OK and... ? What purpose does an always-failing allocator for Vec have? I guess maybe it's useful for some unit testing cases, but otherwise it seems pointless.
If this is out of tree, AFAIK you can use these all you want. Whether or not you _should_ is obviously a different matter.