Skip to content

nonsense help message for stray => #35907

@durka

Description

@durka
Contributor

Code:

if true => { }

Output:

error: expected `{`, found `=>`
 --> expr.rs:5:10
  |
5 | if true => { }
  |         ^^
  |
  = help: place this code inside a block

"Place this code inside a block" doesn't make any sense here.

Activity

Aatch

Aatch commented on Aug 23, 2016

@Aatch
Contributor

It's there to catch this:

if (foo)
   bar;

But the way it's implemented means that if we get something that isn't a block, we say to put it in a block. We might be able try parsing an expression, and show the help only if that works.

added
A-parserArea: The lexing & parsing of Rust source code to an AST
A-diagnosticsArea: Messages for errors, warnings, and lints
on Aug 23, 2016
self-assigned this
on Aug 23, 2016
added 2 commits that reference this issue on Aug 26, 2016
72d629c
added a commit that references this issue on Aug 27, 2016
1385feb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an AST

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @durka@Aatch

    Issue actions

      nonsense help message for stray `=>` · Issue #35907 · rust-lang/rust