Skip to content

Commit a5403d0

Browse files
committed
Add test for #24889
Fixes #24889. r? @Mark-Simulacrum.
1 parent 78d8416 commit a5403d0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/test/ui/coercion-missing-tail-expected-type.rs

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ fn plus_one(x: i32) -> i32 {
1414
x + 1;
1515
}
1616

17+
fn foo() -> Result<u8, u64> {
18+
Ok(1);
19+
}
20+
1721
fn main() {
1822
let x = plus_one(5);
1923
println!("X = {}", x);

src/test/ui/coercion-missing-tail-expected-type.stderr

+17
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,22 @@ help: consider removing this semicolon:
1515
14 | x + 1;
1616
| ^
1717

18+
error[E0308]: mismatched types
19+
--> $DIR/coercion-missing-tail-expected-type.rs:17:29
20+
|
21+
17 | fn foo() -> Result<u8, u64> {
22+
| _____________________________^
23+
18 | | Ok(1);
24+
19 | | }
25+
| |_^ expected enum `std::result::Result`, found ()
26+
|
27+
= note: expected type `std::result::Result<u8, u64>`
28+
found type `()`
29+
help: consider removing this semicolon:
30+
--> $DIR/coercion-missing-tail-expected-type.rs:18:10
31+
|
32+
18 | Ok(1);
33+
| ^
34+
1835
error: aborting due to previous error(s)
1936

0 commit comments

Comments
 (0)