Skip to content

Commit b75956d

Browse files
committed
Add an unstable book entry
1 parent 7f4aee7 commit b75956d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/doc/unstable-book/src/language-features/intrinsics.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@
22

33
The 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
66
exported in some sort of stable manner. Prefer using the stable interfaces to
77
the 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+
1231
These are imported as if they were FFI functions, with the special
1332
`rust-intrinsic` ABI. For example, if one was in a freestanding
1433
context, but wished to be able to `transmute` between types, and

0 commit comments

Comments
 (0)