summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-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/ty-outlives/projection-one-region-closure.rs')
-rw-r--r--src/test/ui/nll/ty-outlives/projection-one-region-closure.rs83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
deleted file mode 100644
index af361e990..000000000
--- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Test cases where we constrain `<T as Anything<'b>>::AssocType` to
-// outlive `'a` and there are no bounds in the trait definition of
-// `Anything`. This means that the constraint can only be satisfied in two
-// ways:
-//
-// - by ensuring that `T: 'a` and `'b: 'a`, or
-// - by something in the where clauses.
-//
-// As of this writing, the where clause option does not work because
-// of limitations in our region inferencing system (this is true both
-// with and without NLL). See `projection_outlives`.
-//
-// Ensuring that both `T: 'a` and `'b: 'a` holds does work (`elements_outlive`).
-
-// compile-flags:-Zverbose
-
-#![allow(warnings)]
-#![feature(rustc_attrs)]
-
-use std::cell::Cell;
-
-trait Anything<'a> {
- type AssocType;
-}
-
-fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F)
-where
- F: FnOnce(Cell<&'a ()>, T),
-{
- op(cell, t)
-}
-
-fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T)
-where
- T: Anything<'b>,
- T::AssocType: 'a,
-{
-}
-
-#[rustc_regions]
-fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-where
- T: Anything<'b>,
-{
- with_signature(cell, t, |cell, t| require(cell, t));
- //~^ ERROR the parameter type `T` may not live long enough
- //~| ERROR
-}
-
-#[rustc_regions]
-fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-where
- T: Anything<'b>,
- 'a: 'a,
-{
- with_signature(cell, t, |cell, t| require(cell, t));
- //~^ ERROR the parameter type `T` may not live long enough
- //~| ERROR
-}
-
-#[rustc_regions]
-fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-where
- T: Anything<'b>,
- T::AssocType: 'a,
-{
- // We are projecting `<T as Anything<'b>>::AssocType`, and we know
- // that this outlives `'a` because of the where-clause.
-
- with_signature(cell, t, |cell, t| require(cell, t));
-}
-
-#[rustc_regions]
-fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
-where
- T: Anything<'b>,
- T: 'a,
- 'b: 'a,
-{
- with_signature(cell, t, |cell, t| require(cell, t));
-}
-
-fn main() {}