Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not reverse the expected type and found type for ObligationCauseCo… #102720

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err.help("consider adding an `else` block that evaluates to the expected type");
error = true;
},
ret_reason.is_none(),
lyming2007 marked this conversation as resolved.
Show resolved Hide resolved
false,
);
error
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/issue-66387-if-without-else.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0317]: `if` may be missing an `else` clause
LL | / if true {
LL | | return 0;
LL | | }
| |_____^ expected `()`, found `i32`
| |_____^ expected `i32`, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/control-flow/issue-50577.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0317]: `if` may be missing an `else` clause
--> $DIR/issue-50577.rs:3:16
|
LL | Drop = assert_eq!(1, 1),
| ^^^^^^^^^^^^^^^^ expected `()`, found `isize`
| ^^^^^^^^^^^^^^^^ expected `isize`, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/expr/if/if-without-else-result.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
let a = if true { true };
//~^ ERROR `if` may be missing an `else` clause [E0317]
//~| expected `()`, found `bool`
//~| expected `bool`, found `()`
println!("{}", a);
}
2 changes: 1 addition & 1 deletion src/test/ui/expr/if/if-without-else-result.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | let a = if true { true };
| ^^^^^^^^^^----^^
| | |
| | found here
| expected `()`, found `bool`
| expected `bool`, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/expr/if/issue-4201.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn main() {
0
} else if false {
//~^ ERROR `if` may be missing an `else` clause
//~| expected `()`, found integer
//~| expected integer, found `()`
1
};
}
2 changes: 1 addition & 1 deletion src/test/ui/expr/if/issue-4201.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | |
LL | | 1
| | - found here
LL | | };
| |_____^ expected `()`, found integer
| |_____^ expected integer, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-19991.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

fn main() {
if let Some(homura) = Some("madoka") { //~ ERROR missing an `else` clause
//~| expected `()`, found integer
//~| expected integer, found `()`
765
};
}
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-19991.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | |
LL | | 765
| | --- found here
LL | | };
| |_____^ expected `()`, found integer
| |_____^ expected integer, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
Expand Down