3 ms·
Why doesn’t this category of bugs exist for Rust programs? Simply because you cannot write a program that contains a null-pointer error. Hate to be that guy,
by ainar-g 8y ago
Why doesn’t this category of bugs exist for Rust programs? Simply
because you cannot write a program that contains a null-pointer error.
Hate to be that guy, but this is strictly not true. Observe:
$ nl -ba nulltmp.rs
1 use std::ptr;
2
3 fn main() {
4 unsafe {
5 let p = ptr::null::<i64>();
6 println!("{}", *p);
7 }
8 }
$ rustc nulltmp.rs
$ ./nulltmp
Segmentation fault (core dumped)
Raw pointers exist. Unsafe Rust exists. Any large enough Rust project will
end up with some unsafe code. That doesn't mean that the things OP is doing
aren't great—they are—but merely that, when considering tools to be used
for real-world Rust, people shouldn't assume that their tools will only be
used in a shiny rainbow unicorn world of Safe Rust.
- int_19h 8y agoThe article mentions unsafe more than once, and specifically says: "I do not intend to tackle the difficult problem of interaction between unsafe and safe Rust code; Rustbelt is the correct way to do it." The statement you quoted is clearly in the implied context of safe code.
- Dylan16807 8y ago> Hate to be that guy Clearly you don't.