Files
rust/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs

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

17 lines
299 B
Rust
Raw Normal View History

2022-05-22 02:05:15 -04:00
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
2017-08-06 04:09:43 +05:30
struct Ref<'a, 'b> {
a: &'a u32,
b: &'b u32,
}
2017-08-06 04:09:43 +05:30
fn foo(mut x: Ref, y: &u32) {
2022-05-22 02:05:15 -04:00
x.b = y;
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
2017-08-06 04:09:43 +05:30
}
fn main() {}