From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../region-object-lifetime-in-coercion.stderr | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/ui/regions/region-object-lifetime-in-coercion.stderr (limited to 'src/test/ui/regions/region-object-lifetime-in-coercion.stderr') diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr new file mode 100644 index 000000000..b5bb08c73 --- /dev/null +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -0,0 +1,62 @@ +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-in-coercion.rs:8:12 + | +LL | fn a(v: &[u8]) -> Box { + | - let's call the lifetime of this reference `'1` +LL | let x: Box = Box::new(v); + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` + | +help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` + | +LL | fn a(v: &[u8]) -> Box { + | ~~ +help: alternatively, add an explicit `'static` bound to this reference + | +LL | fn a(v: &'static [u8]) -> Box { + | ~~~~~~~~~~~~~ + +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-in-coercion.rs:14:5 + | +LL | fn b(v: &[u8]) -> Box { + | - let's call the lifetime of this reference `'1` +LL | Box::new(v) + | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + | +help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` + | +LL | fn b(v: &[u8]) -> Box { + | ~~ +help: alternatively, add an explicit `'static` bound to this reference + | +LL | fn b(v: &'static [u8]) -> Box { + | ~~~~~~~~~~~~~ + +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-in-coercion.rs:21:5 + | +LL | fn c(v: &[u8]) -> Box { + | - let's call the lifetime of this reference `'1` +... +LL | Box::new(v) + | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + | +help: to declare that the trait object captures data from argument `v`, you can add an explicit `'_` lifetime bound + | +LL | fn c(v: &[u8]) -> Box { + | ++++ + +error: lifetime may not live long enough + --> $DIR/region-object-lifetime-in-coercion.rs:26:5 + | +LL | fn d<'a,'b>(v: &'a [u8]) -> Box { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | Box::new(v) + | ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | + = help: consider adding the following bound: `'a: 'b` + +error: aborting due to 4 previous errors + -- cgit v1.2.3