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/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.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/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs')
-rw-r--r-- | src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs deleted file mode 100644 index afe6f10a5..000000000 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Test a case where we setup relationships like `'x: 'a` or `'a: 'x`, -// where `'x` is bound in closure type but `'a` is free. This forces -// us to approximate `'x` one way or the other. - -// compile-flags:-Zverbose - -#![feature(rustc_attrs)] - -use std::cell::Cell; - -fn foo<'a, F>(_cell: Cell<&'a u32>, _f: F) -where - F: for<'x> FnOnce(Cell<&'a u32>, Cell<&'x u32>), -{ -} - -#[rustc_regions] -fn case1() { - let a = 0; - let cell = Cell::new(&a); - foo(cell, |cell_a, cell_x| { - cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure - //~^ ERROR - }) -} - -#[rustc_regions] -fn case2() { - let a = 0; - let cell = Cell::new(&a); - //~^ ERROR `a` does not live long enough - - // As you can see in the stderr output, this closure propoagates a - // requirement that `'a: 'static'. - foo(cell, |cell_a, cell_x| { - cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error - }) -} - -fn main() { } |