mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-01 21:45:15 +00:00
Do not suggest adding a semicolon after `?` Fixes #87051. I have only modified `report_return_mismatched_types()`, i.e. my changes only affect suggestions to add `;` for return type mismatches, but this never makes sense after `?`, because the function cannot return `()` if `?` is used (it has to return a `Result` or an `Option`), and a semicolon won't help if the expected and actual `Err` types differ, even if the expected one is `()`.
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.