From e10614a77789f4b69ccc8cb777aaec035c99ae6f Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Wed, 13 Jan 2016 01:29:39 -0500 Subject: [PATCH] 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. --- src/test/compile-fail/range-1.rs | 2 +- src/test/compile-fail/range-2.rs | 10 ++++++---- src/test/run-pass/range.rs | 3 ++- 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 b839902c6832..e4ab5829f416 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 c9053328572b..94967693ecf9 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 24261772add0..4c249bbe1f73 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.