about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-01-13 01:29:39 -0500
committerAlex Burka <aburka@seas.upenn.edu>2016-02-27 02:01:41 -0500
commite10614a77789f4b69ccc8cb777aaec035c99ae6f (patch)
tree67266d766051b37ae9b90e5c06f6d890c4d50674
parent69719df6116b584b71ee5a8d22974835c33b13be (diff)
downloadrust-e10614a77789f4b69ccc8cb777aaec035c99ae6f.tar.gz
rust-e10614a77789f4b69ccc8cb777aaec035c99ae6f.zip
adjust range tests
Since the desugaring removed special handling for ranges, the error
message changed and so I had to adjust `range-1`.

Turns out there was a bug where borrowck was too restrictive in some
rare cases of constructing ranges from literals. The `range-2` test
enshrined this bug -- now it's adjusted to test a case that's actually
wrong.
-rw-r--r--src/test/compile-fail/range-1.rs2
-rw-r--r--src/test/compile-fail/range-2.rs10
-rw-r--r--src/test/run-pass/range.rs3
3 files changed, 9 insertions, 6 deletions
diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs
index b839902c683..e4ab5829f41 100644
--- a/src/test/compile-fail/range-1.rs
+++ b/src/test/compile-fail/range-1.rs
@@ -13,7 +13,7 @@
 pub fn main() {
     // Mixed types.
     let _ = 0u32..10i32;
-    //~^ ERROR start and end of range have incompatible types
+    //~^ ERROR mismatched types
 
     // Bool => does not implement iterator.
     for i in false..true {}
diff --git a/src/test/compile-fail/range-2.rs b/src/test/compile-fail/range-2.rs
index c9053328572..94967693ecf 100644
--- a/src/test/compile-fail/range-2.rs
+++ b/src/test/compile-fail/range-2.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -12,8 +12,10 @@
 
 pub fn main() {
     let r = {
-        &42..&42
-        //~^ ERROR borrowed value does not live long enough
-        //~^^ ERROR borrowed value does not live long enough
+        let a = 42;
+        let b = 42;
+        &a..&b
+        //~^ ERROR `a` does not live long enough
+        //~^^ ERROR `b` does not live long enough
     };
 }
diff --git a/src/test/run-pass/range.rs b/src/test/run-pass/range.rs
index 24261772add..4c249bbe1f7 100644
--- a/src/test/run-pass/range.rs
+++ b/src/test/run-pass/range.rs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -44,6 +44,7 @@ pub fn main() {
     let _ = 0_usize..4+4-3;
     let _ = 0..foo();
 
+    let _ = { &42..&100 }; // references to literals are OK
     let _ = ..42_usize;
 
     // Test we can use two different types with a common supertype.