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.
This commit is contained in:
Alex Burka 2016-01-13 01:29:39 -05:00
parent 69719df611
commit e10614a777
3 changed files with 9 additions and 6 deletions

View file

@ -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 {}

View file

@ -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
};
}

View file

@ -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.