Modify mismatched type error for functions with no return#57230
Merged
bors merged 4 commits intorust-lang:masterfrom Jan 6, 2019
Merged
Modify mismatched type error for functions with no return#57230bors merged 4 commits intorust-lang:masterfrom
bors merged 4 commits intorust-lang:masterfrom
Conversation
Do not point at the entire block span on fn return type mismatches caused by missing return.
Contributor
|
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
CC @zackmdavis @petrochenkov @nikomatsakis for input (as this might be a more contentious change). |
varkor
reviewed
Jan 4, 2019
Contributor
varkor
left a comment
There was a problem hiding this comment.
This style of suggestions definitely looks more readable to me! I just have one query about test/ui/liveness/liveness-forgot-ret.stderr, but other than that, the changes look good.
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 211365d has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Jan 5, 2019
Modify mismatched type error for functions with no return Fix #50009. ``` error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:24 | LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types | -------- ^^^ expected i32, found () | | | this function's body doesn't return LL | x + 1; | - help: consider removing this semicolon | = note: expected type `i32` found type `()` ``` instead of ``` error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:28 | LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types | ____________________________^ LL | | x + 1; | | - help: consider removing this semicolon LL | | } | |_^ expected i32, found () | = note: expected type `i32` found type `()` ```
Collaborator
|
☀️ Test successful - status-appveyor, status-travis |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #50009.
instead of