diff options
| author | bors <bors@rust-lang.org> | 2022-11-08 22:50:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-08 22:50:12 +0000 |
| commit | 8d36948b1519c77a54867523453fef3e0c3a648b (patch) | |
| tree | eced4c9651b027b180542b5836a760dbbfcd571a /compiler/rustc_parse/src/parser | |
| parent | 85f4f41deb1557ca8ab228319d33003dd2f20f45 (diff) | |
| parent | c46cc1dabe20d702b1544bfed21361235b6e9aa2 (diff) | |
| download | rust-8d36948b1519c77a54867523453fef3e0c3a648b.tar.gz rust-8d36948b1519c77a54867523453fef3e0c3a648b.zip | |
Auto merge of #104168 - GuillaumeGomez:rollup-tf4edqc, r=GuillaumeGomez
Rollup of 12 pull requests Successful merges: - #103928 (Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed') - #104027 (Place config.toml in current working directory if config not found) - #104093 (disable btree size tests on Miri) - #104097 (run alloc benchmarks in Miri and fix UB) - #104104 (Add split-debuginfo print option) - #104109 (rustdoc: Add mutable to the description) - #104113 (Fix `const_fn_trait_ref_impl`, add test for it) - #104114 (Fix invalid background-image file name) - #104132 (fix: lint against lint functions) - #104139 (Clarify licensing situation of MPSC and SPSC queue) - #104147 (Remove an address comparison from the parser) - #104165 (Add llvm-main to triagebot.toml) Failed merges: - #104115 (Migrate crate-search element to CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 4a1162b9599..d784fef2bed 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 the resulting expression is not a cast, it is an illegal postfix operator. + if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _)) { let msg = format!( "{cast_kind} cannot be followed by {}", match with_postfix.kind { |
