about summary refs log tree commit diff
path: root/tests/ui/macros/vec-macro-in-pattern.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-23 16:12:39 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-25 14:35:09 +1000
commit9828e960ab4cccc9526fd6cc61df430588bd0487 (patch)
tree26e565be478e49c3dc53ca92f66302180e6f83fb /tests/ui/macros/vec-macro-in-pattern.rs
parent684b3553f70148ded97a80371c2405984d4f6aa7 (diff)
downloadrust-9828e960ab4cccc9526fd6cc61df430588bd0487.tar.gz
rust-9828e960ab4cccc9526fd6cc61df430588bd0487.zip
Remove `__rust_force_expr`.
This was added (with a different name) to improve an error message. It
is no longer needed -- removing it changes the error message, but overall
I think the new message is no worse:
- the mention of `#` in the first line is a little worse,
- but the extra context makes it very clear what the problem is, perhaps
  even clearer than the old message,
- and the removal of the note about the `expr` fragment (an internal
  detail of `__rust_force_expr`) is an improvement.

Overall I think the error is quite clear and still far better than the
old message that prompted #61933, which didn't even mention patterns.

The motivation for this is #124141, which will cause pasted
metavariables to be tokenized and reparsed instead of the AST node being
cached. This change in behaviour occasionally has a non-zero perf cost,
and `__rust_force_expr` causes the tokenize/reparse step to occur twice.
Removing `__rust_force_expr` greatly reduces the extra overhead for the
`deep-vector` benchmark.
Diffstat (limited to 'tests/ui/macros/vec-macro-in-pattern.rs')
-rw-r--r--tests/ui/macros/vec-macro-in-pattern.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/ui/macros/vec-macro-in-pattern.rs b/tests/ui/macros/vec-macro-in-pattern.rs
index ce4298b8bb3..26d7d4280fa 100644
--- a/tests/ui/macros/vec-macro-in-pattern.rs
+++ b/tests/ui/macros/vec-macro-in-pattern.rs
@@ -4,7 +4,7 @@
 
 fn main() {
     match Some(vec![42]) {
-        Some(vec![43]) => {} //~ ERROR arbitrary expressions aren't allowed in patterns
+        Some(vec![43]) => {} //~ ERROR expected pattern, found `#`
         _ => {}
     }
 }