1
Fork 0

Parser: recover from ::: to ::

This commit is contained in:
Pavel Grigorenko 2024-09-21 20:07:52 +03:00
parent 74fd001cda
commit e90e2593ea
8 changed files with 239 additions and 15 deletions

View file

@ -1054,7 +1054,7 @@ impl<'a> Parser<'a> {
{
// `use *;` or `use ::*;` or `use {...};` or `use ::{...};`
let mod_sep_ctxt = self.token.span.ctxt();
if self.eat(&token::PathSep) {
if self.eat_path_sep() {
prefix
.segments
.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)));
@ -1065,7 +1065,7 @@ impl<'a> Parser<'a> {
// `use path::*;` or `use path::{...};` or `use path;` or `use path as bar;`
prefix = self.parse_path(PathStyle::Mod)?;
if self.eat(&token::PathSep) {
if self.eat_path_sep() {
self.parse_use_tree_glob_or_nested()?
} else {
// Recover from using a colon as path separator.