mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
41e8d152dc
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
26 lines
703 B
Plaintext
26 lines
703 B
Plaintext
error[E0308]: `?` operator has incompatible types
|
|
--> $DIR/remove-question-symbol-with-paren.rs:5:6
|
|
|
|
|
LL | fn foo() -> Option<()> {
|
|
| ---------- expected `Option<()>` because of return type
|
|
LL | let x = Some(());
|
|
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?))
|
|
| +++++ +
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|