Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upClarify role of unsafe functions #179
Comments
This comment has been minimized.
This comment has been minimized.
epage
commented
Sep 10, 2018
|
Hints towards API invariants:
https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe-rust.html |
This comment has been minimized.
This comment has been minimized.
epage
commented
Sep 10, 2018
|
Hints towards undefined behavior:
https://doc.rust-lang.org/nomicon/what-unsafe-does.html
https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe-rust.html |
This comment has been minimized.
This comment has been minimized.
epage
commented
Sep 10, 2018
|
An example of a way to break invariants of an API that doesn't result in UB, and as such is explicitly not marked as unsafe: https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html
|
This comment has been minimized.
This comment has been minimized.
|
Can we think of any examples of |
This comment has been minimized.
This comment has been minimized.
epage
commented
Jan 10, 2019
I missed the "in the ecosystem" part of your question. While I don't know of an existing use, this came up because of crate-ci/escargot#6 where I am concerned about the brittleness of some functions and am considering marking them I do see value in other cases. For example, I remember a |
epage commentedSep 10, 2018
The only things the guidelines say about
unsafefunctions are:Should
unsafebe reserved for compiler Undefined Behavior or also bypassing API invariant checks?