]> git.proxmox.com Git - rustc.git/blame - src/doc/nomicon/src/README.md
New upstream version 1.54.0+dfsg1
[rustc.git] / src / doc / nomicon / src / README.md
CommitLineData
8bb4bdeb 1# The Rustonomicon
c1a9b12d 2
dc9dc135 3#### The Dark Arts of Unsafe Rust
450edc1f
XL
4
5> THE KNOWLEDGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
6INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF UNLEASHING INDESCRIBABLE HORRORS THAT
7SHATTER YOUR PSYCHE AND SET YOUR MIND ADRIFT IN THE UNKNOWABLY INFINITE COSMOS.
c1a9b12d 8
dc9dc135
XL
9The Rustonomicon digs into all the awful details that you need to understand when
10writing Unsafe Rust programs.
11
c1a9b12d
SL
12Should you wish a long and happy career of writing Rust programs, you should
13turn back now and forget you ever saw this book. It is not necessary. However
3b2f2976
XL
14if you intend to write unsafe code — or just want to dig into the guts of the
15language — this book contains lots of useful information.
16
17Unlike *[The Rust Programming Language][trpl]*, we will be assuming considerable
18prior knowledge. In particular, you should be comfortable with basic systems
19programming and Rust. If you don't feel comfortable with these topics, you
416331ca 20should consider reading [The Book][trpl] first. That said, we won't assume you
3b2f2976
XL
21have read it, and we will take care to occasionally give a refresher on the
22basics where appropriate. You can skip straight to this book if you want;
23just know that we won't be explaining everything from the ground up.
24
dc9dc135
XL
25This book exists primarily as a high-level companion to [The Reference][ref].
26Where The Reference exists to detail the syntax and semantics of every part of
27the language, The Rustonomicon exists to describe how to use those pieces together,
28and the issues that you will have in doing so.
29
30The Reference will tell you the syntax and semantics of references, destructors, and
31unwinding, but it won't tell you how combining them can lead to exception-safety
32issues, or how to deal with those issues.
33
34It should be noted that when The Rustonomicon was originally written, The
35Reference was in a state of complete disrepair, and so many things that should
36have been covered by The Reference were originally only documented here. Since
37then, The Reference has been revitalized and is properly maintained, although
38it is still far from complete. In general, if the two documents disagree, The
39Reference should be assumed to be correct (it isn't yet considered normative,
40it's just better maintained).
41
42Topics that are within the scope of this book include: the meaning of (un)safety,
43unsafe primitives provided by the language and standard library, techniques for
44creating safe abstractions with those unsafe primitives, subtyping and variance,
45exception-safety (panic/unwind-safety), working with uninitialized memory,
46type punning, concurrency, interoperating with other languages (FFI),
47optimization tricks, how constructs lower to compiler/OS/hardware primitives,
48how to **not** make the memory model people angry, how you're **going** to make the
49memory model people angry, and more.
50
51The Rustonomicon is not a place to exhaustively describe the semantics and guarantees
52of every single API in the standard library, nor is it a place to exhaustively describe
53every feature of Rust.
c1a9b12d 54
3157f602 55[trpl]: ../book/index.html
dc9dc135 56[ref]: ../reference/index.html