File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 22
33The tracking issue for this feature is: None.
44
5- Intrinsics are never intended to be stable directly, but intrinsics are often
5+ Intrinsics are rarely intended to be stable directly, but are usually
66exported in some sort of stable manner. Prefer using the stable interfaces to
77the intrinsic directly when you can.
88
99------------------------
1010
1111
12+ ## Intrinsics with fallback logic
13+
14+ Many intrinsics can be written in pure rust, albeit inefficiently or without supporting
15+ some features that only exist on some backends. Backends can simply not implement those
16+ intrinsics without causing any code miscompilations or failures to compile.
17+
18+ ``` rust
19+ #![feature(core_intrinsics)]
20+
21+ #[rustc_intrinsic(name_of_things)]
22+ fn foo () -> u32 {
23+ 42
24+ }
25+ ```
26+
27+ ## Intrinsics without fallback logic
28+
29+ These must be implemented by all backends.
30+
1231These are imported as if they were FFI functions, with the special
1332` rust-intrinsic ` ABI. For example, if one was in a freestanding
1433context, but wished to be able to ` transmute ` between types, and
You can’t perform that action at this time.
0 commit comments