mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Remove mgca_direct_lit_hack indirection
This commit is contained in:
@@ -1628,8 +1628,7 @@ fn parse_expr_array_or_repeat(&mut self, close: ExpTokenPair) -> PResult<'a, Box
|
||||
let first_expr = self.parse_expr()?;
|
||||
if self.eat(exp!(Semi)) {
|
||||
// Repeating array syntax: `[ 0; 512 ]`
|
||||
let count =
|
||||
self.parse_expr_anon_const(|this, expr| this.mgca_direct_lit_hack(expr))?;
|
||||
let count = self.parse_expr_anon_const(|_, _| MgcaDisambiguation::Direct)?;
|
||||
self.expect(close)?;
|
||||
ExprKind::Repeat(first_expr, count)
|
||||
} else if self.eat(exp!(Comma)) {
|
||||
|
||||
@@ -1587,9 +1587,7 @@ fn parse_const_item(
|
||||
|
||||
let rhs = match (self.eat(exp!(Eq)), const_arg) {
|
||||
(true, true) => ConstItemRhsKind::TypeConst {
|
||||
rhs: Some(
|
||||
self.parse_expr_anon_const(|this, expr| this.mgca_direct_lit_hack(expr))?,
|
||||
),
|
||||
rhs: Some(self.parse_expr_anon_const(|_, _| MgcaDisambiguation::Direct)?),
|
||||
},
|
||||
(true, false) => ConstItemRhsKind::Body { rhs: Some(self.parse_expr()?) },
|
||||
(false, true) => ConstItemRhsKind::TypeConst { rhs: None },
|
||||
|
||||
@@ -915,14 +915,7 @@ pub(super) fn parse_unambiguous_unbraced_const_arg(
|
||||
});
|
||||
}
|
||||
|
||||
let mgca_disambiguation = self.mgca_direct_lit_hack(&expr);
|
||||
Ok((expr, mgca_disambiguation))
|
||||
}
|
||||
|
||||
/// Under `min_generic_const_args`, prefer direct const arguments rather than
|
||||
/// wrapping literals in anon consts.
|
||||
pub fn mgca_direct_lit_hack(&self, _expr: &Expr) -> MgcaDisambiguation {
|
||||
MgcaDisambiguation::Direct
|
||||
Ok((expr, MgcaDisambiguation::Direct))
|
||||
}
|
||||
|
||||
/// Parse a generic argument in a path segment.
|
||||
|
||||
@@ -658,8 +658,7 @@ fn parse_array_or_slice_ty(&mut self) -> PResult<'a, TyKind> {
|
||||
};
|
||||
|
||||
let ty = if self.eat(exp!(Semi)) {
|
||||
let mut length =
|
||||
self.parse_expr_anon_const(|this, expr| this.mgca_direct_lit_hack(expr))?;
|
||||
let mut length = self.parse_expr_anon_const(|_, _| MgcaDisambiguation::Direct)?;
|
||||
|
||||
if let Err(e) = self.expect(exp!(CloseBracket)) {
|
||||
// Try to recover from `X<Y, ...>` when `X::<Y, ...>` works
|
||||
|
||||
Reference in New Issue
Block a user