On 08-11-21, 17:27, Miguel Ojeda wrote:
Note that these should be in the body, as a normal comment right before `unsafe` blocks explaining why the block is sound, e.g.:
// SAFETY: `x` is dereferencable by the type invariants. unsafe { *x }
I think you are confusing them with the ones in the function documentation, which are a Markdown section (`#`) used in unsafe functions to explain the preconditions on the caller:
/// Does foo and bar /// /// # Safety /// /// `x` must be a multiple of 2. unsafe fn f(x: u32) { // ... }
I get that now. Actually I tried to find documentation on the Safety comments and failed to find any. Is this undocumented tribal knowledge or is really suggested by Rust documentation which I missed to find ?