rust/tests/ui/impl-trait/precise-capturing/redundant.rs

24 lines
617 B
Rust
Raw Permalink Normal View History

2024-11-22 15:20:22 +00:00
//@ edition: 2024
2024-09-29 17:41:13 +00:00
#![deny(impl_trait_redundant_captures)]
2024-04-20 15:22:06 +00:00
2024-06-05 20:18:52 +00:00
fn hello<'a>() -> impl Sized + use<'a> {}
//~^ ERROR all possible in-scope parameters are already captured
2024-04-20 15:22:06 +00:00
struct Inherent;
impl Inherent {
2024-06-05 20:18:52 +00:00
fn inherent(&self) -> impl Sized + use<'_> {}
//~^ ERROR all possible in-scope parameters are already captured
2024-04-20 15:22:06 +00:00
}
trait Test<'a> {
2024-06-05 20:18:52 +00:00
fn in_trait() -> impl Sized + use<'a, Self>;
//~^ ERROR all possible in-scope parameters are already captured
2024-04-20 15:22:06 +00:00
}
impl<'a> Test<'a> for () {
2024-06-05 20:18:52 +00:00
fn in_trait() -> impl Sized + use<'a> {}
//~^ ERROR all possible in-scope parameters are already captured
2024-04-20 15:22:06 +00:00
}
fn main() {}