1
Fork 0

Do not suggest foo.Bar

This commit is contained in:
Esteban Küber 2024-12-21 03:02:07 +00:00
parent cbbc7becc8
commit 1549af29c3
2 changed files with 6 additions and 11 deletions

View file

@ -746,7 +746,12 @@ impl<'a> Parser<'a> {
} }
fn recover_missing_dot(&mut self, err: &mut Diag<'_>) { 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; return;
} }
if self.token.is_reserved_ident() && !self.token.is_ident_named(kw::Await) { if self.token.is_reserved_ident() && !self.token.is_ident_named(kw::Await) {

View file

@ -9,22 +9,12 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
| |
LL | r#struct Test; LL | r#struct Test;
| ^^^^ expected one of 8 possible tokens | ^^^^ expected one of 8 possible tokens
|
help: you might have meant to write a field access
|
LL | r#struct.Test;
| +
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
--> $DIR/raw-literal-keywords.rs:10:13 --> $DIR/raw-literal-keywords.rs:10:13
| |
LL | r#union Test; LL | r#union Test;
| ^^^^ expected one of 8 possible tokens | ^^^^ expected one of 8 possible tokens
|
help: you might have meant to write a field access
|
LL | r#union.Test;
| +
error[E0425]: cannot find value `r#if` in this scope error[E0425]: cannot find value `r#if` in this scope
--> $DIR/raw-literal-keywords.rs:14:13 --> $DIR/raw-literal-keywords.rs:14:13