2023-08-03 03:44:02 -05:00
|
|
|
error[E0308]: `?` operator has incompatible types
|
|
|
|
--> $DIR/remove-question-symbol-with-paren.rs:5:6
|
|
|
|
|
|
2023-08-14 13:36:03 -05:00
|
|
|
LL | fn foo() -> Option<()> {
|
|
|
|
| ---------- expected `Option<()>` because of return type
|
|
|
|
LL | let x = Some(());
|
2023-08-03 03:44:02 -05:00
|
|
|
LL | (x?)
|
|
|
|
| ^^ expected `Option<()>`, found `()`
|
|
|
|
|
|
|
|
|
= note: `?` operator cannot convert from `()` to `Option<()>`
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try removing this `?`
|
|
|
|
|
|
|
|
|
LL - (x?)
|
|
|
|
LL + (x)
|
|
|
|
|
|
|
|
|
help: try wrapping the expression in `Some`
|
|
|
|
|
|
|
|
|
LL | (Some(x?))
|
|
|
|
| +++++ +
|
|
|
|
|
2023-11-21 09:44:16 -06:00
|
|
|
error: aborting due to 1 previous error
|
2023-08-03 03:44:02 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|