Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ExpHP opened this issue Jul 27, 2018 · 1 comment
Closed

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

ExpHP opened this issue Jul 27, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@ExpHP
Copy link
Contributor

ExpHP commented Jul 27, 2018

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.

@csmoe csmoe added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 28, 2018
@csmoe
Copy link
Member

csmoe commented Jul 28, 2018

cc #51822

kennytm added a commit to kennytm/rust that referenced this issue Aug 28, 2018
…, r=nikomatsakis

Do not suggest dereferencing in macro

Fix rust-lang#52783.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Aug 28, 2018
…, r=nikomatsakis

Do not suggest dereferencing in macro

Fix rust-lang#52783.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Aug 29, 2018
…, r=nikomatsakis

Do not suggest dereferencing in macro

Fix rust-lang#52783.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Aug 29, 2018
…, r=nikomatsakis

Do not suggest dereferencing in macro

Fix rust-lang#52783.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Aug 30, 2018
…, r=nikomatsakis

Do not suggest dereferencing in macro

Fix rust-lang#52783.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants