You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggest adding & for "mismatched types: expected reference &&[&str], found reference &[&str]" #78613
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
--> src/main.rs:4:38
|
4 | println!("{}", haystack.contains(needle));
| ^^^^^^ expected `&[&str]`, found slice `[&str]`
|
= note: expected reference `&&[&str]`
found reference `&[&str]`
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.
changed the title [-]Mismatched types: expected reference `&&[&str]`, found reference `&[&str]`[/-][+]Suggest adding `&` for "mismatched types: expected reference `&&[&str]`, found reference `&[&str]`"[/+]on Oct 31, 2020
Activity
camelid commentedon Oct 31, 2020
Also, I don't think autoref is documented anywhere.
jonas-schievink commentedon Oct 31, 2020
Autoref doesn't happen for arguments, only for the receiver
camelid commentedon Oct 31, 2020
Maybe we could suggest adding an
&then?[-]Mismatched types: expected reference `&&[&str]`, found reference `&[&str]`[/-][+]Suggest adding `&` for "mismatched types: expected reference `&&[&str]`, found reference `&[&str]`"[/+]estebank commentedon Aug 12, 2025
Current output, little change, still no suggestion:
Rollup merge of rust-lang#162329 - chenyukang:yukang-fix-78613-sugges…
Rollup merge of rust-lang#162329 - chenyukang:yukang-fix-78613-sugges…
Unrolled build for #162329 in rollup 162353