about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/call-generic-method-pass.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-10-22 00:03:09 +0000
committerMichael Goulet <michael@errs.io>2024-10-22 00:03:09 +0000
commite91267f3f094a6f5d16aef0abb864fca4bc8c9f4 (patch)
treeba5ce9ae085572e299066b12a06da711416eea87 /tests/ui/traits/const-traits/call-generic-method-pass.rs
parentedbd9398dcc0e3b6ffe0dd0cd4578d37d1d36974 (diff)
downloadrust-e91267f3f094a6f5d16aef0abb864fca4bc8c9f4.tar.gz
rust-e91267f3f094a6f5d16aef0abb864fca4bc8c9f4.zip
Move tests
Diffstat (limited to 'tests/ui/traits/const-traits/call-generic-method-pass.rs')
-rw-r--r--tests/ui/traits/const-traits/call-generic-method-pass.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.rs b/tests/ui/traits/const-traits/call-generic-method-pass.rs
new file mode 100644
index 00000000000..413685d8b34
--- /dev/null
+++ b/tests/ui/traits/const-traits/call-generic-method-pass.rs
@@ -0,0 +1,25 @@
+//! Basic test for calling methods on generic type parameters in `const fn`.
+
+//@ known-bug: #110395
+// FIXME(effects) check-pass
+
+#![feature(const_trait_impl, effects)]
+
+struct S;
+
+impl const PartialEq for S {
+    fn eq(&self, _: &S) -> bool {
+        true
+    }
+    fn ne(&self, other: &S) -> bool {
+        !self.eq(other)
+    }
+}
+
+const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
+    *t == *t
+}
+
+pub const EQ: bool = equals_self(&S);
+
+fn main() {}