about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-08-08 14:50:27 -0700
committerRalf Jung <post@ralfj.de>2017-08-08 14:50:27 -0700
commit21a707ee97e8d274acf0359a3c3e33050245056e (patch)
tree811ff37943e38bcf5940aaf4f50a0e32e07ea232
parent94f7511ac242dbdc171be2acefa089e5a9b32562 (diff)
downloadrust-21a707ee97e8d274acf0359a3c3e33050245056e.tar.gz
rust-21a707ee97e8d274acf0359a3c3e33050245056e.zip
explain that the example is indeed UB, but that's okay
-rw-r--r--src/test/mir-opt/validate_5.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/mir-opt/validate_5.rs b/src/test/mir-opt/validate_5.rs
index 150aa2baf2d..0182e6e2964 100644
--- a/src/test/mir-opt/validate_5.rs
+++ b/src/test/mir-opt/validate_5.rs
@@ -26,6 +26,9 @@ fn main() {
     test(&mut 0);
 
     let test_closure = unsafe { |x: &mut i32| write_42(x) };
+    // Note that validation will fail if this is executed: The closure keeps the lock on
+    // x, so the write in write_42 fails.  This test just checks code generation,
+    // so the UB doesn't matter.
     test_closure(&mut 0);
 }