summary refs log tree commit diff
path: root/tests/ui/impl-trait/precise-capturing/redundant.rs
blob: ef4f05bd7e458adbe429e58db4c104b542572d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@ compile-flags: -Zunstable-options --edition=2024
//@ revisions: normal rpitit
//@[normal] check-pass

#![feature(precise_capturing)]

fn hello<'a>() -> impl Sized + use<'a> {}
//[normal]~^ WARN all possible in-scope parameters are already captured

struct Inherent;
impl Inherent {
    fn inherent(&self) -> impl Sized + use<'_> {}
    //[normal]~^ WARN all possible in-scope parameters are already captured
}

#[cfg(rpitit)]
trait Test<'a> {
    fn in_trait() -> impl Sized + use<'a, Self>;
    //[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
}
#[cfg(rpitit)]
impl<'a> Test<'a> for () {
    fn in_trait() -> impl Sized + use<'a> {}
    //[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
}

fn main() {}