-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37a4971
commit c983c0a
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
fn main() {} | ||
trait StreamOnce { | ||
type Position; | ||
} | ||
impl StreamOnce for &str { | ||
type Position = usize; | ||
} | ||
fn follow(_: &str) -> <&str as StreamOnce>::Position { | ||
String::new //~ ERROR mismatched types | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-87490.rs:9:5 | ||
| | ||
LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { | ||
| ------------------------------ expected `usize` because of return type | ||
LL | String::new | ||
| ^^^^^^^^^^^ expected `usize`, found fn item | ||
| | ||
= note: expected type `usize` | ||
found fn item `fn() -> String {String::new}` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |