rust/compiler/rustc_ast_lowering/src
Matthias Krüger 42ab090be9
Rollup merge of #124488 - est31:arbitrary_expressions_error, r=pnkfelix
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
2024-04-29 22:37:51 +02:00
..
asm.rs Change DefKind::Static to a struct variant 2024-03-12 05:53:46 +00:00
block.rs Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
delegation.rs delegation: Support async, const, extern "ABI" and C-variadic functions 2024-04-23 23:05:39 +03:00
errors.rs Add a note to the ArbitraryExpressionInPattern error 2024-04-28 21:27:26 +02:00
expr.rs Error on using yield without also using #[coroutine] on the closure 2024-04-24 08:05:29 +00:00
format.rs Improve semantics of int_ty_max functions 2024-04-15 00:39:28 +05:30
index.rs Add hir::Node::PreciseCapturingNonLifetimeArg 2024-04-15 16:45:25 -04:00
item.rs Auto merge of #122500 - petrochenkov:deleg, r=fmease 2024-04-24 11:57:35 +00:00
lib.rs ast: Generalize item kind visiting 2024-04-25 22:49:58 +03:00
lifetime_collector.rs Lower and resolve precise captures in HIR 2024-04-15 16:45:01 -04:00
pat.rs Add a note to the ArbitraryExpressionInPattern error 2024-04-28 21:27:26 +02:00
path.rs Simplify ImplTraitContext 2024-03-08 02:10:11 +00:00