File tree 3 files changed +4
-20
lines changed
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 =
776
776
expected { $is_bound ->
777
777
[ true ] a pattern range bound
778
778
*[ false ] a pattern
779
- } , found { $is_method_call ->
780
- [ true ] a method call
781
- *[ false ] an expression
782
- }
779
+ } , found an expression
783
780
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
788
782
789
783
parse_unexpected_expr_in_pat_const_pat_sugg = wrap the expression in a inline const (requires `{ " # " } ![feature(inline_const)]`)
790
784
Original file line number Diff line number Diff line change @@ -2439,8 +2439,6 @@ pub(crate) struct UnexpectedExpressionInPattern {
2439
2439
pub span : Span ,
2440
2440
/// Was a `RangePatternBound` expected?
2441
2441
pub is_bound : bool ,
2442
- /// Was the unexpected expression a `MethodCallExpression`?
2443
- pub is_method_call : bool ,
2444
2442
}
2445
2443
2446
2444
#[ derive( Subdiagnostic ) ]
Original file line number Diff line number Diff line change @@ -407,8 +407,6 @@ impl<'a> Parser<'a> {
407
407
)
408
408
. map_err ( |err| err. cancel ( ) )
409
409
{
410
- let non_assoc_span = expr. span ;
411
-
412
410
// Parse an associative expression such as `+ expr`, `% expr`, ...
413
411
// Assignements, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
414
412
if let Ok ( expr) =
@@ -424,16 +422,10 @@ impl<'a> Parser<'a> {
424
422
|| self . token . kind == token:: CloseDelim ( Delimiter :: Parenthesis )
425
423
&& self . look_ahead ( 1 , Token :: is_range_separator) ;
426
424
427
- // Check that `parse_expr_assoc_with` didn't eat a rhs.
428
- let is_method_call = false && non_assoc_span == expr. span ;
429
-
430
425
let span = expr. span ;
431
426
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 } ) ;
437
429
438
430
// FIXME(inline_const): once stabilized, remove this check and remove the `(requires #[feature(inline_const])` note from the message
439
431
if self . psess . unstable_features . is_nightly_build ( ) {
You can’t perform that action at this time.
0 commit comments