-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Modify mismatched type error for functions with no return #57230
Conversation
Do not point at the entire block span on fn return type mismatches caused by missing return.
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
CC @zackmdavis @petrochenkov @nikomatsakis for input (as this might be a more contentious change). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@bors r+ |
📌 Commit 211365d has been approved by |
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 `()` ```
☀️ Test successful - status-appveyor, status-travis |
Fix #50009.
instead of