Skip to content

Commit

Permalink
regression test for issue 87490
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron1024 committed Nov 27, 2021
1 parent 37a4971 commit c983c0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/ui/issues/issue-87490.rs
@@ -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
}
14 changes: 14 additions & 0 deletions src/test/ui/issues/issue-87490.stderr
@@ -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`.

0 comments on commit c983c0a

Please sign in to comment.