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/regions-fn-subtyping-return-static.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/regions-fn-subtyping-return-static.rs')
-rw-r--r-- | src/test/ui/regions/regions-fn-subtyping-return-static.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static.rs b/src/test/ui/regions/regions-fn-subtyping-return-static.rs deleted file mode 100644 index de14d5ba8..000000000 --- a/src/test/ui/regions/regions-fn-subtyping-return-static.rs +++ /dev/null @@ -1,48 +0,0 @@ -// In this fn, the type `F` is a function that takes a reference to a -// struct and returns another reference with the same lifetime. -// -// Meanwhile, the bare fn `foo` takes a reference to a struct with -// *ANY* lifetime and returns a reference with the 'static lifetime. -// This can safely be considered to be an instance of `F` because all -// lifetimes are sublifetimes of 'static. -// -// check-pass - -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(non_snake_case)] - -struct S; - -// Given 'cx, return 'cx -type F = for<'cx> fn(&'cx S) -> &'cx S; -fn want_F(f: F) {} - -// Given anything, return 'static -type G = for<'cx> fn(&'cx S) -> &'static S; -fn want_G(f: G) {} - -// Should meet both. -fn foo(x: &S) -> &'static S { - panic!() -} - -// Should meet both. -fn bar<'a, 'b>(x: &'a S) -> &'b S { - panic!() -} - -// Meets F, but not G. -fn baz(x: &S) -> &S { - panic!() -} - -fn supply_F() { - want_F(foo); - - want_F(bar); - - want_F(baz); -} - -pub fn main() {} |