summaryrefslogtreecommitdiffstats
path: root/src/test/ui/higher-rank-trait-bounds/issue-90177.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/higher-rank-trait-bounds/issue-90177.rs')
-rw-r--r--src/test/ui/higher-rank-trait-bounds/issue-90177.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/higher-rank-trait-bounds/issue-90177.rs b/src/test/ui/higher-rank-trait-bounds/issue-90177.rs
new file mode 100644
index 000000000..b151a9d3a
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/issue-90177.rs
@@ -0,0 +1,32 @@
+// check-pass
+
+trait Base<'f> {
+ type Assoc;
+
+ fn do_something(&self);
+}
+
+trait ForAnyLifetime: for<'f> Base<'f> {}
+
+impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}
+
+trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}
+
+fn foo(a: &dyn CanBeDynamic) {
+ a.do_something();
+}
+
+struct S;
+
+impl<'a> Base<'a> for S {
+ type Assoc = ();
+
+ fn do_something(&self) {}
+}
+
+impl CanBeDynamic for S {}
+
+fn main() {
+ let s = S;
+ foo(&s);
+}