diff options
Diffstat (limited to 'tests/ui/regions/regions-addr-of-upvar-self.rs')
-rw-r--r-- | tests/ui/regions/regions-addr-of-upvar-self.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/regions/regions-addr-of-upvar-self.rs b/tests/ui/regions/regions-addr-of-upvar-self.rs new file mode 100644 index 000000000..171eca32e --- /dev/null +++ b/tests/ui/regions/regions-addr-of-upvar-self.rs @@ -0,0 +1,18 @@ +struct Dog { + food: usize, +} + +impl Dog { + pub fn chase_cat(&mut self) { + let _f = || { + let p: &'static mut usize = &mut self.food; + //~^ ERROR lifetime may not live long enough + //~^^ ERROR lifetime may not live long enough + //~^^^ ERROR E0597 + *p = 3; + }; + } +} + +fn main() { +} |