rust/tests/ui/suggestions/suggest-impl-trait-lifetime.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
371 B
Rust
Raw Normal View History

// run-rustfix
use std::fmt::Debug;
fn foo(d: impl Debug) {
//~^ HELP consider adding an explicit lifetime bound...
bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
//~| 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) {
println!("{:?}", d)
}
fn main() {
foo("hi");
}