summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-addr-of-arg.stderr
blob: 99060a9c7f59ffe125f44fb11e322e0997b041a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
error[E0597]: `a` does not live long enough
  --> $DIR/regions-addr-of-arg.rs:5:30
   |
LL | fn foo(a: isize) {
   |        - binding `a` declared here
LL |     let _p: &'static isize = &a;
   |             --------------   ^^ borrowed value does not live long enough
   |             |
   |             type annotation requires that `a` is borrowed for `'static`
LL | }
   |  - `a` dropped here while still borrowed

error[E0515]: cannot return reference to function parameter `a`
  --> $DIR/regions-addr-of-arg.rs:13:5
   |
LL |     &a
   |     ^^ returns a reference to data owned by the current function

error: aborting due to 2 previous errors

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