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