summaryrefslogtreecommitdiffstats
path: root/src/test/ui/polymorphization/closure_in_upvar
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/polymorphization/closure_in_upvar
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-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/polymorphization/closure_in_upvar')
-rw-r--r--src/test/ui/polymorphization/closure_in_upvar/fn.rs29
-rw-r--r--src/test/ui/polymorphization/closure_in_upvar/fnmut.rs34
-rw-r--r--src/test/ui/polymorphization/closure_in_upvar/fnonce.rs34
-rw-r--r--src/test/ui/polymorphization/closure_in_upvar/other.rs38
4 files changed, 0 insertions, 135 deletions
diff --git a/src/test/ui/polymorphization/closure_in_upvar/fn.rs b/src/test/ui/polymorphization/closure_in_upvar/fn.rs
deleted file mode 100644
index e10308588..000000000
--- a/src/test/ui/polymorphization/closure_in_upvar/fn.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// build-pass
-// compile-flags:-Zpolymorphize=on -Csymbol-mangling-version=v0
-
-fn foo(f: impl Fn()) {
- let x = |_: ()| ();
-
- // Don't use `f` in `y`, but refer to `x` so that the closure substs contain a reference to
- // `x` that will differ for each instantiation despite polymorphisation of the varying
- // argument.
- let y = || x(());
-
- // Consider `f` used in `foo`.
- f();
- // Use `y` so that it is visited in monomorphisation collection.
- y();
-}
-
-fn entry_a() {
- foo(|| ());
-}
-
-fn entry_b() {
- foo(|| ());
-}
-
-fn main() {
- entry_a();
- entry_b();
-}
diff --git a/src/test/ui/polymorphization/closure_in_upvar/fnmut.rs b/src/test/ui/polymorphization/closure_in_upvar/fnmut.rs
deleted file mode 100644
index 62164ff94..000000000
--- a/src/test/ui/polymorphization/closure_in_upvar/fnmut.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// build-pass
-// compile-flags:-Zpolymorphize=on -Csymbol-mangling-version=v0
-
-fn foo(f: impl Fn()) {
- // Mutate an upvar from `x` so that it implements `FnMut`.
- let mut outer = 3;
- let mut x = |_: ()| {
- outer = 4;
- ()
- };
-
- // Don't use `f` in `y`, but refer to `x` so that the closure substs contain a reference to
- // `x` that will differ for each instantiation despite polymorphisation of the varying
- // argument.
- let mut y = || x(());
-
- // Consider `f` used in `foo`.
- f();
- // Use `y` so that it is visited in monomorphisation collection.
- y();
-}
-
-fn entry_a() {
- foo(|| ());
-}
-
-fn entry_b() {
- foo(|| ());
-}
-
-fn main() {
- entry_a();
- entry_b();
-}
diff --git a/src/test/ui/polymorphization/closure_in_upvar/fnonce.rs b/src/test/ui/polymorphization/closure_in_upvar/fnonce.rs
deleted file mode 100644
index 7a364882f..000000000
--- a/src/test/ui/polymorphization/closure_in_upvar/fnonce.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// build-pass
-// compile-flags:-Zpolymorphize=on -Csymbol-mangling-version=v0
-
-fn foo(f: impl Fn()) {
- // Move a non-copy type into `x` so that it implements `FnOnce`.
- let outer = Vec::<u32>::new();
- let x = move |_: ()| {
- let inner = outer;
- ()
- };
-
- // Don't use `f` in `y`, but refer to `x` so that the closure substs contain a reference to
- // `x` that will differ for each instantiation despite polymorphisation of the varying
- // argument.
- let y = || x(());
-
- // Consider `f` used in `foo`.
- f();
- // Use `y` so that it is visited in monomorphisation collection.
- y();
-}
-
-fn entry_a() {
- foo(|| ());
-}
-
-fn entry_b() {
- foo(|| ());
-}
-
-fn main() {
- entry_a();
- entry_b();
-}
diff --git a/src/test/ui/polymorphization/closure_in_upvar/other.rs b/src/test/ui/polymorphization/closure_in_upvar/other.rs
deleted file mode 100644
index 27d59ec88..000000000
--- a/src/test/ui/polymorphization/closure_in_upvar/other.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// build-pass
-// compile-flags:-Zpolymorphize=on -Csymbol-mangling-version=v0
-
-fn y_uses_f(f: impl Fn()) {
- let x = |_: ()| ();
-
- let y = || {
- f();
- x(());
- };
-
- f();
- y();
-}
-
-fn x_uses_f(f: impl Fn()) {
- let x = |_: ()| { f(); };
-
- let y = || x(());
-
- f();
- y();
-}
-
-fn entry_a() {
- x_uses_f(|| ());
- y_uses_f(|| ());
-}
-
-fn entry_b() {
- x_uses_f(|| ());
- y_uses_f(|| ());
-}
-
-fn main() {
- entry_a();
- entry_b();
-}