Tweak match arm semicolon removal suggestion to account for futures#78214
Tweak match arm semicolon removal suggestion to account for futures#78214bors merged 8 commits intorust-lang:masterfrom
Conversation
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @oli-obk |
src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
Outdated
Show resolved
Hide resolved
7302584 to
b56d3a8
Compare
There was a problem hiding this comment.
This is the second occurrence of this pattern... but I have no idea how to generalize it in a useful way...
There was a problem hiding this comment.
We could add a method Span::shrink_by_one(Self) to avoid the BytePos play, but two calls would still be needed.
There was a problem hiding this comment.
yea, that's one solution, but I don't like it unless we have more such - BytePos(1) in rustc or clippy.
There was a problem hiding this comment.
We have a few in rustc, but I try to avoid them like the plague* whenever feasible.
*Really need to stop using that phrase, some people embrace the plague.
|
r=me after a rebase |
226ac27 to
f5d7443
Compare
|
@bors r+ |
|
📌 Commit f5d7443 has been approved by |
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
Rollup of 10 pull requests Successful merges: - rust-lang#74477 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm) - rust-lang#77836 (transmute_copy: explain that alignment is handled correctly) - rust-lang#78126 (Properly define va_arg and va_list for aarch64-apple-darwin) - rust-lang#78137 (Initialize tracing subscriber in compiletest tool) - rust-lang#78161 (Add issue template link to IRLO) - rust-lang#78214 (Tweak match arm semicolon removal suggestion to account for futures) - rust-lang#78247 (Fix rust-lang#78192) - rust-lang#78252 (Add codegen test for rust-lang#45964) - rust-lang#78268 (Do not try to report on closures to avoid ICE) - rust-lang#78295 (Add some regression tests) Failed merges: r? `@ghost`
Suggest calling await on method call and field access When encountering a failing method or field resolution on a `Future`, look at the `Output` and try the same operation on it. If successful, suggest calling `.await` on the `Future`. This had already been introduced in rust-lang#72784, but at some point they stopped working. Built on top of rust-lang#78214, only last commit is relevant. r? @oli-obk
.await" suggestionsimpl Futurewhen suggesting semicolon removalawait foo()?as can't be certain what the intent wasThanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!