News for hackers. Stuff that matters.
Re:The end of the kernel Rust experiment by ViewTrick1002 on Wednesday December 10, 2025 @05:44AM (#46216273)
If you can't create a safe interface and must have the function then create an unsafe function and clearly document the invariants and then rely on the user to uphold them?

Take a look at the unsafe functions for the standard library Vec type to see examples of this:

https://doc.rust-lang.org/std/vec/struct.Vec.html#method.fro...

Re:The end of the kernel Rust experiment by eru on Wednesday December 10, 2025 @08:17PM (#46226472)
> If you can't create a safe interface and must have the function then create an unsafe function and clearly document the invariants and then rely on the user to uphold them?

Yes, that's what you do in practice. But it's no different--in principle--from the approach C programmers have to use.