diff options
| author | bors <bors@rust-lang.org> | 2021-02-20 21:38:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-20 21:38:53 +0000 |
| commit | d2b38d6b3c9d1ee52a360c3ce61e54b7aa91d405 (patch) | |
| tree | 33ce45d4d6fd685e3fbd9b02da5eaff94090a872 /src/test/ui | |
| parent | 83b30a639d5abd1270ade35d9bd92271f5a5ba18 (diff) | |
| parent | fc0cb5d5eb58135cde86f28895e8c282bb2e77d3 (diff) | |
| download | rust-d2b38d6b3c9d1ee52a360c3ce61e54b7aa91d405.tar.gz rust-d2b38d6b3c9d1ee52a360c3ce61e54b7aa91d405.zip | |
Auto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #80595 (`impl PartialEq<Punct> for char`; symmetry for #78636) - #81991 (Fix panic in 'remove semicolon' when types are not local) - #82176 (fix MIR fn-ptr pretty-printing) - #82244 (Keep consistency in example for Stdin StdinLock) - #82260 (rustc: Show ``@path`` usage in stable) - #82316 (Fix minor mistake in LTO docs.) - #82332 (Don't generate src link on dummy spans) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/suggestions/auxiliary/issue-81839.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-81839.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-81839.stderr | 27 | ||||
| -rw-r--r-- | src/test/ui/suggestions/match-prev-arm-needing-semi.stderr | 9 |
4 files changed, 56 insertions, 6 deletions
diff --git a/src/test/ui/suggestions/auxiliary/issue-81839.rs b/src/test/ui/suggestions/auxiliary/issue-81839.rs new file mode 100644 index 00000000000..5683c45adf2 --- /dev/null +++ b/src/test/ui/suggestions/auxiliary/issue-81839.rs @@ -0,0 +1,9 @@ +// edition:2018 + +pub struct Test {} + +impl Test { + pub async fn answer_str(&self, _s: &str) -> Test { + Test {} + } +} diff --git a/src/test/ui/suggestions/issue-81839.rs b/src/test/ui/suggestions/issue-81839.rs new file mode 100644 index 00000000000..0b9b7aefe73 --- /dev/null +++ b/src/test/ui/suggestions/issue-81839.rs @@ -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() {} diff --git a/src/test/ui/suggestions/issue-81839.stderr b/src/test/ui/suggestions/issue-81839.stderr new file mode 100644 index 00000000000..1a289d39e44 --- /dev/null +++ b/src/test/ui/suggestions/issue-81839.stderr @@ -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`. diff --git a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr index e9803a78f94..fae0c498b44 100644 --- a/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/src/test/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -24,13 +24,10 @@ help: consider `await`ing on the `Future` | LL | false => async_dummy().await, | ^^^^^^ -help: consider removing this semicolon and boxing the expressions - | -LL | Box::new(async_dummy()) -LL | -LL | } -LL | false => Box::new(async_dummy()), +help: consider removing this semicolon | +LL | async_dummy() + | -- error[E0308]: `match` arms have incompatible types --> $DIR/match-prev-arm-needing-semi.rs:39:18 |
