Display expected patterns/tokens in parse error when applicable.

We've never been using those 'expected' tokens captured during
  parsing, which is lame because they contain useful information!

  This is much better than merely showing our infamous

    "Try removing it!"
This commit is contained in:
KtorZ
2024-07-19 12:16:13 +02:00
parent d6fd37c80e
commit 2922c0aa6f
4 changed files with 57 additions and 19 deletions

View File

@@ -324,7 +324,7 @@ impl Diagnostic for Error {
"Try moving the shared code to a separate module that the others can depend on\n- {}",
modules.join("\n- ")
))),
Error::Parse { error, .. } => error.kind.help(),
Error::Parse { error, .. } => error.help(),
Error::Type { error, .. } => error.help(),
Error::StandardIo(_) => None,
Error::MissingManifest { .. } => Some(Box::new(