diff options
| author | Orion Gonzalez <ardi@ardis.dev> | 2024-12-11 00:53:07 +0100 |
|---|---|---|
| committer | Orion Gonzalez <ardi@ardis.dev> | 2024-12-11 16:23:04 +0100 |
| commit | 014363e89e4347332c50daede2efa66af3c2c243 (patch) | |
| tree | 053869f875cb9a14aee13a2aa79340749834e5d8 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 33c245b9e98bc91e18ea1c5033824f4c6f92766f (diff) | |
| download | rust-014363e89e4347332c50daede2efa66af3c2c243.tar.gz rust-014363e89e4347332c50daede2efa66af3c2c243.zip | |
Don't emit "field expressions may not have generic arguments" if it's a method call without ()
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index eeb83a85e59..0904a42d8a4 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1369,11 +1369,14 @@ impl<'a> Parser<'a> { )) } else { // Field access `expr.f` + let span = lo.to(self.prev_token.span); if let Some(args) = seg.args { - self.dcx().emit_err(errors::FieldExpressionWithGeneric(args.span())); + // See `StashKey::GenericInFieldExpr` for more info on why we stash this. + self.dcx() + .create_err(errors::FieldExpressionWithGeneric(args.span())) + .stash(seg.ident.span, StashKey::GenericInFieldExpr); } - let span = lo.to(self.prev_token.span); Ok(self.mk_expr(span, ExprKind::Field(self_arg, seg.ident))) } } |
