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 c8dba64

Browse files
committedSep 18, 2020
add ExistentialPredicate compile fail test
1 parent 5ced845 commit c8dba64

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
 
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
trait Service {
2+
type S;
3+
}
4+
5+
trait Framing {
6+
type F;
7+
}
8+
9+
impl Framing for () {
10+
type F = ();
11+
}
12+
13+
impl Framing for u32 {
14+
type F = u32;
15+
}
16+
17+
trait HttpService<F: Framing>: Service<S = F::F> {}
18+
19+
fn build_server<F: FnOnce() -> Box<dyn HttpService<u32, S = ()>>>(_: F) {}
20+
21+
fn make_server<F: Framing>() -> Box<dyn HttpService<F, S = F::F>> {
22+
unimplemented!()
23+
}
24+
25+
fn main() {
26+
build_server(|| make_server())
27+
//~^ ERROR type mismatch
28+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0271]: type mismatch resolving `<u32 as Framing>::F == ()`
2+
--> $DIR/issue-59326-compile-fail.rs:26:21
3+
|
4+
LL | build_server(|| make_server())
5+
| ^^^^^^^^^^^^^ expected `u32`, found `()`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0271`.

0 commit comments

Comments
 (0)
Please sign in to comment.