Skip to content

Commit

Permalink
Rollup merge of #91239 - cameron1024:issue-87490-regression, r=jackh726
Browse files Browse the repository at this point in the history
regression test for issue 87490

Closes #87490
  • Loading branch information
matthiaskrgr authored Dec 14, 2021
2 parents 50327d2 + c983c0a commit c0e3dde
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
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
}
14 changes: 14 additions & 0 deletions src/test/ui/issues/issue-87490.stderr
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`.

0 comments on commit c0e3dde

Please sign in to comment.