Skip to content

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

Closed
@ExpHP

Description

@ExpHP
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.

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

    Issue actions