struct UnsafeFnMarker

Declaration

struct UnsafeFnMarker { /* full declaration omitted */ };

Description

A marker that designates a function as unsafe, or containing Undefined Behaviour if its preconditions are not met. Use of an unsafe function should require a comment documenting how the required preconditions are met in the form: ``` // SAFETY: This is known to be true because of that which we checked there. do_risky_thing(unsafe_fn); ``` Input conditions of the unsafe function should be well encapsulated so that it is even possible to reason about how they are met and to maintain that over time. To call such an unsafe function, pass it the global [`unsafe_fn`]( $sus::marker::unsafe_fn) object, which is brought into the global namespace by `#include "sus/prelude.h"`.

Declared at: sus/marker/unsafe.h:48

Method Overview

Methods

ΒΆconsteval UnsafeFnMarker()

Description

`explicit` prevents `{}` or `{any values...}` from being used to construct an `UnsafeFnMarker`. The marker should only be used as [`unsafe_fn`]( $sus::marker::unsafe_fn). #[doc.hidden]

Declared at: sus/marker/unsafe.h:53