rust/tests/ui/impl-trait/unactionable_diagnostic.rs

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

26 lines
378 B
Rust
Raw Normal View History

//@ run-rustfix
2022-09-01 15:41:13 +00:00
pub trait Trait {}
pub struct Foo;
2022-09-01 15:41:13 +00:00
impl Trait for Foo {}
2022-09-23 07:10:11 +00:00
fn foo<'x, P>(
_post: P,
2022-09-23 07:10:11 +00:00
x: &'x Foo,
) -> &'x impl Trait {
2022-09-01 15:41:13 +00:00
x
}
pub fn bar<'t, T>(
2023-10-08 10:06:17 +00:00
//~^ HELP: consider adding an explicit lifetime bound
2022-09-01 15:41:13 +00:00
post: T,
x: &'t Foo,
) -> &'t impl Trait {
foo(post, x)
//~^ ERROR: the parameter type `T` may not live long enough
2022-09-01 15:41:13 +00:00
}
fn main() {}