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.
Activity
pnkfelix commentedon Oct 19, 2022
(This needs a mentor. I am thinking that if someone doesn't pick it up by Friday, then I will see about using it as the basis for one or more instructional videos.)
compiler-errors commentedon Oct 19, 2022
I can mentor whoever wants to work on this. See https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/item.rs#L950 for the general area where changes need to be made, and ping me if someone needs help on Zulip.
me-diru commentedon Oct 19, 2022
May I work on this?
compiler-errors commentedon Oct 19, 2022
You can claim an issue with rustbot, and I recommend checking out the rustc dev guide to find out what the contribution process looks like.
chetankokil commentedon Oct 20, 2022
@compiler-errors i would like to work on this with your help.
will-flores1 commentedon Oct 20, 2022
@rustbot claim
will-flores1 commentedon Oct 21, 2022
@rustbot release-assignment
fee1-dead commentedon Oct 22, 2022
This is mostly about adding checks around
eat(token::ModSep)
such that it recovers when encounteringtoken::Colon
. srcHowever, we would also need the ability to recover to be configurable as arguments to
parse_path
, as we would want to recover fromuse std:process::Command
as well.PS: don't take this as is.. I am not that familiar with ast and recovery, but I think this is the main idea
8 remaining items