File tree Expand file tree Collapse file tree 3 files changed +4
-20
lines changed Expand file tree Collapse file tree 3 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -776,15 +776,9 @@ parse_unexpected_expr_in_pat =
776776 expected { $is_bound ->
777777 [ true ] a pattern range bound
778778 *[ false ] a pattern
779- } , found { $is_method_call ->
780- [ true ] a method call
781- *[ false ] an expression
782- }
779+ } , found an expression
783780
784- .label = { $is_method_call ->
785- [ true ] method calls
786- *[ false ] arbitrary expressions
787- } are not allowed in patterns
781+ .label = arbitrary expressions are not allowed in patterns
788782
789783parse_unexpected_expr_in_pat_const_pat_sugg = wrap the expression in a inline const (requires `{ " # " } ![feature(inline_const)]`)
790784
Original file line number Diff line number Diff line change @@ -2439,8 +2439,6 @@ pub(crate) struct UnexpectedExpressionInPattern {
24392439 pub span : Span ,
24402440 /// Was a `RangePatternBound` expected?
24412441 pub is_bound : bool ,
2442- /// Was the unexpected expression a `MethodCallExpression`?
2443- pub is_method_call : bool ,
24442442}
24452443
24462444#[ derive( Subdiagnostic ) ]
Original file line number Diff line number Diff line change @@ -407,8 +407,6 @@ impl<'a> Parser<'a> {
407407 )
408408 . map_err ( |err| err. cancel ( ) )
409409 {
410- let non_assoc_span = expr. span ;
411-
412410 // Parse an associative expression such as `+ expr`, `% expr`, ...
413411 // Assignements, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
414412 if let Ok ( expr) =
@@ -424,16 +422,10 @@ impl<'a> Parser<'a> {
424422 || self . token . kind == token:: CloseDelim ( Delimiter :: Parenthesis )
425423 && self . look_ahead ( 1 , Token :: is_range_separator) ;
426424
427- // Check that `parse_expr_assoc_with` didn't eat a rhs.
428- let is_method_call = false && non_assoc_span == expr. span ;
429-
430425 let span = expr. span ;
431426
432- let mut err = self . dcx ( ) . create_err ( UnexpectedExpressionInPattern {
433- span,
434- is_bound,
435- is_method_call,
436- } ) ;
427+ let mut err =
428+ self . dcx ( ) . create_err ( UnexpectedExpressionInPattern { span, is_bound } ) ;
437429
438430 // FIXME(inline_const): once stabilized, remove this check and remove the `(requires #[feature(inline_const])` note from the message
439431 if self . psess . unstable_features . is_nightly_build ( ) {
You can’t perform that action at this time.
0 commit comments