forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#41547 - alexeyzab:41425-fix-mismatched-types-…
…error-message, r=arielb1 Fix error message for mismatched types This addresses rust-lang#41425 by implementing the changes mentioned in the following comment: rust-lang#41425 (comment)
- Loading branch information
Showing
5 changed files
with
62 additions
and
12 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
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
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
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,20 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// #41425 -- error message "mismatched types" has wrong types | ||
|
||
fn plus_one(x: i32) -> i32 { | ||
x + 1; | ||
} | ||
|
||
fn main() { | ||
let x = plus_one(5); | ||
println!("X = {}", x); | ||
} |
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,19 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/coercion-missing-tail-expected-type.rs:13:28 | ||
| | ||
13 | fn plus_one(x: i32) -> i32 { | ||
| ____________________________^ | ||
14 | | x + 1; | ||
15 | | } | ||
| |_^ expected i32, found () | ||
| | ||
= note: expected type `i32` | ||
found type `()` | ||
help: consider removing this semicolon: | ||
--> $DIR/coercion-missing-tail-expected-type.rs:14:10 | ||
| | ||
14 | x + 1; | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|