diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:58 +0000 |
commit | a4b7ed7a42c716ab9f05e351f003d589124fd55d (patch) | |
tree | b620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs | |
parent | Adding upstream version 1.67.1+dfsg1. (diff) | |
download | rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip |
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs')
-rw-r--r-- | src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs b/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs deleted file mode 100644 index d463f311c..000000000 --- a/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Regression test for #74429, where we didn't think that a type parameter -// outlived `ReEmpty`. - -// check-pass - -use std::marker::PhantomData; - -fn apply<T, F: FnOnce(T)>(_: T, _: F) {} - -#[derive(Clone, Copy)] -struct Invariant<T> { - t: T, - p: PhantomData<fn(T) -> T>, -} - -fn verify_reempty<T>(x: T) { - // r is inferred to have type `Invariant<&ReEmpty(U0) T>` - let r = Invariant { t: &x, p: PhantomData }; - // Creates a new universe, all variables from now on are in `U1`, say. - let _: fn(&()) = |_| {}; - // Closure parameter is of type `&ReEmpty(U1) T`, so the closure has an implied - // bound of `T: ReEmpty(U1)` - apply(&x, |_| { - // Requires `typeof(r)` is well-formed, i.e. `T: ReEmpty(U0)`. If we - // only have the implied bound from the closure parameter to use this - // requires `ReEmpty(U1): ReEmpty(U0)`, which isn't true so we reported - // an error. - // - // This doesn't happen any more because we ensure that `T: ReEmpty(U0)` - // is an implicit bound for all type parameters. - drop(r); - }); -} - -fn main() {} |