summary refs log tree commit diff stats
path: root/tests/ui/no_uaf_1.stderr
blob: af0d3e69871b8c3378b6ac948da598e05a2e8485 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
error[E0521]: borrowed data escapes outside of closure
  --> tests/ui/no_uaf_1.rs:23:13
   |
21 |           let rc_clone = rc.clone();
   |               -------- `rc_clone` declared here, outside of the closure body
22 |           let x = Holder::<'_, FooOpaque>::new_with(move |builder| {
   |                                                           ------- `builder` is a reference that is only valid in the closure body
23 | /             builder.build(Foo {
24 | |                 x: "Hello".to_owned(),
25 | |                 y: rc_clone,
26 | |             });
   | |______________^ `builder` escapes the closure body here
   |
   = note: requirement occurs because of a mutable reference to `selfref::Builder<'_, FooOpaque>`
   = note: mutable references are invariant over their type parameter
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance