File tree 1 file changed +20
-1
lines changed
src/doc/unstable-book/src/language-features
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
The tracking issue for this feature is: None.
4
4
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
6
6
exported in some sort of stable manner. Prefer using the stable interfaces to
7
7
the intrinsic directly when you can.
8
8
9
9
------------------------
10
10
11
11
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
+
12
31
These are imported as if they were FFI functions, with the special
13
32
` rust-intrinsic ` ABI. For example, if one was in a freestanding
14
33
context, but wished to be able to ` transmute ` between types, and
You can’t perform that action at this time.
0 commit comments