Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 723b711

Browse files
authoredOct 5, 2021
Rollup merge of rust-lang#89480 - hameerabbasi:issue-89118-test, r=jackh726
Add test for issue 89118. This PR adds a test for issue 89118. Closes rust-lang#89118.
2 parents 1d1731a + dc40430 commit 723b711

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
trait BufferMut {}
2+
struct Ctx<D>(D);
3+
4+
trait BufferUdpStateContext<B> {}
5+
impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
6+
7+
trait StackContext
8+
where
9+
Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
10+
{
11+
type Dispatcher;
12+
}
13+
14+
trait TimerContext {
15+
type Handler;
16+
}
17+
impl<C> TimerContext for C
18+
where
19+
C: StackContext,
20+
//~^ ERROR: is not satisfied [E0277]
21+
{
22+
type Handler = Ctx<C::Dispatcher>;
23+
//~^ ERROR: is not satisfied [E0277]
24+
}
25+
26+
struct EthernetWorker<C>(C)
27+
where
28+
Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
29+
impl<C> EthernetWorker<C> {}
30+
//~^ ERROR: is not satisfied [E0277]
31+
32+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
2+
--> $DIR/issue-89118.rs:19:8
3+
|
4+
LL | C: StackContext,
5+
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
6+
|
7+
note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
8+
--> $DIR/issue-89118.rs:5:23
9+
|
10+
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
12+
note: required by a bound in `StackContext`
13+
--> $DIR/issue-89118.rs:9:14
14+
|
15+
LL | trait StackContext
16+
| ------------ required by a bound in this
17+
LL | where
18+
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
20+
21+
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
22+
--> $DIR/issue-89118.rs:22:20
23+
|
24+
LL | type Handler = Ctx<C::Dispatcher>;
25+
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
26+
|
27+
note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
28+
--> $DIR/issue-89118.rs:5:23
29+
|
30+
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
32+
note: required by a bound in `StackContext`
33+
--> $DIR/issue-89118.rs:9:14
34+
|
35+
LL | trait StackContext
36+
| ------------ required by a bound in this
37+
LL | where
38+
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
40+
41+
error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
42+
--> $DIR/issue-89118.rs:29:9
43+
|
44+
LL | impl<C> EthernetWorker<C> {}
45+
| ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
46+
|
47+
note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>`
48+
--> $DIR/issue-89118.rs:5:23
49+
|
50+
LL | impl<B: BufferMut, C> BufferUdpStateContext<B> for C {}
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
52+
note: required by a bound in `EthernetWorker`
53+
--> $DIR/issue-89118.rs:28:14
54+
|
55+
LL | struct EthernetWorker<C>(C)
56+
| -------------- required by a bound in this
57+
LL | where
58+
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
60+
61+
error: aborting due to 3 previous errors
62+
63+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)
Failed to load comments.