Skip to content

Commit 8a9ba18

Browse files
chenyukangfmease
andcommitted
Update compiler/rustc_parse/src/parser/path.rs
Co-authored-by: León Orell Valerian Liehr <[email protected]>
1 parent 949333b commit 8a9ba18

File tree

1 file changed

+11
-17
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+11
-17
lines changed

Diff for: compiler/rustc_parse/src/parser/path.rs

+11-17
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,17 @@ impl<'a> Parser<'a> {
247247
segments.push(segment);
248248

249249
if self.is_import_coupler() || !self.eat_path_sep() {
250-
let ok_for_recovery = match style {
251-
PathStyle::Expr => self.may_recover(),
252-
PathStyle::Type => {
253-
self.may_recover()
254-
&& if let Some((ident, _)) = self.prev_token.ident() {
255-
ident.as_str().chars().all(|c| c.is_lowercase())
256-
&& self.token == token::Colon
257-
&& self.token.span.lo() == self.prev_token.span.hi()
258-
&& self.look_ahead(1, |token| {
259-
self.token.span.hi() == token.span.lo()
260-
})
261-
} else {
262-
false
263-
}
264-
}
265-
_ => false,
266-
};
250+
let ok_for_recovery = self.may_recover()
251+
&& match style {
252+
PathStyle::Expr => true,
253+
PathStyle::Type if let Some((_ident, _)) = self.prev_token.ident() => {
254+
self.token == token::Colon
255+
&& self.token.span.lo() == self.prev_token.span.hi()
256+
&& self
257+
.look_ahead(1, |token| self.token.span.hi() == token.span.lo())
258+
}
259+
_ => false,
260+
};
267261
if ok_for_recovery
268262
&& self.token == token::Colon
269263
&& self.look_ahead(1, |token| token.is_ident() && !token.is_reserved_ident())

0 commit comments

Comments
 (0)