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