@@ -108,11 +108,24 @@ $ cat .cargo/config
108
108
109
109
## eh_personality
110
110
111
- If your [ target] [ custom-target ] does not contain ` "panic-strategy": "abort" ` , which most targets for
112
- full operating systems don't, then you must add an ` eh_personality ` function, which requires a
113
- nightly compiler. [ Here is Rust's documentation about it] [ more-about-lang-items ] , and [ here is some
114
- discussion about it] [ til-why-eh-personality ] . A simple implementation that does not do anything
115
- special when unwinding is as follows:
111
+ If your configuration does not unconditionally abort on panic, which most targets for full operating
112
+ systems don't (or if your [ custom target] [ custom-target ] does not contain
113
+ ` "panic-strategy": "abort" ` ), then you must tell Cargo to do so or add an ` eh_personality ` function,
114
+ which requires a nightly compiler. [ Here is Rust's documentation about it] [ more-about-lang-items ] ,
115
+ and [ here is some discussion about it] [ til-why-eh-personality ] .
116
+
117
+ In your Cargo.toml, add:
118
+
119
+ ``` toml
120
+ [profile .dev ]
121
+ panic = " abort"
122
+
123
+ [profile .release ]
124
+ panic = " abort"
125
+ ```
126
+
127
+ Alternatively, declare the ` eh_personality ` function. A simple implementation that does not do
128
+ anything special when unwinding is as follows:
116
129
117
130
``` rust
118
131
#![feature(lang_items)]
@@ -121,6 +134,9 @@ special when unwinding is as follows:
121
134
extern " C" fn eh_personality () {}
122
135
```
123
136
137
+ You will receive the error ` language item required, but not found: 'eh_personality' ` if not
138
+ included.
139
+
124
140
[ custom-target ] : ./custom-target.md
125
141
[ more-about-lang-items] :
126
142
https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#more-about-the-language-items
0 commit comments