2024-04-21 15:27:27 +00:00
|
|
|
//@ run-rustfix
|
2024-11-09 18:21:03 +00:00
|
|
|
//@ edition: 2018
|
2024-04-21 15:27:27 +00:00
|
|
|
|
2024-07-12 10:12:24 +00:00
|
|
|
#![allow(unused)]
|
2024-04-21 15:27:27 +00:00
|
|
|
#![deny(impl_trait_overcaptures)]
|
|
|
|
|
|
|
|
fn named<'a>(x: &'a i32) -> impl Sized { *x }
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
2024-08-26 06:46:56 +00:00
|
|
|
//~| WARN this changes meaning in Rust 2024
|
2024-04-21 15:27:27 +00:00
|
|
|
|
|
|
|
fn implicit(x: &i32) -> impl Sized { *x }
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
2024-08-26 06:46:56 +00:00
|
|
|
//~| WARN this changes meaning in Rust 2024
|
2024-04-21 15:27:27 +00:00
|
|
|
|
|
|
|
struct W;
|
|
|
|
impl W {
|
|
|
|
fn hello(&self, x: &i32) -> impl Sized + '_ { self }
|
|
|
|
//~^ ERROR `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024
|
2024-08-26 06:46:56 +00:00
|
|
|
//~| WARN this changes meaning in Rust 2024
|
2024-04-21 15:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Higher<'a> {
|
|
|
|
type Output;
|
|
|
|
}
|
|
|
|
impl Higher<'_> for () {
|
|
|
|
type Output = ();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {}
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
2024-08-26 06:46:56 +00:00
|
|
|
//~| WARN this changes meaning in Rust 2024
|
2024-04-21 15:27:27 +00:00
|
|
|
|
2024-11-09 19:16:43 +00:00
|
|
|
fn apit(_: &impl Sized) -> impl Sized {}
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
|
|
|
//~| WARN this changes meaning in Rust 2024
|
|
|
|
|
|
|
|
fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {}
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
|
|
|
//~| WARN this changes meaning in Rust 2024
|
|
|
|
|
2024-11-09 18:21:03 +00:00
|
|
|
async fn async_fn<'a>(x: &'a ()) -> impl Sized {}
|
|
|
|
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
|
|
|
|
//~| WARN this changes meaning in Rust 2024
|
|
|
|
|
2024-12-10 20:41:24 +00:00
|
|
|
pub fn parens(x: &i32) -> &impl Clone { x }
|
|
|
|
//~^ ERROR `impl Clone` will capture more lifetimes than possibly intended in edition 2024
|
|
|
|
//~| WARN this changes meaning in Rust 2024
|
|
|
|
|
2024-04-21 15:27:27 +00:00
|
|
|
fn main() {}
|