Skip to content

bad suggestion on 'assert_eq!(3i32, &3i32)' #52783

@ExpHP

Description

@ExpHP
Contributor
assert_eq!(3i32, &3i32);

On latest nightly:

   Compiling playground v0.0.1 (file:///playground)
error[E0308]: mismatched types
 --> src/main.rs:3:5
  |
3 |     assert_eq!(3i32, &3i32);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |     |
  |     expected i32, found &i32
  |     help: consider dereferencing the borrow: `*assert_eq!(3i32, &3i32);`
  |
  = note: expected type `i32`
             found type `&i32`
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Notice in particular the suggestion *assert_eq!(3i32, &3i32).

This doesn't happen on beta. Not sure if it's a regression or if the help hint is simply a recent addition.

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
on Jul 28, 2018
csmoe

csmoe commented on Jul 28, 2018

@csmoe
Contributor
added a commit that references this issue on Aug 28, 2018
5e3cb12
added a commit that references this issue on Aug 28, 2018
94e4a29
added 3 commits that reference this issue on Aug 29, 2018
491c4bb
aa93a6a
0334ce4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ExpHP@csmoe

        Issue actions

          bad suggestion on 'assert_eq!(3i32, &3i32)' · Issue #52783 · rust-lang/rust