about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-10-04 21:12:41 -0700
committerGitHub <noreply@github.com>2021-10-04 21:12:41 -0700
commit25cc28ed5d84a24e2a5ef9c3594653a3cfcfb50b (patch)
tree39daed1cf98c0e3605a3ea9f55d054911f5bd223
parentec4145510e9c08c141d405a748533b94985068de (diff)
parentdc4043075e3a6c879218615933e88358abc2e01b (diff)
downloadrust-25cc28ed5d84a24e2a5ef9c3594653a3cfcfb50b.tar.gz
rust-25cc28ed5d84a24e2a5ef9c3594653a3cfcfb50b.zip
Rollup merge of #89480 - hameerabbasi:issue-89118-test, r=jackh726
Add test for issue 89118.

This PR adds a test for issue 89118.

Closes #89118.
-rw-r--r--src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs32
-rw-r--r--src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr63
2 files changed, 95 insertions, 0 deletions
diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs
new file mode 100644
index 00000000000..fffb54f86ca
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs
@@ -0,0 +1,32 @@
+trait BufferMut {}
+struct Ctx<D>(D);
+
+trait BufferUdpStateContext<B> {}
+impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
+
+trait StackContext
+where
+    Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
+{
+    type Dispatcher;
+}
+
+trait TimerContext {
+    type Handler;
+}
+impl<C> TimerContext for C
+where
+    C: StackContext,
+    //~^ ERROR: is not satisfied [E0277]
+{
+    type Handler = Ctx<C::Dispatcher>;
+    //~^ ERROR: is not satisfied [E0277]
+}
+
+struct EthernetWorker<C>(C)
+where
+    Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
+impl<C> EthernetWorker<C> {}
+//~^ ERROR: is not satisfied [E0277]
+
+fn main() {}
diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
new file mode 100644
index 00000000000..7f45fb83cef
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -0,0 +1,63 @@
+error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
+  --> $DIR/issue-89118.rs:19:8
+   |
+LL |     C: StackContext,
+   |        ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
+   |
+note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
+  --> $DIR/issue-89118.rs:5:23
+   |
+LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^     ^
+note: required by a bound in `StackContext`
+  --> $DIR/issue-89118.rs:9:14
+   |
+LL | trait StackContext
+   |       ------------ required by a bound in this
+LL | where
+LL |     Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
+
+error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
+  --> $DIR/issue-89118.rs:22:20
+   |
+LL |     type Handler = Ctx<C::Dispatcher>;
+   |                    ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
+   |
+note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
+  --> $DIR/issue-89118.rs:5:23
+   |
+LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^     ^
+note: required by a bound in `StackContext`
+  --> $DIR/issue-89118.rs:9:14
+   |
+LL | trait StackContext
+   |       ------------ required by a bound in this
+LL | where
+LL |     Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
+
+error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
+  --> $DIR/issue-89118.rs:29:9
+   |
+LL | impl<C> EthernetWorker<C> {}
+   |         ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
+   |
+note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
+  --> $DIR/issue-89118.rs:5:23
+   |
+LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^     ^
+note: required by a bound in `EthernetWorker`
+  --> $DIR/issue-89118.rs:28:14
+   |
+LL | struct EthernetWorker<C>(C)
+   |        -------------- required by a bound in this
+LL | where
+LL |     Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.