From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/suggestions/lifetimes/issue-105544.fixed | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/ui/suggestions/lifetimes/issue-105544.fixed (limited to 'tests/ui/suggestions/lifetimes/issue-105544.fixed') diff --git a/tests/ui/suggestions/lifetimes/issue-105544.fixed b/tests/ui/suggestions/lifetimes/issue-105544.fixed new file mode 100644 index 000000000..47087eb47 --- /dev/null +++ b/tests/ui/suggestions/lifetimes/issue-105544.fixed @@ -0,0 +1,45 @@ +// run-rustfix + +#![allow(warnings)] + +fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here... +//~^ HELP consider adding an explicit lifetime bound + (d, p) + //~^ ERROR the parameter type `impl Sized` may not live long enough + //~| NOTE ...so that the type `impl Sized` will meet its required lifetime bounds +} + +fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ { +//~^ HELP consider adding an explicit lifetime bound... + (d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds + //~^ ERROR the parameter type `impl Sized` may not live long enough +} + +fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here... +//~^ HELP consider adding an explicit lifetime bound + (d, p) + //~^ ERROR the parameter type `impl Sized + 'a` may not live long enough + //~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds +} + +fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... +//~^ HELP consider adding an explicit lifetime bound + (d, p) + //~^ ERROR the parameter type `T` may not live long enough + //~| NOTE ...so that the type `T` will meet its required lifetime bounds +} + +fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { +//~^ HELP consider adding an explicit lifetime bound... + (d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds + //~^ ERROR the parameter type `T` may not live long enough +} + +fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... +//~^ HELP consider adding an explicit lifetime bound + (d, p) + //~^ ERROR the parameter type `T` may not live long enough + //~| NOTE ...so that the type `T` will meet its required lifetime bounds +} + +fn main() {} -- cgit v1.2.3