about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/path.rs
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2023-02-24 04:38:45 +0100
committerest31 <MTest31@outlook.com>2023-02-24 05:12:03 +0100
commit28501166367ac12ac11fcf4bb06261e2c8139988 (patch)
tree8d09393e92fcac090c1badc212f6718569305bc0 /compiler/rustc_parse/src/parser/path.rs
parent07c993eba8b76eae497e98433ae075b00f01be10 (diff)
downloadrust-28501166367ac12ac11fcf4bb06261e2c8139988.tar.gz
rust-28501166367ac12ac11fcf4bb06261e2c8139988.zip
Replace parse_[sth]_expr with parse_expr_[sth] function names
This resolves an inconsistency in naming style for functions
on the parser, between functions parsing specific kinds of items
and those for expressions, favoring the parse_item_[sth] style
used by functions for items. There are multiple advantages
of that style:

* functions of both categories are collected in the same place
  in the rustdoc output.
* it helps with autocompletion, as you can narrow down your
  search for a function to those about expressions.
* it mirrors rust's path syntax where less specific things
  come first, then it gets more specific, i.e.
  std::collections::hash_map::Entry

The disadvantage is that it doesn't "read like a sentence"
any more, but I think the advantages weigh more greatly.

This change was mostly application of this command:

sed -i -E 's/(fn |\.)parse_([[:alnum:]_]+)_expr/\1parse_expr_\2/' compiler/rustc_parse/src/parser/*.rs

Plus very minor fixes outside of rustc_parse, and an invocation
of x fmt.
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 99416c3b204..b50d2984a4e 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -653,7 +653,7 @@ impl<'a> Parser<'a> {
     pub(super) fn parse_const_arg(&mut self) -> PResult<'a, AnonConst> {
         // Parse const argument.
         let value = if let token::OpenDelim(Delimiter::Brace) = self.token.kind {
-            self.parse_block_expr(None, self.token.span, BlockCheckMode::Default)?
+            self.parse_expr_block(None, self.token.span, BlockCheckMode::Default)?
         } else {
             self.handle_unambiguous_unbraced_const_arg()?
         };