]> git.lizzy.rs Git - rust.git/commitdiff
update compile-fail/pushpop-unsafe-rejects.rs to reflect switch from saturated to...
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 23 Jul 2015 21:39:02 +0000 (23:39 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 23 Jul 2015 21:39:28 +0000 (23:39 +0200)
src/test/compile-fail/pushpop-unsafe-rejects.rs

index ad6fd5094db4a40e10bdc72fd753f0963d92e2ed..72c065ae714173e769051ea1751c7668a0322140 100644 (file)
@@ -45,29 +45,30 @@ fn main() {
     });
 
 
-    // Note: For implementation simplicity I have chosen to just have
-    // the stack do "saturated pop", but perhaps we would prefer to
-    // have cases like these two here be errors:
-
-    pop_unsafe!{ g() };
-
-    push_unsafe!({
-        pop_unsafe!(pop_unsafe!{ g() })
-    });
-
-
-    // Okay, back to examples that do error, even in the presence of
-    // "saturated pop"
-
-    push_unsafe!({
-        g();
-        pop_unsafe!(pop_unsafe!({
-            f() //~ ERROR: call to unsafe function
-        }))
-    });
-
-    pop_unsafe!({
-        f(); //~ ERROR: call to unsafe function
-    })
+    // Note: For implementation simplicity the compiler just
+    // ICE's if you underflow the push_unsafe stack.
+    //
+    // Thus all of the following cases cause an ICE.
+    //
+    // (The "ERROR" notes are from an earlier version
+    //  that used saturated arithmetic rather than checked
+    //  arithmetic.)
+
+    //    pop_unsafe!{ g() };
+    //
+    //    push_unsafe!({
+    //        pop_unsafe!(pop_unsafe!{ g() })
+    //    });
+    //
+    //    push_unsafe!({
+    //        g();
+    //        pop_unsafe!(pop_unsafe!({
+    //            f() // ERROR: call to unsafe function
+    //        }))
+    //    });
+    //
+    //    pop_unsafe!({
+    //        f(); // ERROR: call to unsafe function
+    //    })
 
 }