File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ // edition:2018
2+
3+ pub struct Test { }
4+
5+ impl Test {
6+ pub async fn answer_str ( & self , _s : & str ) -> Test {
7+ Test { }
8+ }
9+ }
Original file line number Diff line number Diff line change 1+ // aux-build:issue-81839.rs
2+ // edition:2018
3+
4+ extern crate issue_81839;
5+
6+ async fn test ( ans : & str , num : i32 , cx : & issue_81839:: Test ) -> u32 {
7+ match num {
8+ 1 => {
9+ cx. answer_str ( "hi" ) ;
10+ }
11+ _ => cx. answer_str ( "hi" ) , //~ `match` arms have incompatible types
12+ }
13+
14+ 1
15+ }
16+
17+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: `match` arms have incompatible types
2+ --> $DIR/issue-81839.rs:11:14
3+ |
4+ LL | / match num {
5+ LL | | 1 => {
6+ LL | | cx.answer_str("hi");
7+ | | --------------------
8+ | | | |
9+ | | | help: consider removing this semicolon
10+ | | this is found to be of type `()`
11+ LL | | }
12+ LL | | _ => cx.answer_str("hi"),
13+ | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
14+ LL | | }
15+ | |_____- `match` arms have incompatible types
16+ |
17+ ::: $DIR/auxiliary/issue-81839.rs:6:49
18+ |
19+ LL | pub async fn answer_str(&self, _s: &str) -> Test {
20+ | ---- the `Output` of this `async fn`'s found opaque type
21+ |
22+ = note: expected type `()`
23+ found opaque type `impl Future`
24+
25+ error: aborting due to previous error
26+
27+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments