error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:8:9 | LL | foo(s); | ^ | | | expected struct `std::string::String`, found `&std::string::String` | help: try using a conversion method: `s.to_string()` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:14:10 | LL | foo3(u); | ^ | | | expected `u32`, found `&u32` | help: consider dereferencing the borrow: `*u` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:30:9 | LL | foo(&"aaa".to_owned()); | ^^^^^^^^^^^^^^^^^ | | | expected struct `std::string::String`, found `&std::string::String` | help: consider removing the borrow: `"aaa".to_owned()` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:32:9 | LL | foo(&mut "aaa".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^ | | | expected struct `std::string::String`, found `&mut std::string::String` | help: consider removing the borrow: `"aaa".to_owned()` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:2:20 | LL | ($x:expr) => { &$x } | ^^^ expected `u32`, found `&{integer}` ... LL | foo3(borrow!(0)); | ---------- in this macro invocation error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:36:5 | LL | assert_eq!(3i32, &3i32); | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:39:17 | LL | let s = S { u }; | ^ | | | expected `&u32`, found integer | help: consider borrowing here: `u: &u` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:41:20 | LL | let s = S { u: u }; | ^ | | | expected `&u32`, found integer | help: consider borrowing here: `&u` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:44:17 | LL | let r = R { i }; | ^ | | | expected `u32`, found `&{integer}` | help: consider dereferencing the borrow: `i: *i` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:46:20 | LL | let r = R { i: i }; | ^ | | | expected `u32`, found `&{integer}` | help: consider dereferencing the borrow: `*i` error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0308`.