about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-26 17:30:42 +0000
committerbors <bors@rust-lang.org>2023-12-26 17:30:42 +0000
commita75fed74b62f95d1659ff70bea7895ed5c85bdba (patch)
tree08e57fcd63aa95ee4a3f70859bab39cb5d9c1822 /tests
parente1fadb2c35a6082867a037f012bfdfc5eb686211 (diff)
parente16efbd23afe98d1bda104d850e0285591d3a5d8 (diff)
downloadrust-a75fed74b62f95d1659ff70bea7895ed5c85bdba.tar.gz
rust-a75fed74b62f95d1659ff70bea7895ed5c85bdba.zip
Auto merge of #119042 - bvanjoi:fix-118697-2, r=compiler-errors
fallback `default` to `None` during ast-lowering for lifetime binder

Fixes #118697

This is another attempt. It has a fallback, setting `default` to `None` and emit an error for non-lifetime binders during ast lowering.

r? `@compiler-errors`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/parser/issue-119042.rs7
-rw-r--r--tests/ui/traits/non_lifetime_binders/issue-118697.rs9
-rw-r--r--tests/ui/traits/non_lifetime_binders/issue-118697.stderr21
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/parser/issue-119042.rs b/tests/ui/parser/issue-119042.rs
new file mode 100644
index 00000000000..a4fee169d1c
--- /dev/null
+++ b/tests/ui/parser/issue-119042.rs
@@ -0,0 +1,7 @@
+// check-pass
+
+macro_rules! a { ($ty:ty) => {} }
+
+a! { for<T = &i32> fn() }
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/issue-118697.rs b/tests/ui/traits/non_lifetime_binders/issue-118697.rs
new file mode 100644
index 00000000000..a282d0c5a40
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/issue-118697.rs
@@ -0,0 +1,9 @@
+#![allow(incomplete_features)]
+#![feature(non_lifetime_binders)]
+
+type T = dyn for<V = A(&())> Fn(());
+//~^ ERROR default parameter is not allowed in this binder
+//~| ERROR cannot find type `A` in this scope
+//~| ERROR late-bound type parameter not allowed on trait object types
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/issue-118697.stderr b/tests/ui/traits/non_lifetime_binders/issue-118697.stderr
new file mode 100644
index 00000000000..52ce568d69d
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/issue-118697.stderr
@@ -0,0 +1,21 @@
+error[E0412]: cannot find type `A` in this scope
+  --> $DIR/issue-118697.rs:4:22
+   |
+LL | type T = dyn for<V = A(&())> Fn(());
+   |                      ^ not found in this scope
+
+error: default parameter is not allowed in this binder
+  --> $DIR/issue-118697.rs:4:22
+   |
+LL | type T = dyn for<V = A(&())> Fn(());
+   |                      ^^^^^^
+
+error: late-bound type parameter not allowed on trait object types
+  --> $DIR/issue-118697.rs:4:18
+   |
+LL | type T = dyn for<V = A(&())> Fn(());
+   |                  ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0412`.