Closed
Description
Steps to reproduce:
- Have a function that takes a reference
- Call that function passing an expression using
?
- Forget an
&
Example code: https://play.rust-lang.org/?gist=c75cddbb4c5d8a1b63ec11dc3c5bca43&version=stable&mode=debug&edition=2015
Output:
error[E0308]: try expression alternatives have incompatible types
--> src/main.rs:5:9
|
5 | foo(bar()?);
| ^^^^^^
| |
| expected &i32, found i32
| help: try wrapping with a success variant: `Ok(bar()?)`
|
= note: expected type `&i32`
found type `i32`
Expected output:
error[E0308]: mismatched types
--> src/main.rs:5:9
|
5 | foo(bar()?);
| ^^^^^^
| |
| expected &i32, found i32
| help: consider borrowing here: `&bar()?`
|
= note: expected type `&i32`
found type `i32`