-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for implicitly capturing late-bound var with new capture rules
- Loading branch information
1 parent
0ad160a
commit acba7ef
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |