Skip to content

Slight refinement to wording of help suggestion as a result of not being used #101793

Closed
@Rageking8

Description

@Rageking8

Given the following code: link

fn main() {
    let x = not 123;
}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: unexpected `123` after identifier
 --> src/main.rs:2:17
  |
2 |     let x = not 123;
  |             ----^^^
  |             |
  |             help: use `!` to perform logical negation

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

The above phrasing AFAIK should say "bitwise not" instead of "logical negation" as the above literal is not interpreted as a Boolean.
The following shows a slightly different input and output which has the right phrasing: link

fn main() {
    let x = ~ 123;
}
   Compiling playground v0.0.1 (/playground)
error: `~` cannot be used as a unary operator
 --> src/main.rs:2:13
  |
2 |     let x = ~ 123;
  |             ^ help: use `!` to perform bitwise not

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

Thanks a lot.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.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