about summary refs log tree commit diff
path: root/tests/ui/traits
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2025-08-20 14:02:44 -0400
committerOneirical <manchot@videotron.ca>2025-08-27 15:06:05 -0400
commit2dc4638c4637bf8ddb83577535317dad21abdf6d (patch)
tree30a4419aabfa94d24825735bc504909189dcaa74 /tests/ui/traits
parente8a792daf500b5ff8097896ddb6cc037abe92487 (diff)
downloadrust-2dc4638c4637bf8ddb83577535317dad21abdf6d.tar.gz
rust-2dc4638c4637bf8ddb83577535317dad21abdf6d.zip
Add test batch 2
Diffstat (limited to 'tests/ui/traits')
-rw-r--r--tests/ui/traits/nll-ice-custom-type-ops-53568.rs48
-rw-r--r--tests/ui/traits/self-not-send-in-default-method-8171.rs (renamed from tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs)0
-rw-r--r--tests/ui/traits/trait-object-lifetime-bounds-7563.rs (renamed from tests/ui/traits/trait-implementation-and-usage-7563.rs)0
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/traits/nll-ice-custom-type-ops-53568.rs b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs
new file mode 100644
index 00000000000..9b240cdc190
--- /dev/null
+++ b/tests/ui/traits/nll-ice-custom-type-ops-53568.rs
@@ -0,0 +1,48 @@
+// https://github.com/rust-lang/rust/issues/53568
+// Regression test for an NLL-related ICE (#53568) -- we failed to
+// resolve inference variables in "custom type-ops".
+//
+//@ check-pass
+
+trait Future {
+    type Item;
+}
+
+impl<F, T> Future for F
+where F: Fn() -> T
+{
+    type Item = T;
+}
+
+trait Connect {}
+
+struct Connector<H> {
+    handler: H,
+}
+
+impl<H, T> Connect for Connector<H>
+where
+    T: 'static,
+    H: Future<Item = T>
+{
+}
+
+struct Client<C> {
+    connector: C,
+}
+
+fn build<C>(_connector: C) -> Client<C> {
+    unimplemented!()
+}
+
+fn client<H>(handler: H) -> Client<impl Connect>
+where H: Fn() + Copy
+{
+    let connector = Connector {
+        handler,
+    };
+    let client = build(connector);
+    client
+}
+
+fn main() { }
diff --git a/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs b/tests/ui/traits/self-not-send-in-default-method-8171.rs
index 59ea62c7690..59ea62c7690 100644
--- a/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs
+++ b/tests/ui/traits/self-not-send-in-default-method-8171.rs
diff --git a/tests/ui/traits/trait-implementation-and-usage-7563.rs b/tests/ui/traits/trait-object-lifetime-bounds-7563.rs
index 8cfc7a14ffe..8cfc7a14ffe 100644
--- a/tests/ui/traits/trait-implementation-and-usage-7563.rs
+++ b/tests/ui/traits/trait-object-lifetime-bounds-7563.rs