diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/closures/2229_closure_analysis/nested-closure.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/closures/2229_closure_analysis/nested-closure.rs')
-rw-r--r-- | src/test/ui/closures/2229_closure_analysis/nested-closure.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs b/src/test/ui/closures/2229_closure_analysis/nested-closure.rs deleted file mode 100644 index 22eae744b..000000000 --- a/src/test/ui/closures/2229_closure_analysis/nested-closure.rs +++ /dev/null @@ -1,53 +0,0 @@ -// edition:2021 - -#![feature(rustc_attrs)] - -struct Point { - x: i32, - y: i32, -} - -// This testcase ensures that nested closures are handles properly -// - The nested closure is analyzed first. -// - The capture kind of the nested closure is accounted for by the enclosing closure -// - Any captured path by the nested closure that starts off a local variable in the enclosing -// closure is not listed as a capture of the enclosing closure. - -fn main() { - let mut p = Point { x: 5, y: 20 }; - - let mut c1 = #[rustc_capture_analysis] - //~^ ERROR: attributes on expressions are experimental - //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> - || { - //~^ ERROR: First Pass analysis includes: - //~| ERROR: Min Capture analysis includes: - println!("{}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow - let incr = 10; - let mut c2 = #[rustc_capture_analysis] - //~^ ERROR: attributes on expressions are experimental - //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> - || p.y += incr; - //~^ ERROR: First Pass analysis includes: - //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Capturing incr[] -> ImmBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture incr[] -> ImmBorrow - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow - c2(); - println!("{}", p.y); - //~^ NOTE: Capturing p[(1, 0)] -> ImmBorrow - }; - - c1(); - - let px = &p.x; - - println!("{}", px); - - c1(); -} |