Add test for implicitly capturing late-bound var with new capture rules
This commit is contained in:
parent
0ad160a585
commit
acba7efe1b
14
tests/ui/impl-trait/implicit-capture-late.rs
Normal file
14
tests/ui/impl-trait/implicit-capture-late.rs
Normal 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() {}
|
9
tests/ui/impl-trait/implicit-capture-late.stderr
Normal file
9
tests/ui/impl-trait/implicit-capture-late.stderr
Normal 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`.
|
Loading…
Reference in New Issue
Block a user