Add test for implicitly capturing late-bound var with new capture rules

This commit is contained in:
Michael Goulet 2023-10-19 19:01:59 +00:00
parent 0ad160a585
commit acba7efe1b
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// known-bug: #117647
#![feature(lifetime_capture_rules_2024)]
#![feature(rustc_attrs)]
#![allow(internal_features)]
#![rustc_variance_of_opaques]
use std::ops::Deref;
fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> {
Box::new(x)
}
fn main() {}

View File

@ -0,0 +1,9 @@
error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level
--> $DIR/implicit-capture-late.rs:10:36
|
LL | fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> {
| ^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0657`.