Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to count rust-bindgen and other FFI? #6

Open
Tracked by #241
anderejd opened this issue Jun 21, 2018 · 3 comments
Open
Tracked by #241

How to count rust-bindgen and other FFI? #6

anderejd opened this issue Jun 21, 2018 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@anderejd
Copy link
Contributor

anderejd commented Jun 21, 2018

Questions:

  • Should it even show up in the stats?
  • Does it have its own metric?
  • Should the generated code be analyzed?
  • Can extern "C" and friends be used to help identify unsafe code used for FFI reliably?
@anderejd anderejd added the question Further information is requested label Jun 21, 2018
@anderejd anderejd changed the title How to count rust-bindgen? How to count rust-bindgen and other FFI? Jun 21, 2018
@audreyality
Copy link

Should it even show up in the stats?
Does it have its own metric?

There should probably be flags that enable and disable the metrics, at least for debugging. Another thing to be wary of is unsafe used for FFI say still contain undefined behavior. If you add analyses for known-UB (say, you can identify transmute & to &mut), the FFI analysis shouldn't remove the UB analysis.

It may also be useful to have a "conjunction" mode that outputs metrics for blocks suffering from multiple problems (e.g. blocks that do FFI with UB). This mode may be particularly useful in ecosystem-wide analyses; it could be beneficial to the Rustonomicon, for example, to point out errors that tend to happen for a specific unsafe use-case.

@vi
Copy link

vi commented Jun 26, 2018

If some interfaced C code is buggy and unsafe, then respective FFI crate is also unsafe.

@anderejd
Copy link
Contributor Author

I'm closing this since I'm ok with keeping things as they are right now. Linting for patterns that are known to cause undefined behavior would be an interesting feature though, but perhaps better suited for clippy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants