summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-ranked/leak-check-in-selection.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/higher-ranked/leak-check-in-selection.rs')
-rw-r--r--tests/ui/higher-ranked/leak-check-in-selection.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/higher-ranked/leak-check-in-selection.rs b/tests/ui/higher-ranked/leak-check-in-selection.rs
new file mode 100644
index 000000000..e8d6cff85
--- /dev/null
+++ b/tests/ui/higher-ranked/leak-check-in-selection.rs
@@ -0,0 +1,24 @@
+// run-pass
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+#![allow(coherence_leak_check)]
+
+trait Trait: Sized {
+ fn is_higher_ranked(self) -> bool;
+}
+
+impl Trait for for<'a> fn(&'a ()) {
+ fn is_higher_ranked(self) -> bool {
+ true
+ }
+}
+impl<'a> Trait for fn(&'a ()) {
+ fn is_higher_ranked(self) -> bool {
+ false
+ }
+}
+
+fn main() {
+ let x: for<'a> fn(&'a ()) = |&()| ();
+ assert!(x.is_higher_ranked());
+}