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

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

28 lines
853 B
Rust
Raw Normal View History

2024-04-20 15:22:06 +00:00
//@ compile-flags: -Zunstable-options --edition=2024
2024-06-20 16:17:42 +00:00
//@ revisions: normal rpitit
//@[normal] check-pass
2024-04-20 15:22:06 +00:00
#![feature(precise_capturing)]
2024-06-05 20:18:52 +00:00
fn hello<'a>() -> impl Sized + use<'a> {}
2024-06-20 16:17:42 +00:00
//[normal]~^ WARN 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<'_> {}
2024-06-20 16:17:42 +00:00
//[normal]~^ WARN all possible in-scope parameters are already captured
2024-04-20 15:22:06 +00:00
}
2024-06-20 16:17:42 +00:00
#[cfg(rpitit)]
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>;
2024-06-20 16:17:42 +00:00
//[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
2024-04-20 15:22:06 +00:00
}
2024-06-20 16:17:42 +00:00
#[cfg(rpitit)]
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> {}
2024-06-20 16:17:42 +00:00
//[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits
2024-04-20 15:22:06 +00:00
}
fn main() {}