about summary refs log tree commit diff
path: root/tests/ui/impl-trait/hidden-lifetimes.edition2024.stderr
blob: d585bb50b13f791eed7b4bc159125ce1f5e34a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
error[E0515]: cannot return value referencing local variable `x`
  --> $DIR/hidden-lifetimes.rs:41:5
   |
LL |     hide_ref(&mut res).swap(hide_ref(&mut &x));
   |                                           -- `x` is borrowed here
LL |     res
   |     ^^^ returns a value referencing data owned by the current function

error[E0597]: `x` does not live long enough
  --> $DIR/hidden-lifetimes.rs:57:38
   |
LL |     let x = [1, 2, 3];
   |         - binding `x` declared here
LL |     let short = Rc::new(RefCell::new(&x));
   |                                      ^^ borrowed value does not live long enough
LL |     hide_rc_refcell(long.clone()).swap(hide_rc_refcell(short));
LL |     let res: &'static [i32; 3] = *long.borrow();
   |              ----------------- type annotation requires that `x` is borrowed for `'static`
LL |     res
LL | }
   | - `x` dropped here while still borrowed

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0515, E0597.
For more information about an error, try `rustc --explain E0515`.