Skip to content

Error message "mismatched types" has wrong types #41425

Closed
@akazantsev

Description

@akazantsev

UPDATE: If you are interested in fixing this bug, there are mentoring instructions in this comment below.


fn main() {
    let x = plus_one(5);
    println!("X = {}", x);
}

fn plus_one(x: i32) -> i32 {
    x + 1;
}
  |
6 |   fn plus_one(x: i32) -> i32 {
  |  ____________________________^ starting here...
7 | |     x + 1;
8 | | }
  | |_^ ...ending here: expected (), found i32
  |
  = note: expected type `()`
             found type `i32`

I think that types in "expected type () found type i32" needs to be exchanged

$ rustc --version
rustc 1.18.0-nightly (452bf0852 2017-04-19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions