about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-01-25 21:39:59 +0000
committerMichael Goulet <michael@errs.io>2025-02-11 19:24:07 +0000
commitce0c952e968777004fc59f45653be2fda116fee1 (patch)
tree3d0d2b430b533f9a7172a6805f749aa1432c251d /tests/ui
parenta02a982ffc73457caa1849b09da63e84f78541c6 (diff)
downloadrust-ce0c952e968777004fc59f45653be2fda116fee1.tar.gz
rust-ce0c952e968777004fc59f45653be2fda116fee1.zip
Deeply normalize args for implied bounds
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/borrowck/implied-bound-from-normalized-arg.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/borrowck/implied-bound-from-normalized-arg.rs b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs
new file mode 100644
index 00000000000..4e9a4953c6b
--- /dev/null
+++ b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs
@@ -0,0 +1,22 @@
+//@ 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.
+
+trait Ref<'a> {
+    type Assoc;
+}
+impl<'a, T> Ref<'a> for T where T: 'a {
+    type Assoc = &'a T;
+}
+
+fn outlives<'a, T: 'a>() {}
+
+fn test<'a, T>(_: <T as Ref<'a>>::Assoc) {
+    outlives::<'a, T>();
+}
+
+fn main() {}