From 1549af29c3fea4c9afde42712b5092d8cc98e140 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sat, 21 Dec 2024 03:02:07 +0000 Subject: Do not suggest `foo.Bar` --- compiler/rustc_parse/src/parser/stmt.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 30a150db728..1ddb5fc0a11 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -746,7 +746,12 @@ impl<'a> Parser<'a> { } fn recover_missing_dot(&mut self, err: &mut Diag<'_>) { - if !self.token.is_ident() { + let Some((ident, _)) = self.token.ident() else { + return; + }; + if let Some(c) = ident.name.as_str().chars().next() + && c.is_uppercase() + { return; } if self.token.is_reserved_ident() && !self.token.is_ident_named(kw::Await) { -- cgit 1.4.1-3-g733a5