mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
42ab090be9
Add a note to the ArbitraryExpressionInPattern error The current "arbitrary expressions aren't allowed in patterns" error is confusing, as it fires for code where it *looks* like a pattern but the compiler still treats it as an expression. That this is due to the `:expr` fragment specifier forcing the expression-ness property on the code. In the test suite, the "arbitrary expressions aren't allowed in patterns" error can only be found in combination with macro_rules macros that force expression-ness of their content, namely via `:expr` metavariables. I also can't come up with cases where there would be an expression instead of a pattern, so I think it's always coming from an `:expr`. In order to make the error less confusing, this adds a note explaining the weird `:expr` fragment behaviour. Fixes #99380 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |