Closed
Description
When compiling
thread_local {
static I: i32 = 0;
}
the following error is generated
error: expected one of `!` or `::`, found `{`
--> m.rs:1:14
|
1 | thread_local {
| ^
This happens because the only thing that could possibly be in an item position and not start with a keyword is a macro, and macros start with a path. A path can contain double colons. However, a macro invocation can not, and the compiler will generate an error at a later stage if you try to invoke a macro that way. See #28558
To be clear, I think the error message should just be “expected `!`, found `{`”.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: The lexing & parsing of Rust source code to an ASTCategory: An issue proposing an enhancement or a PR with one.Relevant to the compiler team, which will review and decide on the PR/issue.