Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upstruct constructors are some kind of weird type/path hybrid #41740
Comments
This comment has been minimized.
This comment has been minimized.
|
This issue is not related to struct constructors in general, it's related to what macro_rules! m {
($p: path) => {}
}
fn main() {
m!(a<b>); // OK
m!(a::<b>); // FAIL
}There are two flavors of paths (syntactically) - with disambiguating "turbofish" ( |
durka commentedMay 4, 2017
•
edited
Is this a known issue?
Consider the following setup:
You can construct a
Bar:Now I want to try it with a macro.
The obvious thing doesn't parse at all:
We need to remove the second
::, which makes things inconsistent with the macro-less syntax:Why this inconsistency? It seems like a struct constructor isn't really a
path. But that's the only macro fragment that can be used in that position (besidesidentandtt).