Skip to content

Commit

Permalink
Auto merge of #1328 - RalfJung:align-false-pos, r=RalfJung
Browse files Browse the repository at this point in the history
for alignment errors, note that there might be false positives

Cc @shepmaster

```
error: Undefined Behavior: accessing memory with alignment 1, but alignment 8 is required
 --> tests/compile-fail/unaligned_pointers/alignment.rs:8:9
  |
8 |         *y_ptr = 42;
  |         ^^^^^^^^^^^ accessing memory with alignment 1, but alignment 8 is required
  |
  = help: this usually indicates that your program performed an invalid operation and caused Undefined Behavior
  = help: but alignment errors can also be false positives, see #1074
```
  • Loading branch information
bors committed Apr 13, 2020
2 parents 4545eff + 75297d3 commit fbbd442
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ pub fn report_error<'tcx, 'mir>(
vec![format!("make sure to use a Miri sysroot, which you can prepare with `cargo miri setup`")],
Unsupported(_) =>
vec![format!("this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support")],
UndefinedBehavior(UndefinedBehaviorInfo::AlignmentCheckFailed { .. }) =>
vec![
format!("this usually indicates that your program performed an invalid operation and caused Undefined Behavior"),
format!("but alignment errors can also be false positives, see https://github.com/rust-lang/miri/issues/1074"),
],
UndefinedBehavior(_) =>
vec![
format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior"),
Expand Down

0 comments on commit fbbd442

Please sign in to comment.