]> git.proxmox.com Git - rustc.git/blame - src/doc/trpl/intrinsics.md
Imported Upstream version 1.5.0+dfsg1
[rustc.git] / src / doc / trpl / intrinsics.md
CommitLineData
c34b1796
AL
1% Intrinsics
2
3> **Note**: intrinsics will forever have an unstable interface, it is
4> recommended to use the stable interfaces of libcore rather than intrinsics
5> directly.
6
7These are imported as if they were FFI functions, with the special
8`rust-intrinsic` ABI. For example, if one was in a freestanding
9context, but wished to be able to `transmute` between types, and
10perform efficient pointer arithmetic, one would import those functions
11via a declaration like
12
62682a34 13```rust
c1a9b12d 14#![feature(intrinsics)]
c34b1796
AL
15# fn main() {}
16
17extern "rust-intrinsic" {
18 fn transmute<T, U>(x: T) -> U;
19
20 fn offset<T>(dst: *const T, offset: isize) -> *const T;
21}
22```
23
24As with any other FFI functions, these are always `unsafe` to call.
25