Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder if it would be interesting to introduce a "safe" annotation to Rust, which would fail compilation if any code the function calls is unsafe.


You can use #![deny(unsafe_code)] in your own code.

If you're hoping to enforce across all called functions, it's likely to be unworkable since a lot of stdlib ends up calling unsafe code.


Or even stronger

    #![forbid(unsafe_code)]
Then it can't be `#[allow()]`ed.

There's also things like `cargo gieger` that will tell you how much unsafe code your dependencies have.


I think you meant `cargo geiger`


TIL forbid(), thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: