File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ fn main ( ) { }
2
+ trait StreamOnce {
3
+ type Position ;
4
+ }
5
+ impl StreamOnce for & str {
6
+ type Position = usize ;
7
+ }
8
+ fn follow ( _: & str ) -> <& str as StreamOnce >:: Position {
9
+ String :: new //~ ERROR mismatched types
10
+ }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/issue-87490.rs:9:5
3
+ |
4
+ LL | fn follow(_: &str) -> <&str as StreamOnce>::Position {
5
+ | ------------------------------ expected `usize` because of return type
6
+ LL | String::new
7
+ | ^^^^^^^^^^^ expected `usize`, found fn item
8
+ |
9
+ = note: expected type `usize`
10
+ found fn item `fn() -> String {String::new}`
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments