-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
confusing error message with concat_idents!() use in type position #33709
Comments
The error message comes from here: rust/src/libsyntax/ext/expand.rs Line 261 in 44b3cd8
parse_thunk failed, so I think it's just a generic error message. I guess it used to be accurate but isn't any more?
|
I think this error should be We could also avoid the error in this case by supporting |
Presumably the message is accurate some times, so we'd have to check if the problem is with expression position or type position. I think the problem with concat_idents is that the implementation returns an Expr AST node. It would have to know the context it is being expanded into in order to return a type or an expression or whatever. I don't think that is possible under the current system. I'd rather spend time working towards a nice solution than piling more hacks onto the existing one. |
Agreed -- I meant the error in this specific case. |
I tried to use
concat_idents!
to construct the name of a type in a macro. I discovered this wasn't possible, but the error message for it doesn't seem right.Maybe the "non-expression" and "expression" need to be swapped around?
CC @nrc
The text was updated successfully, but these errors were encountered: