-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Grammar inconsistencies with empty blocks {}
and semi-colons.
#7981
Comments
Nominating for Well-Defined. |
All of these make sense, but they are inconsistent. |
Accepted for well-defined |
I don't think the block-less fn or extern make sense, but agree the others should allow no block. |
A block-less function would be ambiguous in traits. |
I've opened #9336 to disallows I believe that Basically, I would consider #9336 as closing this issue, but others may feel differently. |
I agree with @alexcrichton. |
I guess we should discuss this in the meeting. |
It'd also be nice if |
|
Why do we want to forbid I also think that allowing What makes sense to me:
The reasoning behind allowing both variants for most of the cases is that there are two possible situations:
(Unless the limitation for unit structs is also a problem for enum or trait definitions, then they need to be forbidden too) |
The main reason for forbidding it is consistency. Right now these all mean the same thing, so why not have only one way to do them? In the future we could decide to make |
Progress on #7981 This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
Closed by #9336 |
Add new lint `octal_escapes` This checks for sequences in strings that would be octal character escapes in C, but are not supported in Rust. It suggests either to use the `\x00` escape, or an equivalent hex escape if the octal was intended. Fixes rust-lang#7981 --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: Add new lint [`octal_escapes`], which checks for literals like `"\033[0m"`.
The error on
fn foo();
should probably stay, but I've included it for completion sake.The text was updated successfully, but these errors were encountered: