rust/tests/ui/async-await
bors b3f75cc872 Auto merge of #132147 - estebank:long-types-2, r=davidtwco
Tweak E0277 output when a candidate is available

*Follow up to #132086.*

Go from

```
error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied
 --> src/main.rs:7:50
  |
7 | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> {
  |                                                  ^^^^^^^^^^^^^^^^^^^^^^ the trait `chumsky::private::ParserSealed<'_, &str, (), chumsky::extra::Full<EmptyErr, (), ()>>` is not implemented for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>`, which is required by `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>`
  |
  = help: the trait `chumsky::private::ParserSealed<'_, &'a str, ((), ()), chumsky::extra::Full<EmptyErr, (), ()>>` is implemented for `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>`
  = help: for that trait implementation, expected `((), ())`, found `()`
  = note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>`
note: required for `Then<Ignored<Filter<Any<&str, ...>, ...>, ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>`
 --> src/main.rs:5:16
  |
5 | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {}
  |                ^^^^^^^^^^^^^^^^     ^          ---------------------- unsatisfied trait bound introduced here
  = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt'
  = note: consider using `--verbose` to print the full type name to the console
  = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-0008f9a4f2023b08.long-type-13239977239800463552.txt'
  = note: consider using `--verbose` to print the full type name to the console
```

to

```
error[E0277]: the trait bound `Then<Ignored<chumsky::combinator::Filter<chumsky::primitive::Any<&str, chumsky::extra::Full<EmptyErr, (), ()>>, {closure@src/main.rs:9:17: 9:27}>, char>, chumsky::combinator::Map<impl CSTParser<'a, O>, O, {closure@src/main.rs:11:24: 11:27}>, (), (), chumsky::extra::Full<EmptyErr, (), ()>>: CSTParser<'a>` is not satisfied
  --> src/main.rs:7:50
   |
7  | fn leaf<'a, O>(parser: impl CSTParser<'a, O>) -> impl CSTParser<'a, ()> {
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
...
11 |     ws.then(parser.map(|_| ()))
   |     --------------------------- return type was inferred to be `Then<Ignored<..., ...>, ..., ..., ..., ...>` here
   |
   = help: the trait `ParserSealed<'_, &_, (), Full<_, _, _>>` is not implemented for `Then<Ignored<..., ...>, ..., ..., ..., ...>`
           but trait `ParserSealed<'_, &'a _, ((), ()), Full<_, _, _>>` is implemented for it
   = help: for that trait implementation, expected `((), ())`, found `()`
   = note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `Parser<'_, &str, ()>`
note: required for `Then<Ignored<..., ...>, ..., ..., ..., ...>` to implement `CSTParser<'a>`
  --> src/main.rs:5:16
   |
5  | impl<'a, O, T> CSTParser<'a, O> for T where T: Parser<'a, &'a str, O> {}
   |                ^^^^^^^^^^^^^^^^     ^          ---------------------- unsatisfied trait bound introduced here
   = note: the full name for the type has been written to '/home/gh-estebank/longlong/target/debug/deps/longlong-df9d52be87eada65.long-type-1337037744507305372.txt'
   = note: consider using `--verbose` to print the full type name to the console
```

* Remove redundant wording
* Introduce trait diff highlighting logic and use it
* Fix incorrect "long type written to path" logic (can be split off)
* Point at tail expression in more cases in E0277
* Avoid long primary span labels in E0277 by moving them to a `help`

Fix #132013.

There are individual commits that can be their own PR. If the review load is too big, happy to split them off.
2024-11-02 20:22:49 +00:00
..
async-closures Auto merge of #132147 - estebank:long-types-2, r=davidtwco 2024-11-02 20:22:49 +00:00
async-fn Bless ui tests. 2024-10-04 23:38:41 +00:00
auxiliary
await-keyword
drop-order
future-sizes bless ui tests 2024-08-20 18:33:25 +02:00
in-trait Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issues Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
multiple-lifetimes Bless test fallout 2024-08-17 12:43:25 -04:00
return-type-notation No longer mark RTN as incomplete 2024-09-22 10:46:59 -04:00
track-caller
argument-patterns.rs
async-assoc-fn-anon-lifetimes.rs
async-await-let-else.rs
async-await-let-else.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
async-await.rs
async-block-control-flow-static-semantics.rs
async-block-control-flow-static-semantics.stderr
async-borrowck-escaping-block-error.fixed
async-borrowck-escaping-block-error.rs
async-borrowck-escaping-block-error.stderr
async-borrowck-escaping-closure-error.rs
async-borrowck-escaping-closure-error.stderr
async-closure-matches-expr.rs
async-closure.rs
async-drop.rs bless ui tests 2024-08-20 18:33:25 +02:00
async-drop.run.stdout
async-error-span.rs
async-error-span.stderr Point at tail expression on rpit E0277 2024-11-02 03:08:04 +00:00
async-fn-elided-impl-lifetime-parameter.rs
async-fn-nonsend.rs
async-fn-nonsend.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
async-fn-path-elision.rs
async-fn-path-elision.stderr
async-fn-send-uses-nonsend.rs
async-fn-size-moved-locals.rs
async-fn-size-uninit-locals.rs
async-fn-size.rs
async-is-unwindsafe.rs
async-is-unwindsafe.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
async-matches-expr.rs
async-outside-of-await-issue-121096.rs
async-outside-of-await-issue-121096.stderr
async-trait-fn.rs
async-unsafe-fn-call-in-safe.rs
async-unsafe-fn-call-in-safe.stderr
async-with-closure.rs
await-into-future.rs
await-sequence.rs
await-unsize.rs
awaiting-unsized-param.rs
awaiting-unsized-param.stderr
bound-normalization.rs
clone-suggestion.fixed
clone-suggestion.rs
clone-suggestion.stderr
conditional-and-guaranteed-initialization.rs
const-async-fn-in-main.rs
const-async-fn-in-main.stderr
context-is-sorta-unwindsafe.rs
coroutine-desc.rs
coroutine-desc.stderr
coroutine-not-future.rs On long E0277 primary span label, move it to a help 2024-11-02 03:08:04 +00:00
coroutine-not-future.stderr On long E0277 primary span label, move it to a help 2024-11-02 03:08:04 +00:00
debug-ice-attempted-to-add-with-overflow.rs
debug-ice-attempted-to-add-with-overflow.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
deep-futures-are-freeze.rs
default-struct-update.rs
dont-ice-for-type-mismatch-in-closure-in-async.rs
dont-ice-for-type-mismatch-in-closure-in-async.stderr
dont-print-desugared-async.rs
dont-print-desugared-async.stderr
dont-suggest-await-on-method-return-mismatch.rs
dont-suggest-await-on-method-return-mismatch.stderr
dont-suggest-missing-await.rs
dont-suggest-missing-await.stderr
drop-and-assign.rs
drop-track-bad-field-in-fru.rs
drop-track-bad-field-in-fru.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
drop-track-field-assign-nonsend.rs
drop-track-field-assign-nonsend.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
drop-track-field-assign.rs
drop-tracking-unresolved-typeck-results.rs
drop-tracking-unresolved-typeck-results.stderr
edition-deny-async-fns-2015.rs
edition-deny-async-fns-2015.stderr
expansion-in-attrs.rs
feature-async-closure.rs
feature-async-closure.stderr
feature-async-for-loop.rs
feature-async-for-loop.stderr
feature-self-return-type.rs
feature-self-return-type.stderr
field-assign-nonsend.rs
field-assign-nonsend.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
field-assign.rs
field-in-sync.rs Also note for fields 2024-10-12 06:14:46 -04:00
field-in-sync.stderr Also note for fields 2024-10-12 06:14:46 -04:00
for-await-2015.rs
for-await-consumes-iter.rs
for-await-consumes-iter.stderr
for-await-passthrough.rs
for-await.rs
future-contains-err-issue-115188.rs
future-contains-err-issue-115188.stderr
futures-api.rs
generics-and-bounds.rs
incorrect-move-async-order-issue-79694.fixed
incorrect-move-async-order-issue-79694.rs
incorrect-move-async-order-issue-79694.stderr
inference_var_self_argument.rs
inference_var_self_argument.stderr Bless ui tests. 2024-10-04 23:38:41 +00:00
interior-with-const-generic-expr.rs
issue-54239-private-type-triggers-lint.rs
issue-60709.rs
issue-61076.rs
issue-61076.stderr Also note for fields 2024-10-12 06:14:46 -04:00
issue-61452.rs
issue-61452.stderr
issue-61793.rs
issue-62658.rs
issue-63832-await-short-temporary-lifetime-1.rs
issue-63832-await-short-temporary-lifetime.rs
issue-64130-1-sync.rs
issue-64130-1-sync.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-64130-2-send.rs
issue-64130-2-send.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-64130-3-other.rs
issue-64130-3-other.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-64130-4-async-move.rs
issue-64130-non-send-future-diags.rs
issue-64130-non-send-future-diags.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-64391.rs
issue-65634-raw-ident-suggestion.edition2015.stderr
issue-65634-raw-ident-suggestion.edition2018.stderr
issue-65634-raw-ident-suggestion.rs
issue-66312.rs
issue-66312.stderr Bless ui tests. 2024-10-04 23:38:41 +00:00
issue-66387-if-without-else.rs
issue-66387-if-without-else.stderr
issue-67252-unnamed-future.rs
issue-67252-unnamed-future.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-67651.rs
issue-67651.stderr
issue-67765-async-diagnostic.rs
issue-67765-async-diagnostic.stderr
issue-68112.rs
issue-68112.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-68523-start.rs
issue-68523-start.stderr
issue-68523.rs
issue-68523.stderr
issue-69446-fnmut-capture.rs
issue-69446-fnmut-capture.stderr
issue-70594.rs
issue-70594.stderr
issue-70818.rs
issue-70818.stderr
issue-70935-complex-spans.rs
issue-70935-complex-spans.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-71137.rs
issue-71137.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-72442.rs
issue-72442.stderr
issue-72470-llvm-dominate.rs
issue-72590-type-error-sized.rs
issue-72590-type-error-sized.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-73050.rs
issue-73137.rs
issue-73541-1.rs
issue-73541-1.stderr
issue-73541-2.rs
issue-73541-2.stderr
issue-73541-3.rs
issue-73541-3.stderr
issue-73541.rs
issue-73541.stderr
issue-73741-type-err.rs
issue-73741-type-err.stderr
issue-74047.rs
issue-74047.stderr
issue-74072-lifetime-name-annotations.rs
issue-74072-lifetime-name-annotations.stderr
issue-74497-lifetime-in-opaque.rs
issue-74497-lifetime-in-opaque.stderr
issue-75785-confusing-named-region.rs
issue-75785-confusing-named-region.stderr
issue-76547.rs
issue-76547.stderr
issue-77993-2.rs
issue-77993-2.stderr
issue-78115.rs
issue-84841.rs
issue-84841.stderr
issue-86507.rs
issue-86507.stderr
issue-93197.rs
issue-93648.rs
issue-98634.rs
issue-98634.stderr
issue-101715.rs
issue-101715.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
issue-105501.rs
issue-107036.rs
issue-108572.fixed
issue-108572.rs
issue-108572.stderr
missed-capture-issue-107414.rs
missing-return-in-async-block.fixed
missing-return-in-async-block.rs
missing-return-in-async-block.stderr
move-part-await-return-rest-struct.rs
move-part-await-return-rest-tuple.rs
mutually-recursive-async-impl-trait-type.rs
mutually-recursive-async-impl-trait-type.stderr
nested-in-impl.rs
no-async-const.rs
no-async-const.stderr
no-const-async.rs
no-const-async.stderr
no-move-across-await-struct.rs
no-move-across-await-struct.stderr
no-move-across-await-tuple.rs
no-move-across-await-tuple.stderr
no-non-guaranteed-initialization.rs
no-non-guaranteed-initialization.stderr
no-params-non-move-async-closure.rs
no-std.rs
no-unsafe-async.rs
no-unsafe-async.stderr
non-trivial-drop.rs
normalize-output-in-signature-deduction.rs
partial-drop-partial-reinit.rs
partial-drop-partial-reinit.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
partial-initialization-across-await.rs
partial-initialization-across-await.stderr
pin-needed-to-poll-2.rs
pin-needed-to-poll-2.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
pin-needed-to-poll-3.rs
pin-needed-to-poll-3.stderr
pin-needed-to-poll.rs
pin-needed-to-poll.stderr
pin-reborrow-arg.rs pin_ergonomics: allow reborrowing as Pin<&T> 2024-09-19 16:28:19 -07:00
pin-reborrow-const-as-mut.rs pin_ergonomics: allow reborrowing as Pin<&T> 2024-09-19 16:28:19 -07:00
pin-reborrow-const-as-mut.stderr pin_ergonomics: allow reborrowing as Pin<&T> 2024-09-19 16:28:19 -07:00
pin-reborrow-once.rs Add a test case to make sure we don't reborrow twice 2024-09-19 15:40:56 -07:00
pin-reborrow-once.stderr Add a test case to make sure we don't reborrow twice 2024-09-19 15:40:56 -07:00
pin-reborrow-self.rs Allow reborrowing pinned self methods 2024-09-23 09:12:52 -07:00
pin-reborrow-shorter.rs Allow shortening reborrows 2024-09-19 15:34:00 -07:00
pin-sugar-ambiguity.rs Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
pin-sugar-no-const.rs Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
pin-sugar-no-const.stderr Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
pin-sugar.rs Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
proper-span-for-type-error.fixed
proper-span-for-type-error.rs
proper-span-for-type-error.stderr
recursive-async-impl-trait-type.rs
recursive-async-impl-trait-type.stderr
repeat_count_const_in_async_fn.rs
return-ty-raw-ptr-coercion.rs
return-ty-unsize-coercion.rs
send-bound-async-closure.rs
suggest-missing-await-closure.fixed
suggest-missing-await-closure.rs
suggest-missing-await-closure.stderr
suggest-missing-await.rs
suggest-missing-await.stderr
suggest-switching-edition-on-await-cargo.rs
suggest-switching-edition-on-await-cargo.stderr
suggest-switching-edition-on-await.rs
suggest-switching-edition-on-await.stderr
task-context-arg.rs
try-in-sync.rs Add a note for ? on future in sync function 2024-10-12 06:14:45 -04:00
try-in-sync.stderr Add a note for ? on future in sync function 2024-10-12 06:14:45 -04:00
try-on-option-in-async.rs
try-on-option-in-async.stderr
type-parameter-send.rs
unnecessary-await.rs
unnecessary-await.stderr Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
unreachable-lint-1.rs
unreachable-lint-1.stderr
unreachable-lint-2.rs
unreachable-lint-2.stderr
unreachable-lint.rs
unresolved_type_param.rs
unresolved_type_param.stderr
unsized-across-await.rs
unsized-across-await.stderr
unused-lifetime.rs
unused-lifetime.stderr