Add regression test
This commit is contained in:
parent
15fdccc6ae
commit
9ef67e09a4
3 changed files with 53 additions and 0 deletions
9
src/test/ui/suggestions/auxiliary/issue-81839.rs
Normal file
9
src/test/ui/suggestions/auxiliary/issue-81839.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// edition:2018
|
||||
|
||||
pub struct Test {}
|
||||
|
||||
impl Test {
|
||||
pub async fn answer_str(&self, _s: &str) -> Test {
|
||||
Test {}
|
||||
}
|
||||
}
|
17
src/test/ui/suggestions/issue-81839.rs
Normal file
17
src/test/ui/suggestions/issue-81839.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// aux-build:issue-81839.rs
|
||||
// edition:2018
|
||||
|
||||
extern crate issue_81839;
|
||||
|
||||
async fn test(ans: &str, num: i32, cx: &issue_81839::Test) -> u32 {
|
||||
match num {
|
||||
1 => {
|
||||
cx.answer_str("hi");
|
||||
}
|
||||
_ => cx.answer_str("hi"), //~ `match` arms have incompatible types
|
||||
}
|
||||
|
||||
1
|
||||
}
|
||||
|
||||
fn main() {}
|
27
src/test/ui/suggestions/issue-81839.stderr
Normal file
27
src/test/ui/suggestions/issue-81839.stderr
Normal file
|
@ -0,0 +1,27 @@
|
|||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/issue-81839.rs:11:14
|
||||
|
|
||||
LL | / match num {
|
||||
LL | | 1 => {
|
||||
LL | | cx.answer_str("hi");
|
||||
| | --------------------
|
||||
| | | |
|
||||
| | | help: consider removing this semicolon
|
||||
| | this is found to be of type `()`
|
||||
LL | | }
|
||||
LL | | _ => cx.answer_str("hi"),
|
||||
| | ^^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
|
||||
LL | | }
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
::: $DIR/auxiliary/issue-81839.rs:6:49
|
||||
|
|
||||
LL | pub async fn answer_str(&self, _s: &str) -> Test {
|
||||
| ---- the `Output` of this `async fn`'s found opaque type
|
||||
|
|
||||
= note: expected type `()`
|
||||
found opaque type `impl Future`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Add table
Add a link
Reference in a new issue