about summary refs log tree commit diff
path: root/tests/ui/borrowck/implied-bound-from-impl-header.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/implied-bound-from-impl-header.rs')
-rw-r--r--tests/ui/borrowck/implied-bound-from-impl-header.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/borrowck/implied-bound-from-impl-header.rs b/tests/ui/borrowck/implied-bound-from-impl-header.rs
new file mode 100644
index 00000000000..326a62b22f0
--- /dev/null
+++ b/tests/ui/borrowck/implied-bound-from-impl-header.rs
@@ -0,0 +1,28 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get
+// its implied bounds in impl header.
+
+trait Ref<'a> {
+    type Assoc;
+}
+impl<'a, T> Ref<'a> for T where T: 'a {
+    type Assoc = &'a T;
+}
+
+fn outlives<'a, T: 'a>() {}
+
+trait Trait<'a, T> {
+    fn test();
+}
+
+impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc {
+    fn test() {
+        outlives::<'a, T>();
+    }
+}
+
+fn main() {}