Improve E0133 error explanation
This commit is contained in:
parent
ab7c35fa0f
commit
c848ca1f8d
1 changed files with 13 additions and 1 deletions
|
@ -364,6 +364,18 @@ type X = u32; // ok!
|
|||
"##,
|
||||
|
||||
E0133: r##"
|
||||
Unsafe code was used outside of an unsafe function or block.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail
|
||||
unsafe fn f() { return; } // This is the unsafe code
|
||||
|
||||
fn main() {
|
||||
f(); // error: call to unsafe function requires unsafe function or block
|
||||
}
|
||||
```
|
||||
|
||||
Using unsafe functionality is potentially dangerous and disallowed by safety
|
||||
checks. Examples:
|
||||
|
||||
|
@ -378,7 +390,7 @@ unsafe instructions with an `unsafe` block. For instance:
|
|||
unsafe fn f() { return; }
|
||||
|
||||
fn main() {
|
||||
unsafe { f(); }
|
||||
unsafe { f(); } // ok!
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue