From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/async-await/argument-patterns.rs | 28 -- .../async-await/async-assoc-fn-anon-lifetimes.rs | 23 -- .../async-await-let-else.drop-tracking.stderr | 110 -------- .../async-await-let-else.no-drop-tracking.stderr | 94 ------- src/test/ui/async-await/async-await-let-else.rs | 56 ---- src/test/ui/async-await/async-await.rs | 219 --------------- .../async-block-control-flow-static-semantics.rs | 65 ----- ...sync-block-control-flow-static-semantics.stderr | 81 ------ .../async-borrowck-escaping-block-error.fixed | 18 -- .../async-borrowck-escaping-block-error.rs | 18 -- .../async-borrowck-escaping-block-error.stderr | 41 --- .../async-borrowck-escaping-closure-error.rs | 10 - .../async-borrowck-escaping-closure-error.stderr | 21 -- .../ui/async-await/async-closure-matches-expr.rs | 12 - src/test/ui/async-await/async-closure.rs | 100 ------- src/test/ui/async-await/async-error-span.rs | 17 -- src/test/ui/async-await/async-error-span.stderr | 25 -- .../async-fn-elided-impl-lifetime-parameter.rs | 15 - src/test/ui/async-await/async-fn-nonsend.rs | 74 ----- src/test/ui/async-await/async-fn-nonsend.stderr | 49 ---- src/test/ui/async-await/async-fn-path-elision.rs | 13 - .../ui/async-await/async-fn-path-elision.stderr | 15 - .../ui/async-await/async-fn-send-uses-nonsend.rs | 57 ---- .../ui/async-await/async-fn-size-moved-locals.rs | 118 -------- .../ui/async-await/async-fn-size-uninit-locals.rs | 102 ------- src/test/ui/async-await/async-fn-size.rs | 105 ------- src/test/ui/async-await/async-matches-expr.rs | 10 - src/test/ui/async-await/async-trait-fn.rs | 11 - src/test/ui/async-await/async-trait-fn.stderr | 42 --- .../async-unsafe-fn-call-in-safe.mir.stderr | 35 --- .../ui/async-await/async-unsafe-fn-call-in-safe.rs | 25 -- .../async-unsafe-fn-call-in-safe.thir.stderr | 19 -- src/test/ui/async-await/async-with-closure.rs | 24 -- src/test/ui/async-await/auxiliary/arc_wake.rs | 64 ----- src/test/ui/async-await/auxiliary/issue-107036.rs | 12 - .../ui/async-await/auxiliary/issue-72470-lib.rs | 175 ------------ src/test/ui/async-await/await-into-future.rs | 28 -- .../2015-edition-error-various-positions.rs | 38 --- .../2015-edition-error-various-positions.stderr | 97 ------- .../await-keyword/2015-edition-warning.fixed | 27 -- .../await-keyword/2015-edition-warning.rs | 27 -- .../await-keyword/2015-edition-warning.stderr | 61 ---- .../2018-edition-error-in-non-macro-position.rs | 24 -- ...2018-edition-error-in-non-macro-position.stderr | 81 ------ .../await-keyword/2018-edition-error.rs | 16 -- .../await-keyword/2018-edition-error.stderr | 63 ----- .../await-keyword/incorrect-syntax-suggestions.rs | 132 --------- .../incorrect-syntax-suggestions.stderr | 230 --------------- .../await-keyword/post_expansion_error.rs | 10 - .../await-keyword/post_expansion_error.stderr | 8 - src/test/ui/async-await/await-unsize.rs | 14 - src/test/ui/async-await/bound-normalization.rs | 14 - .../conditional-and-guaranteed-initialization.rs | 16 -- src/test/ui/async-await/default-struct-update.rs | 22 -- .../ui/async-await/dont-print-desugared-async.rs | 8 - .../async-await/dont-print-desugared-async.stderr | 9 - .../ui/async-await/dont-suggest-missing-await.rs | 19 -- .../async-await/dont-suggest-missing-await.stderr | 28 -- src/test/ui/async-await/drop-and-assign.rs | 19 -- .../async-await/drop-order/auxiliary/arc_wake.rs | 64 ----- ...order-for-async-fn-parameters-by-ref-binding.rs | 270 ------------------ .../drop-order-for-async-fn-parameters.rs | 265 ------------------ .../drop-order-for-locals-when-cancelled.rs | 176 ------------ ...drop-order-for-temporary-in-tail-return-expr.rs | 98 ------- .../drop-order/drop-order-locals-are-hidden.rs | 13 - .../drop-order/drop-order-locals-are-hidden.stderr | 27 -- .../drop-order/drop-order-when-cancelled.rs | 309 --------------------- .../ui/async-await/drop-track-bad-field-in-fru.rs | 10 - .../async-await/drop-track-bad-field-in-fru.stderr | 23 -- .../async-await/drop-track-field-assign-nonsend.rs | 45 --- .../drop-track-field-assign-nonsend.stderr | 25 -- src/test/ui/async-await/drop-track-field-assign.rs | 44 --- .../drop-tracking-unresolved-typeck-results.rs | 106 ------- .../drop-tracking-unresolved-typeck-results.stderr | 62 ----- .../ui/async-await/edition-deny-async-fns-2015.rs | 38 --- .../async-await/edition-deny-async-fns-2015.stderr | 98 ------- src/test/ui/async-await/expansion-in-attrs.rs | 13 - src/test/ui/async-await/feature-async-closure.rs | 8 - .../ui/async-await/feature-async-closure.stderr | 13 - .../async-await/feature-gate-async_fn_in_trait.rs | 25 -- .../feature-gate-async_fn_in_trait.stderr | 42 --- .../ui/async-await/feature-self-return-type.rs | 28 -- .../ui/async-await/feature-self-return-type.stderr | 15 - src/test/ui/async-await/futures-api.rs | 61 ---- src/test/ui/async-await/generator-desc.rs | 16 -- src/test/ui/async-await/generator-desc.stderr | 66 ----- src/test/ui/async-await/generator-not-future.rs | 45 --- .../ui/async-await/generator-not-future.stderr | 81 ------ src/test/ui/async-await/generics-and-bounds.rs | 88 ------ .../async-await/in-trait/async-associated-types.rs | 24 -- .../in-trait/async-associated-types2.rs | 30 -- .../async-example-desugared-boxed-in-trait.rs | 21 -- .../async-example-desugared-boxed-in-trait.stderr | 17 -- .../in-trait/async-example-desugared-boxed.rs | 24 -- .../in-trait/async-example-desugared-in-trait.rs | 21 -- .../in-trait/async-example-desugared.rs | 23 -- src/test/ui/async-await/in-trait/async-example.rs | 32 --- .../in-trait/async-generics-and-bounds.rs | 21 -- .../in-trait/async-generics-and-bounds.stderr | 37 --- src/test/ui/async-await/in-trait/async-generics.rs | 18 -- .../ui/async-await/in-trait/async-generics.stderr | 37 --- .../in-trait/async-lifetimes-and-bounds.rs | 19 -- .../ui/async-await/in-trait/async-lifetimes.rs | 17 -- .../in-trait/async-recursive-generic.rs | 21 -- .../in-trait/async-recursive-generic.stderr | 12 - .../ui/async-await/in-trait/async-recursive.rs | 21 -- .../ui/async-await/in-trait/async-recursive.stderr | 12 - src/test/ui/async-await/in-trait/early-bound-1.rs | 17 -- src/test/ui/async-await/in-trait/early-bound-2.rs | 15 - .../ui/async-await/in-trait/fn-not-async-err.rs | 17 -- .../async-await/in-trait/fn-not-async-err.stderr | 17 -- .../ui/async-await/in-trait/fn-not-async-err2.rs | 21 -- .../async-await/in-trait/fn-not-async-err2.stderr | 12 - src/test/ui/async-await/in-trait/implied-bounds.rs | 13 - src/test/ui/async-await/in-trait/issue-102138.rs | 46 --- src/test/ui/async-await/in-trait/issue-102219.rs | 10 - src/test/ui/async-await/in-trait/issue-102310.rs | 15 - .../ui/async-await/in-trait/lifetime-mismatch.rs | 20 -- .../async-await/in-trait/lifetime-mismatch.stderr | 21 -- src/test/ui/async-await/in-trait/nested-rpit.rs | 19 -- src/test/ui/async-await/in-trait/object-safety.rs | 13 - .../ui/async-await/in-trait/object-safety.stderr | 27 -- .../async-await/in-trait/return-type-suggestion.rs | 14 - .../in-trait/return-type-suggestion.stderr | 23 -- .../incorrect-move-async-order-issue-79694.fixed | 8 - .../incorrect-move-async-order-issue-79694.rs | 8 - .../incorrect-move-async-order-issue-79694.stderr | 13 - .../interior-with-const-generic-expr.rs | 26 -- src/test/ui/async-await/issue-101715.rs | 17 -- src/test/ui/async-await/issue-101715.stderr | 16 -- src/test/ui/async-await/issue-107036.rs | 14 - .../issue-54239-private-type-triggers-lint.rs | 17 -- src/test/ui/async-await/issue-60709.rs | 28 -- src/test/ui/async-await/issue-61076.rs | 97 ------- src/test/ui/async-await/issue-61076.stderr | 82 ------ src/test/ui/async-await/issue-61452.rs | 13 - src/test/ui/async-await/issue-61452.stderr | 23 -- src/test/ui/async-await/issue-61793.rs | 16 -- .../ui/async-await/issue-61949-self-return-type.rs | 28 -- .../issue-61949-self-return-type.stderr | 25 -- src/test/ui/async-await/issue-62658.rs | 27 -- ...issue-63832-await-short-temporary-lifetime-1.rs | 19 -- .../issue-63832-await-short-temporary-lifetime.rs | 12 - src/test/ui/async-await/issue-64130-1-sync.rs | 23 -- src/test/ui/async-await/issue-64130-1-sync.stderr | 24 -- src/test/ui/async-await/issue-64130-2-send.rs | 23 -- src/test/ui/async-await/issue-64130-2-send.stderr | 24 -- src/test/ui/async-await/issue-64130-3-other.rs | 26 -- src/test/ui/async-await/issue-64130-3-other.stderr | 27 -- .../issue-64130-4-async-move.drop-tracking.stderr | 26 -- ...ssue-64130-4-async-move.no_drop_tracking.stderr | 26 -- .../ui/async-await/issue-64130-4-async-move.rs | 32 --- .../issue-64130-non-send-future-diags.rs | 25 -- .../issue-64130-non-send-future-diags.stderr | 24 -- src/test/ui/async-await/issue-64391.rs | 14 - src/test/ui/async-await/issue-66312.rs | 14 - src/test/ui/async-await/issue-66312.stderr | 12 - .../ui/async-await/issue-66387-if-without-else.rs | 10 - .../async-await/issue-66387-if-without-else.stderr | 14 - .../ui/async-await/issue-67252-unnamed-future.rs | 24 -- .../async-await/issue-67252-unnamed-future.stderr | 28 -- src/test/ui/async-await/issue-67651.rs | 20 -- src/test/ui/async-await/issue-67651.stderr | 12 - .../ui/async-await/issue-67765-async-diagnostic.rs | 16 -- .../issue-67765-async-diagnostic.stderr | 12 - .../async-await/issue-68112.drop_tracking.stderr | 79 ------ .../issue-68112.no_drop_tracking.stderr | 79 ------ src/test/ui/async-await/issue-68112.rs | 69 ----- src/test/ui/async-await/issue-68523-start.rs | 9 - src/test/ui/async-await/issue-68523-start.stderr | 9 - src/test/ui/async-await/issue-68523.rs | 6 - src/test/ui/async-await/issue-68523.stderr | 9 - .../ui/async-await/issue-69446-fnmut-capture.rs | 22 -- .../async-await/issue-69446-fnmut-capture.stderr | 19 -- src/test/ui/async-await/issue-70594.rs | 11 - src/test/ui/async-await/issue-70594.stderr | 37 --- src/test/ui/async-await/issue-70818.rs | 9 - src/test/ui/async-await/issue-70818.stderr | 18 -- .../issue-70935-complex-spans.drop_tracking.stderr | 34 --- ...sue-70935-complex-spans.no_drop_tracking.stderr | 25 -- .../ui/async-await/issue-70935-complex-spans.rs | 29 -- src/test/ui/async-await/issue-71137.rs | 23 -- src/test/ui/async-await/issue-71137.stderr | 25 -- src/test/ui/async-await/issue-72442.rs | 26 -- src/test/ui/async-await/issue-72442.stderr | 17 -- .../ui/async-await/issue-72470-llvm-dominate.rs | 66 ----- .../ui/async-await/issue-72590-type-error-sized.rs | 22 -- .../issue-72590-type-error-sized.stderr | 34 --- src/test/ui/async-await/issue-73050.rs | 12 - src/test/ui/async-await/issue-73137.rs | 44 --- src/test/ui/async-await/issue-73541-1.rs | 12 - src/test/ui/async-await/issue-73541-1.stderr | 14 - src/test/ui/async-await/issue-73541-2.rs | 20 -- src/test/ui/async-await/issue-73541-2.stderr | 18 -- src/test/ui/async-await/issue-73541-3.rs | 9 - src/test/ui/async-await/issue-73541-3.stderr | 12 - src/test/ui/async-await/issue-73541.rs | 9 - src/test/ui/async-await/issue-73541.stderr | 14 - .../issue-73741-type-err-drop-tracking.rs | 14 - .../issue-73741-type-err-drop-tracking.stderr | 11 - src/test/ui/async-await/issue-73741-type-err.rs | 14 - .../ui/async-await/issue-73741-type-err.stderr | 11 - src/test/ui/async-await/issue-74047.rs | 17 -- src/test/ui/async-await/issue-74047.stderr | 12 - .../issue-74072-lifetime-name-annotations.rs | 37 --- .../issue-74072-lifetime-name-annotations.stderr | 51 ---- .../async-await/issue-74497-lifetime-in-opaque.rs | 19 -- .../issue-74497-lifetime-in-opaque.stderr | 11 - .../issue-75785-confusing-named-region.rs | 13 - .../issue-75785-confusing-named-region.stderr | 15 - src/test/ui/async-await/issue-76547.rs | 38 --- src/test/ui/async-await/issue-76547.stderr | 32 --- src/test/ui/async-await/issue-77993-2.rs | 9 - src/test/ui/async-await/issue-77993-2.stderr | 8 - src/test/ui/async-await/issue-84841.rs | 16 -- src/test/ui/async-await/issue-84841.stderr | 26 -- src/test/ui/async-await/issue-86507.rs | 25 -- src/test/ui/async-await/issue-86507.stderr | 23 -- src/test/ui/async-await/issue-93197.rs | 16 -- src/test/ui/async-await/issue-93648.rs | 12 - src/test/ui/async-await/issue-98634.rs | 50 ---- src/test/ui/async-await/issue-98634.stderr | 60 ---- .../ui/async-await/issues/auxiliary/issue-60674.rs | 12 - .../ui/async-await/issues/auxiliary/issue_67893.rs | 10 - src/test/ui/async-await/issues/issue-51719.rs | 12 - src/test/ui/async-await/issues/issue-51719.stderr | 11 - src/test/ui/async-await/issues/issue-51751.rs | 11 - src/test/ui/async-await/issues/issue-51751.stderr | 12 - src/test/ui/async-await/issues/issue-53249.rs | 47 ---- .../async-await/issues/issue-54752-async-block.rs | 7 - .../issues/issue-54752-async-block.stderr | 15 - src/test/ui/async-await/issues/issue-54974.rs | 14 - src/test/ui/async-await/issues/issue-55324.rs | 11 - src/test/ui/async-await/issues/issue-55809.rs | 28 -- src/test/ui/async-await/issues/issue-58885.rs | 19 -- src/test/ui/async-await/issues/issue-59001.rs | 14 - src/test/ui/async-await/issues/issue-59972.rs | 34 --- src/test/ui/async-await/issues/issue-60518.rs | 10 - .../issues/issue-60655-latebound-regions.rs | 30 -- src/test/ui/async-await/issues/issue-60674.rs | 19 -- src/test/ui/async-await/issues/issue-60674.stdout | 3 - src/test/ui/async-await/issues/issue-61187.rs | 7 - src/test/ui/async-await/issues/issue-61187.stderr | 11 - src/test/ui/async-await/issues/issue-61986.rs | 19 -- src/test/ui/async-await/issues/issue-62009-1.rs | 15 - .../ui/async-await/issues/issue-62009-1.stderr | 43 --- src/test/ui/async-await/issues/issue-62009-2.rs | 10 - .../ui/async-await/issues/issue-62009-2.stderr | 11 - src/test/ui/async-await/issues/issue-62097.rs | 21 -- src/test/ui/async-await/issues/issue-62097.stderr | 36 --- src/test/ui/async-await/issues/issue-62517-1.rs | 21 -- src/test/ui/async-await/issues/issue-62517-2.rs | 16 -- src/test/ui/async-await/issues/issue-63388-1.rs | 19 -- .../ui/async-await/issues/issue-63388-1.stderr | 15 - src/test/ui/async-await/issues/issue-63388-2.rs | 19 -- .../ui/async-await/issues/issue-63388-2.stderr | 30 -- src/test/ui/async-await/issues/issue-63388-3.rs | 17 -- src/test/ui/async-await/issues/issue-63388-4.rs | 10 - src/test/ui/async-await/issues/issue-64391-2.rs | 20 -- src/test/ui/async-await/issues/issue-64433.rs | 30 -- src/test/ui/async-await/issues/issue-64477-2.rs | 22 -- src/test/ui/async-await/issues/issue-64477.rs | 20 -- src/test/ui/async-await/issues/issue-64964.rs | 23 -- src/test/ui/async-await/issues/issue-65159.rs | 11 - src/test/ui/async-await/issues/issue-65159.stderr | 21 -- ...issue-65419-async-fn-resume-after-completion.rs | 46 --- .../issue-65419-async-fn-resume-after-panic.rs | 52 ---- ...ssue-65419-generator-resume-after-completion.rs | 25 -- ...-65436-raw-ptr-not-send.no_drop_tracking.stderr | 36 --- .../issues/issue-65436-raw-ptr-not-send.rs | 20 -- .../async-await/issues/issue-66695-static-refs.rs | 24 -- .../issue-66958-non-copy-infered-type-arg.rs | 15 - .../issue-66958-non-copy-infered-type-arg.stderr | 13 - .../issues/issue-67611-static-mut-refs.rs | 33 --- src/test/ui/async-await/issues/issue-67893.rs | 11 - src/test/ui/async-await/issues/issue-67893.stderr | 27 -- .../ui/async-await/issues/issue-69307-nested.rs | 30 -- src/test/ui/async-await/issues/issue-69307.rs | 23 -- src/test/ui/async-await/issues/issue-72312.rs | 21 -- src/test/ui/async-await/issues/issue-72312.stderr | 23 -- src/test/ui/async-await/issues/issue-78600.rs | 12 - src/test/ui/async-await/issues/issue-78600.stderr | 14 - .../ui/async-await/issues/issue-78654.full.stderr | 19 -- .../ui/async-await/issues/issue-78654.min.stderr | 19 -- src/test/ui/async-await/issues/issue-78654.rs | 15 - .../async-await/issues/issue-78938-async-block.rs | 33 --- .../issues/issue-78938-async-block.stderr | 19 -- src/test/ui/async-await/issues/issue-95307.rs | 13 - src/test/ui/async-await/issues/issue-95307.stderr | 32 --- .../async-await/issues/non-async-enclosing-span.rs | 11 - .../issues/non-async-enclosing-span.stderr | 12 - .../ui/async-await/large_moves.attribute.stderr | 45 --- src/test/ui/async-await/large_moves.option.stderr | 45 --- src/test/ui/async-await/large_moves.rs | 27 -- .../move-part-await-return-rest-struct.rs | 18 -- .../move-part-await-return-rest-tuple.rs | 12 - .../ui/async-await/multiple-lifetimes/elided.rs | 10 - .../ui/async-await/multiple-lifetimes/fn-ptr.rs | 12 - src/test/ui/async-await/multiple-lifetimes/hrtb.rs | 14 - .../ui/async-await/multiple-lifetimes/named.rs | 10 - .../multiple-lifetimes/partial-relation.rs | 13 - .../multiple-lifetimes/ret-impl-trait-fg.rs | 17 -- .../multiple-lifetimes/ret-impl-trait-one.rs | 31 --- .../multiple-lifetimes/ret-impl-trait-one.stderr | 35 --- .../ui/async-await/multiple-lifetimes/ret-ref.rs | 44 --- .../async-await/multiple-lifetimes/ret-ref.stderr | 37 --- .../ui/async-await/multiple-lifetimes/variance.rs | 15 - .../mutually-recursive-async-impl-trait-type.rs | 13 - ...mutually-recursive-async-impl-trait-type.stderr | 21 -- src/test/ui/async-await/nested-in-impl.rs | 15 - src/test/ui/async-await/no-async-const.rs | 5 - src/test/ui/async-await/no-async-const.stderr | 13 - src/test/ui/async-await/no-const-async.rs | 6 - src/test/ui/async-await/no-const-async.stderr | 42 --- .../ui/async-await/no-move-across-await-struct.rs | 16 -- .../async-await/no-move-across-await-struct.stderr | 13 - .../ui/async-await/no-move-across-await-tuple.rs | 12 - .../async-await/no-move-across-await-tuple.stderr | 14 - .../no-non-guaranteed-initialization.rs | 12 - .../no-non-guaranteed-initialization.stderr | 16 -- .../no-params-non-move-async-closure.rs | 8 - .../no-params-non-move-async-closure.stderr | 11 - src/test/ui/async-await/no-std.rs | 13 - src/test/ui/async-await/no-unsafe-async.rs | 11 - src/test/ui/async-await/no-unsafe-async.stderr | 29 -- src/test/ui/async-await/non-trivial-drop.rs | 36 --- ...artial-drop-partial-reinit.drop_tracking.stderr | 35 --- ...ial-drop-partial-reinit.no_drop_tracking.stderr | 35 --- .../ui/async-await/partial-drop-partial-reinit.rs | 40 --- .../partial-initialization-across-await.rs | 39 --- .../partial-initialization-across-await.stderr | 33 --- src/test/ui/async-await/pin-needed-to-poll-2.rs | 48 ---- .../ui/async-await/pin-needed-to-poll-2.stderr | 23 -- src/test/ui/async-await/pin-needed-to-poll.rs | 47 ---- src/test/ui/async-await/pin-needed-to-poll.stderr | 22 -- .../async-await/proper-span-for-type-error.fixed | 12 - .../ui/async-await/proper-span-for-type-error.rs | 11 - .../async-await/proper-span-for-type-error.stderr | 17 -- .../async-await/recursive-async-impl-trait-type.rs | 10 - .../recursive-async-impl-trait-type.stderr | 12 - .../async-await/repeat_count_const_in_async_fn.rs | 10 - .../ui/async-await/return-ty-raw-ptr-coercion.rs | 25 -- .../ui/async-await/return-ty-unsize-coercion.rs | 45 --- .../suggest-missing-await-closure.fixed | 23 -- .../async-await/suggest-missing-await-closure.rs | 23 -- .../suggest-missing-await-closure.stderr | 28 -- src/test/ui/async-await/suggest-missing-await.rs | 74 ----- .../ui/async-await/suggest-missing-await.stderr | 167 ----------- .../suggest-switching-edition-on-await-cargo.rs | 47 ---- ...suggest-switching-edition-on-await-cargo.stderr | 43 --- .../suggest-switching-edition-on-await.rs | 45 --- .../suggest-switching-edition-on-await.stderr | 43 --- .../async-await/track-caller/async-closure-gate.rs | 9 - .../track-caller/async-closure-gate.stderr | 12 - .../ui/async-await/track-caller/issue-105134.rs | 11 - .../track-caller/panic-track-caller.nofeat.stderr | 29 -- .../async-await/track-caller/panic-track-caller.rs | 100 ------- src/test/ui/async-await/try-on-option-in-async.rs | 28 -- .../ui/async-await/try-on-option-in-async.stderr | 44 --- src/test/ui/async-await/type-parameter-send.rs | 18 -- src/test/ui/async-await/unnecessary-await.rs | 14 - src/test/ui/async-await/unnecessary-await.stderr | 24 -- src/test/ui/async-await/unreachable-lint-1.rs | 12 - src/test/ui/async-await/unreachable-lint-1.stderr | 16 -- src/test/ui/async-await/unreachable-lint.rs | 13 - src/test/ui/async-await/unresolved_type_param.rs | 24 -- .../ui/async-await/unresolved_type_param.stderr | 39 --- src/test/ui/async-await/unused-lifetime.rs | 39 --- src/test/ui/async-await/unused-lifetime.stderr | 48 ---- 369 files changed, 11633 deletions(-) delete mode 100644 src/test/ui/async-await/argument-patterns.rs delete mode 100644 src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs delete mode 100644 src/test/ui/async-await/async-await-let-else.drop-tracking.stderr delete mode 100644 src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr delete mode 100644 src/test/ui/async-await/async-await-let-else.rs delete mode 100644 src/test/ui/async-await/async-await.rs delete mode 100644 src/test/ui/async-await/async-block-control-flow-static-semantics.rs delete mode 100644 src/test/ui/async-await/async-block-control-flow-static-semantics.stderr delete mode 100644 src/test/ui/async-await/async-borrowck-escaping-block-error.fixed delete mode 100644 src/test/ui/async-await/async-borrowck-escaping-block-error.rs delete mode 100644 src/test/ui/async-await/async-borrowck-escaping-block-error.stderr delete mode 100644 src/test/ui/async-await/async-borrowck-escaping-closure-error.rs delete mode 100644 src/test/ui/async-await/async-borrowck-escaping-closure-error.stderr delete mode 100644 src/test/ui/async-await/async-closure-matches-expr.rs delete mode 100644 src/test/ui/async-await/async-closure.rs delete mode 100644 src/test/ui/async-await/async-error-span.rs delete mode 100644 src/test/ui/async-await/async-error-span.stderr delete mode 100644 src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs delete mode 100644 src/test/ui/async-await/async-fn-nonsend.rs delete mode 100644 src/test/ui/async-await/async-fn-nonsend.stderr delete mode 100644 src/test/ui/async-await/async-fn-path-elision.rs delete mode 100644 src/test/ui/async-await/async-fn-path-elision.stderr delete mode 100644 src/test/ui/async-await/async-fn-send-uses-nonsend.rs delete mode 100644 src/test/ui/async-await/async-fn-size-moved-locals.rs delete mode 100644 src/test/ui/async-await/async-fn-size-uninit-locals.rs delete mode 100644 src/test/ui/async-await/async-fn-size.rs delete mode 100644 src/test/ui/async-await/async-matches-expr.rs delete mode 100644 src/test/ui/async-await/async-trait-fn.rs delete mode 100644 src/test/ui/async-await/async-trait-fn.stderr delete mode 100644 src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr delete mode 100644 src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs delete mode 100644 src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr delete mode 100644 src/test/ui/async-await/async-with-closure.rs delete mode 100644 src/test/ui/async-await/auxiliary/arc_wake.rs delete mode 100644 src/test/ui/async-await/auxiliary/issue-107036.rs delete mode 100644 src/test/ui/async-await/auxiliary/issue-72470-lib.rs delete mode 100644 src/test/ui/async-await/await-into-future.rs delete mode 100644 src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs delete mode 100644 src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr delete mode 100644 src/test/ui/async-await/await-keyword/2015-edition-warning.fixed delete mode 100644 src/test/ui/async-await/await-keyword/2015-edition-warning.rs delete mode 100644 src/test/ui/async-await/await-keyword/2015-edition-warning.stderr delete mode 100644 src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs delete mode 100644 src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr delete mode 100644 src/test/ui/async-await/await-keyword/2018-edition-error.rs delete mode 100644 src/test/ui/async-await/await-keyword/2018-edition-error.stderr delete mode 100644 src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs delete mode 100644 src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr delete mode 100644 src/test/ui/async-await/await-keyword/post_expansion_error.rs delete mode 100644 src/test/ui/async-await/await-keyword/post_expansion_error.stderr delete mode 100644 src/test/ui/async-await/await-unsize.rs delete mode 100644 src/test/ui/async-await/bound-normalization.rs delete mode 100644 src/test/ui/async-await/conditional-and-guaranteed-initialization.rs delete mode 100644 src/test/ui/async-await/default-struct-update.rs delete mode 100644 src/test/ui/async-await/dont-print-desugared-async.rs delete mode 100644 src/test/ui/async-await/dont-print-desugared-async.stderr delete mode 100644 src/test/ui/async-await/dont-suggest-missing-await.rs delete mode 100644 src/test/ui/async-await/dont-suggest-missing-await.stderr delete mode 100644 src/test/ui/async-await/drop-and-assign.rs delete mode 100644 src/test/ui/async-await/drop-order/auxiliary/arc_wake.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.rs delete mode 100644 src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.stderr delete mode 100644 src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs delete mode 100644 src/test/ui/async-await/drop-track-bad-field-in-fru.rs delete mode 100644 src/test/ui/async-await/drop-track-bad-field-in-fru.stderr delete mode 100644 src/test/ui/async-await/drop-track-field-assign-nonsend.rs delete mode 100644 src/test/ui/async-await/drop-track-field-assign-nonsend.stderr delete mode 100644 src/test/ui/async-await/drop-track-field-assign.rs delete mode 100644 src/test/ui/async-await/drop-tracking-unresolved-typeck-results.rs delete mode 100644 src/test/ui/async-await/drop-tracking-unresolved-typeck-results.stderr delete mode 100644 src/test/ui/async-await/edition-deny-async-fns-2015.rs delete mode 100644 src/test/ui/async-await/edition-deny-async-fns-2015.stderr delete mode 100644 src/test/ui/async-await/expansion-in-attrs.rs delete mode 100644 src/test/ui/async-await/feature-async-closure.rs delete mode 100644 src/test/ui/async-await/feature-async-closure.stderr delete mode 100644 src/test/ui/async-await/feature-gate-async_fn_in_trait.rs delete mode 100644 src/test/ui/async-await/feature-gate-async_fn_in_trait.stderr delete mode 100644 src/test/ui/async-await/feature-self-return-type.rs delete mode 100644 src/test/ui/async-await/feature-self-return-type.stderr delete mode 100644 src/test/ui/async-await/futures-api.rs delete mode 100644 src/test/ui/async-await/generator-desc.rs delete mode 100644 src/test/ui/async-await/generator-desc.stderr delete mode 100644 src/test/ui/async-await/generator-not-future.rs delete mode 100644 src/test/ui/async-await/generator-not-future.stderr delete mode 100644 src/test/ui/async-await/generics-and-bounds.rs delete mode 100644 src/test/ui/async-await/in-trait/async-associated-types.rs delete mode 100644 src/test/ui/async-await/in-trait/async-associated-types2.rs delete mode 100644 src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs delete mode 100644 src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr delete mode 100644 src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs delete mode 100644 src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs delete mode 100644 src/test/ui/async-await/in-trait/async-example-desugared.rs delete mode 100644 src/test/ui/async-await/in-trait/async-example.rs delete mode 100644 src/test/ui/async-await/in-trait/async-generics-and-bounds.rs delete mode 100644 src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr delete mode 100644 src/test/ui/async-await/in-trait/async-generics.rs delete mode 100644 src/test/ui/async-await/in-trait/async-generics.stderr delete mode 100644 src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs delete mode 100644 src/test/ui/async-await/in-trait/async-lifetimes.rs delete mode 100644 src/test/ui/async-await/in-trait/async-recursive-generic.rs delete mode 100644 src/test/ui/async-await/in-trait/async-recursive-generic.stderr delete mode 100644 src/test/ui/async-await/in-trait/async-recursive.rs delete mode 100644 src/test/ui/async-await/in-trait/async-recursive.stderr delete mode 100644 src/test/ui/async-await/in-trait/early-bound-1.rs delete mode 100644 src/test/ui/async-await/in-trait/early-bound-2.rs delete mode 100644 src/test/ui/async-await/in-trait/fn-not-async-err.rs delete mode 100644 src/test/ui/async-await/in-trait/fn-not-async-err.stderr delete mode 100644 src/test/ui/async-await/in-trait/fn-not-async-err2.rs delete mode 100644 src/test/ui/async-await/in-trait/fn-not-async-err2.stderr delete mode 100644 src/test/ui/async-await/in-trait/implied-bounds.rs delete mode 100644 src/test/ui/async-await/in-trait/issue-102138.rs delete mode 100644 src/test/ui/async-await/in-trait/issue-102219.rs delete mode 100644 src/test/ui/async-await/in-trait/issue-102310.rs delete mode 100644 src/test/ui/async-await/in-trait/lifetime-mismatch.rs delete mode 100644 src/test/ui/async-await/in-trait/lifetime-mismatch.stderr delete mode 100644 src/test/ui/async-await/in-trait/nested-rpit.rs delete mode 100644 src/test/ui/async-await/in-trait/object-safety.rs delete mode 100644 src/test/ui/async-await/in-trait/object-safety.stderr delete mode 100644 src/test/ui/async-await/in-trait/return-type-suggestion.rs delete mode 100644 src/test/ui/async-await/in-trait/return-type-suggestion.stderr delete mode 100644 src/test/ui/async-await/incorrect-move-async-order-issue-79694.fixed delete mode 100644 src/test/ui/async-await/incorrect-move-async-order-issue-79694.rs delete mode 100644 src/test/ui/async-await/incorrect-move-async-order-issue-79694.stderr delete mode 100644 src/test/ui/async-await/interior-with-const-generic-expr.rs delete mode 100644 src/test/ui/async-await/issue-101715.rs delete mode 100644 src/test/ui/async-await/issue-101715.stderr delete mode 100644 src/test/ui/async-await/issue-107036.rs delete mode 100644 src/test/ui/async-await/issue-54239-private-type-triggers-lint.rs delete mode 100644 src/test/ui/async-await/issue-60709.rs delete mode 100644 src/test/ui/async-await/issue-61076.rs delete mode 100644 src/test/ui/async-await/issue-61076.stderr delete mode 100644 src/test/ui/async-await/issue-61452.rs delete mode 100644 src/test/ui/async-await/issue-61452.stderr delete mode 100644 src/test/ui/async-await/issue-61793.rs delete mode 100644 src/test/ui/async-await/issue-61949-self-return-type.rs delete mode 100644 src/test/ui/async-await/issue-61949-self-return-type.stderr delete mode 100644 src/test/ui/async-await/issue-62658.rs delete mode 100644 src/test/ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs delete mode 100644 src/test/ui/async-await/issue-63832-await-short-temporary-lifetime.rs delete mode 100644 src/test/ui/async-await/issue-64130-1-sync.rs delete mode 100644 src/test/ui/async-await/issue-64130-1-sync.stderr delete mode 100644 src/test/ui/async-await/issue-64130-2-send.rs delete mode 100644 src/test/ui/async-await/issue-64130-2-send.stderr delete mode 100644 src/test/ui/async-await/issue-64130-3-other.rs delete mode 100644 src/test/ui/async-await/issue-64130-3-other.stderr delete mode 100644 src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr delete mode 100644 src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-64130-4-async-move.rs delete mode 100644 src/test/ui/async-await/issue-64130-non-send-future-diags.rs delete mode 100644 src/test/ui/async-await/issue-64130-non-send-future-diags.stderr delete mode 100644 src/test/ui/async-await/issue-64391.rs delete mode 100644 src/test/ui/async-await/issue-66312.rs delete mode 100644 src/test/ui/async-await/issue-66312.stderr delete mode 100644 src/test/ui/async-await/issue-66387-if-without-else.rs delete mode 100644 src/test/ui/async-await/issue-66387-if-without-else.stderr delete mode 100644 src/test/ui/async-await/issue-67252-unnamed-future.rs delete mode 100644 src/test/ui/async-await/issue-67252-unnamed-future.stderr delete mode 100644 src/test/ui/async-await/issue-67651.rs delete mode 100644 src/test/ui/async-await/issue-67651.stderr delete mode 100644 src/test/ui/async-await/issue-67765-async-diagnostic.rs delete mode 100644 src/test/ui/async-await/issue-67765-async-diagnostic.stderr delete mode 100644 src/test/ui/async-await/issue-68112.drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-68112.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-68112.rs delete mode 100644 src/test/ui/async-await/issue-68523-start.rs delete mode 100644 src/test/ui/async-await/issue-68523-start.stderr delete mode 100644 src/test/ui/async-await/issue-68523.rs delete mode 100644 src/test/ui/async-await/issue-68523.stderr delete mode 100644 src/test/ui/async-await/issue-69446-fnmut-capture.rs delete mode 100644 src/test/ui/async-await/issue-69446-fnmut-capture.stderr delete mode 100644 src/test/ui/async-await/issue-70594.rs delete mode 100644 src/test/ui/async-await/issue-70594.stderr delete mode 100644 src/test/ui/async-await/issue-70818.rs delete mode 100644 src/test/ui/async-await/issue-70818.stderr delete mode 100644 src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-70935-complex-spans.rs delete mode 100644 src/test/ui/async-await/issue-71137.rs delete mode 100644 src/test/ui/async-await/issue-71137.stderr delete mode 100644 src/test/ui/async-await/issue-72442.rs delete mode 100644 src/test/ui/async-await/issue-72442.stderr delete mode 100644 src/test/ui/async-await/issue-72470-llvm-dominate.rs delete mode 100644 src/test/ui/async-await/issue-72590-type-error-sized.rs delete mode 100644 src/test/ui/async-await/issue-72590-type-error-sized.stderr delete mode 100644 src/test/ui/async-await/issue-73050.rs delete mode 100644 src/test/ui/async-await/issue-73137.rs delete mode 100644 src/test/ui/async-await/issue-73541-1.rs delete mode 100644 src/test/ui/async-await/issue-73541-1.stderr delete mode 100644 src/test/ui/async-await/issue-73541-2.rs delete mode 100644 src/test/ui/async-await/issue-73541-2.stderr delete mode 100644 src/test/ui/async-await/issue-73541-3.rs delete mode 100644 src/test/ui/async-await/issue-73541-3.stderr delete mode 100644 src/test/ui/async-await/issue-73541.rs delete mode 100644 src/test/ui/async-await/issue-73541.stderr delete mode 100644 src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs delete mode 100644 src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr delete mode 100644 src/test/ui/async-await/issue-73741-type-err.rs delete mode 100644 src/test/ui/async-await/issue-73741-type-err.stderr delete mode 100644 src/test/ui/async-await/issue-74047.rs delete mode 100644 src/test/ui/async-await/issue-74047.stderr delete mode 100644 src/test/ui/async-await/issue-74072-lifetime-name-annotations.rs delete mode 100644 src/test/ui/async-await/issue-74072-lifetime-name-annotations.stderr delete mode 100644 src/test/ui/async-await/issue-74497-lifetime-in-opaque.rs delete mode 100644 src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr delete mode 100644 src/test/ui/async-await/issue-75785-confusing-named-region.rs delete mode 100644 src/test/ui/async-await/issue-75785-confusing-named-region.stderr delete mode 100644 src/test/ui/async-await/issue-76547.rs delete mode 100644 src/test/ui/async-await/issue-76547.stderr delete mode 100644 src/test/ui/async-await/issue-77993-2.rs delete mode 100644 src/test/ui/async-await/issue-77993-2.stderr delete mode 100644 src/test/ui/async-await/issue-84841.rs delete mode 100644 src/test/ui/async-await/issue-84841.stderr delete mode 100644 src/test/ui/async-await/issue-86507.rs delete mode 100644 src/test/ui/async-await/issue-86507.stderr delete mode 100644 src/test/ui/async-await/issue-93197.rs delete mode 100644 src/test/ui/async-await/issue-93648.rs delete mode 100644 src/test/ui/async-await/issue-98634.rs delete mode 100644 src/test/ui/async-await/issue-98634.stderr delete mode 100644 src/test/ui/async-await/issues/auxiliary/issue-60674.rs delete mode 100644 src/test/ui/async-await/issues/auxiliary/issue_67893.rs delete mode 100644 src/test/ui/async-await/issues/issue-51719.rs delete mode 100644 src/test/ui/async-await/issues/issue-51719.stderr delete mode 100644 src/test/ui/async-await/issues/issue-51751.rs delete mode 100644 src/test/ui/async-await/issues/issue-51751.stderr delete mode 100644 src/test/ui/async-await/issues/issue-53249.rs delete mode 100644 src/test/ui/async-await/issues/issue-54752-async-block.rs delete mode 100644 src/test/ui/async-await/issues/issue-54752-async-block.stderr delete mode 100644 src/test/ui/async-await/issues/issue-54974.rs delete mode 100644 src/test/ui/async-await/issues/issue-55324.rs delete mode 100644 src/test/ui/async-await/issues/issue-55809.rs delete mode 100644 src/test/ui/async-await/issues/issue-58885.rs delete mode 100644 src/test/ui/async-await/issues/issue-59001.rs delete mode 100644 src/test/ui/async-await/issues/issue-59972.rs delete mode 100644 src/test/ui/async-await/issues/issue-60518.rs delete mode 100644 src/test/ui/async-await/issues/issue-60655-latebound-regions.rs delete mode 100644 src/test/ui/async-await/issues/issue-60674.rs delete mode 100644 src/test/ui/async-await/issues/issue-60674.stdout delete mode 100644 src/test/ui/async-await/issues/issue-61187.rs delete mode 100644 src/test/ui/async-await/issues/issue-61187.stderr delete mode 100644 src/test/ui/async-await/issues/issue-61986.rs delete mode 100644 src/test/ui/async-await/issues/issue-62009-1.rs delete mode 100644 src/test/ui/async-await/issues/issue-62009-1.stderr delete mode 100644 src/test/ui/async-await/issues/issue-62009-2.rs delete mode 100644 src/test/ui/async-await/issues/issue-62009-2.stderr delete mode 100644 src/test/ui/async-await/issues/issue-62097.rs delete mode 100644 src/test/ui/async-await/issues/issue-62097.stderr delete mode 100644 src/test/ui/async-await/issues/issue-62517-1.rs delete mode 100644 src/test/ui/async-await/issues/issue-62517-2.rs delete mode 100644 src/test/ui/async-await/issues/issue-63388-1.rs delete mode 100644 src/test/ui/async-await/issues/issue-63388-1.stderr delete mode 100644 src/test/ui/async-await/issues/issue-63388-2.rs delete mode 100644 src/test/ui/async-await/issues/issue-63388-2.stderr delete mode 100644 src/test/ui/async-await/issues/issue-63388-3.rs delete mode 100644 src/test/ui/async-await/issues/issue-63388-4.rs delete mode 100644 src/test/ui/async-await/issues/issue-64391-2.rs delete mode 100644 src/test/ui/async-await/issues/issue-64433.rs delete mode 100644 src/test/ui/async-await/issues/issue-64477-2.rs delete mode 100644 src/test/ui/async-await/issues/issue-64477.rs delete mode 100644 src/test/ui/async-await/issues/issue-64964.rs delete mode 100644 src/test/ui/async-await/issues/issue-65159.rs delete mode 100644 src/test/ui/async-await/issues/issue-65159.stderr delete mode 100644 src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs delete mode 100644 src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs delete mode 100644 src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs delete mode 100644 src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs delete mode 100644 src/test/ui/async-await/issues/issue-66695-static-refs.rs delete mode 100644 src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs delete mode 100644 src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr delete mode 100644 src/test/ui/async-await/issues/issue-67611-static-mut-refs.rs delete mode 100644 src/test/ui/async-await/issues/issue-67893.rs delete mode 100644 src/test/ui/async-await/issues/issue-67893.stderr delete mode 100644 src/test/ui/async-await/issues/issue-69307-nested.rs delete mode 100644 src/test/ui/async-await/issues/issue-69307.rs delete mode 100644 src/test/ui/async-await/issues/issue-72312.rs delete mode 100644 src/test/ui/async-await/issues/issue-72312.stderr delete mode 100644 src/test/ui/async-await/issues/issue-78600.rs delete mode 100644 src/test/ui/async-await/issues/issue-78600.stderr delete mode 100644 src/test/ui/async-await/issues/issue-78654.full.stderr delete mode 100644 src/test/ui/async-await/issues/issue-78654.min.stderr delete mode 100644 src/test/ui/async-await/issues/issue-78654.rs delete mode 100644 src/test/ui/async-await/issues/issue-78938-async-block.rs delete mode 100644 src/test/ui/async-await/issues/issue-78938-async-block.stderr delete mode 100644 src/test/ui/async-await/issues/issue-95307.rs delete mode 100644 src/test/ui/async-await/issues/issue-95307.stderr delete mode 100644 src/test/ui/async-await/issues/non-async-enclosing-span.rs delete mode 100644 src/test/ui/async-await/issues/non-async-enclosing-span.stderr delete mode 100644 src/test/ui/async-await/large_moves.attribute.stderr delete mode 100644 src/test/ui/async-await/large_moves.option.stderr delete mode 100644 src/test/ui/async-await/large_moves.rs delete mode 100644 src/test/ui/async-await/move-part-await-return-rest-struct.rs delete mode 100644 src/test/ui/async-await/move-part-await-return-rest-tuple.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/elided.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/hrtb.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/named.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/partial-relation.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr delete mode 100644 src/test/ui/async-await/multiple-lifetimes/ret-ref.rs delete mode 100644 src/test/ui/async-await/multiple-lifetimes/ret-ref.stderr delete mode 100644 src/test/ui/async-await/multiple-lifetimes/variance.rs delete mode 100644 src/test/ui/async-await/mutually-recursive-async-impl-trait-type.rs delete mode 100644 src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr delete mode 100644 src/test/ui/async-await/nested-in-impl.rs delete mode 100644 src/test/ui/async-await/no-async-const.rs delete mode 100644 src/test/ui/async-await/no-async-const.stderr delete mode 100644 src/test/ui/async-await/no-const-async.rs delete mode 100644 src/test/ui/async-await/no-const-async.stderr delete mode 100644 src/test/ui/async-await/no-move-across-await-struct.rs delete mode 100644 src/test/ui/async-await/no-move-across-await-struct.stderr delete mode 100644 src/test/ui/async-await/no-move-across-await-tuple.rs delete mode 100644 src/test/ui/async-await/no-move-across-await-tuple.stderr delete mode 100644 src/test/ui/async-await/no-non-guaranteed-initialization.rs delete mode 100644 src/test/ui/async-await/no-non-guaranteed-initialization.stderr delete mode 100644 src/test/ui/async-await/no-params-non-move-async-closure.rs delete mode 100644 src/test/ui/async-await/no-params-non-move-async-closure.stderr delete mode 100644 src/test/ui/async-await/no-std.rs delete mode 100644 src/test/ui/async-await/no-unsafe-async.rs delete mode 100644 src/test/ui/async-await/no-unsafe-async.stderr delete mode 100644 src/test/ui/async-await/non-trivial-drop.rs delete mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr delete mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.rs delete mode 100644 src/test/ui/async-await/partial-initialization-across-await.rs delete mode 100644 src/test/ui/async-await/partial-initialization-across-await.stderr delete mode 100644 src/test/ui/async-await/pin-needed-to-poll-2.rs delete mode 100644 src/test/ui/async-await/pin-needed-to-poll-2.stderr delete mode 100644 src/test/ui/async-await/pin-needed-to-poll.rs delete mode 100644 src/test/ui/async-await/pin-needed-to-poll.stderr delete mode 100644 src/test/ui/async-await/proper-span-for-type-error.fixed delete mode 100644 src/test/ui/async-await/proper-span-for-type-error.rs delete mode 100644 src/test/ui/async-await/proper-span-for-type-error.stderr delete mode 100644 src/test/ui/async-await/recursive-async-impl-trait-type.rs delete mode 100644 src/test/ui/async-await/recursive-async-impl-trait-type.stderr delete mode 100644 src/test/ui/async-await/repeat_count_const_in_async_fn.rs delete mode 100644 src/test/ui/async-await/return-ty-raw-ptr-coercion.rs delete mode 100644 src/test/ui/async-await/return-ty-unsize-coercion.rs delete mode 100644 src/test/ui/async-await/suggest-missing-await-closure.fixed delete mode 100644 src/test/ui/async-await/suggest-missing-await-closure.rs delete mode 100644 src/test/ui/async-await/suggest-missing-await-closure.stderr delete mode 100644 src/test/ui/async-await/suggest-missing-await.rs delete mode 100644 src/test/ui/async-await/suggest-missing-await.stderr delete mode 100644 src/test/ui/async-await/suggest-switching-edition-on-await-cargo.rs delete mode 100644 src/test/ui/async-await/suggest-switching-edition-on-await-cargo.stderr delete mode 100644 src/test/ui/async-await/suggest-switching-edition-on-await.rs delete mode 100644 src/test/ui/async-await/suggest-switching-edition-on-await.stderr delete mode 100644 src/test/ui/async-await/track-caller/async-closure-gate.rs delete mode 100644 src/test/ui/async-await/track-caller/async-closure-gate.stderr delete mode 100644 src/test/ui/async-await/track-caller/issue-105134.rs delete mode 100644 src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr delete mode 100644 src/test/ui/async-await/track-caller/panic-track-caller.rs delete mode 100644 src/test/ui/async-await/try-on-option-in-async.rs delete mode 100644 src/test/ui/async-await/try-on-option-in-async.stderr delete mode 100644 src/test/ui/async-await/type-parameter-send.rs delete mode 100644 src/test/ui/async-await/unnecessary-await.rs delete mode 100644 src/test/ui/async-await/unnecessary-await.stderr delete mode 100644 src/test/ui/async-await/unreachable-lint-1.rs delete mode 100644 src/test/ui/async-await/unreachable-lint-1.stderr delete mode 100644 src/test/ui/async-await/unreachable-lint.rs delete mode 100644 src/test/ui/async-await/unresolved_type_param.rs delete mode 100644 src/test/ui/async-await/unresolved_type_param.stderr delete mode 100644 src/test/ui/async-await/unused-lifetime.rs delete mode 100644 src/test/ui/async-await/unused-lifetime.stderr (limited to 'src/test/ui/async-await') diff --git a/src/test/ui/async-await/argument-patterns.rs b/src/test/ui/async-await/argument-patterns.rs deleted file mode 100644 index b9fc1a88c..000000000 --- a/src/test/ui/async-await/argument-patterns.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -// check-pass - -#![deny(unused_mut)] - -type A = Vec; - -async fn a(n: u32, mut vec: A) { - vec.push(n); -} - -async fn b(n: u32, ref mut vec: A) { - vec.push(n); -} - -async fn c(ref vec: A) { - vec.contains(&0); -} - -async fn d((a, mut b): (A, A)) { - b.push(1); -} - -async fn f((ref mut a, ref b): (A, A)) {} - -async fn g(((ref a, ref mut b), (ref mut c, ref d)): ((A, A), (A, A))) {} - -fn main() {} diff --git a/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs b/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs deleted file mode 100644 index 8e08b82b9..000000000 --- a/src/test/ui/async-await/async-assoc-fn-anon-lifetimes.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass -// Check that the anonymous lifetimes used here aren't considered to shadow one -// another. Note that `async fn` is different to `fn` here because the lifetimes -// are numbered by HIR lowering, rather than lifetime resolution. - -// edition:2018 - -struct A<'a, 'b>(&'a &'b i32); -struct B<'a>(&'a i32); - -impl A<'_, '_> { - async fn assoc(x: &u32, y: B<'_>) { - async fn nested(x: &u32, y: A<'_, '_>) {} - } - - async fn assoc2(x: &u32, y: A<'_, '_>) { - impl A<'_, '_> { - async fn nested_assoc(x: &u32, y: B<'_>) {} - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr deleted file mode 100644 index 3be7f370d..000000000 --- a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr +++ /dev/null @@ -1,110 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:48:13 - | -LL | is_send(foo(Some(true))); - | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:11:14 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await - | ^^^^^^ await occurs here, with `r` maybe used later -LL | }; - | - `r` is later dropped here -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:50:13 - | -LL | async fn foo2(x: Option) { - | - within this `impl Future` -... -LL | is_send(foo2(Some(true))); - | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely - | | - | required by a bound introduced by this call - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: required because it's used within this `async fn` body - --> $DIR/async-await-let-else.rs:27:29 - | -LL | async fn bar2(_: T) -> ! { - | _____________________________^ -LL | | panic!() -LL | | } - | |_^ - = note: required because it captures the following types: `ResumeTy`, `Option`, `impl Future`, `()` -note: required because it's used within this `async fn` body - --> $DIR/async-await-let-else.rs:21:32 - | -LL | async fn foo2(x: Option) { - | ________________________________^ -LL | | let Some(_) = x else { -LL | | bar2(Rc::new(())).await -LL | | }; -LL | | } - | |_^ -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:52:13 - | -LL | is_send(foo3(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:33:28 - | -LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | - | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:54:13 - | -LL | is_send(foo4(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:41:14 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await; - | ^^^^^^ await occurs here, with `r` maybe used later -... -LL | }; - | - `r` is later dropped here -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr deleted file mode 100644 index 7f93563e2..000000000 --- a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr +++ /dev/null @@ -1,94 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:48:13 - | -LL | is_send(foo(Some(true))); - | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:11:14 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await - | ^^^^^^ await occurs here, with `r` maybe used later -LL | }; - | - `r` is later dropped here -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:50:13 - | -LL | is_send(foo2(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:23:26 - | -LL | bar2(Rc::new(())).await - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | - | has type `Rc<()>` which is not `Send` -LL | }; - | - `Rc::new(())` is later dropped here -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:52:13 - | -LL | is_send(foo3(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:33:28 - | -LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | - | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:54:13 - | -LL | is_send(foo4(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-await-let-else.rs:41:14 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await; - | ^^^^^^ await occurs here, with `r` maybe used later -... -LL | }; - | - `r` is later dropped here -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:19:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/async-await/async-await-let-else.rs b/src/test/ui/async-await/async-await-let-else.rs deleted file mode 100644 index 3fb2142b9..000000000 --- a/src/test/ui/async-await/async-await-let-else.rs +++ /dev/null @@ -1,56 +0,0 @@ -// edition:2021 -// revisions: drop-tracking no-drop-tracking -// [drop-tracking] compile-flags: -Zdrop-tracking=yes -// [no-drop-tracking] compile-flags: -Zdrop-tracking=no - -use std::rc::Rc; - -async fn foo(x: Option) { - let Some(_) = x else { - let r = Rc::new(()); - bar().await - }; -} - -async fn bar() -> ! { - panic!() -} - -fn is_send(_: T) {} - -async fn foo2(x: Option) { - let Some(_) = x else { - bar2(Rc::new(())).await - }; -} - -async fn bar2(_: T) -> ! { - panic!() -} - -async fn foo3(x: Option) { - let Some(_) = x else { - (Rc::new(()), bar().await); - return; - }; -} - -async fn foo4(x: Option) { - let Some(_) = x else { - let r = Rc::new(()); - bar().await; - println!("{:?}", r); - return; - }; -} - -fn main() { - is_send(foo(Some(true))); - //~^ ERROR cannot be sent between threads safely - is_send(foo2(Some(true))); - //~^ ERROR cannot be sent between threads safely - is_send(foo3(Some(true))); - //~^ ERROR cannot be sent between threads safely - is_send(foo4(Some(true))); - //~^ ERROR cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/async-await.rs b/src/test/ui/async-await/async-await.rs deleted file mode 100644 index 9cabf16f8..000000000 --- a/src/test/ui/async-await/async-await.rs +++ /dev/null @@ -1,219 +0,0 @@ -// run-pass - -// revisions: default nomiropt thirunsafeck -//[nomiropt]compile-flags: -Z mir-opt-level=0 -//[thirunsafeck]compile-flags: -Zthir-unsafeck - -#![allow(unused)] - -// edition: 2018 -// aux-build:arc_wake.rs - -extern crate arc_wake; - -use std::pin::Pin; -use std::future::Future; -use std::sync::{ - Arc, - atomic::{self, AtomicUsize}, -}; -use std::task::{Context, Poll}; -use arc_wake::ArcWake; - -struct Counter { - wakes: AtomicUsize, -} - -impl ArcWake for Counter { - fn wake(self: Arc) { - Self::wake_by_ref(&self) - } - fn wake_by_ref(arc_self: &Arc) { - arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst); - } -} - -struct WakeOnceThenComplete(bool); - -fn wake_and_yield_once() -> WakeOnceThenComplete { WakeOnceThenComplete(false) } - -impl Future for WakeOnceThenComplete { - type Output = (); - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { - if self.0 { - Poll::Ready(()) - } else { - cx.waker().wake_by_ref(); - self.0 = true; - Poll::Pending - } - } -} - -fn async_block(x: u8) -> impl Future { - async move { - wake_and_yield_once().await; - x - } -} - -fn async_block_with_borrow_named_lifetime<'a>(x: &'a u8) -> impl Future + 'a { - async move { - wake_and_yield_once().await; - *x - } -} - -fn async_nonmove_block(x: u8) -> impl Future { - async move { - let future = async { - wake_and_yield_once().await; - x - }; - future.await - } -} - -// see async-closure.rs for async_closure + async_closure_in_unsafe_block - -async fn async_fn(x: u8) -> u8 { - wake_and_yield_once().await; - x -} - -async fn generic_async_fn(x: T) -> T { - wake_and_yield_once().await; - x -} - -async fn async_fn_with_borrow(x: &u8) -> u8 { - wake_and_yield_once().await; - *x -} - -async fn async_fn_with_borrow_named_lifetime<'a>(x: &'a u8) -> u8 { - wake_and_yield_once().await; - *x -} - -fn async_fn_with_impl_future_named_lifetime<'a>(x: &'a u8) -> impl Future + 'a { - async move { - wake_and_yield_once().await; - *x - } -} - -async fn async_fn_multiple_args(x: &u8, _y: &u8) -> u8 { - wake_and_yield_once().await; - *x -} - -async fn async_fn_multiple_args_named_lifetime<'a>(x: &'a u8, _y: &'a u8) -> u8 { - wake_and_yield_once().await; - *x -} - -fn async_fn_with_internal_borrow(y: u8) -> impl Future { - async move { - async_fn_with_borrow_named_lifetime(&y).await - } -} - -async unsafe fn unsafe_async_fn(x: u8) -> u8 { - wake_and_yield_once().await; - x -} - -unsafe fn unsafe_fn(x: u8) -> u8 { - x -} - -fn async_block_in_unsafe_block(x: u8) -> impl Future { - unsafe { - async move { - unsafe_fn(unsafe_async_fn(x).await) - } - } -} - -struct Foo; - -trait Bar { - fn foo() {} -} - -impl Foo { - async fn async_assoc_item(x: u8) -> u8 { - unsafe { - unsafe_async_fn(x).await - } - } - - async unsafe fn async_unsafe_assoc_item(x: u8) -> u8 { - unsafe_async_fn(x).await - } -} - -fn test_future_yields_once_then_returns(f: F) -where - F: FnOnce(u8) -> Fut, - Fut: Future, -{ - let mut fut = Box::pin(f(9)); - let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) }); - let waker = ArcWake::into_waker(counter.clone()); - let mut cx = Context::from_waker(&waker); - assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst)); - assert_eq!(Poll::Pending, fut.as_mut().poll(&mut cx)); - assert_eq!(1, counter.wakes.load(atomic::Ordering::SeqCst)); - assert_eq!(Poll::Ready(9), fut.as_mut().poll(&mut cx)); -} - -fn main() { - macro_rules! test { - ($($fn_name:expr,)*) => { $( - test_future_yields_once_then_returns($fn_name); - )* } - } - - macro_rules! test_with_borrow { - ($($fn_name:expr,)*) => { $( - test_future_yields_once_then_returns(|x| { - async move { - $fn_name(&x).await - } - }); - )* } - } - - test! { - async_block, - async_nonmove_block, - async_fn, - generic_async_fn, - async_fn_with_internal_borrow, - async_block_in_unsafe_block, - Foo::async_assoc_item, - |x| { - async move { - unsafe { unsafe_async_fn(x).await } - } - }, - |x| { - async move { - unsafe { Foo::async_unsafe_assoc_item(x).await } - } - }, - } - test_with_borrow! { - async_block_with_borrow_named_lifetime, - async_fn_with_borrow, - async_fn_with_borrow_named_lifetime, - async_fn_with_impl_future_named_lifetime, - |x| { - async move { - async_fn_multiple_args_named_lifetime(x, x).await - } - }, - } -} diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs deleted file mode 100644 index bc9d12793..000000000 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Test that `async { .. }` blocks: -// 1. do not allow `break` expressions. -// 2. get targeted by `return` and not the parent function. -// 3. get targeted by `?` and not the parent function. -// -// edition:2018 - -fn main() {} - -use core::future::Future; - -fn return_targets_async_block_not_fn() -> u8 { - //~^ ERROR mismatched types - let block = async { - return 0u8; - }; - let _: &dyn Future = █ - //~^ ERROR to be a future that resolves to `()`, but it resolves to `u8` -} - -async fn return_targets_async_block_not_async_fn() -> u8 { - //~^ ERROR mismatched types [E0308] - let block = async { - return 0u8; - }; - let _: &dyn Future = █ - //~^ ERROR to be a future that resolves to `()`, but it resolves to `u8` -} - -fn no_break_in_async_block() { - async { - break 0u8; //~ ERROR `break` inside of an `async` block - }; -} - -fn no_break_in_async_block_even_with_outer_loop() { - loop { - async { - break 0u8; //~ ERROR `break` inside of an `async` block - }; - } -} - -struct MyErr; -fn err() -> Result { - Err(MyErr) -} - -fn rethrow_targets_async_block_not_fn() -> Result { - //~^ ERROR mismatched types - let block = async { - err()?; - Ok(()) - }; - let _: &dyn Future> = █ -} - -fn rethrow_targets_async_block_not_async_fn() -> Result { - //~^ ERROR mismatched types - let block = async { - err()?; - Ok(()) - }; - let _: &dyn Future> = █ -} diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr deleted file mode 100644 index c4487eb84..000000000 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ /dev/null @@ -1,81 +0,0 @@ -error[E0267]: `break` inside of an `async` block - --> $DIR/async-block-control-flow-static-semantics.rs:32:9 - | -LL | / async { -LL | | break 0u8; - | | ^^^^^^^^^ cannot `break` inside of an `async` block -LL | | }; - | |_____- enclosing `async` block - -error[E0267]: `break` inside of an `async` block - --> $DIR/async-block-control-flow-static-semantics.rs:39:13 - | -LL | / async { -LL | | break 0u8; - | | ^^^^^^^^^ cannot `break` inside of an `async` block -LL | | }; - | |_________- enclosing `async` block - -error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:21:58 - | -LL | async fn return_targets_async_block_not_async_fn() -> u8 { - | __________________________________________________________^ -LL | | -LL | | let block = async { -LL | | return 0u8; -... | -LL | | -LL | | } - | |_^ expected `u8`, found `()` - -error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to be a future that resolves to `()`, but it resolves to `u8` - --> $DIR/async-block-control-flow-static-semantics.rs:26:39 - | -LL | let _: &dyn Future = █ - | ^^^^^^ expected `()`, found `u8` - | - = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to the object type `dyn Future` - -error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:12:43 - | -LL | fn return_targets_async_block_not_fn() -> u8 { - | --------------------------------- ^^ expected `u8`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - -error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to be a future that resolves to `()`, but it resolves to `u8` - --> $DIR/async-block-control-flow-static-semantics.rs:17:39 - | -LL | let _: &dyn Future = █ - | ^^^^^^ expected `()`, found `u8` - | - = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to the object type `dyn Future` - -error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:49:44 - | -LL | fn rethrow_targets_async_block_not_fn() -> Result { - | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - | - = note: expected enum `Result` - found unit type `()` - -error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:58:50 - | -LL | fn rethrow_targets_async_block_not_async_fn() -> Result { - | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - | - = note: expected enum `Result` - found unit type `()` - -error: aborting due to 8 previous errors - -Some errors have detailed explanations: E0267, E0271, E0308. -For more information about an error, try `rustc --explain E0267`. diff --git a/src/test/ui/async-await/async-borrowck-escaping-block-error.fixed b/src/test/ui/async-await/async-borrowck-escaping-block-error.fixed deleted file mode 100644 index 605cfdfe7..000000000 --- a/src/test/ui/async-await/async-borrowck-escaping-block-error.fixed +++ /dev/null @@ -1,18 +0,0 @@ -// edition:2018 -// run-rustfix - -fn test_boxed() -> Box> { - let x = 0u32; - Box::new(async move { x } ) - //~^ ERROR E0373 -} - -fn test_ref(x: &u32) -> impl std::future::Future + '_ { - async move { *x } - //~^ ERROR E0373 -} - -fn main() { - let _ = test_boxed(); - let _ = test_ref(&0u32); -} diff --git a/src/test/ui/async-await/async-borrowck-escaping-block-error.rs b/src/test/ui/async-await/async-borrowck-escaping-block-error.rs deleted file mode 100644 index ec752c15f..000000000 --- a/src/test/ui/async-await/async-borrowck-escaping-block-error.rs +++ /dev/null @@ -1,18 +0,0 @@ -// edition:2018 -// run-rustfix - -fn test_boxed() -> Box> { - let x = 0u32; - Box::new(async { x } ) - //~^ ERROR E0373 -} - -fn test_ref(x: &u32) -> impl std::future::Future + '_ { - async { *x } - //~^ ERROR E0373 -} - -fn main() { - let _ = test_boxed(); - let _ = test_ref(&0u32); -} diff --git a/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr b/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr deleted file mode 100644 index 190c59e32..000000000 --- a/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-block-error.rs:6:14 - | -LL | Box::new(async { x } ) - | ^^^^^^^^-^^ - | | | - | | `x` is borrowed here - | may outlive borrowed value `x` - | -note: async block is returned here - --> $DIR/async-borrowck-escaping-block-error.rs:6:5 - | -LL | Box::new(async { x } ) - | ^^^^^^^^^^^^^^^^^^^^^^ -help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | Box::new(async move { x } ) - | ++++ - -error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-block-error.rs:11:5 - | -LL | async { *x } - | ^^^^^^^^--^^ - | | | - | | `x` is borrowed here - | may outlive borrowed value `x` - | -note: async block is returned here - --> $DIR/async-borrowck-escaping-block-error.rs:11:5 - | -LL | async { *x } - | ^^^^^^^^^^^^ -help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | async move { *x } - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0373`. diff --git a/src/test/ui/async-await/async-borrowck-escaping-closure-error.rs b/src/test/ui/async-await/async-borrowck-escaping-closure-error.rs deleted file mode 100644 index e667b72ae..000000000 --- a/src/test/ui/async-await/async-borrowck-escaping-closure-error.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 -#![feature(async_closure)] -fn foo() -> Box> { - let x = 0u32; - Box::new((async || x)()) - //~^ ERROR E0373 -} - -fn main() { -} diff --git a/src/test/ui/async-await/async-borrowck-escaping-closure-error.stderr b/src/test/ui/async-await/async-borrowck-escaping-closure-error.stderr deleted file mode 100644 index 10691aad0..000000000 --- a/src/test/ui/async-await/async-borrowck-escaping-closure-error.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-closure-error.rs:5:15 - | -LL | Box::new((async || x)()) - | ^^^^^^^^ - `x` is borrowed here - | | - | may outlive borrowed value `x` - | -note: closure is returned here - --> $DIR/async-borrowck-escaping-closure-error.rs:5:5 - | -LL | Box::new((async || x)()) - | ^^^^^^^^^^^^^^^^^^^^^^^^ -help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | Box::new((async move || x)()) - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0373`. diff --git a/src/test/ui/async-await/async-closure-matches-expr.rs b/src/test/ui/async-await/async-closure-matches-expr.rs deleted file mode 100644 index d82fbcdc5..000000000 --- a/src/test/ui/async-await/async-closure-matches-expr.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-pass -// edition:2018 - -#![feature(async_closure)] - -macro_rules! match_expr { - ($x:expr) => {} -} - -fn main() { - match_expr!(async || {}); -} diff --git a/src/test/ui/async-await/async-closure.rs b/src/test/ui/async-await/async-closure.rs deleted file mode 100644 index 12d66b19e..000000000 --- a/src/test/ui/async-await/async-closure.rs +++ /dev/null @@ -1,100 +0,0 @@ -// run-pass - -// revisions: default nomiropt -//[nomiropt]compile-flags: -Z mir-opt-level=0 - -// edition:2018 -// aux-build:arc_wake.rs - -#![feature(async_closure)] - -extern crate arc_wake; - -use std::pin::Pin; -use std::future::Future; -use std::sync::{ - Arc, - atomic::{self, AtomicUsize}, -}; -use std::task::{Context, Poll}; -use arc_wake::ArcWake; - -struct Counter { - wakes: AtomicUsize, -} - -impl ArcWake for Counter { - fn wake(self: Arc) { - Self::wake_by_ref(&self) - } - fn wake_by_ref(arc_self: &Arc) { - arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst); - } -} - -struct WakeOnceThenComplete(bool); - -fn wake_and_yield_once() -> WakeOnceThenComplete { WakeOnceThenComplete(false) } - -impl Future for WakeOnceThenComplete { - type Output = (); - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { - if self.0 { - Poll::Ready(()) - } else { - cx.waker().wake_by_ref(); - self.0 = true; - Poll::Pending - } - } -} - -fn async_closure(x: u8) -> impl Future { - (async move |x: u8| -> u8 { - wake_and_yield_once().await; - x - })(x) -} - -fn async_closure_in_unsafe_block(x: u8) -> impl Future { - (unsafe { - async move |x: u8| unsafe_fn(unsafe_async_fn(x).await) - })(x) -} - -async unsafe fn unsafe_async_fn(x: u8) -> u8 { - wake_and_yield_once().await; - x -} - -unsafe fn unsafe_fn(x: u8) -> u8 { - x -} - -fn test_future_yields_once_then_returns(f: F) -where - F: FnOnce(u8) -> Fut, - Fut: Future, -{ - let mut fut = Box::pin(f(9)); - let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) }); - let waker = ArcWake::into_waker(counter.clone()); - let mut cx = Context::from_waker(&waker); - assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst)); - assert_eq!(Poll::Pending, fut.as_mut().poll(&mut cx)); - assert_eq!(1, counter.wakes.load(atomic::Ordering::SeqCst)); - assert_eq!(Poll::Ready(9), fut.as_mut().poll(&mut cx)); -} - -fn main() { - macro_rules! test { - ($($fn_name:expr,)*) => { $( - test_future_yields_once_then_returns($fn_name); - )* } - } - - test! { - async_closure, - async_closure_in_unsafe_block, - } -} diff --git a/src/test/ui/async-await/async-error-span.rs b/src/test/ui/async-await/async-error-span.rs deleted file mode 100644 index 86d459bf0..000000000 --- a/src/test/ui/async-await/async-error-span.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 - -// Regression test for issue #62382. - -use std::future::Future; - -fn get_future() -> impl Future { -//~^ ERROR `()` is not a future - panic!() -} - -async fn foo() { - let a; //~ ERROR type inside `async fn` body must be known in this context - get_future().await; -} - -fn main() {} diff --git a/src/test/ui/async-await/async-error-span.stderr b/src/test/ui/async-await/async-error-span.stderr deleted file mode 100644 index 7d4447b6d..000000000 --- a/src/test/ui/async-await/async-error-span.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/async-error-span.rs:7:20 - | -LL | fn get_future() -> impl Future { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/async-error-span.rs:13:9 - | -LL | let a; - | ^ cannot infer type - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/async-error-span.rs:14:17 - | -LL | get_future().await; - | ^^^^^^ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0698. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs b/src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs deleted file mode 100644 index 1c369fd74..000000000 --- a/src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Check that `async fn` inside of an impl with `'_` -// in the header compiles correctly. -// -// Regression test for #63500. -// -// check-pass -// edition:2018 - -struct Foo<'a>(&'a u8); - -impl Foo<'_> { - async fn bar() {} -} - -fn main() { } diff --git a/src/test/ui/async-await/async-fn-nonsend.rs b/src/test/ui/async-await/async-fn-nonsend.rs deleted file mode 100644 index d7f8d7ac5..000000000 --- a/src/test/ui/async-await/async-fn-nonsend.rs +++ /dev/null @@ -1,74 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib -Zdrop-tracking - -use std::{cell::RefCell, fmt::Debug, rc::Rc}; - -fn non_sync() -> impl Debug { - RefCell::new(()) -} - -fn non_send() -> impl Debug { - Rc::new(()) -} - -fn take_ref(_: &T) {} - -async fn fut() {} - -async fn fut_arg(_: T) {} - -async fn local_dropped_before_await() { - // this is okay now because of the drop - let x = non_send(); - drop(x); - fut().await; -} - -async fn non_send_temporary_in_match() { - // We could theoretically make this work as well (produce a `Send` future) - // for scrutinees / temporaries that can or will - // be dropped prior to the match body - // (e.g. `Copy` types). - match Some(non_send()) { - Some(_) => fut().await, - None => {} - } -} - -fn get_formatter() -> std::fmt::Formatter<'static> { - panic!() -} - -async fn non_sync_with_method_call() { - let f: &mut std::fmt::Formatter = &mut get_formatter(); - // It would by nice for this to work. - if non_sync().fmt(f).unwrap() == () { - fut().await; - } -} - -async fn non_sync_with_method_call_panic() { - let f: &mut std::fmt::Formatter = panic!(); - if non_sync().fmt(f).unwrap() == () { - fut().await; - } -} - -async fn non_sync_with_method_call_infinite_loop() { - let f: &mut std::fmt::Formatter = loop {}; - if non_sync().fmt(f).unwrap() == () { - fut().await; - } -} - -fn assert_send(_: impl Send) {} - -pub fn pass_assert() { - assert_send(local_dropped_before_await()); - assert_send(non_send_temporary_in_match()); - //~^ ERROR future cannot be sent between threads safely - assert_send(non_sync_with_method_call()); - //~^ ERROR future cannot be sent between threads safely - assert_send(non_sync_with_method_call_panic()); - assert_send(non_sync_with_method_call_infinite_loop()); -} diff --git a/src/test/ui/async-await/async-fn-nonsend.stderr b/src/test/ui/async-await/async-fn-nonsend.stderr deleted file mode 100644 index a7b872fe4..000000000 --- a/src/test/ui/async-await/async-fn-nonsend.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/async-fn-nonsend.rs:68:17 - | -LL | assert_send(non_send_temporary_in_match()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` -note: future is not `Send` as this value is used across an await - --> $DIR/async-fn-nonsend.rs:33:25 - | -LL | match Some(non_send()) { - | ---------------- has type `Option` which is not `Send` -LL | Some(_) => fut().await, - | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later -... -LL | } - | - `Some(non_send())` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/async-fn-nonsend.rs:64:24 - | -LL | fn assert_send(_: impl Send) {} - | ^^^^ required by this bound in `assert_send` - -error: future cannot be sent between threads safely - --> $DIR/async-fn-nonsend.rs:70:17 - | -LL | assert_send(non_sync_with_method_call()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` -note: future is not `Send` as this value is used across an await - --> $DIR/async-fn-nonsend.rs:46:14 - | -LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); - | --------------- has type `Formatter<'_>` which is not `Send` -... -LL | fut().await; - | ^^^^^^ await occurs here, with `get_formatter()` maybe used later -LL | } -LL | } - | - `get_formatter()` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/async-fn-nonsend.rs:64:24 - | -LL | fn assert_send(_: impl Send) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/async-await/async-fn-path-elision.rs b/src/test/ui/async-await/async-fn-path-elision.rs deleted file mode 100644 index 3f1f51c20..000000000 --- a/src/test/ui/async-await/async-fn-path-elision.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 - -struct HasLifetime<'a>(&'a bool); - -async fn error(lt: HasLifetime) { //~ ERROR implicit elided lifetime not allowed here - if *lt.0 {} -} - -fn no_error(lt: HasLifetime) { - if *lt.0 {} -} - -fn main() {} diff --git a/src/test/ui/async-await/async-fn-path-elision.stderr b/src/test/ui/async-await/async-fn-path-elision.stderr deleted file mode 100644 index 5e0c8c299..000000000 --- a/src/test/ui/async-await/async-fn-path-elision.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0726]: implicit elided lifetime not allowed here - --> $DIR/async-fn-path-elision.rs:5:20 - | -LL | async fn error(lt: HasLifetime) { - | ^^^^^^^^^^^ expected lifetime parameter - | - = note: assuming a `'static` lifetime... -help: indicate the anonymous lifetime - | -LL | async fn error(lt: HasLifetime<'_>) { - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0726`. diff --git a/src/test/ui/async-await/async-fn-send-uses-nonsend.rs b/src/test/ui/async-await/async-fn-send-uses-nonsend.rs deleted file mode 100644 index 35d9cb155..000000000 --- a/src/test/ui/async-await/async-fn-send-uses-nonsend.rs +++ /dev/null @@ -1,57 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 -// compile-flags: --crate-type lib - -use std::{ - cell::RefCell, - fmt::Debug, - rc::Rc, -}; - -fn non_sync() -> impl Debug { RefCell::new(()) } - -fn non_send() -> impl Debug { Rc::new(()) } - -fn take_ref(_: &T) {} - -async fn fut() {} - -async fn fut_arg(_: T) {} - -async fn still_send() { - fut().await; - println!("{:?} {:?}", non_send(), non_sync()); - fut().await; - drop(non_send()); - drop(non_sync()); - fut().await; - fut_arg(non_sync()).await; - - // Note: all temporaries in `if let` and `match` scrutinee - // are dropped at the *end* of the blocks, so using `non_send()` - // in either of those positions with an await in the middle will - // cause a `!Send` future. It might be nice in the future to allow - // this for `Copy` types, since they can be "dropped" early without - // affecting the end user. - if let Some(_) = Some(non_sync()) { - fut().await; - } - match Some(non_sync()) { - Some(_) => fut().await, - None => fut().await, - } - - let _ = non_send(); - fut().await; - - { - let _x = non_send(); - } - fut().await; -} - -fn assert_send(_: impl Send) {} - -pub fn pass_assert() { - assert_send(still_send()); -} diff --git a/src/test/ui/async-await/async-fn-size-moved-locals.rs b/src/test/ui/async-await/async-fn-size-moved-locals.rs deleted file mode 100644 index 79b7239f3..000000000 --- a/src/test/ui/async-await/async-fn-size-moved-locals.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Test that we don't duplicate storage for futures moved around in .await, and -// for futures moved into other futures. -// -// The exact sizes can change by a few bytes (we'd like to know when they do). -// What we don't want to see is the wrong multiple of 1024 (the size of BigFut) -// being reflected in the size. -// -// See issue #59123 for a full explanation. - -// needs-unwind Size of Futures change on panic=abort -// run-pass - -// edition:2018 - -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; - -const BIG_FUT_SIZE: usize = 1024; -struct BigFut(#[allow(unused_tuple_struct_fields)] [u8; BIG_FUT_SIZE]); - -impl BigFut { - fn new() -> Self { - BigFut([0; BIG_FUT_SIZE]) - } -} - -impl Drop for BigFut { - fn drop(&mut self) {} -} - -impl Future for BigFut { - type Output = (); - - fn poll(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll { - Poll::Ready(()) - } -} - -#[allow(dead_code)] -struct Joiner { - a: Option, - b: Option, - c: Option, -} - -impl Future for Joiner { - type Output = (); - - fn poll(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll { - Poll::Ready(()) - } -} - -fn noop() {} - -async fn single() { - let x = BigFut::new(); - x.await; -} - -async fn single_with_noop() { - let x = BigFut::new(); - noop(); - x.await; -} - -async fn joined() { - let a = BigFut::new(); - let b = BigFut::new(); - let c = BigFut::new(); - - let joiner = Joiner { - a: Some(a), - b: Some(b), - c: Some(c), - }; - joiner.await -} - -async fn joined_with_noop() { - let a = BigFut::new(); - let b = BigFut::new(); - let c = BigFut::new(); - - let joiner = Joiner { - a: Some(a), - b: Some(b), - c: Some(c), - }; - noop(); - joiner.await -} - -async fn mixed_sizes() { - let a = BigFut::new(); - let b = BigFut::new(); - let c = BigFut::new(); - let d = BigFut::new(); - let e = BigFut::new(); - let joiner = Joiner { - a: Some(a), - b: Some(b), - c: Some(c), - }; - - d.await; - e.await; - joiner.await; -} - -fn main() { - assert_eq!(1025, std::mem::size_of_val(&single())); - assert_eq!(1026, std::mem::size_of_val(&single_with_noop())); - assert_eq!(3076, std::mem::size_of_val(&joined())); - assert_eq!(3076, std::mem::size_of_val(&joined_with_noop())); - assert_eq!(6157, std::mem::size_of_val(&mixed_sizes())); -} diff --git a/src/test/ui/async-await/async-fn-size-uninit-locals.rs b/src/test/ui/async-await/async-fn-size-uninit-locals.rs deleted file mode 100644 index 546172693..000000000 --- a/src/test/ui/async-await/async-fn-size-uninit-locals.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Test that we don't store uninitialized locals in futures from `async fn`. -// -// The exact sizes can change by a few bytes (we'd like to know when they do). -// What we don't want to see is the wrong multiple of 1024 (the size of `Big`) -// being reflected in the size. - -// ignore-emscripten (sizes don't match) -// needs-unwind Size of Futures change on panic=abort -// run-pass - -// edition:2018 - -#![allow(unused_variables, unused_assignments)] - -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; - -const BIG_FUT_SIZE: usize = 1024; -struct Big(#[allow(unused_tuple_struct_fields)] [u8; BIG_FUT_SIZE]); - -impl Big { - fn new() -> Self { - Big([0; BIG_FUT_SIZE]) - } -} - -impl Drop for Big { - fn drop(&mut self) {} -} - -#[allow(dead_code)] -struct Joiner { - a: Option, - b: Option, - c: Option, -} - -impl Future for Joiner { - type Output = (); - - fn poll(self: Pin<&mut Self>, _ctx: &mut Context<'_>) -> Poll { - Poll::Ready(()) - } -} - -fn noop() {} -async fn fut() {} - -async fn single() { - let x; - fut().await; - x = Big::new(); -} - -async fn single_with_noop() { - let x; - fut().await; - noop(); - x = Big::new(); - noop(); -} - -async fn joined() { - let joiner; - let a = Big::new(); - let b = Big::new(); - let c = Big::new(); - - fut().await; - joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) }; -} - -async fn joined_with_noop() { - let joiner; - let a = Big::new(); - let b = Big::new(); - let c = Big::new(); - - fut().await; - noop(); - joiner = Joiner { a: Some(a), b: Some(b), c: Some(c) }; - noop(); -} - -async fn join_retval() -> Joiner { - let a = Big::new(); - let b = Big::new(); - let c = Big::new(); - - fut().await; - noop(); - Joiner { a: Some(a), b: Some(b), c: Some(c) } -} - -fn main() { - assert_eq!(2, std::mem::size_of_val(&single())); - assert_eq!(3, std::mem::size_of_val(&single_with_noop())); - assert_eq!(3074, std::mem::size_of_val(&joined())); - assert_eq!(3078, std::mem::size_of_val(&joined_with_noop())); - assert_eq!(3074, std::mem::size_of_val(&join_retval())); -} diff --git a/src/test/ui/async-await/async-fn-size.rs b/src/test/ui/async-await/async-fn-size.rs deleted file mode 100644 index 0c1f36364..000000000 --- a/src/test/ui/async-await/async-fn-size.rs +++ /dev/null @@ -1,105 +0,0 @@ -// run-pass -// aux-build:arc_wake.rs -// edition:2018 - -extern crate arc_wake; - -use std::pin::Pin; -use std::future::Future; -use std::sync::{ - Arc, - atomic::{self, AtomicUsize}, -}; -use std::task::{Context, Poll}; -use arc_wake::ArcWake; - -struct Counter { - wakes: AtomicUsize, -} - -impl ArcWake for Counter { - fn wake(self: Arc) { - Self::wake_by_ref(&self) - } - fn wake_by_ref(arc_self: &Arc) { - arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst); - } -} - -struct WakeOnceThenComplete(bool, u8); - -impl Future for WakeOnceThenComplete { - type Output = u8; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - if self.0 { - Poll::Ready(self.1) - } else { - cx.waker().wake_by_ref(); - self.0 = true; - Poll::Pending - } - } -} - -fn wait(fut: impl Future) -> u8 { - let mut fut = Box::pin(fut); - let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) }); - let waker = ArcWake::into_waker(counter.clone()); - let mut cx = Context::from_waker(&waker); - loop { - match fut.as_mut().poll(&mut cx) { - Poll::Ready(out) => return out, - Poll::Pending => (), - } - } -} - -fn base() -> WakeOnceThenComplete { WakeOnceThenComplete(false, 1) } - -async fn await1_level1() -> u8 { - base().await -} - -async fn await2_level1() -> u8 { - base().await + base().await -} - -async fn await3_level1() -> u8 { - base().await + base().await + base().await -} - -async fn await3_level2() -> u8 { - await3_level1().await + await3_level1().await + await3_level1().await -} - -async fn await3_level3() -> u8 { - await3_level2().await + await3_level2().await + await3_level2().await -} - -async fn await3_level4() -> u8 { - await3_level3().await + await3_level3().await + await3_level3().await -} - -async fn await3_level5() -> u8 { - await3_level4().await + await3_level4().await + await3_level4().await -} - -fn main() { - assert_eq!(2, std::mem::size_of_val(&base())); - assert_eq!(3, std::mem::size_of_val(&await1_level1())); - assert_eq!(4, std::mem::size_of_val(&await2_level1())); - assert_eq!(5, std::mem::size_of_val(&await3_level1())); - assert_eq!(8, std::mem::size_of_val(&await3_level2())); - assert_eq!(11, std::mem::size_of_val(&await3_level3())); - assert_eq!(14, std::mem::size_of_val(&await3_level4())); - assert_eq!(17, std::mem::size_of_val(&await3_level5())); - - assert_eq!(1, wait(base())); - assert_eq!(1, wait(await1_level1())); - assert_eq!(2, wait(await2_level1())); - assert_eq!(3, wait(await3_level1())); - assert_eq!(9, wait(await3_level2())); - assert_eq!(27, wait(await3_level3())); - assert_eq!(81, wait(await3_level4())); - assert_eq!(243, wait(await3_level5())); -} diff --git a/src/test/ui/async-await/async-matches-expr.rs b/src/test/ui/async-await/async-matches-expr.rs deleted file mode 100644 index 299faa058..000000000 --- a/src/test/ui/async-await/async-matches-expr.rs +++ /dev/null @@ -1,10 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 - -macro_rules! match_expr { - ($x:expr) => {} -} - -fn main() { - match_expr!(async {}); -} diff --git a/src/test/ui/async-await/async-trait-fn.rs b/src/test/ui/async-await/async-trait-fn.rs deleted file mode 100644 index e2062e827..000000000 --- a/src/test/ui/async-await/async-trait-fn.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 -trait T { - async fn foo() {} //~ ERROR functions in traits cannot be declared `async` - async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async` - async fn baz() { //~ ERROR functions in traits cannot be declared `async` - // Nested item must not ICE. - fn a() {} - } -} - -fn main() {} diff --git a/src/test/ui/async-await/async-trait-fn.stderr b/src/test/ui/async-await/async-trait-fn.stderr deleted file mode 100644 index afbe25cf7..000000000 --- a/src/test/ui/async-await/async-trait-fn.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:3:5 - | -LL | async fn foo() {} - | -----^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:4:5 - | -LL | async fn bar(&self) {} - | -----^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:5:5 - | -LL | async fn baz() { - | -----^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0706`. diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr deleted file mode 100644 index 2114fb59b..000000000 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:24:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs deleted file mode 100644 index c941dc27a..000000000 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ /dev/null @@ -1,25 +0,0 @@ -// edition:2018 -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -struct S; - -impl S { - async unsafe fn f() {} -} - -async unsafe fn f() {} - -async fn g() { - S::f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe - f(); - //[mir]~^ ERROR call to unsafe function is unsafe - //[thir]~^^ ERROR call to unsafe function `f` is unsafe -} - -fn main() { - S::f(); //[mir]~ ERROR call to unsafe function is unsafe - f(); //[mir]~ ERROR call to unsafe function is unsafe -} diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr deleted file mode 100644 index 68d97d3fd..000000000 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 - | -LL | S::f(); - | ^^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block - --> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 - | -LL | f(); - | ^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/async-await/async-with-closure.rs b/src/test/ui/async-await/async-with-closure.rs deleted file mode 100644 index 0b2255266..000000000 --- a/src/test/ui/async-await/async-with-closure.rs +++ /dev/null @@ -1,24 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 - -trait MyClosure { - type Args; -} - -impl MyClosure for dyn FnMut() -> R -where R: 'static { - type Args = (); -} - -struct MyStream { - x: C::Args, -} - -async fn get_future(_stream: MyStream) {} - -async fn f() { - let messages: MyStream = unimplemented!(); - get_future(messages).await; -} - -fn main() {} diff --git a/src/test/ui/async-await/auxiliary/arc_wake.rs b/src/test/ui/async-await/auxiliary/arc_wake.rs deleted file mode 100644 index c21886f26..000000000 --- a/src/test/ui/async-await/auxiliary/arc_wake.rs +++ /dev/null @@ -1,64 +0,0 @@ -// edition:2018 - -use std::sync::Arc; -use std::task::{ - Waker, RawWaker, RawWakerVTable, -}; - -macro_rules! waker_vtable { - ($ty:ident) => { - &RawWakerVTable::new( - clone_arc_raw::<$ty>, - wake_arc_raw::<$ty>, - wake_by_ref_arc_raw::<$ty>, - drop_arc_raw::<$ty>, - ) - }; -} - -pub trait ArcWake { - fn wake(self: Arc); - - fn wake_by_ref(arc_self: &Arc) { - arc_self.clone().wake() - } - - fn into_waker(wake: Arc) -> Waker where Self: Sized - { - let ptr = Arc::into_raw(wake) as *const (); - - unsafe { - Waker::from_raw(RawWaker::new(ptr, waker_vtable!(Self))) - } - } -} - -unsafe fn increase_refcount(data: *const ()) { - // Retain Arc by creating a copy - let arc: Arc = Arc::from_raw(data as *const T); - let arc_clone = arc.clone(); - // Forget the Arcs again, so that the refcount isn't decrased - let _ = Arc::into_raw(arc); - let _ = Arc::into_raw(arc_clone); -} - -unsafe fn clone_arc_raw(data: *const ()) -> RawWaker { - increase_refcount::(data); - RawWaker::new(data, waker_vtable!(T)) -} - -unsafe fn drop_arc_raw(data: *const ()) { - // Drop Arc - let _: Arc = Arc::from_raw(data as *const T); -} - -unsafe fn wake_arc_raw(data: *const ()) { - let arc: Arc = Arc::from_raw(data as *const T); - ArcWake::wake(arc); -} - -unsafe fn wake_by_ref_arc_raw(data: *const ()) { - let arc: Arc = Arc::from_raw(data as *const T); - ArcWake::wake_by_ref(&arc); - let _ = Arc::into_raw(arc); -} diff --git a/src/test/ui/async-await/auxiliary/issue-107036.rs b/src/test/ui/async-await/auxiliary/issue-107036.rs deleted file mode 100644 index c3f6141b2..000000000 --- a/src/test/ui/async-await/auxiliary/issue-107036.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2021 - -pub trait T {} -impl T for () {} - -pub struct S {} - -impl S { - pub async fn f<'a>(&self) -> impl T + 'a { - () - } -} diff --git a/src/test/ui/async-await/auxiliary/issue-72470-lib.rs b/src/test/ui/async-await/auxiliary/issue-72470-lib.rs deleted file mode 100644 index 8383eba89..000000000 --- a/src/test/ui/async-await/auxiliary/issue-72470-lib.rs +++ /dev/null @@ -1,175 +0,0 @@ -// compile-flags: -C opt-level=3 -// edition:2018 - -use std::future::Future; -use std::marker::PhantomData; -use std::pin::Pin; -use std::sync::atomic::AtomicUsize; -use std::sync::Arc; -use std::task::Poll::{Pending, Ready}; -use std::task::Waker; -use std::task::{Context, Poll}; -use std::{ - ptr, - task::{RawWaker, RawWakerVTable}, -}; - -/// Future for the [`poll_fn`] function. -pub struct PollFn { - f: F, -} - -impl Unpin for PollFn {} - -/// Creates a new future wrapping around a function returning [`Poll`]. -pub fn poll_fn(f: F) -> PollFn -where - F: FnMut(&mut Context<'_>) -> Poll, -{ - PollFn { f } -} - -impl Future for PollFn -where - F: FnMut(&mut Context<'_>) -> Poll, -{ - type Output = T; - - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - (&mut self.f)(cx) - } -} -pub fn run(future: F) -> F::Output { - BasicScheduler.block_on(future) -} - -pub(crate) struct BasicScheduler; - -impl BasicScheduler { - pub(crate) fn block_on(&mut self, mut future: F) -> F::Output - where - F: Future, - { - let waker = unsafe { Waker::from_raw(raw_waker()) }; - let mut cx = std::task::Context::from_waker(&waker); - - let mut future = unsafe { Pin::new_unchecked(&mut future) }; - - loop { - if let Ready(v) = future.as_mut().poll(&mut cx) { - return v; - } - } - } -} - -// ===== impl Spawner ===== - -fn raw_waker() -> RawWaker { - RawWaker::new(ptr::null(), waker_vtable()) -} - -fn waker_vtable() -> &'static RawWakerVTable { - &RawWakerVTable::new( - clone_arc_raw, - wake_arc_raw, - wake_by_ref_arc_raw, - drop_arc_raw, - ) -} - -unsafe fn clone_arc_raw(_: *const ()) -> RawWaker { - raw_waker() -} - -unsafe fn wake_arc_raw(_: *const ()) {} - -unsafe fn wake_by_ref_arc_raw(_: *const ()) {} - -unsafe fn drop_arc_raw(_: *const ()) {} - -struct AtomicWaker {} - -impl AtomicWaker { - /// Create an `AtomicWaker` - fn new() -> AtomicWaker { - AtomicWaker {} - } - - fn register_by_ref(&self, _waker: &Waker) {} -} - -#[allow(dead_code)] -struct Tx { - inner: Arc>, -} - -struct Rx { - inner: Arc>, -} - -#[allow(dead_code)] -struct Chan { - tx: PhantomData, - semaphore: Sema, - rx_waker: AtomicWaker, - rx_closed: bool, -} - -fn channel() -> (Tx, Rx) { - let chan = Arc::new(Chan { - tx: PhantomData, - semaphore: Sema(AtomicUsize::new(0)), - rx_waker: AtomicWaker::new(), - rx_closed: false, - }); - - ( - Tx { - inner: chan.clone(), - }, - Rx { inner: chan }, - ) -} - -// ===== impl Rx ===== - -impl Rx { - /// Receive the next value - fn recv(&mut self, cx: &mut Context<'_>) -> Poll> { - self.inner.rx_waker.register_by_ref(cx.waker()); - - if self.inner.rx_closed && self.inner.semaphore.is_idle() { - Ready(None) - } else { - Pending - } - } -} - -struct Sema(AtomicUsize); - -impl Sema { - fn is_idle(&self) -> bool { - false - } -} - -pub struct UnboundedReceiver { - chan: Rx, -} - -pub fn unbounded_channel() -> UnboundedReceiver { - let (tx, rx) = channel(); - - drop(tx); - let rx = UnboundedReceiver { chan: rx }; - - rx -} - -impl UnboundedReceiver { - pub async fn recv(&mut self) -> Option { - poll_fn(|cx| self.chan.recv(cx)).await - } -} diff --git a/src/test/ui/async-await/await-into-future.rs b/src/test/ui/async-await/await-into-future.rs deleted file mode 100644 index 8bf1385b3..000000000 --- a/src/test/ui/async-await/await-into-future.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass -// aux-build: issue-72470-lib.rs -// edition:2021 -extern crate issue_72470_lib; -use std::{future::{Future, IntoFuture}, pin::Pin}; - -struct AwaitMe; - -impl IntoFuture for AwaitMe { - type Output = i32; - type IntoFuture = Pin>>; - - fn into_future(self) -> Self::IntoFuture { - Box::pin(me()) - } -} - -async fn me() -> i32 { - 41 -} - -async fn run() { - assert_eq!(AwaitMe.await, 41); -} - -fn main() { - issue_72470_lib::run(run()); -} diff --git a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs deleted file mode 100644 index 50c163999..000000000 --- a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs +++ /dev/null @@ -1,38 +0,0 @@ -#![allow(non_camel_case_types)] -#![deny(keyword_idents)] - -mod outer_mod { - pub mod await { //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this is accepted in the current edition - pub struct await; //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this is accepted in the current edition - } -} -use outer_mod::await::await; //~ ERROR `await` is a keyword in the 2018 edition -//~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this is accepted in the current edition -//~^^^ WARN this is accepted in the current edition - -struct Foo { await: () } -//~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this is accepted in the current edition - -impl Foo { fn await() {} } -//~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this is accepted in the current edition - -macro_rules! await { -//~^ ERROR `await` is a keyword in the 2018 edition -//~^^ WARN this is accepted in the current edition - () => {} -} - -fn main() { - await!(); //~ ERROR `await` is a keyword in the 2018 edition - //~^ WARN this is accepted in the current edition - - match await { await => {} } //~ ERROR `await` is a keyword in the 2018 edition - //~^ ERROR `await` is a keyword in the 2018 edition - //~^^ WARN this is accepted in the current edition - //~^^^ WARN this is accepted in the current edition -} diff --git a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr b/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr deleted file mode 100644 index d99967eb2..000000000 --- a/src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr +++ /dev/null @@ -1,97 +0,0 @@ -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:5:13 - | -LL | pub mod await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 -note: the lint level is defined here - --> $DIR/2015-edition-error-various-positions.rs:2:9 - | -LL | #![deny(keyword_idents)] - | ^^^^^^^^^^^^^^ - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:7:20 - | -LL | pub struct await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:11:16 - | -LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:11:23 - | -LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:16:14 - | -LL | struct Foo { await: () } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:20:15 - | -LL | impl Foo { fn await() {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:24:14 - | -LL | macro_rules! await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:31:5 - | -LL | await!(); - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:34:11 - | -LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-error-various-positions.rs:34:19 - | -LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: aborting due to 10 previous errors - diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed b/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed deleted file mode 100644 index 117495e13..000000000 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.fixed +++ /dev/null @@ -1,27 +0,0 @@ -// run-rustfix - -#![allow(non_camel_case_types)] -#![deny(keyword_idents)] - -mod outer_mod { - pub mod r#await { -//~^ ERROR `await` is a keyword -//~| WARN this is accepted in the current edition - pub struct r#await; -//~^ ERROR `await` is a keyword -//~| WARN this is accepted in the current edition - } -} -use outer_mod::r#await::r#await; -//~^ ERROR `await` is a keyword -//~| ERROR `await` is a keyword -//~| WARN this is accepted in the current edition -//~| WARN this is accepted in the current edition - -fn main() { - match r#await { r#await => {} } -//~^ ERROR `await` is a keyword -//~| ERROR `await` is a keyword -//~| WARN this is accepted in the current edition -//~| WARN this is accepted in the current edition -} diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.rs b/src/test/ui/async-await/await-keyword/2015-edition-warning.rs deleted file mode 100644 index b3c64895c..000000000 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-rustfix - -#![allow(non_camel_case_types)] -#![deny(keyword_idents)] - -mod outer_mod { - pub mod await { -//~^ ERROR `await` is a keyword -//~| WARN this is accepted in the current edition - pub struct await; -//~^ ERROR `await` is a keyword -//~| WARN this is accepted in the current edition - } -} -use outer_mod::await::await; -//~^ ERROR `await` is a keyword -//~| ERROR `await` is a keyword -//~| WARN this is accepted in the current edition -//~| WARN this is accepted in the current edition - -fn main() { - match await { await => {} } -//~^ ERROR `await` is a keyword -//~| ERROR `await` is a keyword -//~| WARN this is accepted in the current edition -//~| WARN this is accepted in the current edition -} diff --git a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr b/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr deleted file mode 100644 index bf5c4d8d6..000000000 --- a/src/test/ui/async-await/await-keyword/2015-edition-warning.stderr +++ /dev/null @@ -1,61 +0,0 @@ -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:7:13 - | -LL | pub mod await { - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 -note: the lint level is defined here - --> $DIR/2015-edition-warning.rs:4:9 - | -LL | #![deny(keyword_idents)] - | ^^^^^^^^^^^^^^ - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:10:20 - | -LL | pub struct await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:15:16 - | -LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:15:23 - | -LL | use outer_mod::await::await; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:22:11 - | -LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:22:19 - | -LL | match await { await => {} } - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs deleted file mode 100644 index 9e78f7c51..000000000 --- a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs +++ /dev/null @@ -1,24 +0,0 @@ -// edition:2018 - -#![allow(non_camel_case_types)] - -mod outer_mod { - pub mod await { //~ ERROR expected identifier, found keyword `await` - pub struct await; //~ ERROR expected identifier, found keyword `await` - } -} -use self::outer_mod::await::await; //~ ERROR expected identifier, found keyword `await` -//~^ ERROR expected identifier, found keyword `await` - -struct Foo { await: () } -//~^ ERROR expected identifier, found keyword `await` - -impl Foo { fn await() {} } -//~^ ERROR expected identifier, found keyword `await` - -macro_rules! await { -//~^ ERROR expected identifier, found keyword `await` - () => {} -} - -fn main() {} diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr deleted file mode 100644 index 6bd8f671d..000000000 --- a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr +++ /dev/null @@ -1,81 +0,0 @@ -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:6:13 - | -LL | pub mod await { - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | pub mod r#await { - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:7:20 - | -LL | pub struct await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | pub struct r#await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:10:22 - | -LL | use self::outer_mod::await::await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | use self::outer_mod::r#await::await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:10:29 - | -LL | use self::outer_mod::await::await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | use self::outer_mod::await::r#await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:13:14 - | -LL | struct Foo { await: () } - | --- ^^^^^ expected identifier, found keyword - | | - | while parsing this struct - | -help: escape `await` to use it as an identifier - | -LL | struct Foo { r#await: () } - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:16:15 - | -LL | impl Foo { fn await() {} } - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | impl Foo { fn r#await() {} } - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error-in-non-macro-position.rs:19:14 - | -LL | macro_rules! await { - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | macro_rules! r#await { - | ++ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error.rs b/src/test/ui/async-await/await-keyword/2018-edition-error.rs deleted file mode 100644 index 7ce52259a..000000000 --- a/src/test/ui/async-await/await-keyword/2018-edition-error.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 -#![allow(non_camel_case_types)] - -mod outer_mod { - pub mod await { //~ ERROR expected identifier - pub struct await; //~ ERROR expected identifier - } -} -use self::outer_mod::await::await; //~ ERROR expected identifier - //~^ ERROR expected identifier, found keyword `await` - -macro_rules! await { () => {}; } //~ ERROR expected identifier, found keyword `await` - -fn main() { - await!(); //~ ERROR expected expression, found `)` -} diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error.stderr deleted file mode 100644 index 34bfdfc71..000000000 --- a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error.rs:5:13 - | -LL | pub mod await { - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | pub mod r#await { - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error.rs:6:20 - | -LL | pub struct await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | pub struct r#await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error.rs:9:22 - | -LL | use self::outer_mod::await::await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | use self::outer_mod::r#await::await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error.rs:9:29 - | -LL | use self::outer_mod::await::await; - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | use self::outer_mod::await::r#await; - | ++ - -error: expected identifier, found keyword `await` - --> $DIR/2018-edition-error.rs:12:14 - | -LL | macro_rules! await { () => {}; } - | ^^^^^ expected identifier, found keyword - | -help: escape `await` to use it as an identifier - | -LL | macro_rules! r#await { () => {}; } - | ++ - -error: expected expression, found `)` - --> $DIR/2018-edition-error.rs:15:12 - | -LL | await!(); - | ^ expected expression - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs deleted file mode 100644 index 554ac673d..000000000 --- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs +++ /dev/null @@ -1,132 +0,0 @@ -// edition:2018 - -async fn bar() -> Result<(), ()> { - Ok(()) -} - -async fn foo1() -> Result<(), ()> { - let _ = await bar(); //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo2() -> Result<(), ()> { - let _ = await? bar(); //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo3() -> Result<(), ()> { - let _ = await bar()?; //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo21() -> Result<(), ()> { - let _ = await { bar() }; //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo22() -> Result<(), ()> { - let _ = await(bar()); //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo23() -> Result<(), ()> { - let _ = await { bar() }?; //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo4() -> Result<(), ()> { - let _ = (await bar())?; //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo5() -> Result<(), ()> { - let _ = bar().await(); //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo6() -> Result<(), ()> { - let _ = bar().await()?; //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo7() -> Result<(), ()> { - let _ = bar().await; // OK - Ok(()) -} -async fn foo8() -> Result<(), ()> { - let _ = bar().await?; // OK - Ok(()) -} -fn foo9() -> Result<(), ()> { - let _ = await bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks - //~^ ERROR incorrect use of `await` - Ok(()) -} -fn foo10() -> Result<(), ()> { - let _ = await? bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks - //~^ ERROR incorrect use of `await` - Ok(()) -} -fn foo11() -> Result<(), ()> { - let _ = await bar()?; //~ ERROR incorrect use of `await` - Ok(()) -} -fn foo12() -> Result<(), ()> { - let _ = (await bar())?; //~ ERROR `await` is only allowed inside `async` functions and blocks - //~^ ERROR incorrect use of `await` - Ok(()) -} -fn foo13() -> Result<(), ()> { - let _ = bar().await(); //~ ERROR `await` is only allowed inside `async` functions and blocks - //~^ ERROR incorrect use of `await` - Ok(()) -} -fn foo14() -> Result<(), ()> { - let _ = bar().await()?; //~ ERROR `await` is only allowed inside `async` functions and blocks - //~^ ERROR incorrect use of `await` - Ok(()) -} -fn foo15() -> Result<(), ()> { - let _ = bar().await; //~ ERROR `await` is only allowed inside `async` functions and blocks - Ok(()) -} -fn foo16() -> Result<(), ()> { - let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks - Ok(()) -} -fn foo24() -> Result<(), ()> { - fn foo() -> Result<(), ()> { - let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks - Ok(()) - } - foo() -} -fn foo25() -> Result<(), ()> { - let foo = || { - let _ = bar().await?; //~ ERROR `await` is only allowed inside `async` functions and blocks - Ok(()) - }; - foo() -} - -async fn foo26() -> Result<(), ()> { - let _ = await!(bar()); //~ ERROR incorrect use of `await` - Ok(()) -} -async fn foo27() -> Result<(), ()> { - let _ = await!(bar())?; //~ ERROR incorrect use of `await` - Ok(()) -} -fn foo28() -> Result<(), ()> { - fn foo() -> Result<(), ()> { - let _ = await!(bar())?; //~ ERROR incorrect use of `await` - //~^ ERROR `await` is only allowed inside `async` functions - Ok(()) - } - foo() -} -fn foo29() -> Result<(), ()> { - let foo = || { - let _ = await!(bar())?; //~ ERROR incorrect use of `await` - //~^ ERROR `await` is only allowed inside `async` functions - Ok(()) - }; - foo() -} - -fn main() { - match await { await => () } - //~^ ERROR expected expression, found `=>` - //~| ERROR incorrect use of `await` -} //~ ERROR expected one of `.`, `?`, `{`, or an operator, found `}` diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr deleted file mode 100644 index b30f28837..000000000 --- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr +++ /dev/null @@ -1,230 +0,0 @@ -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:8:13 - | -LL | let _ = await bar(); - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:12:13 - | -LL | let _ = await? bar(); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:16:13 - | -LL | let _ = await bar()?; - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:20:13 - | -LL | let _ = await { bar() }; - | ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:24:13 - | -LL | let _ = await(bar()); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `(bar()).await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:28:13 - | -LL | let _ = await { bar() }?; - | ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:32:14 - | -LL | let _ = (await bar())?; - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:36:24 - | -LL | let _ = bar().await(); - | ^^ help: `await` is not a method call, remove the parentheses - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:40:24 - | -LL | let _ = bar().await()?; - | ^^ help: `await` is not a method call, remove the parentheses - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:52:13 - | -LL | let _ = await bar(); - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:57:13 - | -LL | let _ = await? bar(); - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:62:13 - | -LL | let _ = await bar()?; - | ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:66:14 - | -LL | let _ = (await bar())?; - | ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:71:24 - | -LL | let _ = bar().await(); - | ^^ help: `await` is not a method call, remove the parentheses - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:76:24 - | -LL | let _ = bar().await()?; - | ^^ help: `await` is not a method call, remove the parentheses - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:104:13 - | -LL | let _ = await!(bar()); - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:108:13 - | -LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:113:17 - | -LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:121:17 - | -LL | let _ = await!(bar())?; - | ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await` - -error: expected expression, found `=>` - --> $DIR/incorrect-syntax-suggestions.rs:129:25 - | -LL | match await { await => () } - | ----- ^^ expected expression - | | - | while parsing this incorrect await expression - -error: incorrect use of `await` - --> $DIR/incorrect-syntax-suggestions.rs:129:11 - | -LL | match await { await => () } - | ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await` - -error: expected one of `.`, `?`, `{`, or an operator, found `}` - --> $DIR/incorrect-syntax-suggestions.rs:132:1 - | -LL | match await { await => () } - | ----- - expected one of `.`, `?`, `{`, or an operator - | | - | while parsing this `match` expression -... -LL | } - | ^ unexpected token - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:52:13 - | -LL | fn foo9() -> Result<(), ()> { - | ---- this is not `async` -LL | let _ = await bar(); - | ^^^^^^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:57:13 - | -LL | fn foo10() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = await? bar(); - | ^^^^^^^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:66:14 - | -LL | fn foo12() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = (await bar())?; - | ^^^^^^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:71:18 - | -LL | fn foo13() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = bar().await(); - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:76:18 - | -LL | fn foo14() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = bar().await()?; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:81:18 - | -LL | fn foo15() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = bar().await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:85:18 - | -LL | fn foo16() -> Result<(), ()> { - | ----- this is not `async` -LL | let _ = bar().await?; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:90:22 - | -LL | fn foo() -> Result<(), ()> { - | --- this is not `async` -LL | let _ = bar().await?; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:97:22 - | -LL | let foo = || { - | -- this is not `async` -LL | let _ = bar().await?; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:113:29 - | -LL | fn foo() -> Result<(), ()> { - | --- this is not `async` -LL | let _ = await!(bar())?; - | ^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/incorrect-syntax-suggestions.rs:121:29 - | -LL | let foo = || { - | -- this is not `async` -LL | let _ = await!(bar())?; - | ^ only allowed inside `async` functions and blocks - -error: aborting due to 33 previous errors - -For more information about this error, try `rustc --explain E0728`. diff --git a/src/test/ui/async-await/await-keyword/post_expansion_error.rs b/src/test/ui/async-await/await-keyword/post_expansion_error.rs deleted file mode 100644 index b4c899b0d..000000000 --- a/src/test/ui/async-await/await-keyword/post_expansion_error.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 - -macro_rules! r#await { - () => { println!("Hello, world!") } -} - -fn main() { - await!() - //~^ ERROR expected expression, found `)` -} diff --git a/src/test/ui/async-await/await-keyword/post_expansion_error.stderr b/src/test/ui/async-await/await-keyword/post_expansion_error.stderr deleted file mode 100644 index 0996c38b3..000000000 --- a/src/test/ui/async-await/await-keyword/post_expansion_error.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected expression, found `)` - --> $DIR/post_expansion_error.rs:8:12 - | -LL | await!() - | ^ expected expression - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/await-unsize.rs b/src/test/ui/async-await/await-unsize.rs deleted file mode 100644 index aa09d4bdf..000000000 --- a/src/test/ui/async-await/await-unsize.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Regression test for #62312 - -// check-pass -// edition:2018 - -async fn make_boxed_object() -> Box { - Box::new(()) as _ -} - -async fn await_object() { - let _ = make_boxed_object().await; -} - -fn main() {} diff --git a/src/test/ui/async-await/bound-normalization.rs b/src/test/ui/async-await/bound-normalization.rs deleted file mode 100644 index 5d260682f..000000000 --- a/src/test/ui/async-await/bound-normalization.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// edition:2018 - -// See issue 60414 - -trait Trait { - type Assoc; -} - -async fn foo>() -> T::Assoc { - () -} - -fn main() {} diff --git a/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs b/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs deleted file mode 100644 index 56f4cbbd1..000000000 --- a/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// edition:2018 -// compile-flags: --crate-type lib - -async fn conditional_and_guaranteed_initialization(x: usize) -> usize { - let y; - if x > 5 { - y = echo(10).await; - } else { - y = get_something().await; - } - y -} - -async fn echo(x: usize) -> usize { x } -async fn get_something() -> usize { 10 } diff --git a/src/test/ui/async-await/default-struct-update.rs b/src/test/ui/async-await/default-struct-update.rs deleted file mode 100644 index 64fb6280d..000000000 --- a/src/test/ui/async-await/default-struct-update.rs +++ /dev/null @@ -1,22 +0,0 @@ -// build-pass -// edition:2018 -// compile-flags: -Zdrop-tracking=y - -fn main() { - let _ = foo(); -} - -async fn from_config(_: Config) {} - -async fn foo() { - from_config(Config { - nickname: None, - ..Default::default() - }) - .await; -} - -#[derive(Default)] -struct Config { - nickname: Option>, -} diff --git a/src/test/ui/async-await/dont-print-desugared-async.rs b/src/test/ui/async-await/dont-print-desugared-async.rs deleted file mode 100644 index 68341a24c..000000000 --- a/src/test/ui/async-await/dont-print-desugared-async.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Test that we don't show variables with from async fn desugaring - -// edition:2018 - -async fn async_fn(&ref mut s: &[i32]) {} -//~^ ERROR cannot borrow data in a `&` reference as mutable [E0596] - -fn main() {} diff --git a/src/test/ui/async-await/dont-print-desugared-async.stderr b/src/test/ui/async-await/dont-print-desugared-async.stderr deleted file mode 100644 index d80467c7f..000000000 --- a/src/test/ui/async-await/dont-print-desugared-async.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/dont-print-desugared-async.rs:5:20 - | -LL | async fn async_fn(&ref mut s: &[i32]) {} - | ^^^^^^^^^ cannot borrow as mutable through `&` reference - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/async-await/dont-suggest-missing-await.rs b/src/test/ui/async-await/dont-suggest-missing-await.rs deleted file mode 100644 index a8e5b38ec..000000000 --- a/src/test/ui/async-await/dont-suggest-missing-await.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition:2018 - -// This test ensures we don't make the suggestion in bodies that aren't `async`. - -fn take_u32(x: u32) {} - -async fn make_u32() -> u32 { - 22 -} - -async fn dont_suggest_await_in_closure() { - || { - let x = make_u32(); - take_u32(x) - //~^ ERROR mismatched types [E0308] - }; -} - -fn main() {} diff --git a/src/test/ui/async-await/dont-suggest-missing-await.stderr b/src/test/ui/async-await/dont-suggest-missing-await.stderr deleted file mode 100644 index 627bf05bb..000000000 --- a/src/test/ui/async-await/dont-suggest-missing-await.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/dont-suggest-missing-await.rs:14:18 - | -LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type - | | - | arguments to this function are incorrect - | -note: while checking the return type of the `async fn` - --> $DIR/dont-suggest-missing-await.rs:7:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` -note: function defined here - --> $DIR/dont-suggest-missing-await.rs:5:4 - | -LL | fn take_u32(x: u32) {} - | ^^^^^^^^ ------ -help: consider `await`ing on the `Future` - | -LL | take_u32(x.await) - | ++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/drop-and-assign.rs b/src/test/ui/async-await/drop-and-assign.rs deleted file mode 100644 index fa3f33036..000000000 --- a/src/test/ui/async-await/drop-and-assign.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition:2021 -// compile-flags: -Zdrop-tracking -// build-pass - -struct A; -impl Drop for A { fn drop(&mut self) {} } - -pub async fn f() { - let mut a = A; - a = A; - drop(a); - async {}.await; -} - -fn assert_send(_: T) {} - -fn main() { - let _ = f(); -} diff --git a/src/test/ui/async-await/drop-order/auxiliary/arc_wake.rs b/src/test/ui/async-await/drop-order/auxiliary/arc_wake.rs deleted file mode 100644 index c21886f26..000000000 --- a/src/test/ui/async-await/drop-order/auxiliary/arc_wake.rs +++ /dev/null @@ -1,64 +0,0 @@ -// edition:2018 - -use std::sync::Arc; -use std::task::{ - Waker, RawWaker, RawWakerVTable, -}; - -macro_rules! waker_vtable { - ($ty:ident) => { - &RawWakerVTable::new( - clone_arc_raw::<$ty>, - wake_arc_raw::<$ty>, - wake_by_ref_arc_raw::<$ty>, - drop_arc_raw::<$ty>, - ) - }; -} - -pub trait ArcWake { - fn wake(self: Arc); - - fn wake_by_ref(arc_self: &Arc) { - arc_self.clone().wake() - } - - fn into_waker(wake: Arc) -> Waker where Self: Sized - { - let ptr = Arc::into_raw(wake) as *const (); - - unsafe { - Waker::from_raw(RawWaker::new(ptr, waker_vtable!(Self))) - } - } -} - -unsafe fn increase_refcount(data: *const ()) { - // Retain Arc by creating a copy - let arc: Arc = Arc::from_raw(data as *const T); - let arc_clone = arc.clone(); - // Forget the Arcs again, so that the refcount isn't decrased - let _ = Arc::into_raw(arc); - let _ = Arc::into_raw(arc_clone); -} - -unsafe fn clone_arc_raw(data: *const ()) -> RawWaker { - increase_refcount::(data); - RawWaker::new(data, waker_vtable!(T)) -} - -unsafe fn drop_arc_raw(data: *const ()) { - // Drop Arc - let _: Arc = Arc::from_raw(data as *const T); -} - -unsafe fn wake_arc_raw(data: *const ()) { - let arc: Arc = Arc::from_raw(data as *const T); - ArcWake::wake(arc); -} - -unsafe fn wake_by_ref_arc_raw(data: *const ()) { - let arc: Arc = Arc::from_raw(data as *const T); - ArcWake::wake_by_ref(&arc); - let _ = Arc::into_raw(arc); -} diff --git a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs b/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs deleted file mode 100644 index 9817d377a..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs +++ /dev/null @@ -1,270 +0,0 @@ -// aux-build:arc_wake.rs -// edition:2018 -// run-pass - -#![allow(unused_variables)] - -// Test that the drop order for parameters in a fn and async fn matches up. Also test that -// parameters (used or unused) are not dropped until the async fn completes execution. -// See also #54716. - -extern crate arc_wake; - -use arc_wake::ArcWake; -use std::cell::RefCell; -use std::future::Future; -use std::marker::PhantomData; -use std::sync::Arc; -use std::rc::Rc; -use std::task::Context; - -struct EmptyWaker; - -impl ArcWake for EmptyWaker { - fn wake(self: Arc) {} -} - -#[derive(Debug, Eq, PartialEq)] -enum DropOrder { - Function, - Val(&'static str), -} - -type DropOrderListPtr = Rc>>; - -struct D(&'static str, DropOrderListPtr); - -impl Drop for D { - fn drop(&mut self) { - self.1.borrow_mut().push(DropOrder::Val(self.0)); - } -} - -/// Check that unused bindings are dropped after the function is polled. -async fn foo_async(ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn foo_sync(ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns are dropped after the function is polled. -async fn bar_async(ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn bar_sync(ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns within more complex patterns are dropped after the function -/// is polled. -async fn baz_async((ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn baz_sync((ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore and unused bindings within and outwith more complex patterns are dropped -/// after the function is polled. -async fn foobar_async(ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn foobar_sync(ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -struct Foo; - -impl Foo { - /// Check that unused bindings are dropped after the method is polled. - async fn foo_async(ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foo_sync(ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method is polled. - async fn bar_async(ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn bar_sync(ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// is polled. - async fn baz_async((ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn baz_sync((ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method is polled. - async fn foobar_async( - ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D, - ) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foobar_sync( - ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D, - ) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -struct Bar<'a>(PhantomData<&'a ()>); - -impl<'a> Bar<'a> { - /// Check that unused bindings are dropped after the method with self is polled. - async fn foo_async(&'a self, ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foo_sync(&'a self, ref mut x: D, ref mut _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method with self is polled. - async fn bar_async(&'a self, ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn bar_sync(&'a self, ref mut x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// with self is polled. - async fn baz_async(&'a self, (ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn baz_sync(&'a self, (ref mut x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method with self is polled. - async fn foobar_async( - &'a self, ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D, - ) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foobar_sync( - &'a self, ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D, - ) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -fn assert_drop_order_after_poll>( - f: impl FnOnce(DropOrderListPtr) -> Fut, - g: impl FnOnce(DropOrderListPtr), -) { - let empty = Arc::new(EmptyWaker); - let waker = ArcWake::into_waker(empty); - let mut cx = Context::from_waker(&waker); - - let actual_order = Rc::new(RefCell::new(Vec::new())); - let mut fut = Box::pin(f(actual_order.clone())); - let _ = fut.as_mut().poll(&mut cx); - - let expected_order = Rc::new(RefCell::new(Vec::new())); - g(expected_order.clone()); - - assert_eq!(*actual_order.borrow(), *expected_order.borrow()); -} - -fn main() { - // Free functions (see doc comment on function for what it tests). - assert_drop_order_after_poll(|l| foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| bar_async(D("x", l.clone()), D("_", l.clone())), - |l| bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods w/out self (see doc comment on function for what it tests). - assert_drop_order_after_poll(|l| Foo::foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| Foo::foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| Foo::bar_async(D("x", l.clone()), D("_", l.clone())), - |l| Foo::bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| Foo::baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| Foo::baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - Foo::foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - Foo::foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods (see doc comment on function for what it tests). - let b = Bar(Default::default()); - assert_drop_order_after_poll(|l| b.foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| b.foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| b.bar_async(D("x", l.clone()), D("_", l.clone())), - |l| b.bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| b.baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| b.baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - b.foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - b.foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); -} diff --git a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs b/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs deleted file mode 100644 index 6c10ead36..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs +++ /dev/null @@ -1,265 +0,0 @@ -// aux-build:arc_wake.rs -// edition:2018 -// run-pass - -// revisions: default nomiropt -//[nomiropt]compile-flags: -Z mir-opt-level=0 - -#![allow(unused_variables)] - -// Test that the drop order for parameters in a fn and async fn matches up. Also test that -// parameters (used or unused) are not dropped until the async fn completes execution. -// See also #54716. - -extern crate arc_wake; - -use arc_wake::ArcWake; -use std::cell::RefCell; -use std::future::Future; -use std::marker::PhantomData; -use std::sync::Arc; -use std::rc::Rc; -use std::task::Context; - -struct EmptyWaker; - -impl ArcWake for EmptyWaker { - fn wake(self: Arc) {} -} - -#[derive(Debug, Eq, PartialEq)] -enum DropOrder { - Function, - Val(&'static str), -} - -type DropOrderListPtr = Rc>>; - -struct D(&'static str, DropOrderListPtr); - -impl Drop for D { - fn drop(&mut self) { - self.1.borrow_mut().push(DropOrder::Val(self.0)); - } -} - -/// Check that unused bindings are dropped after the function is polled. -async fn foo_async(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn foo_sync(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns are dropped after the function is polled. -async fn bar_async(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn bar_sync(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns within more complex patterns are dropped after the function -/// is polled. -async fn baz_async((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn baz_sync((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore and unused bindings within and outwith more complex patterns are dropped -/// after the function is polled. -async fn foobar_async(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -fn foobar_sync(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -struct Foo; - -impl Foo { - /// Check that unused bindings are dropped after the method is polled. - async fn foo_async(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foo_sync(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method is polled. - async fn bar_async(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn bar_sync(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// is polled. - async fn baz_async((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn baz_sync((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method is polled. - async fn foobar_async(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foobar_sync(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -struct Bar<'a>(PhantomData<&'a ()>); - -impl<'a> Bar<'a> { - /// Check that unused bindings are dropped after the method with self is polled. - async fn foo_async(&'a self, x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foo_sync(&'a self, x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method with self is polled. - async fn bar_async(&'a self, x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn bar_sync(&'a self, x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// with self is polled. - async fn baz_async(&'a self, (x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn baz_sync(&'a self, (x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method with self is polled. - async fn foobar_async(&'a self, x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - fn foobar_sync(&'a self, x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -fn assert_drop_order_after_poll>( - f: impl FnOnce(DropOrderListPtr) -> Fut, - g: impl FnOnce(DropOrderListPtr), -) { - let empty = Arc::new(EmptyWaker); - let waker = ArcWake::into_waker(empty); - let mut cx = Context::from_waker(&waker); - - let actual_order = Rc::new(RefCell::new(Vec::new())); - let mut fut = Box::pin(f(actual_order.clone())); - let _ = fut.as_mut().poll(&mut cx); - - let expected_order = Rc::new(RefCell::new(Vec::new())); - g(expected_order.clone()); - - assert_eq!(*actual_order.borrow(), *expected_order.borrow()); -} - -fn main() { - // Free functions (see doc comment on function for what it tests). - assert_drop_order_after_poll(|l| foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| bar_async(D("x", l.clone()), D("_", l.clone())), - |l| bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods w/out self (see doc comment on function for what it tests). - assert_drop_order_after_poll(|l| Foo::foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| Foo::foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| Foo::bar_async(D("x", l.clone()), D("_", l.clone())), - |l| Foo::bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| Foo::baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| Foo::baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - Foo::foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - Foo::foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods (see doc comment on function for what it tests). - let b = Bar(Default::default()); - assert_drop_order_after_poll(|l| b.foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| b.foo_sync(D("x", l.clone()), D("_y", l.clone()))); - assert_drop_order_after_poll(|l| b.bar_async(D("x", l.clone()), D("_", l.clone())), - |l| b.bar_sync(D("x", l.clone()), D("_", l.clone()))); - assert_drop_order_after_poll(|l| b.baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| b.baz_sync((D("x", l.clone()), D("_", l.clone())))); - assert_drop_order_after_poll( - |l| { - b.foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - b.foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); -} diff --git a/src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs b/src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs deleted file mode 100644 index 15cc9fbc8..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs +++ /dev/null @@ -1,176 +0,0 @@ -// aux-build:arc_wake.rs -// edition:2018 -// run-pass - -#![deny(dead_code)] -#![allow(unused_variables)] -#![allow(unused_must_use)] -#![allow(path_statements)] - -// Test that the drop order for locals in a fn and async fn matches up. -extern crate arc_wake; - -use arc_wake::ArcWake; -use std::cell::RefCell; -use std::future::Future; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::Arc; -use std::task::{Context, Poll}; - -struct EmptyWaker; - -impl ArcWake for EmptyWaker { - fn wake(self: Arc) {} -} - -#[derive(Debug, Eq, PartialEq)] -enum DropOrder { - Function, - Val(&'static str), -} - -type DropOrderListPtr = Rc>>; - -struct D(&'static str, DropOrderListPtr); - -impl Drop for D { - fn drop(&mut self) { - self.1.borrow_mut().push(DropOrder::Val(self.0)); - } -} - -struct NeverReady; - -impl Future for NeverReady { - type Output = (); - fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { - Poll::Pending - } -} - -async fn simple_variable_declaration_async(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - NeverReady.await; -} - -fn simple_variable_declaration_sync(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); -} - -async fn varable_completely_contained_within_block_async(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - async { - let x = D("x", l.clone()); - } - .await; - let y = D("y", l.clone()); - NeverReady.await; -} - -fn varable_completely_contained_within_block_sync(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - { - let x = D("x", l.clone()); - } - let y = D("y", l.clone()); -} - -async fn variables_moved_into_separate_blocks_async(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - async move { x }.await; - async move { y }.await; - NeverReady.await; -} - -fn variables_moved_into_separate_blocks_sync(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - { - x - }; - { - y - }; -} - -async fn variables_moved_into_same_block_async(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - async move { - x; - y; - }; - NeverReady.await; -} - -fn variables_moved_into_same_block_sync(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - { - x; - y; - }; - return; -} - -async fn move_after_current_await_doesnt_affect_order(l: DropOrderListPtr) { - l.borrow_mut().push(DropOrder::Function); - let x = D("x", l.clone()); - let y = D("y", l.clone()); - NeverReady.await; - async move { - x; - y; - }; -} - -fn assert_drop_order_after_cancel>( - f: impl FnOnce(DropOrderListPtr) -> Fut, - g: impl FnOnce(DropOrderListPtr), -) { - let empty = Arc::new(EmptyWaker); - let waker = ArcWake::into_waker(empty); - let mut cx = Context::from_waker(&waker); - - let actual_order = Rc::new(RefCell::new(Vec::new())); - let mut fut = Box::pin(f(actual_order.clone())); - let _ = fut.as_mut().poll(&mut cx); - drop(fut); - - let expected_order = Rc::new(RefCell::new(Vec::new())); - g(expected_order.clone()); - assert_eq!(*actual_order.borrow(), *expected_order.borrow()); -} - -fn main() { - assert_drop_order_after_cancel( - simple_variable_declaration_async, - simple_variable_declaration_sync, - ); - assert_drop_order_after_cancel( - varable_completely_contained_within_block_async, - varable_completely_contained_within_block_sync, - ); - assert_drop_order_after_cancel( - variables_moved_into_separate_blocks_async, - variables_moved_into_separate_blocks_sync, - ); - assert_drop_order_after_cancel( - variables_moved_into_same_block_async, - variables_moved_into_same_block_sync, - ); - assert_drop_order_after_cancel( - move_after_current_await_doesnt_affect_order, - simple_variable_declaration_sync, - ); -} diff --git a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs b/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs deleted file mode 100644 index edfecb910..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs +++ /dev/null @@ -1,98 +0,0 @@ -// aux-build:arc_wake.rs -// edition:2018 -// run-pass - -// revisions: default nomiropt -//[nomiropt]compile-flags: -Z mir-opt-level=0 - -#![allow(unused_variables)] - -// Test the drop order for parameters relative to local variables and -// temporaries created in the tail return expression of the function -// body. In particular, check that this drop order is the same between -// an `async fn` and an ordinary `fn`. See #64512. - -extern crate arc_wake; - -use arc_wake::ArcWake; -use std::cell::RefCell; -use std::future::Future; -use std::sync::Arc; -use std::rc::Rc; -use std::task::Context; - -struct EmptyWaker; - -impl ArcWake for EmptyWaker { - fn wake(self: Arc) {} -} - -#[derive(Debug, Eq, PartialEq)] -enum DropOrder { - Function, - Val(&'static str), -} - -type DropOrderListPtr = Rc>>; - -struct D(&'static str, DropOrderListPtr); - -impl Drop for D { - fn drop(&mut self) { - self.1.borrow_mut().push(DropOrder::Val(self.0)); - } -} - -/// Check drop order of temporary "temp" as compared to `x`, `y`, and `z`. -/// -/// Expected order: -/// - `z` -/// - temp -/// - `y` -/// - `x` -async fn foo_async(x: D, _y: D) { - let l = x.1.clone(); - let z = D("z", l.clone()); - l.borrow_mut().push(DropOrder::Function); - helper_async(&D("temp", l)).await -} - -async fn helper_async(v: &D) { } - -fn foo_sync(x: D, _y: D) { - let l = x.1.clone(); - let z = D("z", l.clone()); - l.borrow_mut().push(DropOrder::Function); - helper_sync(&D("temp", l)) -} - -fn helper_sync(v: &D) { } - -fn assert_drop_order_after_poll>( - f: impl FnOnce(DropOrderListPtr) -> Fut, - g: impl FnOnce(DropOrderListPtr), -) { - let empty = Arc::new(EmptyWaker); - let waker = ArcWake::into_waker(empty); - let mut cx = Context::from_waker(&waker); - - let actual_order = Rc::new(RefCell::new(Vec::new())); - let mut fut = Box::pin(f(actual_order.clone())); - let r = fut.as_mut().poll(&mut cx); - - assert!(match r { - std::task::Poll::Ready(()) => true, - _ => false, - }); - - let expected_order = Rc::new(RefCell::new(Vec::new())); - g(expected_order.clone()); - - assert_eq!(*actual_order.borrow(), *expected_order.borrow()); -} - -fn main() { - // Free functions (see doc comment on function for what it tests). - assert_drop_order_after_poll(|l| foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| foo_sync(D("x", l.clone()), D("_y", l.clone()))); -} diff --git a/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.rs b/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.rs deleted file mode 100644 index 79dedb1ba..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 - -async fn foobar_async(x: u32, (a, _, _c): (u32, u32, u32), _: u32, _y: u32) { - assert_eq!(__arg1, (1, 2, 3)); //~ ERROR cannot find value `__arg1` in this scope [E0425] - assert_eq!(__arg2, 4); //~ ERROR cannot find value `__arg2` in this scope [E0425] -} - -async fn baz_async(ref mut x: u32, ref y: u32) { - assert_eq!(__arg0, 1); //~ ERROR cannot find value `__arg0` in this scope [E0425] - assert_eq!(__arg1, 2); //~ ERROR cannot find value `__arg1` in this scope [E0425] -} - -fn main() {} diff --git a/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.stderr b/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.stderr deleted file mode 100644 index aa04a613f..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0425]: cannot find value `__arg1` in this scope - --> $DIR/drop-order-locals-are-hidden.rs:4:16 - | -LL | assert_eq!(__arg1, (1, 2, 3)); - | ^^^^^^ not found in this scope - -error[E0425]: cannot find value `__arg2` in this scope - --> $DIR/drop-order-locals-are-hidden.rs:5:16 - | -LL | assert_eq!(__arg2, 4); - | ^^^^^^ not found in this scope - -error[E0425]: cannot find value `__arg0` in this scope - --> $DIR/drop-order-locals-are-hidden.rs:9:16 - | -LL | assert_eq!(__arg0, 1); - | ^^^^^^ not found in this scope - -error[E0425]: cannot find value `__arg1` in this scope - --> $DIR/drop-order-locals-are-hidden.rs:10:16 - | -LL | assert_eq!(__arg1, 2); - | ^^^^^^ not found in this scope - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs b/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs deleted file mode 100644 index cfd68bc0d..000000000 --- a/src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs +++ /dev/null @@ -1,309 +0,0 @@ -// aux-build:arc_wake.rs -// edition:2018 -// run-pass - -// revisions: default nomiropt -//[nomiropt]compile-flags: -Z mir-opt-level=0 - -// Test that the drop order for parameters in a fn and async fn matches up. Also test that -// parameters (used or unused) are not dropped until the async fn is cancelled. -// This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs - -#![allow(unused_variables)] - -extern crate arc_wake; - -use arc_wake::ArcWake; -use std::cell::RefCell; -use std::future::Future; -use std::marker::PhantomData; -use std::pin::Pin; -use std::rc::Rc; -use std::sync::Arc; -use std::task::{Context, Poll}; - -struct EmptyWaker; - -impl ArcWake for EmptyWaker { - fn wake(self: Arc) {} -} - -#[derive(Debug, Eq, PartialEq)] -enum DropOrder { - Function, - Val(&'static str), -} - -type DropOrderListPtr = Rc>>; - -struct D(&'static str, DropOrderListPtr); - -impl Drop for D { - fn drop(&mut self) { - self.1.borrow_mut().push(DropOrder::Val(self.0)); - } -} - -struct NeverReady; - -impl Future for NeverReady { - type Output = (); - fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { - Poll::Pending - } -} - -/// Check that unused bindings are dropped after the function is polled. -async fn foo_async(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; -} - -fn foo_sync(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns are dropped after the function is polled. -async fn bar_async(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; -} - -fn bar_sync(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore patterns within more complex patterns are dropped after the function -/// is polled. -async fn baz_async((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; -} - -fn baz_sync((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); -} - -/// Check that underscore and unused bindings within and outwith more complex patterns are dropped -/// after the function is polled. -async fn foobar_async(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; -} - -fn foobar_sync(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); -} - -struct Foo; - -impl Foo { - /// Check that unused bindings are dropped after the method is polled. - async fn foo_async(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn foo_sync(x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method is polled. - async fn bar_async(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn bar_sync(x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// is polled. - async fn baz_async((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn baz_sync((x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method is polled. - async fn foobar_async(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn foobar_sync(x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -struct Bar<'a>(PhantomData<&'a ()>); - -impl<'a> Bar<'a> { - /// Check that unused bindings are dropped after the method with self is polled. - async fn foo_async(&'a self, x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn foo_sync(&'a self, x: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns are dropped after the method with self is polled. - async fn bar_async(&'a self, x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn bar_sync(&'a self, x: D, _: D) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore patterns within more complex patterns are dropped after the method - /// with self is polled. - async fn baz_async(&'a self, (x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn baz_sync(&'a self, (x, _): (D, D)) { - x.1.borrow_mut().push(DropOrder::Function); - } - - /// Check that underscore and unused bindings within and outwith more complex patterns are - /// dropped after the method with self is polled. - async fn foobar_async(&'a self, x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - NeverReady.await; - } - - fn foobar_sync(&'a self, x: D, (a, _, _c): (D, D, D), _: D, _y: D) { - x.1.borrow_mut().push(DropOrder::Function); - } -} - -fn assert_drop_order_after_cancel>( - f: impl FnOnce(DropOrderListPtr) -> Fut, - g: impl FnOnce(DropOrderListPtr), -) { - let empty = Arc::new(EmptyWaker); - let waker = ArcWake::into_waker(empty); - let mut cx = Context::from_waker(&waker); - - let actual_order = Rc::new(RefCell::new(Vec::new())); - let mut fut = Box::pin(f(actual_order.clone())); - let _ = fut.as_mut().poll(&mut cx); - - // Parameters are never dropped until the future completes. - assert_eq!(*actual_order.borrow(), vec![DropOrder::Function]); - - drop(fut); - - let expected_order = Rc::new(RefCell::new(Vec::new())); - g(expected_order.clone()); - assert_eq!(*actual_order.borrow(), *expected_order.borrow()); -} - -fn main() { - // Free functions (see doc comment on function for what it tests). - assert_drop_order_after_cancel( - |l| foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| foo_sync(D("x", l.clone()), D("_y", l.clone())), - ); - assert_drop_order_after_cancel( - |l| bar_async(D("x", l.clone()), D("_", l.clone())), - |l| bar_sync(D("x", l.clone()), D("_", l.clone())), - ); - assert_drop_order_after_cancel( - |l| baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| baz_sync((D("x", l.clone()), D("_", l.clone()))), - ); - assert_drop_order_after_cancel( - |l| { - foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods w/out self (see doc comment on function for what it tests). - assert_drop_order_after_cancel( - |l| Foo::foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| Foo::foo_sync(D("x", l.clone()), D("_y", l.clone())), - ); - assert_drop_order_after_cancel( - |l| Foo::bar_async(D("x", l.clone()), D("_", l.clone())), - |l| Foo::bar_sync(D("x", l.clone()), D("_", l.clone())), - ); - assert_drop_order_after_cancel( - |l| Foo::baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| Foo::baz_sync((D("x", l.clone()), D("_", l.clone()))), - ); - assert_drop_order_after_cancel( - |l| { - Foo::foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - Foo::foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); - - // Methods (see doc comment on function for what it tests). - let b = Bar(Default::default()); - assert_drop_order_after_cancel( - |l| b.foo_async(D("x", l.clone()), D("_y", l.clone())), - |l| b.foo_sync(D("x", l.clone()), D("_y", l.clone())), - ); - assert_drop_order_after_cancel( - |l| b.bar_async(D("x", l.clone()), D("_", l.clone())), - |l| b.bar_sync(D("x", l.clone()), D("_", l.clone())), - ); - assert_drop_order_after_cancel( - |l| b.baz_async((D("x", l.clone()), D("_", l.clone()))), - |l| b.baz_sync((D("x", l.clone()), D("_", l.clone()))), - ); - assert_drop_order_after_cancel( - |l| { - b.foobar_async( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - |l| { - b.foobar_sync( - D("x", l.clone()), - (D("a", l.clone()), D("_", l.clone()), D("_c", l.clone())), - D("_", l.clone()), - D("_y", l.clone()), - ) - }, - ); -} diff --git a/src/test/ui/async-await/drop-track-bad-field-in-fru.rs b/src/test/ui/async-await/drop-track-bad-field-in-fru.rs deleted file mode 100644 index 28ad77675..000000000 --- a/src/test/ui/async-await/drop-track-bad-field-in-fru.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags: -Zdrop-tracking -// edition: 2021 - -fn main() {} - -async fn foo() { - None { value: (), ..Default::default() }.await; - //~^ ERROR `Option<_>` is not a future - //~| ERROR variant `Option<_>::None` has no field named `value` -} diff --git a/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr b/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr deleted file mode 100644 index 819b64ad7..000000000 --- a/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0559]: variant `Option<_>::None` has no field named `value` - --> $DIR/drop-track-bad-field-in-fru.rs:7:12 - | -LL | None { value: (), ..Default::default() }.await; - | ^^^^^ `Option<_>::None` does not have this field - -error[E0277]: `Option<_>` is not a future - --> $DIR/drop-track-bad-field-in-fru.rs:7:45 - | -LL | None { value: (), ..Default::default() }.await; - | ^^^^^^ - | | - | `Option<_>` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for `Option<_>` - = note: Option<_> must be a future or must implement `IntoFuture` to be awaited - = note: required for `Option<_>` to implement `IntoFuture` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0559. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/drop-track-field-assign-nonsend.rs b/src/test/ui/async-await/drop-track-field-assign-nonsend.rs deleted file mode 100644 index b6c0fda15..000000000 --- a/src/test/ui/async-await/drop-track-field-assign-nonsend.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -// edition:2021 -// compile-flags: -Zdrop-tracking - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option> -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = None; - let element = parse_info(info); - let _ = send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn assert_send(_: T) {} - -fn main() { - let agent = Agent { info_result: InfoResult { node: None } }; - // FIXME: It would be nice for this to work. See #94067. - assert_send(agent.handle()); - //~^ cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/drop-track-field-assign-nonsend.stderr b/src/test/ui/async-await/drop-track-field-assign-nonsend.stderr deleted file mode 100644 index d95483c81..000000000 --- a/src/test/ui/async-await/drop-track-field-assign-nonsend.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/drop-track-field-assign-nonsend.rs:43:17 - | -LL | assert_send(agent.handle()); - | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc` -note: future is not `Send` as this value is used across an await - --> $DIR/drop-track-field-assign-nonsend.rs:21:38 - | -LL | let mut info = self.info_result.clone(); - | -------- has type `InfoResult` which is not `Send` -... -LL | let _ = send_element(element).await; - | ^^^^^^ await occurs here, with `mut info` maybe used later -LL | } - | - `mut info` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/drop-track-field-assign-nonsend.rs:38:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/drop-track-field-assign.rs b/src/test/ui/async-await/drop-track-field-assign.rs deleted file mode 100644 index 3a393cd16..000000000 --- a/src/test/ui/async-await/drop-track-field-assign.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -// edition:2021 -// compile-flags: -Zdrop-tracking -// build-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = Some("bar".into()); - let element = parse_info(info); - let _ = send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn main() { - let mut agent = Agent { - info_result: InfoResult { node: None } - }; - let _ = agent.handle(); -} diff --git a/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.rs b/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.rs deleted file mode 100644 index 7f7294295..000000000 --- a/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.rs +++ /dev/null @@ -1,106 +0,0 @@ -// compile-flags: -Zdrop-tracking -// incremental -// edition: 2021 - -use std::future::*; -use std::marker::PhantomData; -use std::pin::Pin; -use std::task::*; - -fn send(_: T) {} - -pub trait Stream { - type Item; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll>; -} - -struct Empty(PhantomData T>); - -impl Stream for Empty { - type Item = T; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - todo!() - } -} - -pub trait FnOnce1 { - type Output; - fn call_once(self, arg: A) -> Self::Output; -} - -impl FnOnce1 for T -where - T: FnOnce(A) -> R, -{ - type Output = R; - fn call_once(self, arg: A) -> R { - self(arg) - } -} - -pub trait FnMut1: FnOnce1 { - fn call_mut(&mut self, arg: A) -> Self::Output; -} - -impl FnMut1 for T -where - T: FnMut(A) -> R, -{ - fn call_mut(&mut self, arg: A) -> R { - self(arg) - } -} - -struct Map(St, F); - -impl Stream for Map -where - St: Stream, - F: FnMut1, -{ - type Item = F::Output; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - todo!() - } -} - -struct FuturesOrdered(PhantomData T::Output>); - -pub struct Buffered(St, FuturesOrdered, usize) -where - St::Item: Future; - -impl Stream for Buffered -where - St: Stream, - St::Item: Future, -{ - type Item = ::Output; - - fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - todo!() - } -} - -struct Next<'a, T: ?Sized>(&'a T); - -impl Future for Next<'_, St> { - type Output = Option; - - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - todo!() - } -} - -fn main() { - send(async { - //~^ ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await - }); -} diff --git a/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.stderr deleted file mode 100644 index aa9a22e9e..000000000 --- a/src/test/ui/async-await/drop-tracking-unresolved-typeck-results.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.rs b/src/test/ui/async-await/edition-deny-async-fns-2015.rs deleted file mode 100644 index 6bd6d879a..000000000 --- a/src/test/ui/async-await/edition-deny-async-fns-2015.rs +++ /dev/null @@ -1,38 +0,0 @@ -// edition:2015 - -async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 - -fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015 - -async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015 - async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 -} - -struct Foo {} - -impl Foo { - async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 -} - -trait Bar { - async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 - //~^ ERROR functions in traits cannot be declared `async` -} - -fn main() { - macro_rules! accept_item { ($x:item) => {} } - - accept_item! { - async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 - } - - accept_item! { - impl Foo { - async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 - } - } - - let inside_closure = || { - async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 - }; -} diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr deleted file mode 100644 index ba918eb28..000000000 --- a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr +++ /dev/null @@ -1,98 +0,0 @@ -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:3:1 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:5:12 - | -LL | fn baz() { async fn foo() {} } - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:7:1 - | -LL | async fn async_baz() { - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:8:5 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:14:5 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:18:5 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:36:9 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:26:9 - | -LL | async fn foo() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:31:13 - | -LL | async fn bar() {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/edition-deny-async-fns-2015.rs:18:5 - | -LL | async fn foo() {} - | -----^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error: aborting due to 10 previous errors - -Some errors have detailed explanations: E0670, E0706. -For more information about an error, try `rustc --explain E0670`. diff --git a/src/test/ui/async-await/expansion-in-attrs.rs b/src/test/ui/async-await/expansion-in-attrs.rs deleted file mode 100644 index af77c3463..000000000 --- a/src/test/ui/async-await/expansion-in-attrs.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// edition:2018 - -macro_rules! with_doc { - ($doc: expr) => { - #[doc = $doc] - async fn f() {} - }; -} - -with_doc!(concat!("")); - -fn main() {} diff --git a/src/test/ui/async-await/feature-async-closure.rs b/src/test/ui/async-await/feature-async-closure.rs deleted file mode 100644 index d07116b13..000000000 --- a/src/test/ui/async-await/feature-async-closure.rs +++ /dev/null @@ -1,8 +0,0 @@ -// edition:2018 -// gate-test-async_closure - -fn f() { - let _ = async || {}; //~ ERROR async closures are unstable -} - -fn main() {} diff --git a/src/test/ui/async-await/feature-async-closure.stderr b/src/test/ui/async-await/feature-async-closure.stderr deleted file mode 100644 index 485a838b6..000000000 --- a/src/test/ui/async-await/feature-async-closure.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: async closures are unstable - --> $DIR/feature-async-closure.rs:5:13 - | -LL | let _ = async || {}; - | ^^^^^ - | - = note: see issue #62290 for more information - = help: add `#![feature(async_closure)]` to the crate attributes to enable - = help: to use an async block, remove the `||`: `async {` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/feature-gate-async_fn_in_trait.rs b/src/test/ui/async-await/feature-gate-async_fn_in_trait.rs deleted file mode 100644 index 792f378cb..000000000 --- a/src/test/ui/async-await/feature-gate-async_fn_in_trait.rs +++ /dev/null @@ -1,25 +0,0 @@ -// edition:2021 - -// RPITIT is not enough to allow use of async functions -#![allow(incomplete_features)] -#![feature(return_position_impl_trait_in_trait)] - -trait T { - async fn foo(); //~ ERROR functions in traits cannot be declared `async` -} - -// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also -// feature-gate-return_position_impl_trait_in_trait.rs) -trait T2 { - async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async` -} - -trait T3 { - fn foo() -> impl std::future::Future; -} - -impl T3 for () { - async fn foo() {} //~ ERROR functions in traits cannot be declared `async` -} - -fn main() {} diff --git a/src/test/ui/async-await/feature-gate-async_fn_in_trait.stderr b/src/test/ui/async-await/feature-gate-async_fn_in_trait.stderr deleted file mode 100644 index 2a5fbd1ec..000000000 --- a/src/test/ui/async-await/feature-gate-async_fn_in_trait.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/feature-gate-async_fn_in_trait.rs:8:5 - | -LL | async fn foo(); - | -----^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/feature-gate-async_fn_in_trait.rs:14:5 - | -LL | async fn foo() -> impl Sized; - | -----^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/feature-gate-async_fn_in_trait.rs:22:5 - | -LL | async fn foo() {} - | -----^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0706`. diff --git a/src/test/ui/async-await/feature-self-return-type.rs b/src/test/ui/async-await/feature-self-return-type.rs deleted file mode 100644 index 41f887430..000000000 --- a/src/test/ui/async-await/feature-self-return-type.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -#![feature(impl_trait_projections)] - -// This test checks that we emit the correct borrowck error when `Self` is used as a return type. -// See #61949 for context. - -pub struct Foo<'a> { - pub bar: &'a i32, -} - -impl<'a> Foo<'a> { - pub async fn new(_bar: &'a i32) -> Self { - Foo { - bar: &22 - } - } -} - -pub async fn foo() { - let x = { - let bar = 22; - Foo::new(&bar).await - //~^ ERROR `bar` does not live long enough - }; - drop(x); -} - -fn main() { } diff --git a/src/test/ui/async-await/feature-self-return-type.stderr b/src/test/ui/async-await/feature-self-return-type.stderr deleted file mode 100644 index 892468368..000000000 --- a/src/test/ui/async-await/feature-self-return-type.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0597]: `bar` does not live long enough - --> $DIR/feature-self-return-type.rs:22:18 - | -LL | let x = { - | - borrow later stored here -LL | let bar = 22; -LL | Foo::new(&bar).await - | ^^^^ borrowed value does not live long enough -LL | -LL | }; - | - `bar` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/async-await/futures-api.rs b/src/test/ui/async-await/futures-api.rs deleted file mode 100644 index a7da058de..000000000 --- a/src/test/ui/async-await/futures-api.rs +++ /dev/null @@ -1,61 +0,0 @@ -// run-pass - -// aux-build:arc_wake.rs - -extern crate arc_wake; - -use std::future::Future; -use std::pin::Pin; -use std::sync::{ - Arc, - atomic::{self, AtomicUsize}, -}; -use std::task::{ - Context, Poll, -}; -use arc_wake::ArcWake; - -struct Counter { - wakes: AtomicUsize, -} - -impl ArcWake for Counter { - fn wake(self: Arc) { - Self::wake_by_ref(&self) - } - fn wake_by_ref(arc_self: &Arc) { - arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst); - } -} - -struct MyFuture; - -impl Future for MyFuture { - type Output = (); - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - // Wake twice - let waker = cx.waker(); - waker.wake_by_ref(); - waker.wake_by_ref(); - Poll::Ready(()) - } -} - -fn test_waker() { - let counter = Arc::new(Counter { - wakes: AtomicUsize::new(0), - }); - let waker = ArcWake::into_waker(counter.clone()); - assert_eq!(2, Arc::strong_count(&counter)); - { - let mut context = Context::from_waker(&waker); - assert_eq!(Poll::Ready(()), Pin::new(&mut MyFuture).poll(&mut context)); - assert_eq!(2, counter.wakes.load(atomic::Ordering::SeqCst)); - } - drop(waker); - assert_eq!(1, Arc::strong_count(&counter)); -} - -fn main() { - test_waker(); -} diff --git a/src/test/ui/async-await/generator-desc.rs b/src/test/ui/async-await/generator-desc.rs deleted file mode 100644 index 500812016..000000000 --- a/src/test/ui/async-await/generator-desc.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 -#![feature(async_closure)] -use std::future::Future; - -async fn one() {} -async fn two() {} - -fn fun>(f1: F, f2: F) {} -fn main() { - fun(async {}, async {}); - //~^ ERROR mismatched types - fun(one(), two()); - //~^ ERROR mismatched types - fun((async || {})(), (async || {})()); - //~^ ERROR mismatched types -} diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr deleted file mode 100644 index 1686153ac..000000000 --- a/src/test/ui/async-await/generator-desc.stderr +++ /dev/null @@ -1,66 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/generator-desc.rs:10:19 - | -LL | fun(async {}, async {}); - | -------- ^^^^^^^^ - | | | - | | expected `async` block, found a different `async` block - | | arguments to this function are incorrect - | the expected `async` block - | - = note: expected `async` block `[async block@$DIR/generator-desc.rs:10:9: 10:17]` - found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]` -note: function defined here - --> $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn identity_future>(f: Fut) -> Fut { - | ^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/generator-desc.rs:12:16 - | -LL | fun(one(), two()); - | --- ^^^^^ expected opaque type, found a different opaque type - | | - | arguments to this function are incorrect - | -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:5:16 - | -LL | async fn one() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:6:16 - | -LL | async fn two() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:5:16>) - found opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:6:16>) - = help: consider `await`ing on both `Future`s - = note: distinct uses of `impl Trait` result in different opaque types -note: function defined here - --> $DIR/generator-desc.rs:8:4 - | -LL | fn fun>(f1: F, f2: F) {} - | ^^^ ----- - -error[E0308]: mismatched types - --> $DIR/generator-desc.rs:14:26 - | -LL | fun((async || {})(), (async || {})()); - | --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body - | | | - | | the expected `async` closure body - | arguments to this function are incorrect - | - = note: expected `async` closure body `[async closure body@$DIR/generator-desc.rs:14:19: 14:21]` - found `async` closure body `[async closure body@$DIR/generator-desc.rs:14:36: 14:38]` -note: function defined here - --> $DIR/generator-desc.rs:8:4 - | -LL | fn fun>(f1: F, f2: F) {} - | ^^^ ----- - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/generator-not-future.rs b/src/test/ui/async-await/generator-not-future.rs deleted file mode 100644 index 37d7cfa6f..000000000 --- a/src/test/ui/async-await/generator-not-future.rs +++ /dev/null @@ -1,45 +0,0 @@ -// edition:2018 -#![feature(generators, generator_trait)] - -use std::future::Future; -use std::ops::Generator; - -async fn async_fn() {} -fn returns_async_block() -> impl Future { - async {} -} -fn returns_generator() -> impl Generator<(), Yield = (), Return = ()> { - || { - let _: () = yield (); - } -} - -fn takes_future(_f: impl Future) {} -fn takes_generator(_g: impl Generator) {} - -fn main() { - // okay: - takes_future(async_fn()); - takes_future(returns_async_block()); - takes_future(async {}); - takes_generator(returns_generator()); - takes_generator(|| { - let _: () = yield (); - }); - - // async futures are not generators: - takes_generator(async_fn()); - //~^ ERROR the trait bound - takes_generator(returns_async_block()); - //~^ ERROR the trait bound - takes_generator(async {}); - //~^ ERROR the trait bound - - // generators are not futures: - takes_future(returns_generator()); - //~^ ERROR is not a future - takes_future(|ctx| { - //~^ ERROR is not a future - ctx = yield (); - }); -} diff --git a/src/test/ui/async-await/generator-not-future.stderr b/src/test/ui/async-await/generator-not-future.stderr deleted file mode 100644 index 1b81b461f..000000000 --- a/src/test/ui/async-await/generator-not-future.stderr +++ /dev/null @@ -1,81 +0,0 @@ -error[E0277]: the trait bound `impl Future: Generator<_>` is not satisfied - --> $DIR/generator-not-future.rs:31:21 - | -LL | takes_generator(async_fn()); - | --------------- ^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future` - | | - | required by a bound introduced by this call - | -note: required by a bound in `takes_generator` - --> $DIR/generator-not-future.rs:18:39 - | -LL | fn takes_generator(_g: impl Generator) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` - -error[E0277]: the trait bound `impl Future: Generator<_>` is not satisfied - --> $DIR/generator-not-future.rs:33:21 - | -LL | takes_generator(returns_async_block()); - | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future` - | | - | required by a bound introduced by this call - | -note: required by a bound in `takes_generator` - --> $DIR/generator-not-future.rs:18:39 - | -LL | fn takes_generator(_g: impl Generator) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` - -error[E0277]: the trait bound `[async block@$DIR/generator-not-future.rs:35:21: 35:29]: Generator<_>` is not satisfied - --> $DIR/generator-not-future.rs:35:21 - | -LL | takes_generator(async {}); - | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `[async block@$DIR/generator-not-future.rs:35:21: 35:29]` - | | - | required by a bound introduced by this call - | -note: required by a bound in `takes_generator` - --> $DIR/generator-not-future.rs:18:39 - | -LL | fn takes_generator(_g: impl Generator) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` - -error[E0277]: `impl Generator` is not a future - --> $DIR/generator-not-future.rs:39:18 - | -LL | takes_future(returns_generator()); - | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Generator` is not a future - | | - | required by a bound introduced by this call - | - = help: the trait `Future` is not implemented for `impl Generator` - = note: impl Generator must be a future or must implement `IntoFuture` to be awaited -note: required by a bound in `takes_future` - --> $DIR/generator-not-future.rs:17:26 - | -LL | fn takes_future(_f: impl Future) {} - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` - -error[E0277]: `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future - --> $DIR/generator-not-future.rs:41:18 - | -LL | takes_future(|ctx| { - | _____------------_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | ctx = yield (); -LL | | }); - | |_____^ `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future - | - = help: the trait `Future` is not implemented for `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` - = note: [generator@$DIR/generator-not-future.rs:41:18: 41:23] must be a future or must implement `IntoFuture` to be awaited -note: required by a bound in `takes_future` - --> $DIR/generator-not-future.rs:17:26 - | -LL | fn takes_future(_f: impl Future) {} - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/generics-and-bounds.rs b/src/test/ui/async-await/generics-and-bounds.rs deleted file mode 100644 index 963b19b34..000000000 --- a/src/test/ui/async-await/generics-and-bounds.rs +++ /dev/null @@ -1,88 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 -// compile-flags: --crate-type lib - -use std::future::Future; - -pub async fn simple_generic() {} - -pub trait Foo { - fn foo(&self) {} -} - -struct FooType; -impl Foo for FooType {} - -pub async fn call_generic_bound(f: F) { - f.foo() -} - -pub async fn call_where_clause(f: F) -where - F: Foo, -{ - f.foo() -} - -pub async fn call_impl_trait(f: impl Foo) { - f.foo() -} - -pub async fn call_with_ref(f: &impl Foo) { - f.foo() -} - -pub fn async_fn_with_same_generic_params_unifies() { - let mut a = call_generic_bound(FooType); - a = call_generic_bound(FooType); - - let mut b = call_where_clause(FooType); - b = call_where_clause(FooType); - - let mut c = call_impl_trait(FooType); - c = call_impl_trait(FooType); - - let f_one = FooType; - let f_two = FooType; - let mut d = call_with_ref(&f_one); - d = call_with_ref(&f_two); -} - -pub fn simple_generic_block() -> impl Future { - async move {} -} - -pub fn call_generic_bound_block(f: F) -> impl Future { - async move { f.foo() } -} - -pub fn call_where_clause_block(f: F) -> impl Future -where - F: Foo, -{ - async move { f.foo() } -} - -pub fn call_impl_trait_block(f: impl Foo) -> impl Future { - async move { f.foo() } -} - -pub fn call_with_ref_block<'a>(f: &'a (impl Foo + 'a)) -> impl Future + 'a { - async move { f.foo() } -} - -pub fn async_block_with_same_generic_params_unifies() { - let mut a = call_generic_bound_block(FooType); - a = call_generic_bound_block(FooType); - - let mut b = call_where_clause_block(FooType); - b = call_where_clause_block(FooType); - - let mut c = call_impl_trait_block(FooType); - c = call_impl_trait_block(FooType); - - let f_one = FooType; - let f_two = FooType; - let mut d = call_with_ref_block(&f_one); - d = call_with_ref_block(&f_two); -} diff --git a/src/test/ui/async-await/in-trait/async-associated-types.rs b/src/test/ui/async-await/in-trait/async-associated-types.rs deleted file mode 100644 index 974f5aaff..000000000 --- a/src/test/ui/async-await/in-trait/async-associated-types.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(impl_trait_projections)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b { - type MyAssoc; - - async fn foo(&'a self, key: &'b T) -> Self::MyAssoc; -} - -impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U { - type MyAssoc = (&'a U, &'b T); - - async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) { - (self, key) - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-associated-types2.rs b/src/test/ui/async-await/in-trait/async-associated-types2.rs deleted file mode 100644 index e546a0579..000000000 --- a/src/test/ui/async-await/in-trait/async-associated-types2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(type_alias_impl_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - type Fut<'a>: Future - where - Self: 'a; - - fn foo<'a>(&'a self) -> Self::Fut<'a>; -} - -impl MyTrait for i32 { - type Fut<'a> = impl Future + 'a - where - Self: 'a; - - fn foo<'a>(&'a self) -> Self::Fut<'a> { - async { - *self - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs deleted file mode 100644 index 38ba29718..000000000 --- a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; -use std::pin::Pin; - -trait MyTrait { - fn foo(&self) -> Pin + '_>>; -} - -impl MyTrait for i32 { - async fn foo(&self) -> i32 { - //~^ ERROR method `foo` has an incompatible type for trait - *self - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr deleted file mode 100644 index 22d2928f2..000000000 --- a/src/test/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28 - | -LL | async fn foo(&self) -> i32 { - | ^^^ expected struct `Pin`, found opaque type - | -note: type in trait - --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22 - | -LL | fn foo(&self) -> Pin + '_>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected fn pointer `fn(&i32) -> Pin>>` - found fn pointer `fn(&i32) -> impl Future` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs b/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs deleted file mode 100644 index 61d7e2520..000000000 --- a/src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; -use std::pin::Pin; - -trait MyTrait { - async fn foo(&self) -> i32; -} - -impl MyTrait for i32 { - // This will break once a PR that implements #102745 is merged - fn foo(&self) -> Pin + '_>> { - Box::pin(async { - *self - }) - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs deleted file mode 100644 index feeda719e..000000000 --- a/src/test/ui/async-await/in-trait/async-example-desugared-in-trait.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - fn foo(&self) -> impl Future + '_; -} - -impl MyTrait for i32 { - // This will break once a PR that implements #102745 is merged - async fn foo(&self) -> i32 { - *self - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-example-desugared.rs b/src/test/ui/async-await/in-trait/async-example-desugared.rs deleted file mode 100644 index 1313c9edd..000000000 --- a/src/test/ui/async-await/in-trait/async-example-desugared.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - async fn foo(&self) -> i32; -} - -impl MyTrait for i32 { - // This will break once a PR that implements #102745 is merged - fn foo(&self) -> impl Future + '_ { - async { - *self - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-example.rs b/src/test/ui/async-await/in-trait/async-example.rs deleted file mode 100644 index abf94ef74..000000000 --- a/src/test/ui/async-await/in-trait/async-example.rs +++ /dev/null @@ -1,32 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait { - async fn foo(&self) -> i32; - async fn bar(&self) -> i32; -} - -impl MyTrait for i32 { - async fn foo(&self) -> i32 { - *self - } - - async fn bar(&self) -> i32 { - self.foo().await - } -} - -fn main() { - let x = 5; - // Calling from non-async context - let _ = x.foo(); - let _ = x.bar(); - // Calling from async block in non-async context - async { - let _: i32 = x.foo().await; - let _: i32 = x.bar().await; - }; -} diff --git a/src/test/ui/async-await/in-trait/async-generics-and-bounds.rs b/src/test/ui/async-await/in-trait/async-generics-and-bounds.rs deleted file mode 100644 index a73d55adf..000000000 --- a/src/test/ui/async-await/in-trait/async-generics-and-bounds.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-fail -// known-bug: #102682 -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; -use std::hash::Hash; - -trait MyTrait { - async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; -} - -impl MyTrait for (T, U) { - async fn foo(&self) -> &(T, U) { - self - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr b/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr deleted file mode 100644 index f1f0d7e59..000000000 --- a/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics-and-bounds.rs:12:28 - | -LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0311`. diff --git a/src/test/ui/async-await/in-trait/async-generics.rs b/src/test/ui/async-await/in-trait/async-generics.rs deleted file mode 100644 index 67000e577..000000000 --- a/src/test/ui/async-await/in-trait/async-generics.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-fail -// known-bug: #102682 -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait { - async fn foo(&self) -> &(T, U); -} - -impl MyTrait for (T, U) { - async fn foo(&self) -> &(T, U) { - self - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-generics.stderr b/src/test/ui/async-await/in-trait/async-generics.stderr deleted file mode 100644 index 2f0556456..000000000 --- a/src/test/ui/async-await/in-trait/async-generics.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics.rs:9:18 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/async-generics.rs:9:18 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^ -note: ...so that the reference type `&(T, U)` does not outlive the data it points at - --> $DIR/async-generics.rs:9:28 - | -LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0311`. diff --git a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs deleted file mode 100644 index d5481d277..000000000 --- a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait MyTrait<'a, 'b, T> { - async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized; -} - -impl<'a, 'b, T, U> MyTrait<'a, 'b, T> for U { - async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) { - (self, key) - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-lifetimes.rs b/src/test/ui/async-await/in-trait/async-lifetimes.rs deleted file mode 100644 index f298e45d2..000000000 --- a/src/test/ui/async-await/in-trait/async-lifetimes.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait<'a, 'b, T> { - async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); -} - -impl<'a, 'b, T, U> MyTrait<'a, 'b, T> for U { - async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) { - (self, key) - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-recursive-generic.rs b/src/test/ui/async-await/in-trait/async-recursive-generic.rs deleted file mode 100644 index 6839abd38..000000000 --- a/src/test/ui/async-await/in-trait/async-recursive-generic.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait { - async fn foo_recursive(&self, n: usize) -> T; -} - -impl MyTrait for T where T: Copy { - async fn foo_recursive(&self, n: usize) -> T { - //~^ ERROR recursion in an `async fn` requires boxing - if n > 0 { - self.foo_recursive(n - 1).await - } else { - *self - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-recursive-generic.stderr b/src/test/ui/async-await/in-trait/async-recursive-generic.stderr deleted file mode 100644 index cab173bdd..000000000 --- a/src/test/ui/async-await/in-trait/async-recursive-generic.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/async-recursive-generic.rs:11:48 - | -LL | async fn foo_recursive(&self, n: usize) -> T { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/src/test/ui/async-await/in-trait/async-recursive.rs b/src/test/ui/async-await/in-trait/async-recursive.rs deleted file mode 100644 index 61119f809..000000000 --- a/src/test/ui/async-await/in-trait/async-recursive.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait { - async fn foo_recursive(&self, n: usize) -> i32; -} - -impl MyTrait for i32 { - async fn foo_recursive(&self, n: usize) -> i32 { - //~^ ERROR recursion in an `async fn` requires boxing - if n > 0 { - self.foo_recursive(n - 1).await - } else { - *self - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/async-recursive.stderr b/src/test/ui/async-await/in-trait/async-recursive.stderr deleted file mode 100644 index 9feff37b3..000000000 --- a/src/test/ui/async-await/in-trait/async-recursive.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/async-recursive.rs:11:48 - | -LL | async fn foo_recursive(&self, n: usize) -> i32 { - | ^^^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/src/test/ui/async-await/in-trait/early-bound-1.rs b/src/test/ui/async-await/in-trait/early-bound-1.rs deleted file mode 100644 index 6b3b14201..000000000 --- a/src/test/ui/async-await/in-trait/early-bound-1.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -pub trait Foo { - async fn foo(&mut self); -} - -struct MyFoo<'a>(&'a mut ()); - -impl<'a> Foo for MyFoo<'a> { - async fn foo(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/early-bound-2.rs b/src/test/ui/async-await/in-trait/early-bound-2.rs deleted file mode 100644 index 270443229..000000000 --- a/src/test/ui/async-await/in-trait/early-bound-2.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -pub trait Foo { - async fn foo(&mut self); -} - -impl Foo for &mut T { - async fn foo(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/fn-not-async-err.rs b/src/test/ui/async-await/in-trait/fn-not-async-err.rs deleted file mode 100644 index f94d32145..000000000 --- a/src/test/ui/async-await/in-trait/fn-not-async-err.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait MyTrait { - async fn foo(&self) -> i32; -} - -impl MyTrait for i32 { - fn foo(&self) -> i32 { - //~^ ERROR: `i32` is not a future [E0277] - *self - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/fn-not-async-err.stderr b/src/test/ui/async-await/in-trait/fn-not-async-err.stderr deleted file mode 100644 index 03321dc5b..000000000 --- a/src/test/ui/async-await/in-trait/fn-not-async-err.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0277]: `i32` is not a future - --> $DIR/fn-not-async-err.rs:11:22 - | -LL | fn foo(&self) -> i32 { - | ^^^ `i32` is not a future - | - = help: the trait `Future` is not implemented for `i32` - = note: i32 must be a future or must implement `IntoFuture` to be awaited -note: required by a bound in `MyTrait::foo::{opaque#0}` - --> $DIR/fn-not-async-err.rs:7:28 - | -LL | async fn foo(&self) -> i32; - | ^^^ required by this bound in `MyTrait::foo::{opaque#0}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/in-trait/fn-not-async-err2.rs b/src/test/ui/async-await/in-trait/fn-not-async-err2.rs deleted file mode 100644 index 594baa91a..000000000 --- a/src/test/ui/async-await/in-trait/fn-not-async-err2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - async fn foo(&self) -> i32; -} - -impl MyTrait for i32 { - fn foo(&self) -> impl Future { - //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562] - async { - *self - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/fn-not-async-err2.stderr b/src/test/ui/async-await/in-trait/fn-not-async-err2.stderr deleted file mode 100644 index f591f1847..000000000 --- a/src/test/ui/async-await/in-trait/fn-not-async-err2.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return - --> $DIR/fn-not-async-err2.rs:13:22 - | -LL | fn foo(&self) -> impl Future { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/async-await/in-trait/implied-bounds.rs b/src/test/ui/async-await/in-trait/implied-bounds.rs deleted file mode 100644 index 52bceb3cc..000000000 --- a/src/test/ui/async-await/in-trait/implied-bounds.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait TcpStack { - type Connection<'a>: Sized where Self: 'a; - fn connect<'a>(&'a self) -> Self::Connection<'a>; - async fn async_connect<'a>(&'a self) -> Self::Connection<'a>; -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/issue-102138.rs b/src/test/ui/async-await/in-trait/issue-102138.rs deleted file mode 100644 index f61b34ed9..000000000 --- a/src/test/ui/async-await/in-trait/issue-102138.rs +++ /dev/null @@ -1,46 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -async fn yield_now() {} - -trait AsyncIterator { - type Item; - async fn next(&mut self) -> Option; -} - -struct YieldingRange { - counter: u32, - stop: u32, -} - -impl AsyncIterator for YieldingRange { - type Item = u32; - - async fn next(&mut self) -> Option { - if self.counter == self.stop { - None - } else { - let c = self.counter; - self.counter += 1; - yield_now().await; - Some(c) - } - } -} - -async fn async_main() { - let mut x = YieldingRange { counter: 0, stop: 10 }; - - while let Some(v) = x.next().await { - println!("Hi: {v}"); - } -} - -fn main() { - let _ = async_main(); -} diff --git a/src/test/ui/async-await/in-trait/issue-102219.rs b/src/test/ui/async-await/in-trait/issue-102219.rs deleted file mode 100644 index 9a35f6515..000000000 --- a/src/test/ui/async-await/in-trait/issue-102219.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags:--crate-type=lib -// edition:2021 -// check-pass - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -trait T { - async fn foo(); -} diff --git a/src/test/ui/async-await/in-trait/issue-102310.rs b/src/test/ui/async-await/in-trait/issue-102310.rs deleted file mode 100644 index 49c3e9fee..000000000 --- a/src/test/ui/async-await/in-trait/issue-102310.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait)] -#![allow(incomplete_features)] - -pub trait SpiDevice { - async fn transaction(&mut self); -} - -impl SpiDevice for () { - async fn transaction(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/lifetime-mismatch.rs b/src/test/ui/async-await/in-trait/lifetime-mismatch.rs deleted file mode 100644 index 45ede193c..000000000 --- a/src/test/ui/async-await/in-trait/lifetime-mismatch.rs +++ /dev/null @@ -1,20 +0,0 @@ -// edition:2021 - -#![feature(async_fn_in_trait)] -//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - -trait MyTrait { - async fn foo<'a>(&self); - async fn bar(&self); -} - -impl MyTrait for i32 { - async fn foo(&self) {} - //~^ ERROR lifetime parameters or bounds on method `foo` do not match the trait declaration - - async fn bar(&self) { - self.foo(); - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr b/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr deleted file mode 100644 index d87adcc78..000000000 --- a/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr +++ /dev/null @@ -1,21 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/lifetime-mismatch.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration - --> $DIR/lifetime-mismatch.rs:12:17 - | -LL | async fn foo<'a>(&self); - | ---- lifetimes in impl do not match this method in trait -... -LL | async fn foo(&self) {} - | ^ lifetimes do not match method in trait - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0195`. diff --git a/src/test/ui/async-await/in-trait/nested-rpit.rs b/src/test/ui/async-await/in-trait/nested-rpit.rs deleted file mode 100644 index 41d72ebb4..000000000 --- a/src/test/ui/async-await/in-trait/nested-rpit.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition: 2021 -// known-bug: #105197 -// failure-status:101 -// dont-check-compiler-stderr - -#![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; -use std::marker::PhantomData; - -trait Lockable { - async fn lock_all_entries(&self) -> impl Future>; -} - -struct Guard<'a>(PhantomData<&'a ()>); - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/object-safety.rs b/src/test/ui/async-await/in-trait/object-safety.rs deleted file mode 100644 index a8bc35f7e..000000000 --- a/src/test/ui/async-await/in-trait/object-safety.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2021 - -#![feature(async_fn_in_trait)] -//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - -trait Foo { - async fn foo(&self); -} - -fn main() { - let x: &dyn Foo = todo!(); - //~^ ERROR the trait `Foo` cannot be made into an object -} diff --git a/src/test/ui/async-await/in-trait/object-safety.stderr b/src/test/ui/async-await/in-trait/object-safety.stderr deleted file mode 100644 index 0b318f71f..000000000 --- a/src/test/ui/async-await/in-trait/object-safety.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/object-safety.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:11:12 - | -LL | let x: &dyn Foo = todo!(); - | ^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:14 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | async fn foo(&self); - | ^^^ ...because method `foo` is `async` - = help: consider moving `foo` to another trait - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/async-await/in-trait/return-type-suggestion.rs b/src/test/ui/async-await/in-trait/return-type-suggestion.rs deleted file mode 100644 index 3446761d1..000000000 --- a/src/test/ui/async-await/in-trait/return-type-suggestion.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition: 2021 - -#![feature(async_fn_in_trait)] -//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - -trait A { - async fn e() { - Ok(()) - //~^ ERROR mismatched types - //~| HELP consider using a semicolon here - } -} - -fn main() {} diff --git a/src/test/ui/async-await/in-trait/return-type-suggestion.stderr b/src/test/ui/async-await/in-trait/return-type-suggestion.stderr deleted file mode 100644 index 5a9b15e54..000000000 --- a/src/test/ui/async-await/in-trait/return-type-suggestion.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/return-type-suggestion.rs:3:12 - | -LL | #![feature(async_fn_in_trait)] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #91611 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0308]: mismatched types - --> $DIR/return-type-suggestion.rs:8:9 - | -LL | Ok(()) - | ^^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found enum `Result` - | - = note: expected unit type `()` - found enum `Result<(), _>` - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.fixed b/src/test/ui/async-await/incorrect-move-async-order-issue-79694.fixed deleted file mode 100644 index 055800d23..000000000 --- a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.fixed +++ /dev/null @@ -1,8 +0,0 @@ -// run-rustfix -// edition:2018 - -// Regression test for issue 79694 - -fn main() { - let _ = async move { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect -} diff --git a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.rs b/src/test/ui/async-await/incorrect-move-async-order-issue-79694.rs deleted file mode 100644 index e8be16516..000000000 --- a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-rustfix -// edition:2018 - -// Regression test for issue 79694 - -fn main() { - let _ = move async { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect -} diff --git a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.stderr b/src/test/ui/async-await/incorrect-move-async-order-issue-79694.stderr deleted file mode 100644 index 5367b986d..000000000 --- a/src/test/ui/async-await/incorrect-move-async-order-issue-79694.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: the order of `move` and `async` is incorrect - --> $DIR/incorrect-move-async-order-issue-79694.rs:7:13 - | -LL | let _ = move async { }; - | ^^^^^^^^^^ - | -help: try switching the order - | -LL | let _ = async move { }; - | ~~~~~~~~~~ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/interior-with-const-generic-expr.rs b/src/test/ui/async-await/interior-with-const-generic-expr.rs deleted file mode 100644 index 86ba7582d..000000000 --- a/src/test/ui/async-await/interior-with-const-generic-expr.rs +++ /dev/null @@ -1,26 +0,0 @@ -// edition:2018 -// run-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] -#![allow(unused)] - -fn main() { - let x = test(); -} - -fn concat(a: [f32; A], b: [f32; B]) -> [f32; A + B] { - todo!() -} - -async fn reverse(x: [f32; A]) -> [f32; A] { - todo!() -} - -async fn test() { - let a = [0.0]; - let b = [1.0, 2.0]; - let ab = concat(a,b); - let ba = reverse(ab).await; - println!("{:?}", ba); -} diff --git a/src/test/ui/async-await/issue-101715.rs b/src/test/ui/async-await/issue-101715.rs deleted file mode 100644 index 1be5d0248..000000000 --- a/src/test/ui/async-await/issue-101715.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 - -struct S; - -impl S { - fn very_long_method_name_the_longest_method_name_in_the_whole_universe(self) {} -} - -async fn foo() { - S.very_long_method_name_the_longest_method_name_in_the_whole_universe() - .await - //~^ error: `()` is not a future - //~| help: remove the `.await` - //~| help: the trait `Future` is not implemented for `()` -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-101715.stderr b/src/test/ui/async-await/issue-101715.stderr deleted file mode 100644 index a0e8d2a89..000000000 --- a/src/test/ui/async-await/issue-101715.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/issue-101715.rs:11:9 - | -LL | .await - | ^^^^^^ - | | - | `()` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required for `()` to implement `IntoFuture` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-107036.rs b/src/test/ui/async-await/issue-107036.rs deleted file mode 100644 index 6a22de2c9..000000000 --- a/src/test/ui/async-await/issue-107036.rs +++ /dev/null @@ -1,14 +0,0 @@ -// aux-build:issue-107036.rs -// edition:2021 -// check-pass - -extern crate issue_107036; -use issue_107036::S; - -async fn f() { - S{}.f().await; -} - -fn main() { - let _ = f(); -} diff --git a/src/test/ui/async-await/issue-54239-private-type-triggers-lint.rs b/src/test/ui/async-await/issue-54239-private-type-triggers-lint.rs deleted file mode 100644 index 16cf7ad52..000000000 --- a/src/test/ui/async-await/issue-54239-private-type-triggers-lint.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Regression test for #54239, shouldn't trigger lint. -// check-pass -// edition:2018 - -#![deny(missing_debug_implementations)] - -struct DontLookAtMe(i32); - -async fn secret() -> DontLookAtMe { - DontLookAtMe(41) -} - -pub async fn looking() -> i32 { // Shouldn't trigger lint here. - secret().await.0 -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-60709.rs b/src/test/ui/async-await/issue-60709.rs deleted file mode 100644 index 61f6ed1b7..000000000 --- a/src/test/ui/async-await/issue-60709.rs +++ /dev/null @@ -1,28 +0,0 @@ -// This used to compile the future down to ud2, due to uninhabited types being -// handled incorrectly in generators. -// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018 - -// run-pass -// ignore-asmjs wasm2js does not support source maps yet - -use std::future::Future; -use std::task::Poll; -use std::task::Context; -use std::pin::Pin; -use std::rc::Rc; - -struct Never(); -impl Future for Never { - type Output = (); - fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { - Poll::Pending - } -} - -fn main() { - let fut = async { - let _rc = Rc::new(()); // Also crashes with Arc - Never().await; - }; - let _bla = fut; // Moving the future is required. -} diff --git a/src/test/ui/async-await/issue-61076.rs b/src/test/ui/async-await/issue-61076.rs deleted file mode 100644 index 750fad839..000000000 --- a/src/test/ui/async-await/issue-61076.rs +++ /dev/null @@ -1,97 +0,0 @@ -// edition:2018 - -use core::future::Future; -use core::pin::Pin; -use core::task::{Context, Poll}; - -struct T; - -struct Tuple(i32); - -struct Struct { - a: i32 -} - -impl Struct { - fn method(&self) {} -} - -impl Future for Struct { - type Output = Struct; - fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { Poll::Pending } -} - -impl Future for Tuple { - type Output = Tuple; - fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { Poll::Pending } -} - -impl Future for T { - type Output = Result<(), ()>; - - fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { - Poll::Pending - } -} - -async fn foo() -> Result<(), ()> { - Ok(()) -} - -async fn bar() -> Result<(), ()> { - foo()?; //~ ERROR the `?` operator can only be applied to values that implement `Try` - //~^ NOTE the `?` operator cannot be applied to type `impl Future>` - //~| HELP the trait `Try` is not implemented for `impl Future>` - //~| HELP consider `await`ing on the `Future` - //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` - Ok(()) -} - -async fn struct_() -> Struct { - Struct { a: 1 } -} - -async fn tuple() -> Tuple { - //~^ NOTE checked the `Output` of this `async fn`, expected opaque type - //~| NOTE while checking the return type of the `async fn` - //~| NOTE in this expansion of desugaring of `async` block or function - Tuple(1i32) -} - -async fn baz() -> Result<(), ()> { - let t = T; - t?; //~ ERROR the `?` operator can only be applied to values that implement `Try` - //~^ NOTE the `?` operator cannot be applied to type `T` - //~| HELP the trait `Try` is not implemented for `T` - //~| HELP consider `await`ing on the `Future` - //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` - - - let _: i32 = tuple().0; //~ ERROR no field `0` - //~^ HELP consider `await`ing on the `Future` - //~| NOTE field not available in `impl Future` - - let _: i32 = struct_().a; //~ ERROR no field `a` - //~^ HELP consider `await`ing on the `Future` - //~| NOTE field not available in `impl Future` - - struct_().method(); //~ ERROR no method named - //~^ NOTE method not found in `impl Future` - //~| HELP consider `await`ing on the `Future` - Ok(()) -} - -async fn match_() { - match tuple() { //~ HELP consider `await`ing on the `Future` - //~^ NOTE this expression has type `impl Future` - Tuple(_) => {} //~ ERROR mismatched types - //~^ NOTE expected opaque type, found struct `Tuple` - //~| NOTE expected opaque type `impl Future` - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-61076.stderr b/src/test/ui/async-await/issue-61076.stderr deleted file mode 100644 index 33839ea59..000000000 --- a/src/test/ui/async-await/issue-61076.stderr +++ /dev/null @@ -1,82 +0,0 @@ -error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-61076.rs:42:5 - | -LL | foo()?; - | ^^^^^^ the `?` operator cannot be applied to type `impl Future>` - | - = help: the trait `Try` is not implemented for `impl Future>` -help: consider `await`ing on the `Future` - | -LL | foo().await?; - | ++++++ - -error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-61076.rs:65:5 - | -LL | t?; - | ^^ the `?` operator cannot be applied to type `T` - | - = help: the trait `Try` is not implemented for `T` -help: consider `await`ing on the `Future` - | -LL | t.await?; - | ++++++ - -error[E0609]: no field `0` on type `impl Future` - --> $DIR/issue-61076.rs:74:26 - | -LL | let _: i32 = tuple().0; - | ^ field not available in `impl Future`, but it is available in its `Output` - | -help: consider `await`ing on the `Future` and access the field of its `Output` - | -LL | let _: i32 = tuple().await.0; - | ++++++ - -error[E0609]: no field `a` on type `impl Future` - --> $DIR/issue-61076.rs:78:28 - | -LL | let _: i32 = struct_().a; - | ^ field not available in `impl Future`, but it is available in its `Output` - | -help: consider `await`ing on the `Future` and access the field of its `Output` - | -LL | let _: i32 = struct_().await.a; - | ++++++ - -error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope - --> $DIR/issue-61076.rs:82:15 - | -LL | struct_().method(); - | ^^^^^^ method not found in `impl Future` - | -help: consider `await`ing on the `Future` and calling the method on its `Output` - | -LL | struct_().await.method(); - | ++++++ - -error[E0308]: mismatched types - --> $DIR/issue-61076.rs:91:9 - | -LL | match tuple() { - | ------- this expression has type `impl Future` -LL | -LL | Tuple(_) => {} - | ^^^^^^^^ expected opaque type, found struct `Tuple` - | -note: while checking the return type of the `async fn` - --> $DIR/issue-61076.rs:56:21 - | -LL | async fn tuple() -> Tuple { - | ^^^^^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future` - found struct `Tuple` -help: consider `await`ing on the `Future` - | -LL | match tuple().await { - | ++++++ - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0277, E0308, E0599, E0609. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-61452.rs b/src/test/ui/async-await/issue-61452.rs deleted file mode 100644 index 9381251ad..000000000 --- a/src/test/ui/async-await/issue-61452.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 - -pub async fn f(x: Option) { - x.take(); - //~^ ERROR cannot borrow `x` as mutable, as it is not declared as mutable [E0596] -} - -pub async fn g(x: usize) { - x += 1; - //~^ ERROR cannot assign twice to immutable variable `x` [E0384] -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-61452.stderr b/src/test/ui/async-await/issue-61452.stderr deleted file mode 100644 index 2d3bb48e0..000000000 --- a/src/test/ui/async-await/issue-61452.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-61452.rs:4:5 - | -LL | pub async fn f(x: Option) { - | - help: consider changing this to be mutable: `mut x` -LL | x.take(); - | ^^^^^^^^ cannot borrow as mutable - -error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/issue-61452.rs:9:5 - | -LL | pub async fn g(x: usize) { - | - - | | - | first assignment to `x` - | help: consider making this binding mutable: `mut x` -LL | x += 1; - | ^^^^^^ cannot assign twice to immutable variable - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0384, E0596. -For more information about an error, try `rustc --explain E0384`. diff --git a/src/test/ui/async-await/issue-61793.rs b/src/test/ui/async-await/issue-61793.rs deleted file mode 100644 index 9180e1d81..000000000 --- a/src/test/ui/async-await/issue-61793.rs +++ /dev/null @@ -1,16 +0,0 @@ -// This testcase used to ICE in codegen due to inconsistent field reordering -// in the generator state, claiming a ZST field was after a non-ZST field, -// while those two fields were at the same offset (which is impossible). -// That is, memory ordering of `(X, ())`, but offsets of `((), X)`. - -// build-pass -// edition:2018 - -async fn foo(_: &(), _: F) {} - -fn main() { - foo(&(), || {}); - async { - foo(&(), || {}).await; - }; -} diff --git a/src/test/ui/async-await/issue-61949-self-return-type.rs b/src/test/ui/async-await/issue-61949-self-return-type.rs deleted file mode 100644 index d73dbc6e8..000000000 --- a/src/test/ui/async-await/issue-61949-self-return-type.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -// gate-test-impl_trait_projections - -// This test checks that `Self` is prohibited as a return type. See #61949 for context. - -pub struct Foo<'a> { - pub bar: &'a i32, -} - -impl<'a> Foo<'a> { - pub async fn new(_bar: &'a i32) -> Self { - //~^ ERROR `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - Foo { - bar: &22 - } - } -} - -async fn foo() { - let x = { - let bar = 22; - Foo::new(&bar).await - //~^ ERROR `bar` does not live long enough - }; - drop(x); -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-61949-self-return-type.stderr b/src/test/ui/async-await/issue-61949-self-return-type.stderr deleted file mode 100644 index 638b197bc..000000000 --- a/src/test/ui/async-await/issue-61949-self-return-type.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/issue-61949-self-return-type.rs:11:40 - | -LL | pub async fn new(_bar: &'a i32) -> Self { - | ^^^^ help: consider spelling out the type instead: `Foo<'a>` - | - = note: see issue #103532 for more information - = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable - -error[E0597]: `bar` does not live long enough - --> $DIR/issue-61949-self-return-type.rs:22:18 - | -LL | let x = { - | - borrow later stored here -LL | let bar = 22; -LL | Foo::new(&bar).await - | ^^^^ borrowed value does not live long enough -LL | -LL | }; - | - `bar` dropped here while still borrowed - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0597, E0658. -For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/async-await/issue-62658.rs b/src/test/ui/async-await/issue-62658.rs deleted file mode 100644 index d0af01e0c..000000000 --- a/src/test/ui/async-await/issue-62658.rs +++ /dev/null @@ -1,27 +0,0 @@ -// This test created a generator whose size was not rounded to a multiple of its -// alignment. This caused an assertion error in codegen. - -// build-pass -// edition:2018 - -async fn noop() {} - -async fn foo() { - // This suspend should be the largest variant. - { - let x = [0u8; 17]; - noop().await; - println!("{:?}", x); - } - - // Add one variant that's aligned to 8 bytes. - { - let x = 0u64; - noop().await; - println!("{:?}", x); - } -} - -fn main() { - let _ = foo(); -} diff --git a/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs b/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs deleted file mode 100644 index 54059b29f..000000000 --- a/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass -// edition:2018 - -struct Test(String); - -impl Test { - async fn borrow_async(&self) {} - - fn with(&mut self, s: &str) -> &mut Self { - self.0 = s.into(); - self - } -} - -async fn test() { - Test("".to_string()).with("123").borrow_async().await; -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime.rs b/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime.rs deleted file mode 100644 index c5ea2b821..000000000 --- a/src/test/ui/async-await/issue-63832-await-short-temporary-lifetime.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// edition:2018 - -async fn foo(x: &[Vec]) -> u32 { - 0 -} - -async fn bar() { - foo(&[vec![123]]).await; -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-64130-1-sync.rs b/src/test/ui/async-await/issue-64130-1-sync.rs deleted file mode 100644 index 1714cec52..000000000 --- a/src/test/ui/async-await/issue-64130-1-sync.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(negative_impls)] -// edition:2018 - -// This tests the specialized async-await-specific error when futures don't implement an -// auto trait (which is specifically Sync) due to some type that was captured. - -struct Foo; - -impl !Sync for Foo {} - -fn is_sync(t: T) { } - -async fn bar() { - let x = Foo; - baz().await; -} - -async fn baz() { } - -fn main() { - is_sync(bar()); - //~^ ERROR future cannot be shared between threads safely -} diff --git a/src/test/ui/async-await/issue-64130-1-sync.stderr b/src/test/ui/async-await/issue-64130-1-sync.stderr deleted file mode 100644 index e205de473..000000000 --- a/src/test/ui/async-await/issue-64130-1-sync.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:21:13 - | -LL | is_sync(bar()); - | ^^^^^ future returned by `bar` is not `Sync` - | - = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` -note: future is not `Sync` as this value is used across an await - --> $DIR/issue-64130-1-sync.rs:15:10 - | -LL | let x = Foo; - | - has type `Foo` which is not `Sync` -LL | baz().await; - | ^^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_sync` - --> $DIR/issue-64130-1-sync.rs:11:15 - | -LL | fn is_sync(t: T) { } - | ^^^^ required by this bound in `is_sync` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-64130-2-send.rs b/src/test/ui/async-await/issue-64130-2-send.rs deleted file mode 100644 index 7a6e5952c..000000000 --- a/src/test/ui/async-await/issue-64130-2-send.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(negative_impls)] -// edition:2018 - -// This tests the specialized async-await-specific error when futures don't implement an -// auto trait (which is specifically Send) due to some type that was captured. - -struct Foo; - -impl !Send for Foo {} - -fn is_send(t: T) { } - -async fn bar() { - let x = Foo; - baz().await; -} - -async fn baz() { } - -fn main() { - is_send(bar()); - //~^ ERROR future cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/issue-64130-2-send.stderr b/src/test/ui/async-await/issue-64130-2-send.stderr deleted file mode 100644 index 2225000e2..000000000 --- a/src/test/ui/async-await/issue-64130-2-send.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-2-send.rs:21:13 - | -LL | is_send(bar()); - | ^^^^^ future returned by `bar` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Foo` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-2-send.rs:15:10 - | -LL | let x = Foo; - | - has type `Foo` which is not `Send` -LL | baz().await; - | ^^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_send` - --> $DIR/issue-64130-2-send.rs:11:15 - | -LL | fn is_send(t: T) { } - | ^^^^ required by this bound in `is_send` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-64130-3-other.rs b/src/test/ui/async-await/issue-64130-3-other.rs deleted file mode 100644 index 630fb2c41..000000000 --- a/src/test/ui/async-await/issue-64130-3-other.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![feature(auto_traits)] -#![feature(negative_impls)] -// edition:2018 - -// This tests the unspecialized async-await-specific error when futures don't implement an -// auto trait (which is not Send or Sync) due to some type that was captured. - -auto trait Qux {} - -struct Foo; - -impl !Qux for Foo {} - -fn is_qux(t: T) {} - -async fn bar() { - let x = Foo; - baz().await; -} - -async fn baz() {} - -fn main() { - is_qux(bar()); - //~^ ERROR the trait bound `Foo: Qux` is not satisfied in `impl Future` -} diff --git a/src/test/ui/async-await/issue-64130-3-other.stderr b/src/test/ui/async-await/issue-64130-3-other.stderr deleted file mode 100644 index 17867a6a3..000000000 --- a/src/test/ui/async-await/issue-64130-3-other.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` - --> $DIR/issue-64130-3-other.rs:24:12 - | -LL | async fn bar() { - | - within this `impl Future` -... -LL | is_qux(bar()); - | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` - | -note: future does not implement `Qux` as this value is used across an await - --> $DIR/issue-64130-3-other.rs:18:10 - | -LL | let x = Foo; - | - has type `Foo` which does not implement `Qux` -LL | baz().await; - | ^^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_qux` - --> $DIR/issue-64130-3-other.rs:14:14 - | -LL | fn is_qux(t: T) {} - | ^^^ required by this bound in `is_qux` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr deleted file mode 100644 index f609e3636..000000000 --- a/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:19:17 - | -LL | pub fn foo() -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-4-async-move.rs:25:31 - | -LL | match client.status() { - | ------ has type `&Client` which is not `Send` -LL | 200 => { -LL | let _x = get().await; - | ^^^^^^ await occurs here, with `client` maybe used later -... -LL | } - | - `client` is later dropped here -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:23:15 - | -LL | match client.status() { - | ^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr deleted file mode 100644 index f609e3636..000000000 --- a/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:19:17 - | -LL | pub fn foo() -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-4-async-move.rs:25:31 - | -LL | match client.status() { - | ------ has type `&Client` which is not `Send` -LL | 200 => { -LL | let _x = get().await; - | ^^^^^^ await occurs here, with `client` maybe used later -... -LL | } - | - `client` is later dropped here -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:23:15 - | -LL | match client.status() { - | ^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-64130-4-async-move.rs b/src/test/ui/async-await/issue-64130-4-async-move.rs deleted file mode 100644 index a38428fc0..000000000 --- a/src/test/ui/async-await/issue-64130-4-async-move.rs +++ /dev/null @@ -1,32 +0,0 @@ -// edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] check-pass -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no -use std::any::Any; -use std::future::Future; - -struct Client(Box); - -impl Client { - fn status(&self) -> u16 { - 200 - } -} - -async fn get() {} - -pub fn foo() -> impl Future + Send { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely - let client = Client(Box::new(true)); - async move { - match client.status() { - 200 => { - let _x = get().await; - } - _ => (), - } - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-64130-non-send-future-diags.rs b/src/test/ui/async-await/issue-64130-non-send-future-diags.rs deleted file mode 100644 index b652d2391..000000000 --- a/src/test/ui/async-await/issue-64130-non-send-future-diags.rs +++ /dev/null @@ -1,25 +0,0 @@ -// edition:2018 -#![feature(must_not_suspend)] -#![allow(must_not_suspend)] - -// This tests the basic example case for the async-await-specific error. - -use std::sync::Mutex; - -fn is_send(t: T) { } - -async fn foo() { - bar(&Mutex::new(22)).await; -} - -async fn bar(x: &Mutex) { - let g = x.lock().unwrap(); - baz().await; -} - -async fn baz() { } - -fn main() { - is_send(foo()); - //~^ ERROR future cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr b/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr deleted file mode 100644 index 1da80d98b..000000000 --- a/src/test/ui/async-await/issue-64130-non-send-future-diags.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-non-send-future-diags.rs:23:13 - | -LL | is_send(foo()); - | ^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, u32>` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-non-send-future-diags.rs:17:10 - | -LL | let g = x.lock().unwrap(); - | - has type `MutexGuard<'_, u32>` which is not `Send` -LL | baz().await; - | ^^^^^^ await occurs here, with `g` maybe used later -LL | } - | - `g` is later dropped here -note: required by a bound in `is_send` - --> $DIR/issue-64130-non-send-future-diags.rs:9:15 - | -LL | fn is_send(t: T) { } - | ^^^^ required by this bound in `is_send` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-64391.rs b/src/test/ui/async-await/issue-64391.rs deleted file mode 100644 index c6faad3aa..000000000 --- a/src/test/ui/async-await/issue-64391.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Regression test for Issue #64391. The goal here is that this -// function compiles. In the past, due to incorrect drop order for -// temporaries in the tail expression, we failed to compile this -// example. The drop order itself is directly tested in -// `drop-order/drop-order-for-temporary-in-tail-return-expr.rs`. -// -// check-pass -// edition:2018 - -async fn add(x: u32, y: u32) -> u32 { - async { x + y }.await -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-66312.rs b/src/test/ui/async-await/issue-66312.rs deleted file mode 100644 index 9224971ec..000000000 --- a/src/test/ui/async-await/issue-66312.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition:2018 - -trait Test { - fn is_some(self: T); //~ ERROR invalid `self` parameter type -} - -async fn f() { - let x = Some(2); - if x.is_some() { - println!("Some"); - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-66312.stderr b/src/test/ui/async-await/issue-66312.stderr deleted file mode 100644 index 80d294a10..000000000 --- a/src/test/ui/async-await/issue-66312.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0307]: invalid `self` parameter type: T - --> $DIR/issue-66312.rs:4:22 - | -LL | fn is_some(self: T); - | ^ - | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0307`. diff --git a/src/test/ui/async-await/issue-66387-if-without-else.rs b/src/test/ui/async-await/issue-66387-if-without-else.rs deleted file mode 100644 index 3ab8220b4..000000000 --- a/src/test/ui/async-await/issue-66387-if-without-else.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 -async fn f() -> i32 { - if true { //~ ERROR `if` may be missing an `else` clause - return 0; - } - // An `if` block without `else` causes the type table not to have a type for this expr. - // Check that we do not unconditionally access the type table and we don't ICE. -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-66387-if-without-else.stderr b/src/test/ui/async-await/issue-66387-if-without-else.stderr deleted file mode 100644 index 8155fcb56..000000000 --- a/src/test/ui/async-await/issue-66387-if-without-else.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0317]: `if` may be missing an `else` clause - --> $DIR/issue-66387-if-without-else.rs:3:5 - | -LL | / if true { -LL | | return 0; -LL | | } - | |_____^ expected `i32`, found `()` - | - = note: `if` expressions without `else` evaluate to `()` - = help: consider adding an `else` block that evaluates to the expected type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0317`. diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.rs b/src/test/ui/async-await/issue-67252-unnamed-future.rs deleted file mode 100644 index 1a7ff6133..000000000 --- a/src/test/ui/async-await/issue-67252-unnamed-future.rs +++ /dev/null @@ -1,24 +0,0 @@ -// edition:2018 -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; - -fn spawn(_: T) {} - -pub struct AFuture; -impl Future for AFuture{ - type Output = (); - - fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<()> { - unimplemented!() - } -} - -async fn foo() { - spawn(async { //~ ERROR future cannot be sent between threads safely - let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` - AFuture.await; - }); -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr deleted file mode 100644 index fcba4410b..000000000 --- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:18:11 - | -LL | spawn(async { - | ___________^ -LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` -LL | | AFuture.await; -LL | | }); - | |_____^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6]`, the trait `Send` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-67252-unnamed-future.rs:20:16 - | -LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` - | -- has type `*mut ()` which is not `Send` -LL | AFuture.await; - | ^^^^^^ await occurs here, with `_a` maybe used later -LL | }); - | - `_a` is later dropped here -note: required by a bound in `spawn` - --> $DIR/issue-67252-unnamed-future.rs:6:13 - | -LL | fn spawn(_: T) {} - | ^^^^ required by this bound in `spawn` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-67651.rs b/src/test/ui/async-await/issue-67651.rs deleted file mode 100644 index bd96a3b70..000000000 --- a/src/test/ui/async-await/issue-67651.rs +++ /dev/null @@ -1,20 +0,0 @@ -// edition:2018 - -trait From { - fn from(); -} - -impl From for () { - fn from() {} -} - -impl From for () { -//~^ ERROR conflicting implementations of trait - fn from() {} -} - -fn bar() -> impl core::future::Future { - async move { From::from() } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-67651.stderr b/src/test/ui/async-await/issue-67651.stderr deleted file mode 100644 index 89017f6cc..000000000 --- a/src/test/ui/async-await/issue-67651.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `From` for type `()` - --> $DIR/issue-67651.rs:11:1 - | -LL | impl From for () { - | ---------------- first implementation here -... -LL | impl From for () { - | ^^^^^^^^^^^^^^^^ conflicting implementation for `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/async-await/issue-67765-async-diagnostic.rs b/src/test/ui/async-await/issue-67765-async-diagnostic.rs deleted file mode 100644 index 5093916e7..000000000 --- a/src/test/ui/async-await/issue-67765-async-diagnostic.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 -// -// Regression test for issue #67765 -// Tests that we point at the proper location when giving -// a lifetime error. -fn main() {} - -async fn func<'a>() -> Result<(), &'a str> { - let s = String::new(); - - let b = &s[..]; - - Err(b)?; //~ ERROR cannot return value referencing local variable `s` - - Ok(()) -} diff --git a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr b/src/test/ui/async-await/issue-67765-async-diagnostic.stderr deleted file mode 100644 index 492e06fbb..000000000 --- a/src/test/ui/async-await/issue-67765-async-diagnostic.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0515]: cannot return value referencing local variable `s` - --> $DIR/issue-67765-async-diagnostic.rs:13:5 - | -LL | let b = &s[..]; - | - `s` is borrowed here -LL | -LL | Err(b)?; - | ^^^^^^^ returns a value referencing data owned by the current function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/async-await/issue-68112.drop_tracking.stderr b/src/test/ui/async-await/issue-68112.drop_tracking.stderr deleted file mode 100644 index f2802698f..000000000 --- a/src/test/ui/async-await/issue-68112.drop_tracking.stderr +++ /dev/null @@ -1,79 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:37:18 - | -LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:34:17 - | -LL | let _ = non_send_fut.await; - | ^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:46:18 - | -LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:43:17 - | -LL | let _ = make_non_send_future1().await; - | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-68112.rs:65:18 - | -LL | require_send(send_fut); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required for `Arc>` to implement `Send` -note: required because it's used within this `async fn` body - --> $DIR/issue-68112.rs:50:31 - | -LL | async fn ready2(t: T) -> T { - | _______________________________^ -LL | | t -LL | | } - | |_^ -note: required because it appears within the type `impl Future>>` - --> $DIR/issue-68112.rs:53:31 - | -LL | fn make_non_send_future2() -> impl Future>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `Ready` -note: required because it's used within this `async` block - --> $DIR/issue-68112.rs:60:20 - | -LL | let send_fut = async { - | ____________________^ -LL | | let non_send_fut = make_non_send_future2(); -LL | | let _ = non_send_fut.await; -LL | | ready(0).await; -LL | | }; - | |_____^ -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr deleted file mode 100644 index 38eb85b30..000000000 --- a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr +++ /dev/null @@ -1,79 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:37:18 - | -LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:34:17 - | -LL | let _ = non_send_fut.await; - | ^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:46:18 - | -LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:43:17 - | -LL | let _ = make_non_send_future1().await; - | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-68112.rs:65:18 - | -LL | require_send(send_fut); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required for `Arc>` to implement `Send` -note: required because it's used within this `async fn` body - --> $DIR/issue-68112.rs:50:31 - | -LL | async fn ready2(t: T) -> T { - | _______________________________^ -LL | | t -LL | | } - | |_^ -note: required because it appears within the type `impl Future>>` - --> $DIR/issue-68112.rs:53:31 - | -LL | fn make_non_send_future2() -> impl Future>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `i32`, `Ready` -note: required because it's used within this `async` block - --> $DIR/issue-68112.rs:60:20 - | -LL | let send_fut = async { - | ____________________^ -LL | | let non_send_fut = make_non_send_future2(); -LL | | let _ = non_send_fut.await; -LL | | ready(0).await; -LL | | }; - | |_____^ -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:14:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-68112.rs b/src/test/ui/async-await/issue-68112.rs deleted file mode 100644 index 9c705137a..000000000 --- a/src/test/ui/async-await/issue-68112.rs +++ /dev/null @@ -1,69 +0,0 @@ -// edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no - -use std::{ - cell::RefCell, - future::Future, - pin::Pin, - sync::Arc, - task::{Context, Poll}, -}; - -fn require_send(_: impl Send) {} - -struct Ready(Option); -impl Future for Ready { - type Output = T; - fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { - Poll::Ready(self.0.take().unwrap()) - } -} -fn ready(t: T) -> Ready { - Ready(Some(t)) -} - -fn make_non_send_future1() -> impl Future>> { - ready(Arc::new(RefCell::new(0))) -} - -fn test1() { - let send_fut = async { - let non_send_fut = make_non_send_future1(); - let _ = non_send_fut.await; - ready(0).await; - }; - require_send(send_fut); - //~^ ERROR future cannot be sent between threads -} - -fn test1_no_let() { - let send_fut = async { - let _ = make_non_send_future1().await; - ready(0).await; - }; - require_send(send_fut); - //~^ ERROR future cannot be sent between threads -} - -async fn ready2(t: T) -> T { - t -} -fn make_non_send_future2() -> impl Future>> { - ready2(Arc::new(RefCell::new(0))) -} - -// Ideally this test would have diagnostics similar to the test above, but right -// now it doesn't. -fn test2() { - let send_fut = async { - let non_send_fut = make_non_send_future2(); - let _ = non_send_fut.await; - ready(0).await; - }; - require_send(send_fut); - //~^ ERROR `RefCell` cannot be shared between threads safely -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-68523-start.rs b/src/test/ui/async-await/issue-68523-start.rs deleted file mode 100644 index 2ced88a16..000000000 --- a/src/test/ui/async-await/issue-68523-start.rs +++ /dev/null @@ -1,9 +0,0 @@ -// edition:2018 - -#![feature(start)] - -#[start] -pub async fn start(_: isize, _: *const *const u8) -> isize { -//~^ ERROR `start` is not allowed to be `async` - 0 -} diff --git a/src/test/ui/async-await/issue-68523-start.stderr b/src/test/ui/async-await/issue-68523-start.stderr deleted file mode 100644 index 3a0a3b5de..000000000 --- a/src/test/ui/async-await/issue-68523-start.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0752]: `start` is not allowed to be `async` - --> $DIR/issue-68523-start.rs:6:1 - | -LL | pub async fn start(_: isize, _: *const *const u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `start` is not allowed to be `async` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0752`. diff --git a/src/test/ui/async-await/issue-68523.rs b/src/test/ui/async-await/issue-68523.rs deleted file mode 100644 index 7a67661a0..000000000 --- a/src/test/ui/async-await/issue-68523.rs +++ /dev/null @@ -1,6 +0,0 @@ -// edition:2018 - -async fn main() -> Result { -//~^ ERROR `main` function is not allowed to be `async` - Ok(1) -} diff --git a/src/test/ui/async-await/issue-68523.stderr b/src/test/ui/async-await/issue-68523.stderr deleted file mode 100644 index dfdf078e3..000000000 --- a/src/test/ui/async-await/issue-68523.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0752]: `main` function is not allowed to be `async` - --> $DIR/issue-68523.rs:3:1 - | -LL | async fn main() -> Result { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` function is not allowed to be `async` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0752`. diff --git a/src/test/ui/async-await/issue-69446-fnmut-capture.rs b/src/test/ui/async-await/issue-69446-fnmut-capture.rs deleted file mode 100644 index 842115538..000000000 --- a/src/test/ui/async-await/issue-69446-fnmut-capture.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Regression test for issue #69446 - we should display -// which variable is captured -// edition:2018 - -use core::future::Future; - -struct Foo; -impl Foo { - fn foo(&mut self) {} -} - -async fn bar(_: impl FnMut() -> T) -where - T: Future, -{} - -fn main() { - let mut x = Foo; - bar(move || async { //~ ERROR captured - x.foo(); - }); -} diff --git a/src/test/ui/async-await/issue-69446-fnmut-capture.stderr b/src/test/ui/async-await/issue-69446-fnmut-capture.stderr deleted file mode 100644 index 3d2b0402b..000000000 --- a/src/test/ui/async-await/issue-69446-fnmut-capture.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-69446-fnmut-capture.rs:19:17 - | -LL | let mut x = Foo; - | ----- variable defined here -LL | bar(move || async { - | _______________-_^ - | | | - | | inferred to be a `FnMut` closure -LL | | x.foo(); - | | - variable captured here -LL | | }); - | |_____^ returns an `async` block that contains a reference to a captured variable, which then escapes the closure body - | - = note: `FnMut` closures only have access to their captured variables while they are executing... - = note: ...therefore, they cannot allow references to captured variables to escape - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-70594.rs b/src/test/ui/async-await/issue-70594.rs deleted file mode 100644 index 9e7c5847b..000000000 --- a/src/test/ui/async-await/issue-70594.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -async fn fun() { - [1; ().await]; - //~^ error: `await` is only allowed inside `async` functions and blocks - //~| error: `.await` is not allowed in a `const` - //~| error: `.await` is not allowed in a `const` - //~| error: `()` is not a future -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr deleted file mode 100644 index d3cf57d3b..000000000 --- a/src/test/ui/async-await/issue-70594.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-70594.rs:4:11 - | -LL | async fn fun() { - | --- this is not `async` -LL | [1; ().await]; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0744]: `.await` is not allowed in a `const` - --> $DIR/issue-70594.rs:4:9 - | -LL | [1; ().await]; - | ^^^^^^^^ - -error[E0744]: `.await` is not allowed in a `const` - --> $DIR/issue-70594.rs:4:11 - | -LL | [1; ().await]; - | ^^^^^^ - -error[E0277]: `()` is not a future - --> $DIR/issue-70594.rs:4:11 - | -LL | [1; ().await]; - | ^^^^^^ - | | - | `()` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required for `()` to implement `IntoFuture` - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0277, E0728, E0744. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-70818.rs b/src/test/ui/async-await/issue-70818.rs deleted file mode 100644 index 019c56eb2..000000000 --- a/src/test/ui/async-await/issue-70818.rs +++ /dev/null @@ -1,9 +0,0 @@ -// edition:2018 - -use std::future::Future; -fn foo(ty: T, ty1: U) -> impl Future + Send { - //~^ Error future cannot be sent between threads safely - async { (ty, ty1) } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-70818.stderr b/src/test/ui/async-await/issue-70818.stderr deleted file mode 100644 index 20109d4d1..000000000 --- a/src/test/ui/async-await/issue-70818.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-70818.rs:4:38 - | -LL | fn foo(ty: T, ty1: U) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | -note: captured value is not `Send` - --> $DIR/issue-70818.rs:6:18 - | -LL | async { (ty, ty1) } - | ^^^ has type `U` which is not `Send` -help: consider restricting type parameter `U` - | -LL | fn foo(ty: T, ty1: U) -> impl Future + Send { - | +++++++++++++++++++ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr deleted file mode 100644 index 721234aa4..000000000 --- a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0277]: `Sender` cannot be shared between threads safely - --> $DIR/issue-70935-complex-spans.rs:13:45 - | -LL | fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ `Sender` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Sender` - = note: required for `&Sender` to implement `Send` -note: required because it's used within this closure - --> $DIR/issue-70935-complex-spans.rs:17:13 - | -LL | baz(|| async{ - | ^^ -note: required because it's used within this `async fn` body - --> $DIR/issue-70935-complex-spans.rs:10:67 - | -LL | async fn baz(_c: impl FnMut() -> T) where T: Future { - | ___________________________________________________________________^ -LL | | } - | |_^ - = note: required because it captures the following types: `ResumeTy`, `impl Future`, `()` -note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:16:5 - | -LL | / async move { -LL | | baz(|| async{ -LL | | foo(tx.clone()); -LL | | }).await; -LL | | } - | |_____^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr deleted file mode 100644 index 34b31198e..000000000 --- a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-70935-complex-spans.rs:13:45 - | -LL | fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `Sender` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-70935-complex-spans.rs:19:11 - | -LL | baz(|| async{ - | _____________- -LL | | foo(tx.clone()); -LL | | }).await; - | | - ^^^^^^ await occurs here, with the value maybe used later - | |_________| - | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send` -note: the value is later dropped here - --> $DIR/issue-70935-complex-spans.rs:19:17 - | -LL | }).await; - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-70935-complex-spans.rs b/src/test/ui/async-await/issue-70935-complex-spans.rs deleted file mode 100644 index b6d17f93a..000000000 --- a/src/test/ui/async-await/issue-70935-complex-spans.rs +++ /dev/null @@ -1,29 +0,0 @@ -// edition:2018 -// revisions: no_drop_tracking drop_tracking -// [no_drop_tracking]compile-flags:-Zdrop-tracking=no -// [drop_tracking]compile-flags:-Zdrop-tracking -// #70935: Check if we do not emit snippet -// with newlines which lead complex diagnostics. - -use std::future::Future; - -async fn baz(_c: impl FnMut() -> T) where T: Future { -} - -fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely - //[drop_tracking]~^^ ERROR `Sender` cannot be shared between threads - async move { - baz(|| async{ - foo(tx.clone()); - }).await; - } -} - -fn bar(_s: impl Future + Send) { -} - -fn main() { - let (tx, _rx) = std::sync::mpsc::channel(); - bar(foo(tx)); -} diff --git a/src/test/ui/async-await/issue-71137.rs b/src/test/ui/async-await/issue-71137.rs deleted file mode 100644 index 7695e0325..000000000 --- a/src/test/ui/async-await/issue-71137.rs +++ /dev/null @@ -1,23 +0,0 @@ -// edition:2018 -#![feature(must_not_suspend)] -#![allow(must_not_suspend)] - -use std::future::Future; -use std::sync::Mutex; - -fn fake_spawn(f: F) { } - -async fn wrong_mutex() { - let m = Mutex::new(1); - { - let mut guard = m.lock().unwrap(); - (async { "right"; }).await; - *guard += 1; - } - - (async { "wrong"; }).await; -} - -fn main() { - fake_spawn(wrong_mutex()); //~ Error future cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/issue-71137.stderr b/src/test/ui/async-await/issue-71137.stderr deleted file mode 100644 index eade6aa2d..000000000 --- a/src/test/ui/async-await/issue-71137.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-71137.rs:22:14 - | -LL | fake_spawn(wrong_mutex()); - | ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, i32>` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-71137.rs:14:25 - | -LL | let mut guard = m.lock().unwrap(); - | --------- has type `MutexGuard<'_, i32>` which is not `Send` -LL | (async { "right"; }).await; - | ^^^^^^ await occurs here, with `mut guard` maybe used later -LL | *guard += 1; -LL | } - | - `mut guard` is later dropped here -note: required by a bound in `fake_spawn` - --> $DIR/issue-71137.rs:8:27 - | -LL | fn fake_spawn(f: F) { } - | ^^^^ required by this bound in `fake_spawn` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-72442.rs b/src/test/ui/async-await/issue-72442.rs deleted file mode 100644 index 2280154c7..000000000 --- a/src/test/ui/async-await/issue-72442.rs +++ /dev/null @@ -1,26 +0,0 @@ -// edition:2018 -// incremental - -use std::fs::File; -use std::future::Future; -use std::io::prelude::*; - -fn main() -> Result<(), Box> { - block_on(async { - { - let path = std::path::Path::new("."); - let mut f = File::open(path.to_str())?; - //~^ ERROR the trait bound - let mut src = String::new(); - f.read_to_string(&mut src)?; - Ok(()) - } - }) -} - -fn block_on(f: F) -> F::Output -where - F: Future>>, -{ - Ok(()) -} diff --git a/src/test/ui/async-await/issue-72442.stderr b/src/test/ui/async-await/issue-72442.stderr deleted file mode 100644 index 919abf646..000000000 --- a/src/test/ui/async-await/issue-72442.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0277]: the trait bound `Option<&str>: AsRef` is not satisfied - --> $DIR/issue-72442.rs:12:36 - | -LL | let mut f = File::open(path.to_str())?; - | ---------- ^^^^^^^^^^^^^ the trait `AsRef` is not implemented for `Option<&str>` - | | - | required by a bound introduced by this call - | -note: required by a bound in `File::open` - --> $SRC_DIR/std/src/fs.rs:LL:COL - | -LL | pub fn open>(path: P) -> io::Result { - | ^^^^^^^^^^^ required by this bound in `File::open` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-72470-llvm-dominate.rs b/src/test/ui/async-await/issue-72470-llvm-dominate.rs deleted file mode 100644 index 5bb69a073..000000000 --- a/src/test/ui/async-await/issue-72470-llvm-dominate.rs +++ /dev/null @@ -1,66 +0,0 @@ -// compile-flags: -C opt-level=3 -// aux-build: issue-72470-lib.rs -// edition:2018 -// build-pass - -// Regression test for issue #72470, using the minimization -// in https://github.com/jonas-schievink/llvm-error - -extern crate issue_72470_lib; - -use std::future::Future; -use std::pin::Pin; -use std::sync::Mutex; -use std::task::Poll::{Pending, Ready}; - -#[allow(dead_code)] -enum Msg { - A(Vec<()>), - B, -} - -#[allow(dead_code)] -enum Out { - _0(Option), - Disabled, -} - -#[allow(unused_must_use)] -fn main() { - let mut rx = issue_72470_lib::unbounded_channel::(); - let entity = Mutex::new(()); - issue_72470_lib::run(async move { - { - let output = { - let mut fut = rx.recv(); - issue_72470_lib::poll_fn(|cx| { - loop { - let fut = unsafe { Pin::new_unchecked(&mut fut) }; - let out = match fut.poll(cx) { - Ready(out) => out, - Pending => { - break; - } - }; - #[allow(unused_variables)] - match &out { - Some(_msg) => {} - _ => break, - } - return Ready(Out::_0(out)); - } - Ready(Out::_0(None)) - }) - .await - }; - match output { - Out::_0(Some(_msg)) => { - entity.lock(); - } - Out::_0(None) => unreachable!(), - _ => unreachable!(), - } - } - entity.lock(); - }); -} diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.rs b/src/test/ui/async-await/issue-72590-type-error-sized.rs deleted file mode 100644 index 00e098d43..000000000 --- a/src/test/ui/async-await/issue-72590-type-error-sized.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Regression test for issue #72590 -// Tests that we don't emit a spurious "size cannot be statically determined" error -// edition:2018 - -struct Foo { - foo: Nonexistent, //~ ERROR cannot find - other: str -} - -struct Bar { - test: Missing //~ ERROR cannot find -} - -impl Foo { - async fn frob(self) {} //~ ERROR the size -} - -impl Bar { - async fn myfn(self) {} -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.stderr b/src/test/ui/async-await/issue-72590-type-error-sized.stderr deleted file mode 100644 index 778423578..000000000 --- a/src/test/ui/async-await/issue-72590-type-error-sized.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0412]: cannot find type `Nonexistent` in this scope - --> $DIR/issue-72590-type-error-sized.rs:6:10 - | -LL | foo: Nonexistent, - | ^^^^^^^^^^^ not found in this scope - -error[E0412]: cannot find type `Missing` in this scope - --> $DIR/issue-72590-type-error-sized.rs:11:11 - | -LL | test: Missing - | ^^^^^^^ not found in this scope - -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-72590-type-error-sized.rs:15:19 - | -LL | async fn frob(self) {} - | ^^^^ doesn't have a size known at compile-time - | - = help: within `Foo`, the trait `Sized` is not implemented for `str` -note: required because it appears within the type `Foo` - --> $DIR/issue-72590-type-error-sized.rs:5:8 - | -LL | struct Foo { - | ^^^ - = help: unsized fn params are gated as an unstable feature -help: function arguments must have a statically known size, borrowed types always have a known size - | -LL | async fn frob(&self) {} - | + - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0277, E0412. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-73050.rs b/src/test/ui/async-await/issue-73050.rs deleted file mode 100644 index 790f24a23..000000000 --- a/src/test/ui/async-await/issue-73050.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// edition:2018 - -#[allow(unused)] -async fn foo<'a>() { - let _data = &mut [0u8; { 1 + 4 }]; - bar().await -} - -async fn bar() {} - -fn main() {} diff --git a/src/test/ui/async-await/issue-73137.rs b/src/test/ui/async-await/issue-73137.rs deleted file mode 100644 index dcbe7765a..000000000 --- a/src/test/ui/async-await/issue-73137.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Regression test for - -// run-pass -// edition:2018 -// revisions: normal drop-tracking -// [normal]compile-flags: -Zdrop-tracking=no -// [drop-tracking]compile-flags: -Zdrop-tracking - -#![allow(dead_code)] -use std::future::Future; -use std::task::{Waker, Wake, Context}; -use std::sync::Arc; - -struct DummyWaker; -impl Wake for DummyWaker { - fn wake(self: Arc) {} -} - -struct Foo { - a: usize, - b: &'static u32, -} - -#[inline(never)] -fn nop(_: T) {} - -fn main() { - let mut fut = Box::pin(async { - let action = Foo { - b: &42, - a: async { 0 }.await, - }; - - // An error in the generator transform caused `b` to be overwritten with `a` when `b` was - // borrowed. - nop(&action.b); - assert_ne!(0usize, unsafe { std::mem::transmute(action.b) }); - - async {}.await; - }); - let waker = Waker::from(Arc::new(DummyWaker)); - let mut cx = Context::from_waker(&waker); - let _ = fut.as_mut().poll(&mut cx); -} diff --git a/src/test/ui/async-await/issue-73541-1.rs b/src/test/ui/async-await/issue-73541-1.rs deleted file mode 100644 index 7fb0d6c39..000000000 --- a/src/test/ui/async-await/issue-73541-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 - -fn main() { - 'a: loop { - async { - loop { - continue 'a - //~^ ERROR use of unreachable label `'a` - } - }; - } -} diff --git a/src/test/ui/async-await/issue-73541-1.stderr b/src/test/ui/async-await/issue-73541-1.stderr deleted file mode 100644 index 80c1fdf00..000000000 --- a/src/test/ui/async-await/issue-73541-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0767]: use of unreachable label `'a` - --> $DIR/issue-73541-1.rs:7:26 - | -LL | 'a: loop { - | -- unreachable label defined here -... -LL | continue 'a - | ^^ unreachable label `'a` - | - = note: labels are unreachable through functions, closures, async blocks and modules - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0767`. diff --git a/src/test/ui/async-await/issue-73541-2.rs b/src/test/ui/async-await/issue-73541-2.rs deleted file mode 100644 index 70b4ab253..000000000 --- a/src/test/ui/async-await/issue-73541-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// edition:2018 - -async fn c() { - 'a: loop { - macro_rules! b { - () => { - continue 'a - //~^ ERROR use of unreachable label `'a` - } - } - - async { - loop { - b!(); - } - }; - } -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-73541-2.stderr b/src/test/ui/async-await/issue-73541-2.stderr deleted file mode 100644 index 4c9741f6f..000000000 --- a/src/test/ui/async-await/issue-73541-2.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0767]: use of unreachable label `'a` - --> $DIR/issue-73541-2.rs:7:26 - | -LL | 'a: loop { - | -- unreachable label defined here -... -LL | continue 'a - | ^^ unreachable label `'a` -... -LL | b!(); - | ---- in this macro invocation - | - = note: labels are unreachable through functions, closures, async blocks and modules - = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0767`. diff --git a/src/test/ui/async-await/issue-73541-3.rs b/src/test/ui/async-await/issue-73541-3.rs deleted file mode 100644 index 02ca02da8..000000000 --- a/src/test/ui/async-await/issue-73541-3.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - 'aaaaab: loop { - || { - loop { continue 'aaaaaa } - //~^ ERROR use of undeclared label `'aaaaaa` - }; - - } -} diff --git a/src/test/ui/async-await/issue-73541-3.stderr b/src/test/ui/async-await/issue-73541-3.stderr deleted file mode 100644 index 53487aaca..000000000 --- a/src/test/ui/async-await/issue-73541-3.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0426]: use of undeclared label `'aaaaaa` - --> $DIR/issue-73541-3.rs:4:29 - | -LL | 'aaaaab: loop { - | ------- a label with a similar name exists but is unreachable -LL | || { -LL | loop { continue 'aaaaaa } - | ^^^^^^^ undeclared label `'aaaaaa` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0426`. diff --git a/src/test/ui/async-await/issue-73541.rs b/src/test/ui/async-await/issue-73541.rs deleted file mode 100644 index 399a07cd3..000000000 --- a/src/test/ui/async-await/issue-73541.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - 'a: loop { - || { - loop { continue 'a } - //~^ ERROR use of unreachable label `'a` - }; - - } -} diff --git a/src/test/ui/async-await/issue-73541.stderr b/src/test/ui/async-await/issue-73541.stderr deleted file mode 100644 index 4bb466ff1..000000000 --- a/src/test/ui/async-await/issue-73541.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0767]: use of unreachable label `'a` - --> $DIR/issue-73541.rs:4:29 - | -LL | 'a: loop { - | -- unreachable label defined here -LL | || { -LL | loop { continue 'a } - | ^^ unreachable label `'a` - | - = note: labels are unreachable through functions, closures, async blocks and modules - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0767`. diff --git a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs deleted file mode 100644 index c3423ad62..000000000 --- a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition:2018 -// compile-flags: -Zdrop-tracking -// Regression test for issue #73741 -// Ensures that we don't emit spurious errors when -// a type error ocurrs in an `async fn` - -async fn weird() { - 1 = 2; //~ ERROR invalid left-hand side - - let mut loop_count = 0; - async {}.await -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr deleted file mode 100644 index d4e3b6c3b..000000000 --- a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-73741-type-err-drop-tracking.rs:8:7 - | -LL | 1 = 2; - | - ^ - | | - | cannot assign to this expression - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/src/test/ui/async-await/issue-73741-type-err.rs b/src/test/ui/async-await/issue-73741-type-err.rs deleted file mode 100644 index c5b9e34ed..000000000 --- a/src/test/ui/async-await/issue-73741-type-err.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition:2018 -// -// Regression test for issue #73741 -// Ensures that we don't emit spurious errors when -// a type error ocurrs in an `async fn` - -async fn weird() { - 1 = 2; //~ ERROR invalid left-hand side - - let mut loop_count = 0; - async {}.await -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-73741-type-err.stderr b/src/test/ui/async-await/issue-73741-type-err.stderr deleted file mode 100644 index 0b5343a98..000000000 --- a/src/test/ui/async-await/issue-73741-type-err.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-73741-type-err.rs:8:7 - | -LL | 1 = 2; - | - ^ - | | - | cannot assign to this expression - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/src/test/ui/async-await/issue-74047.rs b/src/test/ui/async-await/issue-74047.rs deleted file mode 100644 index 2e4f3e675..000000000 --- a/src/test/ui/async-await/issue-74047.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 - -use std::convert::{TryFrom, TryInto}; -use std::io; - -pub struct MyStream; -pub struct OtherStream; - -pub async fn connect() -> io::Result { - let stream: MyStream = OtherStream.try_into()?; - Ok(stream) -} - -impl TryFrom for MyStream {} -//~^ ERROR: missing - -fn main() {} diff --git a/src/test/ui/async-await/issue-74047.stderr b/src/test/ui/async-await/issue-74047.stderr deleted file mode 100644 index 28174825d..000000000 --- a/src/test/ui/async-await/issue-74047.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0046]: not all trait items implemented, missing: `Error`, `try_from` - --> $DIR/issue-74047.rs:14:1 - | -LL | impl TryFrom for MyStream {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Error`, `try_from` in implementation - | - = help: implement the missing item: `type Error = Type;` - = help: implement the missing item: `fn try_from(_: T) -> Result>::Error> { todo!() }` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/async-await/issue-74072-lifetime-name-annotations.rs b/src/test/ui/async-await/issue-74072-lifetime-name-annotations.rs deleted file mode 100644 index 95683241a..000000000 --- a/src/test/ui/async-await/issue-74072-lifetime-name-annotations.rs +++ /dev/null @@ -1,37 +0,0 @@ -// edition:2018 -#![feature(async_closure)] -use std::future::Future; - -// test the quality of annotations giving lifetimes names (`'1`) when async constructs are involved - -pub async fn async_fn(x: &mut i32) -> &i32 { - let y = &*x; - *x += 1; //~ ERROR cannot assign to `*x` because it is borrowed - y -} - -pub fn async_closure(x: &mut i32) -> impl Future { - (async move || { - let y = &*x; - *x += 1; //~ ERROR cannot assign to `*x` because it is borrowed - y - })() -} - -pub fn async_closure_explicit_return_type(x: &mut i32) -> impl Future { - (async move || -> &i32 { - let y = &*x; - *x += 1; //~ ERROR cannot assign to `*x` because it is borrowed - y - })() -} - -pub fn async_block(x: &mut i32) -> impl Future { - async move { - let y = &*x; - *x += 1; //~ ERROR cannot assign to `*x` because it is borrowed - y - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/src/test/ui/async-await/issue-74072-lifetime-name-annotations.stderr deleted file mode 100644 index b96cab9f0..000000000 --- a/src/test/ui/async-await/issue-74072-lifetime-name-annotations.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:9:5 - | -LL | pub async fn async_fn(x: &mut i32) -> &i32 { - | - let's call the lifetime of this reference `'1` -LL | let y = &*x; - | --- borrow of `*x` occurs here -LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here -LL | y - | - returning this value requires that `*x` is borrowed for `'1` - -error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:16:9 - | -LL | let y = &*x; - | --- borrow of `*x` occurs here -LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here -LL | y - | - returning this value requires that `*x` is borrowed for `'1` -LL | })() - | - return type of async closure is &'1 i32 - -error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:24:9 - | -LL | (async move || -> &i32 { - | - let's call the lifetime of this reference `'1` -LL | let y = &*x; - | --- borrow of `*x` occurs here -LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here -LL | y - | - returning this value requires that `*x` is borrowed for `'1` - -error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-74072-lifetime-name-annotations.rs:32:9 - | -LL | let y = &*x; - | --- borrow of `*x` occurs here -LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here -LL | y - | - returning this value requires that `*x` is borrowed for `'1` -LL | } - | - return type of async block is &'1 i32 - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/async-await/issue-74497-lifetime-in-opaque.rs b/src/test/ui/async-await/issue-74497-lifetime-in-opaque.rs deleted file mode 100644 index 2d765eb41..000000000 --- a/src/test/ui/async-await/issue-74497-lifetime-in-opaque.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition:2018 - -// test that names give to anonymous lifetimes in opaque types like `impl Future` are correctly -// introduced in error messages - -use std::future::Future; - -pub async fn foo(_: F) -where - F: Fn(&u8) -> T, - T: Future, -{ -} - -pub async fn bar(_: &u8) {} - -fn main() { - let _ = foo(|x| bar(x)); //~ ERROR lifetime may not live long enough -} diff --git a/src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr b/src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr deleted file mode 100644 index 4427014ae..000000000 --- a/src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-74497-lifetime-in-opaque.rs:18:21 - | -LL | let _ = foo(|x| bar(x)); - | -- ^^^^^^ returning this value requires that `'1` must outlive `'2` - | || - | |return type of closure `impl Future` contains a lifetime `'2` - | has type `&'1 u8` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-75785-confusing-named-region.rs b/src/test/ui/async-await/issue-75785-confusing-named-region.rs deleted file mode 100644 index 452614087..000000000 --- a/src/test/ui/async-await/issue-75785-confusing-named-region.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 -// -// Regression test for issue #75785 -// Tests that we don't point to a confusing named -// region when emitting a diagnostic - -pub async fn async_fn(x: &mut i32) -> (&i32, &i32) { - let y = &*x; - *x += 1; //~ ERROR cannot assign to - (&32, y) -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-75785-confusing-named-region.stderr b/src/test/ui/async-await/issue-75785-confusing-named-region.stderr deleted file mode 100644 index 3b731d9c6..000000000 --- a/src/test/ui/async-await/issue-75785-confusing-named-region.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/issue-75785-confusing-named-region.rs:9:5 - | -LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) { - | - let's call the lifetime of this reference `'1` -LL | let y = &*x; - | --- borrow of `*x` occurs here -LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here -LL | (&32, y) - | -------- returning this value requires that `*x` is borrowed for `'1` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/async-await/issue-76547.rs b/src/test/ui/async-await/issue-76547.rs deleted file mode 100644 index 587feb624..000000000 --- a/src/test/ui/async-await/issue-76547.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Test for diagnostic improvement issue #76547 -// edition:2018 - -use std::{ - future::Future, - task::{Context, Poll} -}; -use std::pin::Pin; - -pub struct ListFut<'a>(&'a mut [&'a mut [u8]]); -impl<'a> Future for ListFut<'a> { - type Output = (); - - fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll { - unimplemented!() - } -} - -async fn fut(bufs: &mut [&mut [u8]]) { - ListFut(bufs).await - //~^ ERROR lifetime may not live long enough -} - -pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]); -impl<'a> Future for ListFut2<'a> { - type Output = i32; - - fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll { - unimplemented!() - } -} - -async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { - ListFut2(bufs).await - //~^ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-76547.stderr b/src/test/ui/async-await/issue-76547.stderr deleted file mode 100644 index 4d96cce82..000000000 --- a/src/test/ui/async-await/issue-76547.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-76547.rs:20:13 - | -LL | async fn fut(bufs: &mut [&mut [u8]]) { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` -LL | ListFut(bufs).await - | ^^^^ this usage requires that `'1` must outlive `'2` - | -help: consider introducing a named lifetime parameter - | -LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) { - | ++++ ++ ++ - -error: lifetime may not live long enough - --> $DIR/issue-76547.rs:34:14 - | -LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` -LL | ListFut2(bufs).await - | ^^^^ this usage requires that `'1` must outlive `'2` - | -help: consider introducing a named lifetime parameter - | -LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 { - | ++++ ++ ++ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/async-await/issue-77993-2.rs b/src/test/ui/async-await/issue-77993-2.rs deleted file mode 100644 index 4d554a0a1..000000000 --- a/src/test/ui/async-await/issue-77993-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -// edition:2018 - -async fn test() -> Result<(), Box> { - macro!(); - //~^ ERROR expected identifier, found `!` - Ok(()) -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-77993-2.stderr b/src/test/ui/async-await/issue-77993-2.stderr deleted file mode 100644 index 64b378f83..000000000 --- a/src/test/ui/async-await/issue-77993-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: expected identifier, found `!` - --> $DIR/issue-77993-2.rs:4:10 - | -LL | macro!(); - | ^ expected identifier - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-84841.rs b/src/test/ui/async-await/issue-84841.rs deleted file mode 100644 index ba3a1617b..000000000 --- a/src/test/ui/async-await/issue-84841.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 - -fn main() { - -} - -async fn foo() { - // Adding an .await here avoids the ICE - test()?; - //~^ ERROR the `?` operator can only be applied to values that implement `Try` - //~| ERROR the `?` operator can only be used in an async function that returns -} - -// Removing the const generic parameter here avoids the ICE -async fn test() { -} diff --git a/src/test/ui/async-await/issue-84841.stderr b/src/test/ui/async-await/issue-84841.stderr deleted file mode 100644 index 1e22373ba..000000000 --- a/src/test/ui/async-await/issue-84841.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-84841.rs:9:5 - | -LL | test()?; - | ^^^^^^^ the `?` operator cannot be applied to type `impl Future` - | - = help: the trait `Try` is not implemented for `impl Future` - -error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/issue-84841.rs:9:11 - | -LL | async fn foo() { - | ________________- -LL | | // Adding an .await here avoids the ICE -LL | | test()?; - | | ^ cannot use the `?` operator in an async function that returns `()` -LL | | -LL | | -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` - | - = help: the trait `FromResidual<_>` is not implemented for `()` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-86507.rs b/src/test/ui/async-await/issue-86507.rs deleted file mode 100644 index 317f03176..000000000 --- a/src/test/ui/async-await/issue-86507.rs +++ /dev/null @@ -1,25 +0,0 @@ -// edition:2018 - -use ::core::pin::Pin; -use ::core::future::Future; -use ::core::marker::Send; - -trait Foo { - fn bar<'me, 'async_trait, T: Send>(x: &'me T) - -> Pin + Send + 'async_trait>> - where 'me: 'async_trait; -} - -impl Foo for () { - fn bar<'me, 'async_trait, T: Send>(x: &'me T) - -> Pin + Send + 'async_trait>> - where 'me:'async_trait { - Box::pin( //~ ERROR future cannot be sent between threads safely - async move { - let x = x; - } - ) - } -} - -fn main() { } diff --git a/src/test/ui/async-await/issue-86507.stderr b/src/test/ui/async-await/issue-86507.stderr deleted file mode 100644 index 8c2c06da2..000000000 --- a/src/test/ui/async-await/issue-86507.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-86507.rs:17:13 - | -LL | / Box::pin( -LL | | async move { -LL | | let x = x; -LL | | } -LL | | ) - | |_____________^ future created by async block is not `Send` - | -note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` - --> $DIR/issue-86507.rs:19:29 - | -LL | let x = x; - | ^ has type `&T` which is not `Send`, because `T` is not `Sync` - = note: required for the cast from `[async block@$DIR/issue-86507.rs:18:17: 20:18]` to the object type `dyn Future + Send` -help: consider further restricting this bound - | -LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) - | +++++++++++++++++++ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-93197.rs b/src/test/ui/async-await/issue-93197.rs deleted file mode 100644 index c627fe17a..000000000 --- a/src/test/ui/async-await/issue-93197.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Regression test for #93197 -// check-pass -// edition:2021 -// compile-flags: -Zdrop-tracking - -#![feature(try_blocks)] - -use std::sync::{mpsc, mpsc::SendError}; - -pub async fn foo() { - let (tx, _) = mpsc::channel(); - - let _: Result<(), SendError<&str>> = try { tx.send("hello")?; }; -} - -fn main() {} diff --git a/src/test/ui/async-await/issue-93648.rs b/src/test/ui/async-await/issue-93648.rs deleted file mode 100644 index 4ce3ac1e8..000000000 --- a/src/test/ui/async-await/issue-93648.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2021 -// build-pass -// compile-flags: -Zdrop-tracking - -fn main() { - let _ = async { - let mut s = (String::new(),); - s.0.push_str("abc"); - std::mem::drop(s); - async {}.await; - }; -} diff --git a/src/test/ui/async-await/issue-98634.rs b/src/test/ui/async-await/issue-98634.rs deleted file mode 100644 index b0d38687f..000000000 --- a/src/test/ui/async-await/issue-98634.rs +++ /dev/null @@ -1,50 +0,0 @@ -// edition: 2021 - -use std::{ - future::Future, - pin::Pin, - task::{Context, Poll, Waker}, -}; - -pub struct StructAsync Pin>>> { - pub callback: F, -} - -impl Future for StructAsync -where - F: Fn() -> Pin>>, -{ - type Output = (); - - fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { - Poll::Pending - } -} - -async fn callback() {} - -struct Runtime; - -fn waker() -> &'static Waker { - todo!() -} - -impl Runtime { - #[track_caller] - pub fn block_on(&self, mut future: F) -> F::Output { - loop { - unsafe { - Pin::new_unchecked(&mut future).poll(&mut Context::from_waker(waker())); - } - } - } -} - -fn main() { - Runtime.block_on(async { - StructAsync { callback }.await; - //~^ ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - //~| ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - //~| ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - }); -} diff --git a/src/test/ui/async-await/issue-98634.stderr b/src/test/ui/async-await/issue-98634.stderr deleted file mode 100644 index 5160e48d8..000000000 --- a/src/test/ui/async-await/issue-98634.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - --> $DIR/issue-98634.rs:45:23 - | -LL | StructAsync { callback }.await; - | ^^^^^^^^ expected struct `Pin`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` -note: required by a bound in `StructAsync` - --> $DIR/issue-98634.rs:9:35 - | -LL | pub struct StructAsync Pin>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` - -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - --> $DIR/issue-98634.rs:45:9 - | -LL | StructAsync { callback }.await; - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` -note: required by a bound in `StructAsync` - --> $DIR/issue-98634.rs:9:35 - | -LL | pub struct StructAsync Pin>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` - -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - --> $DIR/issue-98634.rs:45:33 - | -LL | StructAsync { callback }.await; - | ^^^^^^ expected struct `Pin`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` -note: required by a bound in `StructAsync` - --> $DIR/issue-98634.rs:9:35 - | -LL | pub struct StructAsync Pin>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/async-await/issues/auxiliary/issue-60674.rs b/src/test/ui/async-await/issues/auxiliary/issue-60674.rs deleted file mode 100644 index 680c6e55e..000000000 --- a/src/test/ui/async-await/issues/auxiliary/issue-60674.rs +++ /dev/null @@ -1,12 +0,0 @@ -// force-host -// no-prefer-dynamic -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn attr(_args: TokenStream, input: TokenStream) -> TokenStream { - println!("{}", input); - TokenStream::new() -} diff --git a/src/test/ui/async-await/issues/auxiliary/issue_67893.rs b/src/test/ui/async-await/issues/auxiliary/issue_67893.rs deleted file mode 100644 index 387966a50..000000000 --- a/src/test/ui/async-await/issues/auxiliary/issue_67893.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 - -use std::sync::{Arc, Mutex}; - -pub async fn f(_: ()) {} - -pub async fn run() { - let x: Arc> = unimplemented!(); - f(*x.lock().unwrap()).await; -} diff --git a/src/test/ui/async-await/issues/issue-51719.rs b/src/test/ui/async-await/issues/issue-51719.rs deleted file mode 100644 index 09241f982..000000000 --- a/src/test/ui/async-await/issues/issue-51719.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 -// -// Tests that the .await syntax can't be used to make a generator - -async fn foo() {} - -fn make_generator() { - let _gen = || foo().await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-51719.stderr b/src/test/ui/async-await/issues/issue-51719.stderr deleted file mode 100644 index f3ce5d1c8..000000000 --- a/src/test/ui/async-await/issues/issue-51719.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-51719.rs:8:24 - | -LL | let _gen = || foo().await; - | -- ^^^^^^ only allowed inside `async` functions and blocks - | | - | this is not `async` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0728`. diff --git a/src/test/ui/async-await/issues/issue-51751.rs b/src/test/ui/async-await/issues/issue-51751.rs deleted file mode 100644 index bc85a96ce..000000000 --- a/src/test/ui/async-await/issues/issue-51751.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -async fn inc(limit: i64) -> i64 { - limit + 1 -} - -fn main() { - let result = inc(10000); - let finished = result.await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks -} diff --git a/src/test/ui/async-await/issues/issue-51751.stderr b/src/test/ui/async-await/issues/issue-51751.stderr deleted file mode 100644 index 8696a5b79..000000000 --- a/src/test/ui/async-await/issues/issue-51751.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-51751.rs:9:26 - | -LL | fn main() { - | ---- this is not `async` -LL | let result = inc(10000); -LL | let finished = result.await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0728`. diff --git a/src/test/ui/async-await/issues/issue-53249.rs b/src/test/ui/async-await/issues/issue-53249.rs deleted file mode 100644 index 3a33af2d2..000000000 --- a/src/test/ui/async-await/issues/issue-53249.rs +++ /dev/null @@ -1,47 +0,0 @@ -// check-pass -// edition:2018 - -#![feature(arbitrary_self_types)] - -use std::task::{self, Poll}; -use std::future::Future; -use std::marker::Unpin; -use std::pin::Pin; - -// This is a regression test for an ICE/unbounded recursion issue relating to async-await. - -#[derive(Debug)] -#[must_use = "futures do nothing unless polled"] -pub struct Lazy { - f: Option -} - -impl Unpin for Lazy {} - -pub fn lazy(f: F) -> Lazy - where F: FnOnce(&mut task::Context) -> R, -{ - Lazy { f: Some(f) } -} - -impl Future for Lazy - where F: FnOnce(&mut task::Context) -> R, -{ - type Output = R; - - fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll { - Poll::Ready((self.f.take().unwrap())(cx)) - } -} - -async fn __receive(want: WantFn) -> () - where Fut: Future, WantFn: Fn(&Box) -> Fut, -{ - lazy(|_| ()).await; -} - -pub fn basic_spawn_receive() { - async { __receive(|_| async { () }).await }; -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.rs b/src/test/ui/async-await/issues/issue-54752-async-block.rs deleted file mode 100644 index a8165ae6c..000000000 --- a/src/test/ui/async-await/issues/issue-54752-async-block.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -// edition:2018 -// pp-exact - -fn main() { let _a = (async { }); } -//~^ WARNING unnecessary parentheses around assigned value diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.stderr b/src/test/ui/async-await/issues/issue-54752-async-block.stderr deleted file mode 100644 index 8cc849dd9..000000000 --- a/src/test/ui/async-await/issues/issue-54752-async-block.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: unnecessary parentheses around assigned value - --> $DIR/issue-54752-async-block.rs:6:22 - | -LL | fn main() { let _a = (async { }); } - | ^ ^ - | - = note: `#[warn(unused_parens)]` on by default -help: remove these parentheses - | -LL - fn main() { let _a = (async { }); } -LL + fn main() { let _a = async { }; } - | - -warning: 1 warning emitted - diff --git a/src/test/ui/async-await/issues/issue-54974.rs b/src/test/ui/async-await/issues/issue-54974.rs deleted file mode 100644 index b602ef153..000000000 --- a/src/test/ui/async-await/issues/issue-54974.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// edition:2018 - -use std::sync::Arc; - -trait SomeTrait: Send + Sync + 'static { - fn do_something(&self); -} - -async fn my_task(obj: Arc) { - unimplemented!() -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-55324.rs b/src/test/ui/async-await/issues/issue-55324.rs deleted file mode 100644 index 9ecb3b129..000000000 --- a/src/test/ui/async-await/issues/issue-55324.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// edition:2018 - -use std::future::Future; - -async fn foo>(x: &i32, future: F) -> i32 { - let y = future.await; - *x + y -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-55809.rs b/src/test/ui/async-await/issues/issue-55809.rs deleted file mode 100644 index 3b271775a..000000000 --- a/src/test/ui/async-await/issues/issue-55809.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -// run-pass - -trait Foo { } - -impl Foo for () { } - -impl<'a, T> Foo for &'a mut T where T: Foo { } - -async fn foo_async(_v: T) -> u8 where T: Foo { - 0 -} - -async fn bad(v: T) -> u8 where T: Foo { - foo_async(v).await -} - -async fn async_main() { - let mut v = (); - - let _ = bad(&mut v).await; - let _ = foo_async(&mut v).await; - let _ = bad(v).await; -} - -fn main() { - let _ = async_main(); -} diff --git a/src/test/ui/async-await/issues/issue-58885.rs b/src/test/ui/async-await/issues/issue-58885.rs deleted file mode 100644 index 11920b072..000000000 --- a/src/test/ui/async-await/issues/issue-58885.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass -// edition:2018 - -struct Xyz { - a: u64, -} - -trait Foo {} - -impl Xyz { - async fn do_sth<'a>( - &'a self, foo: &'a dyn Foo - ) -> bool - { - true - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-59001.rs b/src/test/ui/async-await/issues/issue-59001.rs deleted file mode 100644 index 4ddebcf20..000000000 --- a/src/test/ui/async-await/issues/issue-59001.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// edition:2018 - -use std::future::Future; - -async fn enter<'a, F, R>(mut callback: F) -where - F: FnMut(&'a mut i32) -> R, - R: Future + 'a, -{ - unimplemented!() -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-59972.rs b/src/test/ui/async-await/issues/issue-59972.rs deleted file mode 100644 index c2e24a96b..000000000 --- a/src/test/ui/async-await/issues/issue-59972.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Incorrect handling of uninhabited types could cause us to mark generator -// types as entirely uninhabited, when they were in fact constructible. This -// caused us to hit "unreachable" code (illegal instruction on x86). - -// run-pass - -// compile-flags: --edition=2018 -Aunused - -pub enum Uninhabited { } - -fn uninhabited_async() -> Uninhabited { - unreachable!() -} - -async fn noop() { } - -async fn contains_never() { - let error = uninhabited_async(); - noop().await; - let error2 = error; -} - -async fn overlap_never() { - let error1 = uninhabited_async(); - noop().await; - let error2 = uninhabited_async(); - drop(error1); - noop().await; - drop(error2); -} - -#[allow(unused_must_use)] -fn main() { -} diff --git a/src/test/ui/async-await/issues/issue-60518.rs b/src/test/ui/async-await/issues/issue-60518.rs deleted file mode 100644 index 69bbdd0e8..000000000 --- a/src/test/ui/async-await/issues/issue-60518.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// edition:2018 - -// This is a regression test to ensure that simple bindings (where replacement arguments aren't -// created during async fn lowering) that have their DefId used during HIR lowering (such as impl -// trait) are visited during def collection and thus have a DefId. - -async fn foo(ws: impl Iterator) {} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs b/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs deleted file mode 100644 index 66a3b07c3..000000000 --- a/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Test that opaque `impl Trait` types are allowed to contain late-bound regions. - -// check-pass -// edition:2018 - -#![feature(type_alias_impl_trait)] - -use std::future::Future; - -pub type Func = impl Sized; - -// Late bound region should be allowed to escape the function, since it's bound -// in the type. -fn null_function_ptr() -> Func { - None:: fn(&'a ())> -} - -async fn async_nop(_: &u8) {} - -pub type ServeFut = impl Future; - -// Late bound regions occur in the generator witness type here. -fn serve() -> ServeFut { - async move { - let x = 5; - async_nop(&x).await - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-60674.rs b/src/test/ui/async-await/issues/issue-60674.rs deleted file mode 100644 index c0e34a8df..000000000 --- a/src/test/ui/async-await/issues/issue-60674.rs +++ /dev/null @@ -1,19 +0,0 @@ -// aux-build:issue-60674.rs -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 - -// This is a regression test that ensures that `mut` patterns are not lost when provided as input -// to a proc macro. - -extern crate issue_60674; - -#[issue_60674::attr] -async fn f(mut x: u8) {} - -#[issue_60674::attr] -async fn g((mut x, y, mut z): (u8, u8, u8)) {} - -#[issue_60674::attr] -async fn g(mut x: u8, (a, mut b, c): (u8, u8, u8), y: u8) {} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-60674.stdout b/src/test/ui/async-await/issues/issue-60674.stdout deleted file mode 100644 index 6f980e606..000000000 --- a/src/test/ui/async-await/issues/issue-60674.stdout +++ /dev/null @@ -1,3 +0,0 @@ -async fn f(mut x : u8) {} -async fn g((mut x, y, mut z) : (u8, u8, u8)) {} -async fn g(mut x : u8, (a, mut b, c) : (u8, u8, u8), y : u8) {} diff --git a/src/test/ui/async-await/issues/issue-61187.rs b/src/test/ui/async-await/issues/issue-61187.rs deleted file mode 100644 index 8585a4251..000000000 --- a/src/test/ui/async-await/issues/issue-61187.rs +++ /dev/null @@ -1,7 +0,0 @@ -// edition:2018 - -fn main() {} - -async fn response(data: Vec) { - data.reverse(); //~ ERROR E0596 -} diff --git a/src/test/ui/async-await/issues/issue-61187.stderr b/src/test/ui/async-await/issues/issue-61187.stderr deleted file mode 100644 index 163053471..000000000 --- a/src/test/ui/async-await/issues/issue-61187.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0596]: cannot borrow `data` as mutable, as it is not declared as mutable - --> $DIR/issue-61187.rs:6:5 - | -LL | async fn response(data: Vec) { - | ---- help: consider changing this to be mutable: `mut data` -LL | data.reverse(); - | ^^^^^^^^^^^^^^ cannot borrow as mutable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/async-await/issues/issue-61986.rs b/src/test/ui/async-await/issues/issue-61986.rs deleted file mode 100644 index 879bc6912..000000000 --- a/src/test/ui/async-await/issues/issue-61986.rs +++ /dev/null @@ -1,19 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// edition:2018 -// -// Tests that we properly handle StorageDead/StorageLives for temporaries -// created in async loop bodies. - -async fn bar() -> Option<()> { - Some(()) -} - -async fn listen() { - while let Some(_) = bar().await { - String::new(); - } -} - -fn main() { - listen(); -} diff --git a/src/test/ui/async-await/issues/issue-62009-1.rs b/src/test/ui/async-await/issues/issue-62009-1.rs deleted file mode 100644 index 40ccf2571..000000000 --- a/src/test/ui/async-await/issues/issue-62009-1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// edition:2018 - -async fn print_dur() {} - -fn main() { - async { let (); }.await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks - async { - let task1 = print_dur().await; - }.await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks - (|_| 2333).await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks - //~| ERROR is not a future -} diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr deleted file mode 100644 index 222afb2c7..000000000 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:6:22 - | -LL | fn main() { - | ---- this is not `async` -LL | async { let (); }.await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:10:6 - | -LL | fn main() { - | ---- this is not `async` -... -LL | }.await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:12:15 - | -LL | fn main() { - | ---- this is not `async` -... -LL | (|_| 2333).await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future - --> $DIR/issue-62009-1.rs:12:15 - | -LL | (|_| 2333).await; - | ^^^^^^ - | | - | `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` - = note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited - = note: required for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` to implement `IntoFuture` - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0277, E0728. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issues/issue-62009-2.rs b/src/test/ui/async-await/issues/issue-62009-2.rs deleted file mode 100644 index cb7336e61..000000000 --- a/src/test/ui/async-await/issues/issue-62009-2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 - -#![feature(async_closure)] - -async fn print_dur() {} - -fn main() { - (async || 2333)().await; - //~^ ERROR `await` is only allowed inside `async` functions and blocks -} diff --git a/src/test/ui/async-await/issues/issue-62009-2.stderr b/src/test/ui/async-await/issues/issue-62009-2.stderr deleted file mode 100644 index 92e9a8a69..000000000 --- a/src/test/ui/async-await/issues/issue-62009-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-2.rs:8:22 - | -LL | fn main() { - | ---- this is not `async` -LL | (async || 2333)().await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0728`. diff --git a/src/test/ui/async-await/issues/issue-62097.rs b/src/test/ui/async-await/issues/issue-62097.rs deleted file mode 100644 index a24c84cff..000000000 --- a/src/test/ui/async-await/issues/issue-62097.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition:2018 -async fn foo(fun: F) -where - F: FnOnce() + 'static -{ - fun() -} - -struct Struct; - -impl Struct { - pub async fn run_dummy_fn(&self) { - foo(|| self.bar()).await; - //~^ ERROR closure may outlive the current function - //~| ERROR borrowed data escapes outside of associated function - } - - pub fn bar(&self) {} -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-62097.stderr b/src/test/ui/async-await/issues/issue-62097.stderr deleted file mode 100644 index 786f62132..000000000 --- a/src/test/ui/async-await/issues/issue-62097.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function - --> $DIR/issue-62097.rs:13:13 - | -LL | foo(|| self.bar()).await; - | ^^ ---- `self` is borrowed here - | | - | may outlive borrowed value `self` - | -note: function requires argument type to outlive `'static` - --> $DIR/issue-62097.rs:13:9 - | -LL | foo(|| self.bar()).await; - | ^^^^^^^^^^^^^^^^^^ -help: to force the closure to take ownership of `self` (and any other referenced variables), use the `move` keyword - | -LL | foo(move || self.bar()).await; - | ++++ - -error[E0521]: borrowed data escapes outside of associated function - --> $DIR/issue-62097.rs:13:9 - | -LL | pub async fn run_dummy_fn(&self) { - | ----- - | | - | `self` is a reference that is only valid in the associated function body - | let's call the lifetime of this reference `'1` -LL | foo(|| self.bar()).await; - | ^^^^^^^^^^^^^^^^^^ - | | - | `self` escapes the associated function body here - | argument requires that `'1` must outlive `'static` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0373, E0521. -For more information about an error, try `rustc --explain E0373`. diff --git a/src/test/ui/async-await/issues/issue-62517-1.rs b/src/test/ui/async-await/issues/issue-62517-1.rs deleted file mode 100644 index 4689ce36a..000000000 --- a/src/test/ui/async-await/issues/issue-62517-1.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Regression test for #62517. We used to ICE when you had an `async -// fn` with an `impl Trait` return that mentioned a `dyn Bar` with no -// explicit lifetime bound. -// -// edition:2018 -// check-pass - -trait FirstTrait {} -trait SecondTrait { - type Item: ?Sized; -} - -async fn foo(x: &str) -> impl SecondTrait { -} - - -impl SecondTrait for T { - type Item = dyn FirstTrait; -} - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-62517-2.rs b/src/test/ui/async-await/issues/issue-62517-2.rs deleted file mode 100644 index aaf28d6c1..000000000 --- a/src/test/ui/async-await/issues/issue-62517-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Regression test for #62517. We used to ICE when you had an `async -// fn` with an `impl Trait` return that mentioned a `dyn Bar` with no -// explicit lifetime bound. -// -// edition:2018 -// check-pass - -trait Object {} - -trait Alpha {} - -async fn foo<'a>(_: &'a ()) -> impl Alpha {} - -impl Alpha for T { } - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-63388-1.rs b/src/test/ui/async-await/issues/issue-63388-1.rs deleted file mode 100644 index 32bcbb111..000000000 --- a/src/test/ui/async-await/issues/issue-63388-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition:2018 - -struct Xyz { - a: u64, -} - -trait Foo {} - -impl Xyz { - async fn do_sth<'a>( - &'a self, foo: &dyn Foo - ) -> &dyn Foo - { - //~^ ERROR explicit lifetime required in the type of `foo` [E0621] - foo - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-63388-1.stderr b/src/test/ui/async-await/issues/issue-63388-1.stderr deleted file mode 100644 index 88542315e..000000000 --- a/src/test/ui/async-await/issues/issue-63388-1.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `foo` - --> $DIR/issue-63388-1.rs:13:5 - | -LL | &'a self, foo: &dyn Foo - | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` -LL | ) -> &dyn Foo -LL | / { -LL | | -LL | | foo -LL | | } - | |_____^ lifetime `'a` required - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/async-await/issues/issue-63388-2.rs b/src/test/ui/async-await/issues/issue-63388-2.rs deleted file mode 100644 index 90b59f96e..000000000 --- a/src/test/ui/async-await/issues/issue-63388-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// edition:2018 - -struct Xyz { - a: u64, -} - -trait Foo {} - -impl Xyz { - async fn do_sth<'a>( - foo: &dyn Foo, bar: &'a dyn Foo - ) -> &dyn Foo //~ ERROR missing lifetime specifier - { - //~^ ERROR explicit lifetime required in the type of `foo` [E0621] - foo - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-63388-2.stderr b/src/test/ui/async-await/issues/issue-63388-2.stderr deleted file mode 100644 index e515f227c..000000000 --- a/src/test/ui/async-await/issues/issue-63388-2.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-63388-2.rs:12:10 - | -LL | foo: &dyn Foo, bar: &'a dyn Foo - | -------- ----------- -LL | ) -> &dyn Foo - | ^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar` -help: consider using the `'a` lifetime - | -LL | ) -> &'a dyn Foo - | ++ - -error[E0621]: explicit lifetime required in the type of `foo` - --> $DIR/issue-63388-2.rs:13:5 - | -LL | foo: &dyn Foo, bar: &'a dyn Foo - | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)` -LL | ) -> &dyn Foo -LL | / { -LL | | -LL | | foo -LL | | } - | |_____^ lifetime `'a` required - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0106, E0621. -For more information about an error, try `rustc --explain E0106`. diff --git a/src/test/ui/async-await/issues/issue-63388-3.rs b/src/test/ui/async-await/issues/issue-63388-3.rs deleted file mode 100644 index 1a9822e02..000000000 --- a/src/test/ui/async-await/issues/issue-63388-3.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 -// check-pass - -struct Xyz { - a: u64, -} - -trait Foo {} - -impl Xyz { - async fn do_sth( - &self, foo: &dyn Foo - ) { - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-63388-4.rs b/src/test/ui/async-await/issues/issue-63388-4.rs deleted file mode 100644 index 58f9dacb3..000000000 --- a/src/test/ui/async-await/issues/issue-63388-4.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// edition:2018 - -struct A; - -impl A { - async fn foo(&self, f: &u32) -> &A { self } -} - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-64391-2.rs b/src/test/ui/async-await/issues/issue-64391-2.rs deleted file mode 100644 index eef2c1fb2..000000000 --- a/src/test/ui/async-await/issues/issue-64391-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Regression test for #64391 -// -// As described on the issue, the (spurious) `DROP` inserted for the -// `"".to_string()` value was causing a (spurious) unwind path that -// led us to believe that the future might be dropped after `config` -// had been dropped. This cannot, in fact, happen. -// -// check-pass -// edition:2018 - -async fn connect() { - let config = 666; - connect2(&config, "".to_string()).await -} - -async fn connect2(_config: &u32, _tls: String) { - unimplemented!() -} - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-64433.rs b/src/test/ui/async-await/issues/issue-64433.rs deleted file mode 100644 index d900f8ed9..000000000 --- a/src/test/ui/async-await/issues/issue-64433.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Regression test for issue #64433. -// -// See issue-64391-2.rs for more details, as that was fixed by the -// same PR. -// -// check-pass -// edition:2018 - -#[derive(Debug)] -struct A<'a> { - inner: Vec<&'a str>, -} - -struct B {} - -impl B { - async fn something_with_a(&mut self, a: A<'_>) -> Result<(), String> { - println!("{:?}", a); - Ok(()) - } -} - -async fn can_error(some_string: &str) -> Result<(), String> { - let a = A { inner: vec![some_string, "foo"] }; - let mut b = B {}; - Ok(b.something_with_a(a).await.map(drop)?) -} - -fn main() { -} diff --git a/src/test/ui/async-await/issues/issue-64477-2.rs b/src/test/ui/async-await/issues/issue-64477-2.rs deleted file mode 100644 index 2360b57cc..000000000 --- a/src/test/ui/async-await/issues/issue-64477-2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Another regression test for #64477. -// -// In the past, the code generated by `format!` produced temporaries in the surrounding scope that -// borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which -// meant that when `format!` was used in an async block, the resulting generator was not `Send`. -// See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details -// and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example. -// -// check-pass -// edition:2018 - -async fn foo(_: String) {} - -fn bar() -> impl Send { - async move { - foo(format!("{}:{}", 1, 2)).await; - } -} - -fn main() { - let _ = bar(); -} diff --git a/src/test/ui/async-await/issues/issue-64477.rs b/src/test/ui/async-await/issues/issue-64477.rs deleted file mode 100644 index 5bd52d44a..000000000 --- a/src/test/ui/async-await/issues/issue-64477.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Regression test for #64477. -// -// We were incorrectly claiming that the `f(x).await` future captured -// a value of type `T`, and hence that `T: Send` would have to hold. -// -// check-pass -// edition:2018 - -use std::future::Future; -use std::pin::Pin; - -fn f(_: &T) -> Pin + Send>> { - unimplemented!() -} - -pub fn g(x: &'static T) -> impl Future + Send { - async move { f(x).await } -} - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-64964.rs b/src/test/ui/async-await/issues/issue-64964.rs deleted file mode 100644 index 6d6eff486..000000000 --- a/src/test/ui/async-await/issues/issue-64964.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass -// incremental -// compile-flags: -Z query-dep-graph -// edition:2018 - -// Regression test for ICE related to `await`ing in a method + incr. comp. (#64964) - -struct Body; -impl Body { - async fn next(&mut self) { - async {}.await - } -} - -// Another reproduction: `await`ing with a variable from for-loop. - -async fn bar() { - for x in 0..10 { - async { Some(x) }.await.unwrap(); - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-65159.rs b/src/test/ui/async-await/issues/issue-65159.rs deleted file mode 100644 index df2ca0257..000000000 --- a/src/test/ui/async-await/issues/issue-65159.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Regression test for #65159. We used to ICE. -// -// edition:2018 - -async fn copy() -> Result<()> -//~^ ERROR this enum takes 2 generic arguments -{ - Ok(()) -} - -fn main() { } diff --git a/src/test/ui/async-await/issues/issue-65159.stderr b/src/test/ui/async-await/issues/issue-65159.stderr deleted file mode 100644 index 45f5ec40c..000000000 --- a/src/test/ui/async-await/issues/issue-65159.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied - --> $DIR/issue-65159.rs:5:20 - | -LL | async fn copy() -> Result<()> - | ^^^^^^ -- supplied 1 generic argument - | | - | expected 2 generic arguments - | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result { - | ^^^^^^ - - -help: add missing generic argument - | -LL | async fn copy() -> Result<(), E> - | +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs deleted file mode 100644 index ade386a60..000000000 --- a/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs +++ /dev/null @@ -1,46 +0,0 @@ -// issue 65419 - Attempting to run an async fn after completion mentions generators when it should -// be talking about `async fn`s instead. - -// run-fail -// error-pattern: thread 'main' panicked at '`async fn` resumed after completion' -// edition:2018 -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support - -#![feature(generators, generator_trait)] - -async fn foo() { -} - -fn main() { - let mut future = Box::pin(foo()); - executor::block_on(future.as_mut()); - executor::block_on(future.as_mut()); -} - -mod executor { - use core::{ - future::Future, - pin::Pin, - task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, - }; - - pub fn block_on(mut future: F) -> F::Output { - let mut future = unsafe { Pin::new_unchecked(&mut future) }; - - static VTABLE: RawWakerVTable = RawWakerVTable::new( - |_| unimplemented!("clone"), - |_| unimplemented!("wake"), - |_| unimplemented!("wake_by_ref"), - |_| (), - ); - let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; - let mut context = Context::from_waker(&waker); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs deleted file mode 100644 index b4ea4c9f6..000000000 --- a/src/test/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs +++ /dev/null @@ -1,52 +0,0 @@ -// issue 65419 - Attempting to run an async fn after completion mentions generators when it should -// be talking about `async fn`s instead. Should also test what happens when it panics. - -// run-fail -// needs-unwind -// error-pattern: thread 'main' panicked at '`async fn` resumed after panicking' -// edition:2018 -// ignore-wasm no panic or subprocess support - -#![feature(generators, generator_trait)] - -use std::panic; - -async fn foo() { - panic!(); -} - -fn main() { - let mut future = Box::pin(foo()); - panic::catch_unwind(panic::AssertUnwindSafe(|| { - executor::block_on(future.as_mut()); - })); - - executor::block_on(future.as_mut()); -} - -mod executor { - use core::{ - future::Future, - pin::Pin, - task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, - }; - - pub fn block_on(mut future: F) -> F::Output { - let mut future = unsafe { Pin::new_unchecked(&mut future) }; - - static VTABLE: RawWakerVTable = RawWakerVTable::new( - |_| unimplemented!("clone"), - |_| unimplemented!("wake"), - |_| unimplemented!("wake_by_ref"), - |_| (), - ); - let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; - let mut context = Context::from_waker(&waker); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs deleted file mode 100644 index 9fc5667d6..000000000 --- a/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs +++ /dev/null @@ -1,25 +0,0 @@ -// issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should -// be talking about `async fn`s instead. Regression test added to make sure generators still -// panic when resumed after completion. - -// run-fail -// error-pattern:generator resumed after completion -// edition:2018 -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support - -#![feature(generators, generator_trait)] - -use std::{ - ops::Generator, - pin::Pin, -}; - -fn main() { - let mut g = || { - yield; - }; - Pin::new(&mut g).resume(()); // Yields once. - Pin::new(&mut g).resume(()); // Completes here. - Pin::new(&mut g).resume(()); // Panics here. -} diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr deleted file mode 100644 index ab196dca2..000000000 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-65436-raw-ptr-not-send.rs:16:17 - | -LL | assert_send(async { - | _________________^ -LL | | -LL | | bar(Foo(std::ptr::null())).await; -LL | | }) - | |_____^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 19:6]`, the trait `Send` is not implemented for `*const u8` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 - | -LL | bar(Foo(std::ptr::null())).await; - | ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later - | | - | has type `*const u8` which is not `Send` -note: `std::ptr::null()` is later dropped here - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:41 - | -LL | bar(Foo(std::ptr::null())).await; - | ^ -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13 - | -LL | bar(Foo(std::ptr::null())).await; - | ^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `assert_send` - --> $DIR/issue-65436-raw-ptr-not-send.rs:13:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs deleted file mode 100644 index 91edbc10d..000000000 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs +++ /dev/null @@ -1,20 +0,0 @@ -// edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] check-pass -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no - -struct Foo(*const u8); - -unsafe impl Send for Foo {} - -async fn bar(_: Foo) {} - -fn assert_send(_: T) {} - -fn main() { - assert_send(async { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely - bar(Foo(std::ptr::null())).await; - }) -} diff --git a/src/test/ui/async-await/issues/issue-66695-static-refs.rs b/src/test/ui/async-await/issues/issue-66695-static-refs.rs deleted file mode 100644 index f0609713b..000000000 --- a/src/test/ui/async-await/issues/issue-66695-static-refs.rs +++ /dev/null @@ -1,24 +0,0 @@ -// build-pass -// edition:2018 - -static A: [i32; 5] = [1, 2, 3, 4, 5]; - -async fn fun() { - let u = A[async { 1 }.await]; - match A { - i if async { true }.await => (), - _ => (), - } -} - -fn main() { - async { - let u = A[async { 1 }.await]; - }; - async { - match A { - i if async { true }.await => (), - _ => (), - } - }; -} diff --git a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs deleted file mode 100644 index b7a976a0a..000000000 --- a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs +++ /dev/null @@ -1,15 +0,0 @@ -// edition:2018 - -struct Ia(S); - -impl Ia { - fn partial(_: S) {} - fn full(self) {} - - async fn crash(self) { - Self::partial(self.0); - Self::full(self); //~ ERROR use of partially moved value: `self` - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr deleted file mode 100644 index e2a735398..000000000 --- a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0382]: use of partially moved value: `self` - --> $DIR/issue-66958-non-copy-infered-type-arg.rs:11:20 - | -LL | Self::partial(self.0); - | ------ value partially moved here -LL | Self::full(self); - | ^^^^ value used here after partial move - | - = note: partial move occurs because `self.0` has type `S`, which does not implement the `Copy` trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/async-await/issues/issue-67611-static-mut-refs.rs b/src/test/ui/async-await/issues/issue-67611-static-mut-refs.rs deleted file mode 100644 index dda4a151d..000000000 --- a/src/test/ui/async-await/issues/issue-67611-static-mut-refs.rs +++ /dev/null @@ -1,33 +0,0 @@ -// build-pass -// edition:2018 - -static mut A: [i32; 5] = [1, 2, 3, 4, 5]; - -fn is_send_sync(_: T) {} - -async fn fun() { - let u = unsafe { A[async { 1 }.await] }; - unsafe { - match A { - i if async { true }.await => (), - _ => (), - } - } -} - -fn main() { - let index_block = async { - let u = unsafe { A[async { 1 }.await] }; - }; - let match_block = async { - unsafe { - match A { - i if async { true }.await => (), - _ => (), - } - } - }; - is_send_sync(index_block); - is_send_sync(match_block); - is_send_sync(fun()); -} diff --git a/src/test/ui/async-await/issues/issue-67893.rs b/src/test/ui/async-await/issues/issue-67893.rs deleted file mode 100644 index d73772e5f..000000000 --- a/src/test/ui/async-await/issues/issue-67893.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build: issue_67893.rs -// edition:2018 - -extern crate issue_67893; - -fn g(_: impl Send) {} - -fn main() { - g(issue_67893::run()) - //~^ ERROR future cannot be sent between threads safely -} diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr deleted file mode 100644 index 316b6d06f..000000000 --- a/src/test/ui/async-await/issues/issue-67893.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-67893.rs:9:7 - | -LL | g(issue_67893::run()) - | ^^^^^^^^^^^^^^^^^^ future is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` -note: future is not `Send` as this value is used across an await - --> $DIR/auxiliary/issue_67893.rs:9:26 - | -LL | f(*x.lock().unwrap()).await; - | ----------------- ^^^^^^ await occurs here, with `x.lock().unwrap()` maybe used later - | | - | has type `MutexGuard<'_, ()>` which is not `Send` -note: `x.lock().unwrap()` is later dropped here - --> $DIR/auxiliary/issue_67893.rs:9:32 - | -LL | f(*x.lock().unwrap()).await; - | ^ -note: required by a bound in `g` - --> $DIR/issue-67893.rs:6:14 - | -LL | fn g(_: impl Send) {} - | ^^^^ required by this bound in `g` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issues/issue-69307-nested.rs b/src/test/ui/async-await/issues/issue-69307-nested.rs deleted file mode 100644 index b7cdf3987..000000000 --- a/src/test/ui/async-await/issues/issue-69307-nested.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Regression test for #69307 -// -// Having a `async { .. foo.await .. }` block appear inside of a `+=` -// expression was causing an ICE due to a failure to save/restore -// state in the AST numbering pass when entering a nested body. -// -// check-pass -// edition:2018 - -fn block_on(_: F) -> usize { - 0 -} - -fn main() {} - -async fn bar() { - let mut sum = 0; - sum += { - block_on(async { - baz().await; - let mut inner = 1; - inner += block_on(async { - baz().await; - 0 - }) - }) - }; -} - -async fn baz() {} diff --git a/src/test/ui/async-await/issues/issue-69307.rs b/src/test/ui/async-await/issues/issue-69307.rs deleted file mode 100644 index 59309a7f2..000000000 --- a/src/test/ui/async-await/issues/issue-69307.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Regression test for #69307 -// -// Having an `async { .. foo.await .. }` block appear inside of a `+=` -// expression was causing an ICE due to a failure to save/restore -// state in the AST numbering pass when entering a nested body. -// -// check-pass -// edition:2018 - -fn block_on(_: F) -> usize { - 0 -} - -fn main() {} - -async fn bar() { - let mut sum = 0; - sum += block_on(async { - baz().await; - }); -} - -async fn baz() {} diff --git a/src/test/ui/async-await/issues/issue-72312.rs b/src/test/ui/async-await/issues/issue-72312.rs deleted file mode 100644 index 74122cf00..000000000 --- a/src/test/ui/async-await/issues/issue-72312.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition:2018 -fn require_static(val: T) -> T { - val -} - -struct Problem; - -impl Problem { - pub async fn start(&self) { - //~^ NOTE let's call - //~| NOTE `self` is a reference - require_static(async move { - //~^ ERROR borrowed data escapes - //~| NOTE `self` escapes - //~| NOTE argument requires - &self; - }); - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-72312.stderr b/src/test/ui/async-await/issues/issue-72312.stderr deleted file mode 100644 index aa947b690..000000000 --- a/src/test/ui/async-await/issues/issue-72312.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0521]: borrowed data escapes outside of associated function - --> $DIR/issue-72312.rs:12:9 - | -LL | pub async fn start(&self) { - | ----- - | | - | `self` is a reference that is only valid in the associated function body - | let's call the lifetime of this reference `'1` -... -LL | / require_static(async move { -LL | | -LL | | -LL | | -LL | | &self; -LL | | }); - | | ^ - | | | - | |__________`self` escapes the associated function body here - | argument requires that `'1` must outlive `'static` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/async-await/issues/issue-78600.rs b/src/test/ui/async-await/issues/issue-78600.rs deleted file mode 100644 index 8aaeaecf3..000000000 --- a/src/test/ui/async-await/issues/issue-78600.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 - -struct S<'a>(&'a i32); - -impl<'a> S<'a> { - async fn new(i: &'a i32) -> Result { - //~^ ERROR: `async fn` - Ok(S(&22)) - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-78600.stderr b/src/test/ui/async-await/issues/issue-78600.stderr deleted file mode 100644 index 37eafa996..000000000 --- a/src/test/ui/async-await/issues/issue-78600.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/issue-78600.rs:6:33 - | -LL | async fn new(i: &'a i32) -> Result { - | ^^^^^^^----^^^^^ - | | - | help: consider spelling out the type instead: `S<'a>` - | - = note: see issue #103532 for more information - = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/issues/issue-78654.full.stderr b/src/test/ui/async-await/issues/issue-78654.full.stderr deleted file mode 100644 index 0d12a948c..000000000 --- a/src/test/ui/async-await/issues/issue-78654.full.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0573]: expected type, found built-in attribute `feature` - --> $DIR/issue-78654.rs:9:15 - | -LL | impl Foo { - | ^^^^^^^ not a type - -error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-78654.rs:9:6 - | -LL | impl Foo { - | ^^^^^^^^^^^^^^^^ unconstrained const parameter - | - = note: expressions using a const parameter must map each value to a distinct output value - = note: proving the result of expressions other than the parameter are unique is not supported - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0207, E0573. -For more information about an error, try `rustc --explain E0207`. diff --git a/src/test/ui/async-await/issues/issue-78654.min.stderr b/src/test/ui/async-await/issues/issue-78654.min.stderr deleted file mode 100644 index 0d12a948c..000000000 --- a/src/test/ui/async-await/issues/issue-78654.min.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0573]: expected type, found built-in attribute `feature` - --> $DIR/issue-78654.rs:9:15 - | -LL | impl Foo { - | ^^^^^^^ not a type - -error[E0207]: the const parameter `H` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-78654.rs:9:6 - | -LL | impl Foo { - | ^^^^^^^^^^^^^^^^ unconstrained const parameter - | - = note: expressions using a const parameter must map each value to a distinct output value - = note: proving the result of expressions other than the parameter are unique is not supported - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0207, E0573. -For more information about an error, try `rustc --explain E0207`. diff --git a/src/test/ui/async-await/issues/issue-78654.rs b/src/test/ui/async-await/issues/issue-78654.rs deleted file mode 100644 index cc6dc3834..000000000 --- a/src/test/ui/async-await/issues/issue-78654.rs +++ /dev/null @@ -1,15 +0,0 @@ -// edition:2018 -// revisions: full min - -#![cfg_attr(full, feature(adt_const_params))] -#![cfg_attr(full, allow(incomplete_features))] - -struct Foo; - -impl Foo { -//~^ ERROR: expected type, found built-in attribute `feature` -//~^^ ERROR: the const parameter `H` is not constrained by the impl trait, self type, or predicates - async fn biz() {} -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-78938-async-block.rs b/src/test/ui/async-await/issues/issue-78938-async-block.rs deleted file mode 100644 index 36f716019..000000000 --- a/src/test/ui/async-await/issues/issue-78938-async-block.rs +++ /dev/null @@ -1,33 +0,0 @@ -// edition:2018 - -use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}}; - -async fn f() { - let room_ref = Arc::new(Vec::new()); - - let gameloop_handle = spawn(async { //~ ERROR E0373 - game_loop(Arc::clone(&room_ref)) - }); - gameloop_handle.await; -} - -fn game_loop(v: Arc>) {} - -fn spawn(future: F) -> JoinHandle -where - F: Future + Send + 'static, - F::Output: Send + 'static, -{ - loop {} -} - -struct JoinHandle; - -impl Future for JoinHandle { - type Output = (); - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - loop {} - } -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-78938-async-block.stderr b/src/test/ui/async-await/issues/issue-78938-async-block.stderr deleted file mode 100644 index c1a4b467f..000000000 --- a/src/test/ui/async-await/issues/issue-78938-async-block.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0373]: async block may outlive the current function, but it borrows `room_ref`, which is owned by the current function - --> $DIR/issue-78938-async-block.rs:8:33 - | -LL | let gameloop_handle = spawn(async { - | _________________________________^ -LL | | game_loop(Arc::clone(&room_ref)) - | | -------- `room_ref` is borrowed here -LL | | }); - | |_____^ may outlive borrowed value `room_ref` - | - = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use -help: to force the async block to take ownership of `room_ref` (and any other referenced variables), use the `move` keyword - | -LL | let gameloop_handle = spawn(async move { - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0373`. diff --git a/src/test/ui/async-await/issues/issue-95307.rs b/src/test/ui/async-await/issues/issue-95307.rs deleted file mode 100644 index f7e48070c..000000000 --- a/src/test/ui/async-await/issues/issue-95307.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 - -// Regression test for #95307. -// The ICE occurred on all the editions, specifying edition:2018 to reduce diagnostics. - -pub trait C { - async fn new() -> [u8; _]; - //~^ ERROR: functions in traits cannot be declared `async` - //~| ERROR: using `_` for array lengths is unstable - //~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment -} - -fn main() {} diff --git a/src/test/ui/async-await/issues/issue-95307.stderr b/src/test/ui/async-await/issues/issue-95307.stderr deleted file mode 100644 index a497cebe3..000000000 --- a/src/test/ui/async-await/issues/issue-95307.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/issue-95307.rs:7:5 - | -LL | async fn new() -> [u8; _]; - | -----^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/issue-95307.rs:7:28 - | -LL | async fn new() -> [u8; _]; - | ^ `_` not allowed here - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/issue-95307.rs:7:28 - | -LL | async fn new() -> [u8; _]; - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0658, E0706. -For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/issues/non-async-enclosing-span.rs b/src/test/ui/async-await/issues/non-async-enclosing-span.rs deleted file mode 100644 index d47c21377..000000000 --- a/src/test/ui/async-await/issues/non-async-enclosing-span.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -async fn do_the_thing() -> u8 { - 8 -} -// #63398: point at the enclosing scope and not the previously seen closure -fn main() { //~ NOTE this is not `async` - let x = move || {}; - let y = do_the_thing().await; //~ ERROR `await` is only allowed inside `async` functions - //~^ NOTE only allowed inside `async` functions and blocks -} diff --git a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr b/src/test/ui/async-await/issues/non-async-enclosing-span.stderr deleted file mode 100644 index 20b827479..000000000 --- a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/non-async-enclosing-span.rs:9:27 - | -LL | fn main() { - | ---- this is not `async` -LL | let x = move || {}; -LL | let y = do_the_thing().await; - | ^^^^^^ only allowed inside `async` functions and blocks - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0728`. diff --git a/src/test/ui/async-await/large_moves.attribute.stderr b/src/test/ui/async-await/large_moves.attribute.stderr deleted file mode 100644 index 0c5452475..000000000 --- a/src/test/ui/async-await/large_moves.attribute.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 - | -LL | let x = async { - | _____________^ -LL | | let y = [0; 9999]; -LL | | dbg!(y); -LL | | thing(&y).await; -LL | | dbg!(y); -LL | | }; - | |_____^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -note: the lint level is defined here - --> $DIR/large_moves.rs:1:9 - | -LL | #![deny(large_assignments)] - | ^^^^^^^^^^^^^^^^^ - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 - | -LL | let z = (x, 42); - | ^^^^^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 - | -LL | let a = z.0; - | ^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/async-await/large_moves.option.stderr b/src/test/ui/async-await/large_moves.option.stderr deleted file mode 100644 index 0c5452475..000000000 --- a/src/test/ui/async-await/large_moves.option.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error: moving 10024 bytes - --> $DIR/large_moves.rs:13:13 - | -LL | let x = async { - | _____________^ -LL | | let y = [0; 9999]; -LL | | dbg!(y); -LL | | thing(&y).await; -LL | | dbg!(y); -LL | | }; - | |_____^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -note: the lint level is defined here - --> $DIR/large_moves.rs:1:9 - | -LL | #![deny(large_assignments)] - | ^^^^^^^^^^^^^^^^^ - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 - | -LL | let z = (x, 42); - | ^^^^^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 - | -LL | let a = z.0; - | ^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/async-await/large_moves.rs b/src/test/ui/async-await/large_moves.rs deleted file mode 100644 index d43d0eec0..000000000 --- a/src/test/ui/async-await/large_moves.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![deny(large_assignments)] -#![feature(large_assignments)] -#![cfg_attr(attribute, move_size_limit = "1000")] -// build-fail -// only-x86_64 -// revisions: attribute option -// [option]compile-flags: -Zmove-size-limit=1000 - -// edition:2018 -// compile-flags: -Zmir-opt-level=0 - -fn main() { - let x = async { //~ ERROR large_assignments - let y = [0; 9999]; - dbg!(y); - thing(&y).await; - dbg!(y); - }; - let z = (x, 42); //~ ERROR large_assignments - //~^ ERROR large_assignments - let a = z.0; //~ ERROR large_assignments - let b = z.1; -} - -async fn thing(y: &[u8]) { - dbg!(y); -} diff --git a/src/test/ui/async-await/move-part-await-return-rest-struct.rs b/src/test/ui/async-await/move-part-await-return-rest-struct.rs deleted file mode 100644 index 39ea2aae5..000000000 --- a/src/test/ui/async-await/move-part-await-return-rest-struct.rs +++ /dev/null @@ -1,18 +0,0 @@ -// build-pass -// edition:2018 -// compile-flags: --crate-type lib - -struct Small { - x: Vec, - y: Vec, -} - -// You are allowed to move out part of a struct to an async fn, you still -// have access to remaining parts after awaiting -async fn move_part_await_return_rest_struct() -> Vec { - let s = Small { x: vec![31], y: vec![19, 1441] }; - needs_vec(s.x).await; - s.y -} - -async fn needs_vec(_vec: Vec) {} diff --git a/src/test/ui/async-await/move-part-await-return-rest-tuple.rs b/src/test/ui/async-await/move-part-await-return-rest-tuple.rs deleted file mode 100644 index 7b958b98b..000000000 --- a/src/test/ui/async-await/move-part-await-return-rest-tuple.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-pass -// edition:2018 -// compile-flags: --crate-type lib - -async fn move_part_await_return_rest_tuple() -> Vec { - let x = (vec![3], vec![4, 4]); - drop(x.1); - echo(x.0[0]).await; - x.0 -} - -async fn echo(x: usize) -> usize { x } diff --git a/src/test/ui/async-await/multiple-lifetimes/elided.rs b/src/test/ui/async-await/multiple-lifetimes/elided.rs deleted file mode 100644 index 8258e2eff..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/elided.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 -// run-pass - -// Test that we can use async fns with multiple arbitrary lifetimes. - -async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} - -fn main() { - let _ = multiple_elided_lifetimes(&22, &44); -} diff --git a/src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs b/src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs deleted file mode 100644 index 3912b8547..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 -// run-pass - -// Test that we can use async fns with multiple arbitrary lifetimes. - -async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8, _: fn(&u8)) {} - -fn gimme(_: &u8) { } - -fn main() { - let _ = multiple_named_lifetimes(&22, &44, gimme); -} diff --git a/src/test/ui/async-await/multiple-lifetimes/hrtb.rs b/src/test/ui/async-await/multiple-lifetimes/hrtb.rs deleted file mode 100644 index e788ca5ff..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/hrtb.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition:2018 -// check-pass - -// Test that we can use async fns with multiple arbitrary lifetimes. - -use std::ops::Add; - -async fn multiple_hrtb_and_single_named_lifetime_ok<'c>( - _: impl for<'a> Add<&'a u8>, - _: impl for<'b> Add<&'b u8>, - _: &'c u8, -) {} - -fn main() {} diff --git a/src/test/ui/async-await/multiple-lifetimes/named.rs b/src/test/ui/async-await/multiple-lifetimes/named.rs deleted file mode 100644 index e8eb98102..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/named.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 -// run-pass - -// Test that we can use async fns with multiple arbitrary lifetimes. - -async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8) {} - -fn main() { - let _ = multiple_named_lifetimes(&22, &44); -} diff --git a/src/test/ui/async-await/multiple-lifetimes/partial-relation.rs b/src/test/ui/async-await/multiple-lifetimes/partial-relation.rs deleted file mode 100644 index 02b105999..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/partial-relation.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 -// run-pass - -async fn lotsa_lifetimes<'a, 'b, 'c>(a: &'a u32, b: &'b u32, c: &'c u32) -> (&'a u32, &'b u32) - where 'b: 'a -{ - drop((a, c)); - (b, b) -} - -fn main() { - let _ = lotsa_lifetimes(&22, &44, &66); -} diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs deleted file mode 100644 index f1002947f..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 -// run-pass - -// Test member constraints that appear in the `impl Trait` -// return type of an async function. -// (This used to require a feature gate.) - -trait Trait<'a, 'b> { } -impl Trait<'_, '_> for T { } - -async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - (a, b) -} - -fn main() { - let _ = async_ret_impl_trait(&22, &44); -} diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs deleted file mode 100644 index aebc77d26..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs +++ /dev/null @@ -1,31 +0,0 @@ -// edition:2018 - -// Test that a feature gate is needed to use `impl Trait` as the -// return type of an async. - -trait Trait<'a> { } -impl Trait<'_> for T { } - -// Fails to recognize that both 'a and 'b are mentioned and should thus be accepted -async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { - //~^ ERROR lifetime may not live long enough - (a, b) -} - -// Only `'a` permitted in return type, not `'b`. -async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { - //~^ ERROR captures lifetime that does not appear in bounds - (a, b) -} - -// As above, but `'b: 'a`, so return type can be inferred to `(&'a u8, -// &'a u8)`. -async fn async_ret_impl_trait2<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> -where - 'b: 'a, -{ - (a, b) -} - -fn main() { -} diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr deleted file mode 100644 index ae4d0d585..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ret-impl-trait-one.rs:10:85 - | -LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { - | ________________________________--__--_______________________________________________^ - | | | | - | | | lifetime `'b` defined here - | | lifetime `'a` defined here -LL | | -LL | | (a, b) -LL | | } - | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` - | - = help: consider adding the following bound: `'a: 'b` - -error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds - --> $DIR/ret-impl-trait-one.rs:16:80 - | -LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { - | ____________________________________--__________________________________________^ - | | | - | | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here -LL | | -LL | | (a, b) -LL | | } - | |_^ - | -help: to declare that `impl Trait<'a>` captures `'b`, you can add an explicit `'b` lifetime bound - | -LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0700`. diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-ref.rs b/src/test/ui/async-await/multiple-lifetimes/ret-ref.rs deleted file mode 100644 index 149c020f9..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/ret-ref.rs +++ /dev/null @@ -1,44 +0,0 @@ -// edition:2018 - -// Test that we get the expected borrow check errors when an async -// function (which takes multiple lifetimes) only returns data from -// one of them. - -async fn multiple_named_lifetimes<'a, 'b>(a: &'a u8, _: &'b u8) -> &'a u8 { - a -} - -// Both are borrowed whilst the future is live. -async fn future_live() { - let mut a = 22; - let mut b = 44; - let future = multiple_named_lifetimes(&a, &b); - a += 1; //~ ERROR cannot assign - b += 1; //~ ERROR cannot assign - let p = future.await; - drop(p); -} - -// Just the return value is live after future is awaited. -async fn just_return_live() { - let mut a = 22; - let mut b = 44; - let future = multiple_named_lifetimes(&a, &b); - let p = future.await; - a += 1; //~ ERROR cannot assign - b += 1; - drop(p); -} - -// Once `p` is dead, both `a` and `b` are unborrowed. -async fn after_both_dead() { - let mut a = 22; - let mut b = 44; - let future = multiple_named_lifetimes(&a, &b); - let p = future.await; - drop(p); - a += 1; - b += 1; -} - -fn main() { } diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-ref.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-ref.stderr deleted file mode 100644 index d86e84033..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/ret-ref.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0506]: cannot assign to `a` because it is borrowed - --> $DIR/ret-ref.rs:16:5 - | -LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `a` occurs here -LL | a += 1; - | ^^^^^^ assignment to borrowed `a` occurs here -LL | b += 1; -LL | let p = future.await; - | ------ borrow later used here - -error[E0506]: cannot assign to `b` because it is borrowed - --> $DIR/ret-ref.rs:17:5 - | -LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `b` occurs here -LL | a += 1; -LL | b += 1; - | ^^^^^^ assignment to borrowed `b` occurs here -LL | let p = future.await; - | ------ borrow later used here - -error[E0506]: cannot assign to `a` because it is borrowed - --> $DIR/ret-ref.rs:28:5 - | -LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `a` occurs here -LL | let p = future.await; -LL | a += 1; - | ^^^^^^ assignment to borrowed `a` occurs here -LL | b += 1; -LL | drop(p); - | - borrow later used here - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/async-await/multiple-lifetimes/variance.rs b/src/test/ui/async-await/multiple-lifetimes/variance.rs deleted file mode 100644 index 6ed8bef95..000000000 --- a/src/test/ui/async-await/multiple-lifetimes/variance.rs +++ /dev/null @@ -1,15 +0,0 @@ -// edition:2018 -// run-pass - -// Test for async fn where the parameters have distinct lifetime -// parameters that appear in all possible variances. - -async fn lotsa_lifetimes<'a, 'b, 'c>(_: fn(&'a u8), _: fn(&'b u8) -> &'b u8, _: fn() -> &'c u8) { } - -fn take_any(_: &u8) { } -fn identify(x: &u8) -> &u8 { x } -fn give_back() -> &'static u8 { &22 } - -fn main() { - let _ = lotsa_lifetimes(take_any, identify, give_back); -} diff --git a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.rs deleted file mode 100644 index bb2a61f03..000000000 --- a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 -// Test that impl trait does not allow creating recursive types that are -// otherwise forbidden when using `async` and `await`. - -async fn rec_1() { //~ ERROR recursion in an `async fn` - rec_2().await; -} - -async fn rec_2() { //~ ERROR recursion in an `async fn` - rec_1().await; -} - -fn main() {} diff --git a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr deleted file mode 100644 index f789ad2a0..000000000 --- a/src/test/ui/async-await/mutually-recursive-async-impl-trait-type.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18 - | -LL | async fn rec_1() { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 - | -LL | async fn rec_2() { - | ^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0733`. diff --git a/src/test/ui/async-await/nested-in-impl.rs b/src/test/ui/async-await/nested-in-impl.rs deleted file mode 100644 index 76ed827d5..000000000 --- a/src/test/ui/async-await/nested-in-impl.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test that async fn works when nested inside of -// impls with lifetime parameters. -// -// check-pass -// edition:2018 - -struct Foo<'a>(&'a ()); - -impl<'a> Foo<'a> { - fn test() { - async fn test() {} - } -} - -fn main() { } diff --git a/src/test/ui/async-await/no-async-const.rs b/src/test/ui/async-await/no-async-const.rs deleted file mode 100644 index 963460c11..000000000 --- a/src/test/ui/async-await/no-async-const.rs +++ /dev/null @@ -1,5 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib - -pub async const fn x() {} -//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const` diff --git a/src/test/ui/async-await/no-async-const.stderr b/src/test/ui/async-await/no-async-const.stderr deleted file mode 100644 index a51dc88a4..000000000 --- a/src/test/ui/async-await/no-async-const.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const` - --> $DIR/no-async-const.rs:4:11 - | -LL | pub async const fn x() {} - | ------^^^^^ - | | | - | | expected one of `extern`, `fn`, or `unsafe` - | help: `const` must come before `async`: `const async` - | - = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/no-const-async.rs b/src/test/ui/async-await/no-const-async.rs deleted file mode 100644 index cfb0ef1b3..000000000 --- a/src/test/ui/async-await/no-const-async.rs +++ /dev/null @@ -1,6 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib - -pub const async fn x() {} -//~^ ERROR functions cannot be both `const` and `async` -//~| ERROR cycle detected diff --git a/src/test/ui/async-await/no-const-async.stderr b/src/test/ui/async-await/no-const-async.stderr deleted file mode 100644 index c5bd520aa..000000000 --- a/src/test/ui/async-await/no-const-async.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: functions cannot be both `const` and `async` - --> $DIR/no-const-async.rs:4:5 - | -LL | pub const async fn x() {} - | ----^^^^^-^^^^^---------- - | | | - | | `async` because of this - | `const` because of this - -error[E0391]: cycle detected when computing type of `x::{opaque#0}` - --> $DIR/no-const-async.rs:4:24 - | -LL | pub const async fn x() {} - | ^ - | -note: ...which requires borrow-checking `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing MIR for `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `x`... - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... - = note: ...which again requires computing type of `x::{opaque#0}`, completing the cycle -note: cycle used when checking item types in top-level module - --> $DIR/no-const-async.rs:4:1 - | -LL | pub const async fn x() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/async-await/no-move-across-await-struct.rs b/src/test/ui/async-await/no-move-across-await-struct.rs deleted file mode 100644 index 51c9a42b3..000000000 --- a/src/test/ui/async-await/no-move-across-await-struct.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib - -async fn no_move_across_await_struct() -> Vec { - let s = Small { x: vec![31], y: vec![19, 1441] }; - needs_vec(s.x).await; - s.x - //~^ ERROR use of moved value: `s.x` -} - -struct Small { - x: Vec, - y: Vec, -} - -async fn needs_vec(_vec: Vec) {} diff --git a/src/test/ui/async-await/no-move-across-await-struct.stderr b/src/test/ui/async-await/no-move-across-await-struct.stderr deleted file mode 100644 index 4eaed1cf1..000000000 --- a/src/test/ui/async-await/no-move-across-await-struct.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0382]: use of moved value: `s.x` - --> $DIR/no-move-across-await-struct.rs:7:5 - | -LL | needs_vec(s.x).await; - | --- value moved here -LL | s.x - | ^^^ value used here after move - | - = note: move occurs because `s.x` has type `Vec`, which does not implement the `Copy` trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/async-await/no-move-across-await-tuple.rs b/src/test/ui/async-await/no-move-across-await-tuple.rs deleted file mode 100644 index a65633269..000000000 --- a/src/test/ui/async-await/no-move-across-await-tuple.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib - -async fn no_move_across_await_tuple() -> Vec { - let x = (vec![3], vec![4, 4]); - drop(x.1); - nothing().await; - x.1 - //~^ ERROR use of moved value: `x.1` -} - -async fn nothing() {} diff --git a/src/test/ui/async-await/no-move-across-await-tuple.stderr b/src/test/ui/async-await/no-move-across-await-tuple.stderr deleted file mode 100644 index d750df991..000000000 --- a/src/test/ui/async-await/no-move-across-await-tuple.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0382]: use of moved value: `x.1` - --> $DIR/no-move-across-await-tuple.rs:8:5 - | -LL | drop(x.1); - | --- value moved here -LL | nothing().await; -LL | x.1 - | ^^^ value used here after move - | - = note: move occurs because `x.1` has type `Vec`, which does not implement the `Copy` trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/async-await/no-non-guaranteed-initialization.rs b/src/test/ui/async-await/no-non-guaranteed-initialization.rs deleted file mode 100644 index c4d81bf83..000000000 --- a/src/test/ui/async-await/no-non-guaranteed-initialization.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 -// compile-flags: --crate-type lib - -async fn no_non_guaranteed_initialization(x: usize) -> usize { - let y; - if x > 5 { - y = echo(10).await; - } - y //~ ERROR E0381 -} - -async fn echo(x: usize) -> usize { x + 1 } diff --git a/src/test/ui/async-await/no-non-guaranteed-initialization.stderr b/src/test/ui/async-await/no-non-guaranteed-initialization.stderr deleted file mode 100644 index 12c15bf56..000000000 --- a/src/test/ui/async-await/no-non-guaranteed-initialization.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0381]: used binding `y` is possibly-uninitialized - --> $DIR/no-non-guaranteed-initialization.rs:9:5 - | -LL | let y; - | - binding declared here but left uninitialized -LL | if x > 5 { - | ----- if this `if` condition is `false`, `y` is not initialized -LL | y = echo(10).await; -LL | } - | - an `else` arm might be missing here, initializing `y` -LL | y - | ^ `y` used here but it is possibly-uninitialized - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0381`. diff --git a/src/test/ui/async-await/no-params-non-move-async-closure.rs b/src/test/ui/async-await/no-params-non-move-async-closure.rs deleted file mode 100644 index 3b15f35c2..000000000 --- a/src/test/ui/async-await/no-params-non-move-async-closure.rs +++ /dev/null @@ -1,8 +0,0 @@ -// edition:2018 - -#![feature(async_closure)] - -fn main() { - let _ = async |x: u8| {}; - //~^ ERROR `async` non-`move` closures with parameters are not currently supported -} diff --git a/src/test/ui/async-await/no-params-non-move-async-closure.stderr b/src/test/ui/async-await/no-params-non-move-async-closure.stderr deleted file mode 100644 index 1f589c516..000000000 --- a/src/test/ui/async-await/no-params-non-move-async-closure.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0708]: `async` non-`move` closures with parameters are not currently supported - --> $DIR/no-params-non-move-async-closure.rs:6:13 - | -LL | let _ = async |x: u8| {}; - | ^^^^^^^^^^^^^ - | - = help: consider using `let` statements to manually capture variables by reference before entering an `async move` closure - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0708`. diff --git a/src/test/ui/async-await/no-std.rs b/src/test/ui/async-await/no-std.rs deleted file mode 100644 index 63e93cdff..000000000 --- a/src/test/ui/async-await/no-std.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2018 -// check-pass - -#![no_std] -#![crate_type = "rlib"] - -use core::future::Future; - -async fn a(f: impl Future) { - f.await; -} - -fn main() {} diff --git a/src/test/ui/async-await/no-unsafe-async.rs b/src/test/ui/async-await/no-unsafe-async.rs deleted file mode 100644 index f40154e16..000000000 --- a/src/test/ui/async-await/no-unsafe-async.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -struct S; - -impl S { - #[cfg(FALSE)] - unsafe async fn g() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async` -} - -#[cfg(FALSE)] -unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async` diff --git a/src/test/ui/async-await/no-unsafe-async.stderr b/src/test/ui/async-await/no-unsafe-async.stderr deleted file mode 100644 index f23d17d6b..000000000 --- a/src/test/ui/async-await/no-unsafe-async.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error: expected one of `extern` or `fn`, found keyword `async` - --> $DIR/no-unsafe-async.rs:7:12 - | -LL | impl S { - | - while parsing this item list starting here -LL | #[cfg(FALSE)] -LL | unsafe async fn g() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `async` must come before `unsafe`: `async unsafe` -LL | } - | - the item list ends here - | - = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` - -error: expected one of `extern` or `fn`, found keyword `async` - --> $DIR/no-unsafe-async.rs:11:8 - | -LL | unsafe async fn f() {} - | -------^^^^^ - | | | - | | expected one of `extern` or `fn` - | help: `async` must come before `unsafe`: `async unsafe` - | - = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/async-await/non-trivial-drop.rs b/src/test/ui/async-await/non-trivial-drop.rs deleted file mode 100644 index a3167215d..000000000 --- a/src/test/ui/async-await/non-trivial-drop.rs +++ /dev/null @@ -1,36 +0,0 @@ -// build-pass -// edition:2018 -// compile-flags: -Zdrop-tracking=y - -#![feature(generators)] - -fn main() { - let _ = foo(); -} - -fn foo() { - || { - yield drop(Config { - nickname: NonCopy, - b: NonCopy2, - }.nickname); - }; -} - -#[derive(Default)] -struct NonCopy; -impl Drop for NonCopy { - fn drop(&mut self) {} -} - -#[derive(Default)] -struct NonCopy2; -impl Drop for NonCopy2 { - fn drop(&mut self) {} -} - -#[derive(Default)] -struct Config { - nickname: NonCopy, - b: NonCopy2, -} diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr deleted file mode 100644 index 17b4ef7bd..000000000 --- a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `NotSend` cannot be sent between threads safely - --> $DIR/partial-drop-partial-reinit.rs:9:16 - | -LL | gimme_send(foo()); - | ---------- ^^^^^ `NotSend` cannot be sent between threads safely - | | - | required by a bound introduced by this call -... -LL | async fn foo() { - | - within this `impl Future` - | - = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` - = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future` -note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 - | -LL | async fn foo() { - | ________________^ -LL | | -LL | | -LL | | let mut x = (NotSend {},); -... | -LL | | bar().await; -LL | | } - | |_^ -note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 - | -LL | fn gimme_send(t: T) { - | ^^^^ required by this bound in `gimme_send` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr deleted file mode 100644 index 34d8a159f..000000000 --- a/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `NotSend` cannot be sent between threads safely - --> $DIR/partial-drop-partial-reinit.rs:9:16 - | -LL | gimme_send(foo()); - | ---------- ^^^^^ `NotSend` cannot be sent between threads safely - | | - | required by a bound introduced by this call -... -LL | async fn foo() { - | - within this `impl Future` - | - = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` - = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future`, `()` -note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 - | -LL | async fn foo() { - | ________________^ -LL | | -LL | | -LL | | let mut x = (NotSend {},); -... | -LL | | bar().await; -LL | | } - | |_^ -note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 - | -LL | fn gimme_send(t: T) { - | ^^^^ required by this bound in `gimme_send` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.rs b/src/test/ui/async-await/partial-drop-partial-reinit.rs deleted file mode 100644 index 7d097e72f..000000000 --- a/src/test/ui/async-await/partial-drop-partial-reinit.rs +++ /dev/null @@ -1,40 +0,0 @@ -// edition:2021 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no -#![feature(negative_impls)] -#![allow(unused)] - -fn main() { - gimme_send(foo()); - //~^ ERROR cannot be sent between threads safely - //~| NOTE cannot be sent - //~| NOTE bound introduced by - //~| NOTE appears within the type - //~| NOTE captures the following types -} - -fn gimme_send(t: T) { - //~^ NOTE required by this bound - //~| NOTE required by a bound - drop(t); -} - -struct NotSend {} - -impl Drop for NotSend { - fn drop(&mut self) {} -} - -impl !Send for NotSend {} - -async fn foo() { - //~^ NOTE used within this `async fn` body - //~| NOTE within this `impl Future - let mut x = (NotSend {},); - drop(x.0); - x.0 = NotSend {}; - bar().await; -} - -async fn bar() {} diff --git a/src/test/ui/async-await/partial-initialization-across-await.rs b/src/test/ui/async-await/partial-initialization-across-await.rs deleted file mode 100644 index 7577aee3f..000000000 --- a/src/test/ui/async-await/partial-initialization-across-await.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Test that we don't allow awaiting from an async fn while a local is partially -// initialized. - -// edition:2018 - -struct S { x: i32, y: i32 } -struct T(i32, i32); - -async fn noop() {} - -async fn test_tuple() { - let mut t: (i32, i32); - t.0 = 42; //~ ERROR E0381 - noop().await; - t.1 = 88; - let _ = t; -} - -async fn test_tuple_struct() { - let mut t: T; - t.0 = 42; //~ ERROR E0381 - noop().await; - t.1 = 88; - let _ = t; -} - -async fn test_struct() { - let mut t: S; - t.x = 42; //~ ERROR E0381 - noop().await; - t.y = 88; - let _ = t; -} - -fn main() { - let _ = test_tuple(); - let _ = test_tuple_struct(); - let _ = test_struct(); -} diff --git a/src/test/ui/async-await/partial-initialization-across-await.stderr b/src/test/ui/async-await/partial-initialization-across-await.stderr deleted file mode 100644 index 6a0eeffb9..000000000 --- a/src/test/ui/async-await/partial-initialization-across-await.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0381]: partially assigned binding `t` isn't fully initialized - --> $DIR/partial-initialization-across-await.rs:13:5 - | -LL | let mut t: (i32, i32); - | ----- binding declared here but left uninitialized -LL | t.0 = 42; - | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized - | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` - -error[E0381]: partially assigned binding `t` isn't fully initialized - --> $DIR/partial-initialization-across-await.rs:21:5 - | -LL | let mut t: T; - | ----- binding declared here but left uninitialized -LL | t.0 = 42; - | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized - | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` - -error[E0381]: partially assigned binding `t` isn't fully initialized - --> $DIR/partial-initialization-across-await.rs:29:5 - | -LL | let mut t: S; - | ----- binding declared here but left uninitialized -LL | t.x = 42; - | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized - | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0381`. diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.rs b/src/test/ui/async-await/pin-needed-to-poll-2.rs deleted file mode 100644 index 6ce70336d..000000000 --- a/src/test/ui/async-await/pin-needed-to-poll-2.rs +++ /dev/null @@ -1,48 +0,0 @@ -use std::{ - future::Future, - pin::Pin, - marker::Unpin, - task::{Context, Poll}, -}; - -struct Sleep(std::marker::PhantomPinned); - -impl Future for Sleep { - type Output = (); - - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - Poll::Ready(()) - } -} - -impl Drop for Sleep { - fn drop(&mut self) {} -} - -fn sleep() -> Sleep { - Sleep(std::marker::PhantomPinned) -} - - -struct MyFuture { - sleep: Sleep, -} - -impl MyFuture { - fn new() -> Self { - Self { - sleep: sleep(), - } - } -} - -impl Future for MyFuture { - type Output = (); - - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - Pin::new(&mut self.sleep).poll(cx) - //~^ ERROR `PhantomPinned` cannot be unpinned - } -} - -fn main() {} diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.stderr b/src/test/ui/async-await/pin-needed-to-poll-2.stderr deleted file mode 100644 index 83d1a02c8..000000000 --- a/src/test/ui/async-await/pin-needed-to-poll-2.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/pin-needed-to-poll-2.rs:43:18 - | -LL | Pin::new(&mut self.sleep).poll(cx) - | -------- ^^^^^^^^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned` - | | - | required by a bound introduced by this call - | - = note: consider using `Box::pin` -note: required because it appears within the type `Sleep` - --> $DIR/pin-needed-to-poll-2.rs:8:8 - | -LL | struct Sleep(std::marker::PhantomPinned); - | ^^^^^ -note: required by a bound in `Pin::

::new` - --> $SRC_DIR/core/src/pin.rs:LL:COL - | -LL | impl> Pin

{ - | ^^^^^ required by this bound in `Pin::

::new` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/pin-needed-to-poll.rs b/src/test/ui/async-await/pin-needed-to-poll.rs deleted file mode 100644 index 0d1fe684f..000000000 --- a/src/test/ui/async-await/pin-needed-to-poll.rs +++ /dev/null @@ -1,47 +0,0 @@ -use std::{ - future::Future, - pin::Pin, - task::{Context, Poll}, -}; - -struct Sleep; - -impl Future for Sleep { - type Output = (); - - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - Poll::Ready(()) - } -} - -impl Drop for Sleep { - fn drop(&mut self) {} -} - -fn sleep() -> Sleep { - Sleep -} - - -struct MyFuture { - sleep: Sleep, -} - -impl MyFuture { - fn new() -> Self { - Self { - sleep: sleep(), - } - } -} - -impl Future for MyFuture { - type Output = (); - - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - self.sleep.poll(cx) - //~^ ERROR no method named `poll` found for struct `Sleep` in the current scope - } -} - -fn main() {} diff --git a/src/test/ui/async-await/pin-needed-to-poll.stderr b/src/test/ui/async-await/pin-needed-to-poll.stderr deleted file mode 100644 index 2e8723b27..000000000 --- a/src/test/ui/async-await/pin-needed-to-poll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0599]: no method named `poll` found for struct `Sleep` in the current scope - --> $DIR/pin-needed-to-poll.rs:42:20 - | -LL | struct Sleep; - | ------------ method `poll` not found for this struct -... -LL | self.sleep.poll(cx) - | ^^^^ method not found in `Sleep` - | - ::: $SRC_DIR/core/src/future/future.rs:LL:COL - | -LL | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll; - | ---- the method is available for `Pin<&mut Sleep>` here - | -help: consider wrapping the receiver expression with the appropriate type - | -LL | Pin::new(&mut self.sleep).poll(cx) - | +++++++++++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/async-await/proper-span-for-type-error.fixed b/src/test/ui/async-await/proper-span-for-type-error.fixed deleted file mode 100644 index 7d43b575d..000000000 --- a/src/test/ui/async-await/proper-span-for-type-error.fixed +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2021 -// run-rustfix -#![allow(dead_code)] - -async fn a() {} - -async fn foo() -> Result<(), i32> { - a().await; - Ok(()) //~ ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/async-await/proper-span-for-type-error.rs b/src/test/ui/async-await/proper-span-for-type-error.rs deleted file mode 100644 index 00ccde1bf..000000000 --- a/src/test/ui/async-await/proper-span-for-type-error.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2021 -// run-rustfix -#![allow(dead_code)] - -async fn a() {} - -async fn foo() -> Result<(), i32> { - a().await //~ ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/async-await/proper-span-for-type-error.stderr b/src/test/ui/async-await/proper-span-for-type-error.stderr deleted file mode 100644 index 25f05156c..000000000 --- a/src/test/ui/async-await/proper-span-for-type-error.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/proper-span-for-type-error.rs:8:5 - | -LL | a().await - | ^^^^^^^^^ expected enum `Result`, found `()` - | - = note: expected enum `Result<(), i32>` - found unit type `()` -help: try adding an expression at the end of the block - | -LL ~ a().await; -LL ~ Ok(()) - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/recursive-async-impl-trait-type.rs b/src/test/ui/async-await/recursive-async-impl-trait-type.rs deleted file mode 100644 index edc4cb8ac..000000000 --- a/src/test/ui/async-await/recursive-async-impl-trait-type.rs +++ /dev/null @@ -1,10 +0,0 @@ -// edition:2018 -// Test that impl trait does not allow creating recursive types that are -// otherwise forbidden when using `async` and `await`. - -async fn recursive_async_function() -> () { - //~^ ERROR recursion in an `async fn` requires boxing - recursive_async_function().await; -} - -fn main() {} diff --git a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr b/src/test/ui/async-await/recursive-async-impl-trait-type.stderr deleted file mode 100644 index 63f64f445..000000000 --- a/src/test/ui/async-await/recursive-async-impl-trait-type.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/recursive-async-impl-trait-type.rs:5:40 - | -LL | async fn recursive_async_function() -> () { - | ^^ recursive `async fn` - | - = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` - = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0733`. diff --git a/src/test/ui/async-await/repeat_count_const_in_async_fn.rs b/src/test/ui/async-await/repeat_count_const_in_async_fn.rs deleted file mode 100644 index ebabc3fbf..000000000 --- a/src/test/ui/async-await/repeat_count_const_in_async_fn.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// edition:2018 -// compile-flags: --crate-type=lib - -pub async fn test() { - const C: usize = 4; - foo(&mut [0u8; C]).await; -} - -async fn foo(_: &mut [u8]) {} diff --git a/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs b/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs deleted file mode 100644 index 9fe0869ca..000000000 --- a/src/test/ui/async-await/return-ty-raw-ptr-coercion.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Check that we apply unsizing coercions based on the return type. -// -// Also serves as a regression test for #60424. -// -// edition:2018 -// check-pass - -#![allow(warnings)] - -use std::fmt::Debug; - -const TMP: u32 = 22; - -// Coerce from `&u32` to `*const u32` -fn raw_pointer_coercion() { - fn sync_example() -> *const u32 { - &TMP - } - - async fn async_example() -> *const u32 { - &TMP - } -} - -fn main() {} diff --git a/src/test/ui/async-await/return-ty-unsize-coercion.rs b/src/test/ui/async-await/return-ty-unsize-coercion.rs deleted file mode 100644 index 93832ef7e..000000000 --- a/src/test/ui/async-await/return-ty-unsize-coercion.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Check that we apply unsizing coercions based on the return type. -// -// Also serves as a regression test for #60424. -// -// edition:2018 -// check-pass - -#![allow(warnings)] - -use std::fmt::Debug; - -// Unsizing coercion from `Box<&'static str>` to `Box`. -fn unsize_trait_coercion() { - fn sync_example() -> Box { - Box::new("asdf") - } - - async fn async_example() -> Box { - Box::new("asdf") - } -} - -// Unsizing coercion from `Box<[u32; N]>` to `Box<[32]>`. -fn unsize_slice_coercion() { - fn sync_example() -> Box<[u32]> { - Box::new([0]) - } - - async fn async_example() -> Box<[u32]> { - Box::new([0]) - } -} - -// Unsizing coercion from `&[&str; 1]` to `&[&str]` -fn unsize_slice_str_coercion() { - fn sync_example() -> &'static [&'static str] { - &["hi"] - } - - async fn async_example() -> &'static [&'static str] { - &["hi"] - } -} - -fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await-closure.fixed b/src/test/ui/async-await/suggest-missing-await-closure.fixed deleted file mode 100644 index febcd0218..000000000 --- a/src/test/ui/async-await/suggest-missing-await-closure.fixed +++ /dev/null @@ -1,23 +0,0 @@ -// edition:2018 -// run-rustfix - -#![feature(async_closure)] - -fn take_u32(_x: u32) {} - -async fn make_u32() -> u32 { - 22 -} - -#[allow(unused)] -async fn suggest_await_in_async_closure() { - async || { - let x = make_u32(); - take_u32(x.await) - //~^ ERROR mismatched types [E0308] - //~| HELP consider `await`ing on the `Future` - //~| SUGGESTION .await - }; -} - -fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await-closure.rs b/src/test/ui/async-await/suggest-missing-await-closure.rs deleted file mode 100644 index faabf6ee3..000000000 --- a/src/test/ui/async-await/suggest-missing-await-closure.rs +++ /dev/null @@ -1,23 +0,0 @@ -// edition:2018 -// run-rustfix - -#![feature(async_closure)] - -fn take_u32(_x: u32) {} - -async fn make_u32() -> u32 { - 22 -} - -#[allow(unused)] -async fn suggest_await_in_async_closure() { - async || { - let x = make_u32(); - take_u32(x) - //~^ ERROR mismatched types [E0308] - //~| HELP consider `await`ing on the `Future` - //~| SUGGESTION .await - }; -} - -fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await-closure.stderr b/src/test/ui/async-await/suggest-missing-await-closure.stderr deleted file mode 100644 index a5958baff..000000000 --- a/src/test/ui/async-await/suggest-missing-await-closure.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/suggest-missing-await-closure.rs:16:18 - | -LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type - | | - | arguments to this function are incorrect - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await-closure.rs:8:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` -note: function defined here - --> $DIR/suggest-missing-await-closure.rs:6:4 - | -LL | fn take_u32(_x: u32) {} - | ^^^^^^^^ ------- -help: consider `await`ing on the `Future` - | -LL | take_u32(x.await) - | ++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/suggest-missing-await.rs b/src/test/ui/async-await/suggest-missing-await.rs deleted file mode 100644 index 796f82e77..000000000 --- a/src/test/ui/async-await/suggest-missing-await.rs +++ /dev/null @@ -1,74 +0,0 @@ -// edition:2018 - -fn take_u32(_x: u32) {} - -async fn make_u32() -> u32 { - 22 -} - -#[allow(unused)] -async fn suggest_await_in_async_fn() { - let x = make_u32(); - take_u32(x) - //~^ ERROR mismatched types [E0308] - //~| HELP consider `await`ing on the `Future` - //~| SUGGESTION .await -} - -async fn dummy() {} - -#[allow(unused)] -async fn suggest_await_in_async_fn_return() { - dummy() - //~^ ERROR mismatched types [E0308] - //~| HELP consider `await`ing on the `Future` - //~| HELP consider using a semicolon here - //~| SUGGESTION .await -} - -#[allow(unused)] -async fn suggest_await_on_if() { - let _x = if true { - dummy() - //~^ HELP consider `await`ing on the `Future` - } else { - dummy().await - //~^ ERROR `if` and `else` have incompatible types [E0308] - }; -} - -#[allow(unused)] -async fn suggest_await_on_previous_match_arms() { - let _x = match 0usize { - 0 => dummy(), //~ HELP consider `await`ing on the `Future` - 1 => dummy(), - 2 => dummy().await, - //~^ `match` arms have incompatible types [E0308] - }; -} - -#[allow(unused)] -async fn suggest_await_on_match_expr() { - let _x = match dummy() { //~ HELP consider `await`ing on the `Future` - () => {} //~ ERROR mismatched types [E0308] - }; -} - -async fn dummy_result() -> Result<(), ()> { - Ok(()) -} - -#[allow(unused)] -async fn suggest_await_in_generic_pattern() { - match dummy_result() { - //~^ HELP consider `await`ing on the `Future` - //~| HELP consider `await`ing on the `Future` - //~| SUGGESTION .await - Ok(_) => {} - //~^ ERROR mismatched types [E0308] - Err(_) => {} - //~^ ERROR mismatched types [E0308] - } -} - -fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr deleted file mode 100644 index 1196601ac..000000000 --- a/src/test/ui/async-await/suggest-missing-await.stderr +++ /dev/null @@ -1,167 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:12:14 - | -LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type - | | - | arguments to this function are incorrect - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:5:24 - | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` -note: function defined here - --> $DIR/suggest-missing-await.rs:3:4 - | -LL | fn take_u32(_x: u32) {} - | ^^^^^^^^ ------- -help: consider `await`ing on the `Future` - | -LL | take_u32(x.await) - | ++++++ - -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:22:5 - | -LL | dummy() - | ^^^^^^^ expected `()`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` -help: consider `await`ing on the `Future` - | -LL | dummy().await - | ++++++ -help: consider using a semicolon here - | -LL | dummy(); - | + - -error[E0308]: `if` and `else` have incompatible types - --> $DIR/suggest-missing-await.rs:35:9 - | -LL | let _x = if true { - | ______________- -LL | | dummy() - | | ------- expected because of this -LL | | -LL | | } else { -LL | | dummy().await - | | ^^^^^^^^^^^^^ expected opaque type, found `()` -LL | | -LL | | }; - | |_____- `if` and `else` have incompatible types - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future` - found unit type `()` -help: consider `await`ing on the `Future` - | -LL | dummy().await - | ++++++ - -error[E0308]: `match` arms have incompatible types - --> $DIR/suggest-missing-await.rs:45:14 - | -LL | let _x = match 0usize { - | ______________- -LL | | 0 => dummy(), - | | ------- this is found to be of type `impl Future` -LL | | 1 => dummy(), - | | ------- this is found to be of type `impl Future` -LL | | 2 => dummy().await, - | | ^^^^^^^^^^^^^ expected opaque type, found `()` -LL | | -LL | | }; - | |_____- `match` arms have incompatible types - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future` - found unit type `()` -help: consider `await`ing on the `Future` - | -LL ~ 0 => dummy().await, -LL ~ 1 => dummy().await, - | - -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:53:9 - | -LL | let _x = match dummy() { - | ------- this expression has type `impl Future` -LL | () => {} - | ^^ expected opaque type, found `()` - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future` - found unit type `()` -help: consider `await`ing on the `Future` - | -LL | let _x = match dummy().await { - | ++++++ - -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:67:9 - | -LL | match dummy_result() { - | -------------- this expression has type `impl Future>` -... -LL | Ok(_) => {} - | ^^^^^ expected opaque type, found enum `Result` - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 - | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future>` - found enum `Result<_, _>` -help: consider `await`ing on the `Future` - | -LL | match dummy_result().await { - | ++++++ - -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:69:9 - | -LL | match dummy_result() { - | -------------- this expression has type `impl Future>` -... -LL | Err(_) => {} - | ^^^^^^ expected opaque type, found enum `Result` - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 - | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type - = note: expected opaque type `impl Future>` - found enum `Result<_, _>` -help: consider `await`ing on the `Future` - | -LL | match dummy_result().await { - | ++++++ - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.rs b/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.rs deleted file mode 100644 index 4919e0a05..000000000 --- a/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.rs +++ /dev/null @@ -1,47 +0,0 @@ -// rustc-env:CARGO=/usr/bin/cargo - -use std::pin::Pin; -use std::future::Future; - -fn main() {} - -fn await_on_struct_missing() { - struct S; - let x = S; - x.await; - //~^ ERROR no field `await` on type - //~| NOTE unknown field - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP set `edition = "2021"` in `Cargo.toml` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_struct_similar() { - struct S { - awai: u8, - } - let x = S { awai: 42 }; - x.await; - //~^ ERROR no field `await` on type - //~| HELP a field with a similar name exists - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP set `edition = "2021"` in `Cargo.toml` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_63533(x: Pin<&mut dyn Future>) { - x.await; - //~^ ERROR no field `await` on type - //~| NOTE unknown field - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP set `edition = "2021"` in `Cargo.toml` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_apit(x: impl Future) { - x.await; - //~^ ERROR no field `await` on type - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP set `edition = "2021"` in `Cargo.toml` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} diff --git a/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.stderr b/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.stderr deleted file mode 100644 index 409eb179e..000000000 --- a/src/test/ui/async-await/suggest-switching-edition-on-await-cargo.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0609]: no field `await` on type `await_on_struct_missing::S` - --> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7 - | -LL | x.await; - | ^^^^^ unknown field - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: set `edition = "2021"` in `Cargo.toml` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `await_on_struct_similar::S` - --> $DIR/suggest-switching-edition-on-await-cargo.rs:24:7 - | -LL | x.await; - | ^^^^^ help: a field with a similar name exists: `awai` - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: set `edition = "2021"` in `Cargo.toml` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `Pin<&mut dyn Future>` - --> $DIR/suggest-switching-edition-on-await-cargo.rs:33:7 - | -LL | x.await; - | ^^^^^ unknown field - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: set `edition = "2021"` in `Cargo.toml` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `impl Future` - --> $DIR/suggest-switching-edition-on-await-cargo.rs:42:7 - | -LL | x.await; - | ^^^^^ - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: set `edition = "2021"` in `Cargo.toml` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0609`. diff --git a/src/test/ui/async-await/suggest-switching-edition-on-await.rs b/src/test/ui/async-await/suggest-switching-edition-on-await.rs deleted file mode 100644 index 9852e8fc9..000000000 --- a/src/test/ui/async-await/suggest-switching-edition-on-await.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::pin::Pin; -use std::future::Future; - -fn main() {} - -fn await_on_struct_missing() { - struct S; - let x = S; - x.await; - //~^ ERROR no field `await` on type - //~| NOTE unknown field - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP pass `--edition 2021` to `rustc` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_struct_similar() { - struct S { - awai: u8, - } - let x = S { awai: 42 }; - x.await; - //~^ ERROR no field `await` on type - //~| HELP a field with a similar name exists - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP pass `--edition 2021` to `rustc` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_63533(x: Pin<&mut dyn Future>) { - x.await; - //~^ ERROR no field `await` on type - //~| NOTE unknown field - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP pass `--edition 2021` to `rustc` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} - -fn await_on_apit(x: impl Future) { - x.await; - //~^ ERROR no field `await` on type - //~| NOTE to `.await` a `Future`, switch to Rust 2018 - //~| HELP pass `--edition 2021` to `rustc` - //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide -} diff --git a/src/test/ui/async-await/suggest-switching-edition-on-await.stderr b/src/test/ui/async-await/suggest-switching-edition-on-await.stderr deleted file mode 100644 index ef3334381..000000000 --- a/src/test/ui/async-await/suggest-switching-edition-on-await.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0609]: no field `await` on type `await_on_struct_missing::S` - --> $DIR/suggest-switching-edition-on-await.rs:9:7 - | -LL | x.await; - | ^^^^^ unknown field - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `await_on_struct_similar::S` - --> $DIR/suggest-switching-edition-on-await.rs:22:7 - | -LL | x.await; - | ^^^^^ help: a field with a similar name exists: `awai` - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `Pin<&mut dyn Future>` - --> $DIR/suggest-switching-edition-on-await.rs:31:7 - | -LL | x.await; - | ^^^^^ unknown field - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0609]: no field `await` on type `impl Future` - --> $DIR/suggest-switching-edition-on-await.rs:40:7 - | -LL | x.await; - | ^^^^^ - | - = note: to `.await` a `Future`, switch to Rust 2018 or later - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0609`. diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.rs b/src/test/ui/async-await/track-caller/async-closure-gate.rs deleted file mode 100644 index d9d556855..000000000 --- a/src/test/ui/async-await/track-caller/async-closure-gate.rs +++ /dev/null @@ -1,9 +0,0 @@ -// edition:2021 - -#![feature(async_closure, stmt_expr_attributes)] - -fn main() { - let _ = #[track_caller] async || { - //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658] - }; -} diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.stderr b/src/test/ui/async-await/track-caller/async-closure-gate.stderr deleted file mode 100644 index 498f1b43b..000000000 --- a/src/test/ui/async-await/track-caller/async-closure-gate.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `#[track_caller]` on closures is currently unstable - --> $DIR/async-closure-gate.rs:6:13 - | -LL | let _ = #[track_caller] async || { - | ^^^^^^^^^^^^^^^ - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/track-caller/issue-105134.rs b/src/test/ui/async-await/track-caller/issue-105134.rs deleted file mode 100644 index 4e52b8e25..000000000 --- a/src/test/ui/async-await/track-caller/issue-105134.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// edition:2021 - -#[track_caller] -fn f() { - let _ = async {}; -} - -fn main() { - f(); -} diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr b/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr deleted file mode 100644 index 51ea225f4..000000000 --- a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: `#[track_caller]` on async functions is a no-op - --> $DIR/panic-track-caller.rs:50:1 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ -LL | / async fn bar_track_caller() { -LL | | panic!() -LL | | } - | |_- this function will not propagate the caller location - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - = note: `#[warn(ungated_async_fn_track_caller)]` on by default - -warning: `#[track_caller]` on async functions is a no-op - --> $DIR/panic-track-caller.rs:62:5 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ -LL | / async fn bar_assoc() { -LL | | panic!(); -LL | | } - | |_____- this function will not propagate the caller location - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - -warning: 2 warnings emitted - diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.rs b/src/test/ui/async-await/track-caller/panic-track-caller.rs deleted file mode 100644 index 118361d6c..000000000 --- a/src/test/ui/async-await/track-caller/panic-track-caller.rs +++ /dev/null @@ -1,100 +0,0 @@ -// run-pass -// edition:2021 -// revisions: feat nofeat -// needs-unwind -#![feature(async_closure, stmt_expr_attributes)] -#![cfg_attr(feat, feature(closure_track_caller))] - -use std::future::Future; -use std::panic; -use std::sync::{Arc, Mutex}; -use std::task::{Context, Poll, Wake}; -use std::thread::{self, Thread}; - -/// A waker that wakes up the current thread when called. -struct ThreadWaker(Thread); - -impl Wake for ThreadWaker { - fn wake(self: Arc) { - self.0.unpark(); - } -} - -/// Run a future to completion on the current thread. -fn block_on(fut: impl Future) -> T { - // Pin the future so it can be polled. - let mut fut = Box::pin(fut); - - // Create a new context to be passed to the future. - let t = thread::current(); - let waker = Arc::new(ThreadWaker(t)).into(); - let mut cx = Context::from_waker(&waker); - - // Run the future to completion. - loop { - match fut.as_mut().poll(&mut cx) { - Poll::Ready(res) => return res, - Poll::Pending => thread::park(), - } - } -} - -async fn bar() { - panic!() -} - -async fn foo() { - bar().await -} - -#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op -async fn bar_track_caller() { - panic!() -} - -async fn foo_track_caller() { - bar_track_caller().await -} - -struct Foo; - -impl Foo { - #[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op - async fn bar_assoc() { - panic!(); - } -} - -async fn foo_assoc() { - Foo::bar_assoc().await -} - -fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { - let loc = Arc::new(Mutex::new(None)); - - let hook = panic::take_hook(); - { - let loc = loc.clone(); - panic::set_hook(Box::new(move |info| { - *loc.lock().unwrap() = info.location().map(|loc| loc.line()) - })); - } - panic::catch_unwind(f).unwrap_err(); - panic::set_hook(hook); - let x = loc.lock().unwrap().unwrap(); - x -} - -fn main() { - assert_eq!(panicked_at(|| block_on(foo())), 43); - - #[cfg(feat)] - assert_eq!(panicked_at(|| block_on(foo_track_caller())), 56); - #[cfg(nofeat)] - assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52); - - #[cfg(feat)] - assert_eq!(panicked_at(|| block_on(foo_assoc())), 69); - #[cfg(nofeat)] - assert_eq!(panicked_at(|| block_on(foo_assoc())), 64); -} diff --git a/src/test/ui/async-await/try-on-option-in-async.rs b/src/test/ui/async-await/try-on-option-in-async.rs deleted file mode 100644 index afaaed2ef..000000000 --- a/src/test/ui/async-await/try-on-option-in-async.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(async_closure)] -// edition:2018 -fn main() {} - -async fn an_async_block() -> u32 { - async { - let x: Option = None; - x?; //~ ERROR the `?` operator - 22 - } - .await -} - -async fn async_closure_containing_fn() -> u32 { - let async_closure = async || { - let x: Option = None; - x?; //~ ERROR the `?` operator - 22_u32 - }; - - async_closure().await -} - -async fn an_async_function() -> u32 { - let x: Option = None; - x?; //~ ERROR the `?` operator - 22 -} diff --git a/src/test/ui/async-await/try-on-option-in-async.stderr b/src/test/ui/async-await/try-on-option-in-async.stderr deleted file mode 100644 index 4c7b4fa41..000000000 --- a/src/test/ui/async-await/try-on-option-in-async.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:8:10 - | -LL | / async { -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in an async block that returns `{integer}` -LL | | 22 -LL | | } - | |_____- this function should return `Result` or `Option` to accept `?` - | - = help: the trait `FromResidual>` is not implemented for `{integer}` - -error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:17:10 - | -LL | let async_closure = async || { - | __________________________________- -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in an async closure that returns `u32` -LL | | 22_u32 -LL | | }; - | |_____- this function should return `Result` or `Option` to accept `?` - | - = help: the trait `FromResidual>` is not implemented for `u32` - -error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/try-on-option-in-async.rs:26:6 - | -LL | async fn an_async_function() -> u32 { - | _____________________________________- -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in an async function that returns `u32` -LL | | 22 -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` - | - = help: the trait `FromResidual>` is not implemented for `u32` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/type-parameter-send.rs b/src/test/ui/async-await/type-parameter-send.rs deleted file mode 100644 index ab2b62aa5..000000000 --- a/src/test/ui/async-await/type-parameter-send.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass -// compile-flags: --crate-type lib -// edition:2018 - -fn assert_send(_: F) {} - -async fn __post() -> T { - if false { - todo!() - } else { - async {}.await; - todo!() - } -} - -fn foo() { - assert_send(__post::()); -} diff --git a/src/test/ui/async-await/unnecessary-await.rs b/src/test/ui/async-await/unnecessary-await.rs deleted file mode 100644 index 24673777b..000000000 --- a/src/test/ui/async-await/unnecessary-await.rs +++ /dev/null @@ -1,14 +0,0 @@ -// edition:2018 - -async fn foo () { } -fn bar() -> impl std::future::Future { async {} } -fn boo() {} - -async fn baz() -> std::io::Result<()> { - foo().await; - boo().await; //~ ERROR `()` is not a future - bar().await; - std::io::Result::Ok(()) -} - -fn main() {} diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr deleted file mode 100644 index dc3089336..000000000 --- a/src/test/ui/async-await/unnecessary-await.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/unnecessary-await.rs:9:10 - | -LL | boo().await; - | -----^^^^^^ `()` is not a future - | | - | this call returns `()` - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required for `()` to implement `IntoFuture` -help: remove the `.await` - | -LL - boo().await; -LL + boo(); - | -help: alternatively, consider making `fn boo` asynchronous - | -LL | async fn boo() {} - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/unreachable-lint-1.rs b/src/test/ui/async-await/unreachable-lint-1.rs deleted file mode 100644 index d63d643c4..000000000 --- a/src/test/ui/async-await/unreachable-lint-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// edition:2018 -#![deny(unreachable_code)] - -async fn foo() { - return; bar().await; - //~^ ERROR unreachable statement -} - -async fn bar() { -} - -fn main() { } diff --git a/src/test/ui/async-await/unreachable-lint-1.stderr b/src/test/ui/async-await/unreachable-lint-1.stderr deleted file mode 100644 index e93257889..000000000 --- a/src/test/ui/async-await/unreachable-lint-1.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: unreachable statement - --> $DIR/unreachable-lint-1.rs:5:13 - | -LL | return; bar().await; - | ------ ^^^^^^^^^^^^ unreachable statement - | | - | any code following this expression is unreachable - | -note: the lint level is defined here - --> $DIR/unreachable-lint-1.rs:2:9 - | -LL | #![deny(unreachable_code)] - | ^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/unreachable-lint.rs b/src/test/ui/async-await/unreachable-lint.rs deleted file mode 100644 index ca18cfde4..000000000 --- a/src/test/ui/async-await/unreachable-lint.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// edition:2018 -#![deny(unreachable_code)] - -async fn foo() { - endless().await; -} - -async fn endless() -> ! { - loop {} -} - -fn main() { } diff --git a/src/test/ui/async-await/unresolved_type_param.rs b/src/test/ui/async-await/unresolved_type_param.rs deleted file mode 100644 index 6d6d80614..000000000 --- a/src/test/ui/async-await/unresolved_type_param.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Provoke an unresolved type error (T). -// Error message should pinpoint the type parameter T as needing to be bound -// (rather than give a general error message) -// edition:2018 -// compile-flags: -Zdrop-tracking - -async fn bar() -> () {} - -async fn foo() { - bar().await; - //~^ ERROR type inside `async fn` body must be known in this context - //~| ERROR type inside `async fn` body must be known in this context - //~| ERROR type inside `async fn` body must be known in this context - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE in this expansion of desugaring of `await` - //~| NOTE in this expansion of desugaring of `await` - //~| NOTE in this expansion of desugaring of `await` -} -fn main() {} diff --git a/src/test/ui/async-await/unresolved_type_param.stderr b/src/test/ui/async-await/unresolved_type_param.stderr deleted file mode 100644 index 7236c681f..000000000 --- a/src/test/ui/async-await/unresolved_type_param.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 - | -LL | bar().await; - | ^^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 - | -LL | bar().await; - | ^^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 - | -LL | bar().await; - | ^^^^^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0698`. diff --git a/src/test/ui/async-await/unused-lifetime.rs b/src/test/ui/async-await/unused-lifetime.rs deleted file mode 100644 index 6cfd36ba9..000000000 --- a/src/test/ui/async-await/unused-lifetime.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Check "unused_lifetimes" lint on both async and sync functions -// Both cases should be diagnosed the same way. - -// edition:2018 - -#![deny(unused_lifetimes)] - -async fn async_wrong_without_args<'a>() {} //~ ERROR lifetime parameter `'a` never used - -async fn async_wrong_1_lifetime<'a>(_: &i32) {} //~ ERROR lifetime parameter `'a` never used - -async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} //~ ERROR lifetime parameter `'b` never used - -async fn async_right_1_lifetime<'a>(_: &'a i32) {} - -async fn async_right_2_lifetimes<'a, 'b>(_: &'a i32, _: &'b i32) {} - -async fn async_right_trait_bound_lifetime<'a, I>(_: I) -where - I: Iterator -{} - -fn wrong_without_args<'a>() {} //~ ERROR lifetime parameter `'a` never used - -fn wrong_1_lifetime<'a>(_: &i32) {} //~ ERROR lifetime parameter `'a` never used - -fn wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} //~ ERROR lifetime parameter `'b` never used - -fn right_1_lifetime<'a>(_: &'a i32) {} - -fn right_2_lifetimes<'a, 'b>(_: &'a i32, _: &'b i32) {} - -fn right_trait_bound_lifetime<'a, I>(_: I) -where - I: Iterator -{} - - -fn main() {} diff --git a/src/test/ui/async-await/unused-lifetime.stderr b/src/test/ui/async-await/unused-lifetime.stderr deleted file mode 100644 index 5c00501a6..000000000 --- a/src/test/ui/async-await/unused-lifetime.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error: lifetime parameter `'a` never used - --> $DIR/unused-lifetime.rs:8:35 - | -LL | async fn async_wrong_without_args<'a>() {} - | -^^- help: elide the unused lifetime - | -note: the lint level is defined here - --> $DIR/unused-lifetime.rs:6:9 - | -LL | #![deny(unused_lifetimes)] - | ^^^^^^^^^^^^^^^^ - -error: lifetime parameter `'a` never used - --> $DIR/unused-lifetime.rs:10:33 - | -LL | async fn async_wrong_1_lifetime<'a>(_: &i32) {} - | -^^- help: elide the unused lifetime - -error: lifetime parameter `'b` never used - --> $DIR/unused-lifetime.rs:12:38 - | -LL | async fn async_wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} - | --^^ - | | - | help: elide the unused lifetime - -error: lifetime parameter `'a` never used - --> $DIR/unused-lifetime.rs:23:23 - | -LL | fn wrong_without_args<'a>() {} - | -^^- help: elide the unused lifetime - -error: lifetime parameter `'a` never used - --> $DIR/unused-lifetime.rs:25:21 - | -LL | fn wrong_1_lifetime<'a>(_: &i32) {} - | -^^- help: elide the unused lifetime - -error: lifetime parameter `'b` never used - --> $DIR/unused-lifetime.rs:27:26 - | -LL | fn wrong_2_lifetimes<'a, 'b>(_: &'a i32, _: &i32) {} - | --^^ - | | - | help: elide the unused lifetime - -error: aborting due to 6 previous errors - -- cgit v1.2.3