2022-05-22 05:36:12 +00:00
|
|
|
// FIXME(nll): On NLL stabilization, this should be replaced by
|
|
|
|
// `suggest-impl-trait-lifetime-nll.rs`. Compiletest has
|
|
|
|
// problems with rustfix and revisions.
|
|
|
|
// ignore-compare-mode-nll
|
|
|
|
|
2018-12-12 21:57:47 +00:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
fn foo(d: impl Debug + 'static) {
|
2020-02-20 02:04:03 +00:00
|
|
|
//~^ HELP consider adding an explicit lifetime bound...
|
2018-12-12 21:57:47 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-07-30 15:12:10 +00:00
|
|
|
fn bar(d: impl Debug + 'static) { //~ NOTE ...that is required by this bound
|
2018-12-12 21:57:47 +00:00
|
|
|
println!("{:?}", d)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo("hi");
|
|
|
|
}
|