Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The error message signalling mismatched types gives wrong types #41538

Closed
VinithKrishnan opened this issue Apr 25, 2017 · 2 comments
Closed

The error message signalling mismatched types gives wrong types #41538

VinithKrishnan opened this issue Apr 25, 2017 · 2 comments

Comments

@VinithKrishnan
Copy link

fn main() {
let x = subtract_one(4);
println!("X = {}", x);
}

fn subtract_one(x: i32) -> i32 {
x - 1;
}

Error message:
error[E0308]: mismatched types
--> main.rs:6:32
|
6 | fn subtract_one(x: i32) -> i32 {
| ________________________________^ starting here...
7 | | x - 1;
8 | | }
| |_^ ...ending here: expected (), found i32
|
= note: expected type ()
found type i32
Shouldn't the error message say expected i32,found ()?

rust version:
rustc 1.18.0-nightly (3b5754e 2017-04-10)

@durka
Copy link
Contributor

durka commented Apr 25, 2017

Duplicate of #41425.

@VinithKrishnan
Copy link
Author

Yep,seems like the same issue.Is anyone working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants