mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
20 lines
452 B
Rust
20 lines
452 B
Rust
//@ 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 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");
|
|
}
|