summaryrefslogtreecommitdiff
path: root/tests/ui/closures
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-02-18 03:28:43 +0000
committerMichael Goulet <michael@errs.io>2023-02-18 03:28:54 +0000
commitcec7835d7a8ea25b214b6bae5d61f51251b09b8e (patch)
treeb731557415e38f92f513a866c46f56a64f6d7cdc /tests/ui/closures
parentfded2e95abac4bffcd4dedfff93a34520aa91be2 (diff)
downloadrust-cec7835d7a8ea25b214b6bae5d61f51251b09b8e.tar.gz
Move late-bound arg type checks to resolve_bound_vars
Diffstat (limited to 'tests/ui/closures')
-rw-r--r--tests/ui/closures/binder/type-bound-2.rs7
-rw-r--r--tests/ui/closures/binder/type-bound-2.stderr17
-rw-r--r--tests/ui/closures/binder/type-bound.rs7
-rw-r--r--tests/ui/closures/binder/type-bound.stderr17
4 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/closures/binder/type-bound-2.rs b/tests/ui/closures/binder/type-bound-2.rs
new file mode 100644
index 00000000000..f4edcdaa9ca
--- /dev/null
+++ b/tests/ui/closures/binder/type-bound-2.rs
@@ -0,0 +1,7 @@
+#![feature(closure_lifetime_binder, non_lifetime_binders)]
+//~^ WARN is incomplete and may not be safe to use
+
+fn main() {
+ for<T> || -> () {};
+ //~^ ERROR late-bound type parameter not allowed on closures
+}
diff --git a/tests/ui/closures/binder/type-bound-2.stderr b/tests/ui/closures/binder/type-bound-2.stderr
new file mode 100644
index 00000000000..14b2dbf0395
--- /dev/null
+++ b/tests/ui/closures/binder/type-bound-2.stderr
@@ -0,0 +1,17 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/type-bound-2.rs:1:37
+ |
+LL | #![feature(closure_lifetime_binder, non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: late-bound type parameter not allowed on closures
+ --> $DIR/type-bound-2.rs:5:9
+ |
+LL | for<T> || -> () {};
+ | ^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/closures/binder/type-bound.rs b/tests/ui/closures/binder/type-bound.rs
new file mode 100644
index 00000000000..59a3353f496
--- /dev/null
+++ b/tests/ui/closures/binder/type-bound.rs
@@ -0,0 +1,7 @@
+#![feature(closure_lifetime_binder, non_lifetime_binders)]
+//~^ WARN is incomplete and may not be safe to use
+
+fn main() {
+ for<T> || -> T {};
+ //~^ ERROR late-bound type parameter not allowed on closures
+}
diff --git a/tests/ui/closures/binder/type-bound.stderr b/tests/ui/closures/binder/type-bound.stderr
new file mode 100644
index 00000000000..ef00a2dffce
--- /dev/null
+++ b/tests/ui/closures/binder/type-bound.stderr
@@ -0,0 +1,17 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/type-bound.rs:1:37
+ |
+LL | #![feature(closure_lifetime_binder, non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: late-bound type parameter not allowed on closures
+ --> $DIR/type-bound.rs:5:9
+ |
+LL | for<T> || -> T {};
+ | ^
+
+error: aborting due to previous error; 1 warning emitted
+