2018-12-12 15:57:47 -06:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
fn foo(d: impl Debug + 'static) {
|
2023-10-08 05:06:17 -05:00
|
|
|
//~^ HELP consider adding an explicit lifetime bound
|
2018-12-12 15:57:47 -06:00
|
|
|
bar(d);
|
|
|
|
//~^ ERROR the parameter type `impl Debug` may not live long enough
|
2023-09-17 09:32:02 -05:00
|
|
|
//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
|
2018-12-12 15:57:47 -06:00
|
|
|
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
|
|
|
|
}
|
|
|
|
|
2022-04-01 12:13:25 -05:00
|
|
|
fn bar(d: impl Debug + 'static) {
|
2018-12-12 15:57:47 -06:00
|
|
|
println!("{:?}", d)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo("hi");
|
|
|
|
}
|