Files
rust/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs

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

24 lines
603 B
Rust
Raw Normal View History

2022-05-22 01:36:12 -04: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
// 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
}
fn bar(d: impl Debug + 'static) { //~ NOTE ...that is required by this bound
println!("{:?}", d)
}
fn main() {
foo("hi");
}