Understanding differences in references

My favorite way:

let () = s;
error[E0308]: mismatched types
 --> <anon>:5:9
  |
5 |     let () = s;
  |         ^^ expected reference, found ()
  |
  = note: expected type `&&std::string::String`
  = note:    found type `()`

:wink:

10 Likes