Skip to content

Commit

Permalink
Make CI happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ShE3py committed Apr 25, 2024
1 parent dac8c88 commit bf0a1a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
10 changes: 2 additions & 8 deletions compiler/rustc_parse/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -776,15 +776,9 @@ parse_unexpected_expr_in_pat =
expected {$is_bound ->
[true] a pattern range bound
*[false] a pattern
}, found {$is_method_call ->
[true] a method call
*[false] an expression
}
}, found an expression
.label = {$is_method_call ->
[true] method calls
*[false] arbitrary expressions
} are not allowed in patterns
.label = arbitrary expressions are not allowed in patterns
parse_unexpected_expr_in_pat_const_pat_sugg = wrap the expression in a inline const (requires `{"#"}![feature(inline_const)]`)
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_parse/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2439,8 +2439,6 @@ pub(crate) struct UnexpectedExpressionInPattern {
pub span: Span,
/// Was a `RangePatternBound` expected?
pub is_bound: bool,
/// Was the unexpected expression a `MethodCallExpression`?
pub is_method_call: bool,
}

#[derive(Subdiagnostic)]
Expand Down
12 changes: 2 additions & 10 deletions compiler/rustc_parse/src/parser/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ impl<'a> Parser<'a> {
)
.map_err(|err| err.cancel())
{
let non_assoc_span = expr.span;

// Parse an associative expression such as `+ expr`, `% expr`, ...
// Assignements, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
if let Ok(expr) =
Expand All @@ -424,16 +422,10 @@ impl<'a> Parser<'a> {
|| self.token.kind == token::CloseDelim(Delimiter::Parenthesis)
&& self.look_ahead(1, Token::is_range_separator);

// Check that `parse_expr_assoc_with` didn't eat a rhs.
let is_method_call = false && non_assoc_span == expr.span;

let span = expr.span;

let mut err = self.dcx().create_err(UnexpectedExpressionInPattern {
span,
is_bound,
is_method_call,
});
let mut err =
self.dcx().create_err(UnexpectedExpressionInPattern { span, is_bound });

// FIXME(inline_const): once stabilized, remove this check and remove the `(requires #[feature(inline_const])` note from the message
if self.psess.unstable_features.is_nightly_build() {
Expand Down

0 comments on commit bf0a1a6

Please sign in to comment.