diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-07-11 12:38:36 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-11 12:38:36 -0600 |
| commit | 7897ee4d42e42d183d539fdf9fd5389ca249232a (patch) | |
| tree | ea1a2231fbfc235f4e85851311bf1518b01bf684 /src/test/ui/error-codes | |
| parent | 74cc821fd583844fb3e4a0ebbe78a1962e87c4bd (diff) | |
| parent | f68323b28adf9b5ac1d85abe48915bc189aed813 (diff) | |
| download | rust-7897ee4d42e42d183d539fdf9fd5389ca249232a.tar.gz rust-7897ee4d42e42d183d539fdf9fd5389ca249232a.zip | |
Rollup merge of #52207 - RalfJung:unsafety-errors, r=estebank
improve error message shown for unsafe operations Add a short explanation saying why undefined behavior could arise. In particular, the error many people got for "creating a pointer to a packed field requires unsafe block" was not worded great -- it lead to people just adding the unsafe block without considering if what they are doing follows the rules. I am not sure if a "note" is the right thing, but that was the easiest thing to add... Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0133.stderr | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/ui/error-codes/E0133.stderr b/src/test/ui/error-codes/E0133.stderr index dc57a627444..9be80f8f21b 100644 --- a/src/test/ui/error-codes/E0133.stderr +++ b/src/test/ui/error-codes/E0133.stderr @@ -1,8 +1,10 @@ -error[E0133]: call to unsafe function requires unsafe function or block +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/E0133.rs:14:5 | LL | f(); | ^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior error: aborting due to previous error |
