Continuing the discussion from Make (Some) Separators Optional:
What would it take to allow semicolons after curly brace-delimited items? Like this?
// not valid Rust
struct MyStruct {
};
fn my_fn() {
};
There are two big reasons to want to allow this:
-
They’re already allowed in function bodies, where they parse as empty statements. Not allowing them outside the functions seems inconsistent with that. In other words, this is already valid:
fn my_fn() { fn my_fn_inside() { }; }
-
For non-brace-delimited items, semicolons are not only allowed, they’re required. This includes not only things that obvious need delimiters, like this unit-like struct:
struct MainThreadWitness;
They are also required with this tuple-like struct:
struct MyNewType(u32);
What’s so special about round braces compared to curly braces?