Is there a formal spec somewhere for what is considered valid module names?
Here's the spec on keywords, but I think that either way, prefixing the module name with r#
would work:
mod r#mod {
const FOO: u32 = 0;
}
More specifically, it seems that it is impossible to use any of the keywords in the language to name a module (Apart from union
, or [only in 2015] dyn
, try
, async
, and await
), or a name that starts with a number unless the name starts with raw name identifier (Not sure on the name for it) r#
.
1 Like
https://doc.rust-lang.org/stable/reference/items/modules.html
Says names are an IDENTIFIER. If you click it, it takes you to
https://doc.rust-lang.org/stable/reference/identifiers.html
Which describes the rules in detail.
2 Likes
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.