3 ms·
> Right now both alloc/std and even basic language constructs like indexing into a slice can panic AFAIK they're not using std. And isn't this kind of panic th
by wyldfire 5y ago
> Right now both alloc/std and even basic language constructs like indexing into a slice can panic
AFAIK they're not using std. And isn't this kind of panic the kind of thing that causes BUG()s today? Probably can just map one to the other.
- btbuilder 5y agoout of memory conditions should not cause a kernel panic.
- simias 5y agoThe kernel uses a non standard `kmalloc` to allocate memory anyway, I don't know how they plan to integrate Rust into the kernel but I would be very surprised if they imported any of Rust's std as-is. Actually most of the time you probably wouldn't want a Vec that reallocates automatically in the kernel, you'd probably want a dynamically allocated array of fixed length the majority of the time.
- codys 5y agoYes, indexing into arrays in C (well, really, de-referencing pointers) in ways that are out of bounds will in the best case result in a fault which results in a BUG() invocation in Linux. Panicing on invalid slice indexing is a non-issue.
- a1369209993 5y ago> Panicing on invalid slice indexing is a non-issue. Well, it's less of a issue that what we already have. It would still be nice to be able to tell the compiler: "Issue a diagnostic for any [some qualifiers] panic that isn't optimized out by unreachable code analysis.".