change message infered type for closure#84476
change message infered type for closure#84476ABouttefeux wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @davidtwco (feel free to reassign) |
davidtwco
left a comment
There was a problem hiding this comment.
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}>` herefor 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
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 beFoo<{integer}>herefor code likeBut I was not able to to so. I would greatly appreciate If someone could help me or commit this change