]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/nll/mir_check_cast_unsize.stderr
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / nll / mir_check_cast_unsize.stderr
index 189bb2dff527550574595a34161d0986b984d685..8d02ef71d1bc6c3636e906620b1debf76b8b0d06 100644 (file)
@@ -1,10 +1,15 @@
-error: unsatisfied lifetime constraints
+error: lifetime may not live long enough
   --> $DIR/mir_check_cast_unsize.rs:8:5
    |
 LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
    |        -- lifetime `'a` defined here
 LL |     x
    |     ^ returning this value requires that `'a` must outlive `'static`
+   |
+help: to declare that the trait object captures data from argument `x`, you can add an explicit `'a` lifetime bound
+   |
+LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug + 'a {
+   |                                              ++++
 
 error: aborting due to previous error