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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
393 B
Rust
Raw Normal View History

2014-12-15 01:23:00 +00:00
// Test range syntax - borrow errors.
#![feature(rustc_attrs)]
pub fn main() { #![rustc_error] // rust-lang/rust#49855
2014-12-15 01:23:00 +00:00
let r = {
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
r.use_ref();
2014-12-15 01:23:00 +00:00
}
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
impl<T> Fake for T { }