From 2b5d0cb87b13fd5354143bb0b802d06ca0715ca6 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 4 Dec 2022 17:15:19 -0300 Subject: Add test by steffahn --- tests/ui/no_uaf_2.stderr | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/ui/no_uaf_2.stderr (limited to 'tests/ui/no_uaf_2.stderr') diff --git a/tests/ui/no_uaf_2.stderr b/tests/ui/no_uaf_2.stderr new file mode 100644 index 0000000..5737a38 --- /dev/null +++ b/tests/ui/no_uaf_2.stderr @@ -0,0 +1,10 @@ +error[E0716]: temporary value dropped while borrowed + --> tests/ui/no_uaf_2.rs:30:21 + | +29 | s.as_ref().operate_in(|r| { + | - has type `OperateIn<'1, MyStructKey>` +30 | r.cell.set(&String::from("hello world")); // temporary dropped at end of this statement + | ------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement + | | | + | | creates a temporary value which is freed while still in use + | argument requires that borrow lasts for `'1` -- cgit 1.4.1