项目作者: alexkehayias

项目描述 :
货物安全通过查找依赖关系中不安全代码的所有使用,为Rust项目提供安全检查。
高级语言: Rust
项目地址: git://github.com/alexkehayias/cargo-safety.git
创建时间: 2016-12-28T04:45:56Z
项目社区:https://github.com/alexkehayias/cargo-safety

开源协议:

下载


cargo safety plugin

This crate provides a subcommand for cargo that performs safety checks for Rust projects by finding all uses of unsafe code in dependencies. To do this reliably, the dependency tree is parsed by cargo, code is parsed into it’s AST and then walked. Using Rust’s wonderful pattern matching abilities we can quickly visit all places code can be unsafe.

Why

In coming to Rust, many people are drawn to it’s promises of safety. I was curious to see how and why people were circumventing Rust’s safety guarantees through the unsafe escape hatch. While I don’t think we should reject any libraries that use unsafety, it is good to know where exactly things are unsafe so you can make an informed decision about the many libraries you may use.

Try it

Note: nightly build required

  1. cargo install cargo-safety && cargo safety

Output (json):

  1. [
  2. {
  3. "lib_name": "gcc",
  4. "status": "failed",
  5. "offenses": [
  6. {
  7. "occurences": "\/Users\/alexkehayias\/.cargo\/registry\/src\/github.com-1ecc6299db9ec823\/gcc-0.3.40\/src\/registry.rs:73:1: 73:29\n`unsafe impl Sync for Repr {}`\n",
  8. "kind": "unsafe_impl"
  9. }
  10. ]
  11. }
  12. ]

License

Copyright © 2018 Alex Kehayias

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.