Skip to content

Commit

Permalink
Improve E0133 error explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 27, 2016
1 parent ab7c35f commit c848ca1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/librustc/diagnostics.rs
Expand Up @@ -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:
Expand All @@ -378,7 +390,7 @@ unsafe instructions with an `unsafe` block. For instance:
unsafe fn f() { return; }
fn main() {
unsafe { f(); }
unsafe { f(); } // ok!
}
```
Expand Down

0 comments on commit c848ca1

Please sign in to comment.