Uh oh!
There was an error while loading. Please reload this page.
Point at : when using it instead of ; - #43096
Conversation
rust-highfive
commented
Jul 6, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
bors
commented
Jul 7, 2017
☔ The latest upstream changes (presumably #43060) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Will it work if a colon was here?
There was a problem hiding this comment.
The output in that case is
error: expected type, found `0`
--> ../../src/test/ui/suggestions/type-ascription-instead-of-statement-end.rs:15:5
|
14 | println!("test"):
| - help: did you mean to use `;` here instead?
15 | 0:
| ^ expecting a type here because of type ascriptionThere was a problem hiding this comment.
this sort of looks funny, perhaps because of the ^ having no label. I think I'd prefer:
error: expected type, found `0`
--> $DIR/type-ascription-instead-of-statement-end.rs:15:5
|
14 | println!("test"):
| - help: did you mean to use a `;` here?
15 | 0;
| ^ expecting a type here because of type ascription
error: aborting due to previous error
ad7c8eb to
a4217cbCompareThere was a problem hiding this comment.
Huh, this looks strange to me somehow. Why not say "help: did you mean to use ; here?"? I think users might not know that "end the statement" means ; -- but also, I am not sure about this "floating" ; that appears at the end of the sentence.
There was a problem hiding this comment.
The presentation is because it is an inline suggestion. Should I change the code so that we can control wether the code to be replaced should be displayed when inline?
There was a problem hiding this comment.
Hmm; I think either change the code, or change the wording. But yeah probably just having the option to "suppress" the suggestion when displayed inline seems good.
shepmaster
commented
Jul 14, 2017
This is your polite 7-day ping @estebank — when do you think you'll be able to respond to the comments? |
When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription.
nikomatsakis
commented
Jul 17, 2017
Failure: The new message looks improved, though. =) |
Now there's a way to add suggestions that hide the suggested code when presented inline, to avoid weird wording when short code snippets are added at the end.
estebank
commented
Jul 17, 2017
@nikomatsakis fixed |
estebank
commented
Jul 18, 2017
@nikomatsakis covered another case that fails during fnf(){}fnmain(){f():f();} |
estebank
commented
Jul 23, 2017
@nikomatsakis ping |
nikomatsakis
commented
Jul 23, 2017
@bors r+ |
bors
commented
Jul 23, 2017
📌 Commit e39bcec has been approved by |
nikomatsakis
commented
Jul 23, 2017
cc @oli-obk, I don't this suggestion follows the guidelines, but I also think it looks good. Perhaps we need to adjust the guidelines to account for the "suppress example code" option? |
bors
commented
Jul 23, 2017
oli-obk
commented
Jul 23, 2017
I'm assuming you mean that the guildelines aren't followed by the use of "Try using a |
bors
commented
Jul 23, 2017
☀️ Test successful - status-appveyor, status-travis |
luser
commented
Jul 25, 2017
@estebank Thanks for making this error message better! |
Nokel81
commented
Jul 26, 2017
Which error message got finalized? |
estebank
commented
Jul 26, 2017
@Nokel81 sorry, I don't understand the question. Could you rephrase? This PR adds a label stating "help: did you mean to use |
Nokel81
commented
Jul 26, 2017
I was talking about the guideline of not using |
estebank
commented
Jul 26, 2017
@Nokel81 ah, I see. No, I didn't change the message before it got merged. I can post a PR later today/tomorrow changing the wording, if you want. |
No it is fine, I personally feel that there are some cases where |
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
Fix#42057, #41928.