diff options
Diffstat (limited to 'src/test/ui/nll/issue-48697.rs')
-rw-r--r-- | src/test/ui/nll/issue-48697.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs new file mode 100644 index 000000000..16e29ab2a --- /dev/null +++ b/src/test/ui/nll/issue-48697.rs @@ -0,0 +1,10 @@ +// Regression test for #48697 + +fn foo(x: &i32) -> &i32 { + let z = 4; + let f = &|y| y; + let k = f(&z); + f(x) //~ cannot return value referencing local variable +} + +fn main() {} |