-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
change message infered type for closure #84476
change message infered type for closure #84476
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
r? @davidtwco (feel free to reassign) |
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.
Apologies for the delay in getting to this. With the current changes made by this PR, I don't think it would be worth landing. However, let's see if we can't work out how to improve it in the way you've described in the description.
I would prefer to have display something like
return type inferred to be `Foo<{integer}>` here
for code likestruct Foo<T>(T); fn main() { || { if false { return Foo(0); } Foo(()) }; }But I was not able to to so. I would greatly appreciate If someone could help me or commit this change
I haven't had time to look into this thoroughly, but ret_coercion_span
is set here:
rust/compiler/rustc_typeck/src/check/expr.rs
Lines 679 to 681 in 890803d
if self.ret_coercion_span.get().is_none() { | |
self.ret_coercion_span.set(Some(e.span)); | |
} |
Perhaps you could add some debug logging to see if any of the other values of e.span
which would have been assigned to ret_coercion_span
would have been more suitable, and if there would be a better heuristic than just keeping the first span (maybe the last, or the smallest?).
@ABouttefeux Ping from triage, any updates on this? |
Sorry I can't work on this now, I am in a hospital. |
@ABouttefeux Hope you get well soon! Since there's still some question as to what to implement here or how to implement it, I'm marking this PR as a draft so that we on the triage team don't keep bothering you until it's ready to review. If you need help, feel free to also ask questions on the #t-compiler/help Zulip channel at https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp . In the meantime if you get this in a state where it's ready for review then please remove the "Draft" designation and leave a comment saying that it's ready for review. On the other hand if you decide not to pursue this then feel free to close this PR. Thanks! |
☔ The latest upstream changes (presumably #87661) made this pull request unmergeable. Please resolve the merge conflicts. |
@ABouttefeux hope you are doing well. Do ping us if you need a hand. |
@ABouttefeux thanks for taking the time. I'm closing this due to inactivity, but if you have the time to do this pr, feel free to open a new PR preferably whenever you want :) |
fixes confusing message for inferred type for closure introduced in #84244.
I would prefer to have display something like
return type inferred to be
Foo<{integer}>here
for code likeBut I was not able to to so. I would greatly appreciate If someone could help me or commit this change