File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/test/ui/associated-types Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments