Skip to content

Commit 5c8fdc1

Browse files
committed
Add test for issue-44153
1 parent c27f756 commit 5c8fdc1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pub trait Array {
2+
type Element;
3+
}
4+
5+
pub trait Visit {
6+
fn visit() {}
7+
}
8+
9+
impl Array for () {
10+
type Element = ();
11+
}
12+
13+
impl<'a> Visit for () where
14+
(): Array<Element=&'a ()>,
15+
{}
16+
17+
fn main() {
18+
<() as Visit>::visit(); //~ ERROR: type mismatch resolving
19+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0271]: type mismatch resolving `<() as Array>::Element == &()`
2+
--> $DIR/issue-44153.rs:18:5
3+
|
4+
LL | fn visit() {}
5+
| ---------- required by `Visit::visit`
6+
...
7+
LL | <() as Visit>::visit();
8+
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &()
9+
|
10+
= note: expected type `()`
11+
found type `&()`
12+
= note: required because of the requirements on the impl of `Visit` for `()`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0271`.

0 commit comments

Comments
 (0)