Skip to content

A : instead of a :: in a path of a use item should be a recoverable parsing error #103269

Closed

Description

I tried this code:

use std::process:Command;
use std::fs:File;

fn main() { }

I expected to see this happen: I expected to see two diagnostic messages, telling me about the distinct parse errors on lines 1 and 2.

Instead, this happened: The first error was treated as non-recoverable, yielding this output (playground):

error: expected one of `::`, `;`, or `as`, found `:`
 --> src/main.rs:1:17
  |
1 | [use std::process:Command;](https://play.rust-lang.org/#)
  |                 ^ expected one of `::`, `;`, or `as`

error: could not compile `playground` due to previous error

I'm assuming recovering in the face of this parse error would be a relatively simple task, given that there is already the : present that should be a strong hint that someone meant to type ::. So I'm tagging this with labels indicating that its a good opportunity for someone who wants to acquaint themselves with the code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-parserArea: The parsing of Rust source code to an ASTC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions