blob: 014ab23e4ebc2666b6b79c60a0eb4dcc7d9aa149 [file] [log] [blame]
//@ run-rustfix
#![feature(precise_capturing)]
#![allow(unused, incomplete_features)]
#![deny(impl_trait_overcaptures)]
fn named<'a>(x: &'a i32) -> impl use<> Sized { *x }
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
fn implicit(x: &i32) -> impl use<> Sized { *x }
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
struct W;
impl W {
fn hello(&self, x: &i32) -> impl use<'_> Sized + '_ { self }
//~^ ERROR `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024
}
trait Higher<'a> {
type Output;
}
impl Higher<'_> for () {
type Output = ();
}
fn hrtb() -> impl for<'a> Higher<'a, Output = impl use<> Sized> {}
//~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024
fn main() {}