rust/compiler/rustc_expand/src
Matthias Krüger 1a6ed3050f
Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank
Show note where the macro failed to match

When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong.

```rust
macro_rules! uwu {
    (a a a b) => {};
}
uwu! { a a a c }
```

```diff
error: no rules expected the token `c`
 --> macros.rs:5:14
  |
1 | macro_rules! uwu {
  | ---------------- when calling this macro
...
4 | uwu! { a a a c }
  |              ^ no rules expected this token in macro call
  |
+note: while trying to match `b`
+ --> macros.rs:2:12
+  |
+2 |     (a a a b) => {};
+  |            ^
```
2022-11-15 10:44:07 +01:00
..
mbe Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank 2022-11-15 10:44:07 +01:00
mut_visit rustc_ast: Turn MutVisitor::token_visiting_enabled into a constant 2021-10-18 00:23:24 +03:00
parse Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
tokenstream Remove TokenStreamBuilder. 2022-10-05 12:42:54 +11:00
base.rs Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obk 2022-11-12 12:02:50 +05:30
build.rs Rewrite and refactor format_args!() builtin macro. 2022-09-27 13:13:08 +02:00
config.rs Workaround unstable stmt_expr_attributes for method receiver expressions. 2022-10-23 09:27:12 +00:00
errors.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
expand.rs Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obk 2022-11-12 12:02:50 +05:30
lib.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
mbe.rs Add Tracker to track matching operations 2022-11-02 21:05:09 +01:00
module.rs Use AttrVec in more places. 2022-08-22 07:35:33 +10:00
placeholders.rs Workaround unstable stmt_expr_attributes for method receiver expressions. 2022-10-23 09:27:12 +00:00
proc_macro.rs Add the #[derive_const] attribute 2022-09-20 11:57:58 +00:00
proc_macro_server.rs Introduce ExprKind::IncludedBytes 2022-11-11 16:31:32 +00:00
tests.rs Implement -Ztrack-diagnostics 2022-10-19 00:08:20 +02:00