summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
blob: 4f2fd5ba6001b30b870fd9c48c20019fd1d0600e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-rustfix

use std::fmt::Debug;

fn foo(d: impl Debug + 'static) {
//~^ HELP consider adding an explicit lifetime bound
    bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
}

fn bar(d: impl Debug + 'static) {
    println!("{:?}", d)
}

fn main() {
  foo("hi");
}