rust/tests/ui/span/range-2.rs

16 lines
393 B
Rust
Raw Normal View History

2014-12-14 19:23:00 -06:00
// Test range syntax - borrow errors.
#![feature(rustc_attrs)]
pub fn main() { #![rustc_error] // rust-lang/rust#49855
2014-12-14 19:23:00 -06:00
let r = {
let a = 42;
let b = 42;
&a..&b
2014-12-14 19:23:00 -06:00
};
2017-12-13 19:27:23 -06:00
//~^^ ERROR `a` does not live long enough
//~| ERROR `b` does not live long enough
r.use_ref();
2014-12-14 19:23:00 -06:00
}
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }