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

Warn about Rust safety with a list of known pitfalls #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danielhenrymantilla
Copy link
Contributor

@danielhenrymantilla danielhenrymantilla commented Dec 14, 2018

This list should be completed with any pitfall I may have forgotten to mention, and more external references to blog posts or official documentation should be added.

Lastly, safety-related patterns vs anti-patterns (same folder organization as https://github.com/rust-unofficial/patterns) could be added.

@ad-anssi ad-anssi self-requested a review December 17, 2018 15:17
@ad-anssi
Copy link
Contributor

Hello Daniel,

Thank you for this list of ideas. Your contribution goes precisely in the
direction of this guide: warn about Rust pitfalls, either in 'unsafe', 'safe'
or 'non-unsafe' Rust.
Thus, the points you mention could probably be redistributed in already existing
sections.

I suggest you (or I, if you don't have the time to do it) post issues/PRs to start
discussions while separating the cases; for instance:

  • using 'unsafe' for handling FFI is mentioned in the 'unsafe' section of the
    guide, but I agree with you on the fact that other precautions may be taken
    when doing FFI (the difficulty here is to not include too much information
    that would be specific to the foreign language),

  • panic! topic has been added in 'Error handling' section, but there are still
    things to document,

  • integer overflows are discussed in a dedicated section. Again, there is
    always possible improvements,

  • logic bugs cannot be prevented in the general case, but some language
    constructs may be more error-prone (due to complex operations involved or
    easy misunderstanding for example). These should be documented as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants