diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-08 11:51:10 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-08 11:51:10 +0000 |
| commit | e5d01dcc78c32abf3abfadbc3b20c9080b5fca05 (patch) | |
| tree | 2586837c5e0ab58a4dbe3640671689a1f92222e9 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 57d3c58ed6e0faf89a62411f96c000ffc9fd3937 (diff) | |
| download | rust-e5d01dcc78c32abf3abfadbc3b20c9080b5fca05.tar.gz rust-e5d01dcc78c32abf3abfadbc3b20c9080b5fca05.zip | |
Remove an address comparison from the parser
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 4a1162b9599..728435b6029 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -833,16 +833,11 @@ impl<'a> Parser<'a> { ("cast", None) }; - // Save the memory location of expr before parsing any following postfix operators. - // This will be compared with the memory location of the output expression. - // If they different we can assume we parsed another expression because the existing expression is not reallocated. - let addr_before = &*cast_expr as *const _ as usize; let with_postfix = self.parse_dot_or_call_expr_with_(cast_expr, span)?; - let changed = addr_before != &*with_postfix as *const _ as usize; // Check if an illegal postfix operator has been added after the cast. // If the resulting expression is not a cast, or has a different memory location, it is an illegal postfix operator. - if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _)) || changed { + if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _)) { let msg = format!( "{cast_kind} cannot be followed by {}", match with_postfix.kind { |
