summaryrefslogtreecommitdiffstats
path: root/tests/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/abi/compatibility.rs354
-rw-r--r--tests/ui/abi/debug.rs53
-rw-r--r--tests/ui/abi/debug.stderr959
-rw-r--r--tests/ui/abi/explicit_repr_rust.rs12
-rw-r--r--tests/ui/abi/relocation_model_pic.rs3
-rw-r--r--tests/ui/argument-suggestions/issue-100154.stderr6
-rw-r--r--tests/ui/argument-suggestions/two-mismatch-notes.stderr1
-rw-r--r--tests/ui/asm/aarch64/type-check-2.stderr2
-rw-r--r--tests/ui/asm/x86_64/type-check-2.stderr2
-rw-r--r--tests/ui/associated-consts/associated-const-array-len.stderr10
-rw-r--r--tests/ui/associated-consts/defaults-cyclic-fail.rs2
-rw-r--r--tests/ui/associated-consts/defaults-cyclic-fail.stderr14
-rw-r--r--tests/ui/associated-consts/defaults-not-assumed-fail.stderr6
-rw-r--r--tests/ui/associated-consts/double-elided.rs12
-rw-r--r--tests/ui/associated-consts/double-elided.stderr47
-rw-r--r--tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs2
-rw-r--r--tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr16
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr10
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr12
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr12
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr12
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-1.stderr4
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.rs21
-rw-r--r--tests/ui/associated-inherent-types/private-in-public.stderr52
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs8
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr55
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs12
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr24
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr4
-rw-r--r--tests/ui/associated-type-bounds/suggest-removing-impl.rs14
-rw-r--r--tests/ui/associated-type-bounds/suggest-removing-impl.stderr26
-rw-r--r--tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr4
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr6
-rw-r--r--tests/ui/associated-types/defaults-specialization.stderr4
-rw-r--r--tests/ui/associated-types/defaults-suitability.stderr5
-rw-r--r--tests/ui/associated-types/issue-23595-2.stderr2
-rw-r--r--tests/ui/associated-types/issue-32323.rs (renamed from tests/ui/issues/issue-32323.rs)0
-rw-r--r--tests/ui/associated-types/issue-32323.stderr (renamed from tests/ui/issues/issue-32323.stderr)0
-rw-r--r--tests/ui/associated-types/issue-44153.stderr4
-rw-r--r--tests/ui/associated-types/issue-59324.stderr6
-rw-r--r--tests/ui/associated-types/issue-64855.stderr6
-rw-r--r--tests/ui/associated-types/issue-85103-layout-debug.rs9
-rw-r--r--tests/ui/associated-types/issue-85103-layout-debug.stderr16
-rw-r--r--tests/ui/associated-types/issue-85103.rs9
-rw-r--r--tests/ui/associated-types/issue-85103.stderr8
-rw-r--r--tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr15
-rw-r--r--tests/ui/associated-types/substs-ppaux.normal.stderr4
-rw-r--r--tests/ui/associated-types/substs-ppaux.verbose.stderr4
-rw-r--r--tests/ui/async-await/async-await-let-else.drop-tracking.stderr106
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking.stderr106
-rw-r--r--tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr90
-rw-r--r--tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr90
-rw-r--r--tests/ui/async-await/async-await-let-else.rs3
-rw-r--r--tests/ui/async-await/async-await-let-else.stderr (renamed from tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr)26
-rw-r--r--tests/ui/async-await/async-block-control-flow-static-semantics.stderr8
-rw-r--r--tests/ui/async-await/async-error-span.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/async-error-span.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/async-error-span.rs7
-rw-r--r--tests/ui/async-await/async-error-span.stderr (renamed from tests/ui/async-await/async-error-span.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr49
-rw-r--r--tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr120
-rw-r--r--tests/ui/async-await/async-fn-nonsend.rs6
-rw-r--r--tests/ui/async-await/async-fn-nonsend.stderr (renamed from tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr)12
-rw-r--r--tests/ui/async-await/async-is-unwindsafe.stderr18
-rw-r--r--tests/ui/async-await/await-sequence.rs1
-rw-r--r--tests/ui/async-await/awaiting-unsized-param.rs13
-rw-r--r--tests/ui/async-await/awaiting-unsized-param.stderr21
-rw-r--r--tests/ui/async-await/const-async-fn-in-main.rs7
-rw-r--r--tests/ui/async-await/const-async-fn-in-main.stderr11
-rw-r--r--tests/ui/async-await/default-struct-update.rs3
-rw-r--r--tests/ui/async-await/drop-and-assign.rs3
-rw-r--r--tests/ui/async-await/drop-track-bad-field-in-fru.rs1
-rw-r--r--tests/ui/async-await/drop-track-bad-field-in-fru.stderr4
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.rs3
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.stderr (renamed from tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/drop-track-field-assign.rs3
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs3
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr40
-rw-r--r--tests/ui/async-await/feature-self-return-type.rs1
-rw-r--r--tests/ui/async-await/feature-self-return-type.stderr2
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.rs3
-rw-r--r--tests/ui/async-await/field-assign-nonsend.stderr (renamed from tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/field-assign.rs3
-rw-r--r--tests/ui/async-await/future-contains-err-issue-115188.rs17
-rw-r--r--tests/ui/async-await/future-contains-err-issue-115188.stderr9
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout38
-rw-r--r--tests/ui/async-await/future-sizes/large-arg.stdout44
-rw-r--r--tests/ui/async-await/generator-desc.stderr8
-rw-r--r--tests/ui/async-await/generator-not-future.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs1
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs7
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs2
-rw-r--r--tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs7
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs38
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr10
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr5
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed20
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs20
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr43
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs15
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr23
-rw-r--r--tests/ui/async-await/issue-61949-self-return-type.rs28
-rw-r--r--tests/ui/async-await/issue-61949-self-return-type.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.rs3
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.stderr (renamed from tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr)6
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.rs6
-rw-r--r--tests/ui/async-await/issue-64130-2-send.stderr (renamed from tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.rs6
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr (renamed from tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr)10
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.rs7
-rw-r--r--tests/ui/async-await/issue-64130-non-send-future-diags.stderr2
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.rs5
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.stderr (renamed from tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr)8
-rw-r--r--tests/ui/async-await/issue-68112.drop_tracking.stderr82
-rw-r--r--tests/ui/async-await/issue-68112.no_drop_tracking.stderr82
-rw-r--r--tests/ui/async-await/issue-68112.rs3
-rw-r--r--tests/ui/async-await/issue-68112.stderr (renamed from tests/ui/async-await/issue-68112.drop_tracking_mir.stderr)22
-rw-r--r--tests/ui/async-await/issue-68523-start.rs2
-rw-r--r--tests/ui/async-await/issue-68523-start.stderr4
-rw-r--r--tests/ui/async-await/issue-70818.drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.no_drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.rs3
-rw-r--r--tests/ui/async-await/issue-70818.stderr (renamed from tests/ui/async-await/issue-70818.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr41
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.rs6
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.stderr (renamed from tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr)10
-rw-r--r--tests/ui/async-await/issue-71137.stderr3
-rw-r--r--tests/ui/async-await/issue-73137.rs3
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.rs17
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking_mir.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.no_drop_tracking.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.rs3
-rw-r--r--tests/ui/async-await/issue-86507.stderr (renamed from tests/ui/async-await/issue-86507.drop_tracking.stderr)6
-rw-r--r--tests/ui/async-await/issue-93197.rs1
-rw-r--r--tests/ui/async-await/issue-93648.rs3
-rw-r--r--tests/ui/async-await/issues/auxiliary/issue_67893.rs7
-rw-r--r--tests/ui/async-await/issues/issue-107280.rs5
-rw-r--r--tests/ui/async-await/issues/issue-107280.stderr67
-rw-r--r--tests/ui/async-await/issues/issue-62009-1.stderr10
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr32
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs7
-rw-r--r--tests/ui/async-await/issues/issue-66695-static-refs.rs4
-rw-r--r--tests/ui/async-await/issues/issue-67611-static-mut-refs.rs6
-rw-r--r--tests/ui/async-await/issues/issue-67893.rs2
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr28
-rw-r--r--tests/ui/async-await/issues/issue-78600.rs2
-rw-r--r--tests/ui/async-await/issues/issue-78600.stderr14
-rw-r--r--tests/ui/async-await/missed-capture-issue-107414.rs9
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs4
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr (renamed from tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs3
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr35
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.rs3
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.stderr (renamed from tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr)8
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.rs3
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr (renamed from tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr)2
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr25
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr35
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr11
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs24
-rw-r--r--tests/ui/async-await/unresolved_type_param.drop_tracking.stderr39
-rw-r--r--tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr63
-rw-r--r--tests/ui/async-await/unresolved_type_param.rs26
-rw-r--r--tests/ui/async-await/unresolved_type_param.stderr (renamed from tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr)2
-rw-r--r--tests/ui/async-await/unsized-across-await.rs16
-rw-r--r--tests/ui/async-await/unsized-across-await.stderr21
-rw-r--r--tests/ui/attributes/issue-115264-expr-field.rs17
-rw-r--r--tests/ui/attributes/issue-115264-pat-field.rs19
-rw-r--r--tests/ui/backtrace.rs19
-rw-r--r--tests/ui/binding/match-beginning-vert.rs4
-rw-r--r--tests/ui/block-result/issue-20862.stderr2
-rw-r--r--tests/ui/borrowck/async-reference-generality.rs3
-rw-r--r--tests/ui/borrowck/async-reference-generality.stderr27
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs23
-rw-r--r--tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr24
-rw-r--r--tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs16
-rw-r--r--tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr33
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed20
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.rs20
-rw-r--r--tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr16
-rw-r--r--tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr2
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed36
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs36
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr16
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed30
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.rs30
-rw-r--r--tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr29
-rw-r--r--tests/ui/borrowck/issue-81899.stderr4
-rw-r--r--tests/ui/borrowck/issue-88434-minimal-example.stderr4
-rw-r--r--tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr4
-rw-r--r--tests/ui/borrowck/issue-92157.rs2
-rw-r--r--tests/ui/borrowck/issue-92157.stderr9
-rw-r--r--tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr2
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.fixed30
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.rs30
-rw-r--r--tests/ui/borrowck/suggest-mut-iterator.stderr16
-rw-r--r--tests/ui/c-variadic/variadic-ffi-1.stderr2
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.rs5
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.stderr2
-rw-r--r--tests/ui/cast/cast-as-bool.rs44
-rw-r--r--tests/ui/cast/cast-as-bool.stderr80
-rw-r--r--tests/ui/cast/cast-rfc0401-2.rs2
-rw-r--r--tests/ui/cast/cast-rfc0401-2.stderr9
-rw-r--r--tests/ui/cast/unsized-struct-cast.rs6
-rw-r--r--tests/ui/cast/unsized-struct-cast.stderr9
-rw-r--r--tests/ui/check-cfg/values-target-json.stderr2
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-mut.stderr2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-once.stderr2
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr33
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr33
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs37
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs55
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr3
-rw-r--r--tests/ui/closures/2229_closure_analysis/repr_packed.rs10
-rw-r--r--tests/ui/closures/2229_closure_analysis/repr_packed.stderr19
-rw-r--r--tests/ui/closures/capture-unsized-by-move.rs10
-rw-r--r--tests/ui/closures/capture-unsized-by-move.stderr14
-rw-r--r--tests/ui/closures/capture-unsized-by-ref.rs10
-rw-r--r--tests/ui/closures/closure-no-fn-1.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-2.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-3.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-4.stderr2
-rw-r--r--tests/ui/closures/closure-no-fn-5.stderr2
-rw-r--r--tests/ui/closures/closure-reform-bad.stderr2
-rw-r--r--tests/ui/closures/closure_cap_coerce_many_fail.stderr20
-rw-r--r--tests/ui/closures/issue-112547.rs15
-rw-r--r--tests/ui/closures/issue-112547.stderr23
-rw-r--r--tests/ui/closures/issue-11873.rs (renamed from tests/ui/issues/issue-11873.rs)0
-rw-r--r--tests/ui/closures/issue-11873.stderr (renamed from tests/ui/issues/issue-11873.stderr)0
-rw-r--r--tests/ui/closures/issue-25439.rs (renamed from tests/ui/issues/issue-25439.rs)0
-rw-r--r--tests/ui/closures/issue-25439.stderr (renamed from tests/ui/issues/issue-25439.stderr)0
-rw-r--r--tests/ui/closures/issue-90871.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-1.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-verbose-1.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-verbose.stderr2
-rw-r--r--tests/ui/codegen/issue-79865-llvm-miscompile.rs38
-rw-r--r--tests/ui/codegen/subtyping-enforces-type-equality.stderr1
-rw-r--r--tests/ui/coercion/coerce-expect-unsized-ascribed.stderr12
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr (renamed from tests/ui/coherence/coherence-overlap-downstream-inherent.stderr)4
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr23
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream-inherent.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.next.stderr (renamed from tests/ui/coherence/coherence-overlap-downstream.stderr)4
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.old.stderr21
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr (renamed from tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr)2
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr14
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs3
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.next.stderr (renamed from tests/ui/coherence/coherence-overlap-issue-23516.stderr)2
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.old.stderr13
-rw-r--r--tests/ui/coherence/coherence-overlap-issue-23516.rs3
-rw-r--r--tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr5
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr (renamed from tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr)2
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr14
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs3
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr4
-rw-r--r--tests/ui/confuse-field-and-method/issue-33784.stderr4
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs2
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr4
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs2
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr35
-rw-r--r--tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs44
-rw-r--r--tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr80
-rw-r--r--tests/ui/const-generics/const-param-elided-lifetime.min.stderr10
-rw-r--r--tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr4
-rw-r--r--tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr10
-rw-r--r--tests/ui/const-generics/early/const-param-from-outer-fn.rs2
-rw-r--r--tests/ui/const-generics/early/const-param-from-outer-fn.stderr8
-rw-r--r--tests/ui/const-generics/exhaustive-value.stderr4
-rw-r--r--tests/ui/const-generics/float-generic.simple.stderr1
-rw-r--r--tests/ui/const-generics/fn-const-param-call.min.stderr4
-rw-r--r--tests/ui/const-generics/fn-const-param-infer.min.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.rs7
-rw-r--r--tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr21
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-85848.stderr6
-rw-r--r--tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr1
-rw-r--r--tests/ui/const-generics/issues/issue-56445-1.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-62878.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-68615-adt.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-68615-array.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71169.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71381.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-71382.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-71611.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-72352.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-73491.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74101.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-74255.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74950.min.stderr10
-rw-r--r--tests/ui/const-generics/issues/issue-75047.min.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-86530.stderr5
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.rs25
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.stderr30
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs13
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr8
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs15
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr10
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.rs27
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.stderr29
-rw-r--r--tests/ui/const-generics/lifetime-in-const-param.stderr2
-rw-r--r--tests/ui/const-generics/min_const_generics/complex-types.stderr13
-rw-r--r--tests/ui/const-generics/nested-type.min.stderr2
-rw-r--r--tests/ui/const-generics/projection-as-arg-const.stderr1
-rw-r--r--tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr4
-rw-r--r--tests/ui/const-generics/raw-ptr-const-param.min.stderr2
-rw-r--r--tests/ui/const-generics/slice-const-param-mismatch.min.stderr4
-rw-r--r--tests/ui/const-generics/std/const-generics-range.min.stderr12
-rw-r--r--tests/ui/const-generics/transmute-const-param-static-reference.min.stderr2
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71348.min.stderr4
-rw-r--r--tests/ui/const-generics/type-dependent/issue-71382.stderr2
-rw-r--r--tests/ui/const_prop/dont-propagate-generic-instance-2.rs26
-rw-r--r--tests/ui/const_prop/dont-propagate-generic-instance.rs24
-rw-r--r--tests/ui/consts/assert-type-intrinsics.stderr6
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.rs19
-rw-r--r--tests/ui/consts/assoc-const-elided-lifetime.stderr33
-rw-r--r--tests/ui/consts/const-err-late.stderr6
-rw-r--r--tests/ui/consts/const-err-multi.stderr6
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs5
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr11
-rw-r--r--tests/ui/consts/const-eval/erroneous-const.stderr2
-rw-r--r--tests/ui/consts/const-eval/erroneous-const2.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr6
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.rs2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr4
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr6
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr6
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.64bit.stderr36
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.rs8
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.stderr (renamed from tests/ui/consts/const-eval/ub-int-array.32bit.stderr)8
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.rs16
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.stderr14
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr6
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr4
-rw-r--r--tests/ui/consts/const-float-bits-reject-conv.stderr16
-rw-r--r--tests/ui/consts/const-len-underflow-separate-spans.next.stderr2
-rw-r--r--tests/ui/consts/const-len-underflow-separate-spans.old.stderr2
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.rs3
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.stderr23
-rw-r--r--tests/ui/consts/effect_param.rs11
-rw-r--r--tests/ui/consts/effect_param.stderr19
-rw-r--r--tests/ui/consts/escaping-bound-var.rs13
-rw-r--r--tests/ui/consts/escaping-bound-var.stderr20
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr62
-rw-r--r--tests/ui/consts/invalid-union.32bit.stderr4
-rw-r--r--tests/ui/consts/invalid-union.64bit.stderr4
-rw-r--r--tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs31
-rw-r--r--tests/ui/consts/issue-36163.stderr14
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const_2.stderr4
-rw-r--r--tests/ui/consts/missing-larger-array-impl.stderr4
-rw-r--r--tests/ui/consts/std/alloc.32bit.stderr4
-rw-r--r--tests/ui/consts/std/alloc.64bit.stderr4
-rw-r--r--tests/ui/consts/std/alloc.rs1
-rw-r--r--tests/ui/consts/uninhabited-const-issue-61744.stderr4
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.rs8
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.stderr34
-rw-r--r--tests/ui/cross/cross-fn-cache-hole.stderr5
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed2
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.rs2
-rw-r--r--tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr13
-rw-r--r--tests/ui/derive-uninhabited-enum-38885.stderr1
-rw-r--r--tests/ui/deriving/deriving-all-codegen.stdout28
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs4
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr6
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr2
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs37
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr110
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs7
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr12
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs11
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr24
-rw-r--r--tests/ui/did_you_mean/bad-assoc-expr.stderr62
-rw-r--r--tests/ui/did_you_mean/bad-assoc-pat.stderr41
-rw-r--r--tests/ui/did_you_mean/bad-assoc-ty.stderr62
-rw-r--r--tests/ui/drop-bounds/drop-bounds-impl-drop.rs10
-rw-r--r--tests/ui/drop/dynamic-drop.rs18
-rw-r--r--tests/ui/dropck/coroutine-liveness-1.rs18
-rw-r--r--tests/ui/dropck/coroutine-liveness-2.rs23
-rw-r--r--tests/ui/dst/dst-bad-coerce1.stderr10
-rw-r--r--tests/ui/dyn-star/error.stderr6
-rw-r--r--tests/ui/entry-point/auxiliary/bad_main_functions.rs2
-rw-r--r--tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs6
-rw-r--r--tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr12
-rw-r--r--tests/ui/error-codes/E0040.stderr10
-rw-r--r--tests/ui/error-codes/E0054.stderr9
-rw-r--r--tests/ui/error-codes/E0094.rs2
-rw-r--r--tests/ui/error-codes/E0132.stderr4
-rw-r--r--tests/ui/error-codes/E0220.stderr2
-rw-r--r--tests/ui/error-codes/E0277.stderr5
-rw-r--r--tests/ui/error-codes/E0308.stderr8
-rw-r--r--tests/ui/error-codes/E0374.stderr4
-rw-r--r--tests/ui/error-codes/E0377.stderr4
-rw-r--r--tests/ui/error-codes/E0401.stderr22
-rw-r--r--tests/ui/error-codes/E0445.rs23
-rw-r--r--tests/ui/error-codes/E0445.stderr71
-rw-r--r--tests/ui/error-codes/E0446.rs15
-rw-r--r--tests/ui/error-codes/E0446.stderr23
-rw-r--r--tests/ui/error-codes/E0602.rs2
-rw-r--r--tests/ui/error-codes/E0602.stderr11
-rw-r--r--tests/ui/error-codes/E0609-private-method.rs16
-rw-r--r--tests/ui/error-codes/E0609-private-method.stderr9
-rw-r--r--tests/ui/error-codes/E0647.stderr4
-rw-r--r--tests/ui/error-codes/E0767.stderr2
-rw-r--r--tests/ui/error-festival.stderr9
-rw-r--r--tests/ui/explicit/explicit-call-to-dtor.stderr10
-rw-r--r--tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr10
-rw-r--r--tests/ui/expr/if/bad-if-let-suggestion.rs3
-rw-r--r--tests/ui/expr/if/bad-if-let-suggestion.stderr23
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-dashed.rs10
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-dashed.stderr4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-non-ascii.rs4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr2
-rw-r--r--tests/ui/extern-flag/invalid-crate-name.rs4
-rw-r--r--tests/ui/extern-flag/invalid-crate-name.stderr2
-rw-r--r--tests/ui/extern/extern-main-fn.stderr4
-rw-r--r--tests/ui/extern/extern-with-type-bounds.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-adt_const_params.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-coverage-attribute.rs14
-rw-r--r--tests/ui/feature-gates/feature-gate-coverage-attribute.stderr21
-rw-r--r--tests/ui/feature-gates/feature-gate-no_coverage.rs13
-rw-r--r--tests/ui/feature-gates/feature-gate-no_coverage.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr70
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.rs26
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.stderr84
-rw-r--r--tests/ui/feature-gates/print-with-path.cfg.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.rs7
-rw-r--r--tests/ui/feature-gates/print-with-path.target-cpus.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.target-features.stderr2
-rw-r--r--tests/ui/fmt/raw-idents.rs17
-rw-r--r--tests/ui/fmt/raw-idents.stderr44
-rw-r--r--tests/ui/fn/bad-main.stderr4
-rw-r--r--tests/ui/fn/fn-pointer-mismatch.stderr1
-rw-r--r--tests/ui/fn/keyword-order.stderr2
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.rs1
-rw-r--r--tests/ui/fn/signature-error-reporting-under-verbose.stderr1
-rw-r--r--tests/ui/foreign/foreign-fn-linkname.rs3
-rw-r--r--tests/ui/function-pointer/unsized-ret.stderr12
-rw-r--r--tests/ui/functions-closures/fn-help-with-err.stderr4
-rw-r--r--tests/ui/generator/addassign-yield.rs3
-rw-r--r--tests/ui/generator/auto-trait-regions.drop_tracking.stderr55
-rw-r--r--tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr55
-rw-r--r--tests/ui/generator/auto-trait-regions.rs3
-rw-r--r--tests/ui/generator/auto-trait-regions.stderr (renamed from tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr)8
-rw-r--r--tests/ui/generator/borrowing.drop_tracking.stderr31
-rw-r--r--tests/ui/generator/borrowing.drop_tracking_mir.stderr39
-rw-r--r--tests/ui/generator/borrowing.rs4
-rw-r--r--tests/ui/generator/borrowing.stderr (renamed from tests/ui/generator/borrowing.no_drop_tracking.stderr)4
-rw-r--r--tests/ui/generator/clone-impl-async.stderr24
-rw-r--r--tests/ui/generator/clone-impl-static.stderr8
-rw-r--r--tests/ui/generator/clone-impl.stderr54
-rw-r--r--tests/ui/generator/derived-drop-parent-expr.rs1
-rw-r--r--tests/ui/generator/drop-control-flow.rs1
-rw-r--r--tests/ui/generator/drop-track-addassign-yield.rs1
-rw-r--r--tests/ui/generator/drop-tracking-error-body.rs18
-rw-r--r--tests/ui/generator/drop-tracking-error-body.stderr17
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr128
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr334
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.rs11
-rw-r--r--tests/ui/generator/drop-tracking-parent-expression.stderr (renamed from tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr)24
-rw-r--r--tests/ui/generator/drop-tracking-yielding-in-match-guards.rs3
-rw-r--r--tests/ui/generator/drop-yield-twice.stderr17
-rw-r--r--tests/ui/generator/generator-yielding-or-returning-itself.stderr4
-rw-r--r--tests/ui/generator/issue-102645.rs2
-rw-r--r--tests/ui/generator/issue-102645.stderr2
-rw-r--r--tests/ui/generator/issue-105084.rs12
-rw-r--r--tests/ui/generator/issue-105084.stderr (renamed from tests/ui/generator/issue-105084.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/issue-110929-generator-conflict-error-ice.rs3
-rw-r--r--tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr18
-rw-r--r--tests/ui/generator/issue-57017.no_drop_tracking.stderr248
-rw-r--r--tests/ui/generator/issue-57017.rs13
-rw-r--r--tests/ui/generator/issue-57478.no_drop_tracking.stderr31
-rw-r--r--tests/ui/generator/issue-57478.rs7
-rw-r--r--tests/ui/generator/issue-68112.drop_tracking.stderr66
-rw-r--r--tests/ui/generator/issue-68112.no_drop_tracking.stderr66
-rw-r--r--tests/ui/generator/issue-68112.rs6
-rw-r--r--tests/ui/generator/issue-68112.stderr (renamed from tests/ui/generator/issue-68112.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/issue-93161.rs3
-rw-r--r--tests/ui/generator/layout-error.rs1
-rw-r--r--tests/ui/generator/layout-error.stderr20
-rw-r--r--tests/ui/generator/not-send-sync.drop_tracking.stderr60
-rw-r--r--tests/ui/generator/not-send-sync.no_drop_tracking.stderr60
-rw-r--r--tests/ui/generator/not-send-sync.rs3
-rw-r--r--tests/ui/generator/not-send-sync.stderr (renamed from tests/ui/generator/not-send-sync.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/generator/parent-expression.drop_tracking.stderr128
-rw-r--r--tests/ui/generator/parent-expression.no_drop_tracking.stderr334
-rw-r--r--tests/ui/generator/parent-expression.rs9
-rw-r--r--tests/ui/generator/parent-expression.stderr (renamed from tests/ui/generator/parent-expression.drop_tracking_mir.stderr)24
-rw-r--r--tests/ui/generator/partial-drop.drop_tracking.stderr61
-rw-r--r--tests/ui/generator/partial-drop.no_drop_tracking.stderr61
-rw-r--r--tests/ui/generator/partial-drop.rs15
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr64
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr64
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.rs3
-rw-r--r--tests/ui/generator/print/generator-print-verbose-1.stderr (renamed from tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr)18
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr60
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.rs3
-rw-r--r--tests/ui/generator/print/generator-print-verbose-2.stderr (renamed from tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr)16
-rw-r--r--tests/ui/generator/print/generator-print-verbose-3.stderr2
-rw-r--r--tests/ui/generator/ref-upvar-not-send.stderr2
-rw-r--r--tests/ui/generator/retain-resume-ref.drop_tracking.stderr13
-rw-r--r--tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr14
-rw-r--r--tests/ui/generator/retain-resume-ref.rs4
-rw-r--r--tests/ui/generator/retain-resume-ref.stderr (renamed from tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr)2
-rw-r--r--tests/ui/generator/static-mut-reference-across-yield.rs4
-rw-r--r--tests/ui/generator/static-not-unpin.current.stderr4
-rw-r--r--tests/ui/generator/static-not-unpin.next.stderr4
-rw-r--r--tests/ui/generator/type-mismatch-signature-deduction.stderr2
-rw-r--r--tests/ui/generator/unresolved-ct-var-drop-tracking.rs15
-rw-r--r--tests/ui/generator/unresolved-ct-var-drop-tracking.stderr78
-rw-r--r--tests/ui/generator/unresolved-ct-var.rs5
-rw-r--r--tests/ui/generator/unresolved-ct-var.stderr65
-rw-r--r--tests/ui/generator/unsized-capture-across-yield.rs22
-rw-r--r--tests/ui/generator/unsized-capture-across-yield.stderr23
-rw-r--r--tests/ui/generator/unsized-local-across-yield.rs21
-rw-r--r--tests/ui/generator/unsized-local-across-yield.stderr21
-rw-r--r--tests/ui/generator/witness-ignore-fake-reads.rs34
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.stderr30
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-88460.stderr8
-rw-r--r--tests/ui/generic-associated-types/issue-101020.stderr5
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait.stderr2
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs10
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr15
-rw-r--r--tests/ui/generic-associated-types/own-bound-span.stderr4
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.stderr2
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr4
-rw-r--r--tests/ui/generics/issue-83556.rs4
-rw-r--r--tests/ui/generics/issue-83556.stderr8
-rw-r--r--tests/ui/generics/issue-94432-garbage-ice.rs2
-rw-r--r--tests/ui/generics/issue-98432.rs2
-rw-r--r--tests/ui/generics/issue-98432.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/future.classic.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-30786.stderr18
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-59311.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr15
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr8
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr5
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.rs1
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr82
-rw-r--r--tests/ui/impl-trait/bound-normalization-fail.rs3
-rw-r--r--tests/ui/impl-trait/bound-normalization-fail.stderr16
-rw-r--r--tests/ui/impl-trait/capture-lifetime-not-in-hir.rs21
-rw-r--r--tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr14
-rw-r--r--tests/ui/impl-trait/coherence-treats-tait-ambig.rs3
-rw-r--r--tests/ui/impl-trait/coherence-treats-tait-ambig.stderr (renamed from tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr)2
-rw-r--r--tests/ui/impl-trait/equality-in-canonical-query.clone.stderr29
-rw-r--r--tests/ui/impl-trait/equality-in-canonical-query.rs23
-rw-r--r--tests/ui/impl-trait/feature-self-return-type.rs1
-rw-r--r--tests/ui/impl-trait/feature-self-return-type.stderr6
-rw-r--r--tests/ui/impl-trait/impl-subtyper.rs18
-rw-r--r--tests/ui/impl-trait/impl-subtyper2.rs7
-rw-r--r--tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs13
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr18
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs7
-rw-r--r--tests/ui/impl-trait/in-trait/foreign.rs14
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs8
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs19
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs10
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety-sized.rs23
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/refine.rs48
-rw-r--r--tests/ui/impl-trait/in-trait/refine.stderr67
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs26
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs23
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs46
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.stderr61
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs9
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs20
-rw-r--r--tests/ui/impl-trait/in-trait/variance.stderr26
-rw-r--r--tests/ui/impl-trait/issue-103181-2.rs2
-rw-r--r--tests/ui/impl-trait/issue-103181-2.stderr57
-rw-r--r--tests/ui/impl-trait/issue-108591.rs3
-rw-r--r--tests/ui/impl-trait/issue-108592.rs3
-rw-r--r--tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr8
-rw-r--r--tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr8
-rw-r--r--tests/ui/impl-trait/issue-55872-2.rs5
-rw-r--r--tests/ui/impl-trait/issue-55872-2.stderr (renamed from tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr)4
-rw-r--r--tests/ui/impl-trait/issue-55872-3.stderr4
-rw-r--r--tests/ui/impl-trait/issue-86465.rs6
-rw-r--r--tests/ui/impl-trait/issue-86465.stderr2
-rw-r--r--tests/ui/impl-trait/issue-99073.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-74282.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-78722-2.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-78722.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.stderr4
-rw-r--r--tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type4.stderr2
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.stderr25
-rw-r--r--tests/ui/impl-trait/recursive-generator.rs1
-rw-r--r--tests/ui/impl-trait/recursive-generator.stderr15
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr152
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr152
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs4
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr (renamed from tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr)38
-rw-r--r--tests/ui/impl-trait/static-return-lifetime-infered.stderr4
-rw-r--r--tests/ui/impl-trait/variance.rs16
-rw-r--r--tests/ui/impl-trait/variance.stderr26
-rw-r--r--tests/ui/imports/import-after-macro-expand-10.rs17
-rw-r--r--tests/ui/imports/import-after-macro-expand-11.rs21
-rw-r--r--tests/ui/imports/import-after-macro-expand-12.rs34
-rw-r--r--tests/ui/imports/import-after-macro-expand-13.rs22
-rw-r--r--tests/ui/imports/import-after-macro-expand-14.rs22
-rw-r--r--tests/ui/imports/import-after-macro-expand-2.rs4
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.rs11
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.stderr53
-rw-r--r--tests/ui/imports/import-after-macro-expand-6.rs4
-rw-r--r--tests/ui/imports/import-after-macro-expand-9.rs17
-rw-r--r--tests/ui/inference/issue-72616.stderr2
-rw-r--r--tests/ui/inference/issue-72690.stderr42
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr27
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr (renamed from tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr)15
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.rs10
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.feature.stderr11
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.gated.stderr (renamed from tests/ui/infinite/infinite-vec-type-recursion.stderr)11
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.rs9
-rw-r--r--tests/ui/inline-const/promotion.rs22
-rw-r--r--tests/ui/inline-const/promotion.stderr14
-rw-r--r--tests/ui/inner-static-type-parameter.rs2
-rw-r--r--tests/ui/inner-static-type-parameter.stderr6
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.stderr4
-rw-r--r--tests/ui/intrinsics/feature-gate-safe-intrinsic.rs6
-rw-r--r--tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr20
-rw-r--r--tests/ui/intrinsics/intrinsic-alignment.rs3
-rw-r--r--tests/ui/invalid_dispatch_from_dyn_impls.stderr4
-rw-r--r--tests/ui/issues/auxiliary/issue-111011.stderr2
-rw-r--r--tests/ui/issues/issue-10764.stderr1
-rw-r--r--tests/ui/issues/issue-12127.stderr2
-rw-r--r--tests/ui/issues/issue-17252.stderr11
-rw-r--r--tests/ui/issues/issue-18389.rs10
-rw-r--r--tests/ui/issues/issue-18389.stderr28
-rw-r--r--tests/ui/issues/issue-18611.stderr6
-rw-r--r--tests/ui/issues/issue-21763.stderr3
-rw-r--r--tests/ui/issues/issue-22638.rs4
-rw-r--r--tests/ui/issues/issue-23302-1.stderr9
-rw-r--r--tests/ui/issues/issue-23302-2.stderr9
-rw-r--r--tests/ui/issues/issue-23302-3.stderr14
-rw-r--r--tests/ui/issues/issue-24036.stderr4
-rw-r--r--tests/ui/issues/issue-25076.stderr5
-rw-r--r--tests/ui/issues/issue-27042.stderr15
-rw-r--r--tests/ui/issues/issue-29147.stderr4
-rw-r--r--tests/ui/issues/issue-3214.rs2
-rw-r--r--tests/ui/issues/issue-3214.stderr8
-rw-r--r--tests/ui/issues/issue-35570.stderr6
-rw-r--r--tests/ui/issues/issue-39970.stderr4
-rw-r--r--tests/ui/issues/issue-41880.stderr2
-rw-r--r--tests/ui/issues/issue-43988.stderr4
-rw-r--r--tests/ui/issues/issue-48838.stderr2
-rw-r--r--tests/ui/issues/issue-50600.stderr2
-rw-r--r--tests/ui/issues/issue-50688.stderr2
-rw-r--r--tests/ui/issues/issue-50714-1.stderr4
-rw-r--r--tests/ui/issues/issue-51154.stderr2
-rw-r--r--tests/ui/issues/issue-5997-enum.rs2
-rw-r--r--tests/ui/issues/issue-5997-enum.stderr8
-rw-r--r--tests/ui/issues/issue-5997-struct.rs2
-rw-r--r--tests/ui/issues/issue-5997-struct.stderr8
-rw-r--r--tests/ui/issues/issue-60218.stderr5
-rw-r--r--tests/ui/issues/issue-66353.stderr16
-rw-r--r--tests/ui/issues/issue-66923-show-error-for-correct-call.stderr6
-rw-r--r--tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr2
-rw-r--r--tests/ui/issues/issue-87199.stderr6
-rw-r--r--tests/ui/issues/issue-9575.stderr4
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr6
-rw-r--r--tests/ui/iterators/invalid-iterator-chain.stderr30
-rw-r--r--tests/ui/kindck/kindck-nonsendable-1.stderr4
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argc.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argv.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr11
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_args.stderr13
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ret.stderr13
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ty.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_ret.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_args.rs24
-rw-r--r--tests/ui/lang-items/start_lang_item_args.sigpipe.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.start_ret.stderr8
-rw-r--r--tests/ui/lang-items/start_lang_item_args.too_many_args.stderr9
-rw-r--r--tests/ui/lang-items/start_lang_item_with_target_feature.rs19
-rw-r--r--tests/ui/lang-items/start_lang_item_with_target_feature.stderr11
-rw-r--r--tests/ui/late-bound-lifetimes/predicate-is-global.rs40
-rw-r--r--tests/ui/layout/debug.rs16
-rw-r--r--tests/ui/layout/debug.stderr86
-rw-r--r--tests/ui/layout/enum.rs18
-rw-r--r--tests/ui/layout/enum.stderr14
-rw-r--r--tests/ui/layout/homogeneous-aggr-transparent.rs44
-rw-r--r--tests/ui/layout/homogeneous-aggr-transparent.stderr32
-rw-r--r--tests/ui/layout/layout-cycle.rs31
-rw-r--r--tests/ui/layout/layout-cycle.stderr11
-rw-r--r--tests/ui/layout/struct.rs12
-rw-r--r--tests/ui/layout/struct.stderr14
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.stderr6
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr8
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr8
-rw-r--r--tests/ui/lazy-type-alias/trailing-where-clause.stderr11
-rw-r--r--tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs27
-rw-r--r--tests/ui/lifetimes/issue-95023.stderr2
-rw-r--r--tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr6
-rw-r--r--tests/ui/lifetimes/unusual-rib-combinations.stderr4
-rw-r--r--tests/ui/limits/issue-55878.stderr8
-rw-r--r--tests/ui/limits/issue-56762.rs6
-rw-r--r--tests/ui/limits/issue-56762.stderr10
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.rs14
-rw-r--r--tests/ui/linkage-attr/common-linkage-non-zero-init.stderr3
-rw-r--r--tests/ui/lint-group-forbid-always-trumps-cli.stderr1
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.rs6
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.stderr11
-rw-r--r--tests/ui/lint/command-line-lint-group-deny.stderr1
-rw-r--r--tests/ui/lint/command-line-lint-group-forbid.stderr1
-rw-r--r--tests/ui/lint/command-line-lint-group-warn.stderr1
-rw-r--r--tests/ui/lint/expr-field.rs15
-rw-r--r--tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allow-warnings.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr1
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr1
-rw-r--r--tests/ui/lint/future-incompat-test.stderr1
-rw-r--r--tests/ui/lint/invalid_from_utf8.rs27
-rw-r--r--tests/ui/lint/invalid_from_utf8.stderr135
-rw-r--r--tests/ui/lint/issue-99387.rs2
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.rs29
-rw-r--r--tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr23
-rw-r--r--tests/ui/lint/large_assignments/large_future.attribute.stderr (renamed from tests/ui/async-await/large_moves.option.stderr)16
-rw-r--r--tests/ui/lint/large_assignments/large_future.option.stderr (renamed from tests/ui/async-await/large_moves.attribute.stderr)16
-rw-r--r--tests/ui/lint/large_assignments/large_future.rs (renamed from tests/ui/async-await/large_moves.rs)3
-rw-r--r--tests/ui/lint/lint-ctypes-94223.rs7
-rw-r--r--tests/ui/lint/lint-ctypes-94223.stderr27
-rw-r--r--tests/ui/lint/lint-ctypes-fn.rs2
-rw-r--r--tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs8
-rw-r--r--tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr16
-rw-r--r--tests/ui/lint/lint-ctypes.rs2
-rw-r--r--tests/ui/lint/lint-pre-expansion-extern-module.stderr1
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.rs13
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.stderr28
-rw-r--r--tests/ui/lint/lint-removed-cmdline.rs1
-rw-r--r--tests/ui/lint/lint-removed-cmdline.stderr5
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.rs10
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.stderr31
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.rs1
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.stderr8
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.stderr1
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-allow.rs4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.rs9
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr31
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.rs2
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.stderr20
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr21
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr33
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.rs8
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.stderr (renamed from tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr)7
-rw-r--r--tests/ui/lint/must_not_suspend/ref-drop-tracking.rs30
-rw-r--r--tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr27
-rw-r--r--tests/ui/lint/must_not_suspend/ref.rs5
-rw-r--r--tests/ui/lint/must_not_suspend/ref.stderr (renamed from tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr)8
-rw-r--r--tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr37
-rw-r--r--tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr37
-rw-r--r--tests/ui/lint/must_not_suspend/trait.rs6
-rw-r--r--tests/ui/lint/must_not_suspend/trait.stderr (renamed from tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr)10
-rw-r--r--tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/unit.rs4
-rw-r--r--tests/ui/lint/must_not_suspend/unit.stderr (renamed from tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr)8
-rw-r--r--tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/warn.rs7
-rw-r--r--tests/ui/lint/must_not_suspend/warn.stderr (renamed from tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr)20
-rw-r--r--tests/ui/lint/no-coverage.rs40
-rw-r--r--tests/ui/lint/no-coverage.stderr72
-rw-r--r--tests/ui/lint/noop-method-call.fixed13
-rw-r--r--tests/ui/lint/noop-method-call.rs13
-rw-r--r--tests/ui/lint/noop-method-call.stderr14
-rw-r--r--tests/ui/lint/ptr_null_checks.rs14
-rw-r--r--tests/ui/lint/ptr_null_checks.stderr38
-rw-r--r--tests/ui/lint/reference_casting.rs62
-rw-r--r--tests/ui/lint/reference_casting.stderr209
-rw-r--r--tests/ui/lint/trivial_casts.stderr2
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.rs26
-rw-r--r--tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr30
-rw-r--r--tests/ui/lint/unused/unused-parens-issue-106413.rs32
-rw-r--r--tests/ui/lint/unused/unused-parens-issue-106413.stderr127
-rw-r--r--tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs (renamed from tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs)0
-rw-r--r--tests/ui/loops/issue-69225-layout-repeated-checked-add.rs (renamed from tests/ui/issues/issue-69225-layout-repeated-checked-add.rs)0
-rw-r--r--tests/ui/loops/loop-break-value.rs63
-rw-r--r--tests/ui/loops/loop-break-value.stderr153
-rw-r--r--tests/ui/loops/loop-labeled-break-value.stderr39
-rw-r--r--tests/ui/loops/loop-properly-diverging-2.stderr13
-rw-r--r--tests/ui/macros/issue-2804.rs (renamed from tests/ui/issue-2804.rs)0
-rw-r--r--tests/ui/macros/issue-39467.rs (renamed from tests/ui/issues/issue-39467.rs)0
-rw-r--r--tests/ui/macros/must-use-in-macro-55516.stderr1
-rw-r--r--tests/ui/main-wrong-type.stderr4
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.rs (renamed from tests/ui/match/issue-72896.rs)3
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.stderr23
-rw-r--r--tests/ui/match/match_non_exhaustive.stderr3
-rw-r--r--tests/ui/methods/issue-3707.rs (renamed from tests/ui/issues/issue-3707.rs)0
-rw-r--r--tests/ui/methods/issue-3707.stderr (renamed from tests/ui/issues/issue-3707.stderr)0
-rw-r--r--tests/ui/methods/issues/issue-61525.stderr4
-rw-r--r--tests/ui/methods/method-missing-call.stderr2
-rw-r--r--tests/ui/mir/issue-92893.rs4
-rw-r--r--tests/ui/mir/issue-92893.stderr18
-rw-r--r--tests/ui/mir/mir-inlining/always-encode-mirs.rs12
-rw-r--r--tests/ui/mir/mir-inlining/auxiliary/internal.rs7
-rw-r--r--tests/ui/mismatched_types/cast-rfc0401.stderr11
-rw-r--r--tests/ui/mismatched_types/issue-13033.rs (renamed from tests/ui/issues/issue-13033.rs)0
-rw-r--r--tests/ui/mismatched_types/issue-13033.stderr (renamed from tests/ui/issues/issue-13033.stderr)0
-rw-r--r--tests/ui/mismatched_types/issue-36053-2.stderr14
-rw-r--r--tests/ui/mismatched_types/normalize-fn-sig.stderr1
-rw-r--r--tests/ui/moves/issue-34721.fixed (renamed from tests/ui/issues/issue-34721.fixed)0
-rw-r--r--tests/ui/moves/issue-34721.rs (renamed from tests/ui/issues/issue-34721.rs)0
-rw-r--r--tests/ui/moves/issue-34721.stderr (renamed from tests/ui/issues/issue-34721.stderr)0
-rw-r--r--tests/ui/namespace/namespace-mix.stderr220
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs11
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr4
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs8
-rw-r--r--tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr4
-rw-r--r--tests/ui/nested-ty-params.rs2
-rw-r--r--tests/ui/nested-ty-params.stderr16
-rw-r--r--tests/ui/never_type/fallback-closure-wrap.fallback.stderr4
-rw-r--r--tests/ui/never_type/feature-gate-never_type_fallback.stderr5
-rw-r--r--tests/ui/never_type/impl_trait_fallback3.stderr6
-rw-r--r--tests/ui/never_type/impl_trait_fallback4.stderr6
-rw-r--r--tests/ui/never_type/issue-52443.stderr10
-rw-r--r--tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr6
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument-callee.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-val.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr2
-rw-r--r--tests/ui/nll/issue-54556-stephaneyfx.stderr2
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.rs40
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.stderr79
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr4
-rw-r--r--tests/ui/no-send-res-ports.stderr4
-rw-r--r--tests/ui/not-clone-closure.stderr6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.rs6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.stderr23
-rw-r--r--tests/ui/object-safety/call-when-assoc-ty-is-sized.rs25
-rw-r--r--tests/ui/on-unimplemented/on-trait.stderr10
-rw-r--r--tests/ui/on-unimplemented/parent-label.stderr20
-rw-r--r--tests/ui/on-unimplemented/sum.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.rs7
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.stderr18
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.rs5
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.rs2
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.stderr8
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.rs13
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.rs15
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.stderr11
-rw-r--r--tests/ui/panics/panic-in-cleanup.rs23
-rw-r--r--tests/ui/panics/panic-in-cleanup.run.stderr9
-rw-r--r--tests/ui/panics/panic-in-ffi.rs18
-rw-r--r--tests/ui/panics/panic-in-ffi.run.stderr7
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr2
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.run.stderr2
-rw-r--r--tests/ui/parser/default-unmatched.stderr2
-rw-r--r--tests/ui/parser/expr-as-stmt.stderr2
-rw-r--r--tests/ui/parser/impl-parsing.stderr2
-rw-r--r--tests/ui/parser/issue-101477-enum.stderr2
-rw-r--r--tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs1
-rw-r--r--tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr10
-rw-r--r--tests/ui/parser/issues/issue-17904-2.stderr2
-rw-r--r--tests/ui/parser/issues/issue-43196.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62913.stderr2
-rw-r--r--tests/ui/parser/issues/issue-68890.stderr2
-rw-r--r--tests/ui/parser/issues/issue-89388.stderr7
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-1.rs9
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr16
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs5
-rw-r--r--tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr14
-rw-r--r--tests/ui/parser/keyword-union-as-identifier.rs72
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.rs31
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.stderr51
-rw-r--r--tests/ui/parser/shebang/shebang-doc-comment.stderr2
-rw-r--r--tests/ui/parser/struct-literal-in-if.rs5
-rw-r--r--tests/ui/parser/struct-literal-in-if.stderr18
-rw-r--r--tests/ui/parser/struct-literal-in-match-guard.rs3
-rw-r--r--tests/ui/parser/struct-literal-in-while.rs5
-rw-r--r--tests/ui/parser/struct-literal-in-while.stderr18
-rw-r--r--tests/ui/parser/struct-literal-restrictions-in-lamda.stderr2
-rw-r--r--tests/ui/parser/virtual-structs.stderr2
-rw-r--r--tests/ui/pattern/issue-114896.rs7
-rw-r--r--tests/ui/pattern/issue-114896.stderr11
-rw-r--r--tests/ui/pattern/non-structural-match-types.stderr4
-rw-r--r--tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs2
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr4
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs12
-rw-r--r--tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr17
-rw-r--r--tests/ui/pattern/usefulness/issue-30240.stderr2
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs67
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr170
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs18
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr22
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr2
-rw-r--r--tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr2
-rw-r--r--tests/ui/print_type_sizes/async.stdout16
-rw-r--r--tests/ui/print_type_sizes/generator.stdout2
-rw-r--r--tests/ui/print_type_sizes/generator_discr_placement.stdout2
-rw-r--r--tests/ui/print_type_sizes/zero-sized-fields.stdout10
-rw-r--r--tests/ui/privacy/associated-item-privacy-inherent.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-type-binding.rs2
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.rs2
-rw-r--r--tests/ui/privacy/issue-30079.rs3
-rw-r--r--tests/ui/privacy/issue-30079.stderr17
-rw-r--r--tests/ui/privacy/private-bounds-locally-allowed.rs7
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.rs9
-rw-r--r--tests/ui/privacy/private-in-public-assoc-ty.stderr50
-rw-r--r--tests/ui/privacy/private-in-public-lint.rs19
-rw-r--r--tests/ui/privacy/private-in-public-lint.stderr21
-rw-r--r--tests/ui/privacy/private-in-public-non-principal-2.rs2
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.rs10
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.stderr28
-rw-r--r--tests/ui/privacy/private-in-public-type-alias-impl-trait.rs2
-rw-r--r--tests/ui/privacy/private-in-public-warn.rs85
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr376
-rw-r--r--tests/ui/privacy/private-in-public.rs66
-rw-r--r--tests/ui/privacy/private-in-public.stderr468
-rw-r--r--tests/ui/privacy/private-inferred-type-2.rs1
-rw-r--r--tests/ui/privacy/private-inferred-type-2.stderr6
-rw-r--r--tests/ui/privacy/private-inferred-type.rs2
-rw-r--r--tests/ui/privacy/private-type-in-interface.rs1
-rw-r--r--tests/ui/privacy/private-type-in-interface.stderr18
-rw-r--r--tests/ui/privacy/restricted/private-in-public.rs5
-rw-r--r--tests/ui/privacy/restricted/private-in-public.stderr21
-rw-r--r--tests/ui/privacy/unnameable_types.rs9
-rw-r--r--tests/ui/privacy/unnameable_types.stderr8
-rw-r--r--tests/ui/privacy/where-priv-type.rs27
-rw-r--r--tests/ui/privacy/where-priv-type.stderr107
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.rs23
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr84
-rw-r--r--tests/ui/proc-macro/allowed-signatures.rs2
-rw-r--r--tests/ui/proc-macro/auxiliary/api/mod.rs1
-rw-r--r--tests/ui/proc-macro/auxiliary/api/parse.rs4
-rw-r--r--tests/ui/proc-macro/auxiliary/print-tokens.rs16
-rw-r--r--tests/ui/proc-macro/bad-projection.stderr6
-rw-r--r--tests/ui/proc-macro/literal-to-string.rs26
-rw-r--r--tests/ui/proc-macro/literal-to-string.stdout107
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs30
-rw-r--r--tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr48
-rw-r--r--tests/ui/pub/pub-restricted-error-fn.stderr2
-rw-r--r--tests/ui/range/issue-54505-no-std.rs6
-rw-r--r--tests/ui/range/issue-54505-no-std.stderr14
-rw-r--r--tests/ui/range/range-1.stderr2
-rw-r--r--tests/ui/recursion/issue-83150.stderr6
-rw-r--r--tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr1
-rw-r--r--tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr1
-rw-r--r--tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr1
-rw-r--r--tests/ui/regions/regions-lifetime-bounds-on-fns.stderr1
-rw-r--r--tests/ui/reify-intrinsic.stderr1
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs2
-rw-r--r--tests/ui/repr/explicit-rust-repr-conflicts.rs23
-rw-r--r--tests/ui/repr/explicit-rust-repr-conflicts.stderr39
-rw-r--r--tests/ui/repr/invalid_repr_list_help.stderr10
-rw-r--r--tests/ui/repr/repr-transparent-non-exhaustive.rs40
-rw-r--r--tests/ui/repr/repr-transparent-non-exhaustive.stderr42
-rw-r--r--tests/ui/repr/repr-transparent.rs23
-rw-r--r--tests/ui/repr/repr-transparent.stderr82
-rw-r--r--tests/ui/resolve/associated-fn-called-as-fn.stderr14
-rw-r--r--tests/ui/resolve/bad-expr-path.stderr4
-rw-r--r--tests/ui/resolve/bad-expr-path2.stderr4
-rw-r--r--tests/ui/resolve/bad-type-env-capture.stderr8
-rw-r--r--tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs18
-rw-r--r--tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr41
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr28
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr34
-rw-r--r--tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs39
-rw-r--r--tests/ui/resolve/issue-103474.stderr2
-rw-r--r--tests/ui/resolve/issue-12796.rs2
-rw-r--r--tests/ui/resolve/issue-12796.stderr4
-rw-r--r--tests/ui/resolve/issue-14254.stderr98
-rw-r--r--tests/ui/resolve/issue-2356.stderr42
-rw-r--r--tests/ui/resolve/issue-3021-c.rs4
-rw-r--r--tests/ui/resolve/issue-3021-c.stderr16
-rw-r--r--tests/ui/resolve/issue-60057.stderr12
-rw-r--r--tests/ui/resolve/issue-65025-extern-static-parent-generics.rs2
-rw-r--r--tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr6
-rw-r--r--tests/ui/resolve/issue-65035-static-with-parent-generics.rs10
-rw-r--r--tests/ui/resolve/issue-65035-static-with-parent-generics.stderr30
-rw-r--r--tests/ui/resolve/issue-6642.rs (renamed from tests/ui/issues/issue-6642.rs)0
-rw-r--r--tests/ui/resolve/issue-6642.stderr (renamed from tests/ui/issues/issue-6642.stderr)0
-rw-r--r--tests/ui/resolve/resolve-assoc-suggestions.stderr21
-rw-r--r--tests/ui/resolve/resolve-speculative-adjustment.stderr14
-rw-r--r--tests/ui/resolve/resolve-type-param-in-item-in-trait.rs8
-rw-r--r--tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr32
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed16
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.rs15
-rw-r--r--tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr14
-rw-r--r--tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr26
-rw-r--r--tests/ui/resolve/unresolved_static_type_field.stderr5
-rw-r--r--tests/ui/resolve/use-self-in-inner-fn.rs6
-rw-r--r--tests/ui/resolve/use-self-in-inner-fn.stderr6
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs26
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr35
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs36
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr285
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs16
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs97
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr67
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs41
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs25
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr54
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs18
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs23
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs16
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs6
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs)0
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr (renamed from tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr)2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs14
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs5
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr33
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs340
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr1021
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs261
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr1462
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs1
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs6
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs2
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr36
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr49
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr2
-rw-r--r--tests/ui/rmeta/auxiliary/rmeta-meta.rs4
-rw-r--r--tests/ui/rmeta/no_optitimized_mir.rs11
-rw-r--r--tests/ui/rmeta/no_optitimized_mir.stderr10
-rw-r--r--tests/ui/rust-2018/trait-import-suggestions.rs2
-rw-r--r--tests/ui/sanitize/cfg.rs32
-rw-r--r--tests/ui/self/class-missing-self.stderr9
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.rs28
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.stderr80
-rw-r--r--tests/ui/simd/monomorphize-shuffle-index.generic.stderr12
-rw-r--r--tests/ui/simd/monomorphize-shuffle-index.rs28
-rw-r--r--tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr2
-rw-r--r--tests/ui/span/issue-29595.stderr6
-rw-r--r--tests/ui/span/move-closure.stderr2
-rw-r--r--tests/ui/span/send-is-not-static-std-sync.rs2
-rw-r--r--tests/ui/span/send-is-not-static-std-sync.stderr8
-rw-r--r--tests/ui/specialization/issue-38091.stderr5
-rw-r--r--tests/ui/specialization/specialization-default-types.stderr2
-rw-r--r--tests/ui/static/static-reference-to-fn-1.stderr1
-rw-r--r--tests/ui/stats/hir-stats.stderr32
-rw-r--r--tests/ui/stats/meta-stats.rs7
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.rs (renamed from tests/ui/issues/issue-17431-6.rs)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.stderr (renamed from tests/ui/issues/issue-17431-6.stderr)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.rs (renamed from tests/ui/issues/issue-17431-7.rs)0
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.stderr (renamed from tests/ui/issues/issue-17431-7.stderr)0
-rw-r--r--tests/ui/structs-enums/rec-align-u32.rs2
-rw-r--r--tests/ui/structs-enums/rec-align-u64.rs3
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.rs (renamed from tests/ui/issues/issue-17431-1.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.stderr (renamed from tests/ui/issues/issue-17431-1.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.rs (renamed from tests/ui/issues/issue-17431-2.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.stderr (renamed from tests/ui/issues/issue-17431-2.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.rs (renamed from tests/ui/issues/issue-17431-3.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.stderr (renamed from tests/ui/issues/issue-17431-3.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.rs (renamed from tests/ui/issues/issue-17431-4.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.stderr (renamed from tests/ui/issues/issue-17431-4.stderr)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.rs (renamed from tests/ui/issues/issue-17431-5.rs)0
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.stderr (renamed from tests/ui/issues/issue-17431-5.stderr)0
-rw-r--r--tests/ui/suggestions/assoc-const-as-fn.stderr6
-rw-r--r--tests/ui/suggestions/assoc-const-without-self.stderr2
-rw-r--r--tests/ui/suggestions/assoc-type-in-method-return.stderr7
-rw-r--r--tests/ui/suggestions/assoc_fn_without_self.rs8
-rw-r--r--tests/ui/suggestions/assoc_fn_without_self.stderr49
-rw-r--r--tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr8
-rw-r--r--tests/ui/suggestions/auxiliary/extern-issue-98562.rs26
-rw-r--r--tests/ui/suggestions/call-boxed.stderr4
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr2
-rw-r--r--tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr4
-rw-r--r--tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.stderr4
-rw-r--r--tests/ui/suggestions/issue-89333.stderr5
-rw-r--r--tests/ui/suggestions/issue-98562.rs12
-rw-r--r--tests/ui/suggestions/issue-98562.stderr11
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr2
-rw-r--r--tests/ui/suggestions/missing-assoc-fn.stderr2
-rw-r--r--tests/ui/suggestions/return-closures.stderr4
-rw-r--r--tests/ui/suggestions/sugg-else-for-closure.stderr4
-rw-r--r--tests/ui/suggestions/suggest-box.stderr2
-rw-r--r--tests/ui/suggestions/unnamable-types.stderr6
-rw-r--r--tests/ui/symbol-names/basic.legacy.stderr4
-rw-r--r--tests/ui/symbol-names/issue-60925.legacy.stderr4
-rw-r--r--tests/ui/test-attrs/issue-36768.rs2
-rw-r--r--tests/ui/track-diagnostics/track.rs5
-rw-r--r--tests/ui/track-diagnostics/track.stderr2
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs6
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr13
-rw-r--r--tests/ui/trait-bounds/issue-82038.rs9
-rw-r--r--tests/ui/trait-bounds/issue-82038.stderr15
-rw-r--r--tests/ui/traits/bad-method-typaram-kind.stderr4
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr10
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr5
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-locals.stderr10
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.stderr5
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums.stderr20
-rw-r--r--tests/ui/traits/deny-builtin-object-impl.current.stderr5
-rw-r--r--tests/ui/traits/deny-builtin-object-impl.next.stderr5
-rw-r--r--tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr11
-rw-r--r--tests/ui/traits/impl-bounds-checking.stderr5
-rw-r--r--tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr6
-rw-r--r--tests/ui/traits/issue-105231.rs2
-rw-r--r--tests/ui/traits/issue-105231.stderr8
-rw-r--r--tests/ui/traits/issue-66768.rs (renamed from tests/ui/issues/issue-66768.rs)0
-rw-r--r--tests/ui/traits/issue-77982.stderr20
-rw-r--r--tests/ui/traits/issue-91949-hangs-on-recursion.stderr2
-rw-r--r--tests/ui/traits/issue-99875.stderr4
-rw-r--r--tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr2
-rw-r--r--tests/ui/traits/new-solver/async.fail.stderr2
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs2
-rw-r--r--tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr6
-rw-r--r--tests/ui/traits/new-solver/canonicalize-effect-var.rs22
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr6
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr4
-rw-r--r--tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr8
-rw-r--r--tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs53
-rw-r--r--tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr10
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs2
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr19
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs19
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr21
-rw-r--r--tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr4
-rw-r--r--tests/ui/traits/new-solver/generator.fail.stderr8
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/global-cache.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs12
-rw-r--r--tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr27
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr4
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr4
-rw-r--r--tests/ui/traits/new-solver/projection-discr-kind.stderr5
-rw-r--r--tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr4
-rw-r--r--tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/fail.stderr5
-rw-r--r--tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr2
-rw-r--r--tests/ui/traits/object-does-not-impl-trait.stderr5
-rw-r--r--tests/ui/traits/object/enforce-supertrait-projection.rs2
-rw-r--r--tests/ui/traits/object/enforce-supertrait-projection.stderr2
-rw-r--r--tests/ui/traits/reservation-impl/no-use.next.stderr6
-rw-r--r--tests/ui/traits/reservation-impl/no-use.old.stderr6
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs2
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr8
-rw-r--r--tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs15
-rw-r--r--tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr22
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.fixed (renamed from tests/ui/traits/suggest-deferences/issue-39029.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.rs (renamed from tests/ui/traits/suggest-deferences/issue-39029.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-39029.stderr (renamed from tests/ui/traits/suggest-deferences/issue-39029.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.fixed (renamed from tests/ui/traits/suggest-deferences/issue-62530.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.rs (renamed from tests/ui/traits/suggest-deferences/issue-62530.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/issue-62530.stderr (renamed from tests/ui/traits/suggest-deferences/issue-62530.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.fixed (renamed from tests/ui/traits/suggest-deferences/multiple-0.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.rs (renamed from tests/ui/traits/suggest-deferences/multiple-0.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-0.stderr (renamed from tests/ui/traits/suggest-deferences/multiple-0.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-1.rs (renamed from tests/ui/traits/suggest-deferences/multiple-1.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/multiple-1.stderr (renamed from tests/ui/traits/suggest-deferences/multiple-1.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.fixed (renamed from tests/ui/traits/suggest-deferences/root-obligation.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.rs (renamed from tests/ui/traits/suggest-deferences/root-obligation.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.stderr (renamed from tests/ui/traits/suggest-deferences/root-obligation.stderr)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs)0
-rw-r--r--tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr (renamed from tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr)0
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.rs2
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr4
-rw-r--r--tests/ui/traits/suggest-where-clause.stderr12
-rw-r--r--tests/ui/traits/unsend-future.rs1
-rw-r--r--tests/ui/traits/unsend-future.stderr4
-rw-r--r--tests/ui/traits/vtable-res-trait-param.stderr5
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr19
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs4
-rw-r--r--tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr19
-rw-r--r--tests/ui/transmute/issue-115402-overflow-size.rs27
-rw-r--r--tests/ui/transmute/issue-115402-overflow-size.stderr33
-rw-r--r--tests/ui/trivial-bounds/trivial-bounds-leak.stderr11
-rw-r--r--tests/ui/try-trait/issue-32709.rs (renamed from tests/ui/issues/issue-32709.rs)0
-rw-r--r--tests/ui/try-trait/issue-32709.stderr (renamed from tests/ui/issues/issue-32709.stderr)0
-rw-r--r--tests/ui/tuple/wrong_argument_ice-4.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr24
-rw-r--r--tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs21
-rw-r--r--tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs19
-rw-r--r--tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs23
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs10
-rw-r--r--tests/ui/type-alias-impl-trait/escaping-bound-var.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/escaping-bound-var.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr26
-rw-r--r--tests/ui/type-alias-impl-trait/generic_lifetime_param.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs20
-rw-r--r--tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs29
-rw-r--r--tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr24
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092-2.stderr5
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-89686.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs40
-rw-r--r--tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr5
-rw-r--r--tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr47
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-alias-type.rs32
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/privacy.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr60
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr29
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs32
-rw-r--r--tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs18
-rw-r--r--tests/ui/type-alias-impl-trait/self_implication.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/tait-normalize.rs14
-rw-r--r--tests/ui/type-alias-impl-trait/variance.rs44
-rw-r--r--tests/ui/type-alias-impl-trait/variance.stderr68
-rw-r--r--tests/ui/type/subtyping-opaque-type.rs19
-rw-r--r--tests/ui/type/type-arg-out-of-scope.rs2
-rw-r--r--tests/ui/type/type-arg-out-of-scope.stderr16
-rw-r--r--tests/ui/type/type-error-break-tail.stderr13
-rw-r--r--tests/ui/typeck/auxiliary/issue-29181.rs (renamed from tests/ui/issues/auxiliary/issue-29181.rs)0
-rw-r--r--tests/ui/typeck/issue-114918/const-in-fn-return-type.rs10
-rw-r--r--tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs20
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs12
-rw-r--r--tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr9
-rw-r--r--tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs13
-rw-r--r--tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr9
-rw-r--r--tests/ui/typeck/issue-29181.rs (renamed from tests/ui/issues/issue-29181.rs)0
-rw-r--r--tests/ui/typeck/issue-29181.stderr (renamed from tests/ui/issues/issue-29181.stderr)0
-rw-r--r--tests/ui/typeck/issue-31173.stderr12
-rw-r--r--tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr6
-rw-r--r--tests/ui/typeck/return_type_containing_closure.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_item.stderr2
-rw-r--r--tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr6
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr4
-rw-r--r--tests/ui/unevaluated_fixed_size_array_len.stderr4
-rw-r--r--tests/ui/union/projection-as-union-type-error-2.stderr5
-rw-r--r--tests/ui/union/projection-as-union-type-error.stderr6
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs37
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr78
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs37
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr78
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr6
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr6
-rw-r--r--tests/ui/unreachable-code.rs15
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs17
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr16
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.rs11
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.stderr16
-rw-r--r--tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs16
-rw-r--r--tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr21
-rw-r--r--tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs10
-rw-r--r--tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr15
-rw-r--r--tests/ui/unsized/issue-115203.rs11
-rw-r--r--tests/ui/unsized/issue-115203.stderr19
-rw-r--r--tests/ui/unsized/issue-115809.rs13
-rw-r--r--tests/ui/unsized/issue-115809.stderr19
-rw-r--r--tests/ui/unsized/issue-75707.stderr5
-rw-r--r--tests/ui/unsized/unsized3.stderr12
-rw-r--r--tests/ui/wf/hir-wf-canonicalized.stderr12
-rw-r--r--tests/ui/wf/issue-95665.stderr5
-rw-r--r--tests/ui/wf/wf-complex-assoc-type.stderr5
-rw-r--r--tests/ui/wf/wf-foreign-fn-decl-ret.stderr11
-rw-r--r--tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr6
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr5
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr5
-rw-r--r--tests/ui/where-clauses/where-clause-method-substituion.stderr5
1368 files changed, 15743 insertions, 10709 deletions
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
new file mode 100644
index 000000000..1f049b178
--- /dev/null
+++ b/tests/ui/abi/compatibility.rs
@@ -0,0 +1,354 @@
+// check-pass
+// revisions: host
+// revisions: arm
+//[arm] compile-flags: --target arm-unknown-linux-gnueabi
+//[arm] needs-llvm-components: arm
+// revisions: aarch64
+//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
+//[aarch64] needs-llvm-components: aarch64
+// revisions: s390x
+//[s390x] compile-flags: --target s390x-unknown-linux-gnu
+//[s390x] needs-llvm-components: systemz
+// revisions: mips
+//[mips] compile-flags: --target mips-unknown-linux-gnu
+//[mips] needs-llvm-components: mips
+// revisions: mips64
+//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
+//[mips64] needs-llvm-components: mips
+// revisions: sparc
+//[sparc] compile-flags: --target sparc-unknown-linux-gnu
+//[sparc] needs-llvm-components: sparc
+// revisions: sparc64
+//[sparc64] compile-flags: --target sparc64-unknown-linux-gnu
+//[sparc64] needs-llvm-components: sparc
+// revisions: powerpc64
+//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
+//[powerpc64] needs-llvm-components: powerpc
+// revisions: riscv
+//[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu
+//[riscv] needs-llvm-components: riscv
+// revisions: loongarch64
+//[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
+//[loongarch64] needs-llvm-components: loongarch
+// revisions: wasm
+//[wasm] compile-flags: --target wasm32-unknown-unknown
+//[wasm] needs-llvm-components: webassembly
+// revisions: wasi
+//[wasi] compile-flags: --target wasm32-wasi
+//[wasi] needs-llvm-components: webassembly
+// revisions: nvptx64
+//[nvptx64] compile-flags: --target nvptx64-nvidia-cuda
+//[nvptx64] needs-llvm-components: nvptx
+#![feature(rustc_attrs, unsized_fn_params, transparent_unions)]
+#![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)]
+#![allow(unused, improper_ctypes_definitions, internal_features)]
+
+// FIXME: some targets are broken in various ways.
+// Hence there are `cfg` throughout this test to disable parts of it on those targets.
+// sparc64: https://github.com/rust-lang/rust/issues/115336
+// mips64: https://github.com/rust-lang/rust/issues/115404
+
+#[cfg(host)]
+use std::{
+ any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZeroI32, ptr::NonNull, rc::Rc,
+ sync::Arc,
+};
+
+/// To work cross-target this test must be no_core.
+/// This little prelude supplies what we need.
+#[cfg(not(host))]
+mod prelude {
+ #[lang = "sized"]
+ pub trait Sized {}
+
+ #[lang = "receiver"]
+ pub trait Receiver {}
+ impl<T: ?Sized> Receiver for &T {}
+ impl<T: ?Sized> Receiver for &mut T {}
+
+ #[lang = "copy"]
+ pub trait Copy: Sized {}
+ impl Copy for i32 {}
+ impl Copy for f32 {}
+ impl<T: ?Sized> Copy for &T {}
+ impl<T: ?Sized> Copy for *const T {}
+ impl<T: ?Sized> Copy for *mut T {}
+
+ #[lang = "clone"]
+ pub trait Clone: Sized {
+ fn clone(&self) -> Self;
+ }
+
+ #[lang = "phantom_data"]
+ pub struct PhantomData<T: ?Sized>;
+ impl<T: ?Sized> Copy for PhantomData<T> {}
+
+ #[lang = "unsafe_cell"]
+ #[repr(transparent)]
+ pub struct UnsafeCell<T: ?Sized> {
+ value: T,
+ }
+
+ pub trait Any: 'static {}
+
+ pub enum Option<T> {
+ None,
+ Some(T),
+ }
+ impl<T: Copy> Copy for Option<T> {}
+
+ pub enum Result<T, E> {
+ Ok(T),
+ Err(E),
+ }
+ impl<T: Copy, E: Copy> Copy for Result<T, E> {}
+
+ #[lang = "manually_drop"]
+ #[repr(transparent)]
+ pub struct ManuallyDrop<T: ?Sized> {
+ value: T,
+ }
+ impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {}
+
+ #[repr(transparent)]
+ #[rustc_layout_scalar_valid_range_start(1)]
+ #[rustc_nonnull_optimization_guaranteed]
+ pub struct NonNull<T: ?Sized> {
+ pointer: *const T,
+ }
+ impl<T: ?Sized> Copy for NonNull<T> {}
+
+ #[repr(transparent)]
+ #[rustc_layout_scalar_valid_range_start(1)]
+ #[rustc_nonnull_optimization_guaranteed]
+ pub struct NonZeroI32(i32);
+
+ // This just stands in for a non-trivial type.
+ pub struct Vec<T> {
+ ptr: NonNull<T>,
+ cap: usize,
+ len: usize,
+ }
+
+ pub struct Unique<T: ?Sized> {
+ pub pointer: NonNull<T>,
+ pub _marker: PhantomData<T>,
+ }
+
+ pub struct Global;
+
+ #[lang = "owned_box"]
+ pub struct Box<T: ?Sized, A = Global>(Unique<T>, A);
+
+ #[repr(C)]
+ struct RcBox<T: ?Sized> {
+ strong: UnsafeCell<usize>,
+ weak: UnsafeCell<usize>,
+ value: T,
+ }
+ pub struct Rc<T: ?Sized, A = Global> {
+ ptr: NonNull<RcBox<T>>,
+ phantom: PhantomData<RcBox<T>>,
+ alloc: A,
+ }
+
+ #[repr(C, align(8))]
+ struct AtomicUsize(usize);
+ #[repr(C)]
+ struct ArcInner<T: ?Sized> {
+ strong: AtomicUsize,
+ weak: AtomicUsize,
+ data: T,
+ }
+ pub struct Arc<T: ?Sized, A = Global> {
+ ptr: NonNull<ArcInner<T>>,
+ phantom: PhantomData<ArcInner<T>>,
+ alloc: A,
+ }
+}
+#[cfg(not(host))]
+use prelude::*;
+
+macro_rules! assert_abi_compatible {
+ ($name:ident, $t1:ty, $t2:ty) => {
+ mod $name {
+ use super::*;
+ // Declaring a `type` doesn't even check well-formedness, so we also declare a function.
+ fn check_wf(_x: $t1, _y: $t2) {}
+ // Test argument and return value, `Rust` and `C` ABIs.
+ #[rustc_abi(assert_eq)]
+ type TestRust = (fn($t1) -> $t1, fn($t2) -> $t2);
+ #[rustc_abi(assert_eq)]
+ type TestC = (extern "C" fn($t1) -> $t1, extern "C" fn($t2) -> $t2);
+ }
+ };
+}
+
+struct Zst;
+impl Copy for Zst {}
+impl Clone for Zst {
+ fn clone(&self) -> Self {
+ Zst
+ }
+}
+
+#[repr(C)]
+struct ReprC1<T: ?Sized>(T);
+#[repr(C)]
+struct ReprC2Int<T>(i32, T);
+#[repr(C)]
+struct ReprC2Float<T>(f32, T);
+#[repr(C)]
+struct ReprC4<T>(T, Vec<i32>, Zst, T);
+#[repr(C)]
+struct ReprC4Mixed<T>(T, f32, i32, T);
+#[repr(C)]
+enum ReprCEnum<T> {
+ Variant1,
+ Variant2(T),
+}
+#[repr(C)]
+union ReprCUnion<T> {
+ nothing: (),
+ something: ManuallyDrop<T>,
+}
+
+macro_rules! test_abi_compatible {
+ ($name:ident, $t1:ty, $t2:ty) => {
+ mod $name {
+ use super::*;
+ assert_abi_compatible!(plain, $t1, $t2);
+ // We also do some tests with differences in fields of `repr(C)` types.
+ assert_abi_compatible!(repr_c_1, ReprC1<$t1>, ReprC1<$t2>);
+ assert_abi_compatible!(repr_c_2_int, ReprC2Int<$t1>, ReprC2Int<$t2>);
+ assert_abi_compatible!(repr_c_2_float, ReprC2Float<$t1>, ReprC2Float<$t2>);
+ assert_abi_compatible!(repr_c_4, ReprC4<$t1>, ReprC4<$t2>);
+ assert_abi_compatible!(repr_c_4mixed, ReprC4Mixed<$t1>, ReprC4Mixed<$t2>);
+ assert_abi_compatible!(repr_c_enum, ReprCEnum<$t1>, ReprCEnum<$t2>);
+ assert_abi_compatible!(repr_c_union, ReprCUnion<$t1>, ReprCUnion<$t2>);
+ }
+ };
+}
+
+// Compatibility of pointers is probably de-facto guaranteed,
+// but that does not seem to be documented.
+test_abi_compatible!(ptr_mut, *const i32, *mut i32);
+test_abi_compatible!(ptr_pointee, *const i32, *const Vec<i32>);
+test_abi_compatible!(ref_mut, &i32, &mut i32);
+test_abi_compatible!(ref_ptr, &i32, *const i32);
+test_abi_compatible!(box_ptr, Box<i32>, *const i32);
+test_abi_compatible!(nonnull_ptr, NonNull<i32>, *const i32);
+test_abi_compatible!(fn_fn, fn(), fn(i32) -> i32);
+
+// Some further guarantees we will likely (have to) make.
+test_abi_compatible!(zst_unit, Zst, ());
+#[cfg(not(any(target_arch = "sparc64")))]
+test_abi_compatible!(zst_array, Zst, [u8; 0]);
+test_abi_compatible!(nonzero_int, NonZeroI32, i32);
+
+// `DispatchFromDyn` relies on ABI compatibility.
+// This is interesting since these types are not `repr(transparent)`.
+test_abi_compatible!(rc, Rc<i32>, *mut i32);
+test_abi_compatible!(arc, Arc<i32>, *mut i32);
+
+// `repr(transparent)` compatibility.
+#[repr(transparent)]
+struct Wrapper1<T: ?Sized>(T);
+#[repr(transparent)]
+struct Wrapper2<T: ?Sized>((), Zst, T);
+#[repr(transparent)]
+struct Wrapper3<T>(T, [u8; 0], PhantomData<u64>);
+#[repr(transparent)]
+union WrapperUnion<T> {
+ nothing: (),
+ something: ManuallyDrop<T>,
+}
+
+macro_rules! test_transparent {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ test_abi_compatible!(wrap1, $t, Wrapper1<$t>);
+ test_abi_compatible!(wrap2, $t, Wrapper2<$t>);
+ test_abi_compatible!(wrap3, $t, Wrapper3<$t>);
+ test_abi_compatible!(wrap4, $t, WrapperUnion<$t>);
+ }
+ };
+}
+
+test_transparent!(simple, i32);
+test_transparent!(reference, &'static i32);
+test_transparent!(zst, Zst);
+test_transparent!(unit, ());
+test_transparent!(enum_, Option<i32>);
+test_transparent!(enum_niched, Option<&'static i32>);
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod tuples {
+ use super::*;
+ // mixing in some floats since they often get special treatment
+ test_transparent!(pair, (i32, f32));
+ // chosen to fit into 64bit
+ test_transparent!(triple, (i8, i16, f32));
+ // Pure-float types that are not ScalarPair seem to be tricky.
+ test_transparent!(triple_f32, (f32, f32, f32));
+ test_transparent!(triple_f64, (f64, f64, f64));
+ // and also something that's larger than 2 pointers
+ test_transparent!(tuple, (i32, f32, i64, f64));
+}
+// Some targets have special rules for arrays.
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod arrays {
+ use super::*;
+ test_transparent!(empty_array, [u32; 0]);
+ test_transparent!(empty_1zst_array, [u8; 0]);
+ test_transparent!(small_array, [i32; 2]); // chosen to fit into 64bit
+ test_transparent!(large_array, [i32; 16]);
+}
+
+// Some tests with unsized types (not all wrappers are compatible with that).
+macro_rules! test_transparent_unsized {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ assert_abi_compatible!(wrap1, $t, Wrapper1<$t>);
+ assert_abi_compatible!(wrap1_reprc, ReprC1<$t>, ReprC1<Wrapper1<$t>>);
+ assert_abi_compatible!(wrap2, $t, Wrapper2<$t>);
+ assert_abi_compatible!(wrap2_reprc, ReprC1<$t>, ReprC1<Wrapper2<$t>>);
+ }
+ };
+}
+
+#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
+mod unsized_ {
+ use super::*;
+ test_transparent_unsized!(str_, str);
+ test_transparent_unsized!(slice, [u8]);
+ test_transparent_unsized!(dyn_trait, dyn Any);
+}
+
+// RFC 3391 <https://rust-lang.github.io/rfcs/3391-result_ffi_guarantees.html>.
+macro_rules! test_nonnull {
+ ($name:ident, $t:ty) => {
+ mod $name {
+ use super::*;
+ test_abi_compatible!(option, Option<$t>, $t);
+ test_abi_compatible!(result_err_unit, Result<$t, ()>, $t);
+ test_abi_compatible!(result_ok_unit, Result<(), $t>, $t);
+ test_abi_compatible!(result_err_zst, Result<$t, Zst>, $t);
+ test_abi_compatible!(result_ok_zst, Result<Zst, $t>, $t);
+ test_abi_compatible!(result_err_arr, Result<$t, [i8; 0]>, $t);
+ test_abi_compatible!(result_ok_arr, Result<[i8; 0], $t>, $t);
+ }
+ }
+}
+
+test_nonnull!(ref_, &i32);
+test_nonnull!(mut_, &mut i32);
+test_nonnull!(ref_unsized, &[i32]);
+test_nonnull!(mut_unsized, &mut [i32]);
+test_nonnull!(fn_, fn());
+test_nonnull!(nonnull, NonNull<i32>);
+test_nonnull!(nonnull_unsized, NonNull<dyn Any>);
+test_nonnull!(non_zero, NonZeroI32);
+
+fn main() {}
diff --git a/tests/ui/abi/debug.rs b/tests/ui/abi/debug.rs
new file mode 100644
index 000000000..77715ee40
--- /dev/null
+++ b/tests/ui/abi/debug.rs
@@ -0,0 +1,53 @@
+// normalize-stderr-test "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
+// normalize-stderr-test "(size): Size\([48] bytes\)" -> "$1: $$SOME_SIZE"
+// normalize-stderr-test "(can_unwind): (true|false)" -> "$1: $$SOME_BOOL"
+// normalize-stderr-test "(valid_range): 0\.\.=(4294967295|18446744073709551615)" -> "$1: $$FULL"
+// This pattern is prepared for when we account for alignment in the niche.
+// normalize-stderr-test "(valid_range): [1-9]\.\.=(429496729[0-9]|1844674407370955161[0-9])" -> "$1: $$NON_NULL"
+// Some attributes are only computed for release builds:
+// compile-flags: -O
+#![feature(rustc_attrs)]
+#![crate_type = "lib"]
+
+struct S(u16);
+
+#[rustc_abi(debug)]
+fn test(_x: u8) -> bool { true } //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+type TestFnPtr = fn(bool) -> u8; //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+fn test_generic<T>(_x: *const T) { } //~ ERROR: fn_abi
+
+#[rustc_abi(debug)]
+const C: () = (); //~ ERROR: can only be applied to
+
+impl S {
+ #[rustc_abi(debug)]
+ const C: () = (); //~ ERROR: can only be applied to
+}
+
+impl S {
+ #[rustc_abi(debug)]
+ fn assoc_test(&self) { } //~ ERROR: fn_abi
+}
+
+#[rustc_abi(assert_eq)]
+type TestAbiEq = (fn(bool), fn(bool));
+
+#[rustc_abi(assert_eq)]
+type TestAbiNe = (fn(u8), fn(u32)); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiNeFloat = (fn(f32), fn(u32)); //~ ERROR: ABIs are not compatible
+
+// Sign matters on some targets (such as s390x), so let's make sure we never accept this.
+#[rustc_abi(assert_eq)]
+type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
+
+#[rustc_abi(assert_eq)]
+type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr
new file mode 100644
index 000000000..00fc7d1ec
--- /dev/null
+++ b/tests/ui/abi/debug.stderr
@@ -0,0 +1,959 @@
+error: fn_abi_of(test) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: bool,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: Zext,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:15:1
+ |
+LL | fn test(_x: u8) -> bool { true }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: fn_abi_of(TestFnPtr) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: bool,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=1,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: Zext,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:18:1
+ |
+LL | type TestFnPtr = fn(bool) -> u8;
+ | ^^^^^^^^^^^^^^
+
+error: fn_abi_of(test_generic) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: *const T,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:21:1
+ |
+LL | fn test_generic<T>(_x: *const T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
+ --> $DIR/debug.rs:24:1
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u8,
+ layout: Layout {
+ size: Size(1 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I8,
+ false,
+ ),
+ valid_range: 0..=255,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:40:1
+ |
+LL | type TestAbiNe = (fn(u8), fn(u32));
+ | ^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: [u8; 32],
+ layout: Layout {
+ size: Size(32 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Array {
+ stride: Size(1 bytes),
+ count: 32,
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Indirect {
+ attrs: ArgAttributes {
+ regular: NoAlias | NoCapture | NonNull | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(32 bytes),
+ pointee_align: Some(
+ Align(1 bytes),
+ ),
+ },
+ meta_attrs: None,
+ on_stack: false,
+ },
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: [u32; 32],
+ layout: Layout {
+ size: Size(128 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Array {
+ stride: Size(4 bytes),
+ count: 32,
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Indirect {
+ attrs: ArgAttributes {
+ regular: NoAlias | NoCapture | NonNull | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(128 bytes),
+ pointee_align: Some(
+ Align(4 bytes),
+ ),
+ },
+ meta_attrs: None,
+ on_stack: false,
+ },
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:43:1
+ |
+LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32]));
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: f32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: F32,
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:46:1
+ |
+LL | type TestAbiNeFloat = (fn(f32), fn(u32));
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: ABIs are not compatible
+ left ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: i32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ true,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ right ABI = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: u32,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Int(
+ I32,
+ false,
+ ),
+ valid_range: $FULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoUndef,
+ arg_ext: None,
+ pointee_size: Size(0 bytes),
+ pointee_align: None,
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:50:1
+ |
+LL | type TestAbiNeSign = (fn(i32), fn(u32));
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/debug.rs:53:46
+ |
+LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str)));
+ | ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
+ --> $DIR/debug.rs:28:5
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: fn_abi_of(assoc_test) = FnAbi {
+ args: [
+ ArgAbi {
+ layout: TyAndLayout {
+ ty: &S,
+ layout: Layout {
+ size: $SOME_SIZE,
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Scalar(
+ Initialized {
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $NON_NULL,
+ },
+ ),
+ fields: Primitive,
+ largest_niche: Some(
+ Niche {
+ offset: Size(0 bytes),
+ value: Pointer(
+ AddressSpace(
+ 0,
+ ),
+ ),
+ valid_range: $NON_NULL,
+ },
+ ),
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Direct(
+ ArgAttributes {
+ regular: NoAlias | NonNull | ReadOnly | NoUndef,
+ arg_ext: None,
+ pointee_size: Size(2 bytes),
+ pointee_align: Some(
+ Align(2 bytes),
+ ),
+ },
+ ),
+ },
+ ],
+ ret: ArgAbi {
+ layout: TyAndLayout {
+ ty: (),
+ layout: Layout {
+ size: Size(0 bytes),
+ align: AbiAndPrefAlign {
+ abi: $SOME_ALIGN,
+ pref: $SOME_ALIGN,
+ },
+ abi: Aggregate {
+ sized: true,
+ },
+ fields: Arbitrary {
+ offsets: [],
+ memory_index: [],
+ },
+ largest_niche: None,
+ variants: Single {
+ index: 0,
+ },
+ max_repr_align: None,
+ unadjusted_abi_align: $SOME_ALIGN,
+ },
+ },
+ mode: Ignore,
+ },
+ c_variadic: false,
+ fixed_count: 1,
+ conv: Rust,
+ can_unwind: $SOME_BOOL,
+ }
+ --> $DIR/debug.rs:33:5
+ |
+LL | fn assoc_test(&self) { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/abi/explicit_repr_rust.rs b/tests/ui/abi/explicit_repr_rust.rs
new file mode 100644
index 000000000..4f8cab3bf
--- /dev/null
+++ b/tests/ui/abi/explicit_repr_rust.rs
@@ -0,0 +1,12 @@
+// check-pass
+
+#[repr(Rust)]
+struct A;
+
+#[repr(Rust, align(16))]
+struct B;
+
+#[repr(Rust, packed)]
+struct C;
+
+fn main() {}
diff --git a/tests/ui/abi/relocation_model_pic.rs b/tests/ui/abi/relocation_model_pic.rs
index 0cfc44cd0..cca2e8db7 100644
--- a/tests/ui/abi/relocation_model_pic.rs
+++ b/tests/ui/abi/relocation_model_pic.rs
@@ -1,7 +1,6 @@
// run-pass
// compile-flags: -C relocation-model=pic
-// ignore-emscripten no pic
-// ignore-wasm
+// needs-relocation-model-pic
#![feature(cfg_relocation_model)]
diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr
index 2504f616f..966f56e2a 100644
--- a/tests/ui/argument-suggestions/issue-100154.stderr
+++ b/tests/ui/argument-suggestions/issue-100154.stderr
@@ -14,12 +14,10 @@ LL | fn foo(i: impl std::fmt::Display) {}
= note: `impl Trait` cannot be explicitly specified as a generic argument
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/issue-100154.rs:4:15
+ --> $DIR/issue-100154.rs:4:11
|
LL | foo::<()>(());
- | --------- ^^ `()` cannot be formatted with the default formatter
- | |
- | required by a bound introduced by this call
+ | ^^ `()` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
diff --git a/tests/ui/argument-suggestions/two-mismatch-notes.stderr b/tests/ui/argument-suggestions/two-mismatch-notes.stderr
index 38cf23ddc..70cc60255 100644
--- a/tests/ui/argument-suggestions/two-mismatch-notes.stderr
+++ b/tests/ui/argument-suggestions/two-mismatch-notes.stderr
@@ -11,7 +11,6 @@ LL | foo(f, w);
| ^
= note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: expected `Wrapper<i32>`, found `Wrapper<isize>`
--> $DIR/two-mismatch-notes.rs:10:12
|
diff --git a/tests/ui/asm/aarch64/type-check-2.stderr b/tests/ui/asm/aarch64/type-check-2.stderr
index 875df44ff..d647f6a9f 100644
--- a/tests/ui/asm/aarch64/type-check-2.stderr
+++ b/tests/ui/asm/aarch64/type-check-2.stderr
@@ -22,7 +22,7 @@ LL | asm!("{:v}", in(vreg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
= note: `SimdNonCopy` does not implement the Copy trait
-error: cannot use value of type `[closure@$DIR/type-check-2.rs:41:28: 41:36]` for inline assembly
+error: cannot use value of type `{closure@$DIR/type-check-2.rs:41:28: 41:36}` for inline assembly
--> $DIR/type-check-2.rs:41:28
|
LL | asm!("{}", in(reg) |x: i32| x);
diff --git a/tests/ui/asm/x86_64/type-check-2.stderr b/tests/ui/asm/x86_64/type-check-2.stderr
index d9ca25519..4f3d5100a 100644
--- a/tests/ui/asm/x86_64/type-check-2.stderr
+++ b/tests/ui/asm/x86_64/type-check-2.stderr
@@ -30,7 +30,7 @@ LL | asm!("{}", in(xmm_reg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
= note: `SimdNonCopy` does not implement the Copy trait
-error: cannot use value of type `[closure@$DIR/type-check-2.rs:52:28: 52:36]` for inline assembly
+error: cannot use value of type `{closure@$DIR/type-check-2.rs:52:28: 52:36}` for inline assembly
--> $DIR/type-check-2.rs:52:28
|
LL | asm!("{}", in(reg) |x: i32| x);
diff --git a/tests/ui/associated-consts/associated-const-array-len.stderr b/tests/ui/associated-consts/associated-const-array-len.stderr
index 86c62e7b7..e3db45810 100644
--- a/tests/ui/associated-consts/associated-const-array-len.stderr
+++ b/tests/ui/associated-consts/associated-const-array-len.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/associated-const-array-len.rs:5:16
+ --> $DIR/associated-const-array-len.rs:5:17
|
LL | const X: [i32; <i32 as Foo>::ID] = [0, 1, 2];
- | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ | ^^^ the trait `Foo` is not implemented for `i32`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-const-array-len.rs:1:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.rs b/tests/ui/associated-consts/defaults-cyclic-fail.rs
index a1c6840a0..9ef0003da 100644
--- a/tests/ui/associated-consts/defaults-cyclic-fail.rs
+++ b/tests/ui/associated-consts/defaults-cyclic-fail.rs
@@ -3,7 +3,7 @@
// Cyclic assoc. const defaults don't error unless *used*
trait Tr {
const A: u8 = Self::B;
- //~^ cycle detected when const-evaluating + checking `Tr::A`
+ //~^ cycle detected
const B: u8 = Self::A;
}
diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.stderr b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
index ebdb76e42..e29c32f5d 100644
--- a/tests/ui/associated-consts/defaults-cyclic-fail.stderr
+++ b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `Tr::A`
+error[E0391]: cycle detected when simplifying constant for the type system `Tr::A`
+ --> $DIR/defaults-cyclic-fail.rs:5:5
+ |
+LL | const A: u8 = Self::B;
+ | ^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:5:19
|
LL | const A: u8 = Self::B;
| ^^^^^^^
+note: ...which requires simplifying constant for the type system `Tr::B`...
+ --> $DIR/defaults-cyclic-fail.rs:8:5
|
+LL | const B: u8 = Self::A;
+ | ^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:19
|
LL | const B: u8 = Self::A;
| ^^^^^^^
- = note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `Tr::A`, completing the cycle
note: cycle used when const-evaluating + checking `main::promoted[1]`
--> $DIR/defaults-cyclic-fail.rs:16:16
|
diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
index 9b761b006..d65991234 100644
--- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
+++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<() as Tr>::B` failed
LL | const B: u8 = Self::A + 1;
| ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:16
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
@@ -18,7 +18,7 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/defaults-not-assumed-fail.rs:33:5
|
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
diff --git a/tests/ui/associated-consts/double-elided.rs b/tests/ui/associated-consts/double-elided.rs
new file mode 100644
index 000000000..fd0317781
--- /dev/null
+++ b/tests/ui/associated-consts/double-elided.rs
@@ -0,0 +1,12 @@
+struct S;
+
+impl S {
+ const C: &&str = &"";
+ //~^ WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| ERROR in type `&&str`, reference has a longer lifetime than the data it references
+}
+
+fn main() {}
diff --git a/tests/ui/associated-consts/double-elided.stderr b/tests/ui/associated-consts/double-elided.stderr
new file mode 100644
index 000000000..ba4e6a23e
--- /dev/null
+++ b/tests/ui/associated-consts/double-elided.stderr
@@ -0,0 +1,47 @@
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+ = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
+help: use the `'static` lifetime
+ |
+LL | const C: &'static &str = &"";
+ | +++++++
+
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/double-elided.rs:4:15
+ |
+LL | const C: &&str = &"";
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+help: use the `'static` lifetime
+ |
+LL | const C: &&'static str = &"";
+ | +++++++
+
+error[E0491]: in type `&&str`, reference has a longer lifetime than the data it references
+ --> $DIR/double-elided.rs:4:5
+ |
+LL | const C: &&str = &"";
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the anonymous lifetime as defined here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+note: but the referenced data is only valid for the anonymous lifetime as defined here
+ --> $DIR/double-elided.rs:4:14
+ |
+LL | const C: &&str = &"";
+ | ^
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
index 40896c32e..1e0b77b0d 100644
--- a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
+++ b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.rs
@@ -5,6 +5,8 @@ trait Trait {
impl Trait for () {
const ASSOC: &dyn Fn(_) = 1i32;
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated constants
+ //~| WARN `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}
fn main() {}
diff --git a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
index 993a08fab..f8c02420f 100644
--- a/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
+++ b/tests/ui/associated-consts/infer-placeholder-in-non-suggestable-pos.stderr
@@ -1,9 +1,23 @@
+warning: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:18
+ |
+LL | const ASSOC: &dyn Fn(_) = 1i32;
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+ = note: `#[warn(elided_lifetimes_in_associated_constant)]` on by default
+help: use the `'static` lifetime
+ |
+LL | const ASSOC: &'static dyn Fn(_) = 1i32;
+ | +++++++
+
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
--> $DIR/infer-placeholder-in-non-suggestable-pos.rs:6:26
|
LL | const ASSOC: &dyn Fn(_) = 1i32;
| ^ not allowed in type signatures
-error: aborting due to previous error
+error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0121`.
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index e9fe3a5e5..927422fa8 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -51,6 +51,11 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
LL | foo::<Demo>()();
| ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-105330.rs:1:1
+ |
+LL | pub trait TraitWAssocConst {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foo`
--> $DIR/issue-105330.rs:11:11
|
@@ -87,6 +92,11 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
LL | foo::<Demo>();
| ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-105330.rs:1:1
+ |
+LL | pub trait TraitWAssocConst {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foo`
--> $DIR/issue-105330.rs:11:11
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
index 51bf0cb5e..4418fb755 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-249
LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
+note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
+ |
+LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
+ |
+LL | const BAR: u32 = IMPL_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
index 8277d41a1..392cd5e34 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `FooDefault::BAR`
LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
+ |
+LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
+ |
+LL | const BAR: u32 = DEFAULT_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `FooDefault::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
|
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
index 9983ba794..6cbddca9c 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
@@ -4,7 +4,12 @@ error[E0391]: cycle detected when elaborating drops for `<impl at $DIR/issue-249
LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^
|
-note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
+note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
+ |
+LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
@@ -14,6 +19,11 @@ note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`...
+ --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
+ |
+LL | const BAR: u32 = TRAIT_REF_BAR;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
|
diff --git a/tests/ui/associated-inherent-types/issue-111879-1.stderr b/tests/ui/associated-inherent-types/issue-111879-1.stderr
index 689b45e09..bf35f2bb5 100644
--- a/tests/ui/associated-inherent-types/issue-111879-1.stderr
+++ b/tests/ui/associated-inherent-types/issue-111879-1.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(for<'a> fn(Foo<fn(&'a ())>::Assoc))`
+ = note: expected signature `fn()`
+ found signature `fn(for<'a> fn(&'a ()))`
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/private-in-public.rs b/tests/ui/associated-inherent-types/private-in-public.rs
index e9e189f95..7797a2a16 100644
--- a/tests/ui/associated-inherent-types/private-in-public.rs
+++ b/tests/ui/associated-inherent-types/private-in-public.rs
@@ -1,26 +1,15 @@
+// check-pass
+
#![feature(inherent_associated_types)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
#![crate_type = "lib"]
-#![deny(private_in_public)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub type PubAlias0 = PubTy::PrivAssocTy;
-//~^ ERROR private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
+//~^ WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
pub type PubAlias1 = PrivTy::PubAssocTy;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias1`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias1`
pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
-//~^ ERROR private type `PrivTy` in public interface (error E0446)
-//~| WARNING this was previously accepted
-//~| WARNING type `PrivTy` is more private than the item `PubAlias2`
+//~^ WARNING type `PrivTy` is more private than the item `PubAlias2`
pub struct PubTy;
impl PubTy {
diff --git a/tests/ui/associated-inherent-types/private-in-public.stderr b/tests/ui/associated-inherent-types/private-in-public.stderr
index 65d187c1b..076bbd78a 100644
--- a/tests/ui/associated-inherent-types/private-in-public.stderr
+++ b/tests/ui/associated-inherent-types/private-in-public.stderr
@@ -1,75 +1,39 @@
-error: private associated type `PubTy::PrivAssocTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:12:1
- |
-LL | pub type PubAlias0 = PubTy::PrivAssocTy;
- | ^^^^^^^^^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-note: the lint level is defined here
- --> $DIR/private-in-public.rs:5:9
- |
-LL | #![deny(private_in_public)]
- | ^^^^^^^^^^^^^^^^^
-
warning: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
- --> $DIR/private-in-public.rs:12:1
+ --> $DIR/private-in-public.rs:7:1
|
LL | pub type PubAlias0 = PubTy::PrivAssocTy;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias0` is reachable at visibility `pub`
|
note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:27:5
+ --> $DIR/private-in-public.rs:16:5
|
LL | type PrivAssocTy = ();
| ^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/private-in-public.rs:6:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: private type `PrivTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:16:1
- |
-LL | pub type PubAlias1 = PrivTy::PubAssocTy;
- | ^^^^^^^^^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+ = note: `#[warn(private_interfaces)]` on by default
warning: type `PrivTy` is more private than the item `PubAlias1`
- --> $DIR/private-in-public.rs:16:1
+ --> $DIR/private-in-public.rs:9:1
|
LL | pub type PubAlias1 = PrivTy::PubAssocTy;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias1` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:31:1
+ --> $DIR/private-in-public.rs:20:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error: private type `PrivTy` in public interface (error E0446)
- --> $DIR/private-in-public.rs:20:1
- |
-LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
- | ^^^^^^^^^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `PubAlias2`
- --> $DIR/private-in-public.rs:20:1
+ --> $DIR/private-in-public.rs:11:1
|
LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
| ^^^^^^^^^^^^^^^^^^ type alias `PubAlias2` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public.rs:31:1
+ --> $DIR/private-in-public.rs:20:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
index 5c59f217b..997696923 100644
--- a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
+++ b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
@@ -1,6 +1,5 @@
-// FIXME(inherent_associated_types): This should be `check-pass`
-// known-bug: #108491
// compile-flags: --crate-type=lib
+// check-pass
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
@@ -8,11 +7,6 @@
// Bounds on the self type play a major role in the resolution of inherent associated types (*).
// As a result of that, if a type alias contains any then its bounds have to be respected and the
// lint `type_alias_bounds` should not fire.
-//
-// FIXME(inherent_associated_types): In the current implementation that is. We might move the
-// selection phase of IATs from hir_typeck to trait_selection resulting in us not requiring the
-// ParamEnv that early allowing us to ignore bounds on type aliases again.
-// Triage this before stabilization.
#![deny(type_alias_bounds)]
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
deleted file mode 100644
index 5e18543fc..000000000
--- a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0391]: cycle detected when expanding type alias `Alias`
- --> $DIR/type-alias-bounds-are-enforced.rs:19:1
- |
-LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires computing the variances of `Source`...
- --> $DIR/type-alias-bounds-are-enforced.rs:21:1
- |
-LL | pub struct Source<T>(T);
- | ^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing the variances for items in this crate...
- = note: ...which again requires expanding type alias `Alias`, completing the cycle
-note: cycle used when collecting item types in top-level module
- --> $DIR/type-alias-bounds-are-enforced.rs:5:1
- |
-LL | / #![feature(inherent_associated_types)]
-LL | | #![allow(incomplete_features)]
-LL | |
-LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
-... |
-LL | | pub type Assoc = ();
-LL | | }
- | |_^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when expanding type alias `Alias`
- --> $DIR/type-alias-bounds-are-enforced.rs:19:1
- |
-LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires computing the variances of `Source`...
- --> $DIR/type-alias-bounds-are-enforced.rs:21:1
- |
-LL | pub struct Source<T>(T);
- | ^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing the variances for items in this crate...
- = note: ...which again requires expanding type alias `Alias`, completing the cycle
-note: cycle used when collecting item types in top-level module
- --> $DIR/type-alias-bounds-are-enforced.rs:5:1
- |
-LL | / #![feature(inherent_associated_types)]
-LL | | #![allow(incomplete_features)]
-LL | |
-LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
-... |
-LL | | pub type Assoc = ();
-LL | | }
- | |_^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs
new file mode 100644
index 000000000..3853bc859
--- /dev/null
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.rs
@@ -0,0 +1,12 @@
+#![allow(bare_trait_objects)]
+#![feature(associated_type_bounds)]
+trait Item {
+ type Core;
+}
+pub struct Flatten<I> {
+ inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ //~^ ERROR E0191
+ //~| ERROR E0223
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
new file mode 100644
index 000000000..61299550e
--- /dev/null
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
@@ -0,0 +1,24 @@
+error[E0191]: the value of the associated types `IntoIter` (from trait `IntoIterator`), `IntoIter` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`) must be specified
+ --> $DIR/overlaping-bound-suggestion.rs:7:13
+ |
+LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | associated types `Item`, `IntoIter` must be specified
+ | associated types `Item`, `IntoIter` must be specified
+
+error[E0223]: ambiguous associated type
+ --> $DIR/overlaping-bound-suggestion.rs:7:13
+ |
+LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: if there were a trait named `Example` with associated type `IntoIterator` implemented for `(dyn IntoIterator + 'static)`, you could use the fully-qualified path
+ |
+LL | inner: <<(dyn IntoIterator + 'static) as Example>::IntoIterator as Item>::Core,
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0191, E0223.
+For more information about an error, try `rustc --explain E0191`.
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
index c2da4f576..edce1045e 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
@@ -13,12 +13,12 @@ error: future cannot be sent between threads safely
LL | is_send(foo::<T>());
| ^^^^^^^^^^ future returned by `foo` is not `Send`
|
- = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>`
+ = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/basic.rs:13:5
|
LL | T::method().await?;
- | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send`
+ | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>> { <T as Foo>::method() }`, which is not `Send`
note: required by a bound in `is_send`
--> $DIR/basic.rs:17:20
|
diff --git a/tests/ui/associated-type-bounds/suggest-removing-impl.rs b/tests/ui/associated-type-bounds/suggest-removing-impl.rs
new file mode 100644
index 000000000..242cd8572
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-removing-impl.rs
@@ -0,0 +1,14 @@
+trait Tr {
+ type Assoc: impl Sized;
+ //~^ ERROR expected a trait, found type
+ //~| HELP use the trait bounds directly
+
+ fn fn_with_generics<T>()
+ where
+ T: impl Sized
+ //~^ ERROR expected a trait, found type
+ //~| HELP use the trait bounds directly
+ {}
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-removing-impl.stderr b/tests/ui/associated-type-bounds/suggest-removing-impl.stderr
new file mode 100644
index 000000000..875b2db6d
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-removing-impl.stderr
@@ -0,0 +1,26 @@
+error: expected a trait, found type
+ --> $DIR/suggest-removing-impl.rs:2:17
+ |
+LL | type Assoc: impl Sized;
+ | ^^^^^^^^^^
+ |
+help: use the trait bounds directly
+ |
+LL - type Assoc: impl Sized;
+LL + type Assoc: Sized;
+ |
+
+error: expected a trait, found type
+ --> $DIR/suggest-removing-impl.rs:8:12
+ |
+LL | T: impl Sized
+ | ^^^^^^^^^^
+ |
+help: use the trait bounds directly
+ |
+LL - T: impl Sized
+LL + T: Sized
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
index 8c3463a28..fbc4ccd4c 100644
--- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
+++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Add<A>` is not satisfied
|
LL | r = r + a;
| ^ the trait `Add<A>` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:1
+ |
+LL | trait Add<RHS=Self> {
+ | ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
index 8fecfdf7b..676d6353d 100644
--- a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
+++ b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
- --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:12
+ --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:13
|
LL | let u: <T as Foo<usize>>::Bar = t.get_bar();
- | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<usize>` is not implemented for `T`
+ | ^ the trait `Foo<usize>` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
index bd3ee2abd..b3f2e16ba 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-types-no-suitable-supertrait.rs:12:1
+ |
+LL | trait Get {
+ | ^^^^^^^^^
error[E0277]: the trait bound `Self: Get` is not satisfied
--> $DIR/associated-types-no-suitable-supertrait.rs:17:40
diff --git a/tests/ui/associated-types/defaults-specialization.stderr b/tests/ui/associated-types/defaults-specialization.stderr
index 7e21f7fc3..7ef433d85 100644
--- a/tests/ui/associated-types/defaults-specialization.stderr
+++ b/tests/ui/associated-types/defaults-specialization.stderr
@@ -29,7 +29,7 @@ error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:35:18
|
LL | default type Ty = bool;
- | ----------------------- expected this associated type
+ | ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> bool { true }
| ^^^^
@@ -76,7 +76,7 @@ error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:44:29
|
LL | default type Ty = bool;
- | ----------------------- expected this associated type
+ | ----------------------- associated type is `default` and may be overridden
LL |
LL | fn make() -> Self::Ty { true }
| -------- ^^^^ expected associated type, found `bool`
diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.stderr
index 4b2094691..0a8ad0f89 100644
--- a/tests/ui/associated-types/defaults-suitability.stderr
+++ b/tests/ui/associated-types/defaults-suitability.stderr
@@ -58,6 +58,11 @@ error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
LL | type Assoc: Foo<Self> = ();
| ^^ the trait `Foo<Self>` is not implemented for `()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/defaults-suitability.rs:27:1
+ |
+LL | trait Foo<T> {
+ | ^^^^^^^^^^^^
note: required by a bound in `Bar::Assoc`
--> $DIR/defaults-suitability.rs:34:17
|
diff --git a/tests/ui/associated-types/issue-23595-2.stderr b/tests/ui/associated-types/issue-23595-2.stderr
index dded673f6..73effa9f9 100644
--- a/tests/ui/associated-types/issue-23595-2.stderr
+++ b/tests/ui/associated-types/issue-23595-2.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `anything_here_kills_it` not found for `Self`
--> $DIR/issue-23595-2.rs:6:22
|
LL | type B = C<Self::anything_here_kills_it>;
- | ^^^^^^^^^^^^^^^^^^^^^^ associated type `anything_here_kills_it` not found
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: `Self` has the following associated type: `B`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-32323.rs b/tests/ui/associated-types/issue-32323.rs
index 5078f5523..5078f5523 100644
--- a/tests/ui/issues/issue-32323.rs
+++ b/tests/ui/associated-types/issue-32323.rs
diff --git a/tests/ui/issues/issue-32323.stderr b/tests/ui/associated-types/issue-32323.stderr
index 8212c607e..8212c607e 100644
--- a/tests/ui/issues/issue-32323.stderr
+++ b/tests/ui/associated-types/issue-32323.stderr
diff --git a/tests/ui/associated-types/issue-44153.stderr b/tests/ui/associated-types/issue-44153.stderr
index 8bddcd955..73365d64d 100644
--- a/tests/ui/associated-types/issue-44153.stderr
+++ b/tests/ui/associated-types/issue-44153.stderr
@@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `<() as Array>::Element == &()`
- --> $DIR/issue-44153.rs:18:5
+ --> $DIR/issue-44153.rs:18:6
|
LL | <() as Visit>::visit();
- | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Array>::Element == &()`
+ | ^^ type mismatch resolving `<() as Array>::Element == &()`
|
note: expected this to be `&()`
--> $DIR/issue-44153.rs:10:20
diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr
index a84b599b5..266e22d47 100644
--- a/tests/ui/associated-types/issue-59324.stderr
+++ b/tests/ui/associated-types/issue-59324.stderr
@@ -48,6 +48,12 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
|
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-59324.rs:3:1
+ |
+LL | pub trait Foo: NotFoo {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bug: Foo` is not satisfied
--> $DIR/issue-59324.rs:19:10
diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr
index 6ad795c11..f1016f0e3 100644
--- a/tests/ui/associated-types/issue-64855.stderr
+++ b/tests/ui/associated-types/issue-64855.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<T>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-64855.rs:1:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-types/issue-85103-layout-debug.rs b/tests/ui/associated-types/issue-85103-layout-debug.rs
new file mode 100644
index 000000000..77c9876ff
--- /dev/null
+++ b/tests/ui/associated-types/issue-85103-layout-debug.rs
@@ -0,0 +1,9 @@
+#![feature(rustc_attrs)]
+
+use std::borrow::Cow;
+
+#[rustc_layout(debug)]
+type Edges<'a, E> = Cow<'a, [E]>;
+//~^ the trait bound `[E]: ToOwned` is not satisfied
+
+fn main() {}
diff --git a/tests/ui/associated-types/issue-85103-layout-debug.stderr b/tests/ui/associated-types/issue-85103-layout-debug.stderr
new file mode 100644
index 000000000..0bdea10ba
--- /dev/null
+++ b/tests/ui/associated-types/issue-85103-layout-debug.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `[E]: ToOwned` is not satisfied
+ --> $DIR/issue-85103-layout-debug.rs:6:21
+ |
+LL | type Edges<'a, E> = Cow<'a, [E]>;
+ | ^^^^^^^^^^^^ the trait `ToOwned` is not implemented for `[E]`
+ |
+note: required by a bound in `Cow`
+ --> $SRC_DIR/alloc/src/borrow.rs:LL:COL
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+ |
+LL | type Edges<'a, E> where [E]: ToOwned = Cow<'a, [E]>;
+ | ++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-types/issue-85103.rs b/tests/ui/associated-types/issue-85103.rs
deleted file mode 100644
index 9c6a419e9..000000000
--- a/tests/ui/associated-types/issue-85103.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(rustc_attrs)]
-
-use std::borrow::Cow;
-
-#[rustc_layout(debug)]
-type Edges<'a, E> = Cow<'a, [E]>;
-//~^ 6:1: 6:18: unable to determine layout for `<[E] as ToOwned>::Owned` because `<[E] as ToOwned>::Owned` cannot be normalized
-
-fn main() {}
diff --git a/tests/ui/associated-types/issue-85103.stderr b/tests/ui/associated-types/issue-85103.stderr
deleted file mode 100644
index 17f714807..000000000
--- a/tests/ui/associated-types/issue-85103.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: unable to determine layout for `<[E] as ToOwned>::Owned` because `<[E] as ToOwned>::Owned` cannot be normalized
- --> $DIR/issue-85103.rs:6:1
- |
-LL | type Edges<'a, E> = Cow<'a, [E]>;
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
index 3b4689e08..056d9201b 100644
--- a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
+++ b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Foo::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:4:17
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Baz::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:13:18
|
@@ -31,6 +41,11 @@ error[E0277]: the trait bound `bool: Bar` is not satisfied
LL | type Assoc = bool;
| ^^^^ the trait `Bar` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/point-at-type-on-obligation-failure-2.rs:1:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `Bat::Assoc`
--> $DIR/point-at-type-on-obligation-failure-2.rs:24:27
|
diff --git a/tests/ui/associated-types/substs-ppaux.normal.stderr b/tests/ui/associated-types/substs-ppaux.normal.stderr
index acdc3be8c..015b22f79 100644
--- a/tests/ui/associated-types/substs-ppaux.normal.stderr
+++ b/tests/ui/associated-types/substs-ppaux.normal.stderr
@@ -71,10 +71,10 @@ LL | let x: () = foo::<'static>();
| ++
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/substs-ppaux.rs:49:5
+ --> $DIR/substs-ppaux.rs:49:6
|
LL | <str as Foo<u8>>::bar;
- | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
note: required for `str` to implement `Foo<'_, '_, u8>`
diff --git a/tests/ui/associated-types/substs-ppaux.verbose.stderr b/tests/ui/associated-types/substs-ppaux.verbose.stderr
index ad67899e6..484581b10 100644
--- a/tests/ui/associated-types/substs-ppaux.verbose.stderr
+++ b/tests/ui/associated-types/substs-ppaux.verbose.stderr
@@ -71,10 +71,10 @@ LL | let x: () = foo::<'static>();
| ++
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/substs-ppaux.rs:49:5
+ --> $DIR/substs-ppaux.rs:49:6
|
LL | <str as Foo<u8>>::bar;
- | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
note: required for `str` to implement `Foo<'?0, '?1, u8>`
diff --git a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.drop-tracking.stderr
deleted file mode 100644
index fb83ca90a..000000000
--- a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr
+++ /dev/null
@@ -1,106 +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<Output = ()>`, 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: 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<bool>) {
- | - within this `impl Future<Output = ()>`
-...
-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<Output = ()>`, 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>(_: T) -> ! {
- | _____________________________^
-LL | | panic!()
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
-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<bool>) {
- | ________________________________^
-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: 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<Output = ()>`, 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);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: 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<Output = ()>`, 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: 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/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
deleted file mode 100644
index dee90262f..000000000
--- a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
+++ /dev/null
@@ -1,106 +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<Output = ()>`, 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:15
- |
-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: 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<bool>) {
- | - within this `impl Future<Output = ()>`
-...
-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<Output = ()>`, 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>(_: T) -> ! {
- | _____________________________^
-LL | | panic!()
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
-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<bool>) {
- | ________________________________^
-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: 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<Output = ()>`, 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:29
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: 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<Output = ()>`, 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:15
- |
-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: 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/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr
deleted file mode 100644
index d3c5e80a3..000000000
--- a/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr
+++ /dev/null
@@ -1,90 +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<Output = ()>`, 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: 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<Output = ()>`, 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: 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<Output = ()>`, 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);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: 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<Output = ()>`, 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: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
deleted file mode 100644
index ece4e51ec..000000000
--- a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
+++ /dev/null
@@ -1,90 +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<Output = ()>`, 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:15
- |
-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: 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<Output = ()>`, 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:27
- |
-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: 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<Output = ()>`, 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:29
- |
-LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | await occurs here, with `Rc::new(())` maybe used later
- | has type `Rc<()>` which is not `Send`
-note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
- |
-LL | fn is_send<T: 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<Output = ()>`, 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:15
- |
-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: Send>(_: T) {}
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/async-await/async-await-let-else.rs b/tests/ui/async-await/async-await-let-else.rs
index 113d576b5..a3c722605 100644
--- a/tests/ui/async-await/async-await-let-else.rs
+++ b/tests/ui/async-await/async-await-let-else.rs
@@ -1,7 +1,4 @@
// edition:2021
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::rc::Rc;
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.stderr
index e3fcceaa3..9a1c17822 100644
--- a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-await-let-else.stderr
@@ -1,25 +1,25 @@
error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:48:13
+ --> $DIR/async-await-let-else.rs:45:13
|
LL | is_send(foo(Some(true)));
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
|
= help: within `impl Future<Output = ()>`, 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:15
+ --> $DIR/async-await-let-else.rs:8:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
| ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: 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
+ --> $DIR/async-await-let-else.rs:47:13
|
LL | async fn foo2(x: Option<bool>) {
| - within this `impl Future<Output = ()>`
@@ -31,7 +31,7 @@ LL | is_send(foo2(Some(true)));
|
= help: within `impl Future<Output = ()>`, 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
+ --> $DIR/async-await-let-else.rs:24:29
|
LL | async fn bar2<T>(_: T) -> ! {
| _____________________________^
@@ -40,7 +40,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
note: required because it's used within this `async fn` body
- --> $DIR/async-await-let-else.rs:21:32
+ --> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
| ________________________________^
@@ -50,47 +50,47 @@ LL | | };
LL | | }
| |_^
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: 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
+ --> $DIR/async-await-let-else.rs:49:13
|
LL | is_send(foo3(Some(true)));
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
|
= help: within `impl Future<Output = ()>`, 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:29
+ --> $DIR/async-await-let-else.rs:30:29
|
LL | (Rc::new(()), bar().await);
| ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: 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
+ --> $DIR/async-await-let-else.rs:51:13
|
LL | is_send(foo4(Some(true)));
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
|
= help: within `impl Future<Output = ()>`, 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:15
+ --> $DIR/async-await-let-else.rs:38:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
| ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:19:15
+ --> $DIR/async-await-let-else.rs:16:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
index bbd5a822d..c89671cc4 100644
--- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
+++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
@@ -29,13 +29,13 @@ 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`
+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<Output = ()> = &block;
| ^^^^^^ expected `()`, found `u8`
|
- = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to `&dyn Future<Output = ()>`
+ = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to `&dyn Future<Output = ()>`
error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:12:43
@@ -45,13 +45,13 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
| |
| 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`
+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<Output = ()> = &block;
| ^^^^^^ expected `()`, found `u8`
|
- = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to `&dyn Future<Output = ()>`
+ = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to `&dyn Future<Output = ()>`
error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
diff --git a/tests/ui/async-await/async-error-span.drop_tracking.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr
deleted file mode 100644
index 99a674a26..000000000
--- a/tests/ui/async-await/async-error-span.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
- |
-LL | fn get_future() -> impl Future<Output = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` 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:16: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:19:18
- |
-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/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
deleted file mode 100644
index 99a674a26..000000000
--- a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
- |
-LL | fn get_future() -> impl Future<Output = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` 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:16: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:19:18
- |
-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/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs
index c9ecf359e..c8127df62 100644
--- a/tests/ui/async-await/async-error-span.rs
+++ b/tests/ui/async-await/async-error-span.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Regression test for issue #62382.
@@ -13,9 +10,7 @@ fn get_future() -> impl Future<Output = ()> {
}
async fn foo() {
- let a;
- //[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context
- //[drop_tracking_mir]~^^ ERROR type annotations needed
+ let a; //~ ERROR type annotations needed
get_future().await;
}
diff --git a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr b/tests/ui/async-await/async-error-span.stderr
index 2f29ee6cd..2ec968ffc 100644
--- a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-error-span.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:10:20
+ --> $DIR/async-error-span.rs:7:20
|
LL | fn get_future() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
@@ -8,7 +8,7 @@ LL | fn get_future() -> impl Future<Output = ()> {
= note: () must be a future or must implement `IntoFuture` to be awaited
error[E0282]: type annotations needed
- --> $DIR/async-error-span.rs:16:9
+ --> $DIR/async-error-span.rs:13:9
|
LL | let a;
| ^
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
deleted file mode 100644
index 0515edaed..000000000
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
- |
-LL | assert_send(non_send_temporary_in_match());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:36:26
- |
-LL | match Some(non_send()) {
- | ---------------- has type `Option<impl Debug>` 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:67: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:74:17
- |
-LL | assert_send(non_sync_with_method_call());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:49:15
- |
-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:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index b29d2e192..000000000
--- a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,120 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:70:17
- |
-LL | assert_send(local_dropped_before_await());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:27:11
- |
-LL | let x = non_send();
- | - has type `impl Debug` which is not `Send`
-LL | drop(x);
-LL | fut().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67: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:72:17
- |
-LL | assert_send(non_send_temporary_in_match());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:36:26
- |
-LL | match Some(non_send()) {
- | ---------- has type `impl Debug` which is not `Send`
-LL | Some(_) => fut().await,
- | ^^^^^ await occurs here, with `non_send()` maybe used later
-...
-LL | }
- | - `non_send()` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67: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:74:17
- |
-LL | assert_send(non_sync_with_method_call());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:49:15
- |
-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:67: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:76:17
- |
-LL | assert_send(non_sync_with_method_call_panic());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:56:15
- |
-LL | let f: &mut std::fmt::Formatter = panic!();
- | - has type `&mut Formatter<'_>` which is not `Send`
-LL | if non_sync().fmt(f).unwrap() == () {
-LL | fut().await;
- | ^^^^^ await occurs here, with `f` maybe used later
-LL | }
-LL | }
- | - `f` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67: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:78:17
- |
-LL | assert_send(non_sync_with_method_call_infinite_loop());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, 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:63:15
- |
-LL | let f: &mut std::fmt::Formatter = loop {};
- | - has type `&mut Formatter<'_>` which is not `Send`
-LL | if non_sync().fmt(f).unwrap() == () {
-LL | fut().await;
- | ^^^^^ await occurs here, with `f` maybe used later
-LL | }
-LL | }
- | - `f` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 5 previous errors
-
diff --git a/tests/ui/async-await/async-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs
index ed440bd01..c5453b67e 100644
--- a/tests/ui/async-await/async-fn-nonsend.rs
+++ b/tests/ui/async-await/async-fn-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// compile-flags: --crate-type lib
@@ -68,13 +65,10 @@ fn assert_send(_: impl Send) {}
pub fn pass_assert() {
assert_send(local_dropped_before_await());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
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());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_infinite_loop());
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
}
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.stderr
index 219945e09..0ced6c36f 100644
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.stderr
@@ -1,32 +1,32 @@
error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
+ --> $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<Output = ()>`, 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:36:26
+ --> $DIR/async-fn-nonsend.rs:33:26
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
| ^^^^^ await occurs here, with `Some(non_send())` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
+ --> $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:74:17
+ --> $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<Output = ()>`, 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:49:15
+ --> $DIR/async-fn-nonsend.rs:46:15
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
@@ -34,7 +34,7 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
LL | fut().await;
| ^^^^^ await occurs here, with `get_formatter()` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
+ --> $DIR/async-fn-nonsend.rs:64:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr
index 5d29325c8..eaa455380 100644
--- a/tests/ui/async-await/async-is-unwindsafe.stderr
+++ b/tests/ui/async-await/async-is-unwindsafe.stderr
@@ -1,21 +1,20 @@
error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary
- --> $DIR/async-is-unwindsafe.rs:12:19
+ --> $DIR/async-is-unwindsafe.rs:12:5
|
LL | is_unwindsafe(async {
- | ___________________^
+ | _____^^^^^^^^^^^^^_-
+ | | |
+ | | `&mut Context<'_>` may not be safely transferred across an unwind boundary
LL | |
LL | | use std::ptr::null;
LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker};
... |
LL | | drop(cx_ref);
LL | | });
- | | ^
- | | |
- | |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary
- | within this `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`
+ | |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`
|
- = help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
- = note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>`
+ = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
+ = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>`
note: future does not implement `UnwindSafe` as this value is used across an await
--> $DIR/async-is-unwindsafe.rs:25:18
|
@@ -24,9 +23,6 @@ LL | let cx_ref = &mut cx;
LL |
LL | async {}.await; // this needs an inner await point
| ^^^^^ await occurs here, with `cx_ref` maybe used later
-...
-LL | });
- | - `cx_ref` is later dropped here
note: required by a bound in `is_unwindsafe`
--> $DIR/async-is-unwindsafe.rs:3:26
|
diff --git a/tests/ui/async-await/await-sequence.rs b/tests/ui/async-await/await-sequence.rs
index 726c4284e..79f68dd60 100644
--- a/tests/ui/async-await/await-sequence.rs
+++ b/tests/ui/async-await/await-sequence.rs
@@ -1,5 +1,4 @@
// edition:2021
-// compile-flags: -Z drop-tracking
// build-pass
use std::collections::HashMap;
diff --git a/tests/ui/async-await/awaiting-unsized-param.rs b/tests/ui/async-await/awaiting-unsized-param.rs
new file mode 100644
index 000000000..e8b18bf37
--- /dev/null
+++ b/tests/ui/async-await/awaiting-unsized-param.rs
@@ -0,0 +1,13 @@
+// edition: 2021
+
+#![feature(unsized_fn_params, unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+use std::future::Future;
+
+async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
+ //~^ ERROR the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time
+ (&mut f).await
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/awaiting-unsized-param.stderr b/tests/ui/async-await/awaiting-unsized-param.stderr
new file mode 100644
index 000000000..47a5dcebf
--- /dev/null
+++ b/tests/ui/async-await/awaiting-unsized-param.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/awaiting-unsized-param.rs:3:31
+ |
+LL | #![feature(unsized_fn_params, unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time
+ --> $DIR/awaiting-unsized-param.rs:8:17
+ |
+LL | async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Future<Output = T> + Unpin + 'static)`
+ = note: all values captured by value by a closure must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/const-async-fn-in-main.rs b/tests/ui/async-await/const-async-fn-in-main.rs
new file mode 100644
index 000000000..5d1aa4d83
--- /dev/null
+++ b/tests/ui/async-await/const-async-fn-in-main.rs
@@ -0,0 +1,7 @@
+// edition:2021
+// Check what happens when a const async fn is in the main function (#102796)
+
+fn main() {
+ const async fn a() {}
+//~^ ERROR functions cannot be both `const` and `async`
+}
diff --git a/tests/ui/async-await/const-async-fn-in-main.stderr b/tests/ui/async-await/const-async-fn-in-main.stderr
new file mode 100644
index 000000000..10b151709
--- /dev/null
+++ b/tests/ui/async-await/const-async-fn-in-main.stderr
@@ -0,0 +1,11 @@
+error: functions cannot be both `const` and `async`
+ --> $DIR/const-async-fn-in-main.rs:5:5
+ |
+LL | const async fn a() {}
+ | ^^^^^-^^^^^----------
+ | | |
+ | | `async` because of this
+ | `const` because of this
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs
index daee8469a..f4757e7cb 100644
--- a/tests/ui/async-await/default-struct-update.rs
+++ b/tests/ui/async-await/default-struct-update.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs
index e520dfbdc..ef39033a9 100644
--- a/tests/ui/async-await/drop-and-assign.rs
+++ b/tests/ui/async-await/drop-and-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.rs b/tests/ui/async-await/drop-track-bad-field-in-fru.rs
index 28ad77675..667b288e6 100644
--- a/tests/ui/async-await/drop-track-bad-field-in-fru.rs
+++ b/tests/ui/async-await/drop-track-bad-field-in-fru.rs
@@ -1,4 +1,3 @@
-// compile-flags: -Zdrop-tracking
// edition: 2021
fn main() {}
diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
index b49b15db6..721e01062 100644
--- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
+++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
@@ -1,5 +1,5 @@
error[E0559]: variant `Option<_>::None` has no field named `value`
- --> $DIR/drop-track-bad-field-in-fru.rs:7:12
+ --> $DIR/drop-track-bad-field-in-fru.rs:6:12
|
LL | None { value: (), ..Default::default() }.await;
| ^^^^^ `Option<_>::None` does not have this field
@@ -7,7 +7,7 @@ LL | None { value: (), ..Default::default() }.await;
= note: all struct fields are already assigned
error[E0277]: `Option<_>` is not a future
- --> $DIR/drop-track-bad-field-in-fru.rs:7:46
+ --> $DIR/drop-track-bad-field-in-fru.rs:6:46
|
LL | None { value: (), ..Default::default() }.await;
| -^^^^^
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
deleted file mode 100644
index 80402d842..000000000
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
- |
-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:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index 80402d842..000000000
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
- |
-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:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
index 3e2228000..19315ef19 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr
index d9141cf4e..6c235916d 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:45:17
+ --> $DIR/drop-track-field-assign-nonsend.rs:42:17
|
LL | assert_send(agent.handle());
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:39
+ --> $DIR/drop-track-field-assign-nonsend.rs:20:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
@@ -14,7 +14,7 @@ LL | let mut info = self.info_result.clone();
LL | let _ = send_element(element).await;
| ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/drop-track-field-assign-nonsend.rs:40:19
+ --> $DIR/drop-track-field-assign-nonsend.rs:37:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs
index b79d2af06..4887eff7e 100644
--- a/tests/ui/async-await/drop-track-field-assign.rs
+++ b/tests/ui/async-await/drop-track-field-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
index 7f7294295..9f80b9c6e 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs
@@ -1,4 +1,3 @@
-// compile-flags: -Zdrop-tracking
// incremental
// edition: 2021
@@ -99,8 +98,6 @@ 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/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
index aa9a22e9e..cfb0ebe38 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
@@ -1,26 +1,9 @@
error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
+ --> $DIR/drop-tracking-unresolved-typeck-results.rs:98: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
@@ -29,28 +12,11 @@ LL | | });
= note: ...but it actually implements `FnOnce<(&(),)>`
error: implementation of `FnOnce` is not general enough
- --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5
+ --> $DIR/drop-tracking-unresolved-typeck-results.rs:98: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
@@ -58,5 +24,5 @@ LL | | });
= 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
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/feature-self-return-type.rs b/tests/ui/async-await/feature-self-return-type.rs
index 41f887430..ae6f766d2 100644
--- a/tests/ui/async-await/feature-self-return-type.rs
+++ b/tests/ui/async-await/feature-self-return-type.rs
@@ -1,5 +1,4 @@
// 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.
diff --git a/tests/ui/async-await/feature-self-return-type.stderr b/tests/ui/async-await/feature-self-return-type.stderr
index 747c54b66..dc160bfbf 100644
--- a/tests/ui/async-await/feature-self-return-type.stderr
+++ b/tests/ui/async-await/feature-self-return-type.stderr
@@ -1,5 +1,5 @@
error[E0597]: `bar` does not live long enough
- --> $DIR/feature-self-return-type.rs:22:18
+ --> $DIR/feature-self-return-type.rs:21:18
|
LL | let x = {
| - borrow later stored here
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
deleted file mode 100644
index e2e64c9ae..000000000
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
- |
-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/field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
deleted file mode 100644
index e2e64c9ae..000000000
--- a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
- |
-LL | assert_send(agent.handle());
- | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
- |
-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/field-assign-nonsend.rs:40:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs
index 3e2228000..19315ef19 100644
--- a/tests/ui/async-await/field-assign-nonsend.rs
+++ b/tests/ui/async-await/field-assign-nonsend.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.stderr
index d1df8e91a..3037d7024 100644
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/field-assign-nonsend.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/field-assign-nonsend.rs:45:17
+ --> $DIR/field-assign-nonsend.rs:42:17
|
LL | assert_send(agent.handle());
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:39
+ --> $DIR/field-assign-nonsend.rs:20:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
@@ -14,7 +14,7 @@ LL | let mut info = self.info_result.clone();
LL | let _ = send_element(element).await;
| ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/field-assign-nonsend.rs:40:19
+ --> $DIR/field-assign-nonsend.rs:37:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/field-assign.rs b/tests/ui/async-await/field-assign.rs
index b79d2af06..4887eff7e 100644
--- a/tests/ui/async-await/field-assign.rs
+++ b/tests/ui/async-await/field-assign.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/future-contains-err-issue-115188.rs b/tests/ui/async-await/future-contains-err-issue-115188.rs
new file mode 100644
index 000000000..bf643c926
--- /dev/null
+++ b/tests/ui/async-await/future-contains-err-issue-115188.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+// Makes sure we don't spew a bunch of unrelated opaque errors when the reason
+// for this error is just a missing struct field in `foo`.
+
+async fn foo() {
+ let y = Wrapper { };
+ //~^ ERROR missing field `t` in initializer of `Wrapper<_>`
+}
+
+struct Wrapper<T> { t: T }
+
+fn is_send<T: Send>(_: T) {}
+
+fn main() {
+ is_send(foo());
+}
diff --git a/tests/ui/async-await/future-contains-err-issue-115188.stderr b/tests/ui/async-await/future-contains-err-issue-115188.stderr
new file mode 100644
index 000000000..8fd2550c1
--- /dev/null
+++ b/tests/ui/async-await/future-contains-err-issue-115188.stderr
@@ -0,0 +1,9 @@
+error[E0063]: missing field `t` in initializer of `Wrapper<_>`
+ --> $DIR/future-contains-err-issue-115188.rs:7:13
+ |
+LL | let y = Wrapper { };
+ | ^^^^^^^ missing `t`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0063`.
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index c0fbb0204..d63911b0d 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -1,11 +1,17 @@
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2]`: 3078 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2}`: 3078 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 3077 bytes
print-type-size local `.__awaitee`: 3077 bytes
print-type-size variant `Returned`: 0 bytes
print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]`: 3077 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 3077 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}`: 3077 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
@@ -30,13 +36,13 @@ print-type-size variant `Returned`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size variant `Panicked`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
-print-type-size field `.value`: 3077 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
-print-type-size variant `MaybeUninit`: 3077 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 1025 bytes
print-type-size field `.uninit`: 0 bytes
-print-type-size field `.value`: 3077 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}`: 1025 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
@@ -44,17 +50,6 @@ print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.arg`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
-print-type-size field `.value`: 1025 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
-print-type-size variant `MaybeUninit`: 1025 bytes
-print-type-size field `.uninit`: 0 bytes
-print-type-size field `.value`: 1025 bytes
-print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 0 bytes
-print-type-size variant `Returned`: 0 bytes
-print-type-size variant `Panicked`: 0 bytes
print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes
print-type-size field `.value`: 1 bytes
print-type-size type: `std::mem::MaybeUninit<bool>`: 1 bytes, alignment: 1 bytes
@@ -66,3 +61,8 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 0 bytes
print-type-size field `.0`: 0 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19}`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout
index b5e95ddd7..005460df6 100644
--- a/tests/ui/async-await/future-sizes/large-arg.stdout
+++ b/tests/ui/async-await/future-sizes/large-arg.stdout
@@ -1,55 +1,47 @@
-print-type-size type: `[async fn body@$DIR/large-arg.rs:6:21: 8:2]`: 3076 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:6:21: 8:2}`: 3076 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 3075 bytes
print-type-size local `.__awaitee`: 3075 bytes
print-type-size variant `Returned`: 0 bytes
print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:10:30: 12:2]`: 3075 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Suspend0`: 3074 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size local `.__awaitee`: 2050 bytes
-print-type-size variant `Returned`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Panicked`: 1024 bytes
-print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes
print-type-size field `.value`: 3075 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 3075 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 3075 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:13:26: 15:2]`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:10:30: 12:2}`: 3075 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size variant `Suspend0`: 2049 bytes
+print-type-size variant `Suspend0`: 3074 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size local `.__awaitee`: 1025 bytes
+print-type-size local `.__awaitee`: 2050 bytes
print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes
print-type-size field `.value`: 2050 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 2050 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 2050 bytes
-print-type-size type: `[async fn body@$DIR/large-arg.rs:16:26: 18:2]`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:13:26: 15:2}`: 2050 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Suspend0`: 2049 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size local `.__awaitee`: 1025 bytes
print-type-size variant `Returned`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
print-type-size variant `Panicked`: 1024 bytes
print-type-size upvar `.t`: 1024 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes
print-type-size field `.value`: 1025 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 1025 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 1025 bytes
@@ -58,3 +50,11 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 1024 bytes
print-type-size field `.0`: 1024 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/large-arg.rs:16:26: 18:2}`: 1025 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr
index 042766f19..d3e951cfe 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/generator-desc.stderr
@@ -7,8 +7,8 @@ LL | fun(async {}, async {});
| | the expected `async` block
| arguments to this function are incorrect
|
- = 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: 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
--> $DIR/generator-desc.rs:8:4
|
@@ -40,8 +40,8 @@ LL | fun((async || {})(), (async || {})());
| | 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: 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
|
diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr
index 1b81b461f..540501b98 100644
--- a/tests/ui/async-await/generator-not-future.stderr
+++ b/tests/ui/async-await/generator-not-future.stderr
@@ -26,11 +26,11 @@ note: required by a bound in `takes_generator`
LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+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]`
+ | --------------- ^^^^^^^^ 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
|
@@ -56,7 +56,7 @@ note: required by a bound in `takes_future`
LL | fn takes_future(_f: impl Future<Output = ()>) {}
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-error[E0277]: `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a 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| {
@@ -66,10 +66,10 @@ LL | takes_future(|ctx| {
LL | |
LL | | ctx = yield ();
LL | | });
- | |_____^ `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future
+ | |_____^ `{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
+ = 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
|
diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs
index 974f5aaff..3e2739a16 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -2,7 +2,6 @@
// edition: 2021
#![feature(async_fn_in_trait)]
-#![feature(impl_trait_projections)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
index 81e1e59a3..3505690f1 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
@@ -2,14 +2,14 @@
// edition: 2021
#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::future::Future;
use std::pin::Pin;
use std::task::Poll;
-trait MyTrait {
+pub trait MyTrait {
async fn foo(&self) -> i32;
}
@@ -27,8 +27,7 @@ impl Future for MyFuture {
}
impl MyTrait for i32 {
- // FIXME: this should eventually require `#[refine]` to compile, because it also provides
- // `Clone`.
+ #[expect(refining_impl_trait)]
fn foo(&self) -> impl Future<Output = i32> + Clone {
MyFuture(*self)
}
diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs
index fb92ec786..0a5023176 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -12,7 +12,7 @@ trait MyTrait {
}
impl MyTrait for i32 {
- fn foo(&self) -> impl Future<Output = i32> + '_ {
+ fn foo(&self) -> impl Future<Output = i32> {
async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
new file mode 100644
index 000000000..bba886f17
--- /dev/null
+++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
@@ -0,0 +1,7 @@
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+
+pub trait Foo {
+ async fn test();
+}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
new file mode 100644
index 000000000..2fe6b473d
--- /dev/null
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
@@ -0,0 +1,38 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR cycle detected when computing layout of
+
+#![feature(async_fn_in_trait)]
+
+fn main() {
+ let _ = async {
+ A.first().await.second().await;
+ };
+}
+
+pub trait First {
+ type Second: Second;
+ async fn first(self) -> Self::Second;
+}
+
+struct A;
+
+impl First for A {
+ type Second = A;
+ async fn first(self) -> Self::Second {
+ A
+ }
+}
+
+pub trait Second {
+ async fn second(self);
+}
+
+impl<C> Second for C
+where
+ C: First,
+{
+ async fn second(self) {
+ self.first().await.second().await;
+ }
+}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
new file mode 100644
index 000000000..41e84466a
--- /dev/null
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
@@ -0,0 +1,10 @@
+error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
+ |
+ = note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`...
+ = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle
+ = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:8:13: 10:6}`
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr
index 18185b755..7e59d94d4 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -15,6 +15,11 @@ note: required by a bound in `assert_is_send`
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::bar`
+ |
+LL - async fn bar();
+LL + fn bar() -> impl std::future::Future<Output = ()> + Send;
+ |
error: aborting due to previous error
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
new file mode 100644
index 000000000..33c005874
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+// edition: 2021
+
+#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
+#![allow(unused)]
+
+trait Foo {
+ fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
+ fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
+}
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+ needs_send(T::test2());
+ //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
new file mode 100644
index 000000000..96b623d69
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+// edition: 2021
+
+#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
+#![allow(unused)]
+
+trait Foo {
+ async fn test() -> () {}
+ async fn test2() -> i32 { 1 + 2 }
+}
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+ needs_send(T::test2());
+ //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
new file mode 100644
index 000000000..4319a1411
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
@@ -0,0 +1,43 @@
+error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
+ --> $DIR/send-on-async-fn-in-trait.rs:14:16
+ |
+LL | needs_send(T::test());
+ | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test`
+ |
+LL - async fn test() -> () {}
+LL + fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
+ |
+
+error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely
+ --> $DIR/send-on-async-fn-in-trait.rs:16:16
+ |
+LL | needs_send(T::test2());
+ | ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = i32>`
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test2`
+ |
+LL - async fn test2() -> i32 { 1 + 2 }
+LL + fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } }
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
new file mode 100644
index 000000000..83b69d72a
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
@@ -0,0 +1,15 @@
+// aux-build:foreign-async-fn.rs
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+
+extern crate foreign_async_fn;
+use foreign_async_fn::Foo;
+
+fn bar<T: Foo>() {
+ fn needs_send(_: impl Send) {}
+ needs_send(T::test());
+ //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
new file mode 100644
index 000000000..f337a04ba
--- /dev/null
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16
+ |
+LL | needs_send(T::test());
+ | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
+note: `<T as Foo>::test` is an `async fn` in trait, which does not automatically imply that its future is `Send`
+ --> $DIR/auxiliary/foreign-async-fn.rs:6:5
+ |
+LL | async fn test();
+ | ^^^^^^^^^^^^^^^^
+note: required by a bound in `needs_send`
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27
+ |
+LL | fn needs_send(_: impl Send) {}
+ | ^^^^ required by this bound in `needs_send`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-61949-self-return-type.rs b/tests/ui/async-await/issue-61949-self-return-type.rs
deleted file mode 100644
index d73dbc6e8..000000000
--- a/tests/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/tests/ui/async-await/issue-61949-self-return-type.stderr b/tests/ui/async-await/issue-61949-self-return-type.stderr
deleted file mode 100644
index ac85ed288..000000000
--- a/tests/ui/async-await/issue-61949-self-return-type.stderr
+++ /dev/null
@@ -1,26 +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 <https://github.com/rust-lang/rust/issues/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;
- | --- binding `bar` declared here
-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/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
deleted file mode 100644
index 56aa035f4..000000000
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
- |
-LL | is_sync(bar());
- | ^^^^^ future returned by `bar` is not `Sync`
- |
- = help: within `impl Future<Output = ()>`, 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:18:11
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Sync`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | drop(x);
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
- |
-LL | fn is_sync<T: Sync>(t: T) { }
- | ^^^^ required by this bound in `is_sync`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
deleted file mode 100644
index 56aa035f4..000000000
--- a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
- |
-LL | is_sync(bar());
- | ^^^^^ future returned by `bar` is not `Sync`
- |
- = help: within `impl Future<Output = ()>`, 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:18:11
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Sync`
-LL | baz().await;
- | ^^^^^ await occurs here, with `x` maybe used later
-LL | drop(x);
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
- |
-LL | fn is_sync<T: Sync>(t: T) { }
- | ^^^^ required by this bound in `is_sync`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs
index 44646e0e5..7769085a0 100644
--- a/tests/ui/async-await/issue-64130-1-sync.rs
+++ b/tests/ui/async-await/issue-64130-1-sync.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr
index ea1bfb9f9..207e085d2 100644
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.stderr
@@ -1,19 +1,19 @@
error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:25:13
+ --> $DIR/issue-64130-1-sync.rs:22:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, 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:18:11
+ --> $DIR/issue-64130-1-sync.rs:15:11
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
+ --> $DIR/issue-64130-1-sync.rs:11:15
|
LL | fn is_sync<T: Sync>(t: T) { }
| ^^^^ required by this bound in `is_sync`
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
deleted file mode 100644
index d1717ad33..000000000
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
- |
-LL | is_send(bar());
- | ^^^^^ future returned by `bar` is not `Send`
- |
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<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:14:15
- |
-LL | fn is_send<T: Send>(t: T) { }
- | ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
deleted file mode 100644
index d1717ad33..000000000
--- a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
- |
-LL | is_send(bar());
- | ^^^^^ future returned by `bar` is not `Send`
- |
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<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:14:15
- |
-LL | fn is_send<T: Send>(t: T) { }
- | ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs
index d6d855bac..0195afe6b 100644
--- a/tests/ui/async-await/issue-64130-2-send.rs
+++ b/tests/ui/async-await/issue-64130-2-send.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
@@ -14,8 +11,9 @@ impl !Send for Foo {}
fn is_send<T: Send>(t: T) { }
async fn bar() {
- let x = Box::new(Foo);
+ let x = Foo;
baz().await;
+ drop(x);
}
async fn baz() { }
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.stderr
index 45e43525a..a433c76ae 100644
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.stderr
@@ -1,26 +1,22 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
+ --> $DIR/issue-64130-2-send.rs:22:13
|
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
- = note: the trait bound `Unique<Foo>: Send` is not satisfied
+ = help: within `impl Future<Output = ()>`, 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:18:11
+ --> $DIR/issue-64130-2-send.rs:15:11
|
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which is not `Send`
+LL | let x = Foo;
+ | - has type `Foo` which is not `Send`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:14:15
+ --> $DIR/issue-64130-2-send.rs:11:15
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
-help: consider borrowing here
- |
-LL | is_send(&bar());
- | +
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
deleted file mode 100644
index b69f06da1..000000000
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
- |
-LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_qux(bar());
- | ^^^^^ within `impl Future<Output = ()>`, 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:21:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<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:17:14
- |
-LL | fn is_qux<T: 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/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
deleted file mode 100644
index b69f06da1..000000000
--- a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
- |
-LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_qux(bar());
- | ^^^^^ within `impl Future<Output = ()>`, 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:21:11
- |
-LL | let x = Box::new(Foo);
- | - has type `Box<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:17:14
- |
-LL | fn is_qux<T: 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/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs
index 92d3b7c81..074d67aa3 100644
--- a/tests/ui/async-await/issue-64130-3-other.rs
+++ b/tests/ui/async-await/issue-64130-3-other.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(auto_traits)]
#![feature(negative_impls)]
// edition:2018
@@ -17,8 +14,9 @@ impl !Qux for Foo {}
fn is_qux<T: Qux>(t: T) {}
async fn bar() {
- let x = Box::new(Foo);
+ let x = Foo;
baz().await;
+ drop(x);
}
async fn baz() {}
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 129837124..573da1034 100644
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
+ --> $DIR/issue-64130-3-other.rs:25:12
|
LL | async fn bar() {
| - within this `impl Future<Output = ()>`
@@ -8,14 +8,14 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, 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:21:11
+ --> $DIR/issue-64130-3-other.rs:18:11
|
-LL | let x = Box::new(Foo);
- | - has type `Box<Foo>` which does not implement `Qux`
+LL | let x = Foo;
+ | - has type `Foo` which does not implement `Qux`
LL | baz().await;
| ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:17:14
+ --> $DIR/issue-64130-3-other.rs:14:14
|
LL | fn is_qux<T: Qux>(t: T) {}
| ^^^ required by this bound in `is_qux`
diff --git a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
deleted file mode 100644
index 884619f4d..000000000
--- a/tests/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:20: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:27: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:25:15
- |
-LL | match client.status() {
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
deleted file mode 100644
index 60b7551ff..000000000
--- a/tests/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:21: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:27:23
- |
-LL | match client.status() {
- | ------ has type `&Client` which is not `Send`
-LL | 200 => {
-LL | 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:25:15
- |
-LL | match client.status() {
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-4-async-move.rs b/tests/ui/async-await/issue-64130-4-async-move.rs
index 5d68a808b..359813f63 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.rs
+++ b/tests/ui/async-await/issue-64130-4-async-move.rs
@@ -1,9 +1,5 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking_mir] check-pass
-// [drop_tracking] check-pass
+// check-pass
use std::any::Any;
use std::future::Future;
@@ -19,7 +15,6 @@ impl Client {
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() {
diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
index e044e2ca0..cb02fcf5c 100644
--- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
+++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
@@ -12,8 +12,6 @@ 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
|
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
deleted file mode 100644
index fa2229865..000000000
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:11
- |
-LL | spawn(async {
- | ___________^
-LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
-LL | | AFuture.await;
-LL | | drop(a);
-LL | | });
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25: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:23:17
- |
-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 | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
- |
-LL | fn spawn<T: Send>(_: T) {}
- | ^^^^ required by this bound in `spawn`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
deleted file mode 100644
index fa2229865..000000000
--- a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:11
- |
-LL | spawn(async {
- | ___________^
-LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
-LL | | AFuture.await;
-LL | | drop(a);
-LL | | });
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25: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:23:17
- |
-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 | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
- |
-LL | fn spawn<T: Send>(_: T) {}
- | ^^^^ required by this bound in `spawn`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs
index bb9ad77ce..60717d993 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.rs
+++ b/tests/ui/async-await/issue-67252-unnamed-future.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
use std::pin::Pin;
@@ -21,7 +18,7 @@ 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;
- drop(a);
+ let _a = a;
});
}
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr
index 8cf7bb8d9..069befa91 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-67252-unnamed-future.stderr
@@ -1,19 +1,19 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:21:5
+ --> $DIR/issue-67252-unnamed-future.rs:18:5
|
LL | spawn(async {
| ^^^^^ future created by async block is not `Send`
|
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
+ = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22: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:23:17
+ --> $DIR/issue-67252-unnamed-future.rs:20:17
|
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
note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:9:13
+ --> $DIR/issue-67252-unnamed-future.rs:6:13
|
LL | fn spawn<T: Send>(_: T) {}
| ^^^^ required by this bound in `spawn`
diff --git a/tests/ui/async-await/issue-68112.drop_tracking.stderr b/tests/ui/async-await/issue-68112.drop_tracking.stderr
deleted file mode 100644
index bd648de30..000000000
--- a/tests/ui/async-await/issue-68112.drop_tracking.stderr
+++ /dev/null
@@ -1,82 +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<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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<Output = Arc<RefCell<i32>>>`, 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<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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<Output = Arc<RefCell<i32>>>`, 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<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:18
- |
-LL | require_send(send_fut);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` 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) -> T {
- | _______________________________^
-LL | | t
-LL | | }
- | |_^
-note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
- |
-LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>`
-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/tests/ui/async-await/issue-68112.no_drop_tracking.stderr b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
deleted file mode 100644
index 35b7341f6..000000000
--- a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
+++ /dev/null
@@ -1,82 +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<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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<Output = Arc<RefCell<i32>>>`, 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<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-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<Output = Arc<RefCell<i32>>>`, 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<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:18
- |
-LL | require_send(send_fut);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` 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) -> T {
- | _______________________________^
-LL | | t
-LL | | }
- | |_^
-note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
- |
-LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>`
-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/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs
index 19119ae0f..fd6089e0c 100644
--- a/tests/ui/async-await/issue-68112.rs
+++ b/tests/ui/async-await/issue-68112.rs
@@ -1,7 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::{
cell::RefCell,
diff --git a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr b/tests/ui/async-await/issue-68112.stderr
index 7a9242cba..17b619ebe 100644
--- a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-68112.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:37:5
+ --> $DIR/issue-68112.rs:34:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ future created by async block is not `Send`
@@ -7,18 +7,18 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:34:17
+ --> $DIR/issue-68112.rs:31:17
|
LL | let _ = non_send_fut.await;
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11: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:5
+ --> $DIR/issue-68112.rs:43:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ future created by async block is not `Send`
@@ -26,18 +26,18 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:43:17
+ --> $DIR/issue-68112.rs:40:17
|
LL | let _ = make_non_send_future1().await;
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:65:5
+ --> $DIR/issue-68112.rs:62:5
|
LL | require_send(send_fut);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -46,7 +46,7 @@ LL | require_send(send_fut);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this `async fn` body
- --> $DIR/issue-68112.rs:50:31
+ --> $DIR/issue-68112.rs:47:31
|
LL | async fn ready2<T>(t: T) -> T {
| _______________________________^
@@ -54,13 +54,13 @@ LL | | t
LL | | }
| |_^
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:53:31
+ --> $DIR/issue-68112.rs:50:31
|
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>`
note: required because it's used within this `async` block
- --> $DIR/issue-68112.rs:60:20
+ --> $DIR/issue-68112.rs:57:20
|
LL | let send_fut = async {
| ____________________^
@@ -70,7 +70,7 @@ LL | | ready(0).await;
LL | | };
| |_____^
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:14:25
+ --> $DIR/issue-68112.rs:11:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/async-await/issue-68523-start.rs b/tests/ui/async-await/issue-68523-start.rs
index 2ced88a16..5adc28b20 100644
--- a/tests/ui/async-await/issue-68523-start.rs
+++ b/tests/ui/async-await/issue-68523-start.rs
@@ -4,6 +4,6 @@
#[start]
pub async fn start(_: isize, _: *const *const u8) -> isize {
-//~^ ERROR `start` is not allowed to be `async`
+//~^ ERROR `#[start]` function is not allowed to be `async`
0
}
diff --git a/tests/ui/async-await/issue-68523-start.stderr b/tests/ui/async-await/issue-68523-start.stderr
index 3a0a3b5de..7c06fe340 100644
--- a/tests/ui/async-await/issue-68523-start.stderr
+++ b/tests/ui/async-await/issue-68523-start.stderr
@@ -1,8 +1,8 @@
-error[E0752]: `start` is not allowed to be `async`
+error[E0752]: `#[start]` function 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`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[start]` is not allowed to be `async`
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr
deleted file mode 100644
index ab0698c3e..000000000
--- a/tests/ui/async-await/issue-70818.drop_tracking.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
- |
-LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
-note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
- |
-LL | async { (ty, ty1) }
- | ^^^ has type `U` which is not `Send`
-help: consider restricting type parameter `U`
- |
-LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
deleted file mode 100644
index ab0698c3e..000000000
--- a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
- |
-LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
-note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
- |
-LL | async { (ty, ty1) }
- | ^^^ has type `U` which is not `Send`
-help: consider restricting type parameter `U`
- |
-LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs
index 2941de0f5..019c56eb2 100644
--- a/tests/ui/async-await/issue-70818.rs
+++ b/tests/ui/async-await/issue-70818.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.stderr
index ab0698c3e..20109d4d1 100644
--- a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-70818.stderr
@@ -1,11 +1,11 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
+ --> $DIR/issue-70818.rs:4:38
|
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
+ --> $DIR/issue-70818.rs:6:18
|
LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
deleted file mode 100644
index f80bb4242..000000000
--- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0277]: `*mut ()` cannot be shared between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
- |
-LL | fn foo(x: NotSync) -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
- |
- = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
-note: required because it appears within the type `PhantomData<*mut ()>`
- --> $SRC_DIR/core/src/marker.rs:LL:COL
-note: required because it appears within the type `NotSync`
- --> $DIR/issue-70935-complex-spans.rs:12:8
- |
-LL | struct NotSync(PhantomData<*mut ()>);
- | ^^^^^^^
- = note: required for `&NotSync` to implement `Send`
-note: required because it's used within this closure
- --> $DIR/issue-70935-complex-spans.rs:22:13
- |
-LL | baz(|| async {
- | ^^
-note: required because it's used within this `async fn` body
- --> $DIR/issue-70935-complex-spans.rs:15:67
- |
-LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
- | ___________________________________________________________________^
-LL | | }
- | |_^
- = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()`
-note: required because it's used within this `async` block
- --> $DIR/issue-70935-complex-spans.rs:21:5
- |
-LL | / async move {
-LL | | baz(|| async {
-LL | | foo(x.clone());
-LL | | }).await;
-LL | | }
- | |_____^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
deleted file mode 100644
index d8ef6a5ee..000000000
--- a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
- |
-LL | fn foo(x: NotSync) -> impl Future + Send {
- | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
- = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-70935-complex-spans.rs:24:12
- |
-LL | baz(|| async {
- | _____________-
-LL | | foo(x.clone());
-LL | | }).await;
- | | - ^^^^^- the value is later dropped here
- | | | |
- | |_________| await occurs here, with the value maybe used later
- | has type `[closure@$DIR/issue-70935-complex-spans.rs:22:13: 22:15]` which is not `Send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs
index 9ebde1d39..4af737395 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.rs
+++ b/tests/ui/async-await/issue-70935-complex-spans.rs
@@ -1,7 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics.
@@ -16,8 +13,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
}
fn foo(x: NotSync) -> impl Future + Send {
- //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
- //[drop_tracking,drop_tracking_mir]~^^ ERROR `*mut ()` cannot be shared between threads
+ //~^ ERROR `*mut ()` cannot be shared between threads safely
async move {
baz(|| async {
foo(x.clone());
diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr
index eb9d93e22..ab834daa8 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.stderr
@@ -1,5 +1,5 @@
error[E0277]: `*mut ()` cannot be shared between threads safely
- --> $DIR/issue-70935-complex-spans.rs:18:23
+ --> $DIR/issue-70935-complex-spans.rs:15:23
|
LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
@@ -8,18 +8,18 @@ LL | fn foo(x: NotSync) -> impl Future + Send {
note: required because it appears within the type `PhantomData<*mut ()>`
--> $SRC_DIR/core/src/marker.rs:LL:COL
note: required because it appears within the type `NotSync`
- --> $DIR/issue-70935-complex-spans.rs:12:8
+ --> $DIR/issue-70935-complex-spans.rs:9:8
|
LL | struct NotSync(PhantomData<*mut ()>);
| ^^^^^^^
= note: required for `&NotSync` to implement `Send`
note: required because it's used within this closure
- --> $DIR/issue-70935-complex-spans.rs:22:13
+ --> $DIR/issue-70935-complex-spans.rs:18:13
|
LL | baz(|| async {
| ^^
note: required because it's used within this `async fn` body
- --> $DIR/issue-70935-complex-spans.rs:15:67
+ --> $DIR/issue-70935-complex-spans.rs:12:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^
@@ -27,7 +27,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = ()>`
note: required because it's used within this `async` block
- --> $DIR/issue-70935-complex-spans.rs:21:5
+ --> $DIR/issue-70935-complex-spans.rs:17:5
|
LL | / async move {
LL | | baz(|| async {
diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr
index a344246d6..443af010c 100644
--- a/tests/ui/async-await/issue-71137.stderr
+++ b/tests/ui/async-await/issue-71137.stderr
@@ -12,9 +12,6 @@ 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
|
diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs
index dcbe7765a..c43ce2cad 100644
--- a/tests/ui/async-await/issue-73137.rs
+++ b/tests/ui/async-await/issue-73137.rs
@@ -2,9 +2,6 @@
// 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;
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.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:11: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/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:11: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/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr
deleted file mode 100644
index 6d19c3beb..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_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:11: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/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
deleted file mode 100644
index 1fa8d6914..000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-//
-// 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/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
deleted file mode 100644
index adb7b9bf4..000000000
--- a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20: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:22:29
- |
-LL | let x = x;
- | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
-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/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
deleted file mode 100644
index adb7b9bf4..000000000
--- a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20: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:22:29
- |
-LL | let x = x;
- | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
-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/tests/ui/async-await/issue-86507.rs b/tests/ui/async-await/issue-86507.rs
index 63c298dbe..317f03176 100644
--- a/tests/ui/async-await/issue-86507.rs
+++ b/tests/ui/async-await/issue-86507.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use ::core::pin::Pin;
diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.stderr
index adb7b9bf4..d5a3f72cf 100644
--- a/tests/ui/async-await/issue-86507.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-86507.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:20:13
+ --> $DIR/issue-86507.rs:17:13
|
LL | / Box::pin(
LL | | async move {
@@ -9,11 +9,11 @@ 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:22:29
+ --> $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 `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
+ = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 20:18}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
help: consider further restricting this bound
|
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/issue-93197.rs b/tests/ui/async-await/issue-93197.rs
index c627fe17a..05ec013d0 100644
--- a/tests/ui/async-await/issue-93197.rs
+++ b/tests/ui/async-await/issue-93197.rs
@@ -1,7 +1,6 @@
// Regression test for #93197
// check-pass
// edition:2021
-// compile-flags: -Zdrop-tracking
#![feature(try_blocks)]
diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs
index ec2249ca5..b27a79a42 100644
--- a/tests/ui/async-await/issue-93648.rs
+++ b/tests/ui/async-await/issue-93648.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// build-pass
diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
index d53944698..efde4d286 100644
--- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs
+++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
@@ -1,13 +1,12 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::sync::{Arc, Mutex};
+fn make_arc() -> Arc<Mutex<()>> { unimplemented!() }
+
pub async fn f(_: ()) {}
pub async fn run() {
- let x: Arc<Mutex<()>> = unimplemented!();
+ let x: Arc<Mutex<()>> = make_arc();
f(*x.lock().unwrap()).await;
}
diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs
index 85fce8740..81ae9553c 100644
--- a/tests/ui/async-await/issues/issue-107280.rs
+++ b/tests/ui/async-await/issues/issue-107280.rs
@@ -3,11 +3,6 @@
async fn foo() {
inner::<false>().await
//~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied
- //~| 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
- //~| ERROR: type inside `async fn` body must be known in this context
- //~| ERROR: type inside `async fn` body must be known in this context
}
async fn inner<T, const PING: bool>() {}
diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr
index 2e69862a0..c5fd5c5bf 100644
--- a/tests/ui/async-await/issues/issue-107280.stderr
+++ b/tests/ui/async-await/issues/issue-107280.stderr
@@ -7,7 +7,7 @@ LL | inner::<false>().await
| expected 2 generic arguments
|
note: function defined here, with 2 generic parameters: `T`, `PING`
- --> $DIR/issue-107280.rs:13:10
+ --> $DIR/issue-107280.rs:8:10
|
LL | async fn inner<T, const PING: bool>() {}
| ^^^^^ - ----------------
@@ -16,67 +16,6 @@ help: add missing generic argument
LL | inner::<false, PING>().await
| ++++++
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/issue-107280.rs:4:5
- |
-LL | inner::<false>().await
- | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:22
- |
-LL | inner::<false>().await
- | ^^^^^
-
-error: aborting due to 6 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0107, E0698.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr
index 53d0577a1..bb617d090 100644
--- a/tests/ui/async-await/issues/issue-62009-1.stderr
+++ b/tests/ui/async-await/issues/issue-62009-1.stderr
@@ -24,18 +24,18 @@ LL | fn main() {
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
+error[E0277]: `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future
--> $DIR/issue-62009-1.rs:12:16
|
LL | (|_| 2333).await;
| -^^^^^
| ||
- | |`[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
+ | |`{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`
+ = 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
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
deleted file mode 100644
index 53d326202..000000000
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-65436-raw-ptr-not-send.rs:17: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:17:17: 20: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:19:36
- |
-LL | bar(Foo(std::ptr::null())).await;
- | ---------------- ^^^^^- `std::ptr::null()` is later dropped here
- | | |
- | | await occurs here, with `std::ptr::null()` maybe used later
- | has type `*const u8` which is not `Send`
-help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
- |
-LL | bar(Foo(std::ptr::null())).await;
- | ^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `assert_send`
- --> $DIR/issue-65436-raw-ptr-not-send.rs:14:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
index d7ef92951..ef6f105f3 100644
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
+++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
@@ -1,9 +1,5 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] check-pass
-// [drop_tracking_mir] check-pass
+// check-pass
struct Foo(*const u8);
@@ -15,7 +11,6 @@ fn assert_send<T: 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/tests/ui/async-await/issues/issue-66695-static-refs.rs b/tests/ui/async-await/issues/issue-66695-static-refs.rs
index f0609713b..1b0e1c6c9 100644
--- a/tests/ui/async-await/issues/issue-66695-static-refs.rs
+++ b/tests/ui/async-await/issues/issue-66695-static-refs.rs
@@ -1,12 +1,15 @@
// build-pass
// edition:2018
+#![feature(if_let_guard)]
+
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 => (),
+ i if let Some(1) = async { Some(1) }.await => (),
_ => (),
}
}
@@ -18,6 +21,7 @@ fn main() {
async {
match A {
i if async { true }.await => (),
+ i if let Some(2) = async { Some(2) }.await => (),
_ => (),
}
};
diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
index c4f8f607d..caed76269 100644
--- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
+++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
@@ -1,9 +1,7 @@
// build-pass
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+#![feature(if_let_guard)]
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
@@ -14,6 +12,7 @@ async fn fun() {
unsafe {
match A {
i if async { true }.await => (),
+ i if let Some(1) = async { Some(1) }.await => (),
_ => (),
}
}
@@ -27,6 +26,7 @@ fn main() {
unsafe {
match A {
i if async { true }.await => (),
+ i if let Some(2) = async { Some(2) }.await => (),
_ => (),
}
}
diff --git a/tests/ui/async-await/issues/issue-67893.rs b/tests/ui/async-await/issues/issue-67893.rs
index d73772e5f..359c75f17 100644
--- a/tests/ui/async-await/issues/issue-67893.rs
+++ b/tests/ui/async-await/issues/issue-67893.rs
@@ -7,5 +7,5 @@ fn g(_: impl Send) {}
fn main() {
g(issue_67893::run())
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR `MutexGuard<'_, ()>` cannot be sent between threads safely
}
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index c941b9eeb..f36269e8f 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -1,18 +1,27 @@
-error: future cannot be sent between threads safely
+error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely
--> $DIR/issue-67893.rs:9:7
|
LL | g(issue_67893::run())
- | ^^^^^^^^^^^^^^^^^^ future is not `Send`
+ | - ^^^^^^^^^^^^^^^^^^ `MutexGuard<'_, ()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ ::: $DIR/auxiliary/issue_67893.rs:9:20
+ |
+LL | pub async fn run() {
+ | - within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, 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:12:27
+ = note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`
+note: required because it's used within this `async fn` body
+ --> $DIR/auxiliary/issue_67893.rs:9:20
|
-LL | f(*x.lock().unwrap()).await;
- | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here
- | | |
- | | await occurs here, with `x.lock().unwrap()` maybe used later
- | has type `MutexGuard<'_, ()>` which is not `Send`
+LL | pub async fn run() {
+ | ____________________^
+LL | | let x: Arc<Mutex<()>> = make_arc();
+LL | | f(*x.lock().unwrap()).await;
+LL | | }
+ | |_^
note: required by a bound in `g`
--> $DIR/issue-67893.rs:6:14
|
@@ -21,3 +30,4 @@ LL | fn g(_: impl Send) {}
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issues/issue-78600.rs b/tests/ui/async-await/issues/issue-78600.rs
index 8aaeaecf3..4303fc795 100644
--- a/tests/ui/async-await/issues/issue-78600.rs
+++ b/tests/ui/async-await/issues/issue-78600.rs
@@ -1,10 +1,10 @@
+// check-pass
// edition:2018
struct S<'a>(&'a i32);
impl<'a> S<'a> {
async fn new(i: &'a i32) -> Result<Self, ()> {
- //~^ ERROR: `async fn`
Ok(S(&22))
}
}
diff --git a/tests/ui/async-await/issues/issue-78600.stderr b/tests/ui/async-await/issues/issue-78600.stderr
deleted file mode 100644
index 37eafa996..000000000
--- a/tests/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<Self, ()> {
- | ^^^^^^^----^^^^^
- | |
- | help: consider spelling out the type instead: `S<'a>`
- |
- = note: see issue #103532 <https://github.com/rust-lang/rust/issues/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/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs
index 0ab4f5ade..bb14eb74b 100644
--- a/tests/ui/async-await/missed-capture-issue-107414.rs
+++ b/tests/ui/async-await/missed-capture-issue-107414.rs
@@ -1,6 +1,8 @@
// check-pass
// edition:2018
+#![feature(if_let_guard)]
+
fn main() {}
struct StructA {}
@@ -22,3 +24,10 @@ async fn ice() {
_ => {}
}
}
+
+async fn if_let() {
+ match Some(StructB {}) {
+ Some(struct_b) if let true = get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
deleted file mode 100644
index 8a7317bb9..000000000
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9: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:13: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/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
deleted file mode 100644
index 8a7317bb9..000000000
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9: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:13: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/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
index a241f30e7..bb2a61f03 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index 8a7317bb9..f789ad2a0 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
|
LL | async fn rec_1() {
| ^ recursive `async fn`
@@ -8,7 +8,7 @@ LL | async fn rec_1() {
= 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:13:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
LL | async fn rec_2() {
| ^ recursive `async fn`
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index 258da0756..3fed7c972 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr
deleted file mode 100644
index 17b4ef7bd..000000000
--- a/tests/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<Output = ()>`
- |
- = help: within `impl Future<Output = ()>`, 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<Output = ()>`
-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: 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/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs
index 7d097e72f..75acb442e 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.rs
+++ b/tests/ui/async-await/partial-drop-partial-reinit.rs
@@ -1,7 +1,4 @@
// 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)]
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr
index 34d8a159f..85e1830c7 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr
+++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr
@@ -1,5 +1,5 @@
error[E0277]: `NotSend` cannot be sent between threads safely
- --> $DIR/partial-drop-partial-reinit.rs:9:16
+ --> $DIR/partial-drop-partial-reinit.rs:6:16
|
LL | gimme_send(foo());
| ---------- ^^^^^ `NotSend` cannot be sent between threads safely
@@ -11,9 +11,9 @@ LL | async fn foo() {
|
= help: within `impl Future<Output = ()>`, 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<Output = ()>`, `()`
+ = note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>`
note: required because it's used within this `async fn` body
- --> $DIR/partial-drop-partial-reinit.rs:31:16
+ --> $DIR/partial-drop-partial-reinit.rs:28:16
|
LL | async fn foo() {
| ________________^
@@ -25,7 +25,7 @@ LL | | bar().await;
LL | | }
| |_^
note: required by a bound in `gimme_send`
- --> $DIR/partial-drop-partial-reinit.rs:17:18
+ --> $DIR/partial-drop-partial-reinit.rs:14:18
|
LL | fn gimme_send<T: Send>(t: T) {
| ^^^^ required by this bound in `gimme_send`
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
deleted file mode 100644
index 7e63a8da5..000000000
--- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8: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/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
deleted file mode 100644
index 7e63a8da5..000000000
--- a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8: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/tests/ui/async-await/recursive-async-impl-trait-type.rs b/tests/ui/async-await/recursive-async-impl-trait-type.rs
index 60b34d3a1..edc4cb8ac 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 7e63a8da5..63f64f445 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8:40
+ --> $DIR/recursive-async-impl-trait-type.rs:5:40
|
LL | async fn recursive_async_function() -> () {
| ^^ recursive `async fn`
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
index 1b847b59e..77385e966 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
index 1b847b59e..77385e966 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:17:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:37:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
index 33e22dec3..969094a2c 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
@@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)]
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:15:5
|
LL | / spawn(async move {
@@ -16,11 +16,17 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:35:17
+ |
+LL | F: Future + Send + 'static,
+ | ^^^^
-error: higher-ranked lifetime error
+error[E0308]: mismatched types
--> $DIR/issue-110963-early.rs:15:5
|
LL | / spawn(async move {
@@ -29,9 +35,16 @@ LL | | if !hc.check().await {
LL | | log_health_check_failure().await;
LL | | }
LL | | });
- | |______^
+ | |______^ one type is more general than the other
+ |
+ = note: expected trait `Send`
+ found trait `for<'a> Send`
+note: the lifetime requirement is introduced here
+ --> $DIR/issue-110963-early.rs:35:17
|
- = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+LL | F: Future + Send + 'static,
+ | ^^^^
error: aborting due to 2 previous errors; 1 warning emitted
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
new file mode 100644
index 000000000..8f4590203
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
@@ -0,0 +1,35 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ |
+LL | build(Bar);
+ | ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ |
+LL | build(Bar);
+ | ------^^^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
+note: required by a bound in `build`
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39
+ |
+LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
+ | ^^^^ required by this bound in `build`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
new file mode 100644
index 000000000..6fab71787
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
new file mode 100644
index 000000000..b2cd9707d
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
@@ -0,0 +1,24 @@
+// revisions: current next
+//[current] known-bug: #109924
+//[next] check-pass
+//[next] compile-flags: -Ztrait-solver=next
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+#![feature(return_type_notation)]
+//[next]~^ WARN the feature `return_type_notation` is incomplete
+
+trait Foo {
+ async fn bar(&self);
+}
+
+struct Bar;
+impl Foo for Bar {
+ async fn bar(&self) {}
+}
+
+fn build<T>(_: T) where T: Foo<bar(): Send> {}
+
+fn main() {
+ build(Bar);
+}
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
deleted file mode 100644
index 6b4a3a363..000000000
--- a/tests/ui/async-await/unresolved_type_param.drop_tracking.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:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
deleted file mode 100644
index 6642e90ac..000000000
--- a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
+++ /dev/null
@@ -1,63 +0,0 @@
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:12: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:12:11
- |
-LL | bar().await;
- | ^^^^^
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs
index ca0a92b94..dd5aa0dd0 100644
--- a/tests/ui/async-await/unresolved_type_param.rs
+++ b/tests/ui/async-await/unresolved_type_param.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// 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)
@@ -10,27 +7,6 @@ async fn bar<T>() -> () {}
async fn foo() {
bar().await;
- //[drop_tracking_mir]~^ ERROR type annotations needed
- //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T`
- //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context
- //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
- //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
- //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
- //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //~^ ERROR type annotations needed
}
fn main() {}
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr b/tests/ui/async-await/unresolved_type_param.stderr
index 95c799468..45aa76606 100644
--- a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/unresolved_type_param.stderr
@@ -1,5 +1,5 @@
error[E0282]: type annotations needed
- --> $DIR/unresolved_type_param.rs:12:5
+ --> $DIR/unresolved_type_param.rs:9:5
|
LL | bar().await;
| ^^^ cannot infer type of the type parameter `T` declared on the function `bar`
diff --git a/tests/ui/async-await/unsized-across-await.rs b/tests/ui/async-await/unsized-across-await.rs
new file mode 100644
index 000000000..32cb4f88e
--- /dev/null
+++ b/tests/ui/async-await/unsized-across-await.rs
@@ -0,0 +1,16 @@
+// edition: 2021
+
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+async fn f() {}
+
+async fn g(x: Box<dyn std::fmt::Display>) {
+ let _x = *x;
+ //~^ ERROR the size for values of type `dyn std::fmt::Display` cannot be known at compilation time
+ f().await;
+}
+
+fn main() {
+ let _a = g(Box::new(5));
+}
diff --git a/tests/ui/async-await/unsized-across-await.stderr b/tests/ui/async-await/unsized-across-await.stderr
new file mode 100644
index 000000000..649b12ce5
--- /dev/null
+++ b/tests/ui/async-await/unsized-across-await.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-across-await.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `dyn std::fmt::Display` cannot be known at compilation time
+ --> $DIR/unsized-across-await.rs:9:9
+ |
+LL | let _x = *x;
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `dyn std::fmt::Display`
+ = note: all values live across `await` must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/attributes/issue-115264-expr-field.rs b/tests/ui/attributes/issue-115264-expr-field.rs
new file mode 100644
index 000000000..f53ac4aee
--- /dev/null
+++ b/tests/ui/attributes/issue-115264-expr-field.rs
@@ -0,0 +1,17 @@
+// Regression test for issue 115264
+// Tests that retrieving the ident of the X::foo field
+// in main() does not cause an ICE
+
+// check-pass
+
+#[allow(dead_code)]
+struct X {
+ foo: i32,
+}
+
+fn main() {
+ let _ = X {
+ #[doc(alias = "StructItem")]
+ foo: 123,
+ };
+}
diff --git a/tests/ui/attributes/issue-115264-pat-field.rs b/tests/ui/attributes/issue-115264-pat-field.rs
new file mode 100644
index 000000000..8c6bbe167
--- /dev/null
+++ b/tests/ui/attributes/issue-115264-pat-field.rs
@@ -0,0 +1,19 @@
+// Regression test for issue 115264
+// Tests that retrieving the ident of 'foo' variable in
+// the pattern inside main() does not cause an ICE
+
+// check-pass
+
+struct X {
+ foo: i32,
+}
+
+#[allow(unused_variables)]
+fn main() {
+ let X {
+ #[doc(alias = "StructItem")]
+ foo
+ } = X {
+ foo: 123
+ };
+}
diff --git a/tests/ui/backtrace.rs b/tests/ui/backtrace.rs
index 66b378f62..84be333be 100644
--- a/tests/ui/backtrace.rs
+++ b/tests/ui/backtrace.rs
@@ -94,27 +94,30 @@ fn runtest(me: &str) {
#[cfg(not(panic = "abort"))]
{
// Make sure a stack trace is printed
- let p = template(me).arg("double-fail").spawn().unwrap();
+ let p = template(me).arg("double-fail").env("RUST_BACKTRACE","0").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap();
// loosened the following from double::h to double:: due to
// spurious failures on mac, 32bit, optimized
- assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"),
- "bad output3: {}", s);
+ assert!(
+ s.contains("stack backtrace") &&
+ s.contains("panic in a destructor during cleanup") &&
+ contains_verbose_expected(s, "double"),
+ "bad output3: {}", s
+ );
+ // Make sure it's only one stack trace.
+ assert_eq!(s.split("stack backtrace").count(), 2);
// Make sure a stack trace isn't printed too many times
- //
- // Currently it is printed 3 times ("once", "twice" and "panic in a
- // function that cannot unwind") but in the future the last one may be
- // removed.
+ // even with RUST_BACKTRACE=1. It should be printed twice.
let p = template(me).arg("double-fail")
.env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap();
let mut i = 0;
- for _ in 0..3 {
+ for _ in 0..2 {
i += s[i + 10..].find("stack backtrace").unwrap() + 10;
}
assert!(s[i + 10..].find("stack backtrace").is_none(),
diff --git a/tests/ui/binding/match-beginning-vert.rs b/tests/ui/binding/match-beginning-vert.rs
index 79267400b..93c08f0b7 100644
--- a/tests/ui/binding/match-beginning-vert.rs
+++ b/tests/ui/binding/match-beginning-vert.rs
@@ -1,4 +1,7 @@
// run-pass
+
+#![feature(if_let_guard)]
+
enum Foo {
A,
B,
@@ -13,6 +16,7 @@ fn main() {
match *foo {
| A => println!("A"),
| B | C if 1 < 2 => println!("BC!"),
+ | D if let 1 = 1 => println!("D!"),
| _ => {},
}
}
diff --git a/tests/ui/block-result/issue-20862.stderr b/tests/ui/block-result/issue-20862.stderr
index 37bad64c5..17b524fe3 100644
--- a/tests/ui/block-result/issue-20862.stderr
+++ b/tests/ui/block-result/issue-20862.stderr
@@ -7,7 +7,7 @@ LL | |y| x + y
| ^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-20862.rs:2:5: 2:8]`
+ found closure `{closure@$DIR/issue-20862.rs:2:5: 2:8}`
error[E0618]: expected function, found `()`
--> $DIR/issue-20862.rs:7:13
diff --git a/tests/ui/borrowck/async-reference-generality.rs b/tests/ui/borrowck/async-reference-generality.rs
index 487d1ac81..668df9ea7 100644
--- a/tests/ui/borrowck/async-reference-generality.rs
+++ b/tests/ui/borrowck/async-reference-generality.rs
@@ -1,5 +1,4 @@
-// check-fail
-// known-bug: #99492
+// check-pass
// edition: 2021
use std::marker::PhantomData;
diff --git a/tests/ui/borrowck/async-reference-generality.stderr b/tests/ui/borrowck/async-reference-generality.stderr
deleted file mode 100644
index af720ad29..000000000
--- a/tests/ui/borrowck/async-reference-generality.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/async-reference-generality.rs:23:5
- |
-LL | / async {
-LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
-LL | | async {}.await;
-LL | | }
- | |_____^ one type is more general than the other
- |
- = note: expected reference `&()`
- found reference `&()`
-
-error[E0308]: mismatched types
- --> $DIR/async-reference-generality.rs:23:5
- |
-LL | / async {
-LL | | let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
-LL | | async {}.await;
-LL | | }
- | |_____^ one type is more general than the other
- |
- = note: expected reference `&()`
- found reference `&()`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
deleted file mode 100644
index addbe5d65..000000000
--- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: -Zdrop-tracking-mir
-// edition:2021
-
-use std::future::Future;
-
-trait Client {
- type Connecting<'a>: Future + Send
- where
- Self: 'a;
-
- fn connect(&'_ self) -> Self::Connecting<'a>;
- //~^ ERROR use of undeclared lifetime name `'a`
-}
-
-fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
-where
- C: Client + Send + Sync,
-{
- async move { c.connect().await }
- //~^ ERROR `C` does not live long enough
-}
-
-fn main() {}
diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
deleted file mode 100644
index 53abe3dc9..000000000
--- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/erase-error-in-mir-drop-tracking.rs:11:46
- |
-LL | fn connect(&'_ self) -> Self::Connecting<'a>;
- | ^^ undeclared lifetime
- |
-help: consider introducing lifetime `'a` here
- |
-LL | fn connect<'a>(&'_ self) -> Self::Connecting<'a>;
- | ++++
-help: consider introducing lifetime `'a` here
- |
-LL | trait Client<'a> {
- | ++++
-
-error: `C` does not live long enough
- --> $DIR/erase-error-in-mir-drop-tracking.rs:19:5
- |
-LL | async move { c.connect().await }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs
new file mode 100644
index 000000000..4a6c2f9ed
--- /dev/null
+++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs
@@ -0,0 +1,16 @@
+#![allow(dead_code)]
+
+fn bar<'a>(_: std::fmt::Arguments<'a>) {}
+fn main() {
+ let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3);
+ //~^ ERROR temporary value dropped while borrowed
+
+ bar(x);
+
+ let foo = format_args!("{}", "hi");
+ //~^ ERROR temporary value dropped while borrowed
+ bar(foo);
+
+ let foo = format_args!("hi"); // no placeholder in arguments, so no error
+ bar(foo);
+}
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
new file mode 100644
index 000000000..8221505b1
--- /dev/null
+++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr
@@ -0,0 +1,33 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-114374-invalid-help-fmt-args.rs:5:13
+ |
+LL | let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+...
+LL | bar(x);
+ | - borrow later used here
+ |
+ = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used
+ = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/issue-114374-invalid-help-fmt-args.rs:10:15
+ |
+LL | let foo = format_args!("{}", "hi");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+LL |
+LL | bar(foo);
+ | --- borrow later used here
+ |
+ = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used
+ = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>
+ = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed
new file mode 100644
index 000000000..4653fe737
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+pub trait Layer {
+ fn process(&mut self) -> u32;
+}
+
+pub struct State {
+ layers: Vec<Box<dyn Layer>>,
+}
+
+impl State {
+ pub fn process(&mut self) -> u32 {
+ self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
+ //~^ ERROR cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs
new file mode 100644
index 000000000..e0f6ab132
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+pub trait Layer {
+ fn process(&mut self) -> u32;
+}
+
+pub struct State {
+ layers: Vec<Box<dyn Layer>>,
+}
+
+impl State {
+ pub fn process(&mut self) -> u32 {
+ self.layers.iter().fold(0, |result, mut layer| result + layer.process())
+ //~^ ERROR cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
new file mode 100644
index 000000000..7e0fc2cf2
--- /dev/null
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `**layer` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-115259-suggest-iter-mut.rs:15:65
+ |
+LL | self.layers.iter().fold(0, |result, mut layer| result + layer.process())
+ | --------- ^^^^^ `layer` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut Box<dyn Layer>`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
+ | ~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
index f0b574846..3debfb62c 100644
--- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
+++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
@@ -4,7 +4,7 @@ error: lifetime may not live long enough
LL | let _action = move || {
| -------
| | |
- | | return type of closure `[closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11]` contains a lifetime `'2`
+ | | return type of closure `{closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11}` contains a lifetime `'2`
| lifetime `'1` represents this closure's body
LL | || f() // The `nested` closure
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed
new file mode 100644
index 000000000..f02374d8e
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.fixed
@@ -0,0 +1,36 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+use std::path::PathBuf;
+
+#[derive(Clone)]
+struct Container {
+ things: Vec<PathBuf>,
+}
+
+impl Container {
+ fn things(&mut self) -> &[PathBuf] {
+ &self.things
+ }
+}
+
+// contains containers
+struct ContainerContainer {
+ contained: Vec<Container>,
+}
+
+impl ContainerContainer {
+ fn contained(&self) -> &[Container] {
+ &self.contained
+ }
+
+ fn all_the_things(&mut self) -> &[PathBuf] {
+ let mut vec = self.contained.clone();
+ let _a =
+ vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ //~^ ERROR cannot borrow `*container` as mutable, as it is behind a `&` reference
+ unimplemented!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs
new file mode 100644
index 000000000..2d0b837a9
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.rs
@@ -0,0 +1,36 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+use std::path::PathBuf;
+
+#[derive(Clone)]
+struct Container {
+ things: Vec<PathBuf>,
+}
+
+impl Container {
+ fn things(&mut self) -> &[PathBuf] {
+ &self.things
+ }
+}
+
+// contains containers
+struct ContainerContainer {
+ contained: Vec<Container>,
+}
+
+impl ContainerContainer {
+ fn contained(&self) -> &[Container] {
+ &self.contained
+ }
+
+ fn all_the_things(&mut self) -> &[PathBuf] {
+ let mut vec = self.contained.clone();
+ let _a =
+ vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ //~^ ERROR cannot borrow `*container` as mutable, as it is behind a `&` reference
+ unimplemented!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
new file mode 100644
index 000000000..19f194100
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `*container` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut-2.rs:30:45
+ |
+LL | vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ | --------- ^^^^^^^^^ `container` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut Container`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>();
+ | ~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed b/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed
new file mode 100644
index 000000000..8bf2625de
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.fixed
@@ -0,0 +1,30 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+#[derive(Debug)]
+struct A {
+ a: i32,
+}
+
+impl A {
+ fn double(&mut self) {
+ self.a += self.a
+ }
+}
+
+fn baz() {
+ let mut v = [A { a: 4 }];
+ v.iter_mut().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn bar() {
+ let mut v = [A { a: 4 }];
+ v.iter_mut().rev().rev().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs b/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs
new file mode 100644
index 000000000..39bc30bf2
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.rs
@@ -0,0 +1,30 @@
+// run-rustfix
+#![allow(unused_mut)]
+#![allow(dead_code)]
+
+#[derive(Debug)]
+struct A {
+ a: i32,
+}
+
+impl A {
+ fn double(&mut self) {
+ self.a += self.a
+ }
+}
+
+fn baz() {
+ let mut v = [A { a: 4 }];
+ v.iter().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn bar() {
+ let mut v = [A { a: 4 }];
+ v.iter().rev().rev().for_each(|a| a.double());
+ //~^ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference
+ println!("{:?}", v);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
new file mode 100644
index 000000000..fd58e4330
--- /dev/null
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
@@ -0,0 +1,29 @@
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut.rs:18:27
+ |
+LL | v.iter().for_each(|a| a.double());
+ | - ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut A`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | v.iter_mut().for_each(|a| a.double());
+ | ~~~~~~~~
+
+error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-62387-suggest-iter-mut.rs:25:39
+ |
+LL | v.iter().rev().rev().for_each(|a| a.double());
+ | - ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | |
+ | consider changing this binding's type to be: `&mut A`
+ |
+help: you may want to use `iter_mut` here
+ |
+LL | v.iter_mut().rev().rev().for_each(|a| a.double());
+ | ~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr
index 1b03bc3af..5ff33933c 100644
--- a/tests/ui/borrowck/issue-81899.stderr
+++ b/tests/ui/borrowck/issue-81899.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5
|
-note: inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>`
+note: inside `f::<{closure@$DIR/issue-81899.rs:4:31: 4:34}>`
--> $DIR/issue-81899.rs:11:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-81899.rs:4:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr
index a5a571c6d..7b785b25b 100644
--- a/tests/ui/borrowck/issue-88434-minimal-example.stderr
+++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5
|
-note: inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>`
+note: inside `f::<{closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28}>`
--> $DIR/issue-88434-minimal-example.rs:10:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &() = &f(&|_| {});
| ^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-88434-minimal-example.rs:3:21
|
LL | const _CONST: &() = &f(&|_| {});
diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
index 00023c459..9732b8cfa 100644
--- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
+++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | panic!()
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
-note: inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>`
+note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>`
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
|
LL | panic!()
@@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
| ^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
diff --git a/tests/ui/borrowck/issue-92157.rs b/tests/ui/borrowck/issue-92157.rs
index 6ee2320a6..3a6f8908b 100644
--- a/tests/ui/borrowck/issue-92157.rs
+++ b/tests/ui/borrowck/issue-92157.rs
@@ -9,7 +9,7 @@ extern {}
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- //~^ ERROR: incorrect number of parameters for the `start` lang item
+ //~^ ERROR lang item `start` function has wrong type [E0308]
40+2
}
diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr
index a4010d73d..a46b12889 100644
--- a/tests/ui/borrowck/issue-92157.stderr
+++ b/tests/ui/borrowck/issue-92157.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/issue-92157.rs:11:1
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 3
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
index 776c338de..d7762621c 100644
--- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
+++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr
@@ -24,7 +24,7 @@ error: lifetime may not live long enough
LL | move |()| s.chars().map(|c| format!("{}{}", c, s))
| --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
- | | return type of closure `Map<Chars<'_>, [closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32]>` contains a lifetime `'2`
+ | | return type of closure `Map<Chars<'_>, {closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32}>` contains a lifetime `'2`
| lifetime `'1` represents this closure's body
|
= note: closure implements `Fn`, so references to captured variables can't escape the closure
diff --git a/tests/ui/borrowck/suggest-mut-iterator.fixed b/tests/ui/borrowck/suggest-mut-iterator.fixed
new file mode 100644
index 000000000..16512b8a3
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.fixed
@@ -0,0 +1,30 @@
+// run-rustfix
+struct Test {
+ a: u32
+}
+
+impl Test {
+ pub fn add(&mut self, value: u32) {
+ self.a += value;
+ }
+
+ pub fn print_value(&self) {
+ println!("Value of a is: {}", self.a);
+ }
+}
+
+fn main() {
+ let mut tests = Vec::new();
+ for i in 0..=10 {
+ tests.push(Test {a: i});
+ }
+ for test in &mut tests {
+ test.add(2); //~ ERROR cannot borrow `*test` as mutable, as it is behind a `&` reference
+ }
+ for test in &mut tests {
+ test.add(2);
+ }
+ for test in &tests {
+ test.print_value();
+ }
+}
diff --git a/tests/ui/borrowck/suggest-mut-iterator.rs b/tests/ui/borrowck/suggest-mut-iterator.rs
new file mode 100644
index 000000000..276edeccb
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.rs
@@ -0,0 +1,30 @@
+// run-rustfix
+struct Test {
+ a: u32
+}
+
+impl Test {
+ pub fn add(&mut self, value: u32) {
+ self.a += value;
+ }
+
+ pub fn print_value(&self) {
+ println!("Value of a is: {}", self.a);
+ }
+}
+
+fn main() {
+ let mut tests = Vec::new();
+ for i in 0..=10 {
+ tests.push(Test {a: i});
+ }
+ for test in &tests {
+ test.add(2); //~ ERROR cannot borrow `*test` as mutable, as it is behind a `&` reference
+ }
+ for test in &mut tests {
+ test.add(2);
+ }
+ for test in &tests {
+ test.print_value();
+ }
+}
diff --git a/tests/ui/borrowck/suggest-mut-iterator.stderr b/tests/ui/borrowck/suggest-mut-iterator.stderr
new file mode 100644
index 000000000..77f991a9a
--- /dev/null
+++ b/tests/ui/borrowck/suggest-mut-iterator.stderr
@@ -0,0 +1,16 @@
+error[E0596]: cannot borrow `*test` as mutable, as it is behind a `&` reference
+ --> $DIR/suggest-mut-iterator.rs:22:9
+ |
+LL | for test in &tests {
+ | ------ this iterator yields `&` references
+LL | test.add(2);
+ | ^^^^ `test` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: use a mutable iterator instead
+ |
+LL | for test in &mut tests {
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr
index c78993381..4beea83d8 100644
--- a/tests/ui/c-variadic/variadic-ffi-1.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-1.stderr
@@ -46,7 +46,6 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
|
= note: expected fn pointer `unsafe extern "C" fn(_, _)`
found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:26:54
@@ -58,7 +57,6 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
|
= note: expected fn pointer `extern "C" fn(_, _, ...)`
found fn item `extern "C" fn(_, _) {bar}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0617]: can't pass `f32` to variadic function
--> $DIR/variadic-ffi-1.rs:28:19
diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs
index c34b7e55f..67a0a9a1d 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.rs
+++ b/tests/ui/c-variadic/variadic-ffi-2.rs
@@ -3,10 +3,13 @@
fn baz(f: extern "stdcall" fn(usize, ...)) {
//~^ ERROR: C-variadic function must have a compatible calling convention,
- // like C, cdecl, win64, sysv64 or efiapi
+ // like C, cdecl, aapcs, win64, sysv64 or efiapi
f(22, 44);
}
+fn aapcs(f: extern "aapcs" fn(usize, ...)) {
+ f(22, 44);
+}
fn sysv(f: extern "sysv64" fn(usize, ...)) {
f(22, 44);
}
diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr
index e21001eca..8884fc6fb 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-2.stderr
@@ -1,4 +1,4 @@
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
--> $DIR/variadic-ffi-2.rs:4:11
|
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
diff --git a/tests/ui/cast/cast-as-bool.rs b/tests/ui/cast/cast-as-bool.rs
index fbebc80d9..511a02718 100644
--- a/tests/ui/cast/cast-as-bool.rs
+++ b/tests/ui/cast/cast-as-bool.rs
@@ -1,11 +1,47 @@
fn main() {
- let u = 5 as bool; //~ ERROR cannot cast as `bool`
+ let u = 5 as bool; //~ ERROR cannot cast `i32` as `bool`
//~| HELP compare with zero instead
- //~| SUGGESTION 5 != 0
+ //~| SUGGESTION != 0
- let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool`
+ let t = (1 + 2) as bool; //~ ERROR cannot cast `i32` as `bool`
//~| HELP compare with zero instead
- //~| SUGGESTION (1 + 2) != 0
+ //~| SUGGESTION != 0
+
+ let _ = 5_u32 as bool; //~ ERROR cannot cast `u32` as `bool`
+ //~| HELP compare with zero instead
+
+ let _ = 64.0_f64 as bool; //~ ERROR cannot cast `f64` as `bool`
+ //~| HELP compare with zero instead
+
+ // Enums that can normally be cast to integers can't be cast to `bool`, just like integers.
+ // Note that enums that cannot be cast to integers can't be cast to anything at *all*
+ // so that's not tested here.
+ enum IntEnum {
+ Zero,
+ One,
+ Two
+ }
+ let _ = IntEnum::One as bool; //~ ERROR cannot cast `IntEnum` as `bool`
+
+ fn uwu(_: u8) -> String {
+ todo!()
+ }
+
+ unsafe fn owo() {}
+
+ // fn item to bool
+ let _ = uwu as bool; //~ ERROR cannot cast `fn(u8) -> String {uwu}` as `bool`
+ // unsafe fn item
+ let _ = owo as bool; //~ ERROR cannot cast `unsafe fn() {owo}` as `bool`
+
+ // fn ptr to bool
+ let _ = uwu as fn(u8) -> String as bool; //~ ERROR cannot cast `fn(u8) -> String` as `bool`
+
+ let _ = 'x' as bool; //~ ERROR cannot cast `char` as `bool`
+
+ let ptr = 1 as *const ();
+
+ let _ = ptr as bool; //~ ERROR cannot cast `*const ()` as `bool`
let v = "hello" as bool;
//~^ ERROR casting `&'static str` as `bool` is invalid
diff --git a/tests/ui/cast/cast-as-bool.stderr b/tests/ui/cast/cast-as-bool.stderr
index 19ac8f10f..4ff56a95e 100644
--- a/tests/ui/cast/cast-as-bool.stderr
+++ b/tests/ui/cast/cast-as-bool.stderr
@@ -1,18 +1,86 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-as-bool.rs:2:13
|
LL | let u = 5 as bool;
- | ^^^^^^^^^ help: compare with zero instead: `5 != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let u = 5 != 0;
+ | ~~~~
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-as-bool.rs:6:13
|
LL | let t = (1 + 2) as bool;
- | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0`
+ | ^^^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let t = (1 + 2) != 0;
+ | ~~~~
-error[E0606]: casting `&'static str` as `bool` is invalid
+error[E0054]: cannot cast `u32` as `bool`
--> $DIR/cast-as-bool.rs:10:13
|
+LL | let _ = 5_u32 as bool;
+ | ^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 5_u32 != 0;
+ | ~~~~
+
+error[E0054]: cannot cast `f64` as `bool`
+ --> $DIR/cast-as-bool.rs:13:13
+ |
+LL | let _ = 64.0_f64 as bool;
+ | ^^^^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 64.0_f64 != 0;
+ | ~~~~
+
+error[E0054]: cannot cast `IntEnum` as `bool`
+ --> $DIR/cast-as-bool.rs:24:13
+ |
+LL | let _ = IntEnum::One as bool;
+ | ^^^^^^^^^^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `fn(u8) -> String {uwu}` as `bool`
+ --> $DIR/cast-as-bool.rs:33:13
+ |
+LL | let _ = uwu as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `unsafe fn() {owo}` as `bool`
+ --> $DIR/cast-as-bool.rs:35:13
+ |
+LL | let _ = owo as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `fn(u8) -> String` as `bool`
+ --> $DIR/cast-as-bool.rs:38:13
+ |
+LL | let _ = uwu as fn(u8) -> String as bool;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `char` as `bool`
+ --> $DIR/cast-as-bool.rs:40:13
+ |
+LL | let _ = 'x' as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0054]: cannot cast `*const ()` as `bool`
+ --> $DIR/cast-as-bool.rs:44:13
+ |
+LL | let _ = ptr as bool;
+ | ^^^^^^^^^^^ unsupported cast
+
+error[E0606]: casting `&'static str` as `bool` is invalid
+ --> $DIR/cast-as-bool.rs:46:13
+ |
LL | let v = "hello" as bool;
| ^^^^^^^^^^^^^^^
|
@@ -21,7 +89,7 @@ help: consider using the `is_empty` method on `&'static str` to determine if it
LL | let v = !"hello".is_empty();
| + ~~~~~~~~~~~
-error: aborting due to 3 previous errors
+error: aborting due to 11 previous errors
Some errors have detailed explanations: E0054, E0606.
For more information about an error, try `rustc --explain E0054`.
diff --git a/tests/ui/cast/cast-rfc0401-2.rs b/tests/ui/cast/cast-rfc0401-2.rs
index 7709aa341..70604a587 100644
--- a/tests/ui/cast/cast-rfc0401-2.rs
+++ b/tests/ui/cast/cast-rfc0401-2.rs
@@ -4,5 +4,5 @@
fn main() {
let _ = 3 as bool;
- //~^ ERROR cannot cast as `bool`
+ //~^ ERROR cannot cast `i32` as `bool`
}
diff --git a/tests/ui/cast/cast-rfc0401-2.stderr b/tests/ui/cast/cast-rfc0401-2.stderr
index 52f6af78a..dd90c3a97 100644
--- a/tests/ui/cast/cast-rfc0401-2.stderr
+++ b/tests/ui/cast/cast-rfc0401-2.stderr
@@ -1,8 +1,13 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-rfc0401-2.rs:6:13
|
LL | let _ = 3 as bool;
- | ^^^^^^^^^ help: compare with zero instead: `3 != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 3 != 0;
+ | ~~~~
error: aborting due to previous error
diff --git a/tests/ui/cast/unsized-struct-cast.rs b/tests/ui/cast/unsized-struct-cast.rs
new file mode 100644
index 000000000..52bb6cedc
--- /dev/null
+++ b/tests/ui/cast/unsized-struct-cast.rs
@@ -0,0 +1,6 @@
+pub struct Data([u8]);
+
+fn main(){
+ const _: *const Data = &[] as *const Data;
+ //~^ ERROR: casting `&[_; 0]` as `*const Data` is invalid
+}
diff --git a/tests/ui/cast/unsized-struct-cast.stderr b/tests/ui/cast/unsized-struct-cast.stderr
new file mode 100644
index 000000000..79b3d973c
--- /dev/null
+++ b/tests/ui/cast/unsized-struct-cast.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `&[_; 0]` as `*const Data` is invalid
+ --> $DIR/unsized-struct-cast.rs:4:28
+ |
+LL | const _: *const Data = &[] as *const Data;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr
index e773d5d83..c705152d9 100644
--- a/tests/ui/check-cfg/values-target-json.stderr
+++ b/tests/ui/check-cfg/values-target-json.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"linux"`
|
- = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index 1f7758146..b381f5a4a 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"linux"`
|
- = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value
diff --git a/tests/ui/closure_context/issue-26046-fn-mut.stderr b/tests/ui/closure_context/issue-26046-fn-mut.stderr
index e468f6be7..eeb409452 100644
--- a/tests/ui/closure_context/issue-26046-fn-mut.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-mut.stderr
@@ -9,7 +9,7 @@ LL | num += 1;
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
- = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]>` to `Box<(dyn Fn() + 'static)>`
+ = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}>` to `Box<(dyn Fn() + 'static)>`
error: aborting due to previous error
diff --git a/tests/ui/closure_context/issue-26046-fn-once.stderr b/tests/ui/closure_context/issue-26046-fn-once.stderr
index 41f60327c..24773a1d7 100644
--- a/tests/ui/closure_context/issue-26046-fn-once.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-once.stderr
@@ -9,7 +9,7 @@ LL | vec
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
- = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
+ = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
error: aborting due to previous error
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr
new file mode 100644
index 000000000..394629c00
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `value` because it is borrowed
+ --> $DIR/if-let-guards-errors.rs:16:13
+ |
+LL | let f = |x: &E| {
+ | ------- borrow of `value` occurs here
+LL | match &x {
+LL | E::Number(_) if let E::Number(ref mut n) = *value => { }
+ | ------ borrow occurs due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ move out of `value` occurs here
+LL |
+LL | drop(f);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `value`
+ --> $DIR/if-let-guards-errors.rs:28:13
+ |
+LL | fn if_let_move(value: Box<E>) {
+ | ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait
+LL | let f = |x: &E| {
+ | ------- value moved into closure here
+LL | match &x {
+LL | E::Number(_) if let E::String(s) = *value => { }
+ | ------ variable moved due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr
new file mode 100644
index 000000000..567284501
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `value` because it is borrowed
+ --> $DIR/if-let-guards-errors.rs:16:13
+ |
+LL | let f = |x: &E| {
+ | ------- borrow of `*value` occurs here
+LL | match &x {
+LL | E::Number(_) if let E::Number(ref mut n) = *value => { }
+ | ------ borrow occurs due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ move out of `value` occurs here
+LL |
+LL | drop(f);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `value`
+ --> $DIR/if-let-guards-errors.rs:28:13
+ |
+LL | fn if_let_move(value: Box<E>) {
+ | ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait
+LL | let f = |x: &E| {
+ | ------- value moved into closure here
+LL | match &x {
+LL | E::Number(_) if let E::String(s) = *value => { }
+ | ------ variable moved due to use in closure
+...
+LL | let x = value;
+ | ^^^^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs
new file mode 100644
index 000000000..17e38c033
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs
@@ -0,0 +1,37 @@
+// Check the if let guards don't force capture by value
+// revisions: e2018 e2021
+//[e2018] edition:2018
+//[e2021] edition:2021
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn if_let_ref_mut(mut value: Box<E>) {
+ let f = |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref mut n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+ //~^ ERROR cannot move out of `value` because it is borrowed
+ drop(f);
+}
+
+fn if_let_move(value: Box<E>) {
+ let f = |x: &E| {
+ match &x {
+ E::Number(_) if let E::String(s) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+ //~^ ERROR use of moved value: `value`
+}
+
+enum E {
+ String(String),
+ Number(i32),
+}
+
+fn main() {}
diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs
new file mode 100644
index 000000000..fa331707b
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs
@@ -0,0 +1,55 @@
+// Check the if let guards don't force capture by value
+// revisions: e2018 e2021
+// check-pass
+//[e2018] edition:2018
+//[e2021] edition:2021
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn if_let_underscore(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let _ = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_copy(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_ref(value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+fn if_let_ref_mut(mut value: Box<E>) {
+ |x: &E| {
+ match &x {
+ E::Number(_) if let E::Number(ref mut n) = *value => { }
+ _ => {}
+ }
+ };
+ let x = value;
+}
+
+enum E {
+ String(String),
+ Number(i32),
+}
+
+fn main() {}
diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
index 3a5fad154..0807f4590 100644
--- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
+++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
@@ -45,7 +45,8 @@ note: `E2` defined here
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^
- = note: the matched value is of type `E2`, which is marked as non-exhaustive
+ = note: the matched value is of type `E2`
+ = note: `E2` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } };
diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/repr_packed.rs
index f23670f63..8c23454fa 100644
--- a/tests/ui/closures/2229_closure_analysis/repr_packed.rs
+++ b/tests/ui/closures/2229_closure_analysis/repr_packed.rs
@@ -3,7 +3,8 @@
#![feature(rustc_attrs)]
// `u8` aligned at a byte and are unaffected by repr(packed).
-// Therefore we can precisely (and safely) capture references to both the fields.
+// Therefore we *could* precisely (and safely) capture references to both the fields,
+// but we don't, since we don't want capturing to change when field types change alignment.
fn test_alignment_not_affected() {
#[repr(packed)]
struct Foo { x: u8, y: u8 }
@@ -17,11 +18,10 @@ fn test_alignment_not_affected() {
//~^ ERROR: First Pass analysis includes:
//~| ERROR: Min Capture analysis includes:
let z1: &u8 = &foo.x;
- //~^ NOTE: Capturing foo[(0, 0)] -> ImmBorrow
- //~| NOTE: Min Capture foo[(0, 0)] -> ImmBorrow
+ //~^ NOTE: Capturing foo[] -> ImmBorrow
let z2: &mut u8 = &mut foo.y;
- //~^ NOTE: Capturing foo[(1, 0)] -> MutBorrow
- //~| NOTE: Min Capture foo[(1, 0)] -> MutBorrow
+ //~^ NOTE: Capturing foo[] -> MutBorrow
+ //~| NOTE: Min Capture foo[] -> MutBorrow
*z2 = 42;
diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
index 580061ebc..32b3d844c 100644
--- a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
+++ b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr
@@ -1,5 +1,5 @@
error[E0658]: attributes on expressions are experimental
- --> $DIR/repr_packed.rs:13:17
+ --> $DIR/repr_packed.rs:14:17
|
LL | let mut c = #[rustc_capture_analysis]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | let c = #[rustc_capture_analysis]
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
error: First Pass analysis includes:
- --> $DIR/repr_packed.rs:16:5
+ --> $DIR/repr_packed.rs:17:5
|
LL | / || {
LL | |
@@ -37,19 +37,19 @@ LL | | println!("({}, {})", z1, z2);
LL | | };
| |_____^
|
-note: Capturing foo[(0, 0)] -> ImmBorrow
- --> $DIR/repr_packed.rs:19:24
+note: Capturing foo[] -> ImmBorrow
+ --> $DIR/repr_packed.rs:20:24
|
LL | let z1: &u8 = &foo.x;
| ^^^^^
-note: Capturing foo[(1, 0)] -> MutBorrow
+note: Capturing foo[] -> MutBorrow
--> $DIR/repr_packed.rs:22:32
|
LL | let z2: &mut u8 = &mut foo.y;
| ^^^^^
error: Min Capture analysis includes:
- --> $DIR/repr_packed.rs:16:5
+ --> $DIR/repr_packed.rs:17:5
|
LL | / || {
LL | |
@@ -60,12 +60,7 @@ LL | | println!("({}, {})", z1, z2);
LL | | };
| |_____^
|
-note: Min Capture foo[(0, 0)] -> ImmBorrow
- --> $DIR/repr_packed.rs:19:24
- |
-LL | let z1: &u8 = &foo.x;
- | ^^^^^
-note: Min Capture foo[(1, 0)] -> MutBorrow
+note: Min Capture foo[] -> MutBorrow
--> $DIR/repr_packed.rs:22:32
|
LL | let z2: &mut u8 = &mut foo.y;
diff --git a/tests/ui/closures/capture-unsized-by-move.rs b/tests/ui/closures/capture-unsized-by-move.rs
new file mode 100644
index 000000000..1148e34ac
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-move.rs
@@ -0,0 +1,10 @@
+// compile-flags: --crate-type=lib
+
+#![feature(unsized_fn_params)]
+
+pub fn f(k: dyn std::fmt::Display) {
+ let k2 = move || {
+ k.to_string();
+ //~^ ERROR the size for values of type `(dyn std::fmt::Display + 'static)` cannot be known at compilation time
+ };
+}
diff --git a/tests/ui/closures/capture-unsized-by-move.stderr b/tests/ui/closures/capture-unsized-by-move.stderr
new file mode 100644
index 000000000..d7fafc8ca
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-move.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `(dyn std::fmt::Display + 'static)` cannot be known at compilation time
+ --> $DIR/capture-unsized-by-move.rs:7:9
+ |
+LL | let k2 = move || {
+ | -- this closure captures all values by move
+LL | k.to_string();
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn std::fmt::Display + 'static)`
+ = note: all values captured by value by a closure must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/closures/capture-unsized-by-ref.rs b/tests/ui/closures/capture-unsized-by-ref.rs
new file mode 100644
index 000000000..c9e4a5903
--- /dev/null
+++ b/tests/ui/closures/capture-unsized-by-ref.rs
@@ -0,0 +1,10 @@
+// build-pass
+// compile-flags: --crate-type=lib
+
+#![feature(unsized_fn_params)]
+
+pub fn f(k: dyn std::fmt::Display) {
+ let k2 = || {
+ k.to_string();
+ };
+}
diff --git a/tests/ui/closures/closure-no-fn-1.stderr b/tests/ui/closures/closure-no-fn-1.stderr
index eab7482e6..87e670bb0 100644
--- a/tests/ui/closures/closure-no-fn-1.stderr
+++ b/tests/ui/closures/closure-no-fn-1.stderr
@@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this
|
= note: expected fn pointer `fn(u8) -> u8`
- found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:36]`
+ found closure `{closure@$DIR/closure-no-fn-1.rs:6:29: 6:36}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-1.rs:6:39
|
diff --git a/tests/ui/closures/closure-no-fn-2.stderr b/tests/ui/closures/closure-no-fn-2.stderr
index e1f0143ab..7c7e9d0ce 100644
--- a/tests/ui/closures/closure-no-fn-2.stderr
+++ b/tests/ui/closures/closure-no-fn-2.stderr
@@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { b };
| expected due to this
|
= note: expected fn pointer `fn() -> u8`
- found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:29]`
+ found closure `{closure@$DIR/closure-no-fn-2.rs:6:27: 6:29}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-2.rs:6:32
|
diff --git a/tests/ui/closures/closure-no-fn-3.stderr b/tests/ui/closures/closure-no-fn-3.stderr
index 6009389b1..276e766e8 100644
--- a/tests/ui/closures/closure-no-fn-3.stderr
+++ b/tests/ui/closures/closure-no-fn-3.stderr
@@ -1,4 +1,4 @@
-error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:28: 6:30]` as `fn() -> u8`
+error[E0605]: non-primitive cast: `{closure@$DIR/closure-no-fn-3.rs:6:28: 6:30}` as `fn() -> u8`
--> $DIR/closure-no-fn-3.rs:6:27
|
LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
diff --git a/tests/ui/closures/closure-no-fn-4.stderr b/tests/ui/closures/closure-no-fn-4.stderr
index d1b704884..0bec11ab6 100644
--- a/tests/ui/closures/closure-no-fn-4.stderr
+++ b/tests/ui/closures/closure-no-fn-4.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____- `match` arms have incompatible types
|
= note: expected fn pointer `fn(usize) -> usize`
- found closure `[closure@$DIR/closure-no-fn-4.rs:5:18: 5:21]`
+ found closure `{closure@$DIR/closure-no-fn-4.rs:5:18: 5:21}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-4.rs:5:26
|
diff --git a/tests/ui/closures/closure-no-fn-5.stderr b/tests/ui/closures/closure-no-fn-5.stderr
index a33b847ea..13d19495d 100644
--- a/tests/ui/closures/closure-no-fn-5.stderr
+++ b/tests/ui/closures/closure-no-fn-5.stderr
@@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { a; b; c; d; e };
| expected due to this
|
= note: expected fn pointer `fn() -> u8`
- found closure `[closure@$DIR/closure-no-fn-5.rs:10:27: 10:29]`
+ found closure `{closure@$DIR/closure-no-fn-5.rs:10:27: 10:29}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-no-fn-5.rs:10:32
|
diff --git a/tests/ui/closures/closure-reform-bad.stderr b/tests/ui/closures/closure-reform-bad.stderr
index 4c40f70b9..6bb598131 100644
--- a/tests/ui/closures/closure-reform-bad.stderr
+++ b/tests/ui/closures/closure-reform-bad.stderr
@@ -9,7 +9,7 @@ LL | call_bare(f)
| arguments to this function are incorrect
|
= note: expected fn pointer `for<'a> fn(&'a str)`
- found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:22]`
+ found closure `{closure@$DIR/closure-reform-bad.rs:10:13: 10:22}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-reform-bad.rs:10:43
|
diff --git a/tests/ui/closures/closure_cap_coerce_many_fail.stderr b/tests/ui/closures/closure_cap_coerce_many_fail.stderr
index ca8a43328..958439e7d 100644
--- a/tests/ui/closures/closure_cap_coerce_many_fail.stderr
+++ b/tests/ui/closures/closure_cap_coerce_many_fail.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____- `match` arms have incompatible types
|
= note: expected fn item `fn(i32, i32) -> i32 {add}`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22]`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22}`
error[E0308]: `match` arms have incompatible types
--> $DIR/closure_cap_coerce_many_fail.rs:18:16
@@ -23,15 +23,15 @@ LL | | "+" => |a, b| (a + b) as i32,
| | ---------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22}`
LL | | "-" => |a, b| (a - b + cap) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
@@ -44,15 +44,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
| | ---------------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22}`
LL | | "-" => |a, b| (a - b) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
@@ -65,15 +65,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
| | ---------------------------
| | |
| | the expected closure
- | | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
+ | | this is found to be of type `{closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22}`
LL | | "-" => |a, b| (a - b + cap) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(),
LL | | };
| |_____- `match` arms have incompatible types
|
- = note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
- found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22]`
+ = note: expected closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22}`
+ found closure `{closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
diff --git a/tests/ui/closures/issue-112547.rs b/tests/ui/closures/issue-112547.rs
new file mode 100644
index 000000000..8ecb2abcc
--- /dev/null
+++ b/tests/ui/closures/issue-112547.rs
@@ -0,0 +1,15 @@
+#![feature(non_lifetime_binders)]
+ //~^ WARNING the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+
+pub fn bar()
+where
+ for<const N: usize = {
+ (||1usize)()
+}> V: IntoIterator
+//~^ ERROR cannot find type `V` in this scope [E0412]
+{
+}
+
+fn main() {
+ bar();
+}
diff --git a/tests/ui/closures/issue-112547.stderr b/tests/ui/closures/issue-112547.stderr
new file mode 100644
index 000000000..d86b05dc6
--- /dev/null
+++ b/tests/ui/closures/issue-112547.stderr
@@ -0,0 +1,23 @@
+error[E0412]: cannot find type `V` in this scope
+ --> $DIR/issue-112547.rs:8:4
+ |
+LL | }> V: IntoIterator
+ | ^ not found in this scope
+ |
+help: you might be missing a type parameter
+ |
+LL | pub fn bar<V>()
+ | +++
+
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/issue-112547.rs:1:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/issues/issue-11873.rs b/tests/ui/closures/issue-11873.rs
index d3bd05caf..d3bd05caf 100644
--- a/tests/ui/issues/issue-11873.rs
+++ b/tests/ui/closures/issue-11873.rs
diff --git a/tests/ui/issues/issue-11873.stderr b/tests/ui/closures/issue-11873.stderr
index c814eedd2..c814eedd2 100644
--- a/tests/ui/issues/issue-11873.stderr
+++ b/tests/ui/closures/issue-11873.stderr
diff --git a/tests/ui/issues/issue-25439.rs b/tests/ui/closures/issue-25439.rs
index 4f73ff3e3..4f73ff3e3 100644
--- a/tests/ui/issues/issue-25439.rs
+++ b/tests/ui/closures/issue-25439.rs
diff --git a/tests/ui/issues/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr
index dadae23fd..dadae23fd 100644
--- a/tests/ui/issues/issue-25439.stderr
+++ b/tests/ui/closures/issue-25439.stderr
diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr
index 4a578b4d7..ef1cb213f 100644
--- a/tests/ui/closures/issue-90871.stderr
+++ b/tests/ui/closures/issue-90871.stderr
@@ -14,7 +14,7 @@ LL | type_ascribe!(2, n([u8; || 1]))
| ^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-90871.rs:4:29: 4:31]`
+ found closure `{closure@$DIR/issue-90871.rs:4:29: 4:31}`
help: use parentheses to call this closure
|
LL | type_ascribe!(2, n([u8; (|| 1)()]))
diff --git a/tests/ui/closures/print/closure-print-generic-1.stderr b/tests/ui/closures/print/closure-print-generic-1.stderr
index b21734f02..2697f93b1 100644
--- a/tests/ui/closures/print/closure-print-generic-1.stderr
+++ b/tests/ui/closures/print/closure-print-generic-1.stderr
@@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c`
--> $DIR/closure-print-generic-1.rs:17:5
|
LL | let c = to_fn_once(move || {
- | - move occurs because `c` has type `[closure@$DIR/closure-print-generic-1.rs:12:24: 12:31]`, which does not implement the `Copy` trait
+ | - move occurs because `c` has type `{closure@$DIR/closure-print-generic-1.rs:12:24: 12:31}`, which does not implement the `Copy` trait
...
LL | c();
| --- `c` moved due to this call
diff --git a/tests/ui/closures/print/closure-print-generic-2.stderr b/tests/ui/closures/print/closure-print-generic-2.stderr
index e53277a93..ced0be945 100644
--- a/tests/ui/closures/print/closure-print-generic-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-2.stderr
@@ -9,7 +9,7 @@ LL | let c1: () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[closure@$DIR/closure-print-generic-2.rs:5:17: 5:19]`
+ found closure `{closure@$DIR/closure-print-generic-2.rs:5:17: 5:19}`
help: use parentheses to call this closure
|
LL | let c1: () = c();
diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
index 49453b053..6e3659b95 100644
--- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `{mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]}`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-generic-verbose-1.stderr b/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
index 9a1f18fa8..5e8a6b1a7 100644
--- a/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
+++ b/tests/ui/closures/print/closure-print-generic-verbose-1.stderr
@@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c`
--> $DIR/closure-print-generic-verbose-1.rs:17:5
|
LL | let c = to_fn_once(move|| {
- | - move occurs because `c` has type `[f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)]`, which does not implement the `Copy` trait
+ | - move occurs because `c` has type `{f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'?9 str>, T)}`, which does not implement the `Copy` trait
...
LL | c();
| --- `c` moved due to this call
diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
index d2deba3dd..f1fc35e75 100644
--- a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `{f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]}`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-verbose.stderr b/tests/ui/closures/print/closure-print-verbose.stderr
index acc81f5e4..3f9160fe5 100644
--- a/tests/ui/closures/print/closure-print-verbose.stderr
+++ b/tests/ui/closures/print/closure-print-verbose.stderr
@@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this
|
= note: expected fn pointer `fn(u8) -> u8`
- found closure `[main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]`
+ found closure `{main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]}`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-print-verbose.rs:10:39
|
diff --git a/tests/ui/codegen/issue-79865-llvm-miscompile.rs b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
new file mode 100644
index 000000000..b77f09f8e
--- /dev/null
+++ b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
@@ -0,0 +1,38 @@
+// run-pass
+// only-x86_64
+// compile-flags: -C opt-level=3
+
+// Regression test for issue #79865.
+// The assertion will fail when compiled with Rust 1.56..=1.59
+// due to a LLVM miscompilation.
+
+use std::arch::x86_64::*;
+
+fn main() {
+ if is_x86_feature_detected!("avx") {
+ let res: [f64; 4] = unsafe { std::mem::transmute::<_, _>(first()) };
+ assert_eq!(res, [22.0, 44.0, 66.0, 88.0]);
+ }
+}
+
+#[target_feature(enable = "avx")]
+unsafe fn first() -> __m256d {
+ second()
+}
+
+unsafe fn second() -> __m256d {
+ let v0 = _mm256_setr_pd(1.0, 2.0, 3.0, 4.0);
+ let v1 = _mm256_setr_pd(10.0, 20.0, 30.0, 40.0);
+
+ // needs to be called twice to hit the miscompilation
+ let (add, _) = add_sub(v0, v1);
+ let (add, _) = add_sub(add, add);
+ add
+}
+
+#[inline(never)] // needed to hit the miscompilation
+unsafe fn add_sub(v1: __m256d, v0: __m256d) -> (__m256d, __m256d) {
+ let add = _mm256_add_pd(v0, v1);
+ let sub = _mm256_sub_pd(v0, v1);
+ (add, sub)
+}
diff --git a/tests/ui/codegen/subtyping-enforces-type-equality.stderr b/tests/ui/codegen/subtyping-enforces-type-equality.stderr
deleted file mode 100644
index 870ca0f83..000000000
--- a/tests/ui/codegen/subtyping-enforces-type-equality.stderr
+++ /dev/null
@@ -1 +0,0 @@
-WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858
diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
index aa5ec6b5a..646044ae4 100644
--- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
+++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr
@@ -29,10 +29,10 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27
|
LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:14:39]>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:14:39}>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
- found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42]>`
+ found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27
@@ -83,10 +83,10 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:22:27
|
LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _);
- | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:22:30]`
+ | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@coerce-expect-unsized-ascribed.rs:22:30}`
|
= note: expected reference `&dyn Fn(i32) -> u8`
- found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33]`
+ found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27
@@ -119,10 +119,10 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:27:27
|
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:27:36]>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:27:36}>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
- found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39]>`
+ found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39}>`
error: aborting due to 14 previous errors
diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.stderr b/tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr
index bbce4b530..2938bc629 100644
--- a/tests/ui/coherence/coherence-overlap-downstream-inherent.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.next.stderr
@@ -1,5 +1,5 @@
error[E0592]: duplicate definitions with name `dummy`
- --> $DIR/coherence-overlap-downstream-inherent.rs:7:26
+ --> $DIR/coherence-overlap-downstream-inherent.rs:10:26
|
LL | impl<T:Sugar> Sweet<T> { fn dummy(&self) { } }
| ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
@@ -8,7 +8,7 @@ LL | impl<T:Fruit> Sweet<T> { fn dummy(&self) { } }
| --------------- other definition for `dummy`
error[E0592]: duplicate definitions with name `f`
- --> $DIR/coherence-overlap-downstream-inherent.rs:13:38
+ --> $DIR/coherence-overlap-downstream-inherent.rs:16:38
|
LL | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
| ^^^^^^^^^^^ duplicate definitions for `f`
diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr b/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr
new file mode 100644
index 000000000..2938bc629
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.old.stderr
@@ -0,0 +1,23 @@
+error[E0592]: duplicate definitions with name `dummy`
+ --> $DIR/coherence-overlap-downstream-inherent.rs:10:26
+ |
+LL | impl<T:Sugar> Sweet<T> { fn dummy(&self) { } }
+ | ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
+LL |
+LL | impl<T:Fruit> Sweet<T> { fn dummy(&self) { } }
+ | --------------- other definition for `dummy`
+
+error[E0592]: duplicate definitions with name `f`
+ --> $DIR/coherence-overlap-downstream-inherent.rs:16:38
+ |
+LL | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
+ | ^^^^^^^^^^^ duplicate definitions for `f`
+LL |
+LL | impl<X> A<i32, X> { fn f(&self) {} }
+ | ----------- other definition for `f`
+ |
+ = note: downstream crates may implement trait `Bar<_>` for type `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
index 5dea33e33..2c3ef4fd3 100644
--- a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
+++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
index 7f373e595..9d62efbc3 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Sweet`
- --> $DIR/coherence-overlap-downstream.rs:8:1
+ --> $DIR/coherence-overlap-downstream.rs:11:1
|
LL | impl<T:Sugar> Sweet for T { }
| ------------------------- first implementation here
@@ -7,7 +7,7 @@ LL | impl<T:Fruit> Sweet for T { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
- --> $DIR/coherence-overlap-downstream.rs:14:1
+ --> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ----------------------- first implementation here
diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
new file mode 100644
index 000000000..9d62efbc3
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
@@ -0,0 +1,21 @@
+error[E0119]: conflicting implementations of trait `Sweet`
+ --> $DIR/coherence-overlap-downstream.rs:11:1
+ |
+LL | impl<T:Sugar> Sweet for T { }
+ | ------------------------- first implementation here
+LL | impl<T:Fruit> Sweet for T { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
+ --> $DIR/coherence-overlap-downstream.rs:17:1
+ |
+LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
+ | ----------------------- first implementation here
+LL | impl<X> Foo<X> for i32 {}
+ | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
+ |
+ = note: downstream crates may implement trait `Bar<_>` for type `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.rs b/tests/ui/coherence/coherence-overlap-downstream.rs
index 738ec0e3d..a4e559604 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.rs
+++ b/tests/ui/coherence/coherence-overlap-downstream.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even
// though no impls are found.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr
index 3ad818cbc..c02a679c1 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.stderr
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.next.stderr
@@ -1,5 +1,5 @@
error[E0592]: duplicate definitions with name `dummy`
- --> $DIR/coherence-overlap-issue-23516-inherent.rs:9:25
+ --> $DIR/coherence-overlap-issue-23516-inherent.rs:12:25
|
LL | impl<T:Sugar> Cake<T> { fn dummy(&self) { } }
| ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr
new file mode 100644
index 000000000..c02a679c1
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr
@@ -0,0 +1,14 @@
+error[E0592]: duplicate definitions with name `dummy`
+ --> $DIR/coherence-overlap-issue-23516-inherent.rs:12:25
+ |
+LL | impl<T:Sugar> Cake<T> { fn dummy(&self) { } }
+ | ^^^^^^^^^^^^^^^ duplicate definitions for `dummy`
+LL |
+LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
+ | --------------- other definition for `dummy`
+ |
+ = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
index a272e620f..a7c90a6b8 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
+++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.stderr b/tests/ui/coherence/coherence-overlap-issue-23516.next.stderr
index cd3984267..a4e87af8a 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516.stderr
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Sweet` for type `Box<_>`
- --> $DIR/coherence-overlap-issue-23516.rs:8:1
+ --> $DIR/coherence-overlap-issue-23516.rs:11:1
|
LL | impl<T:Sugar> Sweet for T { }
| ------------------------- first implementation here
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr b/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr
new file mode 100644
index 000000000..a4e87af8a
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.old.stderr
@@ -0,0 +1,13 @@
+error[E0119]: conflicting implementations of trait `Sweet` for type `Box<_>`
+ --> $DIR/coherence-overlap-issue-23516.rs:11:1
+ |
+LL | impl<T:Sugar> Sweet for T { }
+ | ------------------------- first implementation here
+LL | impl<U:Sugar> Sweet for Box<U> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
+ |
+ = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.rs b/tests/ui/coherence/coherence-overlap-issue-23516.rs
index 63e42e8f4..c846d3971 100644
--- a/tests/ui/coherence/coherence-overlap-issue-23516.rs
+++ b/tests/ui/coherence/coherence-overlap-issue-23516.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even
// though we see no impl of `Sugar` for `Box`. Therefore, an overlap
// error is reported for the following pair of impls (#23516).
diff --git a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr b/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
index 2e2dac288..a3a37fd27 100644
--- a/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
+++ b/tests/ui/coherence/coherence-unsafe-trait-object-impl.stderr
@@ -6,6 +6,11 @@ LL | takes_t(t);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/coherence-unsafe-trait-object-impl.rs:6:1
+ |
+LL | trait Trait: Sized {
+ | ^^^^^^^^^^^^^^^^^^
note: required by a bound in `takes_t`
--> $DIR/coherence-unsafe-trait-object-impl.rs:10:15
|
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
index 4ddd712b2..0dd28706e 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
- --> $DIR/inter-crate-ambiguity-causes-notes.rs:9:1
+ --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
|
LL | impl From<()> for S {
| ------------------- first implementation here
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
new file mode 100644
index 000000000..0dd28706e
--- /dev/null
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `From<()>` for type `S`
+ --> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
+ |
+LL | impl From<()> for S {
+ | ------------------- first implementation here
+...
+LL | impl<I> From<I> for S
+ | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+ |
+ = note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
index 5b11c78ab..743e80d3f 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
struct S;
impl From<()> for S {
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
index f315ba821..89289767b 100644
--- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
@@ -6,13 +6,11 @@ LL | #[derive(PartialEq, Default)]
...
LL | impl<T, Q> PartialEq<Q> for Interval<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
-...
-LL | Q: ?Sized + PartialOrd,
- | ---------- `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>
= note: impls that are not considered to overlap may be considered to overlap in the future
+ = note: `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
note: the lint level is defined here
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9
|
diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr
index 34debb683..aaf953a66 100644
--- a/tests/ui/confuse-field-and-method/issue-33784.stderr
+++ b/tests/ui/confuse-field-and-method/issue-33784.stderr
@@ -1,4 +1,4 @@
-error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
+error[E0599]: no method named `closure` found for reference `&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope
--> $DIR/issue-33784.rs:27:7
|
LL | p.closure();
@@ -9,7 +9,7 @@ help: to call the function stored in `closure`, surround the field access with p
LL | (p.closure)();
| + +
-error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
+error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope
--> $DIR/issue-33784.rs:29:7
|
LL | q.fn_ptr();
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
index 0da68ae75..c4d2d02ba 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
@@ -5,7 +5,7 @@ fn check(_: impl std::marker::ConstParamTy) {}
fn main() {
check(main); //~ error: `fn() {main}` can't be used as a const parameter type
- check(|| {}); //~ error: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type
+ check(|| {}); //~ error: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
check(main as fn()); //~ error: `fn()` can't be used as a const parameter type
check(&mut ()); //~ error: `&mut ()` can't be used as a const parameter type
check(&mut () as *mut ()); //~ error: `*mut ()` can't be used as a const parameter type
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
index 48910b82a..d96491f4f 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr
@@ -16,11 +16,11 @@ help: use parentheses to call this function
LL | check(main());
| ++
-error[E0277]: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type
+error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:8:11
|
LL | check(|| {});
- | ----- ^^^^^ the trait `ConstParamTy` is not implemented for closure `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]`
+ | ----- ^^^^^ the trait `ConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
index 08f7c5cb5..7174d1ec4 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
@@ -10,10 +10,12 @@ struct CantParam(ImplementsConstParamTy);
impl std::marker::ConstParamTy for CantParam {}
//~^ error: the type `CantParam` does not `#[derive(Eq)]`
//~| error: the type `CantParam` does not `#[derive(PartialEq)]`
+//~| the trait bound `CantParam: Eq` is not satisfied
#[derive(std::marker::ConstParamTy)]
//~^ error: the type `CantParamDerive` does not `#[derive(Eq)]`
//~| error: the type `CantParamDerive` does not `#[derive(PartialEq)]`
+//~| the trait bound `CantParamDerive: Eq` is not satisfied
struct CantParamDerive(ImplementsConstParamTy);
fn check<T: std::marker::ConstParamTy>() {}
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
index 43c5b96dc..2cf7cc07d 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `CantParam: Eq` is not satisfied
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
+ |
+LL | impl std::marker::ConstParamTy for CantParam {}
+ | ^^^^^^^^^ the trait `Eq` is not implemented for `CantParam`
+ |
+note: required by a bound in `ConstParamTy`
+ --> $SRC_DIR/core/src/marker.rs:LL:COL
+help: consider annotating `CantParam` with `#[derive(Eq)]`
+ |
+LL + #[derive(Eq)]
+LL | struct CantParam(ImplementsConstParamTy);
+ |
+
error[E0277]: the type `CantParam` does not `#[derive(PartialEq)]`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
|
@@ -16,8 +30,23 @@ LL | impl std::marker::ConstParamTy for CantParam {}
note: required by a bound in `ConstParamTy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
+error[E0277]: the trait bound `CantParamDerive: Eq` is not satisfied
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
+ |
+LL | #[derive(std::marker::ConstParamTy)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
+ |
+note: required by a bound in `ConstParamTy`
+ --> $SRC_DIR/core/src/marker.rs:LL:COL
+ = note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider annotating `CantParamDerive` with `#[derive(Eq)]`
+ |
+LL + #[derive(Eq)]
+LL | struct CantParamDerive(ImplementsConstParamTy);
+ |
+
error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
- --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive`
@@ -27,7 +56,7 @@ note: required by a bound in `ConstParamTy`
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the type `CantParamDerive` does not `#[derive(Eq)]`
- --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
+ --> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParamDerive`
@@ -36,6 +65,6 @@ note: required by a bound in `ConstParamTy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 4 previous errors
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs
new file mode 100644
index 000000000..a83830178
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.rs
@@ -0,0 +1,44 @@
+// Test that when adt_const_params is not enabled, we suggest adding the feature only when
+// it would be possible for the type to be used as a const generic or when it's likely
+// possible for the user to fix their type to be used.
+
+// Can never be used as const generics.
+fn uwu_0<const N: &'static mut ()>() {}
+//~^ ERROR: forbidden as the type of a const generic
+
+// Needs the feature but can be used, so suggest adding the feature.
+fn owo_0<const N: &'static u32>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// Can only be used in const generics with changes.
+struct Meow {
+ meow: u8,
+}
+
+fn meow_0<const N: Meow>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_1<const N: &'static Meow>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_2<const N: [Meow; 100]>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+fn meow_3<const N: (Meow, u8)>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// This is suboptimal that it thinks it can be used
+// but better to suggest the feature to the user.
+fn meow_4<const N: (Meow, String)>() {}
+//~^ ERROR: forbidden as the type of a const generic
+//~^^ HELP: add `#![feature(adt_const_params)]`
+
+// Non-local ADT that does not impl `ConstParamTy`
+fn nya_0<const N: String>() {}
+//~^ ERROR: forbidden as the type of a const generic
+fn nya_1<const N: Vec<u32>>() {}
+//~^ ERROR: forbidden as the type of a const generic
+
+fn main() {}
diff --git a/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr
new file mode 100644
index 000000000..04527e315
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/suggest_feature_only_when_possible.stderr
@@ -0,0 +1,80 @@
+error: `&'static mut ()` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:6:19
+ |
+LL | fn uwu_0<const N: &'static mut ()>() {}
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: `&'static u32` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:10:19
+ |
+LL | fn owo_0<const N: &'static u32>() {}
+ | ^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `Meow` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:19:20
+ |
+LL | fn meow_0<const N: Meow>() {}
+ | ^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `&'static Meow` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:22:20
+ |
+LL | fn meow_1<const N: &'static Meow>() {}
+ | ^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `[Meow; 100]` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:25:20
+ |
+LL | fn meow_2<const N: [Meow; 100]>() {}
+ | ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `(Meow, u8)` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:28:20
+ |
+LL | fn meow_3<const N: (Meow, u8)>() {}
+ | ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `(Meow, String)` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:34:20
+ |
+LL | fn meow_4<const N: (Meow, String)>() {}
+ | ^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+
+error: `String` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:39:19
+ |
+LL | fn nya_0<const N: String>() {}
+ | ^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: `Vec<u32>` is forbidden as the type of a const generic parameter
+ --> $DIR/suggest_feature_only_when_possible.rs:41:19
+ |
+LL | fn nya_1<const N: Vec<u32>>() {}
+ | ^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
index 656bc2946..ffe452859 100644
--- a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
+++ b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr
@@ -35,7 +35,7 @@ LL | struct A<const N: &u8>;
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:14:15
@@ -44,7 +44,7 @@ LL | impl<const N: &u8> A<N> {
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:22:15
@@ -53,7 +53,7 @@ LL | impl<const N: &u8> B for A<N> {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:26:17
@@ -62,7 +62,7 @@ LL | fn bar<const N: &u8>() {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:17:21
@@ -71,7 +71,7 @@ LL | fn foo<const M: &u8>(&self) {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 10 previous errors
diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
index f829526ca..daeeadeed 100644
--- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
+++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
@@ -21,7 +21,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `[u8; N]` is forbidden as the type of a const generic parameter
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
@@ -30,7 +30,7 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
index d8eebeb0d..b3a275660 100644
--- a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
+++ b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `[Adt; std::mem::size_of::<Self::Assoc>()]: Foo` is not satisfied
- --> $DIR/dont-evaluate-array-len-on-err-1.rs:15:9
+ --> $DIR/dont-evaluate-array-len-on-err-1.rs:15:10
|
LL | <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; std::mem::size_of::<Self::Assoc>()]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; std::mem::size_of::<Self::Assoc>()]`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/dont-evaluate-array-len-on-err-1.rs:9:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/const-generics/early/const-param-from-outer-fn.rs b/tests/ui/const-generics/early/const-param-from-outer-fn.rs
index c3b418ee3..ee57f3c4f 100644
--- a/tests/ui/const-generics/early/const-param-from-outer-fn.rs
+++ b/tests/ui/const-generics/early/const-param-from-outer-fn.rs
@@ -1,6 +1,6 @@
fn foo<const X: u32>() {
fn bar() -> u32 {
- X //~ ERROR can't use generic parameters from outer function
+ X //~ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
index e3bf38b70..826f26579 100644
--- a/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
+++ b/tests/ui/const-generics/early/const-param-from-outer-fn.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/const-param-from-outer-fn.rs:3:9
|
LL | fn foo<const X: u32>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | fn bar() -> u32 {
- | - help: try using a local generic parameter instead: `<X>`
+ | - help: try introducing a local generic parameter here: `<X>`
LL | X
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to previous error
diff --git a/tests/ui/const-generics/exhaustive-value.stderr b/tests/ui/const-generics/exhaustive-value.stderr
index 4a26e0977..deb65ddba 100644
--- a/tests/ui/const-generics/exhaustive-value.stderr
+++ b/tests/ui/const-generics/exhaustive-value.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `(): Foo<N>` is not satisfied
- --> $DIR/exhaustive-value.rs:262:5
+ --> $DIR/exhaustive-value.rs:262:6
|
LL | <() as Foo<N>>::test()
- | ^^^^^^^^^^^^^^^^^^^^ the trait `Foo<N>` is not implemented for `()`
+ | ^^ the trait `Foo<N>` is not implemented for `()`
|
= help: the following other types implement trait `Foo<N>`:
<() as Foo<0>>
diff --git a/tests/ui/const-generics/float-generic.simple.stderr b/tests/ui/const-generics/float-generic.simple.stderr
index 89ca36b0f..aeb19dc75 100644
--- a/tests/ui/const-generics/float-generic.simple.stderr
+++ b/tests/ui/const-generics/float-generic.simple.stderr
@@ -5,7 +5,6 @@ LL | fn foo<const F: f32>() {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/fn-const-param-call.min.stderr b/tests/ui/const-generics/fn-const-param-call.min.stderr
index d984449e6..2d316fba1 100644
--- a/tests/ui/const-generics/fn-const-param-call.min.stderr
+++ b/tests/ui/const-generics/fn-const-param-call.min.stderr
@@ -3,12 +3,16 @@ error: using function pointers as const generic parameters is forbidden
|
LL | struct Wrapper<const F: fn() -> u32>;
| ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:13:15
|
LL | impl<const F: fn() -> u32> Wrapper<F> {
| ^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/fn-const-param-infer.min.stderr b/tests/ui/const-generics/fn-const-param-infer.min.stderr
index f0767a109..a7afa4842 100644
--- a/tests/ui/const-generics/fn-const-param-infer.min.stderr
+++ b/tests/ui/const-generics/fn-const-param-infer.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
index 956e9c9c9..64d1e0bcf 100644
--- a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr
@@ -23,7 +23,7 @@ LL | struct B<const CFG: Config> {
| ^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 3 previous errors
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
index e5464a425..8023b998a 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
@@ -1,12 +1,6 @@
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub struct Const<const U: u8>;
@@ -21,7 +15,6 @@ where
{
type AssocTy = Const<{ my_const_fn(U) }>;
//~^ ERROR private type
- //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
fn assoc_fn() -> Self::AssocTy {
Const
}
diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
index 16fae6b5c..2d9de8805 100644
--- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr
@@ -1,5 +1,5 @@
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
- --> $DIR/eval-privacy.rs:22:5
+ --> $DIR/eval-privacy.rs:16:5
|
LL | type AssocTy = Const<{ my_const_fn(U) }>;
| ^^^^^^^^^^^^ can't leak private type
@@ -7,23 +7,6 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
LL | const fn my_const_fn(val: u8) -> u8 {
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
- --> $DIR/eval-privacy.rs:22:5
- |
-LL | type AssocTy = Const<{ my_const_fn(U) }>;
- | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
- |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
- --> $DIR/eval-privacy.rs:30:1
- |
-LL | const fn my_const_fn(val: u8) -> u8 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/eval-privacy.rs:5:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
index e50ac671e..9391b1c1a 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr
@@ -6,7 +6,11 @@ LL | writes_to_specific_path(&cap);
| |
| required by a bound introduced by this call
|
- = help: the trait `Delegates<U>` is implemented for `T`
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-85848.rs:4:1
+ |
+LL | trait _Contains<T> {
+ | ^^^^^^^^^^^^^^^^^^
note: required for `&C` to implement `Contains<(), true>`
--> $DIR/issue-85848.rs:21:12
|
diff --git a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
index b8a1027c9..4c45339b9 100644
--- a/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
+++ b/tests/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr
@@ -14,7 +14,7 @@ LL | trait Trait<const S: &'static str> {}
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index 42ad4d61c..796966b22 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -4,6 +4,7 @@ error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
LL | *(B as *const bool as *mut bool) = false;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
error[E0080]: evaluation of constant value failed
diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr
index 71a7051f2..fc10aba0f 100644
--- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr
+++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr
@@ -13,7 +13,7 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr
index 9c0e5179c..eb8b9732f 100644
--- a/tests/ui/const-generics/issues/issue-62878.min.stderr
+++ b/tests/ui/const-generics/issues/issue-62878.min.stderr
@@ -13,7 +13,7 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
index 9f6c7ccf3..9d80f1cd0 100644
--- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
+++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
@@ -5,7 +5,7 @@ LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
index df04c4896..c8b9f1719 100644
--- a/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
+++ b/tests/ui/const-generics/issues/issue-68615-adt.min.stderr
@@ -5,7 +5,7 @@ LL | struct Const<const V: [usize; 0]> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-68615-array.min.stderr b/tests/ui/const-generics/issues/issue-68615-array.min.stderr
index 1b4517087..fc6cef9d4 100644
--- a/tests/ui/const-generics/issues/issue-68615-array.min.stderr
+++ b/tests/ui/const-generics/issues/issue-68615-array.min.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const V: [usize; 0] > {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr
index ebfb24bec..bba92f32a 100644
--- a/tests/ui/const-generics/issues/issue-71169.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71169.min.stderr
@@ -13,7 +13,7 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-71381.min.stderr b/tests/ui/const-generics/issues/issue-71381.min.stderr
index e1e140071..e16d3b7a8 100644
--- a/tests/ui/const-generics/issues/issue-71381.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71381.min.stderr
@@ -19,12 +19,16 @@ error: using function pointers as const generic parameters is forbidden
|
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-71381.rs:23:19
|
LL | const FN: unsafe extern "C" fn(Args),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/issues/issue-71382.min.stderr b/tests/ui/const-generics/issues/issue-71382.min.stderr
index 715037bd5..217166d84 100644
--- a/tests/ui/const-generics/issues/issue-71382.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71382.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn test<const FN: fn()>(&self) {
| ^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-71611.min.stderr b/tests/ui/const-generics/issues/issue-71611.min.stderr
index b33d7cf98..b01936f4d 100644
--- a/tests/ui/const-generics/issues/issue-71611.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71611.min.stderr
@@ -11,6 +11,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
| ^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-72352.min.stderr b/tests/ui/const-generics/issues/issue-72352.min.stderr
index eedd73c4d..b010996b8 100644
--- a/tests/ui/const-generics/issues/issue-72352.min.stderr
+++ b/tests/ui/const-generics/issues/issue-72352.min.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize {
| ^^^^^^^^^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-73491.min.stderr b/tests/ui/const-generics/issues/issue-73491.min.stderr
index f03354fc4..fdf057bdb 100644
--- a/tests/ui/const-generics/issues/issue-73491.min.stderr
+++ b/tests/ui/const-generics/issues/issue-73491.min.stderr
@@ -5,7 +5,7 @@ LL | fn hoge<const IN: [u32; LEN]>() {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
index 0a7db6247..bed0a02a7 100644
--- a/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
+++ b/tests/ui/const-generics/issues/issue-73727-static-reference-array-const-param.min.stderr
@@ -5,7 +5,7 @@ LL | fn a<const X: &'static [u32]>() {}
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-74101.min.stderr b/tests/ui/const-generics/issues/issue-74101.min.stderr
index 134c24834..7852ce5bc 100644
--- a/tests/ui/const-generics/issues/issue-74101.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74101.min.stderr
@@ -5,7 +5,7 @@ LL | fn test<const N: [u8; 1 + 2]>() {}
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `[u8; 1 + 2]` is forbidden as the type of a const generic parameter
--> $DIR/issue-74101.rs:9:21
@@ -14,7 +14,7 @@ LL | struct Foo<const N: [u8; 1 + 2]>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/issues/issue-74255.min.stderr b/tests/ui/const-generics/issues/issue-74255.min.stderr
index bbcf8682b..affeca167 100644
--- a/tests/ui/const-generics/issues/issue-74255.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74255.min.stderr
@@ -5,7 +5,7 @@ LL | fn ice_struct_fn<const I: IceEnum>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr
index c37ee93d4..a5dbe10b7 100644
--- a/tests/ui/const-generics/issues/issue-74950.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74950.min.stderr
@@ -5,7 +5,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -14,7 +14,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -23,7 +23,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -32,7 +32,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -41,7 +41,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 5 previous errors
diff --git a/tests/ui/const-generics/issues/issue-75047.min.stderr b/tests/ui/const-generics/issues/issue-75047.min.stderr
index 46af19ef3..e316b4624 100644
--- a/tests/ui/const-generics/issues/issue-75047.min.stderr
+++ b/tests/ui/const-generics/issues/issue-75047.min.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; Bar::<u32>::value()]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/issues/issue-86530.stderr b/tests/ui/const-generics/issues/issue-86530.stderr
index 620ed4f0f..d02808f7c 100644
--- a/tests/ui/const-generics/issues/issue-86530.stderr
+++ b/tests/ui/const-generics/issues/issue-86530.stderr
@@ -6,6 +6,11 @@ LL | z(" ");
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-86530.rs:4:1
+ |
+LL | pub trait X {
+ | ^^^^^^^^^^^
note: required by a bound in `z`
--> $DIR/issue-86530.rs:10:8
|
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs
index 4fdf603b0..443c755c6 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.rs
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs
@@ -1,28 +1,13 @@
-// failure-status: 101
// known-bug: unknown
-// error-pattern:internal compiler error
-// normalize-stderr-test "internal compiler error.*" -> ""
-// normalize-stderr-test "DefId\([^)]*\)" -> "..."
-// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
-// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
-// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
-// normalize-stderr-test "stack backtrace:\n" -> ""
-// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
-// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n[ ]*\n" -> ""
-// normalize-stderr-test "compiler/.*: projection" -> "projection"
-// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
-// normalize-stderr-test "error: [\s\n]*query stack during panic:\n" -> ""
-// this should run-pass
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
-const fn inner<'a>() -> usize where &'a (): Sized {
+const fn inner<'a>() -> usize
+where
+ &'a (): Sized,
+{
3
}
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
index ac406bf2b..e15496454 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.stderr
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
@@ -1,10 +1,20 @@
-#0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}`
-#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}`
-#2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE
-#3 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
-#4 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
-#5 [eval_to_valtree] evaluating type-level constant
-#6 [typeck] type-checking `test`
-#7 [analysis] running analysis passes on this crate
-end of query stack
-error: aborting due to previous error \ No newline at end of file
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/in_closure.rs:16:29
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _ = || {
+LL | let _: [u8; inner::<'a>()];
+ | ^^
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/in_closure.rs:17:29
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+...
+LL | let _ = [0; inner::<'a>()];
+ | ^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
new file mode 100644
index 000000000..b81aa50d9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
@@ -0,0 +1,13 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait MyTrait<T> {}
+
+fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+ todo!()
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
new file mode 100644
index 000000000..21c8fe686
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
@@ -0,0 +1,8 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/late-bound-in-return-issue-77357.rs:9:53
+ |
+LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+ | -- lifetime defined here ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
new file mode 100644
index 000000000..89f01748f
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
@@ -0,0 +1,15 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+fn bug<'a>()
+where
+ for<'b> [(); {
+ let x: &'b ();
+ 0
+ }]:
+{}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
new file mode 100644
index 000000000..a66dc8db9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/late-bound-in-where-issue-83993.rs:10:17
+ |
+LL | for<'b> [(); {
+ | -- lifetime defined here
+LL | let x: &'b ();
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs
index 544073b5a..a562bd8cb 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.rs
+++ b/tests/ui/const-generics/late-bound-vars/simple.rs
@@ -1,22 +1,13 @@
-// failure-status: 101
// known-bug: unknown
-// error-pattern:internal compiler error
-// normalize-stderr-test "internal compiler error.*" -> ""
-// normalize-stderr-test "DefId\([^)]*\)" -> "..."
-// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
-// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
-// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
-// normalize-stderr-test "stack backtrace:\n" -> ""
-// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
-// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n\n[ ]*\n" -> ""
-// normalize-stderr-test "compiler/.*: projection" -> "projection"
-// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
-// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack"
+
+// If we want this to compile, then we'd need to do something like RPITs do,
+// where nested associated constants have early-bound versions of their captured
+// late-bound vars inserted into their generics. This gives us substitutable
+// lifetimes to actually use when borrow-checking the associated const, which is
+// lowered as a totally separate body from its parent. Since this doesn't exist,
+// we should just error rather than resolving this late-bound var with no
+// binder to actually attach it to, or worse, as a free region that can't even be
+// substituted correctly, and ICEing. - @compiler-errors
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
diff --git a/tests/ui/const-generics/late-bound-vars/simple.stderr b/tests/ui/const-generics/late-bound-vars/simple.stderr
index c9f2164b6..e72e37363 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.stderr
+++ b/tests/ui/const-generics/late-bound-vars/simple.stderr
@@ -1,12 +1,19 @@
-error: query stack during panic:
-#0 [mir_borrowck] borrow-checking `test::{constant#1}`
-#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{constant#1}`
-#2 [mir_for_ctfe] caching mir of `test::{constant#1}` for CTFE
-#3 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
-#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
-#5 [eval_to_valtree] evaluating type-level constant
-#6 [typeck] type-checking `test`
-#7 [analysis] running analysis passes on this crate
-end of query stack
-error: aborting due to previous error
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/simple.rs:20:25
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _: [u8; inner::<'a>()];
+ | ^^
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/simple.rs:21:25
+ |
+LL | fn test<'a>() {
+ | -- lifetime defined here
+LL | let _: [u8; inner::<'a>()];
+LL | let _ = [0; inner::<'a>()];
+ | ^^
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/lifetime-in-const-param.stderr b/tests/ui/const-generics/lifetime-in-const-param.stderr
index 8fd9068e8..c2fcdcf1a 100644
--- a/tests/ui/const-generics/lifetime-in-const-param.stderr
+++ b/tests/ui/const-generics/lifetime-in-const-param.stderr
@@ -11,7 +11,7 @@ LL | struct S<'a, const N: S2>(&'a ());
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/min_const_generics/complex-types.stderr b/tests/ui/const-generics/min_const_generics/complex-types.stderr
index 4ddbadb54..8cc75dbaf 100644
--- a/tests/ui/const-generics/min_const_generics/complex-types.stderr
+++ b/tests/ui/const-generics/min_const_generics/complex-types.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; 0]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:6:21
@@ -14,7 +14,7 @@ LL | struct Bar<const N: ()>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `No` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:11:21
@@ -23,7 +23,7 @@ LL | struct Fez<const N: No>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:14:21
@@ -32,7 +32,7 @@ LL | struct Faz<const N: &'static u8>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `!` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:17:21
@@ -41,7 +41,6 @@ LL | struct Fiz<const N: !>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:20:19
@@ -50,7 +49,7 @@ LL | enum Goo<const N: ()> { A, B }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:23:20
@@ -59,7 +58,7 @@ LL | union Boo<const N: ()> { a: () }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 7 previous errors
diff --git a/tests/ui/const-generics/nested-type.min.stderr b/tests/ui/const-generics/nested-type.min.stderr
index 257a9e31e..ca5af5f96 100644
--- a/tests/ui/const-generics/nested-type.min.stderr
+++ b/tests/ui/const-generics/nested-type.min.stderr
@@ -30,7 +30,7 @@ LL | | }]>;
| |__^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/projection-as-arg-const.stderr b/tests/ui/const-generics/projection-as-arg-const.stderr
index 803ed9c95..9f727231e 100644
--- a/tests/ui/const-generics/projection-as-arg-const.stderr
+++ b/tests/ui/const-generics/projection-as-arg-const.stderr
@@ -5,7 +5,6 @@ LL | pub fn foo<const X: <i32 as Identity>::Identity>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
index 04bc46cb4..1eb238255 100644
--- a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
+++ b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr
@@ -3,12 +3,16 @@ error: using raw pointers as const generic parameters is forbidden
|
LL | struct Const<const P: *const u32>;
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: using raw pointers as const generic parameters is forbidden
--> $DIR/raw-ptr-const-param-deref.rs:11:15
|
LL | impl<const P: *const u32> Const<P> {
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/raw-ptr-const-param.min.stderr b/tests/ui/const-generics/raw-ptr-const-param.min.stderr
index 310422aaf..13fbc34e5 100644
--- a/tests/ui/const-generics/raw-ptr-const-param.min.stderr
+++ b/tests/ui/const-generics/raw-ptr-const-param.min.stderr
@@ -3,6 +3,8 @@ error: using raw pointers as const generic parameters is forbidden
|
LL | struct Const<const P: *const u32>;
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
index fed802f6a..3c086f59b 100644
--- a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
+++ b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr
@@ -5,7 +5,7 @@ LL | struct ConstString<const T: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static [u8]` is forbidden as the type of a const generic parameter
--> $DIR/slice-const-param-mismatch.rs:9:28
@@ -14,7 +14,7 @@ LL | struct ConstBytes<const T: &'static [u8]>;
| ^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/std/const-generics-range.min.stderr b/tests/ui/const-generics/std/const-generics-range.min.stderr
index 53fca6e88..d45f74924 100644
--- a/tests/ui/const-generics/std/const-generics-range.min.stderr
+++ b/tests/ui/const-generics/std/const-generics-range.min.stderr
@@ -5,7 +5,7 @@ LL | struct _Range<const R: std::ops::Range<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeFrom<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:13:28
@@ -14,7 +14,7 @@ LL | struct _RangeFrom<const R: std::ops::RangeFrom<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeFull` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:18:28
@@ -23,7 +23,7 @@ LL | struct _RangeFull<const R: std::ops::RangeFull>;
| ^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:24:33
@@ -32,7 +32,7 @@ LL | struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeTo<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:29:26
@@ -41,7 +41,7 @@ LL | struct _RangeTo<const R: std::ops::RangeTo<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `RangeToInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:34:35
@@ -50,7 +50,7 @@ LL | struct _RangeToInclusive<const R: std::ops::RangeToInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 6 previous errors
diff --git a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
index 039c4276c..f18e14946 100644
--- a/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
+++ b/tests/ui/const-generics/transmute-const-param-static-reference.min.stderr
@@ -5,7 +5,7 @@ LL | struct Const<const P: &'static ()>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
index b8fbb3979..6490592c1 100644
--- a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
+++ b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr
@@ -5,7 +5,7 @@ LL | trait Get<'a, const N: &'static str> {
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/issue-71348.rs:18:25
@@ -14,7 +14,7 @@ LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Ta
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/type-dependent/issue-71382.stderr b/tests/ui/const-generics/type-dependent/issue-71382.stderr
index ad522aead..3f42feea5 100644
--- a/tests/ui/const-generics/type-dependent/issue-71382.stderr
+++ b/tests/ui/const-generics/type-dependent/issue-71382.stderr
@@ -3,6 +3,8 @@ error: using function pointers as const generic parameters is forbidden
|
LL | fn test<const FN: fn() -> u8>(&self) -> u8 {
| ^^^^^^^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
error: aborting due to previous error
diff --git a/tests/ui/const_prop/dont-propagate-generic-instance-2.rs b/tests/ui/const_prop/dont-propagate-generic-instance-2.rs
new file mode 100644
index 000000000..e5525af23
--- /dev/null
+++ b/tests/ui/const_prop/dont-propagate-generic-instance-2.rs
@@ -0,0 +1,26 @@
+// run-pass
+
+#![feature(inline_const)]
+
+// Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls.
+// This is relevant when we have an overlapping impl and builtin dyn instance.
+// See <https://github.com/rust-lang/rust/pull/114941> for more context.
+
+trait Trait {
+ fn foo(&self) -> &'static str;
+}
+
+impl<T: ?Sized> Trait for T {
+ fn foo(&self) -> &'static str {
+ std::any::type_name::<T>()
+ }
+}
+
+fn bar<T: ?Sized>() -> fn(&T) -> &'static str {
+ const { Trait::foo as fn(&T) -> &'static str }
+ // If const prop were to propagate the instance
+}
+
+fn main() {
+ assert_eq!("i32", bar::<dyn Trait>()(&1i32));
+}
diff --git a/tests/ui/const_prop/dont-propagate-generic-instance.rs b/tests/ui/const_prop/dont-propagate-generic-instance.rs
new file mode 100644
index 000000000..5994961b8
--- /dev/null
+++ b/tests/ui/const_prop/dont-propagate-generic-instance.rs
@@ -0,0 +1,24 @@
+// run-pass
+
+// Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls.
+// This is relevant when we have an overlapping impl and builtin dyn instance.
+// See <https://github.com/rust-lang/rust/pull/114941> for more context.
+
+trait Trait {
+ fn foo(&self) -> &'static str;
+}
+
+impl<T: ?Sized> Trait for T {
+ fn foo(&self) -> &'static str {
+ std::any::type_name::<T>()
+ }
+}
+
+const fn bar<T: ?Sized>() -> fn(&T) -> &'static str {
+ Trait::foo
+ // If const prop were to propagate the instance
+}
+
+fn main() {
+ assert_eq!("i32", bar::<dyn Trait>()(&1i32));
+}
diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr
index 70aec91e2..3c03b03de 100644
--- a/tests/ui/consts/assert-type-intrinsics.stderr
+++ b/tests/ui/consts/assert-type-intrinsics.stderr
@@ -2,19 +2,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:12:9
|
LL | MaybeUninit::<!>::uninit().assume_init();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:12:36
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:16:9
|
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:16:9
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:20:9
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:20:9
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.rs b/tests/ui/consts/assoc-const-elided-lifetime.rs
new file mode 100644
index 000000000..10cd33a8f
--- /dev/null
+++ b/tests/ui/consts/assoc-const-elided-lifetime.rs
@@ -0,0 +1,19 @@
+#![deny(elided_lifetimes_in_associated_constant)]
+
+use std::marker::PhantomData;
+
+struct Foo<'a> {
+ x: PhantomData<&'a ()>,
+}
+
+impl<'a> Foo<'a> {
+ const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+ //~^ ERROR `'_` cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+ const BAR: &() = &();
+ //~^ ERROR `&` without an explicit lifetime name cannot be used here
+ //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+fn main() {}
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr
new file mode 100644
index 000000000..a1eeaff4b
--- /dev/null
+++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr
@@ -0,0 +1,33 @@
+error: `'_` cannot be used here
+ --> $DIR/assoc-const-elided-lifetime.rs:10:20
+ |
+LL | const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+note: the lint level is defined here
+ --> $DIR/assoc-const-elided-lifetime.rs:1:9
+ |
+LL | #![deny(elided_lifetimes_in_associated_constant)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: use the `'static` lifetime
+ |
+LL | const FOO: Foo<'static> = Foo { x: PhantomData::<&()> };
+ | ~~~~~~~
+
+error: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/assoc-const-elided-lifetime.rs:14:16
+ |
+LL | const BAR: &() = &();
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
+help: use the `'static` lifetime
+ |
+LL | const BAR: &'static () = &();
+ | +++++++
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr
index 149d3b523..85bc56bae 100644
--- a/tests/ui/consts/const-err-late.stderr
+++ b/tests/ui/consts/const-err-late.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `S::<i32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:16
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
@@ -16,13 +16,13 @@ error[E0080]: evaluation of `S::<u32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:31
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-late.rs:19:16
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
diff --git a/tests/ui/consts/const-err-multi.stderr b/tests/ui/consts/const-err-multi.stderr
index 28af8e5eb..1ad504b3a 100644
--- a/tests/ui/consts/const-err-multi.stderr
+++ b/tests/ui/consts/const-err-multi.stderr
@@ -4,19 +4,19 @@ error[E0080]: evaluation of constant value failed
LL | pub const A: i8 = -i8::MIN;
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:3:19
|
LL | pub const B: i8 = A;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:5:19
|
LL | pub const C: u8 = A as u8;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-err-multi.rs:7:24
|
LL | pub const D: i8 = 50 - A;
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs
new file mode 100644
index 000000000..0bf2f0e66
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.rs
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+
+struct Bug([u8; panic!{"\t"}]);
+//~^ ERROR evaluation of constant value failed
+//~| NOTE: in this expansion of panic!
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
new file mode 100644
index 000000000..82c63dd17
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const_panic-normalize-tabs-115498.rs:3:17
+ |
+LL | struct Bug([u8; panic!{"\t"}]);
+ | ^^^^^^^^^^^^ the evaluated program panicked at ' ', $DIR/const_panic-normalize-tabs-115498.rs:3:17
+ |
+ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (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 E0080`.
diff --git a/tests/ui/consts/const-eval/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr
index 770f95062..0e31520fd 100644
--- a/tests/ui/consts/const-eval/erroneous-const.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/erroneous-const.rs:13:13
|
LL | PrintName::<T>::VOID;
diff --git a/tests/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr
index 082c28765..4ca44694c 100644
--- a/tests/ui/consts/const-eval/erroneous-const2.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const2.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/erroneous-const2.rs:13:9
|
LL | PrintName::<i32>::VOID;
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index f3952809e..c7aaee942 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<Bar<u16, u8> as Foo>::AMT` failed
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
@@ -18,7 +18,7 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.stderr
index 956f7aec9..450fb0023 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
LL | const BAR: usize = [5, 6, 7][T::BOO];
| ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-50814-2.rs:18:6
|
LL | &<A<T> as Foo<T>>::BAR
diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr
index 05b6271f4..48a20d0bb 100644
--- a/tests/ui/consts/const-eval/issue-50814.stderr
+++ b/tests/ui/consts/const-eval/issue-50814.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
LL | const MAX: u8 = A::MAX + B::MAX;
| ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-50814.rs:20:6
|
LL | &Sum::<U8, U8>::MAX
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
index 1abe708d1..88ce5b0d8 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
@@ -11,5 +11,5 @@ impl PrintName {
}
fn main() {
- let _ = PrintName::VOID; //~ erroneous constant used
+ let _ = PrintName::VOID; //~ erroneous constant encountered
}
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index 7c36a3a42..4706497db 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -6,13 +6,13 @@ LL | const VOID: ! = panic!();
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:14:13
|
LL | let _ = PrintName::VOID;
| ^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/panic-assoc-never-type.rs:14:13
|
LL | let _ = PrintName::VOID;
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index e087a0ebe..042e7eeb3 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:160:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:166:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾ALLOC_ID╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:170:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 4c655161f..8426a9505 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:160:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:166:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾ALLOC_ID╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/raw-bytes.rs:170:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
deleted file mode 100644
index b3df41304..000000000
--- a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:19:1
- |
-LL | const UNINIT_INT_0: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 12, align: 4) {
- __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:24:1
- |
-LL | const UNINIT_INT_1: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 12, align: 4) {
- 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....░....░.
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:42:1
- |
-LL | const UNINIT_INT_2: [u32; 3] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 12, align: 4) {
- 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........░
- }
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-int-array.rs b/tests/ui/consts/const-eval/ub-int-array.rs
index adcf376b9..cde0749dc 100644
--- a/tests/ui/consts/const-eval/ub-int-array.rs
+++ b/tests/ui/consts/const-eval/ub-int-array.rs
@@ -1,4 +1,3 @@
-// stderr-per-bitwidth
//! Test the "array of int" fast path in validity checking, and in particular whether it
//! points at the right array element.
@@ -19,7 +18,12 @@ impl<T: Copy> MaybeUninit<T> {
const UNINIT_INT_0: [u32; 3] = unsafe {
//~^ ERROR it is undefined behavior to use this value
//~| invalid value at [0]
- mem::transmute([MaybeUninit { uninit: () }, MaybeUninit::new(1), MaybeUninit::new(2)])
+ mem::transmute([
+ MaybeUninit { uninit: () },
+ // Constants chosen to achieve endianness-independent hex dump.
+ MaybeUninit::new(0x11111111),
+ MaybeUninit::new(0x22222222),
+ ])
};
const UNINIT_INT_1: [u32; 3] = unsafe {
//~^ ERROR it is undefined behavior to use this value
diff --git a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr b/tests/ui/consts/const-eval/ub-int-array.stderr
index b3df41304..c8efd7e1b 100644
--- a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.stderr
@@ -1,16 +1,16 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:19:1
+ --> $DIR/ub-int-array.rs:18:1
|
LL | const UNINIT_INT_0: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 12, align: 4) {
- __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
+ __ __ __ __ 11 11 11 11 22 22 22 22 │ ░░░░....""""
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:24:1
+ --> $DIR/ub-int-array.rs:28:1
|
LL | const UNINIT_INT_1: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
@@ -21,7 +21,7 @@ LL | const UNINIT_INT_1: [u32; 3] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:42:1
+ --> $DIR/ub-int-array.rs:46:1
|
LL | const UNINIT_INT_2: [u32; 3] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 0ee1e6087..6d5c36cea 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -60,7 +60,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-ref-ptr.rs:36:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
@@ -75,7 +75,7 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-ref-ptr.rs:39:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs
index 10edae437..01600f545 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.rs
+++ b/tests/ui/consts/const-eval/ub-uninhabit.rs
@@ -1,7 +1,10 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+#![feature(core_intrinsics)]
+#![feature(never_type)]
+use std::intrinsics;
use std::mem;
#[derive(Copy, Clone)]
@@ -15,11 +18,24 @@ union MaybeUninit<T: Copy> {
const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
//~^ ERROR evaluation of constant value failed
+//~| constructing invalid value
const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
//~^ ERROR it is undefined behavior to use this value
+//~| constructing invalid value
const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
//~^ ERROR evaluation of constant value failed
+//~| constructing invalid value
+
+
+const READ_NEVER: () = unsafe {
+ let mem = [0u32; 8];
+ let ptr = mem.as_ptr().cast::<!>();
+ let _val = intrinsics::read_via_copy(ptr);
+ //~^ ERROR evaluation of constant value failed
+ //~| constructing invalid value
+};
+
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr
index f1ad0f04d..d26f4e036 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.stderr
+++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr
@@ -1,11 +1,11 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-uninhabit.rs:16:35
+ --> $DIR/ub-uninhabit.rs:19:35
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type `Bar`
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:19:1
+ --> $DIR/ub-uninhabit.rs:23:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -16,11 +16,17 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-uninhabit.rs:22:42
+ --> $DIR/ub-uninhabit.rs:27:42
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type `Bar`
-error: aborting due to 3 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-uninhabit.rs:35:16
+ |
+LL | let _val = intrinsics::read_via_copy(ptr);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index 02bbbf504..d8add67fa 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -139,7 +139,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:85:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
@@ -156,7 +156,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:92:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
@@ -173,7 +173,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
HEX_DUMP
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/ub-wide-ptr.rs:96:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr
index 9899c56c0..ce260300f 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/union-const-eval-field.rs:31:5
|
LL | FIELD3
| ^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/union-const-eval-field.rs:31:5
|
LL | FIELD3
diff --git a/tests/ui/consts/const-float-bits-reject-conv.stderr b/tests/ui/consts/const-float-bits-reject-conv.stderr
index 7ad022520..1511dab12 100644
--- a/tests/ui/consts/const-float-bits-reject-conv.stderr
+++ b/tests/ui/consts/const-float-bits-reject-conv.stderr
@@ -30,25 +30,25 @@ LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555;
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:35:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:36:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:42:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:43:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
@@ -86,25 +86,25 @@ LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555;
| ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:57:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:58:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:61:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-float-bits-reject-conv.rs:62:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
diff --git a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
index d9208d070..b7b5b648c 100644
--- a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
+++ b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:14:17
|
LL | let a: [i8; LEN] = unimplemented!();
diff --git a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
index d9208d070..b7b5b648c 100644
--- a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
+++ b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr
@@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/const-len-underflow-separate-spans.rs:14:17
|
LL | let a: [i8; LEN] = unimplemented!();
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.rs b/tests/ui/consts/const_in_pattern/issue-65466.rs
index 2b421f4c7..d45c32e17 100644
--- a/tests/ui/consts/const_in_pattern/issue-65466.rs
+++ b/tests/ui/consts/const_in_pattern/issue-65466.rs
@@ -15,7 +15,8 @@ const C: &[O<B>] = &[O::None];
fn main() {
let x = O::None;
match &[x][..] {
- C => (),
+ C => (), //~WARN: the type must implement `PartialEq`
+ //~| previously accepted
_ => (),
}
}
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.stderr b/tests/ui/consts/const_in_pattern/issue-65466.stderr
new file mode 100644
index 000000000..9c80cb3a8
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-65466.stderr
@@ -0,0 +1,23 @@
+warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-65466.rs:18:9
+ |
+LL | C => (),
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-65466.rs:18:9
+ |
+LL | C => (),
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
diff --git a/tests/ui/consts/effect_param.rs b/tests/ui/consts/effect_param.rs
new file mode 100644
index 000000000..f11ec739f
--- /dev/null
+++ b/tests/ui/consts/effect_param.rs
@@ -0,0 +1,11 @@
+//! Ensure we don't allow accessing const effect parameters from stable Rust.
+
+fn main() {
+ i8::checked_sub::<true>(42, 43);
+ //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ i8::checked_sub::<false>(42, 43);
+ //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr
new file mode 100644
index 000000000..f8c4bfc02
--- /dev/null
+++ b/tests/ui/consts/effect_param.stderr
@@ -0,0 +1,19 @@
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/effect_param.rs:9:9
+ |
+LL | i8::checked_sub::<false>(42, 43);
+ | ^^^^^^^^^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/effect_param.rs:4:9
+ |
+LL | i8::checked_sub::<true>(42, 43);
+ | ^^^^^^^^^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/consts/escaping-bound-var.rs b/tests/ui/consts/escaping-bound-var.rs
new file mode 100644
index 000000000..7c1fbd24f
--- /dev/null
+++ b/tests/ui/consts/escaping-bound-var.rs
@@ -0,0 +1,13 @@
+#![feature(generic_const_exprs)]
+//~^ WARN the feature `generic_const_exprs` is incomplete
+
+fn test<'a>(
+ _: &'a (),
+) -> [(); {
+ let x: &'a ();
+ //~^ ERROR cannot capture late-bound lifetime in constant
+ 1
+}] {
+}
+
+fn main() {}
diff --git a/tests/ui/consts/escaping-bound-var.stderr b/tests/ui/consts/escaping-bound-var.stderr
new file mode 100644
index 000000000..d26ae2cee
--- /dev/null
+++ b/tests/ui/consts/escaping-bound-var.stderr
@@ -0,0 +1,20 @@
+warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/escaping-bound-var.rs:1:12
+ |
+LL | #![feature(generic_const_exprs)]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/escaping-bound-var.rs:7:13
+ |
+LL | fn test<'a>(
+ | -- lifetime defined here
+...
+LL | let x: &'a ();
+ | ^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index bfebf6670..658a0b7b2 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -10,6 +10,66 @@ error[E0635]: unknown feature `const_cmp`
LL | #![feature(const_cmp)]
| ^^^^^^^^^
-error: aborting due to 2 previous errors
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:15:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:15:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:22:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:22:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:29:15
+ |
+LL | T: ~const FnOnce<()>,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:29:15
+ |
+LL | T: ~const FnOnce<()>,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:36:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:36:15
+ |
+LL | T: ~const Fn<()> + ~const Destruct,
+ | ^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:50:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/fn_trait_refs.rs:50:15
+ |
+LL | T: ~const FnMut<()> + ~const Destruct,
+ | ^^^^^^^^^
+
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0635`.
diff --git a/tests/ui/consts/invalid-union.32bit.stderr b/tests/ui/consts/invalid-union.32bit.stderr
index 0dd18a557..b6cf060e5 100644
--- a/tests/ui/consts/invalid-union.32bit.stderr
+++ b/tests/ui/consts/invalid-union.32bit.stderr
@@ -9,13 +9,13 @@ LL | fn main() {
╾─alloc7──╼ │ ╾──╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
| ^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr
index 07f36ee28..e3a3ef62c 100644
--- a/tests/ui/consts/invalid-union.64bit.stderr
+++ b/tests/ui/consts/invalid-union.64bit.stderr
@@ -9,13 +9,13 @@ LL | fn main() {
╾───────alloc7────────╼ │ ╾──────╼
}
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
| ^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
diff --git a/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs b/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs
new file mode 100644
index 000000000..1615399be
--- /dev/null
+++ b/tests/ui/consts/issue-105536-const-val-roundtrip-ptr-eq.rs
@@ -0,0 +1,31 @@
+// run-pass
+
+// This does not reflect a stable guarantee (we guarantee very little for equality of pointers
+// around `const`), but it would be good to understand what is happening if these assertions ever
+// fail.
+use std::ptr::NonNull;
+use std::slice::from_raw_parts;
+
+const PTR_U8: *const u8 = NonNull::dangling().as_ptr();
+const CONST_U8_REF: &[u8] = unsafe { from_raw_parts(PTR_U8, 0) };
+const CONST_U8_PTR: *const u8 = unsafe { from_raw_parts(PTR_U8, 0).as_ptr() };
+static STATIC_U8_REF: &[u8] = unsafe { from_raw_parts(PTR_U8, 0) };
+
+const PTR_U16: *const u16 = NonNull::dangling().as_ptr();
+const CONST_U16_REF: &[u16] = unsafe { from_raw_parts(PTR_U16, 0) };
+
+const fn const_u8_fn() -> &'static [u8] {
+ unsafe { from_raw_parts(PTR_U8, 0) }
+}
+
+fn main() {
+ let ptr_u8 = unsafe { from_raw_parts(PTR_U8, 0) }.as_ptr();
+ let ptr_u16 = unsafe { from_raw_parts(PTR_U16, 0) }.as_ptr();
+
+ assert_eq!(ptr_u8, PTR_U8);
+ assert_eq!(ptr_u8, CONST_U8_PTR);
+ assert_eq!(ptr_u8, const_u8_fn().as_ptr());
+ assert_eq!(ptr_u8, STATIC_U8_REF.as_ptr());
+ assert_eq!(ptr_u16, CONST_U16_REF.as_ptr());
+ assert_eq!(ptr_u8, CONST_U8_REF.as_ptr());
+}
diff --git a/tests/ui/consts/issue-36163.stderr b/tests/ui/consts/issue-36163.stderr
index 190b41062..6fcfe3ed2 100644
--- a/tests/ui/consts/issue-36163.stderr
+++ b/tests/ui/consts/issue-36163.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
|
+note: ...which requires const-evaluating + checking `Foo::B::{constant#0}`...
+ --> $DIR/issue-36163.rs:4:9
+ |
+LL | B = A,
+ | ^
+note: ...which requires simplifying constant for the type system `A`...
+ --> $DIR/issue-36163.rs:1:1
+ |
+LL | const A: isize = Foo::B as isize;
+ | ^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-36163.rs:1:18
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^
- = note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
|
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr
index d97097d35..274b1de7e 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr
@@ -13,13 +13,13 @@ note: inside `<String as Bar<Vec<u32>, String>>::F`
LL | const F: u32 = (U::X, 42).1;
| ^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const.rs:29:13
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const.rs:29:13
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
index ae7b03fc9..c8e4cab4e 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -4,13 +4,13 @@ error[E0080]: evaluation of `<std::string::String as Bar<std::string::String>>::
LL | const F: u32 = 100 / U::X;
| ^^^^^^^^^^ attempt to divide `100_u32` by zero
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F;
diff --git a/tests/ui/consts/missing-larger-array-impl.stderr b/tests/ui/consts/missing-larger-array-impl.stderr
index b8f6cb5ef..fe9d0f6e6 100644
--- a/tests/ui/consts/missing-larger-array-impl.stderr
+++ b/tests/ui/consts/missing-larger-array-impl.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[X; 35]: Default` is not satisfied
- --> $DIR/missing-larger-array-impl.rs:7:5
+ --> $DIR/missing-larger-array-impl.rs:7:6
|
LL | <[X; 35] as Default>::default();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
+ | ^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
|
= help: the following other types implement trait `Default`:
[T; 0]
diff --git a/tests/ui/consts/std/alloc.32bit.stderr b/tests/ui/consts/std/alloc.32bit.stderr
index 8c83df53d..da805de45 100644
--- a/tests/ui/consts/std/alloc.32bit.stderr
+++ b/tests/ui/consts/std/alloc.32bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:12:1
+ --> $DIR/alloc.rs:11:1
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:16:1
+ --> $DIR/alloc.rs:15:1
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag
diff --git a/tests/ui/consts/std/alloc.64bit.stderr b/tests/ui/consts/std/alloc.64bit.stderr
index addedad17..094503e10 100644
--- a/tests/ui/consts/std/alloc.64bit.stderr
+++ b/tests/ui/consts/std/alloc.64bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:12:1
+ --> $DIR/alloc.rs:11:1
|
LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchec
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/alloc.rs:16:1
+ --> $DIR/alloc.rs:15:1
|
LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
diff --git a/tests/ui/consts/std/alloc.rs b/tests/ui/consts/std/alloc.rs
index 9abf35d63..0a2c2f4de 100644
--- a/tests/ui/consts/std/alloc.rs
+++ b/tests/ui/consts/std/alloc.rs
@@ -1,5 +1,4 @@
// stderr-per-bitwidth
-// ignore-debug (the debug assertions change the error)
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr
index adefbf336..f48e6c4ce 100644
--- a/tests/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr
@@ -645,13 +645,13 @@ note: inside `<i32 as Const>::CONSTANT`
LL | const CONSTANT: i32 = unsafe { fake_type() };
| ^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.rs b/tests/ui/consts/unstable-const-fn-in-libcore.rs
index 61e28117e..b62a74039 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.rs
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.rs
@@ -1,3 +1,5 @@
+// known-bug: #110395
+// FIXME check-pass
// This is a non-regression test for const-qualification of unstable items in libcore
// as explained in issue #67053.
// const-qualification could miss some `const fn`s if they were unstable and the feature
@@ -15,12 +17,12 @@ impl<T> Opt<T> {
#[rustc_const_unstable(feature = "foo", issue = "none")]
#[stable(feature = "rust1", since = "1.0.0")]
const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- //~^ ERROR destructor of
- //~| ERROR destructor of
+ //FIXME ~^ ERROR destructor of
+ //FIXME ~| ERROR destructor of
match self {
Opt::Some(t) => t,
Opt::None => f(),
- //~^ ERROR cannot call
+ //FIXME ~^ ERROR cannot call
}
}
}
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
index 95d7b7e85..b75f99a72 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
@@ -1,34 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/unstable-const-fn-in-libcore.rs:22:26
- |
-LL | Opt::None => f(),
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const std::ops::FnOnce<()>>(self, f: F) -> T {
- | +++++++++++++++++++++++++++++
-
-error[E0493]: destructor of `F` cannot be evaluated at compile-time
- --> $DIR/unstable-const-fn-in-libcore.rs:17:60
- |
-LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- | ^ the destructor for this type cannot be evaluated in constant functions
-...
-LL | }
- | - value is dropped here
-
-error[E0493]: destructor of `Opt<T>` cannot be evaluated at compile-time
- --> $DIR/unstable-const-fn-in-libcore.rs:17:54
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/unstable-const-fn-in-libcore.rs:19:39
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
- | ^^^^ the destructor for this type cannot be evaluated in constant functions
-...
-LL | }
- | - value is dropped here
+ | ^^^^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0493.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/cross/cross-fn-cache-hole.stderr b/tests/ui/cross/cross-fn-cache-hole.stderr
index 7e15562b0..79d171393 100644
--- a/tests/ui/cross/cross-fn-cache-hole.stderr
+++ b/tests/ui/cross/cross-fn-cache-hole.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `i32: Bar<u32>` is not satisfied
LL | where i32: Foo<u32, A>
| ^^^^^^^^^^^^^^^^ the trait `Bar<u32>` is not implemented for `i32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/cross-fn-cache-hole.rs:11:1
+ |
+LL | trait Bar<X> { }
+ | ^^^^^^^^^^^^
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
index 85e882870..659b54655 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed
@@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
+
+ let _baz = ["a", "b"].join(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
index 246de2f5e..cfc6c4450 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs
@@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
+
+ let _baz = ["a", "b"].connect(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
index 3b518d180..d1f5ea360 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
@@ -25,5 +25,16 @@ help: replace the use of the deprecated method
LL | let _bar = " aoeu".trim_start();
| ~~~~~~~~~~
-error: aborting due to 2 previous errors
+error: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join
+ --> $DIR/issue-84637-deprecated-associated-function.rs:10:27
+ |
+LL | let _baz = ["a", "b"].connect(" ");
+ | ^^^^^^^
+ |
+help: replace the use of the deprecated method
+ |
+LL | let _baz = ["a", "b"].join(" ");
+ | ~~~~
+
+error: aborting due to 3 previous errors
diff --git a/tests/ui/derive-uninhabited-enum-38885.stderr b/tests/ui/derive-uninhabited-enum-38885.stderr
index dcdf8f843..3fabf446d 100644
--- a/tests/ui/derive-uninhabited-enum-38885.stderr
+++ b/tests/ui/derive-uninhabited-enum-38885.stderr
@@ -9,6 +9,7 @@ LL | Void(Void),
|
= note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
= note: `-W dead-code` implied by `-W unused`
+ = help: to override `-W unused` add `#[allow(dead_code)]`
warning: 1 warning emitted
diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout
index 6bfc859bf..3d9f8129d 100644
--- a/tests/ui/deriving/deriving-all-codegen.stdout
+++ b/tests/ui/deriving/deriving-all-codegen.stdout
@@ -60,7 +60,7 @@ impl ::core::marker::StructuralEq for Empty { }
impl ::core::cmp::Eq for Empty {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -135,7 +135,7 @@ impl ::core::marker::StructuralEq for Point { }
impl ::core::cmp::Eq for Point {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -221,7 +221,7 @@ impl ::core::marker::StructuralEq for PackedPoint { }
impl ::core::cmp::Eq for PackedPoint {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -334,7 +334,7 @@ impl ::core::marker::StructuralEq for Big { }
impl ::core::cmp::Eq for Big {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -500,7 +500,7 @@ impl ::core::marker::StructuralEq for Unsized { }
impl ::core::cmp::Eq for Unsized {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<[u32]>;
}
@@ -615,7 +615,7 @@ impl<T: ::core::cmp::Eq + Trait, U: ::core::cmp::Eq> ::core::cmp::Eq for
Generic<T, U> where T::A: ::core::cmp::Eq {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<T::A>;
@@ -738,7 +738,7 @@ impl<T: ::core::cmp::Eq + ::core::marker::Copy + Trait, U: ::core::cmp::Eq +
T::A: ::core::cmp::Eq + ::core::marker::Copy {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<T::A>;
@@ -821,7 +821,7 @@ impl ::core::marker::StructuralEq for Enum0 { }
impl ::core::cmp::Eq for Enum0 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -892,7 +892,7 @@ impl ::core::marker::StructuralEq for Enum1 { }
impl ::core::cmp::Eq for Enum1 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
@@ -959,7 +959,7 @@ impl ::core::marker::StructuralEq for Fieldless1 { }
impl ::core::cmp::Eq for Fieldless1 {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -1034,7 +1034,7 @@ impl ::core::marker::StructuralEq for Fieldless { }
impl ::core::cmp::Eq for Fieldless {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
@@ -1142,7 +1142,7 @@ impl ::core::marker::StructuralEq for Mixed { }
impl ::core::cmp::Eq for Mixed {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
@@ -1270,7 +1270,7 @@ impl ::core::marker::StructuralEq for Fielded { }
impl ::core::cmp::Eq for Fielded {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<bool>;
@@ -1393,7 +1393,7 @@ impl<T: ::core::cmp::Eq, U: ::core::cmp::Eq> ::core::cmp::Eq for
EnumGeneric<T, U> {
#[inline]
#[doc(hidden)]
- #[no_coverage]
+ #[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
let _: ::core::cmp::AssertParamIsEq<U>;
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
index a686ed9c8..b08e29162 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
@@ -1,12 +1,12 @@
#[diagnostic::non_existing_attribute]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
pub trait Bar {
}
#[diagnostic::non_existing_attribute(with_option = "foo")]
//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
-//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+//~|WARNING unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes]
struct Foo;
fn main() {
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
index 45c95cbb3..017d00e2c 100644
--- a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
@@ -4,7 +4,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
= help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
error[E0658]: `#[diagnostic]` attribute name space is experimental
@@ -13,7 +13,7 @@ error[E0658]: `#[diagnostic]` attribute name space is experimental
LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
| ^^^^^^^^^^
|
- = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
= help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
warning: unknown diagnostic attribute
@@ -22,7 +22,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/feature-gate-diagnostic_namespace.rs:7:15
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
index 4f9b7ba2b..753077b36 100644
--- a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
@@ -4,7 +4,7 @@ warning: unknown diagnostic attribute
LL | #[diagnostic::non_existing_attribute]
| ^^^^^^^^^^^^^^^^^^^^^^
|
- = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
warning: unknown diagnostic attribute
--> $DIR/non_existing_attributes_accepted.rs:8:15
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
new file mode 100644
index 000000000..00fb59d14
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -0,0 +1,37 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(unsupported = "foo")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Baz")]
+//~^WARN `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+struct Bar {}
+
+#[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Baz {}
+
+#[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+//~^WARN malformed `on_unimplemented` attribute
+//~|WARN malformed `on_unimplemented` attribute
+trait Boom {}
+
+#[diagnostic::on_unimplemented = "boom"]
+//~^WARN malformed `on_unimplemented` attribute
+trait Doom {}
+
+fn take_foo(_: impl Foo) {}
+fn take_baz(_: impl Baz) {}
+fn take_boom(_: impl Boom) {}
+
+fn main() {
+ take_foo(1_i32);
+ //~^ERROR the trait bound `i32: Foo` is not satisfied
+ take_baz(1_i32);
+ //~^ERROR Boom
+ take_boom(1_i32);
+ //~^ERROR Boom
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
new file mode 100644
index 000000000..bb1b29ef2
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -0,0 +1,110 @@
+warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:8:1
+ |
+LL | #[diagnostic::on_unimplemented(message = "Baz")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:1
+ |
+LL | #[diagnostic::on_unimplemented = "boom"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
+ |
+LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:14
+ |
+LL | take_foo(1_i32);
+ | -------- ^^^^^ the trait `Foo` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:6:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `take_foo`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:21
+ |
+LL | fn take_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `take_foo`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:14
+ |
+LL | take_baz(1_i32);
+ | -------- ^^^^^ the trait `Baz` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:15:1
+ |
+LL | trait Baz {}
+ | ^^^^^^^^^
+note: required by a bound in `take_baz`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:27:21
+ |
+LL | fn take_baz(_: impl Baz) {}
+ | ^^^ required by this bound in `take_baz`
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
+ |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: Boom
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:15
+ |
+LL | take_boom(1_i32);
+ | --------- ^^^^^ the trait `Boom` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:20:1
+ |
+LL | trait Boom {}
+ | ^^^^^^^^^^
+note: required by a bound in `take_boom`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:28:22
+ |
+LL | fn take_boom(_: impl Boom) {}
+ | ^^^^ required by this bound in `take_boom`
+
+error: aborting due to 3 previous errors; 8 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
new file mode 100644
index 000000000..609a840c1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.rs
@@ -0,0 +1,7 @@
+#[diagnostic::on_unimplemented(message = "Foo")]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+pub trait Bar {
+}
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
new file mode 100644
index 000000000..21f02e3a7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/feature-gate-diagnostic_on_unimplemented.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+ --> $DIR/feature-gate-diagnostic_on_unimplemented.rs:1:3
+ |
+LL | #[diagnostic::on_unimplemented(message = "Foo")]
+ | ^^^^^^^^^^
+ |
+ = note: see issue #111996 <https://github.com/rust-lang/rust/issues/111996> for more information
+ = help: add `#![feature(diagnostic_namespace)]` 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/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
new file mode 100644
index 000000000..797edbc9e
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.rs
@@ -0,0 +1,11 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
new file mode 100644
index 000000000..549c7caa7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_unimplemented_simple.stderr
@@ -0,0 +1,24 @@
+error[E0277]: Foo
+ --> $DIR/on_unimplemented_simple.rs:9:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+help: this trait has no implementations, consider adding one
+ --> $DIR/on_unimplemented_simple.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/on_unimplemented_simple.rs:6:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/did_you_mean/bad-assoc-expr.stderr b/tests/ui/did_you_mean/bad-assoc-expr.stderr
index c295cac9a..b83078e21 100644
--- a/tests/ui/did_you_mean/bad-assoc-expr.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-expr.stderr
@@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:3:5
|
LL | [i32; 4]::clone(&a);
- | ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[i32; 4]>::clone(&a);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:6:5
|
LL | [i32]::as_ref(&a);
- | ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[i32]>::as_ref(&a);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:9:5
|
LL | (u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:12:5
|
LL | (u8, u8)::clone(&(0, 0));
- | ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8, u8)>::clone(&(0, 0));
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:15:6
|
LL | &(u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | &<(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:18:10
|
LL | 10 + (u8)::clone(&0);
- | ^^^^^^^^^^^ help: try: `<(u8)>::clone`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | 10 + <(u8)>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:32:13
|
LL | let _ = ty!()::clone(&0);
- | ^^^^^^^^^^^^ help: try: `<ty!()>::clone`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | let _ = <ty!()>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:34:5
|
LL | ty!()::clone(&0);
- | ^^^^^^^^^^^^ help: try: `<ty!()>::clone`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <ty!()>::clone(&0);
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-expr.rs:23:19
|
LL | ($ty: ty) => ($ty::clone(&0))
- | ^^^^^^^^^^ help: try: `<$ty>::clone`
+ | ^^^
...
LL | expr!(u8);
| --------- in this macro invocation
|
= note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::clone(&0))
+ | + +
error: aborting due to 9 previous errors
diff --git a/tests/ui/did_you_mean/bad-assoc-pat.stderr b/tests/ui/did_you_mean/bad-assoc-pat.stderr
index 19d173f1b..8bdeb8ffd 100644
--- a/tests/ui/did_you_mean/bad-assoc-pat.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-pat.stderr
@@ -2,42 +2,71 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:3:9
|
LL | [u8]::AssocItem => {}
- | ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <[u8]>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:6:9
|
LL | (u8, u8)::AssocItem => {}
- | ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <(u8, u8)>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:9:9
|
LL | _::AssocItem => {}
- | ^^^^^^^^^^^^ help: try: `<_>::AssocItem`
+ | ^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <_>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:14:10
|
LL | &(u8,)::AssocItem => {}
- | ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | &<(u8,)>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:32:9
|
LL | ty!()::AssocItem => {}
- | ^^^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocItem`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | <ty!()>::AssocItem => {}
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-pat.rs:21:19
|
LL | ($ty: ty) => ($ty::AssocItem)
- | ^^^^^^^^^^^^^^ help: try: `<$ty>::AssocItem`
+ | ^^^
...
LL | pat!(u8) => {}
| -------- in this macro invocation
|
= note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::AssocItem)
+ | + +
error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope
--> $DIR/bad-assoc-pat.rs:3:15
diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr
index 55096e95d..efa6bb668 100644
--- a/tests/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr
@@ -2,60 +2,104 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:1:10
|
LL | type A = [u8; 4]::AssocTy;
- | ^^^^^^^^^^^^^^^^ help: try: `<[u8; 4]>::AssocTy`
+ | ^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type A = <[u8; 4]>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:5:10
|
LL | type B = [u8]::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<[u8]>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type B = <[u8]>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:9:10
|
LL | type C = (u8)::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type C = <(u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:13:10
|
LL | type D = (u8, u8)::AssocTy;
- | ^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocTy`
+ | ^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type D = <(u8, u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:17:10
|
LL | type E = _::AssocTy;
- | ^^^^^^^^^^ help: try: `<_>::AssocTy`
+ | ^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type E = <_>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:21:19
|
LL | type F = &'static (u8)::AssocTy;
- | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy`
+ | ^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type F = &'static <(u8)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:27:10
|
LL | type G = dyn 'static + (Send)::AssocTy;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<dyn 'static + (Send)>::AssocTy`
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type G = <dyn 'static + (Send)>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:46:10
|
LL | type I = ty!()::AssocTy;
- | ^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocTy`
+ | ^^^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | type I = <ty!()>::AssocTy;
+ | + +
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:39:19
|
LL | ($ty: ty) => ($ty::AssocTy);
- | ^^^^^^^^^^^^ help: try: `<$ty>::AssocTy`
+ | ^^^
...
LL | type J = ty!(u8);
| ------- in this macro invocation
|
= note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | ($ty: ty) => (<$ty>::AssocTy);
+ | + +
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:1:10
diff --git a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
index 063efc7b3..15aebdf1b 100644
--- a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
+++ b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs
@@ -2,13 +2,13 @@
#![deny(drop_bounds)]
// As a special exemption, `impl Drop` in the return position raises no error.
// This allows a convenient way to return an unnamed drop guard.
-fn voldemort_type() -> impl Drop {
- struct Voldemort;
- impl Drop for Voldemort {
+fn unnameable_type() -> impl Drop {
+ struct Unnameable;
+ impl Drop for Unnameable {
fn drop(&mut self) {}
}
- Voldemort
+ Unnameable
}
fn main() {
- let _ = voldemort_type();
+ let _ = unnameable_type();
}
diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs
index 9e51d3ada..caef6358e 100644
--- a/tests/ui/drop/dynamic-drop.rs
+++ b/tests/ui/drop/dynamic-drop.rs
@@ -2,6 +2,7 @@
// needs-unwind
#![feature(generators, generator_trait)]
+#![feature(if_let_guard)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
@@ -332,6 +333,16 @@ fn move_ref_pattern(a: &Allocator) {
let (ref _a, ref mut _b, _c, mut _d) = tup;
}
+fn if_let_guard(a: &Allocator, c: bool, d: i32) {
+ let foo = if c { Some(a.alloc()) } else { None };
+
+ match d == 0 {
+ false if let Some(a) = foo => { let b = a; }
+ true if let true = { drop(foo.unwrap_or_else(|| a.alloc())); d == 1 } => {}
+ _ => {}
+ }
+}
+
fn panic_after_return(a: &Allocator) -> Ptr<'_> {
// Panic in the drop of `p` or `q` can leak
let exceptions = vec![8, 9];
@@ -497,6 +508,13 @@ fn main() {
run_test(|a| move_ref_pattern(a));
+ run_test(|a| if_let_guard(a, true, 0));
+ run_test(|a| if_let_guard(a, true, 1));
+ run_test(|a| if_let_guard(a, true, 2));
+ run_test(|a| if_let_guard(a, false, 0));
+ run_test(|a| if_let_guard(a, false, 1));
+ run_test(|a| if_let_guard(a, false, 2));
+
run_test(|a| {
panic_after_return(a);
});
diff --git a/tests/ui/dropck/coroutine-liveness-1.rs b/tests/ui/dropck/coroutine-liveness-1.rs
new file mode 100644
index 000000000..aea4d15ad
--- /dev/null
+++ b/tests/ui/dropck/coroutine-liveness-1.rs
@@ -0,0 +1,18 @@
+// check-pass
+// edition: 2021
+
+// regression test for #116242.
+use std::future;
+
+fn main() {
+ let mut recv = future::ready(());
+ let _combined_fut = async {
+ let _ = || read(&mut recv);
+ };
+
+ drop(recv);
+}
+
+fn read<F: future::Future>(_: &mut F) -> F::Output {
+ todo!()
+}
diff --git a/tests/ui/dropck/coroutine-liveness-2.rs b/tests/ui/dropck/coroutine-liveness-2.rs
new file mode 100644
index 000000000..416a073c6
--- /dev/null
+++ b/tests/ui/dropck/coroutine-liveness-2.rs
@@ -0,0 +1,23 @@
+// check-pass
+// edition: 2021
+
+// regression test found while working on #117134.
+use std::future;
+
+fn main() {
+ let mut recv = future::ready(());
+ let _combined_fut = async {
+ let _ = || read(&mut recv);
+ };
+
+ let _uwu = (String::new(), _combined_fut);
+ // Dropping a coroutine as part of a more complex
+ // types should not add unnecessary liveness
+ // constraints.
+
+ drop(recv);
+}
+
+fn read<F: future::Future>(_: &mut F) -> F::Output {
+ todo!()
+}
diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr
index 2c75518c2..455d15e93 100644
--- a/tests/ui/dst/dst-bad-coerce1.stderr
+++ b/tests/ui/dst/dst-bad-coerce1.stderr
@@ -15,6 +15,11 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
LL | let f3: &Fat<dyn Bar> = f2;
| ^^ the trait `Bar` is not implemented for `Foo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/dst-bad-coerce1.rs:10:1
+ |
+LL | trait Bar { fn bar(&self) {} }
+ | ^^^^^^^^^
= note: required for the cast from `&Fat<Foo>` to `&Fat<dyn Bar>`
error[E0308]: mismatched types
@@ -34,6 +39,11 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
LL | let f3: &(dyn Bar,) = f2;
| ^^ the trait `Bar` is not implemented for `Foo`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/dst-bad-coerce1.rs:10:1
+ |
+LL | trait Bar { fn bar(&self) {} }
+ | ^^^^^^^^^
= note: required for the cast from `&(Foo,)` to `&(dyn Bar,)`
error: aborting due to 4 previous errors
diff --git a/tests/ui/dyn-star/error.stderr b/tests/ui/dyn-star/error.stderr
index ae54b9ca7..e039bb6f1 100644
--- a/tests/ui/dyn-star/error.stderr
+++ b/tests/ui/dyn-star/error.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `{integer}: Foo` is not satisfied
|
LL | let dyn_i: dyn* Foo = i;
| ^ the trait `Foo` is not implemented for `{integer}`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/error.rs:6:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/entry-point/auxiliary/bad_main_functions.rs b/tests/ui/entry-point/auxiliary/bad_main_functions.rs
new file mode 100644
index 000000000..4649be99e
--- /dev/null
+++ b/tests/ui/entry-point/auxiliary/bad_main_functions.rs
@@ -0,0 +1,2 @@
+pub fn boilerplate(x: u8) {}
+//~^ ERROR: `main` function has wrong type [E0580]
diff --git a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
new file mode 100644
index 000000000..0a115dd3b
--- /dev/null
+++ b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.rs
@@ -0,0 +1,6 @@
+// aux-build:bad_main_functions.rs
+
+#![feature(imported_main)]
+
+extern crate bad_main_functions;
+pub use bad_main_functions::boilerplate as main;
diff --git a/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr
new file mode 100644
index 000000000..3c6893310
--- /dev/null
+++ b/tests/ui/entry-point/imported_main_from_extern_crate_wrong_type.stderr
@@ -0,0 +1,12 @@
+error[E0580]: `main` function has wrong type
+ --> $DIR/auxiliary/bad_main_functions.rs:1:1
+ |
+LL | pub fn boilerplate(x: u8) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected signature `fn()`
+ found signature `fn(u8)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0580`.
diff --git a/tests/ui/error-codes/E0040.stderr b/tests/ui/error-codes/E0040.stderr
index 9fcda1a93..839be79d2 100644
--- a/tests/ui/error-codes/E0040.stderr
+++ b/tests/ui/error-codes/E0040.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/E0040.rs:16:7
|
LL | x.drop();
- | --^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(x)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(x);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0054.stderr b/tests/ui/error-codes/E0054.stderr
index 6b1092760..0a4adabba 100644
--- a/tests/ui/error-codes/E0054.stderr
+++ b/tests/ui/error-codes/E0054.stderr
@@ -1,8 +1,13 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/E0054.rs:3:24
|
LL | let x_is_nonzero = x as bool;
- | ^^^^^^^^^ help: compare with zero instead: `x != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let x_is_nonzero = x != 0;
+ | ~~~~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs
index a2ec932c1..97ebcff99 100644
--- a/tests/ui/error-codes/E0094.rs
+++ b/tests/ui/error-codes/E0094.rs
@@ -1,4 +1,4 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
extern "rust-intrinsic" {
#[rustc_safe_intrinsic]
diff --git a/tests/ui/error-codes/E0132.stderr b/tests/ui/error-codes/E0132.stderr
index c21363756..d4ddc07b5 100644
--- a/tests/ui/error-codes/E0132.stderr
+++ b/tests/ui/error-codes/E0132.stderr
@@ -1,8 +1,8 @@
-error[E0132]: start function is not allowed to have type parameters
+error[E0132]: `#[start]` function is not allowed to have type parameters
--> $DIR/E0132.rs:4:5
|
LL | fn f< T >() {}
- | ^^^^^ start function cannot have type parameters
+ | ^^^^^ `#[start]` function cannot have type parameters
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr
index 11763ce78..e03eadaca 100644
--- a/tests/ui/error-codes/E0220.stderr
+++ b/tests/ui/error-codes/E0220.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `F` not found for `Trait`
--> $DIR/E0220.rs:5:22
|
LL | type Foo = dyn Trait<F=i32>;
- | ^ associated type `F` not found
+ | ^ help: `Trait` has the following associated type: `Bar`
error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
--> $DIR/E0220.rs:5:16
diff --git a/tests/ui/error-codes/E0277.stderr b/tests/ui/error-codes/E0277.stderr
index 440e43dff..0b0d2b097 100644
--- a/tests/ui/error-codes/E0277.stderr
+++ b/tests/ui/error-codes/E0277.stderr
@@ -21,6 +21,11 @@ LL | some_func(5i32);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/E0277.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `some_func`
--> $DIR/E0277.rs:7:17
|
diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr
index 187b775f9..141abed60 100644
--- a/tests/ui/error-codes/E0308.stderr
+++ b/tests/ui/error-codes/E0308.stderr
@@ -1,11 +1,11 @@
error[E0308]: intrinsic has wrong type
- --> $DIR/E0308.rs:6:5
+ --> $DIR/E0308.rs:6:20
|
LL | fn size_of<T>();
- | ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
+ | ^ expected `usize`, found `()`
|
- = note: expected fn pointer `extern "rust-intrinsic" fn()`
- found fn pointer `extern "rust-intrinsic" fn() -> usize`
+ = note: expected signature `extern "rust-intrinsic" fn() -> usize`
+ found signature `extern "rust-intrinsic" fn()`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr
index 68e15e6f8..a77920430 100644
--- a/tests/ui/error-codes/E0374.stderr
+++ b/tests/ui/error-codes/E0374.stderr
@@ -1,8 +1,10 @@
-error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found
+error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0374.rs:8:1
|
LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected a single field to be coerced, none found
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr
index bf7d8c8d3..664e499ec 100644
--- a/tests/ui/error-codes/E0377.stderr
+++ b/tests/ui/error-codes/E0377.stderr
@@ -1,8 +1,10 @@
-error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with the same definition; expected `Foo`, found `Bar`
+error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0377.rs:12:1
|
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected coercion between the same definition; expected `Foo`, found `Bar`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index fa4b91cac..928c8d11d 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -1,26 +1,26 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:4:39
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `T,`
+ | help: try introducing a local generic parameter here: `T,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:9:16
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
...
LL | fn baz<U,
- | - help: try using a local generic parameter instead: `T,`
+ | - help: try introducing a local generic parameter here: `T,`
...
LL | (y: T) {
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:24:25
|
LL | impl<T> Iterator for A<T> {
@@ -29,8 +29,8 @@ LL | impl<T> Iterator for A<T> {
LL | fn helper(sel: &Self) -> u8 {
| ^^^^
| |
- | use of generic parameter from outer function
- | use a type here instead
+ | use of generic parameter from outer item
+ | refer to the type directly here instead
error[E0282]: type annotations needed
--> $DIR/E0401.rs:11:5
diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs
deleted file mode 100644
index 9f29c8167..000000000
--- a/tests/ui/error-codes/E0445.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(type_privacy_lints)]
-#[warn(private_bounds)]
-#[warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
-
-trait Foo {
- fn dummy(&self) { }
-}
-
-pub trait Bar : Foo {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar`
-pub struct Bar2<T: Foo>(pub T);
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar2`
-pub fn foo<T: Foo> (t: T) {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `foo`
-
-fn main() {}
diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr
deleted file mode 100644
index 4f940868f..000000000
--- a/tests/ui/error-codes/E0445.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:13:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar`
- --> $DIR/E0445.rs:13:1
- |
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/E0445.rs:2:8
- |
-LL | #[warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:16:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar2`
- --> $DIR/E0445.rs:16:1
- |
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:19:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `foo`
- --> $DIR/E0445.rs:19:1
- |
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error: aborting due to 3 previous errors; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/error-codes/E0446.rs b/tests/ui/error-codes/E0446.rs
index f61c7e546..6d6c4f97c 100644
--- a/tests/ui/error-codes/E0446.rs
+++ b/tests/ui/error-codes/E0446.rs
@@ -1,9 +1,14 @@
-mod foo {
- struct Bar(u32);
+struct Bar;
+trait PrivTr {}
- pub fn bar() -> Bar { //~ ERROR E0446
- Bar(0)
- }
+pub trait PubTr {
+ type Alias1;
+ type Alias2;
+}
+
+impl PubTr for u8 {
+ type Alias1 = Bar; //~ ERROR E0446
+ type Alias2 = Box<dyn PrivTr>; //~ ERROR E0446
}
fn main() {}
diff --git a/tests/ui/error-codes/E0446.stderr b/tests/ui/error-codes/E0446.stderr
index b6a195c40..2951e69d1 100644
--- a/tests/ui/error-codes/E0446.stderr
+++ b/tests/ui/error-codes/E0446.stderr
@@ -1,12 +1,21 @@
error[E0446]: private type `Bar` in public interface
- --> $DIR/E0446.rs:4:5
+ --> $DIR/E0446.rs:10:5
|
-LL | struct Bar(u32);
- | ---------- `Bar` declared as private
-LL |
-LL | pub fn bar() -> Bar {
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+LL | struct Bar;
+ | ---------- `Bar` declared as private
+...
+LL | type Alias1 = Bar;
+ | ^^^^^^^^^^^ can't leak private type
-error: aborting due to previous error
+error[E0446]: private trait `PrivTr` in public interface
+ --> $DIR/E0446.rs:11:5
+ |
+LL | trait PrivTr {}
+ | ------------ `PrivTr` declared as private
+...
+LL | type Alias2 = Box<dyn PrivTr>;
+ | ^^^^^^^^^^^ can't leak private trait
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/error-codes/E0602.rs b/tests/ui/error-codes/E0602.rs
index 8fadce526..77d28838a 100644
--- a/tests/ui/error-codes/E0602.rs
+++ b/tests/ui/error-codes/E0602.rs
@@ -1,6 +1,8 @@
// compile-flags:-D bogus
+// check-pass
// error-pattern:E0602
// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:`#[warn(unknown_lints)]` on by default
fn main() {}
diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr
index 2b3722633..60ecec7cd 100644
--- a/tests/ui/error-codes/E0602.stderr
+++ b/tests/ui/error-codes/E0602.stderr
@@ -1,11 +1,16 @@
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
-error: aborting due to 2 previous errors
+warning[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+warning: 3 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/error-codes/E0609-private-method.rs b/tests/ui/error-codes/E0609-private-method.rs
new file mode 100644
index 000000000..dfa97ad9a
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.rs
@@ -0,0 +1,16 @@
+// This error is an E0609 and *not* an E0615 because the fact that the method exists is not
+// relevant.
+mod foo {
+ pub struct Foo {
+ x: u32,
+ }
+
+ impl Foo {
+ fn method(&self) {}
+ }
+}
+
+fn main() {
+ let f = foo::Foo { x: 0 };
+ f.method; //~ ERROR E0609
+}
diff --git a/tests/ui/error-codes/E0609-private-method.stderr b/tests/ui/error-codes/E0609-private-method.stderr
new file mode 100644
index 000000000..d2a11e906
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `method` on type `Foo`
+ --> $DIR/E0609-private-method.rs:15:7
+ |
+LL | f.method;
+ | ^^^^^^ unknown field
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/error-codes/E0647.stderr b/tests/ui/error-codes/E0647.stderr
index 08cedfaef..9d1ab9671 100644
--- a/tests/ui/error-codes/E0647.stderr
+++ b/tests/ui/error-codes/E0647.stderr
@@ -1,8 +1,8 @@
-error[E0647]: start function is not allowed to have a `where` clause
+error[E0647]: `#[start]` function is not allowed to have a `where` clause
--> $DIR/E0647.rs:7:50
|
LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy {
- | ^^^^^^^^^^^^^^ start function cannot have a `where` clause
+ | ^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0767.stderr b/tests/ui/error-codes/E0767.stderr
index ee8524730..4b09008f9 100644
--- a/tests/ui/error-codes/E0767.stderr
+++ b/tests/ui/error-codes/E0767.stderr
@@ -19,7 +19,7 @@ LL | | }
| |_________^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/E0767.rs:3:9: 3:11]`
+ found closure `{closure@$DIR/E0767.rs:3:9: 3:11}`
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr
index e8ee1d969..9d75671c4 100644
--- a/tests/ui/error-festival.stderr
+++ b/tests/ui/error-festival.stderr
@@ -59,11 +59,16 @@ error[E0605]: non-primitive cast: `u8` as `Vec<u8>`
LL | x as Vec<u8>;
| ^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `{integer}` as `bool`
--> $DIR/error-festival.rs:33:24
|
LL | let x_is_nonzero = x as bool;
- | ^^^^^^^^^ help: compare with zero instead: `x != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let x_is_nonzero = x != 0;
+ | ~~~~
error[E0606]: casting `&u8` as `u32` is invalid
--> $DIR/error-festival.rs:37:18
diff --git a/tests/ui/explicit/explicit-call-to-dtor.stderr b/tests/ui/explicit/explicit-call-to-dtor.stderr
index f3c9bf6cc..f2e0b73b6 100644
--- a/tests/ui/explicit/explicit-call-to-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-dtor.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/explicit-call-to-dtor.rs:15:7
|
LL | x.drop();
- | --^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(x)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(x);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
index c70671173..5fa42fcf1 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/explicit-call-to-supertrait-dtor.rs:22:14
|
LL | self.drop();
- | -----^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(self)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(self);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/expr/if/bad-if-let-suggestion.rs b/tests/ui/expr/if/bad-if-let-suggestion.rs
index a8b2a2830..99d584ac7 100644
--- a/tests/ui/expr/if/bad-if-let-suggestion.rs
+++ b/tests/ui/expr/if/bad-if-let-suggestion.rs
@@ -4,9 +4,8 @@
fn a() {
if let x = 1 && i = 2 {}
//~^ ERROR cannot find value `i` in this scope
- //~| ERROR `let` expressions in this position are unstable
//~| ERROR mismatched types
- //~| ERROR `let` expressions are not supported here
+ //~| ERROR expected expression, found `let` statement
}
fn b() {
diff --git a/tests/ui/expr/if/bad-if-let-suggestion.stderr b/tests/ui/expr/if/bad-if-let-suggestion.stderr
index 3a53a20b4..20ac9ca76 100644
--- a/tests/ui/expr/if/bad-if-let-suggestion.stderr
+++ b/tests/ui/expr/if/bad-if-let-suggestion.stderr
@@ -1,4 +1,4 @@
-error: `let` expressions are not supported here
+error: expected expression, found `let` statement
--> $DIR/bad-if-let-suggestion.rs:5:8
|
LL | if let x = 1 && i = 2 {}
@@ -13,7 +13,7 @@ LL | if let x = 1 && i = 2 {}
| ^ not found in this scope
error[E0425]: cannot find value `i` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:9
+ --> $DIR/bad-if-let-suggestion.rs:12:9
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -22,7 +22,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `j` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:13
+ --> $DIR/bad-if-let-suggestion.rs:12:13
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -31,7 +31,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `i` in this scope
- --> $DIR/bad-if-let-suggestion.rs:13:18
+ --> $DIR/bad-if-let-suggestion.rs:12:18
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -40,7 +40,7 @@ LL | if (i + j) = i {}
| ^ help: a function with a similar name exists: `a`
error[E0425]: cannot find value `x` in this scope
- --> $DIR/bad-if-let-suggestion.rs:20:8
+ --> $DIR/bad-if-let-suggestion.rs:19:8
|
LL | fn a() {
| ------ similarly named function `a` defined here
@@ -48,15 +48,6 @@ LL | fn a() {
LL | if x[0] = 1 {}
| ^ help: a function with a similar name exists: `a`
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/bad-if-let-suggestion.rs:5:8
- |
-LL | if let x = 1 && i = 2 {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
error[E0308]: mismatched types
--> $DIR/bad-if-let-suggestion.rs:5:8
|
@@ -68,7 +59,7 @@ help: you might have meant to compare for equality
LL | if let x = 1 && i == 2 {}
| +
-error: aborting due to 8 previous errors
+error: aborting due to 7 previous errors
-Some errors have detailed explanations: E0308, E0425, E0658.
+Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/extern-flag/invalid-crate-name-dashed.rs b/tests/ui/extern-flag/invalid-crate-name-dashed.rs
new file mode 100644
index 000000000..7f351e48b
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-dashed.rs
@@ -0,0 +1,10 @@
+// compile-flags: --extern=my-awesome-library=libawesome.rlib
+// error-pattern: crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier
+// error-pattern: consider replacing the dashes with underscores: `my_awesome_library`
+
+// In a sense, this is a regression test for issue #113035. We no longer suggest
+// `pub use my-awesome-library::*;` (sic!) as we outright ban this crate name.
+
+pub use my_awesome_library::*;
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name-dashed.stderr b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr
new file mode 100644
index 000000000..5da1c4bb2
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr
@@ -0,0 +1,4 @@
+error: crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier
+ |
+ = help: consider replacing the dashes with underscores: `my_awesome_library`
+
diff --git a/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs b/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs
new file mode 100644
index 000000000..ec4a85820
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-non-ascii.rs
@@ -0,0 +1,4 @@
+// compile-flags: --extern čɍαţē=libnon_ascii.rlib
+// error-pattern: crate name `čɍαţē` passed to `--extern` is not a valid ASCII identifier
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr b/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr
new file mode 100644
index 000000000..6b38dcd01
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name-non-ascii.stderr
@@ -0,0 +1,2 @@
+error: crate name `čɍαţē` passed to `--extern` is not a valid ASCII identifier
+
diff --git a/tests/ui/extern-flag/invalid-crate-name.rs b/tests/ui/extern-flag/invalid-crate-name.rs
new file mode 100644
index 000000000..a26b5dd46
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name.rs
@@ -0,0 +1,4 @@
+// compile-flags: --extern=?#1%$
+// error-pattern: crate name `?#1%$` passed to `--extern` is not a valid ASCII identifier
+
+fn main() {}
diff --git a/tests/ui/extern-flag/invalid-crate-name.stderr b/tests/ui/extern-flag/invalid-crate-name.stderr
new file mode 100644
index 000000000..e2f83160d
--- /dev/null
+++ b/tests/ui/extern-flag/invalid-crate-name.stderr
@@ -0,0 +1,2 @@
+error: crate name `?#1%$` passed to `--extern` is not a valid ASCII identifier
+
diff --git a/tests/ui/extern/extern-main-fn.stderr b/tests/ui/extern/extern-main-fn.stderr
index 136c95753..846102670 100644
--- a/tests/ui/extern/extern-main-fn.stderr
+++ b/tests/ui/extern/extern-main-fn.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | extern "C" fn main() {}
| ^^^^^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn
|
- = note: expected fn pointer `fn()`
- found fn pointer `extern "C" fn()`
+ = note: expected signature `fn()`
+ found signature `extern "C" fn()`
error: aborting due to previous error
diff --git a/tests/ui/extern/extern-with-type-bounds.rs b/tests/ui/extern/extern-with-type-bounds.rs
index a72aa4171..99e9801fd 100644
--- a/tests/ui/extern/extern-with-type-bounds.rs
+++ b/tests/ui/extern/extern-with-type-bounds.rs
@@ -1,4 +1,4 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
extern "rust-intrinsic" {
// Real example from libcore
diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
index d8f089a28..13b9b84f0 100644
--- a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
+++ b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr
@@ -5,7 +5,7 @@ LL | struct Foo<const NAME: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to previous error
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
new file mode 100644
index 000000000..0a463755f
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
@@ -0,0 +1,14 @@
+#![crate_type = "lib"]
+#![feature(no_coverage)] //~ ERROR feature has been removed [E0557]
+
+#[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(coverage)`
+struct Foo {
+ a: u8,
+ b: u32,
+}
+
+#[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature
+fn requires_feature_coverage() -> bool {
+ let bar = Foo { a: 0, b: 0 };
+ bar == Foo { a: 0, b: 0 }
+}
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
new file mode 100644
index 000000000..0131a19a3
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
@@ -0,0 +1,21 @@
+error[E0557]: feature has been removed
+ --> $DIR/feature-gate-coverage-attribute.rs:2:12
+ |
+LL | #![feature(no_coverage)]
+ | ^^^^^^^^^^^ feature has been removed
+ |
+ = note: renamed to `coverage_attribute`
+
+error[E0658]: the `#[coverage]` attribute is an experimental feature
+ --> $DIR/feature-gate-coverage-attribute.rs:10:1
+ |
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
+ = help: add `#![feature(coverage_attribute)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0557, E0658.
+For more information about an error, try `rustc --explain E0557`.
diff --git a/tests/ui/feature-gates/feature-gate-no_coverage.rs b/tests/ui/feature-gates/feature-gate-no_coverage.rs
deleted file mode 100644
index fd4c6f760..000000000
--- a/tests/ui/feature-gates/feature-gate-no_coverage.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![crate_type = "lib"]
-
-#[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(no_coverage)`
-struct Foo {
- a: u8,
- b: u32,
-}
-
-#[no_coverage] //~ ERROR the `#[no_coverage]` attribute is an experimental feature
-fn requires_feature_no_coverage() -> bool {
- let bar = Foo { a: 0, b: 0 };
- bar == Foo { a: 0, b: 0 }
-}
diff --git a/tests/ui/feature-gates/feature-gate-no_coverage.stderr b/tests/ui/feature-gates/feature-gate-no_coverage.stderr
deleted file mode 100644
index f7167e0b7..000000000
--- a/tests/ui/feature-gates/feature-gate-no_coverage.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: the `#[no_coverage]` attribute is an experimental feature
- --> $DIR/feature-gate-no_coverage.rs:9:1
- |
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
- |
- = note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
- = help: add `#![feature(no_coverage)]` 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/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs
new file mode 100644
index 000000000..0648ce0ee
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.rs
@@ -0,0 +1,10 @@
+// force-host
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::Literal;
+
+fn test() {
+ Literal::byte_character(b'a'); //~ ERROR use of unstable library feature 'proc_macro_byte_character'
+}
diff --git a/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr
new file mode 100644
index 000000000..006915389
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-proc_macro_byte_character.stderr
@@ -0,0 +1,12 @@
+error[E0658]: use of unstable library feature 'proc_macro_byte_character'
+ --> $DIR/feature-gate-proc_macro_byte_character.rs:9:5
+ |
+LL | Literal::byte_character(b'a');
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #115268 <https://github.com/rust-lang/rust/issues/115268> for more information
+ = help: add `#![feature(proc_macro_byte_character)]` 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/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
index aad64c9d0..8bb9736f1 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs
@@ -1,11 +1,5 @@
// check-pass
-#![warn(private_interfaces)] //~ WARN unknown lint
- //~| WARN unknown lint
- //~| WARN unknown lint
-#![warn(private_bounds)] //~ WARN unknown lint
- //~| WARN unknown lint
- //~| WARN unknown lint
#![warn(unnameable_types)] //~ WARN unknown lint
//~| WARN unknown lint
//~| WARN unknown lint
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
index 79cc974cc..4349fea6f 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -1,26 +1,5 @@
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
- = note: `#[warn(unknown_lints)]` on by default
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,29 +7,10 @@ LL | #![warn(unnameable_types)]
= note: the `unnameable_types` lint is unstable
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+ = note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,28 +19,8 @@ LL | #![warn(unnameable_types)]
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-warning: unknown lint: `private_interfaces`
- --> $DIR/feature-gate-type_privacy_lints.rs:3:1
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_interfaces` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
-warning: unknown lint: `private_bounds`
- --> $DIR/feature-gate-type_privacy_lints.rs:6:1
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `private_bounds` lint is unstable
- = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
- = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-
warning: unknown lint: `unnameable_types`
- --> $DIR/feature-gate-type_privacy_lints.rs:9:1
+ --> $DIR/feature-gate-type_privacy_lints.rs:3:1
|
LL | #![warn(unnameable_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,5 +29,5 @@ LL | #![warn(unnameable_types)]
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
-warning: 9 warnings emitted
+warning: 3 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
new file mode 100644
index 000000000..4bbd0c83b
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
@@ -0,0 +1,26 @@
+struct Foo {
+ foo: u8,
+ _: union { //~ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~^ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~| ERROR anonymous unions are unimplemented
+ bar: u8,
+ baz: u16
+ }
+}
+
+union Bar {
+ foobar: u8,
+ _: struct { //~ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~^ ERROR unnamed fields are not yet fully implemented [E0658]
+ //~| ERROR anonymous structs are unimplemented
+ foobaz: u8,
+ barbaz: u16
+ }
+}
+
+struct S;
+struct Baz {
+ _: S //~ ERROR unnamed fields are not yet fully implemented [E0658]
+}
+
+fn main(){}
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
new file mode 100644
index 000000000..f026f2c36
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
@@ -0,0 +1,84 @@
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:5
+ |
+LL | _: union {
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:8
+ |
+LL | _: union {
+ | ________^
+LL | |
+LL | |
+LL | | bar: u8,
+LL | | baz: u16
+LL | | }
+ | |_____^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:5
+ |
+LL | _: struct {
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:8
+ |
+LL | _: struct {
+ | ________^
+LL | |
+LL | |
+LL | | foobaz: u8,
+LL | | barbaz: u16
+LL | | }
+ | |_____^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error[E0658]: unnamed fields are not yet fully implemented
+ --> $DIR/feature-gate-unnamed_fields.rs:23:5
+ |
+LL | _: S
+ | ^
+ |
+ = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
+ = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
+
+error: anonymous unions are unimplemented
+ --> $DIR/feature-gate-unnamed_fields.rs:3:8
+ |
+LL | _: union {
+ | ________^
+LL | |
+LL | |
+LL | | bar: u8,
+LL | | baz: u16
+LL | | }
+ | |_____^
+
+error: anonymous structs are unimplemented
+ --> $DIR/feature-gate-unnamed_fields.rs:13:8
+ |
+LL | _: struct {
+ | ________^
+LL | |
+LL | |
+LL | | foobaz: u8,
+LL | | barbaz: u16
+LL | | }
+ | |_____^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/print-with-path.cfg.stderr b/tests/ui/feature-gates/print-with-path.cfg.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.cfg.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/feature-gates/print-with-path.rs b/tests/ui/feature-gates/print-with-path.rs
deleted file mode 100644
index f929c14c2..000000000
--- a/tests/ui/feature-gates/print-with-path.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// check-fail
-// revisions: cfg target-features target-cpus
-// [cfg]compile-flags: --print cfg=cfg.txt
-// [target-cpus]compile-flags: --print target-cpu=target_cpu.txt
-// [target-features]compile-flags: --print target-features=target_features.txt
-
-fn main() {}
diff --git a/tests/ui/feature-gates/print-with-path.target-cpus.stderr b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.target-cpus.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/feature-gates/print-with-path.target-features.stderr b/tests/ui/feature-gates/print-with-path.target-features.stderr
deleted file mode 100644
index a6c51baa3..000000000
--- a/tests/ui/feature-gates/print-with-path.target-features.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-error: the `-Z unstable-options` flag must also be passed to enable the path print option
-
diff --git a/tests/ui/fmt/raw-idents.rs b/tests/ui/fmt/raw-idents.rs
new file mode 100644
index 000000000..29a74c55a
--- /dev/null
+++ b/tests/ui/fmt/raw-idents.rs
@@ -0,0 +1,17 @@
+// Regression test for https://github.com/rust-lang/rust/issues/115466
+
+// The "identifier" in format strings is parsed as an IDENTIFIER_OR_KEYWORD, not an IDENTIFIER.
+// Test that there is an actionable diagnostic if a RAW_IDENTIFIER is used instead.
+
+fn main() {
+ let r#type = "foobar";
+ println!("It is {r#type}"); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!(r##"It still is {r#type}"##); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!(concat!("{r#", "type}")); //~ ERROR: invalid format string: raw identifiers are not supported
+ println!("{\x72\x23type:?}"); //~ ERROR: invalid format string: raw identifiers are not supported
+
+ // OK
+ println!("{type}");
+ println!("{let}", let = r#type);
+ println!("{let}", r#let = r#type);
+}
diff --git a/tests/ui/fmt/raw-idents.stderr b/tests/ui/fmt/raw-idents.stderr
new file mode 100644
index 000000000..2ddc114d2
--- /dev/null
+++ b/tests/ui/fmt/raw-idents.stderr
@@ -0,0 +1,44 @@
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:8:22
+ |
+LL | println!("It is {r#type}");
+ | --^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:9:31
+ |
+LL | println!(r##"It still is {r#type}"##);
+ | --^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:10:14
+ |
+LL | println!(concat!("{r#", "type}"));
+ | ^^^^^^^^^^^^^^^^^^^^^^^ raw identifier used here in format string
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+ = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid format string: raw identifiers are not supported
+ --> $DIR/raw-idents.rs:11:16
+ |
+LL | println!("{\x72\x23type:?}");
+ | --------^^^^
+ | |
+ | raw identifier used here in format string
+ | help: remove the `r#`
+ |
+ = note: identifiers in format strings can be keywords and don't need to be prefixed with `r#`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/fn/bad-main.stderr b/tests/ui/fn/bad-main.stderr
index 675b66d05..65140a079 100644
--- a/tests/ui/fn/bad-main.stderr
+++ b/tests/ui/fn/bad-main.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(x: isize) { }
| ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(isize)`
+ = note: expected signature `fn()`
+ found signature `fn(isize)`
error: aborting due to previous error
diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr
index a674babcb..87ece845b 100644
--- a/tests/ui/fn/fn-pointer-mismatch.stderr
+++ b/tests/ui/fn/fn-pointer-mismatch.stderr
@@ -80,7 +80,6 @@ LL | let e: &fn(u32) -> u32 = &foo;
= note: expected reference `&fn(u32) -> u32`
found reference `&fn(u32) -> u32 {foo}`
= note: fn items are distinct from fn pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32);
diff --git a/tests/ui/fn/keyword-order.stderr b/tests/ui/fn/keyword-order.stderr
index d3b140c85..97d8f91b1 100644
--- a/tests/ui/fn/keyword-order.stderr
+++ b/tests/ui/fn/keyword-order.stderr
@@ -11,6 +11,8 @@ error: expected item, found keyword `pub`
|
LL | default pub const async unsafe extern fn err() {}
| ^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.rs b/tests/ui/fn/signature-error-reporting-under-verbose.rs
index 12ff113c9..d00cbd8a0 100644
--- a/tests/ui/fn/signature-error-reporting-under-verbose.rs
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.rs
@@ -12,5 +12,4 @@ fn main() {
//~| NOTE expected fn pointer, found fn item
//~| NOTE expected fn pointer `fn(i32, u32)`
//~| NOTE arguments to this function are incorrect
- //~| NOTE when the arguments and return types match, functions can be coerced to function pointers
}
diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.stderr b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
index f4498db72..067ee824d 100644
--- a/tests/ui/fn/signature-error-reporting-under-verbose.stderr
+++ b/tests/ui/fn/signature-error-reporting-under-verbose.stderr
@@ -8,7 +8,6 @@ LL | needs_ptr(foo);
|
= note: expected fn pointer `fn(i32, u32)`
found fn item `fn(i32, i32) {foo}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/signature-error-reporting-under-verbose.rs:5:4
|
diff --git a/tests/ui/foreign/foreign-fn-linkname.rs b/tests/ui/foreign/foreign-fn-linkname.rs
index f6d820594..d1d6e703e 100644
--- a/tests/ui/foreign/foreign-fn-linkname.rs
+++ b/tests/ui/foreign/foreign-fn-linkname.rs
@@ -2,6 +2,9 @@
// ignore-wasm32-bare no libc to test ffi with
// ignore-sgx no libc
+// Ensure no false positive on "unused extern crate" lint
+#![deny(unused_extern_crates)]
+
#![feature(rustc_private)]
extern crate libc;
diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr
index 870f1805b..dcfec53ee 100644
--- a/tests/ui/function-pointer/unsized-ret.stderr
+++ b/tests/ui/function-pointer/unsized-ret.stderr
@@ -1,10 +1,8 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/unsized-ret.rs:10:27
+ --> $DIR/unsized-ret.rs:10:11
|
LL | foo::<fn() -> str, _>(None, ());
- | --------------------- ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `fn() -> str`, the trait `Sized` is not implemented for `str`
= note: required because it appears within the type `fn() -> str`
@@ -15,12 +13,10 @@ LL | fn foo<F: Fn<T>, T:std::marker::Tuple>(f: Option<F>, t: T) {
| ^^^^^ required by this bound in `foo`
error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot be known at compilation time
- --> $DIR/unsized-ret.rs:13:66
+ --> $DIR/unsized-ret.rs:13:11
|
LL | foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),));
- | ------------------------------------------------------------ ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`
= note: required because it appears within the type `fn(&()) -> dyn Display`
diff --git a/tests/ui/functions-closures/fn-help-with-err.stderr b/tests/ui/functions-closures/fn-help-with-err.stderr
index da081eb43..e5fe46114 100644
--- a/tests/ui/functions-closures/fn-help-with-err.stderr
+++ b/tests/ui/functions-closures/fn-help-with-err.stderr
@@ -4,11 +4,11 @@ error[E0425]: cannot find value `oops` in this scope
LL | let arc = std::sync::Arc::new(oops);
| ^^^^ not found in this scope
-error[E0599]: no method named `bar` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:18:36: 18:38]>` in the current scope
+error[E0599]: no method named `bar` found for struct `Arc<{closure@$DIR/fn-help-with-err.rs:18:36: 18:38}>` in the current scope
--> $DIR/fn-help-with-err.rs:19:10
|
LL | arc2.bar();
- | ^^^ method not found in `Arc<[closure@fn-help-with-err.rs:18:36]>`
+ | ^^^ method not found in `Arc<{closure@fn-help-with-err.rs:18:36}>`
|
= help: items from traits can only be used if the trait is implemented and in scope
note: `Bar` defines an item `bar`, perhaps you need to implement it
diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/generator/addassign-yield.rs
index 7211367af..66f22bf31 100644
--- a/tests/ui/generator/addassign-yield.rs
+++ b/tests/ui/generator/addassign-yield.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// run-pass
// Regression test for broken MIR error (#61442)
// Due to the two possible evaluation orders for
diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.drop_tracking.stderr
deleted file mode 100644
index b2a5b92ed..000000000
--- a/tests/ui/generator/auto-trait-regions.drop_tracking.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut binding, &mut true, No);
- |
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut true, &mut binding, No);
- |
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
- = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
- = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr b/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr
deleted file mode 100644
index b2a5b92ed..000000000
--- a/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,55 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut binding, &mut true, No);
- |
-
-error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
- |
-LL | let a = A(&mut true, &mut true, No);
- | ^^^^ - temporary value is freed at the end of this statement
- | |
- | creates a temporary value which is freed while still in use
-...
-LL | assert_foo(a);
- | - borrow later used here
- |
-help: consider using a `let` binding to create a longer lived value
- |
-LL ~ let binding = true;
-LL ~ let a = A(&mut true, &mut binding, No);
- |
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
- = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
-
-error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
- |
-LL | assert_foo(gen);
- | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
- |
- = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
- = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/generator/auto-trait-regions.rs
index 350f3cc34..aa4218e13 100644
--- a/tests/ui/generator/auto-trait-regions.rs
+++ b/tests/ui/generator/auto-trait-regions.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
#![feature(auto_traits)]
#![feature(negative_impls)]
diff --git a/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.stderr
index b2a5b92ed..a9a0bde2b 100644
--- a/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr
+++ b/tests/ui/generator/auto-trait-regions.stderr
@@ -1,5 +1,5 @@
error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:24
+ --> $DIR/auto-trait-regions.rs:45:24
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
@@ -16,7 +16,7 @@ LL ~ let a = A(&mut binding, &mut true, No);
|
error[E0716]: temporary value dropped while borrowed
- --> $DIR/auto-trait-regions.rs:48:35
+ --> $DIR/auto-trait-regions.rs:45:35
|
LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement
@@ -33,7 +33,7 @@ LL ~ let a = A(&mut true, &mut binding, No);
|
error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:34:5
+ --> $DIR/auto-trait-regions.rs:31:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
@@ -42,7 +42,7 @@ LL | assert_foo(gen);
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
error: implementation of `Foo` is not general enough
- --> $DIR/auto-trait-regions.rs:54:5
+ --> $DIR/auto-trait-regions.rs:51:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
diff --git a/tests/ui/generator/borrowing.drop_tracking.stderr b/tests/ui/generator/borrowing.drop_tracking.stderr
deleted file mode 100644
index 96e3c327f..000000000
--- a/tests/ui/generator/borrowing.drop_tracking.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | Pin::new(&mut || yield &a).resume(())
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here by generator
-LL |
-LL | };
- | - `a` dropped here while still borrowed
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/generator/borrowing.drop_tracking_mir.stderr b/tests/ui/generator/borrowing.drop_tracking_mir.stderr
deleted file mode 100644
index 8fbad276d..000000000
--- a/tests/ui/generator/borrowing.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
- |
-LL | Pin::new(&mut || yield &a).resume(())
- | ----------^
- | | |
- | | borrowed value does not live long enough
- | value captured here by generator
- | a temporary with access to the borrow is created here ...
-LL |
-LL | };
- | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
- | |
- | `a` dropped here while still borrowed
- |
- = note: the temporary is part of an expression at the end of a block;
- consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
-help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
- |
-LL | let x = Pin::new(&mut || yield &a).resume(()); x
- | +++++++ +++
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/generator/borrowing.rs
index 29f39437f..d36592583 100644
--- a/tests/ui/generator/borrowing.rs
+++ b/tests/ui/generator/borrowing.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, generator_trait)]
use std::ops::Generator;
diff --git a/tests/ui/generator/borrowing.no_drop_tracking.stderr b/tests/ui/generator/borrowing.stderr
index 96e3c327f..38e1ace8c 100644
--- a/tests/ui/generator/borrowing.no_drop_tracking.stderr
+++ b/tests/ui/generator/borrowing.stderr
@@ -1,5 +1,5 @@
error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
+ --> $DIR/borrowing.rs:9:33
|
LL | let _b = {
| -- borrow later stored here
@@ -13,7 +13,7 @@ LL | };
| - `a` dropped here while still borrowed
error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
+ --> $DIR/borrowing.rs:16:20
|
LL | let _b = {
| -- borrow later stored here
diff --git a/tests/ui/generator/clone-impl-async.stderr b/tests/ui/generator/clone-impl-async.stderr
index 985472887..d172dff3a 100644
--- a/tests/ui/generator/clone-impl-async.stderr
+++ b/tests/ui/generator/clone-impl-async.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:17:16
|
LL | check_copy(&inner_non_clone);
- | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]`
+ | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
| |
| required by a bound introduced by this call
|
@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:19:17
|
LL | check_clone(&inner_non_clone);
- | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]`
+ | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 16:6}`
| |
| required by a bound introduced by this call
|
@@ -26,11 +26,11 @@ note: required by a bound in `check_clone`
LL | fn check_clone<T: Clone>(_x: &T) {}
| ^^^^^ required by this bound in `check_clone`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:26:16
|
LL | check_copy(&outer_non_clone);
- | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]`
+ | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
| |
| required by a bound introduced by this call
|
@@ -40,11 +40,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:28:17
|
LL | check_clone(&outer_non_clone);
- | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]`
+ | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 25:6}`
| |
| required by a bound introduced by this call
|
@@ -54,11 +54,11 @@ note: required by a bound in `check_clone`
LL | fn check_clone<T: Clone>(_x: &T) {}
| ^^^^^ required by this bound in `check_clone`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Copy` is not satisfied
--> $DIR/clone-impl-async.rs:32:16
|
LL | check_copy(&maybe_copy_clone);
- | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]`
+ | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
| |
| required by a bound introduced by this call
|
@@ -68,11 +68,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Clone` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}: Clone` is not satisfied
--> $DIR/clone-impl-async.rs:34:17
|
LL | check_clone(&maybe_copy_clone);
- | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]`
+ | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:41}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/clone-impl-static.stderr b/tests/ui/generator/clone-impl-static.stderr
index cbadf6f15..8b51824c7 100644
--- a/tests/ui/generator/clone-impl-static.stderr
+++ b/tests/ui/generator/clone-impl-static.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Copy` is not satisfied
+error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied
--> $DIR/clone-impl-static.rs:10:16
|
LL | check_copy(&gen);
- | ---------- ^^^^ the trait `Copy` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+ | ---------- ^^^^ the trait `Copy` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Clone` is not satisfied
+error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied
--> $DIR/clone-impl-static.rs:12:17
|
LL | check_clone(&gen);
- | ----------- ^^^^ the trait `Clone` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]`
+ | ----------- ^^^^ the trait `Clone` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr
index 64eb47c1a..870216398 100644
--- a/tests/ui/generator/clone-impl.stderr
+++ b/tests/ui/generator/clone-impl.stderr
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
- --> $DIR/clone-impl.rs:42:16
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ --> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:40:14
@@ -18,14 +18,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
- --> $DIR/clone-impl.rs:42:16
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ --> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
note: generator does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:38:9
@@ -34,23 +34,20 @@ LL | let v = vec!['a'];
| - has type `Vec<char>` which does not implement `Copy`
LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later
-...
-LL | };
- | - `v` is later dropped here
note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:72:18
|
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
- --> $DIR/clone-impl.rs:58:16
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ --> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:56:14
@@ -63,14 +60,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
- --> $DIR/clone-impl.rs:58:16
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ --> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
note: generator does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:52:9
@@ -80,23 +77,20 @@ LL | let v = vec!['a'];
...
LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later
-...
-LL | };
- | - `v` is later dropped here
note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:72:18
|
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
- --> $DIR/clone-impl.rs:66:16
+error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ --> $DIR/clone-impl.rs:66:5
|
LL | let gen_non_clone = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_copy(&gen_non_clone);
- | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Copy` is not implemented for `NonClone`
+ | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:64:14
@@ -114,14 +108,14 @@ LL + #[derive(Copy)]
LL | struct NonClone;
|
-error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
- --> $DIR/clone-impl.rs:68:17
+error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ --> $DIR/clone-impl.rs:68:5
|
LL | let gen_non_clone = move || {
- | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
+ | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_clone(&gen_non_clone);
- | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Clone` is not implemented for `NonClone`
+ | ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
note: captured value does not implement `Clone`
--> $DIR/clone-impl.rs:64:14
diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/generator/derived-drop-parent-expr.rs
index 4bd34346a..e38192451 100644
--- a/tests/ui/generator/derived-drop-parent-expr.rs
+++ b/tests/ui/generator/derived-drop-parent-expr.rs
@@ -1,5 +1,4 @@
// build-pass
-// compile-flags:-Zdrop-tracking
//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR
#![feature(generators)]
diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/generator/drop-control-flow.rs
index c6efda954..1c25c06ba 100644
--- a/tests/ui/generator/drop-control-flow.rs
+++ b/tests/ui/generator/drop-control-flow.rs
@@ -1,5 +1,4 @@
// build-pass
-// compile-flags: -Zdrop-tracking
// A test to ensure generators capture values that were conditionally dropped,
// and also that values that are dropped along all paths to a yield do not get
diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/generator/drop-track-addassign-yield.rs
index 71cfb170b..1e64f1d2e 100644
--- a/tests/ui/generator/drop-track-addassign-yield.rs
+++ b/tests/ui/generator/drop-track-addassign-yield.rs
@@ -1,5 +1,4 @@
// run-pass
-// compile-flags: -Zdrop-tracking
// Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement
// the fake_read callback on ExprUseVisitor which caused this case to break.
diff --git a/tests/ui/generator/drop-tracking-error-body.rs b/tests/ui/generator/drop-tracking-error-body.rs
deleted file mode 100644
index f99d9ab6b..000000000
--- a/tests/ui/generator/drop-tracking-error-body.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// compile-flags: -Zdrop-tracking-mir --edition=2021
-
-#![feature(generators)]
-
-pub async fn async_bad_body() {
- match true {} //~ ERROR non-exhaustive patterns: type `bool` is non-empty
-}
-
-pub fn generator_bad_body() {
- || {
- // 'non-exhaustive pattern' only seems to be reported once, so this annotation doesn't work
- // keep the function around so we can make sure it doesn't ICE
- match true {}; // ERROR non-exhaustive patterns: type `bool` is non-empty
- yield ();
- };
-}
-
-fn main() {}
diff --git a/tests/ui/generator/drop-tracking-error-body.stderr b/tests/ui/generator/drop-tracking-error-body.stderr
deleted file mode 100644
index 28a689233..000000000
--- a/tests/ui/generator/drop-tracking-error-body.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0004]: non-exhaustive patterns: type `bool` is non-empty
- --> $DIR/drop-tracking-error-body.rs:6:11
- |
-LL | match true {}
- | ^^^^
- |
- = note: the matched value is of type `bool`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
- |
-LL ~ match true {
-LL + _ => todo!(),
-LL ~ }
- |
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr
deleted file mode 100644
index c07906ec3..000000000
--- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr
+++ /dev/null
@@ -1,128 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr
deleted file mode 100644
index 1a05bfe4f..000000000
--- a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `copy::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `copy::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/generator/drop-tracking-parent-expression.rs
index ed9ac6d11..198b14528 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.rs
+++ b/tests/ui/generator/drop-tracking-parent-expression.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
@@ -21,14 +17,13 @@ macro_rules! type_combinations {
let g = move || match drop($name::Client { ..$name::Client::default() }) {
//~^ `significant_drop::Client` which is not `Send`
//~| `insignificant_dtor::Client` which is not `Send`
- //[no_drop_tracking,drop_tracking]~| `derived_drop::Client` which is not `Send`
+ //~| `derived_drop::Client` which is not `Send`
_ => yield,
};
assert_send(g);
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@@ -38,10 +33,6 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}
diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/drop-tracking-parent-expression.stderr
index 35698a98d..e85bb1347 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr
+++ b/tests/ui/generator/drop-tracking-parent-expression.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -13,9 +13,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
@@ -32,14 +32,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -53,9 +53,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
@@ -72,14 +72,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/drop-tracking-parent-expression.rs:27:13
+ --> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -93,9 +93,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+ = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/drop-tracking-parent-expression.rs:25:22
+ --> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
@@ -112,7 +112,7 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/drop-tracking-parent-expression.rs:49:19
+ --> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
index cbc291701..92e0136d5 100644
--- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
+++ b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
@@ -1,8 +1,5 @@
// build-pass
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/generator/drop-yield-twice.stderr
index 0808a2c85..39a906f0b 100644
--- a/tests/ui/generator/drop-yield-twice.stderr
+++ b/tests/ui/generator/drop-yield-twice.stderr
@@ -1,16 +1,10 @@
error: generator cannot be sent between threads safely
- --> $DIR/drop-yield-twice.rs:7:17
+ --> $DIR/drop-yield-twice.rs:7:5
|
-LL | assert_send(|| {
- | _________________^
-LL | | let guard = Foo(42);
-LL | | yield;
-LL | | drop(guard);
-LL | | yield;
-LL | | })
- | |_____^ generator is not `Send`
+LL | assert_send(|| {
+ | ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo`
+ = help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-yield-twice.rs:9:9
|
@@ -18,9 +12,6 @@ LL | let guard = Foo(42);
| ----- has type `Foo` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
-...
-LL | })
- | - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/drop-yield-twice.rs:15:19
|
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/generator/generator-yielding-or-returning-itself.stderr
index a26dbf3f2..7841a0854 100644
--- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr
+++ b/tests/ui/generator/generator-yielding-or-returning-itself.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36]`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36} as Generator>::Return == {generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36}`
--> $DIR/generator-yielding-or-returning-itself.rs:15:34
|
LL | want_cyclic_generator_return(|| {
@@ -23,7 +23,7 @@ LL | pub fn want_cyclic_generator_return<T>(_: T)
LL | where T: Generator<Yield = (), Return = T>
| ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35]`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35} as Generator>::Yield == {generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35}`
--> $DIR/generator-yielding-or-returning-itself.rs:28:33
|
LL | want_cyclic_generator_yield(|| {
diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/generator/issue-102645.rs
index 35acd5cd7..677cc69d3 100644
--- a/tests/ui/generator/issue-102645.rs
+++ b/tests/ui/generator/issue-102645.rs
@@ -1,5 +1,3 @@
-// compile-flags: -Zdrop-tracking
-
#![feature(generators, generator_trait)]
use std::ops::Generator;
diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/generator/issue-102645.stderr
index 3f9a4c2f3..5d28dfc45 100644
--- a/tests/ui/generator/issue-102645.stderr
+++ b/tests/ui/generator/issue-102645.stderr
@@ -1,5 +1,5 @@
error[E0061]: this method takes 1 argument but 0 arguments were supplied
- --> $DIR/issue-102645.rs:16:22
+ --> $DIR/issue-102645.rs:14:22
|
LL | Pin::new(&mut b).resume();
| ^^^^^^-- an argument of type `()` is missing
diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs
index ff9357b76..50b5da6e6 100644
--- a/tests/ui/generator/issue-105084.rs
+++ b/tests/ui/generator/issue-105084.rs
@@ -1,11 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [no_drop_tracking] known-bug: #105084
-// [no_drop_tracking] check-pass
-// [drop_tracking] known-bug: #105084
-// [drop_tracking] check-pass
-
#![feature(generators)]
#![feature(generator_clone)]
#![feature(generator_trait)]
@@ -37,13 +29,13 @@ fn main() {
// As it is not taken into account for trait computation,
// the generator is `Copy`.
let mut h = copy(g);
- //[drop_tracking_mir]~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
+ //~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
// We now have 2 boxes with the same backing allocation:
// one inside `g` and one inside `h`.
// Proceed and drop `t` in `g`.
Pin::new(&mut g).resume(());
- //[drop_tracking_mir]~^ ERROR borrow of moved value: `g`
+ //~^ ERROR borrow of moved value: `g`
// Proceed and drop `t` in `h` -> double free!
Pin::new(&mut h).resume(());
diff --git a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr b/tests/ui/generator/issue-105084.stderr
index 1cd4c4e4d..573c31f11 100644
--- a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr
+++ b/tests/ui/generator/issue-105084.stderr
@@ -1,8 +1,8 @@
error[E0382]: borrow of moved value: `g`
- --> $DIR/issue-105084.rs:45:14
+ --> $DIR/issue-105084.rs:37:14
|
LL | let mut g = || {
- | ----- move occurs because `g` has type `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, which does not implement the `Copy` trait
+ | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
...
LL | let mut h = copy(g);
| - value moved here
@@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(());
| ^^^^^^ value borrowed here after move
|
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
- --> $DIR/issue-105084.rs:17:21
+ --> $DIR/issue-105084.rs:9:21
|
LL | fn copy<T: Copy>(x: T) -> T {
| ---- ^ this parameter takes ownership of the value
@@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable
LL | let mut h = copy(g.clone());
| ++++++++
-error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `[generator@$DIR/issue-105084.rs:22:17: 22:19]`
- --> $DIR/issue-105084.rs:39:17
+error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
+ --> $DIR/issue-105084.rs:31:17
|
LL | let mut g = || {
- | -- within this `[generator@$DIR/issue-105084.rs:22:17: 22:19]`
+ | -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
...
LL | let mut h = copy(g);
- | ^^^^ within `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, the trait `Copy` is not implemented for `Box<(i32, ())>`
+ | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
note: generator does not implement `Copy` as this value is used across a yield
- --> $DIR/issue-105084.rs:29:22
+ --> $DIR/issue-105084.rs:21:22
|
LL | Box::new((5, yield));
| -------------^^^^^--
@@ -40,7 +40,7 @@ LL | Box::new((5, yield));
| | yield occurs here, with `Box::new((5, yield))` maybe used later
| has type `Box<(i32, ())>` which does not implement `Copy`
note: required by a bound in `copy`
- --> $DIR/issue-105084.rs:17:12
+ --> $DIR/issue-105084.rs:9:12
|
LL | fn copy<T: Copy>(x: T) -> T {
| ^^^^ required by this bound in `copy`
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
index 9408acc15..845102464 100644
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
+++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
@@ -1,5 +1,5 @@
// edition:2021
-// compile-flags: -Zdrop-tracking-mir=yes
+// check-pass
#![feature(generators)]
fn main() {
@@ -7,6 +7,5 @@ fn main() {
|| {
let _c = || yield *&mut *x;
|| _ = &mut *x;
- //~^ cannot borrow `*x` as mutable more than once at a time
};
}
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr
deleted file mode 100644
index 4d72ebe79..000000000
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0499]: cannot borrow `*x` as mutable more than once at a time
- --> $DIR/issue-110929-generator-conflict-error-ice.rs:9:9
- |
-LL | let _c = || yield *&mut *x;
- | -- -- first borrow occurs due to use of `*x` in generator
- | |
- | first mutable borrow occurs here
-LL | || _ = &mut *x;
- | ^^ -- second borrow occurs due to use of `*x` in closure
- | |
- | second mutable borrow occurs here
-LL |
-LL | };
- | - first borrow might be used here, when `_c` is dropped and runs the destructor for generator
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/issue-57017.no_drop_tracking.stderr b/tests/ui/generator/issue-57017.no_drop_tracking.stderr
deleted file mode 100644
index f7b8e198c..000000000
--- a/tests/ui/generator/issue-57017.no_drop_tracking.stderr
+++ /dev/null
@@ -1,248 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `copy::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&copy::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `copy::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:32:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:30:28
- |
-LL | let g = move || match drop(&$name::unsync::Client::default()) {
- | --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
-LL | };
- | - `&$name::unsync::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57017.rs:44:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57017.rs:42:28
- |
-LL | let g = move || match drop($name::unsend::Client::default()) {
- | -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
-LL | _status => yield,
- | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
-LL | };
- | - `$name::unsend::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
-LL | | significant_drop => {
-... |
-LL | | }
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/issue-57017.rs:52:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 6 previous errors
-
diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs
index 381897c77..bb2d6679b 100644
--- a/tests/ui/generator/issue-57017.rs
+++ b/tests/ui/generator/issue-57017.rs
@@ -1,9 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] build-pass
-// [drop_tracking_mir] build-pass
-
+// build-pass
#![feature(generators, negative_impls)]
#![allow(dropping_references, dropping_copy_types)]
@@ -30,9 +25,6 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
// This tests that `Client` is properly considered to be dropped after moving it into the
@@ -42,9 +34,6 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
- //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
)* }
}
diff --git a/tests/ui/generator/issue-57478.no_drop_tracking.stderr b/tests/ui/generator/issue-57478.no_drop_tracking.stderr
deleted file mode 100644
index 612dd9c37..000000000
--- a/tests/ui/generator/issue-57478.no_drop_tracking.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-57478.rs:13:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Foo;
-LL | | drop(guard);
-LL | | yield;
-LL | | })
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/issue-57478.rs:13:17: 13:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-57478.rs:17:9
- |
-LL | let guard = Foo;
- | ----- has type `Foo` which is not `Send`
-LL | drop(guard);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | })
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/issue-57478.rs:21:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/generator/issue-57478.rs
index 3c23b5992..39710febd 100644
--- a/tests/ui/generator/issue-57478.rs
+++ b/tests/ui/generator/issue-57478.rs
@@ -1,8 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking] check-pass
-// [drop_tracking_mir] check-pass
+// check-pass
#![feature(negative_impls, generators)]
@@ -11,7 +7,6 @@ impl !Send for Foo {}
fn main() {
assert_send(|| {
- //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Foo;
drop(guard);
yield;
diff --git a/tests/ui/generator/issue-68112.drop_tracking.stderr b/tests/ui/generator/issue-68112.drop_tracking.stderr
deleted file mode 100644
index 282eac1b6..000000000
--- a/tests/ui/generator/issue-68112.drop_tracking.stderr
+++ /dev/null
@@ -1,66 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
-LL |
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-...
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/issue-68112.no_drop_tracking.stderr b/tests/ui/generator/issue-68112.no_drop_tracking.stderr
deleted file mode 100644
index 282eac1b6..000000000
--- a/tests/ui/generator/issue-68112.no_drop_tracking.stderr
+++ /dev/null
@@ -1,66 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
-LL |
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-...
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
-note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs
index 48b53b769..9dd68726f 100644
--- a/tests/ui/generator/issue-68112.rs
+++ b/tests/ui/generator/issue-68112.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators, generator_trait)]
use std::{
@@ -39,7 +36,7 @@ fn test1() {
yield;
//~^ NOTE yield occurs here
//~| NOTE value is used across a yield
- }; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here
+ };
require_send(send_gen);
//~^ ERROR generator cannot be sent between threads
//~| NOTE not `Send`
@@ -68,7 +65,6 @@ fn test2() {
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely
//~| NOTE `RefCell<i32>` cannot be shared between threads safely
//~| NOTE required for
- //[no_drop_tracking,drop_tracking]~| NOTE required by a bound introduced by this call
//~| NOTE captures the following types
//~| NOTE use `std::sync::RwLock` instead
}
diff --git a/tests/ui/generator/issue-68112.drop_tracking_mir.stderr b/tests/ui/generator/issue-68112.stderr
index a83522b71..808004822 100644
--- a/tests/ui/generator/issue-68112.drop_tracking_mir.stderr
+++ b/tests/ui/generator/issue-68112.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/issue-68112.rs:43:5
+ --> $DIR/issue-68112.rs:40:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ generator is not `Send`
@@ -7,7 +7,7 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: generator is not `Send` as this value is used across a yield
- --> $DIR/issue-68112.rs:39:9
+ --> $DIR/issue-68112.rs:36:9
|
LL | let _non_send_gen = make_non_send_generator();
| ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
@@ -15,13 +15,13 @@ LL |
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
+ --> $DIR/issue-68112.rs:22:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/issue-68112.rs:67:5
+ --> $DIR/issue-68112.rs:64:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -30,28 +30,28 @@ LL | require_send(send_gen);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this generator
- --> $DIR/issue-68112.rs:52:5
+ --> $DIR/issue-68112.rs:49:5
|
LL | || {
| ^^
note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:49:30
+ --> $DIR/issue-68112.rs:46:30
|
LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
- --> $DIR/issue-68112.rs:57:34
+ --> $DIR/issue-68112.rs:54:34
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
note: required because it's used within this generator
- --> $DIR/issue-68112.rs:63:20
+ --> $DIR/issue-68112.rs:60:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:25:25
+ --> $DIR/issue-68112.rs:22:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/generator/issue-93161.rs
index 8d3f7c62f..ae8603b7c 100644
--- a/tests/ui/generator/issue-93161.rs
+++ b/tests/ui/generator/issue-93161.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// run-pass
diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/generator/layout-error.rs
index 44cfc1d70..7c3d18740 100644
--- a/tests/ui/generator/layout-error.rs
+++ b/tests/ui/generator/layout-error.rs
@@ -24,6 +24,5 @@ fn main() {
type F = impl Future;
// Check that statics are inhabited computes they layout.
static POOL: Task<F> = Task::new();
- //~^ ERROR: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits
Task::spawn(&POOL, || cb());
}
diff --git a/tests/ui/generator/layout-error.stderr b/tests/ui/generator/layout-error.stderr
index ea3b25551..b1a258f4f 100644
--- a/tests/ui/generator/layout-error.stderr
+++ b/tests/ui/generator/layout-error.stderr
@@ -4,24 +4,6 @@ error[E0425]: cannot find value `Foo` in this scope
LL | let a = Foo;
| ^^^ not found in this scope
-error: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits
- --> $DIR/layout-error.rs:26:18
- |
-LL | static POOL: Task<F> = Task::new();
- | ^^^^^^^
- |
-note: opaque type is declared here
- --> $DIR/layout-error.rs:24:14
- |
-LL | type F = impl Future;
- | ^^^^^^^^^^^
-note: required because it appears within the type `Task<F>`
- --> $DIR/layout-error.rs:9:12
- |
-LL | pub struct Task<F: Future>(F);
- | ^^^^
- = note: shared static variables must have a type that implements `Sync`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/generator/not-send-sync.drop_tracking.stderr b/tests/ui/generator/not-send-sync.drop_tracking.stderr
deleted file mode 100644
index 718fd4224..000000000
--- a/tests/ui/generator/not-send-sync.drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr
deleted file mode 100644
index 718fd4224..000000000
--- a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs
index 8794db452..16c8cd476 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/generator/not-send-sync.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
#![feature(negative_impls)]
diff --git a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr b/tests/ui/generator/not-send-sync.stderr
index 66f01ae37..13ce687e0 100644
--- a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr
+++ b/tests/ui/generator/not-send-sync.stderr
@@ -1,39 +1,39 @@
error: generator cannot be shared between threads safely
- --> $DIR/not-send-sync.rs:17:5
+ --> $DIR/not-send-sync.rs:14:5
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
- = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
+ = help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
- --> $DIR/not-send-sync.rs:20:9
+ --> $DIR/not-send-sync.rs:17:9
|
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_sync`
- --> $DIR/not-send-sync.rs:14:23
+ --> $DIR/not-send-sync.rs:11:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
- --> $DIR/not-send-sync.rs:24:5
+ --> $DIR/not-send-sync.rs:21:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
+ = help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/not-send-sync.rs:27:9
+ --> $DIR/not-send-sync.rs:24:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/not-send-sync.rs:15:23
+ --> $DIR/not-send-sync.rs:12:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/parent-expression.drop_tracking.stderr b/tests/ui/generator/parent-expression.drop_tracking.stderr
deleted file mode 100644
index ef489088b..000000000
--- a/tests/ui/generator/parent-expression.drop_tracking.stderr
+++ /dev/null
@@ -1,128 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/generator/parent-expression.no_drop_tracking.stderr b/tests/ui/generator/parent-expression.no_drop_tracking.stderr
deleted file mode 100644
index 2e1313a80..000000000
--- a/tests/ui/generator/parent-expression.no_drop_tracking.stderr
+++ /dev/null
@@ -1,334 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `copy::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `copy::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `derived_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `significant_drop::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
- |
-LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-...
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:40:25
- |
-LL | assert_send(g);
- | ^ generator is not `Send`
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
- |
- = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:38:22
- |
-LL | let g = move || match drop($name::Client::default()) {
- | ------------------------ has type `insignificant_dtor::Client` which is not `Send`
-LL | _ => yield,
- | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
-LL | };
- | - `$name::Client::default()` is later dropped here
-...
-LL | / type_combinations!(
-LL | | // OK
-LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
-LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
-... |
-LL | | };
-LL | | );
- | |_____- in this macro invocation
-note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
- |
-LL | fn assert_send<T: Send>(_thing: T) {}
- | ^^^^ required by this bound in `assert_send`
- = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/generator/parent-expression.rs
index 239034e3d..198b14528 100644
--- a/tests/ui/generator/parent-expression.rs
+++ b/tests/ui/generator/parent-expression.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(generators, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
@@ -28,7 +24,6 @@ macro_rules! type_combinations {
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
- //[no_drop_tracking]~^^^^ ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@@ -38,10 +33,6 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
- //[no_drop_tracking]~^ ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
- //[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}
diff --git a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/parent-expression.stderr
index bf8144564..25a3b051b 100644
--- a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr
+++ b/tests/ui/generator/parent-expression.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -13,9 +13,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
@@ -32,14 +32,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -53,9 +53,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
@@ -72,14 +72,14 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
- --> $DIR/parent-expression.rs:27:13
+ --> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^ generator is not `Send`
@@ -93,9 +93,9 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+ = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/parent-expression.rs:25:22
+ --> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
@@ -112,7 +112,7 @@ LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
- --> $DIR/parent-expression.rs:49:19
+ --> $DIR/parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/partial-drop.drop_tracking.stderr b/tests/ui/generator/partial-drop.drop_tracking.stderr
deleted file mode 100644
index f1b25cb8c..000000000
--- a/tests/ui/generator/partial-drop.drop_tracking.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:17:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | drop(guard.foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:21:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-LL | drop(guard.foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | let Bar { foo, x } = guard;
-LL | | drop(foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:29:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-...
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/partial-drop.no_drop_tracking.stderr b/tests/ui/generator/partial-drop.no_drop_tracking.stderr
deleted file mode 100644
index 91152b5ea..000000000
--- a/tests/ui/generator/partial-drop.no_drop_tracking.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:17:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | drop(guard.foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:21:9
- |
-LL | let guard = Bar { foo: Foo, x: 42 };
- | ----- has type `Bar` which is not `Send`
-LL | drop(guard.foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `guard` maybe used later
-LL | });
- | - `guard` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: generator cannot be sent between threads safely
- --> $DIR/partial-drop.rs:24:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let guard = Bar { foo: Foo, x: 42 };
-LL | | let Bar { foo, x } = guard;
-LL | | drop(foo);
-LL | | yield;
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/partial-drop.rs:29:9
- |
-LL | let Bar { foo, x } = guard;
- | --- has type `Foo` which is not `Send`
-LL | drop(foo);
-LL | yield;
- | ^^^^^ yield occurs here, with `foo` maybe used later
-LL | });
- | - `foo` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/partial-drop.rs:33:19
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/generator/partial-drop.rs
index 1d3ae075d..868f36adc 100644
--- a/tests/ui/generator/partial-drop.rs
+++ b/tests/ui/generator/partial-drop.rs
@@ -1,8 +1,4 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-// [drop_tracking_mir] check-pass
-
+// check-pass
#![feature(negative_impls, generators)]
struct Foo;
@@ -15,14 +11,19 @@ struct Bar {
fn main() {
assert_send(|| {
- //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Bar { foo: Foo, x: 42 };
drop(guard.foo);
yield;
});
assert_send(|| {
- //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
+ let mut guard = Bar { foo: Foo, x: 42 };
+ drop(guard);
+ guard = Bar { foo: Foo, x: 23 };
+ yield;
+ });
+
+ assert_send(|| {
let guard = Bar { foo: Foo, x: 42 };
let Bar { foo, x } = guard;
drop(foo);
diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr
deleted file mode 100644
index 429b202f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:38:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
- --> $DIR/generator-print-verbose-1.rs:50:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:55:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr
deleted file mode 100644
index 429b202f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:18
- |
-LL | require_send(send_gen);
- | ^^^^^^^^ generator is not `Send`
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:38:9
- |
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
-LL | };
- | - `_non_send_gen` is later dropped here
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:18
- |
-LL | require_send(send_gen);
- | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
- = note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
- |
-LL | || {
- | ^^
-note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
- |
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
- --> $DIR/generator-print-verbose-1.rs:50:34
- |
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:55:20
- |
-LL | let send_gen = || {
- | ^^
-note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
- |
-LL | fn require_send(_: impl Send) {}
- | ^^^^ required by this bound in `require_send`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs
index c7052c7d1..e52234c08 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/generator/print/generator-print-verbose-1.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as: tests/ui/generator/issue-68112.stderr
diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr
index 01a30fd2f..d949543de 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-1.stderr
@@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:40:5
+ --> $DIR/generator-print-verbose-1.rs:37:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ generator is not `Send`
@@ -7,20 +7,20 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:38:9
+ --> $DIR/generator-print-verbose-1.rs:35:9
|
LL | let _non_send_gen = make_non_send_generator();
| ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
+ --> $DIR/generator-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:59:5
+ --> $DIR/generator-print-verbose-1.rs:56:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -29,28 +29,28 @@ LL | require_send(send_gen);
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:45:5
+ --> $DIR/generator-print-verbose-1.rs:42:5
|
LL | || {
| ^^
note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:44:30
+ --> $DIR/generator-print-verbose-1.rs:41:30
|
LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
- --> $DIR/generator-print-verbose-1.rs:50:34
+ --> $DIR/generator-print-verbose-1.rs:47:34
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:55:20
+ --> $DIR/generator-print-verbose-1.rs:52:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:29:25
+ --> $DIR/generator-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
deleted file mode 100644
index 1f2e530f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
deleted file mode 100644
index 1f2e530f6..000000000
--- a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr
+++ /dev/null
@@ -1,60 +0,0 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:17
- |
-LL | assert_sync(|| {
- | _________________^
-LL | |
-LL | | let a = NotSync;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Sync`
- |
- = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
- |
-LL | let a = NotSync;
- | - has type `NotSync` which is not `Sync`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
- |
-LL | fn assert_sync<T: Sync>(_: T) {}
- | ^^^^ required by this bound in `assert_sync`
-
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:17
- |
-LL | assert_send(|| {
- | _________________^
-LL | |
-LL | | let a = NotSend;
-LL | | yield;
-LL | | drop(a);
-LL | | });
- | |_____^ generator is not `Send`
- |
- = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
- |
-LL | let a = NotSend;
- | - has type `NotSend` which is not `Send`
-LL | yield;
- | ^^^^^ yield occurs here, with `a` maybe used later
-LL | drop(a);
-LL | });
- | - `a` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
- |
-LL | fn assert_send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs
index ab29db6e0..e53a7ef8c 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.rs
+++ b/tests/ui/generator/print/generator-print-verbose-2.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// compile-flags: -Zverbose
// Same as test/ui/generator/not-send-sync.rs
diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-2.stderr
index 354369f19..8ff755761 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-2.stderr
@@ -1,39 +1,39 @@
error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:20:5
+ --> $DIR/generator-print-verbose-2.rs:17:5
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
- = help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync`
+ = help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:23:9
+ --> $DIR/generator-print-verbose-2.rs:20:9
|
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:17:23
+ --> $DIR/generator-print-verbose-2.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:27:5
+ --> $DIR/generator-print-verbose-2.rs:24:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
- = help: within `[main::{closure#1} upvar_tys=() [main::{closure#1}]]`, the trait `Send` is not implemented for `NotSend`
+ = help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:30:9
+ --> $DIR/generator-print-verbose-2.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:18:23
+ --> $DIR/generator-print-verbose-2.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-3.stderr b/tests/ui/generator/print/generator-print-verbose-3.stderr
index d15646259..69358ed0a 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.stderr
+++ b/tests/ui/generator/print/generator-print-verbose-3.stderr
@@ -12,7 +12,7 @@ LL | | };
| |_____^ expected `()`, found generator
|
= note: expected unit type `()`
- found generator `[main::{closure#0} upvar_tys=(unavailable)]`
+ found generator `{main::{closure#0} upvar_tys=(unavailable)}`
error: aborting due to previous error
diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/generator/ref-upvar-not-send.stderr
index 689ace67e..d6a2be977 100644
--- a/tests/ui/generator/ref-upvar-not-send.stderr
+++ b/tests/ui/generator/ref-upvar-not-send.stderr
@@ -34,7 +34,7 @@ LL | | let _y = y;
LL | | });
| |_____^ generator is not `Send`
|
- = help: within `[generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24]`, the trait `Send` is not implemented for `*mut ()`
+ = help: within `{generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()`
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> $DIR/ref-upvar-not-send.rs:27:18
|
diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking.stderr
deleted file mode 100644
index 7122a951e..000000000
--- a/tests/ui/generator/retain-resume-ref.drop_tracking.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
- |
-LL | gen.as_mut().resume(&mut thing);
- | ---------- first mutable borrow occurs here
-LL | gen.as_mut().resume(&mut thing);
- | ------ ^^^^^^^^^^ second mutable borrow occurs here
- | |
- | first borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr
deleted file mode 100644
index 736ed1fb6..000000000
--- a/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
- |
-LL | gen.as_mut().resume(&mut thing);
- | ---------- first mutable borrow occurs here
-LL | gen.as_mut().resume(&mut thing);
- | ^^^^^^^^^^ second mutable borrow occurs here
-LL |
-LL | }
- | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/generator/retain-resume-ref.rs
index 0050d98d0..0606ea71c 100644
--- a/tests/ui/generator/retain-resume-ref.rs
+++ b/tests/ui/generator/retain-resume-ref.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
//! This test ensures that a mutable reference cannot be passed as a resume argument twice.
#![feature(generators, generator_trait)]
diff --git a/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.stderr
index 7122a951e..e33310d12 100644
--- a/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr
+++ b/tests/ui/generator/retain-resume-ref.stderr
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
+ --> $DIR/retain-resume-ref.rs:23:25
|
LL | gen.as_mut().resume(&mut thing);
| ---------- first mutable borrow occurs here
diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/generator/static-mut-reference-across-yield.rs
index 4784ff49b..0fa6d9cdc 100644
--- a/tests/ui/generator/static-mut-reference-across-yield.rs
+++ b/tests/ui/generator/static-mut-reference-across-yield.rs
@@ -1,8 +1,6 @@
// build-pass
-// revisions: mir thir drop_tracking drop_tracking_mir
+// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/generator/static-not-unpin.current.stderr
index ecd8ca60c..242489841 100644
--- a/tests/ui/generator/static-not-unpin.current.stderr
+++ b/tests/ui/generator/static-not-unpin.current.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned
+error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
--> $DIR/static-not-unpin.rs:17:18
|
LL | assert_unpin(generator);
- | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]`
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/static-not-unpin.next.stderr b/tests/ui/generator/static-not-unpin.next.stderr
index ecd8ca60c..242489841 100644
--- a/tests/ui/generator/static-not-unpin.next.stderr
+++ b/tests/ui/generator/static-not-unpin.next.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]` cannot be unpinned
+error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
--> $DIR/static-not-unpin.rs:17:18
|
LL | assert_unpin(generator);
- | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:14:25: 14:34]`
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/generator/type-mismatch-signature-deduction.stderr
index ef6d896f8..fe1bade55 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.stderr
+++ b/tests/ui/generator/type-mismatch-signature-deduction.stderr
@@ -18,7 +18,7 @@ LL | Ok(5)
LL | Err(5)
| ++++ +
-error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7] as Generator>::Return == i32`
+error[E0271]: type mismatch resolving `<{generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Generator>::Return == i32`
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
LL | fn foo() -> impl Generator<Return = i32> {
diff --git a/tests/ui/generator/unresolved-ct-var-drop-tracking.rs b/tests/ui/generator/unresolved-ct-var-drop-tracking.rs
deleted file mode 100644
index a6589348d..000000000
--- a/tests/ui/generator/unresolved-ct-var-drop-tracking.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// incremental
-// edition:2021
-// compile-flags: -Zdrop-tracking
-
-fn main() {
- let _ = async {
- let s = std::array::from_fn(|_| ()).await;
- //~^ ERROR `[(); _]` is not a future
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- };
-}
diff --git a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr b/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
deleted file mode 100644
index dec0141ab..000000000
--- a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
+++ /dev/null
@@ -1,78 +0,0 @@
-error[E0277]: `[(); _]` is not a future
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ----------------------------^^^^^
- | | ||
- | | |`[(); _]` is not a future
- | | help: remove the `.await`
- | 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`
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0277, E0698.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/unresolved-ct-var.rs b/tests/ui/generator/unresolved-ct-var.rs
index 0a1570fc2..0316385fb 100644
--- a/tests/ui/generator/unresolved-ct-var.rs
+++ b/tests/ui/generator/unresolved-ct-var.rs
@@ -5,10 +5,5 @@ fn main() {
let _ = async {
let s = std::array::from_fn(|_| ()).await;
//~^ ERROR `[(); _]` is not a future
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
- //~| ERROR type inside `async` block must be known in this context
};
}
diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/generator/unresolved-ct-var.stderr
index ace254178..9badc1dc2 100644
--- a/tests/ui/generator/unresolved-ct-var.stderr
+++ b/tests/ui/generator/unresolved-ct-var.stderr
@@ -12,67 +12,6 @@ LL | let s = std::array::from_fn(|_| ()).await;
= note: [(); _] must be a future or must implement `IntoFuture` to be awaited
= note: required for `[(); _]` to implement `IntoFuture`
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error[E0698]: type inside `async` block must be known in this context
- --> $DIR/unresolved-ct-var.rs:6:17
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
- |
-note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:45
- |
-LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^
-
-error: aborting due to 6 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0277, E0698.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/unsized-capture-across-yield.rs b/tests/ui/generator/unsized-capture-across-yield.rs
new file mode 100644
index 000000000..7bcb0800c
--- /dev/null
+++ b/tests/ui/generator/unsized-capture-across-yield.rs
@@ -0,0 +1,22 @@
+#![feature(generator_trait)]
+#![feature(generators)]
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::ops::Generator;
+
+fn capture() -> impl Generator {
+ let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ move || {
+ println!("{:?}", &b);
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+
+ yield;
+
+ for elem in b.iter() {}
+ }
+}
+
+fn main() {
+ capture();
+}
diff --git a/tests/ui/generator/unsized-capture-across-yield.stderr b/tests/ui/generator/unsized-capture-across-yield.stderr
new file mode 100644
index 000000000..8a5b968a5
--- /dev/null
+++ b/tests/ui/generator/unsized-capture-across-yield.stderr
@@ -0,0 +1,23 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-capture-across-yield.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized-capture-across-yield.rs:11:27
+ |
+LL | move || {
+ | -- this closure captures all values by move
+LL | println!("{:?}", &b);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all values captured by value by a closure must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/generator/unsized-local-across-yield.rs
new file mode 100644
index 000000000..f761f45c2
--- /dev/null
+++ b/tests/ui/generator/unsized-local-across-yield.rs
@@ -0,0 +1,21 @@
+#![feature(generator_trait)]
+#![feature(generators)]
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::ops::Generator;
+
+fn across() -> impl Generator {
+ move || {
+ let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+
+ yield;
+
+ for elem in b.iter() {}
+ }
+}
+
+fn main() {
+ across();
+}
diff --git a/tests/ui/generator/unsized-local-across-yield.stderr b/tests/ui/generator/unsized-local-across-yield.stderr
new file mode 100644
index 000000000..1942f266e
--- /dev/null
+++ b/tests/ui/generator/unsized-local-across-yield.stderr
@@ -0,0 +1,21 @@
+warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/unsized-local-across-yield.rs:3:12
+ |
+LL | #![feature(unsized_locals)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized-local-across-yield.rs:10:13
+ |
+LL | let b: [u8] = *(Box::new([]) as Box<[u8]>);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+ = note: all values live across `yield` must have a statically known size
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/witness-ignore-fake-reads.rs b/tests/ui/generator/witness-ignore-fake-reads.rs
new file mode 100644
index 000000000..ccf9ce8b4
--- /dev/null
+++ b/tests/ui/generator/witness-ignore-fake-reads.rs
@@ -0,0 +1,34 @@
+// check-pass
+// edition: 2021
+
+// regression test for #117059
+struct SendNotSync(*const ());
+unsafe impl Send for SendNotSync {}
+// impl !Sync for SendNotSync {} // automatically disabled
+
+struct Inner {
+ stream: SendNotSync,
+ state: bool,
+}
+
+struct SendSync;
+impl std::ops::Deref for SendSync {
+ type Target = Inner;
+ fn deref(&self) -> &Self::Target {
+ todo!();
+ }
+}
+
+async fn next() {
+ let inner = SendSync;
+ match inner.state {
+ true if false => {}
+ false => async {}.await,
+ _ => {}
+ }
+}
+
+fn is_send<T: Send>(_: T) {}
+fn main() {
+ is_send(next())
+}
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
index 86dbad84d..93c69422f 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
@@ -7,16 +7,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-note: the lifetime defined here...
- --> $DIR/issue-100013.rs:16:38
- |
-LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
- | ^^
-note: ...must outlive the lifetime defined here
- --> $DIR/issue-100013.rs:16:34
- |
-LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
@@ -28,16 +18,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-note: the lifetime `'b` defined here...
- --> $DIR/issue-100013.rs:21:14
- |
-LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
- | ^^
-note: ...must outlive the lifetime `'a` defined here
- --> $DIR/issue-100013.rs:21:10
- |
-LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime may not live long enough
@@ -62,16 +42,6 @@ LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
-note: the lifetime `'b` defined here...
- --> $DIR/issue-100013.rs:28:18
- |
-LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
- | ^^
-note: ...must outlive the lifetime `'a` defined here
- --> $DIR/issue-100013.rs:28:10
- |
-LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
- | ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: aborting due to 4 previous errors
diff --git a/tests/ui/generic-associated-types/bugs/issue-88460.stderr b/tests/ui/generic-associated-types/bugs/issue-88460.stderr
index a2047f103..b9e2c4186 100644
--- a/tests/ui/generic-associated-types/bugs/issue-88460.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-88460.stderr
@@ -7,6 +7,14 @@ LL | test(Foo);
| required by a bound introduced by this call
|
= help: the trait `Marker` is implemented for `()`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-88460.rs:28:10
+ |
+LL | test(Foo);
+ | -----^^^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `test`
--> $DIR/issue-88460.rs:15:27
|
diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr
index 5c8db617c..91967fb85 100644
--- a/tests/ui/generic-associated-types/issue-101020.stderr
+++ b/tests/ui/generic-associated-types/issue-101020.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satis
LL | (&mut EmptyIter).consume(());
| ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-101020.rs:28:1
+ |
+LL | trait Foo<T> {}
+ | ^^^^^^^^^^^^
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
--> $DIR/issue-101020.rs:27:20
|
diff --git a/tests/ui/generic-associated-types/issue-90014-tait.stderr b/tests/ui/generic-associated-types/issue-90014-tait.stderr
index 1dec7edce..b86e2a204 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait.stderr
@@ -10,7 +10,7 @@ LL | async { () }
| ^^^^^^^^^^^^ expected future, found `async` block
|
= note: expected opaque type `Foo<'_>::Fut<'a>`
- found `async` block `[async block@$DIR/issue-90014-tait.rs:18:9: 18:21]`
+ found `async` block `{async block@$DIR/issue-90014-tait.rs:18:9: 18:21}`
note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/issue-90014-tait.rs:17:8
|
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
new file mode 100644
index 000000000..b127b3f6e
--- /dev/null
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
@@ -0,0 +1,10 @@
+trait Trait {
+ type P<T: Copy, U: Copy>;
+}
+impl Trait for () {
+ type P<T: Copy, U: Copy> = ();
+}
+fn main() {
+ let _: <() as Trait>::P<String, String>;
+ //~^ ERROR the trait bound `String: Copy` is not satisfied
+}
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
new file mode 100644
index 000000000..72a987b4a
--- /dev/null
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/multiple-type-params-with-unmet-bounds.rs:8:29
+ |
+LL | let _: <() as Trait>::P<String, String>;
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `Trait::P`
+ --> $DIR/multiple-type-params-with-unmet-bounds.rs:2:15
+ |
+LL | type P<T: Copy, U: Copy>;
+ | ^^^^ required by this bound in `Trait::P`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/own-bound-span.stderr b/tests/ui/generic-associated-types/own-bound-span.stderr
index 8ab8ea623..4a0566ca7 100644
--- a/tests/ui/generic-associated-types/own-bound-span.stderr
+++ b/tests/ui/generic-associated-types/own-bound-span.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/own-bound-span.rs:14:12
+ --> $DIR/own-bound-span.rs:14:24
|
LL | let _: <S as D>::P<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
note: required by a bound in `D::P`
--> $DIR/own-bound-span.rs:4:15
diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr
index 8cd3f9ee7..e7df8ca5c 100644
--- a/tests/ui/generic-const-items/elided-lifetimes.stderr
+++ b/tests/ui/generic-const-items/elided-lifetimes.stderr
@@ -28,7 +28,7 @@ LL | const I<const S: &str>: &str = "";
| ^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 4 previous errors
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
index 1fda46037..2cee53431 100644
--- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -27,10 +27,10 @@ LL | Infallible: From<T>;
| ^^^^^^^ required by this bound in `K`
error[E0277]: the trait bound `Vec<u8>: Copy` is not satisfied
- --> $DIR/unsatisfied-bounds.rs:32:13
+ --> $DIR/unsatisfied-bounds.rs:32:26
|
LL | let _ = <() as Trait<Vec<u8>>>::A;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
+ | ^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
|
note: required by a bound in `Trait::A`
--> $DIR/unsatisfied-bounds.rs:17:12
diff --git a/tests/ui/generics/issue-83556.rs b/tests/ui/generics/issue-83556.rs
new file mode 100644
index 000000000..7cea1c863
--- /dev/null
+++ b/tests/ui/generics/issue-83556.rs
@@ -0,0 +1,4 @@
+struct Foo<T, 'a>(&'a ());
+//~^ ERROR lifetime parameters must be declared prior to
+
+fn main() {}
diff --git a/tests/ui/generics/issue-83556.stderr b/tests/ui/generics/issue-83556.stderr
new file mode 100644
index 000000000..93affaffe
--- /dev/null
+++ b/tests/ui/generics/issue-83556.stderr
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type and const parameters
+ --> $DIR/issue-83556.rs:1:15
+ |
+LL | struct Foo<T, 'a>(&'a ());
+ | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generics/issue-94432-garbage-ice.rs b/tests/ui/generics/issue-94432-garbage-ice.rs
index d0709e2d2..4ddb3a7e9 100644
--- a/tests/ui/generics/issue-94432-garbage-ice.rs
+++ b/tests/ui/generics/issue-94432-garbage-ice.rs
@@ -4,7 +4,7 @@
fn�a<e>(){fn�p(){e}} //~ ERROR unknown start of token: \u{fffd}
//~^ ERROR unknown start of token: \u{fffd}
-//~^^ ERROR can't use generic parameters from outer function [E0401]
+//~^^ ERROR can't use generic parameters from outer item [E0401]
//~^^^ WARN type parameter `e` should have an upper camel case name
fn main(){}
diff --git a/tests/ui/generics/issue-98432.rs b/tests/ui/generics/issue-98432.rs
index 780c50d6f..c31dea76c 100644
--- a/tests/ui/generics/issue-98432.rs
+++ b/tests/ui/generics/issue-98432.rs
@@ -2,7 +2,7 @@ struct Struct<T>(T);
impl<T> Struct<T> {
const CONST: fn() = || {
- struct _Obligation where T:; //~ ERROR can't use generic parameters from outer function
+ struct _Obligation where T:; //~ ERROR can't use generic parameters from outer item
};
}
diff --git a/tests/ui/generics/issue-98432.stderr b/tests/ui/generics/issue-98432.stderr
index c7b5c3361..0736d9410 100644
--- a/tests/ui/generics/issue-98432.stderr
+++ b/tests/ui/generics/issue-98432.stderr
@@ -1,13 +1,13 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-98432.rs:5:34
|
LL | impl<T> Struct<T> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | const CONST: fn() = || {
LL | struct _Obligation where T:;
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr b/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
index 33c0f7173..ef31b7266 100644
--- a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/future.classic.stderr
@@ -1,6 +1,6 @@
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
-#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> [async fn body@$DIR/future.rs:32:35: 34:2]: core::future::future::Future`
+#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> {async fn body@$DIR/future.rs:32:35: 34:2}: core::future::future::Future`
#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>`
end of query stack
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
index 957082b60..4f9ceb577 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
@@ -1,4 +1,4 @@
-error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@issue-30786.rs:119:27]>`, but its trait bounds were not satisfied
+error[E0599]: the method `filterx` exists for struct `Map<Repeat, {closure@issue-30786.rs:119:27}>`, but its trait bounds were not satisfied
--> $DIR/issue-30786.rs:120:22
|
LL | pub struct Map<S, F> {
@@ -8,18 +8,18 @@ LL | pub struct Map<S, F> {
| doesn't satisfy `_: StreamExt`
...
LL | let filter = map.filterx(|x: &_| true);
- | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@issue-30786.rs:119:27]>` due to unsatisfied trait bounds
+ | ^^^^^^^ method cannot be called on `Map<Repeat, {closure@issue-30786.rs:119:27}>` due to unsatisfied trait bounds
|
note: the following trait bounds were not satisfied:
- `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
- `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
- `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
+ `&'a mut &Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
+ `&'a mut &mut Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
+ `&'a mut Map<Repeat, {closure@$DIR/issue-30786.rs:119:27: 119:34}>: Stream`
--> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
| --------- - ^^^^^^ unsatisfied trait bound introduced here
-error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, [closure@issue-30786.rs:131:30]>`, but its trait bounds were not satisfied
+error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, {closure@issue-30786.rs:131:30}>`, but its trait bounds were not satisfied
--> $DIR/issue-30786.rs:132:24
|
LL | pub struct Filter<S, F> {
@@ -32,9 +32,9 @@ LL | let count = filter.countx();
| ^^^^^^ method cannot be called due to unsatisfied trait bounds
|
note: the following trait bounds were not satisfied:
- `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
- `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
- `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
+ `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
+ `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
+ `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, {closure@$DIR/issue-30786.rs:131:30: 131:37}>: Stream`
--> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
index c01ab8e34..28c259be3 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr
@@ -4,7 +4,7 @@ error: higher-ranked lifetime error
LL | v.t(|| {});
| ^^^^^^^^^^
|
- = note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:11] well-formed`
+ = note: could not prove `{closure@$DIR/issue-59311.rs:17:9: 17:11} well-formed`
error: higher-ranked lifetime error
--> $DIR/issue-59311.rs:17:9
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
index 4d470ae70..74610b55d 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
+error[E0271]: type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
LL | let v = Unit2.m(
@@ -10,7 +10,7 @@ LL | | f: |x| {
... |
LL | | },
LL | | },
- | |_________^ type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
+ | |_________^ type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
|
note: expected this to be `<_ as Ty<'_>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:21:14
@@ -30,7 +30,7 @@ LL | where
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
-error[E0271]: expected `[closure@issue-62203-hrtb-ice.rs:42:16]` to be a closure that returns `Unit3`, but it returns `Unit4`
+error[E0271]: expected `{closure@issue-62203-hrtb-ice.rs:42:16}` to be a closure that returns `Unit3`, but it returns `Unit4`
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
LL | let v = Unit2.m(
@@ -44,7 +44,7 @@ LL | | },
LL | | },
| |_________^ expected `Unit3`, found `Unit4`
|
-note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to implement `for<'r> T0<'r, (&'r u8,)>`
+note: required for `L<{closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19}>` to implement `for<'r> T0<'r, (&'r u8,)>`
--> $DIR/issue-62203-hrtb-ice.rs:17:16
|
LL | impl<'a, A, T> T0<'a, A> for L<T>
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
index b30dd36d2..2cc2bb2bb 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
@@ -8,6 +8,14 @@ LL | call(f, ());
|
= note: expected a closure with arguments `((),)`
found a closure with arguments `(<_ as ATC<'a>>::Type,)`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-62529-3.rs:25:14
+ |
+LL | call(f, ());
+ | -----^-----
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `call`
--> $DIR/issue-62529-3.rs:9:36
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
index edef6ccd3..7fe803550 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | C: StackContext,
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
@@ -26,6 +31,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | impl<C> EthernetWorker<C> {}
| ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
@@ -48,6 +58,11 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
LL | type Handler = Ctx<C::Dispatcher>;
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89118.rs:1:1
+ |
+LL | trait BufferMut {}
+ | ^^^^^^^^^^^^^^^
note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>`
--> $DIR/issue-89118.rs:5:23
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
index 5be33bccd..55eaef786 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-90950.stderr
@@ -7,6 +7,14 @@ LL | upcast(y)
| required by a bound introduced by this call
|
= help: the trait `IsCovariant<'a>` is implemented for `std::borrow::Cow<'a, T>`
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/issue-90950.rs:50:12
+ |
+LL | upcast(y)
+ | -------^-
+ | | |
+ | | the trait solver is unable to infer the generic types that should be inferred from this argument
+ | add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `upcast`
--> $DIR/issue-90950.rs:27:42
|
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
index 73388a725..081dbb67d 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> <_ as Trait<'a>>::Out: Copy` is not satis
LL | let _: () = weird_bound();
| ^^^^^^^^^^^ the trait `for<'a> Copy` is not implemented for `<_ as Trait<'a>>::Out`
|
+note: this is a known limitation of the trait solver that will be lifted in the future
+ --> $DIR/norm-before-method-resolution.rs:22:17
+ |
+LL | let _: () = weird_bound();
+ | ^^^^^^^^^^^ try adding turbofish arguments to this expression to specify the types manually, even if it's redundant
note: required by a bound in `weird_bound`
--> $DIR/norm-before-method-resolution.rs:18:40
|
diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs
index d71c09879..1f90292f4 100644
--- a/tests/ui/impl-trait/auto-trait-leak.rs
+++ b/tests/ui/impl-trait/auto-trait-leak.rs
@@ -12,7 +12,6 @@ fn cycle1() -> impl Clone {
//~^ ERROR cycle detected
//~| ERROR cycle detected
send(cycle2().clone());
- //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
Rc::new(Cell::new(5))
}
diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr
index a024cff0b..62341f6de 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
--> $DIR/auto-trait-leak.rs:11:16
|
LL | fn cycle1() -> impl Clone {
@@ -10,32 +10,26 @@ note: ...which requires type-checking `cycle1`...
LL | send(cycle2().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:20:16
+note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
+ --> $DIR/auto-trait-leak.rs:19:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:21:5
+ --> $DIR/auto-trait-leak.rs:20:5
|
LL | send(cycle1().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`...
- = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/auto-trait-leak.rs:1:1
- |
-LL | / use std::cell::Cell;
-LL | | use std::rc::Rc;
-LL | |
-LL | | fn send<T: Send>(_: T) {}
-... |
-LL | | Rc::new(String::from("foo"))
-LL | | }
- | |_^
+ = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `cycle1::{opaque#0}`
+ --> $DIR/auto-trait-leak.rs:11:16
+ |
+LL | fn cycle1() -> impl Clone {
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
--> $DIR/auto-trait-leak.rs:11:16
|
LL | fn cycle1() -> impl Clone {
@@ -47,32 +41,26 @@ note: ...which requires type-checking `cycle1`...
LL | send(cycle2().clone());
| ^^^^
= note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:20:16
+note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
+ --> $DIR/auto-trait-leak.rs:19:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:20:1
+ --> $DIR/auto-trait-leak.rs:19:1
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/auto-trait-leak.rs:1:1
- |
-LL | / use std::cell::Cell;
-LL | | use std::rc::Rc;
-LL | |
-LL | | fn send<T: Send>(_: T) {}
-... |
-LL | | Rc::new(String::from("foo"))
-LL | | }
- | |_^
+ = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `cycle1::{opaque#0}`
+ --> $DIR/auto-trait-leak.rs:11:16
+ |
+LL | fn cycle1() -> impl Clone {
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:21:10
+ --> $DIR/auto-trait-leak.rs:20:10
|
LL | send(cycle1().clone());
| ---- ^^^^^^^^^^^^^^^^
@@ -85,7 +73,7 @@ note: opaque type is declared here
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:20:4
+ --> $DIR/auto-trait-leak.rs:19:4
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^
@@ -95,30 +83,6 @@ note: required by a bound in `send`
LL | fn send<T: Send>(_: T) {}
| ^^^^ required by this bound in `send`
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:14:10
- |
-LL | send(cycle2().clone());
- | ---- ^^^^^^^^^^^^^^^^
- | |
- | required by a bound introduced by this call
- |
-note: opaque type is declared here
- --> $DIR/auto-trait-leak.rs:20:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:11:4
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^
-note: required by a bound in `send`
- --> $DIR/auto-trait-leak.rs:4:12
- |
-LL | fn send<T: Send>(_: T) {}
- | ^^^^ required by this bound in `send`
-
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/bound-normalization-fail.rs b/tests/ui/impl-trait/bound-normalization-fail.rs
index 332959247..566a4a7ad 100644
--- a/tests/ui/impl-trait/bound-normalization-fail.rs
+++ b/tests/ui/impl-trait/bound-normalization-fail.rs
@@ -39,8 +39,7 @@ mod lifetimes {
/// Missing bound constraining `Assoc`, `T::Assoc` can't be normalized further.
fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
- //~^ ERROR `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- //~| ERROR: type mismatch
+ //~^ ERROR: type mismatch
Foo(())
}
}
diff --git a/tests/ui/impl-trait/bound-normalization-fail.stderr b/tests/ui/impl-trait/bound-normalization-fail.stderr
index f04a753a0..fcac9ac34 100644
--- a/tests/ui/impl-trait/bound-normalization-fail.stderr
+++ b/tests/ui/impl-trait/bound-normalization-fail.stderr
@@ -19,21 +19,12 @@ help: consider constraining the associated type `<T as impl_trait::Trait>::Assoc
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ++++++++++++
-error[E0658]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
- --> $DIR/bound-normalization-fail.rs:41:41
- |
-LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information
- = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable
-
error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as Trait<'a>>::Assoc`
--> $DIR/bound-normalization-fail.rs:41:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output = T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Foo<()> as FooLike>::Output == <T as Trait<'a>>::Assoc`
-...
+LL |
LL | Foo(())
| ------- return type was inferred to be `Foo<()>` here
|
@@ -49,7 +40,6 @@ help: consider constraining the associated type `<T as lifetimes::Trait<'a>>::As
LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output = T::Assoc> {
| ++++++++++++
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0271, E0658.
-For more information about an error, try `rustc --explain E0271`.
+For more information about this error, try `rustc --explain E0271`.
diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs
new file mode 100644
index 000000000..9c067cb69
--- /dev/null
+++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs
@@ -0,0 +1,21 @@
+#![feature(rustc_attrs)]
+#![rustc_variance_of_opaques]
+
+trait Bar<'a> {
+ type Assoc: From<()>;
+}
+
+fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> {
+ //~^ ERROR [o, o]
+ // captures both T and 'a invariantly
+ ()
+}
+
+fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a {
+ //~^ ERROR [o, o, o]
+ // captures both T and 'a invariantly, and also duplicates `'a`
+ // i.e. the opaque looks like `impl Into<<T as Bar<'a>>::Assoc> + 'a_duplicated`
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr
new file mode 100644
index 000000000..9d52001b0
--- /dev/null
+++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr
@@ -0,0 +1,14 @@
+error: [o, o]
+ --> $DIR/capture-lifetime-not-in-hir.rs:8:29
+ |
+LL | fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: [o, o, o]
+ --> $DIR/capture-lifetime-not-in-hir.rs:14:30
+ |
+LL | fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
index 156a7eb0e..df47208bf 100644
--- a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
+++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs
@@ -1,6 +1,3 @@
-// revisions: current next
-//[next] compile-flags: -Ztrait-solver=next
-
#![feature(type_alias_impl_trait)]
type T = impl Sized;
diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr
index 61fed1629..7c69c4bfe 100644
--- a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr
+++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo`
- --> $DIR/coherence-treats-tait-ambig.rs:10:1
+ --> $DIR/coherence-treats-tait-ambig.rs:7:1
|
LL | impl Into<T> for Foo {
| ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr
new file mode 100644
index 000000000..83791f0d3
--- /dev/null
+++ b/tests/ui/impl-trait/equality-in-canonical-query.clone.stderr
@@ -0,0 +1,29 @@
+error: internal compiler error: no errors encountered even though `delay_span_bug` issued
+
+error: internal compiler error: {OpaqueTypeKey { def_id: DefId(rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }) } }}
+ |
+ =
+
+
+error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }))), bound_vars: [] } } }
+ --> $DIR/equality-in-canonical-query.rs:19:5
+ |
+LL | same_output(foo, rpit);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+
+ --> $DIR/equality-in-canonical-query.rs:19:5
+ |
+LL | same_output(foo, rpit);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+
+
+
+
+
+
+query stack during panic:
+end of query stack
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/impl-trait/equality-in-canonical-query.rs b/tests/ui/impl-trait/equality-in-canonical-query.rs
new file mode 100644
index 000000000..672b1eeea
--- /dev/null
+++ b/tests/ui/impl-trait/equality-in-canonical-query.rs
@@ -0,0 +1,23 @@
+// issue: #116877
+// revisions: sized clone
+//[sized] check-pass
+
+//[clone] known-bug: #108498
+//[clone] failure-status: 101
+//[clone] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
+//[clone] normalize-stderr-test: "(?m)note: .*$" -> ""
+//[clone] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
+//[clone] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
+
+#[cfg(sized)] fn rpit() -> impl Sized {}
+#[cfg(clone)] fn rpit() -> impl Clone {}
+
+fn same_output<Out>(_: impl Fn() -> Out, _: impl Fn() -> Out) {}
+
+pub fn foo() -> impl Sized {
+ same_output(rpit, foo);
+ same_output(foo, rpit);
+ rpit()
+}
+
+fn main () {}
diff --git a/tests/ui/impl-trait/feature-self-return-type.rs b/tests/ui/impl-trait/feature-self-return-type.rs
index 51877e9cc..7555df1b2 100644
--- a/tests/ui/impl-trait/feature-self-return-type.rs
+++ b/tests/ui/impl-trait/feature-self-return-type.rs
@@ -1,5 +1,4 @@
// edition:2018
-#![feature(impl_trait_projections)]
// This test checks that we emit the correct borrowck error when `Self` or a projection is used as
// a return type. See #61949 for context.
diff --git a/tests/ui/impl-trait/feature-self-return-type.stderr b/tests/ui/impl-trait/feature-self-return-type.stderr
index b9b8d00ce..e7113a9df 100644
--- a/tests/ui/impl-trait/feature-self-return-type.stderr
+++ b/tests/ui/impl-trait/feature-self-return-type.stderr
@@ -1,5 +1,5 @@
error[E0597]: `bar` does not live long enough
- --> $DIR/feature-self-return-type.rs:23:22
+ --> $DIR/feature-self-return-type.rs:22:22
|
LL | let x = {
| - borrow later stored here
@@ -12,7 +12,7 @@ LL | };
| - `bar` dropped here while still borrowed
error[E0597]: `y` does not live long enough
- --> $DIR/feature-self-return-type.rs:63:17
+ --> $DIR/feature-self-return-type.rs:62:17
|
LL | let x = {
| - borrow later stored here
@@ -25,7 +25,7 @@ LL | };
| - `y` dropped here while still borrowed
error[E0597]: `y` does not live long enough
- --> $DIR/feature-self-return-type.rs:95:17
+ --> $DIR/feature-self-return-type.rs:94:17
|
LL | let x = {
| - borrow later stored here
diff --git a/tests/ui/impl-trait/impl-subtyper.rs b/tests/ui/impl-trait/impl-subtyper.rs
new file mode 100644
index 000000000..2d99cdd4f
--- /dev/null
+++ b/tests/ui/impl-trait/impl-subtyper.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+#![crate_type = "lib"]
+fn checkpoints() -> impl Iterator {
+ Some(()).iter().flat_map(|_| std::iter::once(()))
+}
+
+fn block_checkpoints() -> impl Iterator {
+ checkpoints()
+}
+
+fn iter_raw() -> impl Iterator {
+ let mut iter = block_checkpoints();
+
+ (0..9).map(move |_| {
+ iter.next();
+ })
+}
diff --git a/tests/ui/impl-trait/impl-subtyper2.rs b/tests/ui/impl-trait/impl-subtyper2.rs
new file mode 100644
index 000000000..2e0acbae6
--- /dev/null
+++ b/tests/ui/impl-trait/impl-subtyper2.rs
@@ -0,0 +1,7 @@
+// check-pass
+
+fn ages() -> Option<impl Iterator> {
+ None::<std::slice::Iter<()>>
+}
+
+fn main(){}
diff --git a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
new file mode 100644
index 000000000..e62662f2f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
@@ -0,0 +1,13 @@
+// compile-flags: --crate-type=lib
+// check-pass
+
+#![feature(return_position_impl_trait_in_trait)]
+#![deny(refining_impl_trait)]
+
+pub trait Tr<T> {
+ fn foo() -> impl for<'a> Tr<&'a Self>;
+}
+
+impl<T> Tr<T> for () {
+ fn foo() -> impl for<'a> Tr<&'a Self> {}
+}
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index cfc2193f6..6e9940211 100644
--- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
@@ -1,4 +1,4 @@
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::ops::Deref;
@@ -8,6 +8,7 @@ pub trait Foo {
pub struct Foreign;
impl Foo for Foreign {
+ #[expect(refining_impl_trait)]
fn bar(self) -> &'static () {
&()
}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
index ff7ad4bf3..fbbbb8585 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -2,7 +2,7 @@
#![feature(return_position_impl_trait_in_trait)]
-trait Iterable {
+pub trait Iterable {
type Item<'a>
where
Self: 'a;
@@ -17,6 +17,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
//~^ ERROR impl has stricter requirements than trait
fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+ //~^ WARN impl trait in impl method signature does not match trait method signature
(*self).iter()
}
}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
index 106b8a7c8..a5fb338ea 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -12,6 +12,22 @@ help: copy the `where` clause predicates from the trait
LL | where Self: 'b;
| ~~~~~~~~~~~~~~
-error: aborting due to previous error
+warning: impl trait in impl method signature does not match trait method signature
+ --> $DIR/bad-item-bound-within-rpitit.rs:19:28
+ |
+LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
+ | ----------------------------------------- return type from trait method defined here
+...
+LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+ | ^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+ = note: `#[warn(refining_impl_trait)]` on by default
+help: replace the return type so that it matches the trait
+ |
+LL | fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ {
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0276`.
diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs
index 78cff97c6..fc290f11f 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,15 +1,16 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-struct Wrapper<T>(T);
+pub struct Wrapper<T>(T);
-trait Foo {
+pub trait Foo {
fn bar() -> Wrapper<impl Sized>;
}
impl Foo for () {
+ #[expect(refining_impl_trait)]
fn bar() -> Wrapper<i32> {
Wrapper(0)
}
diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs
index b0c93a029..6285d7786 100644
--- a/tests/ui/impl-trait/in-trait/foreign.rs
+++ b/tests/ui/impl-trait/in-trait/foreign.rs
@@ -1,14 +1,25 @@
// check-pass
// aux-build: rpitit.rs
+#![feature(lint_reasons)]
+
extern crate rpitit;
use rpitit::{Foo, Foreign};
use std::sync::Arc;
// Implement an RPITIT from another crate.
-struct Local;
+pub struct Local;
impl Foo for Local {
+ #[expect(refining_impl_trait)]
+ fn bar(self) -> Arc<String> {
+ Arc::new(String::new())
+ }
+}
+
+struct LocalIgnoreRefining;
+impl Foo for LocalIgnoreRefining {
+ #[deny(refining_impl_trait)]
fn bar(self) -> Arc<String> {
Arc::new(String::new())
}
@@ -23,4 +34,5 @@ fn main() {
let &() = Foreign.bar();
let x: Arc<String> = Local.bar();
+ let x: Arc<String> = LocalIgnoreRefining.bar();
}
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 5d55b9fa4..18bb63745 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -6,7 +6,11 @@ LL | MyTrait::foo(&self)
| |
| required by a bound introduced by this call
|
- = help: the trait `MyTrait` is implemented for `Outer`
+help: consider removing the leading `&`-reference
+ |
+LL - MyTrait::foo(&self)
+LL + MyTrait::foo(self)
+ |
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
--> $DIR/issue-102140.rs:23:9
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index 61c91e644..ccb53031c 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -8,14 +8,6 @@ trait Foo {
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
}
-struct A;
-
-impl Foo for A {
- fn bar(self) -> &'static str {
- "Hello, world"
- }
-}
-
fn foo<T: Foo>(t: T) {
let () = t.bar();
//~^ ERROR mismatched types
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index 87219941d..594b9ae9c 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:20:9
+ --> $DIR/issue-102571.rs:12:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
diff --git a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
new file mode 100644
index 000000000..49d36d6c9
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
+
+trait Trait {
+ type Type;
+
+ fn method(&self) -> impl Trait<Type: '_>;
+}
+
+impl Trait for () {
+ type Type = ();
+
+ fn method(&self) -> impl Trait<Type: '_> {
+ ()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
index 65285e3a3..58ba1acaf 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,26 +1,28 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
use std::ops::Deref;
-trait Foo {
+pub trait Foo {
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
}
-struct A;
+pub struct A;
impl Foo for A {
+ #[expect(refining_impl_trait)]
fn bar(self) -> &'static str {
"Hello, world"
}
}
-struct B;
+pub struct B;
impl Foo for B {
+ #[expect(refining_impl_trait)]
fn bar(self) -> Box<i32> {
Box::new(42)
}
diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
new file mode 100644
index 000000000..f221cfbb1
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
@@ -0,0 +1,23 @@
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(return_position_impl_trait_in_trait)]
+
+fn main() {
+ let vec: Vec<Box<dyn Trait>> = Vec::new();
+
+ for i in vec {
+ i.fn_2();
+ }
+}
+
+trait OtherTrait {}
+
+trait Trait {
+ fn fn_1(&self) -> impl OtherTrait
+ where
+ Self: Sized;
+
+ fn fn_2(&self) -> bool;
+}
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index dd35b9a2d..d1c9fba4e 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -8,7 +8,7 @@ trait Foo {
}
impl Foo for u32 {
- fn baz(&self) -> u32 {
+ fn baz(&self) -> impl Debug {
32
}
}
@@ -19,4 +19,5 @@ fn main() {
//~| ERROR the trait `Foo` cannot be made into an object
let s = i.baz();
//~^ ERROR the trait `Foo` cannot be made into an object
+ //~| ERROR the trait `Foo` cannot be made into an object
}
diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 4a3b3b114..0170dc5d0 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -14,6 +14,21 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-safety.rs:20:15
+ |
+LL | let s = i.baz();
+ | ^^^ `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 <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/object-safety.rs:7:22
+ |
+LL | trait Foo {
+ | --- this trait cannot be made into an object...
+LL | fn baz(&self) -> impl Debug;
+ | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
+ = help: consider moving `baz` to another trait
+
+error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/object-safety.rs:20:13
|
LL | let s = i.baz();
@@ -44,6 +59,6 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
= note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs
new file mode 100644
index 000000000..a91f9b3e7
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/refine.rs
@@ -0,0 +1,48 @@
+#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
+#![deny(refining_impl_trait)]
+
+pub trait Foo {
+ fn bar() -> impl Sized;
+}
+
+pub struct A;
+impl Foo for A {
+ fn bar() -> impl Copy {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+pub struct B;
+impl Foo for B {
+ fn bar() {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+pub struct C;
+impl Foo for C {
+ fn bar() -> () {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+struct Private;
+impl Foo for Private {
+ fn bar() -> () {}
+}
+
+pub trait Arg<A> {
+ fn bar() -> impl Sized;
+}
+impl Arg<Private> for A {
+ fn bar() -> () {}
+}
+
+pub trait Late {
+ fn bar<'a>(&'a self) -> impl Sized + 'a;
+}
+
+pub struct D;
+impl Late for D {
+ fn bar(&self) -> impl Copy + '_ {}
+ //~^ ERROR impl method signature does not match trait method signature
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
new file mode 100644
index 000000000..29aa08e25
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -0,0 +1,67 @@
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:10:22
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() -> impl Copy {}
+ | ^^^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+note: the lint level is defined here
+ --> $DIR/refine.rs:2:9
+ |
+LL | #![deny(refining_impl_trait)]
+ | ^^^^^^^^^^^^^^^^^^^
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | ~~~~~~~~~~
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:16:5
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() {}
+ | ^^^^^^^^
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | +++++++++++++
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:22:17
+ |
+LL | fn bar() -> impl Sized;
+ | ---------- return type from trait method defined here
+...
+LL | fn bar() -> () {}
+ | ^^
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar() -> impl Sized {}
+ | ~~~~~~~~~~
+
+error: impl trait in impl method signature does not match trait method signature
+ --> $DIR/refine.rs:44:27
+ |
+LL | fn bar<'a>(&'a self) -> impl Sized + 'a;
+ | --------------- return type from trait method defined here
+...
+LL | fn bar(&self) -> impl Copy + '_ {}
+ | ^^^^ this bound is stronger than that defined on the trait
+ |
+ = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+help: replace the return type so that it matches the trait
+ |
+LL | fn bar(&self) -> impl Sized + '_ {}
+ | ~~~~~~~~~~~~~~~
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index d6ede1cc4..b1b46d75b 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,13 +1,14 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-trait Foo {
+pub trait Foo {
fn f() -> Box<impl Sized>;
}
impl Foo for () {
+ #[expect(refining_impl_trait)]
fn f() -> Box<String> {
Box::new(String::new())
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
new file mode 100644
index 000000000..5e14a7f8e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
@@ -0,0 +1,26 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Extend {
+ fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str);
+}
+
+impl Extend for () {
+ fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ //~^ ERROR in type `&'static &'a ()`, reference has a longer lifetime than the data it references
+ where
+ 'a: 'static,
+ {
+ (None, s)
+ }
+}
+
+// This indirection is not necessary for reproduction,
+// but it makes this test future-proof against #114936.
+fn extend<T: Extend>(s: &str) -> &'static str {
+ <T as Extend>::extend(s).1
+}
+
+fn main() {
+ let use_after_free = extend::<()>(&String::from("temporary"));
+ println!("{}", use_after_free);
+}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
new file mode 100644
index 000000000..1d947310e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
@@ -0,0 +1,16 @@
+error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38
+ |
+LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the pointer is valid for the static lifetime
+note: but the referenced data is only valid for the lifetime `'a` as defined here
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15
+ |
+LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
new file mode 100644
index 000000000..c1885af4e
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
@@ -0,0 +1,23 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Extend {
+ fn extend(_: &str) -> (impl Sized + '_, &'static str);
+}
+
+impl Extend for () {
+ fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ //~^ ERROR in type `&'static &()`, reference has a longer lifetime than the data it references
+ (None, s)
+ }
+}
+
+// This indirection is not necessary for reproduction,
+// but it makes this test future-proof against #114936.
+fn extend<T: Extend>(s: &str) -> &'static str {
+ <T as Extend>::extend(s).1
+}
+
+fn main() {
+ let use_after_free = extend::<()>(&String::from("temporary"));
+ println!("{}", use_after_free);
+}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
new file mode 100644
index 000000000..7b63e72ac
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
@@ -0,0 +1,16 @@
+error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:27
+ |
+LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the pointer is valid for the static lifetime
+note: but the referenced data is only valid for the anonymous lifetime defined here
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:18
+ |
+LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
index 7682884f8..44a2b4303 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -1,6 +1,6 @@
// issue: 113903
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::ops::Deref;
@@ -10,6 +10,7 @@ pub trait Tr {
}
impl Tr for () {
+ #[expect(refining_impl_trait)]
fn w() -> &'static () {
&()
}
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr
new file mode 100644
index 000000000..468cf12f1
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/signature-mismatch.rs:79:10
+ |
+LL | &'a self,
+ | -------- this parameter and the return type are declared with different lifetimes...
+...
+LL | ) -> impl Future<Output = Vec<u8>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | ...but data from `buff` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 1d63a6f3c..685c0f06e 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -1,26 +1,36 @@
// edition:2021
+// revisions: success failure
+//[success] check-pass
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
use std::future::Future;
-trait Captures<'a> {}
+pub trait Captures<'a> {}
impl<T> Captures<'_> for T {}
-trait Captures2<'a, 'b> {}
+pub trait Captures2<'a, 'b> {}
impl<T> Captures2<'_, '_> for T {}
pub trait AsyncTrait {
+ #[cfg(success)]
fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
+
+ #[cfg(success)]
fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
+
+ #[cfg(success)]
fn async_fn_multiple<'a>(&'a self, buff: &[u8])
- -> impl Future<Output = Vec<u8>> + Captures<'a>;
+ -> impl Future<Output = Vec<u8>> + Captures<'a>;
+
+ #[cfg(failure)]
fn async_fn_reduce_outlive<'a, T>(
&'a self,
buff: &[u8],
t: T,
) -> impl Future<Output = Vec<u8>> + 'a;
+
+ #[cfg(success)]
fn async_fn_reduce<'a, T>(
&'a self,
buff: &[u8],
@@ -31,38 +41,52 @@ pub trait AsyncTrait {
pub struct Struct;
impl AsyncTrait for Struct {
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // Does not capture more lifetimes that trait def'n, since trait def'n
+ // implicitly captures all in-scope lifetimes.
+ #[cfg(success)]
+ #[expect(refining_impl_trait)]
fn async_fn_multiple<'a, 'b>(
&'a self,
buff: &'b [u8],
) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
- //~^ ERROR return type captures more lifetimes than trait definition
async move { buff.to_vec() }
}
+ // This error message is awkward, but `impl Future<Output = Vec<u8>>`
+ // cannot outlive `'a` (from the trait signature) because it captures
+ // both `T` and `'b`.
+ #[cfg(failure)]
fn async_fn_reduce_outlive<'a, 'b, T>(
&'a self,
buff: &'b [u8],
t: T,
) -> impl Future<Output = Vec<u8>> {
- //~^ ERROR the parameter type `T` may not live long enough
+ //[failure]~^ ERROR lifetime mismatch
async move {
let _t = t;
vec![]
}
}
- // OK: We remove the `Captures<'a>`, providing a guarantee that we don't capture `'a`,
- // but we still fulfill the `Captures<'a>` trait bound.
+ // Does not capture fewer lifetimes that trait def'n (not that it matters),
+ // since impl also captures all in-scope lifetimes.
+ #[cfg(success)]
fn async_fn_reduce<'a, 'b, T>(&'a self, buff: &'b [u8], t: T) -> impl Future<Output = Vec<u8>> {
async move {
let _t = t;
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr
deleted file mode 100644
index 616f1ac35..000000000
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:34:47
- |
-LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:15:40
- |
-LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:39:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:16:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:47:10
- |
-LL | fn async_fn_multiple<'a, 'b>(
- | -- this lifetime was captured
-...
-LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:18:12
- |
-LL | -> impl Future<Output = Vec<u8>> + Captures<'a>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>`
-
-error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/signature-mismatch.rs:56:10
- |
-LL | ) -> impl Future<Output = Vec<u8>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds...
- |
-note: ...that is required by this bound
- --> $DIR/signature-mismatch.rs:23:42
- |
-LL | ) -> impl Future<Output = Vec<u8>> + 'a;
- | ^^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>(
- | ++++
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
index c9ee877db..41fc28588 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,10 +1,10 @@
// check-pass
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
-trait Foo {
+pub trait Foo {
fn bar(&self) -> impl Sized;
}
@@ -12,6 +12,7 @@ impl<U> Foo for U
where
U: Copy,
{
+ #[expect(refining_impl_trait)]
fn bar(&self) -> U {
*self
}
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 4cbe682b4..7d415ea17 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,29 +1,32 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
+#![feature(return_position_impl_trait_in_trait, lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
-trait Foo {
+pub trait Foo {
fn bar(&self) -> impl Display;
}
impl Foo for i32 {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> i32 {
*self
}
}
impl Foo for &'static str {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> &'static str {
*self
}
}
-struct Yay;
+pub struct Yay;
impl Foo for Yay {
+ #[expect(refining_impl_trait)]
fn bar(&self) -> String {
String::from(":^)")
}
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
new file mode 100644
index 000000000..f8e4ab88c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -0,0 +1,20 @@
+#![feature(rustc_attrs, return_position_impl_trait_in_trait)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Foo<'i> {
+ fn implicit_capture_early<'a: 'a>() -> impl Sized {}
+ //~^ [o, *, *, o, o]
+ // Self, 'i, 'a, 'i_duplicated, 'a_duplicated
+
+ fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [o, *, *, o, o]
+
+ fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} //~ [o, *, o, o]
+
+ fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o, *, o, o]
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/variance.stderr b/tests/ui/impl-trait/in-trait/variance.stderr
new file mode 100644
index 000000000..8cae5a92f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/variance.stderr
@@ -0,0 +1,26 @@
+error: [o, *, *, o, o]
+ --> $DIR/variance.rs:9:44
+ |
+LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o, *, *, o, o]
+ --> $DIR/variance.rs:13:44
+ |
+LL | fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, *, o, o]
+ --> $DIR/variance.rs:15:48
+ |
+LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o, *, o, o]
+ --> $DIR/variance.rs:17:48
+ |
+LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/impl-trait/issue-103181-2.rs b/tests/ui/impl-trait/issue-103181-2.rs
index 34deb98be..b43ac4507 100644
--- a/tests/ui/impl-trait/issue-103181-2.rs
+++ b/tests/ui/impl-trait/issue-103181-2.rs
@@ -24,8 +24,6 @@ where
B: Send, // <- a second bound
{
normalize(broken_fut(), ());
- //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
- //~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits
}
fn main() {}
diff --git a/tests/ui/impl-trait/issue-103181-2.stderr b/tests/ui/impl-trait/issue-103181-2.stderr
index cb5253ea6..5eb2dd918 100644
--- a/tests/ui/impl-trait/issue-103181-2.stderr
+++ b/tests/ui/impl-trait/issue-103181-2.stderr
@@ -4,61 +4,6 @@ error[E0425]: cannot find value `ident_error` in this scope
LL | ident_error;
| ^^^^^^^^^^^ not found in this scope
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/issue-103181-2.rs:26:15
- |
-LL | normalize(broken_fut(), ());
- | --------- ^^^^^^^^^^^^
- | |
- | required by a bound introduced by this call
- |
-note: opaque type is declared here
- --> $DIR/issue-103181-2.rs:11:23
- |
-LL | async fn broken_fut() {
- | ^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/issue-103181-2.rs:20:10
- |
-LL | async fn iceice<A, B>()
- | ^^^^^^
-note: required for `impl Future<Output = ()>` to implement `SendFuture`
- --> $DIR/issue-103181-2.rs:7:17
- |
-LL | impl<Fut: Send> SendFuture for Fut {
- | ---- ^^^^^^^^^^ ^^^
- | |
- | unsatisfied trait bound introduced here
-note: required by a bound in `normalize`
- --> $DIR/issue-103181-2.rs:18:19
- |
-LL | fn normalize<Fut: SendFuture>(_: Fut, _: Fut::Output) {}
- | ^^^^^^^^^^ required by this bound in `normalize`
-
-error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/issue-103181-2.rs:26:5
- |
-LL | normalize(broken_fut(), ());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: opaque type is declared here
- --> $DIR/issue-103181-2.rs:11:23
- |
-LL | async fn broken_fut() {
- | ^
-note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/issue-103181-2.rs:20:10
- |
-LL | async fn iceice<A, B>()
- | ^^^^^^
-note: required for `impl Future<Output = ()>` to implement `SendFuture`
- --> $DIR/issue-103181-2.rs:7:17
- |
-LL | impl<Fut: Send> SendFuture for Fut {
- | ---- ^^^^^^^^^^ ^^^
- | |
- | unsatisfied trait bound introduced here
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/impl-trait/issue-108591.rs b/tests/ui/impl-trait/issue-108591.rs
index 6b9d14941..91ea2e9fb 100644
--- a/tests/ui/impl-trait/issue-108591.rs
+++ b/tests/ui/impl-trait/issue-108591.rs
@@ -13,7 +13,8 @@ impl MyTy<'_> {
}
}
-type Opaque<'a> = impl Sized;
+type Opaque2 = impl Sized;
+type Opaque<'a> = Opaque2;
fn define<'a>() -> Opaque<'a> {}
fn test<'a>() {
diff --git a/tests/ui/impl-trait/issue-108592.rs b/tests/ui/impl-trait/issue-108592.rs
index 58a0ed9bf..953fffc48 100644
--- a/tests/ui/impl-trait/issue-108592.rs
+++ b/tests/ui/impl-trait/issue-108592.rs
@@ -11,7 +11,8 @@ fn test_closure() {
closure(&opaque());
}
-type Opaque<'a> = impl Sized;
+type Opaque2 = impl Sized;
+type Opaque<'a> = Opaque2;
fn define<'a>() -> Opaque<'a> {}
fn test_tait(_: &Opaque<'_>) {
diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr
deleted file mode 100644
index 477c964bd..000000000
--- a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- --> $DIR/issue-55872-2.rs:17:9
- |
-LL | async {}
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr
deleted file mode 100644
index 477c964bd..000000000
--- a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- --> $DIR/issue-55872-2.rs:17:9
- |
-LL | async {}
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/impl-trait/issue-55872-2.rs b/tests/ui/impl-trait/issue-55872-2.rs
index 7a5cb3b3d..8a96fdc5c 100644
--- a/tests/ui/impl-trait/issue-55872-2.rs
+++ b/tests/ui/impl-trait/issue-55872-2.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(impl_trait_in_assoc_type)]
@@ -16,7 +13,7 @@ impl<S> Bar for S {
fn foo<T>() -> Self::E {
async {}
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- //[drop_tracking_mir]~^^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
+ //~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
}
}
diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr b/tests/ui/impl-trait/issue-55872-2.stderr
index c14bb5cc9..3e70f1cf8 100644
--- a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr
+++ b/tests/ui/impl-trait/issue-55872-2.stderr
@@ -1,11 +1,11 @@
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- --> $DIR/issue-55872-2.rs:17:9
+ --> $DIR/issue-55872-2.rs:14:9
|
LL | async {}
| ^^^^^^^^
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
- --> $DIR/issue-55872-2.rs:17:9
+ --> $DIR/issue-55872-2.rs:14:9
|
LL | async {}
| ^^^^^^^^
diff --git a/tests/ui/impl-trait/issue-55872-3.stderr b/tests/ui/impl-trait/issue-55872-3.stderr
index 827988974..b542b6141 100644
--- a/tests/ui/impl-trait/issue-55872-3.stderr
+++ b/tests/ui/impl-trait/issue-55872-3.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]: Copy` is not satisfied
+error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}: Copy` is not satisfied
--> $DIR/issue-55872-3.rs:13:20
|
LL | fn foo<T>() -> Self::E {
- | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]`
+ | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:17}`
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/issue-86465.rs b/tests/ui/impl-trait/issue-86465.rs
index 8c7b41d73..a79bb6474 100644
--- a/tests/ui/impl-trait/issue-86465.rs
+++ b/tests/ui/impl-trait/issue-86465.rs
@@ -1,10 +1,6 @@
#![feature(type_alias_impl_trait)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type X<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type X<'a, 'b> = impl std::fmt::Debug;
fn f<'t, 'u>(a: &'t u32, b: &'u u32) -> (X<'t, 'u>, X<'u, 't>) {
(a, a)
diff --git a/tests/ui/impl-trait/issue-86465.stderr b/tests/ui/impl-trait/issue-86465.stderr
index b949b2b42..90d6904ed 100644
--- a/tests/ui/impl-trait/issue-86465.stderr
+++ b/tests/ui/impl-trait/issue-86465.stderr
@@ -1,5 +1,5 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/issue-86465.rs:10:5
+ --> $DIR/issue-86465.rs:6:5
|
LL | (a, a)
| ^^^^^^
diff --git a/tests/ui/impl-trait/issue-99073.stderr b/tests/ui/impl-trait/issue-99073.stderr
index a8400080e..3c32f1794 100644
--- a/tests/ui/impl-trait/issue-99073.stderr
+++ b/tests/ui/impl-trait/issue-99073.stderr
@@ -10,7 +10,7 @@ error: concrete type differs from previous defining opaque type use
--> $DIR/issue-99073.rs:6:13
|
LL | move || f(fix(&f))
- | ^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G`
+ | ^^^^^^^ expected `{closure@$DIR/issue-99073.rs:6:3: 6:10}`, got `G`
|
note: previous use here
--> $DIR/issue-99073.rs:5:36
diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr
index d43e9fee0..f8e85f7ae 100644
--- a/tests/ui/impl-trait/issues/issue-74282.stderr
+++ b/tests/ui/impl-trait/issues/issue-74282.stderr
@@ -14,7 +14,7 @@ LL | | })
| |_____^ expected opaque type, found closure
|
= note: expected opaque type `Closure`
- found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]`
+ found closure `{closure@$DIR/issue-74282.rs:8:15: 8:17}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
note: tuple struct defined here
diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr
index 6db603e77..8817eb7d2 100644
--- a/tests/ui/impl-trait/issues/issue-78722-2.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr
@@ -7,7 +7,7 @@ LL | let f: F = async { 1 };
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
-error[E0271]: expected `[async block@$DIR/issue-78722-2.rs:13:13: 13:21]` to be a future that resolves to `u8`, but it resolves to `()`
+error[E0271]: expected `{async block@$DIR/issue-78722-2.rs:13:13: 13:21}` to be a future that resolves to `u8`, but it resolves to `()`
--> $DIR/issue-78722-2.rs:11:30
|
LL | fn concrete_use() -> F {
diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr
index 36340a0ba..5ad659697 100644
--- a/tests/ui/impl-trait/issues/issue-78722.stderr
+++ b/tests/ui/impl-trait/issues/issue-78722.stderr
@@ -7,7 +7,7 @@ LL | let f: F = async { 1 };
= note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information
= help: add `#![feature(const_async_blocks)]` to the crate attributes to enable
-error[E0271]: expected `[async block@$DIR/issue-78722.rs:10:13: 10:21]` to be a future that resolves to `u8`, but it resolves to `()`
+error[E0271]: expected `{async block@$DIR/issue-78722.rs:10:13: 10:21}` to be a future that resolves to `u8`, but it resolves to `()`
--> $DIR/issue-78722.rs:8:30
|
LL | fn concrete_use() -> F {
diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr
index facab390d..8228f8ace 100644
--- a/tests/ui/impl-trait/issues/issue-86800.stderr
+++ b/tests/ui/impl-trait/issues/issue-86800.stderr
@@ -7,6 +7,6 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResu
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
-#0 [type_of] computing type of `TransactionFuture::{opaque#0}`
-#1 [check_mod_item_types] checking item types in top-level module
+#0 [type_of_opaque] computing type of opaque `TransactionFuture::{opaque#0}`
+#1 [type_of] computing type of `TransactionFuture::{opaque#0}`
end of query stack
diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
index 55e3cd950..33b48b1e9 100644
--- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
+++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -104,7 +104,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
| -- ---------------- opaque type defined here
| |
- | hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13]` captures the lifetime `'b` as defined here
+ | hidden type `{closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13}` captures the lifetime `'b` as defined here
LL | move |_| println!("{}", y)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index b85bb5efd..125262b96 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -5,7 +5,7 @@ LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
-note: required for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` to implement `Trait`
+note: required for `{closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7}` to implement `Trait`
--> $DIR/nested-return-type2-tait2.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index 19fd3c134..c2332b6e4 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -5,7 +5,7 @@ LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `impl Send`
|
= help: the trait `Duh` is implemented for `i32`
-note: required for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` to implement `Trait`
+note: required for `{closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7}` to implement `Trait`
--> $DIR/nested-return-type2-tait3.rs:14:31
|
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr
index 907822ebb..a1e2d227f 100644
--- a/tests/ui/impl-trait/nested-return-type4.stderr
+++ b/tests/ui/impl-trait/nested-return-type4.stderr
@@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifeti
LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> {
| -- --------------------------------------------- opaque type defined here
| |
- | hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here
+ | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:31}` captures the lifetime `'s` as defined here
LL | async move { let _s = s; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index 5fbba9a85..ada8fd7fa 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -1,25 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/normalize-tait-in-const.rs:26:5
- |
-LL | fun(filter_positive());
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const std::ops::Fn<(&Alias<'_>,)>>(fun: F) {
- | ++++++++++++++++++++++++++++++++++++
-
-error[E0493]: destructor of `F` cannot be evaluated at compile-time
- --> $DIR/normalize-tait-in-const.rs:25:79
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/normalize-tait-in-const.rs:25:42
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
- | ^^^ the destructor for this type cannot be evaluated in constant functions
-LL | fun(filter_positive());
-LL | }
- | - value is dropped here
+ | ^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0493.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-generator.rs
index e876f0fb4..000af70c4 100644
--- a/tests/ui/impl-trait/recursive-generator.rs
+++ b/tests/ui/impl-trait/recursive-generator.rs
@@ -7,7 +7,6 @@ fn foo() -> impl Generator<Yield = (), Return = ()> {
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
- //~^ NOTE returning here
let mut gen = Box::pin(foo());
//~^ NOTE generator captures itself here
let mut r = gen.as_mut().resume(());
diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-generator.stderr
index e23fd4b4a..86e193d95 100644
--- a/tests/ui/impl-trait/recursive-generator.stderr
+++ b/tests/ui/impl-trait/recursive-generator.stderr
@@ -1,18 +1,11 @@
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-generator.rs:5:13
|
-LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
+LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
...
-LL | / || {
-LL | |
-LL | | let mut gen = Box::pin(foo());
- | | ------- generator captures itself here
-LL | |
-... |
-LL | | }
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-generator.rs:9:5: 9:7]`
+LL | let mut gen = Box::pin(foo());
+ | ------- generator captures itself here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr
deleted file mode 100644
index 43118ae38..000000000
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr
+++ /dev/null
@@ -1,152 +0,0 @@
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
- |
-LL | fn option(i: i32) -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | if i < 0 { None } else { Some((option(i - 1), i)) }
- | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>`
- | |
- | returning here with type `Option<(impl Sized, i32)>`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
- |
-LL | fn tuple() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (tuple(),)
- | ---------- returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
- |
-LL | fn array() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | [array()]
- | --------- returning here with type `[impl Sized; 1]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
- |
-LL | fn ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | &ptr() as *const _
- | ------------------ returning here with type `*const impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
- |
-LL | fn fn_ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | fn_ptr as fn() -> _
- | ------------------- returning here with type `fn() -> impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
- |
-LL | fn closure_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
- |
-LL | fn closure_ref_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | &x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
- |
-LL | fn closure_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
- |
-LL | fn generator_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
- |
-LL | fn generator_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | yield;
-LL | | x;
- | | - generator captures itself here
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
- |
-LL | fn substs_change<T: 'static>() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (substs_change::<&T>(),)
- | ------------------------ returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
- |
-LL | fn generator_hold() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | / move || {
-LL | | let x = generator_hold();
- | | - generator captures itself here
-LL | | yield;
-LL | | x;
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
- |
-LL | fn mutual_recursion() -> impl Sync {
- | ^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion_b()
- | -------------------- returning here with type `impl Sized`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ---------- returning this opaque type `impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
- |
-LL | fn mutual_recursion() -> impl Sync {
- | --------- returning this opaque type `impl Sync`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion()
- | ------------------ returning here with type `impl Sync`
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr
deleted file mode 100644
index 43118ae38..000000000
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr
+++ /dev/null
@@ -1,152 +0,0 @@
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
- |
-LL | fn option(i: i32) -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | if i < 0 { None } else { Some((option(i - 1), i)) }
- | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>`
- | |
- | returning here with type `Option<(impl Sized, i32)>`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
- |
-LL | fn tuple() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (tuple(),)
- | ---------- returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
- |
-LL | fn array() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | [array()]
- | --------- returning here with type `[impl Sized; 1]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
- |
-LL | fn ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | &ptr() as *const _
- | ------------------ returning here with type `*const impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
- |
-LL | fn fn_ptr() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | fn_ptr as fn() -> _
- | ------------------- returning here with type `fn() -> impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
- |
-LL | fn closure_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
- |
-LL | fn closure_ref_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | &x;
- | | - closure captures itself here
-LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
- |
-LL | fn closure_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
- |
-LL | fn generator_sig() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
- |
-LL | fn generator_capture() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-...
-LL | / move || {
-LL | | yield;
-LL | | x;
- | | - generator captures itself here
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
- |
-LL | fn substs_change<T: 'static>() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | (substs_change::<&T>(),)
- | ------------------------ returning here with type `(impl Sized,)`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
- |
-LL | fn generator_hold() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | / move || {
-LL | | let x = generator_hold();
- | | - generator captures itself here
-LL | | yield;
-LL | | x;
-LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
- |
-LL | fn mutual_recursion() -> impl Sync {
- | ^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion_b()
- | -------------------- returning here with type `impl Sized`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ---------- returning this opaque type `impl Sized`
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
- |
-LL | fn mutual_recursion() -> impl Sync {
- | --------- returning this opaque type `impl Sync`
-...
-LL | fn mutual_recursion_b() -> impl Sized {
- | ^^^^^^^^^^ recursive opaque type
-LL |
-LL | mutual_recursion()
- | ------------------ returning here with type `impl Sync`
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
index 630372e13..ffc0cd9d1 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
@@ -1,7 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
index 9c67f17e9..1d919fb52 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
@@ -1,5 +1,5 @@
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:11:22
+ --> $DIR/recursive-impl-trait-type-indirect.rs:7:22
|
LL | fn option(i: i32) -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -10,7 +10,7 @@ LL | if i < 0 { None } else { Some((option(i - 1), i)) }
| returning here with type `Option<(impl Sized, i32)>`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:16:15
+ --> $DIR/recursive-impl-trait-type-indirect.rs:12:15
|
LL | fn tuple() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -19,7 +19,7 @@ LL | (tuple(),)
| ---------- returning here with type `(impl Sized,)`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:21:15
+ --> $DIR/recursive-impl-trait-type-indirect.rs:17:15
|
LL | fn array() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -28,7 +28,7 @@ LL | [array()]
| --------- returning here with type `[impl Sized; 1]`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:26:13
+ --> $DIR/recursive-impl-trait-type-indirect.rs:22:13
|
LL | fn ptr() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -37,7 +37,7 @@ LL | &ptr() as *const _
| ------------------ returning here with type `*const impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:31:16
+ --> $DIR/recursive-impl-trait-type-indirect.rs:27:16
|
LL | fn fn_ptr() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -46,7 +46,7 @@ LL | fn_ptr as fn() -> _
| ------------------- returning here with type `fn() -> impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:36:25
+ --> $DIR/recursive-impl-trait-type-indirect.rs:32:25
|
LL | fn closure_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -55,10 +55,10 @@ LL | / move || {
LL | | x;
| | - closure captures itself here
LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]`
+ | |_____- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 35:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:44:29
+ --> $DIR/recursive-impl-trait-type-indirect.rs:40:29
|
LL | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -67,28 +67,28 @@ LL | / move || {
LL | | &x;
| | - closure captures itself here
LL | | }
- | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]`
+ | |_____- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 43:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:52:21
+ --> $DIR/recursive-impl-trait-type-indirect.rs:48:21
|
LL | fn closure_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
LL | || closure_sig()
- | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]`
+ | ---------------- returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:7}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:57:23
+ --> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
LL | fn generator_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
LL | || generator_sig()
- | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]`
+ | ------------------ returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:62:27
+ --> $DIR/recursive-impl-trait-type-indirect.rs:58:27
|
LL | fn generator_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -98,10 +98,10 @@ LL | | yield;
LL | | x;
| | - generator captures itself here
LL | | }
- | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]`
+ | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:71:35
+ --> $DIR/recursive-impl-trait-type-indirect.rs:67:35
|
LL | fn substs_change<T: 'static>() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -110,7 +110,7 @@ LL | (substs_change::<&T>(),)
| ------------------------ returning here with type `(impl Sized,)`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
+ --> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
@@ -119,7 +119,7 @@ LL | let x = generator_hold();
| - generator captures itself here
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:90:26
+ --> $DIR/recursive-impl-trait-type-indirect.rs:86:26
|
LL | fn mutual_recursion() -> impl Sync {
| ^^^^^^^^^ recursive opaque type
@@ -131,7 +131,7 @@ LL | fn mutual_recursion_b() -> impl Sized {
| ---------- returning this opaque type `impl Sized`
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-impl-trait-type-indirect.rs:95:28
+ --> $DIR/recursive-impl-trait-type-indirect.rs:91:28
|
LL | fn mutual_recursion() -> impl Sync {
| --------- returning this opaque type `impl Sync`
diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr
index 488cb821c..4be244068 100644
--- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr
+++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr
@@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----- ----------------------- opaque type defined here
| |
- | hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here
+ | hidden type `Map<std::slice::Iter<'_, (u32, u32)>, {closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30}>` captures the anonymous lifetime defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -- ----------------------- opaque type defined here
| |
- | hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30]>` captures the lifetime `'a` as defined here
+ | hidden type `Map<std::slice::Iter<'a, (u32, u32)>, {closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30}>` captures the lifetime `'a` as defined here
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
diff --git a/tests/ui/impl-trait/variance.rs b/tests/ui/impl-trait/variance.rs
new file mode 100644
index 000000000..d6212f8f3
--- /dev/null
+++ b/tests/ui/impl-trait/variance.rs
@@ -0,0 +1,16 @@
+#![feature(rustc_attrs)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn not_captured_early<'a: 'a>() -> impl Sized {} //~ [*]
+
+fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [*, o]
+
+fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} //~ []
+
+fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o]
+
+fn main() {}
diff --git a/tests/ui/impl-trait/variance.stderr b/tests/ui/impl-trait/variance.stderr
new file mode 100644
index 000000000..644736754
--- /dev/null
+++ b/tests/ui/impl-trait/variance.stderr
@@ -0,0 +1,26 @@
+error: [*]
+ --> $DIR/variance.rs:8:36
+ |
+LL | fn not_captured_early<'a: 'a>() -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [*, o]
+ --> $DIR/variance.rs:10:32
+ |
+LL | fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: []
+ --> $DIR/variance.rs:12:40
+ |
+LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized {}
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:14:36
+ |
+LL | fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/imports/import-after-macro-expand-10.rs b/tests/ui/imports/import-after-macro-expand-10.rs
new file mode 100644
index 000000000..b3520c42d
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-10.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+use crate::b::*;
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-11.rs b/tests/ui/imports/import-after-macro-expand-11.rs
new file mode 100644
index 000000000..2b81dfc23
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-11.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+#[derive(Debug)]
+struct H;
+
+mod p {
+ use super::*;
+
+ #[derive(Clone)]
+ struct H;
+
+ mod t {
+ use super::*;
+
+ fn f() {
+ let h: crate::p::H = H;
+ }
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-12.rs b/tests/ui/imports/import-after-macro-expand-12.rs
new file mode 100644
index 000000000..f92e8c12f
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-12.rs
@@ -0,0 +1,34 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/115377
+
+use module::*;
+
+mod module {
+ pub enum B {}
+ impl B {
+ pub const ASSOC: u8 = 0;
+ }
+}
+
+#[derive()]
+pub enum B {}
+impl B {
+ pub const ASSOC: u16 = 0;
+}
+
+macro_rules! m {
+ ($right:expr) => {
+ $right
+ };
+}
+
+fn main() {
+ let a: u16 = {
+ use self::*;
+ B::ASSOC
+ };
+ let b: u16 = m!({
+ use self::*;
+ B::ASSOC
+ });
+}
diff --git a/tests/ui/imports/import-after-macro-expand-13.rs b/tests/ui/imports/import-after-macro-expand-13.rs
new file mode 100644
index 000000000..fd640002c
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-13.rs
@@ -0,0 +1,22 @@
+// check-pass
+// similar as `import-after-macro-expand-6.rs`
+
+use crate::a::HeaderMap;
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+mod a {
+ pub use crate::b::*;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-14.rs b/tests/ui/imports/import-after-macro-expand-14.rs
new file mode 100644
index 000000000..4d461a0e2
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-14.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+use crate::a::HeaderMap;
+
+mod b {
+ pub mod http {
+ #[derive(Clone)]
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+mod a {
+ pub use crate::b::*;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-2.rs b/tests/ui/imports/import-after-macro-expand-2.rs
index b3996d488..ff773fc82 100644
--- a/tests/ui/imports/import-after-macro-expand-2.rs
+++ b/tests/ui/imports/import-after-macro-expand-2.rs
@@ -12,9 +12,7 @@ mod tests {
use super::*;
fn test_thing() {
- let thing: crate::thing::Thing = Thing::Bar;
- // FIXME: `thing` should refer to `crate::Thing`,
- // FIXME: but doesn't currently refer to it due to backward compatibility
+ let thing: crate::Thing = Thing::Foo;
}
}
diff --git a/tests/ui/imports/import-after-macro-expand-4.rs b/tests/ui/imports/import-after-macro-expand-4.rs
index 02cc3f01a..fc0a232a9 100644
--- a/tests/ui/imports/import-after-macro-expand-4.rs
+++ b/tests/ui/imports/import-after-macro-expand-4.rs
@@ -1,3 +1,4 @@
+// check-pass
// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
// similar with `import-after-macro-expand-2.rs`
@@ -10,16 +11,6 @@ pub use a::*;
mod c {
use crate::*;
pub struct S(Vec<P>);
- //~^ ERROR the size for values of type
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
- //~| WARNING trait objects without an explicit
- //~| WARNING this is accepted in the current edition
-
- // FIXME: should works, but doesn't currently refer
- // to it due to backward compatibility
}
#[derive(Clone)]
diff --git a/tests/ui/imports/import-after-macro-expand-4.stderr b/tests/ui/imports/import-after-macro-expand-4.stderr
deleted file mode 100644
index 01f70cfc5..000000000
--- a/tests/ui/imports/import-after-macro-expand-4.stderr
+++ /dev/null
@@ -1,53 +0,0 @@
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
- = note: `#[warn(bare_trait_objects)]` on by default
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-warning: trait objects without an explicit `dyn` are deprecated
- --> $DIR/import-after-macro-expand-4.rs:12:22
- |
-LL | pub struct S(Vec<P>);
- | ^
- |
- = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
- = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: use `dyn`
- |
-LL | pub struct S(Vec<dyn P>);
- | +++
-
-error[E0277]: the size for values of type `(dyn a::P + 'static)` cannot be known at compilation time
- --> $DIR/import-after-macro-expand-4.rs:12:18
- |
-LL | pub struct S(Vec<P>);
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `(dyn a::P + 'static)`
-note: required by a bound in `Vec`
- --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error: aborting due to previous error; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/imports/import-after-macro-expand-6.rs b/tests/ui/imports/import-after-macro-expand-6.rs
index ab5bb37a1..bff8efebc 100644
--- a/tests/ui/imports/import-after-macro-expand-6.rs
+++ b/tests/ui/imports/import-after-macro-expand-6.rs
@@ -18,7 +18,5 @@ mod b {
use crate::a::HeaderMap;
fn main() {
- let h: crate::b::http::HeaderMap = HeaderMap;
- // FIXME: should refer to `crate::b::HeaderMap`,
- // FIXME: but doesn't currently refer to it due to backward compatibility
+ let h: crate::b::HeaderMap = HeaderMap;
}
diff --git a/tests/ui/imports/import-after-macro-expand-9.rs b/tests/ui/imports/import-after-macro-expand-9.rs
new file mode 100644
index 000000000..deee42c3b
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-9.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+use crate::b::*;
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr
index 6ee0626ca..02c92c1c1 100644
--- a/tests/ui/inference/issue-72616.stderr
+++ b/tests/ui/inference/issue-72616.stderr
@@ -23,7 +23,7 @@ LL | if String::from("a") == "a".try_into().unwrap() {}
| ^^^^^^^^
|
= note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`:
- - impl<> TryFrom<&str> for std::sys_common::net::LookupHost;
+ - impl TryFrom<&str> for std::sys_common::net::LookupHost;
- impl<T, U> TryFrom<U> for T
where U: Into<T>;
= note: required for `&str` to implement `TryInto<_>`
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 8eda71ec0..225558805 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -2,11 +2,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:7:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:7:22
@@ -71,11 +71,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:21:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:21:22
@@ -97,11 +97,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:28:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:28:22
@@ -123,11 +123,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:37:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:37:22
@@ -149,11 +149,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:46:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:46:22
@@ -175,11 +175,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:53:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:53:22
@@ -201,11 +201,11 @@ error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:62:5
|
LL | String::from("x".as_ref());
- | ^^^^^^^^^^^^ cannot infer type for reference `&_`
+ | ^^^^^^ cannot infer type for reference `&_`
|
= note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
- - impl<> From<&String> for String;
- - impl<> From<&str> for String;
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:62:22
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
new file mode 100644
index 000000000..8b8fc46df
--- /dev/null
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature.stderr
@@ -0,0 +1,27 @@
+error[E0275]: overflow evaluating the requirement `X2`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
+ |
+LL | type X1 = X2;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error[E0275]: overflow evaluating the requirement `X3`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
+ |
+LL | type X2 = X3;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error[E0275]: overflow evaluating the requirement `X1`
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
+ |
+LL | type X3 = X1;
+ | ^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr
index bbdb1f70b..ec63688fa 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated.stderr
@@ -1,16 +1,16 @@
error[E0391]: cycle detected when expanding type alias `X1`
- --> $DIR/infinite-type-alias-mutual-recursion.rs:1:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:6:11
|
LL | type X1 = X2;
| ^^
|
note: ...which requires expanding type alias `X2`...
- --> $DIR/infinite-type-alias-mutual-recursion.rs:3:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:9:11
|
LL | type X2 = X3;
| ^^
note: ...which requires expanding type alias `X3`...
- --> $DIR/infinite-type-alias-mutual-recursion.rs:4:11
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:11:11
|
LL | type X3 = X1;
| ^^
@@ -19,12 +19,13 @@ LL | type X3 = X1;
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
- --> $DIR/infinite-type-alias-mutual-recursion.rs:1:1
+ --> $DIR/infinite-type-alias-mutual-recursion.rs:3:1
|
-LL | / type X1 = X2;
+LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
+LL | | #![allow(incomplete_features)]
LL | |
-LL | | type X2 = X3;
-LL | | type X3 = X1;
+LL | | type X1 = X2;
+... |
LL | |
LL | | fn main() {}
| |____________^
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
index 5381eedcf..90c941c63 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
@@ -1,6 +1,14 @@
+// revisions: feature gated
+
+#![cfg_attr(feature, feature(lazy_type_alias))]
+#![allow(incomplete_features)]
+
type X1 = X2;
-//~^ ERROR cycle detected when expanding type alias `X1`
+//[gated]~^ ERROR cycle detected when expanding type alias `X1`
+//[feature]~^^ ERROR: overflow evaluating the requirement `X2`
type X2 = X3;
+//[feature]~^ ERROR: overflow evaluating the requirement `X3`
type X3 = X1;
+//[feature]~^ ERROR: overflow evaluating the requirement `X1`
fn main() {}
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
new file mode 100644
index 000000000..3a1462159
--- /dev/null
+++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr
@@ -0,0 +1,11 @@
+error[E0275]: overflow evaluating the requirement `X`
+ --> $DIR/infinite-vec-type-recursion.rs:6:10
+ |
+LL | type X = Vec<X>;
+ | ^^^^^^
+ |
+ = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.stderr b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr
index a21b033a9..e47d9b652 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.stderr
+++ b/tests/ui/infinite/infinite-vec-type-recursion.gated.stderr
@@ -1,5 +1,5 @@
error[E0391]: cycle detected when expanding type alias `X`
- --> $DIR/infinite-vec-type-recursion.rs:1:14
+ --> $DIR/infinite-vec-type-recursion.rs:6:14
|
LL | type X = Vec<X>;
| ^
@@ -9,11 +9,14 @@ LL | type X = Vec<X>;
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
- --> $DIR/infinite-vec-type-recursion.rs:1:1
+ --> $DIR/infinite-vec-type-recursion.rs:3:1
|
-LL | / type X = Vec<X>;
-LL | |
+LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
+LL | | #![allow(incomplete_features)]
LL | |
+LL | | type X = Vec<X>;
+... |
+LL | | #[rustfmt::skip]
LL | | fn main() { let b: X = Vec::new(); }
| |____________________________________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.rs b/tests/ui/infinite/infinite-vec-type-recursion.rs
index 356818225..71ab4a330 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.rs
+++ b/tests/ui/infinite/infinite-vec-type-recursion.rs
@@ -1,4 +1,11 @@
+// revisions: feature gated
+
+#![cfg_attr(feature, feature(lazy_type_alias))]
+#![allow(incomplete_features)]
+
type X = Vec<X>;
-//~^ ERROR cycle detected
+//[gated]~^ ERROR cycle detected
+//[feature]~^^ ERROR: overflow evaluating the requirement `X`
+#[rustfmt::skip]
fn main() { let b: X = Vec::new(); }
diff --git a/tests/ui/inline-const/promotion.rs b/tests/ui/inline-const/promotion.rs
new file mode 100644
index 000000000..242959c6b
--- /dev/null
+++ b/tests/ui/inline-const/promotion.rs
@@ -0,0 +1,22 @@
+#![feature(inline_const)]
+#![allow(arithmetic_overflow, unconditional_panic)]
+
+// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.
+// Make sure that in a `const` block, we do not promote such calls.
+const fn div_by_zero() -> i32 {
+ 1 / 0
+}
+
+const fn mk_false() -> bool {
+ false
+}
+
+fn main() {
+ let v = const {
+ if mk_false() {
+ let _x: &'static i32 = &div_by_zero();
+ //~^ ERROR: temporary value dropped while borrowed
+ }
+ 42
+ };
+}
diff --git a/tests/ui/inline-const/promotion.stderr b/tests/ui/inline-const/promotion.stderr
new file mode 100644
index 000000000..795fc8f59
--- /dev/null
+++ b/tests/ui/inline-const/promotion.stderr
@@ -0,0 +1,14 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/promotion.rs:17:37
+ |
+LL | let _x: &'static i32 = &div_by_zero();
+ | ------------ ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
+ | |
+ | type annotation requires that borrow lasts for `'static`
+LL |
+LL | }
+ | - temporary value is freed at the end of this statement
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/inner-static-type-parameter.rs b/tests/ui/inner-static-type-parameter.rs
index c08ccd29d..a1994e752 100644
--- a/tests/ui/inner-static-type-parameter.rs
+++ b/tests/ui/inner-static-type-parameter.rs
@@ -4,7 +4,7 @@ enum Bar<T> { What } //~ ERROR parameter `T` is never used
fn foo<T>() {
static a: Bar<T> = Bar::What;
-//~^ ERROR can't use generic parameters from outer function
+//~^ ERROR can't use generic parameters from outer item
}
fn main() {
diff --git a/tests/ui/inner-static-type-parameter.stderr b/tests/ui/inner-static-type-parameter.stderr
index e4e449e41..ff6558e49 100644
--- a/tests/ui/inner-static-type-parameter.stderr
+++ b/tests/ui/inner-static-type-parameter.stderr
@@ -1,10 +1,10 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/inner-static-type-parameter.rs:6:19
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | static a: Bar<T> = Bar::What;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error[E0392]: parameter `T` is never used
--> $DIR/inner-static-type-parameter.rs:3:10
diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr
index d4507a27a..ecd08e3cd 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.stderr
+++ b/tests/ui/intrinsics/const-eval-select-bad.stderr
@@ -4,7 +4,7 @@ error: this argument must be a function item
LL | const_eval_select((), || {}, || {});
| ^^^^^
|
- = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]
+ = note: expected a function item, found {closure@$DIR/const-eval-select-bad.rs:7:27: 7:29}
= help: consult the documentation on `const_eval_select` for more information
error: this argument must be a function item
@@ -13,7 +13,7 @@ error: this argument must be a function item
LL | const_eval_select((), || {}, || {});
| ^^^^^
|
- = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:34: 7:36]
+ = note: expected a function item, found {closure@$DIR/const-eval-select-bad.rs:7:34: 7:36}
= help: consult the documentation on `const_eval_select` for more information
error: this argument must be a function item
diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs b/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs
new file mode 100644
index 000000000..ffaa4d771
--- /dev/null
+++ b/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs
@@ -0,0 +1,6 @@
+#[rustc_safe_intrinsic]
+//~^ ERROR the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe
+//~| ERROR attribute should be applied to intrinsic functions
+fn safe() {}
+
+fn main() {}
diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr b/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr
new file mode 100644
index 000000000..8aeb56598
--- /dev/null
+++ b/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr
@@ -0,0 +1,20 @@
+error[E0658]: the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe
+ --> $DIR/feature-gate-safe-intrinsic.rs:1:1
+ |
+LL | #[rustc_safe_intrinsic]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+
+error: attribute should be applied to intrinsic functions
+ --> $DIR/feature-gate-safe-intrinsic.rs:1:1
+ |
+LL | #[rustc_safe_intrinsic]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn safe() {}
+ | ------------ not an intrinsic function
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs
index b99bb39d0..6f9df6441 100644
--- a/tests/ui/intrinsics/intrinsic-alignment.rs
+++ b/tests/ui/intrinsics/intrinsic-alignment.rs
@@ -1,7 +1,7 @@
// run-pass
// ignore-wasm32-bare seems not important to test here
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
mod rusti {
extern "rust-intrinsic" {
@@ -16,6 +16,7 @@ mod rusti {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
index b5b32d2f0..172ee7ade 100644
--- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr
+++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
@@ -15,11 +15,13 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for Multipl
= note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
= note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`)
-error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced, none found
+error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
--> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1
|
LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected a single field to be coerced, none found
error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
--> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1
diff --git a/tests/ui/issues/auxiliary/issue-111011.stderr b/tests/ui/issues/auxiliary/issue-111011.stderr
index 082f0f035..c0b48c584 100644
--- a/tests/ui/issues/auxiliary/issue-111011.stderr
+++ b/tests/ui/issues/auxiliary/issue-111011.stderr
@@ -17,7 +17,7 @@ LL | bar(async move || {});
| arguments to this function are incorrect
|
= note: expected struct `Box<(dyn FnOnce() -> _ + 'static)>`
- found closure `[closure@$DIR/issue-111011.rs:11:9: 11:22]`
+ found closure `{closure@$DIR/issue-111011.rs:11:9: 11:22}`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: function defined here
--> $DIR/issue-111011.rs:7:4
diff --git a/tests/ui/issues/issue-10764.stderr b/tests/ui/issues/issue-10764.stderr
index fcb45affe..4d8a85a13 100644
--- a/tests/ui/issues/issue-10764.stderr
+++ b/tests/ui/issues/issue-10764.stderr
@@ -8,7 +8,6 @@ LL | fn main() { f(bar) }
|
= note: expected fn pointer `fn()`
found fn item `extern "C" fn() {bar}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/issue-10764.rs:1:4
|
diff --git a/tests/ui/issues/issue-12127.stderr b/tests/ui/issues/issue-12127.stderr
index 2c451b07f..2e5858679 100644
--- a/tests/ui/issues/issue-12127.stderr
+++ b/tests/ui/issues/issue-12127.stderr
@@ -11,7 +11,7 @@ note: this value implements `FnOnce`, which causes it to be moved when called
|
LL | f();
| ^
- = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:30]`, which does not implement the `Copy` trait
+ = note: move occurs because `f` has type `{closure@$DIR/issue-12127.rs:8:24: 8:30}`, which does not implement the `Copy` trait
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-17252.stderr b/tests/ui/issues/issue-17252.stderr
index daaf82e80..32e20d774 100644
--- a/tests/ui/issues/issue-17252.stderr
+++ b/tests/ui/issues/issue-17252.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `FOO`
+error[E0391]: cycle detected when simplifying constant for the type system `FOO`
+ --> $DIR/issue-17252.rs:1:1
+ |
+LL | const FOO: usize = FOO;
+ | ^^^^^^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `FOO`...
--> $DIR/issue-17252.rs:1:20
|
LL | const FOO: usize = FOO;
| ^^^
- |
- = note: ...which immediately requires const-evaluating + checking `FOO` again
+ = note: ...which again requires simplifying constant for the type system `FOO`, completing the cycle
note: cycle used when const-evaluating + checking `main::{constant#0}`
--> $DIR/issue-17252.rs:4:18
|
diff --git a/tests/ui/issues/issue-18389.rs b/tests/ui/issues/issue-18389.rs
index 05a5decf4..26b607f40 100644
--- a/tests/ui/issues/issue-18389.rs
+++ b/tests/ui/issues/issue-18389.rs
@@ -1,9 +1,4 @@
-#![feature(type_privacy_lints)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+// check-pass
use std::any::Any;
use std::any::TypeId;
@@ -12,8 +7,7 @@ trait Private<P, R> {
fn call(&self, p: P, r: R);
}
pub trait Public: Private<
-//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
-//~| WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
+//~^ WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
<Self as Public>::P,
<Self as Public>::R
> {
diff --git a/tests/ui/issues/issue-18389.stderr b/tests/ui/issues/issue-18389.stderr
index 18ffc4177..4706d1ba1 100644
--- a/tests/ui/issues/issue-18389.stderr
+++ b/tests/ui/issues/issue-18389.stderr
@@ -1,39 +1,19 @@
-error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
- --> $DIR/issue-18389.rs:14:1
- |
-LL | trait Private<P, R> {
- | ------------------- `Private<<Self as Public>::P, <Self as Public>::R>` declared as private
-...
-LL | / pub trait Public: Private<
-LL | |
-LL | |
-LL | | <Self as Public>::P,
-LL | | <Self as Public>::R
-LL | | > {
- | |_^ can't leak private trait
-
warning: trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public`
- --> $DIR/issue-18389.rs:14:1
+ --> $DIR/issue-18389.rs:9:1
|
LL | / pub trait Public: Private<
LL | |
-LL | |
LL | | <Self as Public>::P,
LL | | <Self as Public>::R
LL | | > {
| |_^ trait `Public` is reachable at visibility `pub`
|
note: but trait `Private<<Self as Public>::P, <Self as Public>::R>` is only usable at visibility `pub(crate)`
- --> $DIR/issue-18389.rs:11:1
+ --> $DIR/issue-18389.rs:6:1
|
LL | trait Private<P, R> {
| ^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/issue-18389.rs:2:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-error: aborting due to previous error; 1 warning emitted
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/issues/issue-18611.stderr b/tests/ui/issues/issue-18611.stderr
index bd18d4622..784b9b984 100644
--- a/tests/ui/issues/issue-18611.stderr
+++ b/tests/ui/issues/issue-18611.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied
|
LL | fn add_state(op: <isize as HasState>::State) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-18611.rs:5:1
+ |
+LL | trait HasState {
+ | ^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr
index df50118ac..a887635d3 100644
--- a/tests/ui/issues/issue-21763.stderr
+++ b/tests/ui/issues/issue-21763.stderr
@@ -9,9 +9,6 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>();
= note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>`
--> $HASHBROWN_SRC_LOCATION
- |
-LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
- | ^^^^^^^
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
note: required by a bound in `foo`
diff --git a/tests/ui/issues/issue-22638.rs b/tests/ui/issues/issue-22638.rs
index 198ceccc2..c2407227c 100644
--- a/tests/ui/issues/issue-22638.rs
+++ b/tests/ui/issues/issue-22638.rs
@@ -1,5 +1,5 @@
// build-fail
-// normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`"
+// normalize-stderr-test: "<\{closure@.+`" -> "$$CLOSURE`"
// normalize-stderr-test: ".nll/" -> "/"
#![allow(unused)]
@@ -54,7 +54,7 @@ impl D {
pub fn matches<F: Fn()>(&self, f: &F) {
let &D(ref a) = self;
a.matches(f)
- //~^ ERROR reached the recursion limit while instantiating `A::matches::<[closure
+ //~^ ERROR reached the recursion limit while instantiating `A::matches::<{closure
}
}
diff --git a/tests/ui/issues/issue-23302-1.stderr b/tests/ui/issues/issue-23302-1.stderr
index d807e2440..d753bdeb9 100644
--- a/tests/ui/issues/issue-23302-1.stderr
+++ b/tests/ui/issues/issue-23302-1.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `X::A::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
|
- = note: ...which immediately requires const-evaluating + checking `X::A::{constant#0}` again
+note: ...which requires const-evaluating + checking `X::A::{constant#0}`...
+ --> $DIR/issue-23302-1.rs:4:9
+ |
+LL | A = X::A as isize,
+ | ^^^^^^^^^^^^^
+ = note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9
|
diff --git a/tests/ui/issues/issue-23302-2.stderr b/tests/ui/issues/issue-23302-2.stderr
index 91b39dba1..b756ee1d5 100644
--- a/tests/ui/issues/issue-23302-2.stderr
+++ b/tests/ui/issues/issue-23302-2.stderr
@@ -1,10 +1,15 @@
-error[E0391]: cycle detected when const-evaluating + checking `Y::A::{constant#0}`
+error[E0391]: cycle detected when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
|
- = note: ...which immediately requires const-evaluating + checking `Y::A::{constant#0}` again
+note: ...which requires const-evaluating + checking `Y::A::{constant#0}`...
+ --> $DIR/issue-23302-2.rs:4:9
+ |
+LL | A = Y::B as isize,
+ | ^^^^^^^^^^^^^
+ = note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9
|
diff --git a/tests/ui/issues/issue-23302-3.stderr b/tests/ui/issues/issue-23302-3.stderr
index 6b708d81f..6cdc94551 100644
--- a/tests/ui/issues/issue-23302-3.stderr
+++ b/tests/ui/issues/issue-23302-3.stderr
@@ -1,15 +1,25 @@
-error[E0391]: cycle detected when const-evaluating + checking `A`
+error[E0391]: cycle detected when simplifying constant for the type system `A`
+ --> $DIR/issue-23302-3.rs:1:1
+ |
+LL | const A: i32 = B;
+ | ^^^^^^^^^^^^
+ |
+note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-23302-3.rs:1:16
|
LL | const A: i32 = B;
| ^
+note: ...which requires simplifying constant for the type system `B`...
+ --> $DIR/issue-23302-3.rs:3:1
|
+LL | const B: i32 = A;
+ | ^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `B`...
--> $DIR/issue-23302-3.rs:3:16
|
LL | const B: i32 = A;
| ^
- = note: ...which again requires const-evaluating + checking `A`, completing the cycle
+ = note: ...which again requires simplifying constant for the type system `A`, completing the cycle
note: cycle used when simplifying constant for the type system `A`
--> $DIR/issue-23302-3.rs:1:1
|
diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr
index 0e73a51fa..a425816cd 100644
--- a/tests/ui/issues/issue-24036.stderr
+++ b/tests/ui/issues/issue-24036.stderr
@@ -6,8 +6,8 @@ LL | let mut x = |c| c + 1;
LL | x = |c| c + 1;
| ^^^^^^^^^ expected closure, found a different closure
|
- = note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:20]`
- found closure `[closure@$DIR/issue-24036.rs:3:9: 3:12]`
+ = note: expected closure `{closure@$DIR/issue-24036.rs:2:17: 2:20}`
+ found closure `{closure@$DIR/issue-24036.rs:3:9: 3:12}`
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
diff --git a/tests/ui/issues/issue-25076.stderr b/tests/ui/issues/issue-25076.stderr
index 159cc484c..065bf7def 100644
--- a/tests/ui/issues/issue-25076.stderr
+++ b/tests/ui/issues/issue-25076.stderr
@@ -6,6 +6,11 @@ LL | do_fold(bot(), ());
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-25076.rs:3:1
+ |
+LL | trait InOut<T> { type Out; }
+ | ^^^^^^^^^^^^^^
note: required by a bound in `do_fold`
--> $DIR/issue-25076.rs:5:18
|
diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr
index 59ef28481..01532de99 100644
--- a/tests/ui/issues/issue-27042.stderr
+++ b/tests/ui/issues/issue-27042.stderr
@@ -11,11 +11,18 @@ LL | | while true { break }; // but here we cite the whole loop
error[E0308]: mismatched types
--> $DIR/issue-27042.rs:6:16
|
+LL | let _: i32 =
+ | - expected because of this assignment
+LL | 'a: // in this case, the citation is just the `break`:
LL | loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ---- ^^^^^ expected `i32`, found `()`
+ | |
+ | this loop is expected to be of type `i32`
+ |
+help: give it a value of the expected type
+ |
+LL | loop { break 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/issue-27042.rs:8:9
diff --git a/tests/ui/issues/issue-29147.stderr b/tests/ui/issues/issue-29147.stderr
index 138d477dc..d0d948531 100644
--- a/tests/ui/issues/issue-29147.stderr
+++ b/tests/ui/issues/issue-29147.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed
- --> $DIR/issue-29147.rs:22:13
+ --> $DIR/issue-29147.rs:22:14
|
LL | let _ = <S5<_>>::xxx;
- | ^^^^^^^^^^^^ cannot infer type for struct `S5<_>`
+ | ^^^^^ cannot infer type for struct `S5<_>`
|
note: multiple `impl`s satisfying `S5<_>: Foo` found
--> $DIR/issue-29147.rs:18:1
diff --git a/tests/ui/issues/issue-3214.rs b/tests/ui/issues/issue-3214.rs
index e3c07bb3f..b2c27f5be 100644
--- a/tests/ui/issues/issue-3214.rs
+++ b/tests/ui/issues/issue-3214.rs
@@ -1,6 +1,6 @@
fn foo<T>() {
struct Foo {
- x: T, //~ ERROR can't use generic parameters from outer function
+ x: T, //~ ERROR can't use generic parameters from outer item
}
impl<T> Drop for Foo<T> {
diff --git a/tests/ui/issues/issue-3214.stderr b/tests/ui/issues/issue-3214.stderr
index 7a2d772f0..5b57c1baf 100644
--- a/tests/ui/issues/issue-3214.stderr
+++ b/tests/ui/issues/issue-3214.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3214.rs:3:12
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | struct Foo {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | x: T,
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-3214.rs:6:22
diff --git a/tests/ui/issues/issue-35570.stderr b/tests/ui/issues/issue-35570.stderr
index 2697d46bd..197e80ac0 100644
--- a/tests/ui/issues/issue-35570.stderr
+++ b/tests/ui/issues/issue-35570.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-35570.rs:4:1
+ |
+LL | trait Trait2<'a> {
+ | ^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-39970.stderr b/tests/ui/issues/issue-39970.stderr
index 8344b88c3..713bc404f 100644
--- a/tests/ui/issues/issue-39970.stderr
+++ b/tests/ui/issues/issue-39970.stderr
@@ -1,8 +1,8 @@
error[E0271]: type mismatch resolving `<() as Array<'a>>::Element == ()`
- --> $DIR/issue-39970.rs:19:5
+ --> $DIR/issue-39970.rs:19:6
|
LL | <() as Visit>::visit();
- | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Array<'a>>::Element == ()`
+ | ^^ type mismatch resolving `<() as Array<'a>>::Element == ()`
|
note: expected this to be `()`
--> $DIR/issue-39970.rs:10:20
diff --git a/tests/ui/issues/issue-41880.stderr b/tests/ui/issues/issue-41880.stderr
index 00c375f8d..6414e2692 100644
--- a/tests/ui/issues/issue-41880.stderr
+++ b/tests/ui/issues/issue-41880.stderr
@@ -5,7 +5,7 @@ LL | pub struct Iterate<T, F> {
| ------------------------ method `iter` not found for this struct
...
LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
- | ^^^^ method not found in `Iterate<{integer}, [closure@issue-41880.rs:26:24]>`
+ | ^^^^ method not found in `Iterate<{integer}, {closure@issue-41880.rs:26:24}>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr
index 02c5dd5bf..7bbb8ed2c 100644
--- a/tests/ui/issues/issue-43988.stderr
+++ b/tests/ui/issues/issue-43988.stderr
@@ -32,7 +32,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(nothing)]
| ^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/issue-43988.rs:18:12
@@ -40,7 +40,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(something_not_real)]
| ^^^^^^^^^^^^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43988.rs:30:5
diff --git a/tests/ui/issues/issue-48838.stderr b/tests/ui/issues/issue-48838.stderr
index 3502af702..159199a7f 100644
--- a/tests/ui/issues/issue-48838.stderr
+++ b/tests/ui/issues/issue-48838.stderr
@@ -5,7 +5,7 @@ LL | Square = |x| x,
| ^^^^^ expected `isize`, found closure
|
= note: expected type `isize`
- found closure `[closure@$DIR/issue-48838.rs:2:14: 2:17]`
+ found closure `{closure@$DIR/issue-48838.rs:2:14: 2:17}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50600.stderr b/tests/ui/issues/issue-50600.stderr
index 7fea7e5c0..d285c3467 100644
--- a/tests/ui/issues/issue-50600.stderr
+++ b/tests/ui/issues/issue-50600.stderr
@@ -5,7 +5,7 @@ LL | fn([u8; |x: u8| {}]),
| ^^^^^^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-50600.rs:2:13: 2:20]`
+ found closure `{closure@$DIR/issue-50600.rs:2:13: 2:20}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50688.stderr b/tests/ui/issues/issue-50688.stderr
index 6973ad271..df7603d79 100644
--- a/tests/ui/issues/issue-50688.stderr
+++ b/tests/ui/issues/issue-50688.stderr
@@ -5,7 +5,7 @@ LL | [1; || {}];
| ^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/issue-50688.rs:2:9: 2:11]`
+ found closure `{closure@$DIR/issue-50688.rs:2:9: 2:11}`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-50714-1.stderr b/tests/ui/issues/issue-50714-1.stderr
index 28469bee0..bacd09b2a 100644
--- a/tests/ui/issues/issue-50714-1.stderr
+++ b/tests/ui/issues/issue-50714-1.stderr
@@ -1,8 +1,8 @@
-error[E0647]: start function is not allowed to have a `where` clause
+error[E0647]: `#[start]` function is not allowed to have a `where` clause
--> $DIR/issue-50714-1.rs:9:50
|
LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq {
- | ^^^^^^^^^^^^^^^^^ start function cannot have a `where` clause
+ | ^^^^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-51154.stderr b/tests/ui/issues/issue-51154.stderr
index d8a833a86..002d5ccdc 100644
--- a/tests/ui/issues/issue-51154.stderr
+++ b/tests/ui/issues/issue-51154.stderr
@@ -9,7 +9,7 @@ LL | let _: Box<F> = Box::new(|| ());
| arguments to this function are incorrect
|
= note: expected type parameter `F`
- found closure `[closure@$DIR/issue-51154.rs:2:30: 2:32]`
+ found closure `{closure@$DIR/issue-51154.rs:2:30: 2:32}`
= help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F`
note: associated function defined here
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
diff --git a/tests/ui/issues/issue-5997-enum.rs b/tests/ui/issues/issue-5997-enum.rs
index 3ff4e036c..0b1857ae3 100644
--- a/tests/ui/issues/issue-5997-enum.rs
+++ b/tests/ui/issues/issue-5997-enum.rs
@@ -1,6 +1,6 @@
fn f<Z>() -> bool {
enum E { V(Z) }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
true
}
diff --git a/tests/ui/issues/issue-5997-enum.stderr b/tests/ui/issues/issue-5997-enum.stderr
index 3a79215d3..d07258ea7 100644
--- a/tests/ui/issues/issue-5997-enum.stderr
+++ b/tests/ui/issues/issue-5997-enum.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-enum.rs:2:16
|
LL | fn f<Z>() -> bool {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | enum E { V(Z) }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<Z>`
+ | help: try introducing a local generic parameter here: `<Z>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-5997-struct.rs b/tests/ui/issues/issue-5997-struct.rs
index 6cf510b0a..19d994b0d 100644
--- a/tests/ui/issues/issue-5997-struct.rs
+++ b/tests/ui/issues/issue-5997-struct.rs
@@ -1,5 +1,5 @@
fn f<T>() -> bool {
- struct S(T); //~ ERROR can't use generic parameters from outer function
+ struct S(T); //~ ERROR can't use generic parameters from outer item
true
}
diff --git a/tests/ui/issues/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-struct.stderr
index d2e97f767..83229e02c 100644
--- a/tests/ui/issues/issue-5997-struct.stderr
+++ b/tests/ui/issues/issue-5997-struct.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-5997-struct.rs:2:14
|
LL | fn f<T>() -> bool {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | struct S(T);
- | -^ use of generic parameter from outer function
+ | -^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-60218.stderr b/tests/ui/issues/issue-60218.stderr
index 563690c9a..ae3c4d120 100644
--- a/tests/ui/issues/issue-60218.stderr
+++ b/tests/ui/issues/issue-60218.stderr
@@ -6,6 +6,11 @@ LL | trigger_error(vec![], |x: &u32| x)
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-60218.rs:7:1
+ |
+LL | pub trait Foo {}
+ | ^^^^^^^^^^^^^
note: required by a bound in `trigger_error`
--> $DIR/issue-60218.rs:13:72
|
diff --git a/tests/ui/issues/issue-66353.stderr b/tests/ui/issues/issue-66353.stderr
index 335618097..7ab7547b4 100644
--- a/tests/ui/issues/issue-66353.stderr
+++ b/tests/ui/issues/issue-66353.stderr
@@ -1,8 +1,14 @@
error[E0277]: the trait bound `(): _A` is not satisfied
- --> $DIR/issue-66353.rs:12:14
+ --> $DIR/issue-66353.rs:12:15
|
LL | _Func::< <() as _A>::AssocT >::func(());
- | ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
+ | ^^ the trait `_A` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-66353.rs:7:1
+ |
+LL | trait _A {
+ | ^^^^^^^^
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
--> $DIR/issue-66353.rs:12:41
@@ -11,6 +17,12 @@ LL | _Func::< <() as _A>::AssocT >::func(());
| ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()`
| |
| required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-66353.rs:3:1
+ |
+LL | trait _Func<T> {
+ | ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
index cec482a53..22b1da64c 100644
--- a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
+++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -17,10 +17,12 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
- --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
+ --> $DIR/issue-66923-show-error-for-correct-call.rs:12:39
|
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
- | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+ | ------- ^^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
index ba385d887..6f9302bc4 100644
--- a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
+++ b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr
@@ -13,7 +13,7 @@ LL | type MyA: TraitA;
LL | impl TraitB for B {
| ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17
|
LL | let _ = [0; B::VALUE];
diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr
index 0ec5e73f3..67949b37d 100644
--- a/tests/ui/issues/issue-87199.stderr
+++ b/tests/ui/issues/issue-87199.stderr
@@ -17,12 +17,10 @@ LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
- --> $DIR/issue-87199.rs:18:22
+ --> $DIR/issue-87199.rs:18:15
|
LL | ref_arg::<[i32]>(&[5]);
- | ---------------- ^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i32]`
note: required by a bound in `ref_arg`
diff --git a/tests/ui/issues/issue-9575.stderr b/tests/ui/issues/issue-9575.stderr
index 5b8ce84a0..e49eac3ba 100644
--- a/tests/ui/issues/issue-9575.stderr
+++ b/tests/ui/issues/issue-9575.stderr
@@ -4,8 +4,8 @@ error[E0308]: `#[start]` function has wrong type
LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn(isize, *const *const u8) -> _`
- found fn pointer `fn(isize, *const *const u8, *const u8) -> _`
+ = note: expected signature `fn(isize, *const *const u8) -> _`
+ found signature `fn(isize, *const *const u8, *const u8) -> _`
error: aborting due to previous error
diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
index 7f1b9c38e..e728fec29 100644
--- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
@@ -1,8 +1,10 @@
error[E0277]: a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}`
- --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:41
+ --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:47
|
LL | let x = Some(()).iter().map(|()| 1).sum::<f32>();
- | ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>`
+ | --- ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Sum<A>`:
diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr
index a2688107d..b355da5cb 100644
--- a/tests/ui/iterators/invalid-iterator-chain.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain.stderr
@@ -17,10 +17,12 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:15:27
+ --> $DIR/invalid-iterator-chain.rs:15:33
|
LL | println!("{}", scores.sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -42,10 +44,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:26:14
+ --> $DIR/invalid-iterator-chain.rs:26:20
|
LL | .sum::<i32>(),
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -74,10 +78,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
- --> $DIR/invalid-iterator-chain.rs:36:14
+ --> $DIR/invalid-iterator-chain.rs:36:20
|
LL | .sum::<i32>(),
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<f64>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -102,10 +108,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
- --> $DIR/invalid-iterator-chain.rs:38:54
+ --> $DIR/invalid-iterator-chain.rs:38:60
|
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -123,10 +131,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
- --> $DIR/invalid-iterator-chain.rs:39:40
+ --> $DIR/invalid-iterator-chain.rs:39:46
|
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
diff --git a/tests/ui/kindck/kindck-nonsendable-1.stderr b/tests/ui/kindck/kindck-nonsendable-1.stderr
index cc6e1f59c..077004ae7 100644
--- a/tests/ui/kindck/kindck-nonsendable-1.stderr
+++ b/tests/ui/kindck/kindck-nonsendable-1.stderr
@@ -5,10 +5,10 @@ LL | bar(move|| foo(x));
| --- ------^^^^^^^
| | |
| | `Rc<usize>` cannot be sent between threads safely
- | | within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`
+ | | within this `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`
| required by a bound introduced by this call
|
- = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc<usize>`
+ = help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`, the trait `Send` is not implemented for `Rc<usize>`
note: required because it's used within this closure
--> $DIR/kindck-nonsendable-1.rs:9:9
|
diff --git a/tests/ui/lang-items/start_lang_item_args.argc.stderr b/tests/ui/lang-items/start_lang_item_args.argc.stderr
index 65c99a93c..66d4397a2 100644
--- a/tests/ui/lang-items/start_lang_item_args.argc.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argc.stderr
@@ -1,8 +1,12 @@
-error: parameter 2 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:75:38
|
LL | fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^ help: change the type from `i8` to `isize`
+ | ^^ expected `isize`, found `i8`
+ |
+ = note: expected signature `fn(fn() -> _, isize, _, _) -> _`
+ found signature `fn(fn() -> _, i8, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.argv.stderr b/tests/ui/lang-items/start_lang_item_args.argv.stderr
index f0947a9b3..53d776cd8 100644
--- a/tests/ui/lang-items/start_lang_item_args.argv.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argv.stderr
@@ -1,8 +1,12 @@
-error: parameter 3 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:89:52
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
- | ^^ help: change the type from `u8` to `*const *const u8`
+ | ^^ expected `*const *const u8`, found `u8`
+ |
+ = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _`
+ found signature `fn(fn() -> _, _, u8, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
index 08efd5088..7d002e090 100644
--- a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr
@@ -1,13 +1,12 @@
-error: parameter 3 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:82:52
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ expected `u8`, found `usize`
|
-help: change the type from `*const *const usize` to `*const *const u8`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~~~~~~~~
+ = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _`
+ found signature `fn(fn() -> _, _, *const *const usize, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_args.stderr b/tests/ui/lang-items/start_lang_item_args.main_args.stderr
index c20a74466..91994b9d7 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_args.stderr
@@ -1,13 +1,12 @@
-error: parameter 1 of the `start` lang item is incorrect
- --> $DIR/start_lang_item_args.rs:61:20
+error[E0308]: lang item `start` function has wrong type
+ --> $DIR/start_lang_item_args.rs:61:1
|
LL | fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
-help: change the type from `fn(i32) -> T` to `fn() -> T`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~
+ = note: expected signature `fn(fn() -> _, _, _, _) -> _`
+ found signature `fn(fn(i32) -> _, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
index 8f967252f..4582b6985 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
@@ -1,13 +1,14 @@
-error: parameter 1 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:68:20
|
LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^^^^^^^^^
+ | - ^^^^^^^^^^^ expected type parameter `T`, found `u16`
+ | |
+ | this type parameter
|
-help: change the type from `fn() -> u16` to `fn() -> T`
- |
-LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ~~~~~~~~~
+ = note: expected signature `fn(fn() -> T, _, _, _) -> _`
+ found signature `fn(fn() -> u16, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
index deb37b868..87940d05e 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr
@@ -1,8 +1,12 @@
-error: parameter 1 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:54:20
|
LL | fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- | ^^^ help: change the type from `u64` to `fn() -> T`
+ | ^^^ expected fn pointer, found `u64`
+ |
+ = note: expected signature `fn(fn() -> T, _, _, _) -> _`
+ found signature `fn(u64, _, _, _) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
index 004c2a67f..5363871e2 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:15:1
|
LL | fn start<T>() -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 0
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn() -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
index 1d8285b59..2bb29f911 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
@@ -1,8 +1,12 @@
-error: the return type of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:29:84
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
- | ^ help: change the type from `()` to `isize`
+ | ^ expected `isize`, found `()`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, _) -> isize`
+ found signature `fn(fn() -> _, _, _, _)`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
index e545a750f..f873f7614 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr
@@ -1,11 +1,12 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:22:1
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 3
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.rs b/tests/ui/lang-items/start_lang_item_args.rs
index 0dbfba39c..4a0302bcb 100644
--- a/tests/ui/lang-items/start_lang_item_args.rs
+++ b/tests/ui/lang-items/start_lang_item_args.rs
@@ -13,33 +13,33 @@ pub trait Sized {}
#[cfg(missing_all_args)]
#[lang = "start"]
fn start<T>() -> isize {
- //[missing_all_args]~^ ERROR incorrect number of parameters
+ //[missing_all_args]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(missing_sigpipe_arg)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
- //[missing_sigpipe_arg]~^ ERROR incorrect number of parameters
+ //[missing_sigpipe_arg]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(missing_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
-//[missing_ret]~^ ERROR the return type of the `start` lang item is incorrect
+//[missing_ret]~^ ERROR lang item `start` function has wrong type [E0308]
#[cfg(start_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
- //[start_ret]~^ ERROR the return type of the `start` lang item is incorrect
+ //[start_ret]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(too_many_args)]
#[lang = "start"]
fn start<T>(
- //[too_many_args]~^ ERROR incorrect number of parameters
+ //[too_many_args]~^ ERROR lang item `start` function has wrong type [E0308]
_main: fn() -> T,
_argc: isize,
_argv: *const *const u8,
@@ -52,49 +52,49 @@ fn start<T>(
#[cfg(main_ty)]
#[lang = "start"]
fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_ty]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_ty]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(main_args)]
#[lang = "start"]
fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_args]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_args]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(main_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[main_ret]~^ ERROR parameter 1 of the `start` lang item is incorrect
+ //[main_ret]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argc)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
- //[argc]~^ ERROR parameter 2 of the `start` lang item is incorrect
+ //[argc]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argv_inner_ptr)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
- //[argv_inner_ptr]~^ ERROR parameter 3 of the `start` lang item is incorrect
+ //[argv_inner_ptr]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(argv)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
- //[argv]~^ ERROR parameter 3 of the `start` lang item is incorrect
+ //[argv]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
#[cfg(sigpipe)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
- //[sigpipe]~^ ERROR parameter 4 of the `start` lang item is incorrect
+ //[sigpipe]~^ ERROR lang item `start` function has wrong type [E0308]
100
}
diff --git a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
index b20ae3128..280d423bd 100644
--- a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr
@@ -1,8 +1,12 @@
-error: parameter 4 of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:96:80
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
- | ^^^ help: change the type from `i64` to `u8`
+ | ^^^ expected `u8`, found `i64`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, u8) -> _`
+ found signature `fn(fn() -> _, _, _, i64) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
index 935d5f3c8..4e4f8a5cd 100644
--- a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr
@@ -1,8 +1,12 @@
-error: the return type of the `start` lang item is incorrect
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:34:87
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
- | ^^ help: change the type from `u8` to `isize`
+ | ^^ expected `isize`, found `u8`
+ |
+ = note: expected signature `fn(fn() -> _, _, _, _) -> isize`
+ found signature `fn(fn() -> _, _, _, _) -> u8`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
index 30a7ed18a..085d4b1f2 100644
--- a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr
@@ -1,4 +1,4 @@
-error: incorrect number of parameters for the `start` lang item
+error[E0308]: lang item `start` function has wrong type
--> $DIR/start_lang_item_args.rs:41:1
|
LL | / fn start<T>(
@@ -8,10 +8,11 @@ LL | | _argc: isize,
... |
LL | | _extra_arg: (),
LL | | ) -> isize {
- | |__________^
+ | |__________^ incorrect number of function parameters
|
- = note: the `start` lang item should have four parameters, but found 5
- = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+ = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _`
+ found signature `fn(fn() -> T, isize, *const *const u8, u8, ()) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.rs b/tests/ui/lang-items/start_lang_item_with_target_feature.rs
new file mode 100644
index 000000000..3052b7bb5
--- /dev/null
+++ b/tests/ui/lang-items/start_lang_item_with_target_feature.rs
@@ -0,0 +1,19 @@
+// only-x86_64
+// check-fail
+
+#![feature(lang_items, no_core, target_feature_11)]
+#![no_core]
+
+#[lang = "copy"]
+pub trait Copy {}
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "start"]
+#[target_feature(enable = "avx2")]
+//~^ ERROR `start` language item function is not allowed to have `#[target_feature]`
+fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+ 0
+}
+
+fn main() {}
diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.stderr b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr
new file mode 100644
index 000000000..ff55a1365
--- /dev/null
+++ b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr
@@ -0,0 +1,11 @@
+error: `start` language item function is not allowed to have `#[target_feature]`
+ --> $DIR/start_lang_item_with_target_feature.rs:13:1
+ |
+LL | #[target_feature(enable = "avx2")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+ | ------------------------------------------------------------------------------------------- `start` language item function is not allowed to have `#[target_feature]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/late-bound-lifetimes/predicate-is-global.rs b/tests/ui/late-bound-lifetimes/predicate-is-global.rs
new file mode 100644
index 000000000..be017a3f9
--- /dev/null
+++ b/tests/ui/late-bound-lifetimes/predicate-is-global.rs
@@ -0,0 +1,40 @@
+// check-pass
+
+trait Foo {
+ type Assoc;
+
+ fn do_it(_: &Self::Assoc)
+ where
+ for<'a> Self: Baz<'a>;
+}
+
+trait Baz<'a>: Foo {}
+
+impl Foo for () {
+ type Assoc = Inherent;
+
+ // Ensure that the `for<'a> Self: Baz<'a>` predicate, which has
+ // a supertrait `for<'a> Self: Foo`, does not cause us to fail
+ // to normalize `Self::Assoc`.
+ fn do_it(x: &Self::Assoc)
+ where
+ for<'a> Self: Baz<'a>,
+ {
+ x.inherent();
+ }
+}
+
+struct Inherent;
+impl Inherent {
+ fn inherent(&self) {}
+}
+
+// This trivial bound doesn't hold, but the unused lifetime tripped up that check after #117589, and
+// showed up in its crater results (in `soa-derive 0.13.0`).
+fn do_it()
+where
+ for<'a> Inherent: Clone,
+{
+}
+
+fn main() {}
diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs
index 46171880a..65f2f3b89 100644
--- a/tests/ui/layout/debug.rs
+++ b/tests/ui/layout/debug.rs
@@ -1,4 +1,4 @@
-// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
#![feature(never_type, rustc_attrs, type_alias_impl_trait, repr_simd)]
#![crate_type = "lib"]
@@ -17,6 +17,9 @@ type Test = Result<i32, i32>; //~ ERROR: layout_of
#[rustc_layout(debug)]
type T = impl std::fmt::Debug; //~ ERROR: layout_of
+fn f() -> T {
+ 0i32
+}
#[rustc_layout(debug)]
pub union V { //~ ERROR: layout_of
@@ -63,6 +66,13 @@ union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
#[rustc_layout(debug)]
type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
-fn f() -> T {
- 0i32
+#[rustc_layout(debug)]
+const C: () = (); //~ ERROR: can only be applied to
+
+impl S {
+ #[rustc_layout(debug)]
+ const C: () = (); //~ ERROR: can only be applied to
}
+
+#[rustc_layout(debug)]
+type Impossible = (str, str); //~ ERROR: cannot be known at compilation time
diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr
index eeffb3c5f..5162a771b 100644
--- a/tests/ui/layout/debug.stderr
+++ b/tests/ui/layout/debug.stderr
@@ -2,7 +2,7 @@ error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -40,7 +40,7 @@ error: layout_of(E) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -60,7 +60,7 @@ error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Uninhabited,
fields: Arbitrary {
@@ -96,7 +96,7 @@ error: layout_of(S) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -117,13 +117,13 @@ error: layout_of(S) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
- Size(0 bytes),
+ Size(8 bytes),
Size(4 bytes),
],
memory_index: [
- 1,
0,
2,
+ 1,
],
},
largest_niche: None,
@@ -142,7 +142,7 @@ error: layout_of(U) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -162,11 +162,11 @@ error: layout_of(U) = Layout {
LL | union U { f1: (i32, i32), f3: i32 }
| ^^^^^^^
-error: layout_of(std::result::Result<i32, i32>) = Layout {
+error: layout_of(Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -217,7 +217,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -254,7 +254,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: ScalarPair(
Initialized {
@@ -301,7 +301,7 @@ error: layout_of(i32) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
@@ -329,7 +329,7 @@ error: layout_of(V) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -344,7 +344,7 @@ error: layout_of(V) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:22:1
+ --> $DIR/debug.rs:25:1
|
LL | pub union V {
| ^^^^^^^^^^^
@@ -353,7 +353,7 @@ error: layout_of(W) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -368,7 +368,7 @@ error: layout_of(W) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:28:1
+ --> $DIR/debug.rs:31:1
|
LL | pub union W {
| ^^^^^^^^^^^
@@ -377,7 +377,7 @@ error: layout_of(Y) = Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -392,7 +392,7 @@ error: layout_of(Y) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(2 bytes),
}
- --> $DIR/debug.rs:34:1
+ --> $DIR/debug.rs:37:1
|
LL | pub union Y {
| ^^^^^^^^^^^
@@ -401,7 +401,7 @@ error: layout_of(P1) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -416,7 +416,7 @@ error: layout_of(P1) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:41:1
+ --> $DIR/debug.rs:44:1
|
LL | union P1 { x: u32 }
| ^^^^^^^^
@@ -425,7 +425,7 @@ error: layout_of(P2) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -440,7 +440,7 @@ error: layout_of(P2) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:45:1
+ --> $DIR/debug.rs:48:1
|
LL | union P2 { x: (u32, u32) }
| ^^^^^^^^
@@ -449,7 +449,7 @@ error: layout_of(P3) = Layout {
size: Size(16 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -464,7 +464,7 @@ error: layout_of(P3) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:53:1
+ --> $DIR/debug.rs:56:1
|
LL | union P3 { x: F32x4 }
| ^^^^^^^^
@@ -473,7 +473,7 @@ error: layout_of(P4) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
@@ -488,7 +488,7 @@ error: layout_of(P4) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:57:1
+ --> $DIR/debug.rs:60:1
|
LL | union P4 { x: E }
| ^^^^^^^^
@@ -497,7 +497,7 @@ error: layout_of(P5) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Union {
@@ -517,16 +517,16 @@ error: layout_of(P5) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:61:1
+ --> $DIR/debug.rs:64:1
|
LL | union P5 { zst: [u16; 0], byte: u8 }
| ^^^^^^^^
-error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
+error: layout_of(MaybeUninit<u8>) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
- pref: $PREF_ALIGN,
+ pref: $SOME_ALIGN,
},
abi: Scalar(
Union {
@@ -546,10 +546,32 @@ error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(1 bytes),
}
- --> $DIR/debug.rs:64:1
+ --> $DIR/debug.rs:67:1
|
LL | type X = std::mem::MaybeUninit<u8>;
| ^^^^^^
-error: aborting due to 14 previous errors
+error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
+ --> $DIR/debug.rs:70:1
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/debug.rs:78:19
+ |
+LL | type Impossible = (str, str);
+ | ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases
+ --> $DIR/debug.rs:74:5
+ |
+LL | const C: () = ();
+ | ^^^^^^^^^^^
+
+error: aborting due to 17 previous errors
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/layout/enum.rs b/tests/ui/layout/enum.rs
new file mode 100644
index 000000000..7ac2eaa86
--- /dev/null
+++ b/tests/ui/layout/enum.rs
@@ -0,0 +1,18 @@
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//! Various enum layout tests.
+
+#![feature(rustc_attrs)]
+#![feature(never_type)]
+#![crate_type = "lib"]
+
+#[rustc_layout(align)]
+enum UninhabitedVariantAlign { //~ERROR: abi: Align(2 bytes)
+ A([u8; 32]),
+ B([u16; 0], !), // make sure alignment in uninhabited fields is respected
+}
+
+#[rustc_layout(size)]
+enum UninhabitedVariantSpace { //~ERROR: size: Size(16 bytes)
+ A,
+ B([u8; 15], !), // make sure there is space being reserved for this field.
+}
diff --git a/tests/ui/layout/enum.stderr b/tests/ui/layout/enum.stderr
new file mode 100644
index 000000000..d6bc7780c
--- /dev/null
+++ b/tests/ui/layout/enum.stderr
@@ -0,0 +1,14 @@
+error: align: AbiAndPrefAlign { abi: Align(2 bytes), pref: $PREF_ALIGN }
+ --> $DIR/enum.rs:9:1
+ |
+LL | enum UninhabitedVariantAlign {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: size: Size(16 bytes)
+ --> $DIR/enum.rs:15:1
+ |
+LL | enum UninhabitedVariantSpace {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/layout/homogeneous-aggr-transparent.rs b/tests/ui/layout/homogeneous-aggr-transparent.rs
new file mode 100644
index 000000000..9703d2bf2
--- /dev/null
+++ b/tests/ui/layout/homogeneous-aggr-transparent.rs
@@ -0,0 +1,44 @@
+#![feature(rustc_attrs)]
+#![feature(transparent_unions)]
+use std::marker::PhantomData;
+
+// Regression test for #115664. We want to ensure that `repr(transparent)` wrappers do not affect
+// the result of `homogeneous_aggregate`.
+
+type Tuple = (f32, f32, f32);
+
+struct Zst;
+
+#[repr(transparent)]
+struct Wrapper1<T>(T);
+#[repr(transparent)]
+struct Wrapper2<T>((), Zst, T);
+#[repr(transparent)]
+struct Wrapper3<T>(T, [u8; 0], PhantomData<u64>);
+#[repr(transparent)]
+union WrapperUnion<T: Copy> {
+ nothing: (),
+ something: T,
+}
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test0 = Tuple;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test1 = Wrapper1<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test2 = Wrapper2<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test3 = Wrapper3<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+#[rustc_layout(homogeneous_aggregate)]
+pub type Test4 = WrapperUnion<Tuple>;
+//~^ ERROR homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+
+fn main() {}
diff --git a/tests/ui/layout/homogeneous-aggr-transparent.stderr b/tests/ui/layout/homogeneous-aggr-transparent.stderr
new file mode 100644
index 000000000..99eb703ac
--- /dev/null
+++ b/tests/ui/layout/homogeneous-aggr-transparent.stderr
@@ -0,0 +1,32 @@
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:25:1
+ |
+LL | pub type Test0 = Tuple;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:29:1
+ |
+LL | pub type Test1 = Wrapper1<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:33:1
+ |
+LL | pub type Test2 = Wrapper2<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:37:1
+ |
+LL | pub type Test3 = Wrapper3<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: homogeneous_aggregate: Ok(Homogeneous(Reg { kind: Float, size: Size(4 bytes) }))
+ --> $DIR/homogeneous-aggr-transparent.rs:41:1
+ |
+LL | pub type Test4 = WrapperUnion<Tuple>;
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/layout/layout-cycle.rs b/tests/ui/layout/layout-cycle.rs
new file mode 100644
index 000000000..85685058e
--- /dev/null
+++ b/tests/ui/layout/layout-cycle.rs
@@ -0,0 +1,31 @@
+// build-fail
+//~^ ERROR: a cycle occurred during layout computation
+//~| ERROR: cycle detected when computing layout of
+
+// Issue #111176 -- ensure that we do not emit ICE on layout cycles
+
+use std::mem;
+
+pub struct S<T: Tr> {
+ pub f: <T as Tr>::I,
+}
+
+pub trait Tr {
+ type I: Tr;
+}
+
+impl<T: Tr> Tr for S<T> {
+ type I = S<S<T>>;
+}
+
+impl Tr for () {
+ type I = ();
+}
+
+fn foo<T: Tr>() -> usize {
+ mem::size_of::<S<T>>()
+}
+
+fn main() {
+ println!("{}", foo::<S<()>>());
+}
diff --git a/tests/ui/layout/layout-cycle.stderr b/tests/ui/layout/layout-cycle.stderr
new file mode 100644
index 000000000..a3cdb7edc
--- /dev/null
+++ b/tests/ui/layout/layout-cycle.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when computing layout of `S<S<()>>`
+ |
+ = note: ...which requires computing layout of `<S<()> as Tr>::I`...
+ = note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: failed to get layout for S<S<()>>: a cycle occurred during layout computation
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/layout/struct.rs b/tests/ui/layout/struct.rs
new file mode 100644
index 000000000..e74cf5a95
--- /dev/null
+++ b/tests/ui/layout/struct.rs
@@ -0,0 +1,12 @@
+// normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
+//! Various struct layout tests.
+
+#![feature(rustc_attrs)]
+#![feature(never_type)]
+#![crate_type = "lib"]
+
+#[rustc_layout(abi)]
+struct AlignedZstPreventsScalar(i16, [i32; 0]); //~ERROR: abi: Aggregate
+
+#[rustc_layout(abi)]
+struct AlignedZstButStillScalar(i32, [i16; 0]); //~ERROR: abi: Scalar
diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr
new file mode 100644
index 000000000..b61c9a99c
--- /dev/null
+++ b/tests/ui/layout/struct.stderr
@@ -0,0 +1,14 @@
+error: abi: Aggregate { sized: true }
+ --> $DIR/struct.rs:9:1
+ |
+LL | struct AlignedZstPreventsScalar(i16, [i32; 0]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: abi: Scalar(Initialized { value: Int(I32, true), valid_range: 0..=4294967295 })
+ --> $DIR/struct.rs:12:1
+ |
+LL | struct AlignedZstButStillScalar(i32, [i16; 0]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr
index df9f1cc8d..8161f97dd 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.stderr
+++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr
@@ -1,4 +1,4 @@
-error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
+error: layout_of(Result<[u32; 0], bool>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
@@ -232,7 +232,7 @@ error: layout_of(MultipleAlignments) = Layout {
LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^
-error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = Layout {
+error: layout_of(Result<[u32; 0], Packed<NonZeroU16>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
@@ -337,7 +337,7 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>;
| ^^^^^^^^^^^^^^^^^^^^^^^
-error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
+error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
index 9e0e2bfa8..3b216ac15 100644
--- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
@@ -1,14 +1,14 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24
|
LL | let _: lazy::Alias<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `lazy::Alias`
--> $DIR/auxiliary/lazy.rs:4:19
|
LL | pub type Alias<T: Copy> = Option<T>;
- | ^^^^ required by this bound
+ | ^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
index 9e0e2bfa8..3b216ac15 100644
--- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
@@ -1,14 +1,14 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24
|
LL | let _: lazy::Alias<String>;
- | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
|
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `lazy::Alias`
--> $DIR/auxiliary/lazy.rs:4:19
|
LL | pub type Alias<T: Copy> = Option<T>;
- | ^^^^ required by this bound
+ | ^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
index d7606ba6b..193f80b23 100644
--- a/tests/ui/lazy-type-alias/trailing-where-clause.stderr
+++ b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `String: From<()>` is not satisfied
- --> $DIR/trailing-where-clause.rs:12:12
+ --> $DIR/trailing-where-clause.rs:12:18
|
LL | let _: Alias<()>;
- | ^^^^^^^^^ the trait `From<()>` is not implemented for `String`
+ | ^^ the trait `From<()>` is not implemented for `String`
|
= help: the following other types implement trait `From<T>`:
<String as From<char>>
@@ -11,11 +11,14 @@ LL | let _: Alias<()>;
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
-note: required by a bound on the type alias `Alias`
+note: required by a bound in `Alias`
--> $DIR/trailing-where-clause.rs:8:13
|
+LL | type Alias<T> = T
+ | ----- required by a bound in this type alias
+LL | where
LL | String: From<T>;
- | ^^^^^^^ required by this bound
+ | ^^^^^^^ required by this bound in `Alias`
error: aborting due to previous error
diff --git a/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs b/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs
new file mode 100644
index 000000000..05e3763e9
--- /dev/null
+++ b/tests/ui/lifetimes/anonymize-unnamed-bound-vars-in-binders.rs
@@ -0,0 +1,27 @@
+// build-pass
+// issue: #115807
+
+trait Chip: for<'a> TraitWithLifetime<'a> + SomeMarker {
+ fn compute(&self);
+}
+
+trait SomeMarker {}
+
+trait TraitWithLifetime<'a>: SomeMarker {}
+
+trait Machine {
+ fn run();
+}
+
+struct BasicMachine;
+
+impl Machine for BasicMachine {
+ fn run() {
+ let chips: [&dyn Chip; 0] = [];
+ let _ = chips.map(|chip| chip.compute());
+ }
+}
+
+fn main() {
+ BasicMachine::run();
+}
diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr
index 5b93eff86..6361d8ad3 100644
--- a/tests/ui/lifetimes/issue-95023.stderr
+++ b/tests/ui/lifetimes/issue-95023.stderr
@@ -36,7 +36,7 @@ error[E0220]: associated type `B` not found for `Self`
--> $DIR/issue-95023.rs:6:44
|
LL | fn foo<const N: usize>(&self) -> Self::B<{N}>;
- | ^ associated type `B` not found
+ | ^ help: `Self` has the following associated type: `Output`
error: aborting due to 5 previous errors
diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
index ef1127c59..421ab3fcf 100644
--- a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
+++ b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied
|
LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/lifetime-elision-return-type-trait.rs:1:1
+ |
+LL | trait Future {
+ | ^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr
index 01ec69a61..92a2ef2f4 100644
--- a/tests/ui/lifetimes/unusual-rib-combinations.stderr
+++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr
@@ -56,7 +56,7 @@ LL | fn d<const C: S>() {}
| ^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
--> $DIR/unusual-rib-combinations.rs:29:21
@@ -65,7 +65,7 @@ LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
- = help: more complex types are supported with `#![feature(adt_const_params)]`
+ = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 9 previous errors
diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr
index 510b36edd..93716c0b3 100644
--- a/tests/ui/limits/issue-55878.stderr
+++ b/tests/ui/limits/issue-55878.stderr
@@ -1,6 +1,8 @@
-error[E0080]: values of the type `[u8; usize::MAX]` are too big for the current architecture
+error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
+ = note: values of the type `[u8; usize::MAX]` are too big for the current architecture
+ |
note: inside `std::mem::size_of::<[u8; usize::MAX]>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
note: inside `main`
@@ -9,7 +11,7 @@ note: inside `main`
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
@@ -17,7 +19,7 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
|
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
+note: erroneous constant encountered
--> $DIR/issue-55878.rs:7:26
|
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
diff --git a/tests/ui/limits/issue-56762.rs b/tests/ui/limits/issue-56762.rs
index ed7ee4da8..1c7facb04 100644
--- a/tests/ui/limits/issue-56762.rs
+++ b/tests/ui/limits/issue-56762.rs
@@ -14,8 +14,10 @@ impl TooBigArray {
}
static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
-//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
+//~^ ERROR could not evaluate static initializer
+//~| too big
static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
-//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big
+//~^ ERROR could not evaluate static initializer
+//~| too big
fn main() { }
diff --git a/tests/ui/limits/issue-56762.stderr b/tests/ui/limits/issue-56762.stderr
index 29f2a8859..3a6c3559a 100644
--- a/tests/ui/limits/issue-56762.stderr
+++ b/tests/ui/limits/issue-56762.stderr
@@ -1,14 +1,14 @@
-error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
+error[E0080]: could not evaluate static initializer
--> $DIR/issue-56762.rs:16:1
|
LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture
-error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture
- --> $DIR/issue-56762.rs:18:1
+error[E0080]: could not evaluate static initializer
+ --> $DIR/issue-56762.rs:19:1
|
LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843009213693951]` are too big for the current architecture
error: aborting due to 2 previous errors
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.rs b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
new file mode 100644
index 000000000..ce8d9848e
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.rs
@@ -0,0 +1,14 @@
+// build-fail
+// failure-status: 101
+// known-bug: #109681
+
+// This test verifies that we continue to hit the LLVM error for common linkage with non-zero
+// initializers, since it generates invalid LLVM IR.
+// Linkages are internal features marked as perma-unstable, so we don't need to fix the issue
+// for now.
+#![crate_type="lib"]
+#![feature(linkage)]
+
+#[linkage = "common"]
+#[no_mangle]
+pub static TEST: bool = true;
diff --git a/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
new file mode 100644
index 000000000..667bb3ec1
--- /dev/null
+++ b/tests/ui/linkage-attr/common-linkage-non-zero-init.stderr
@@ -0,0 +1,3 @@
+'common' global must have a zero initializer!
+ptr @TEST
+LLVM ERROR: Broken module found, compilation aborted!
diff --git a/tests/ui/lint-group-forbid-always-trumps-cli.stderr b/tests/ui/lint-group-forbid-always-trumps-cli.stderr
index 8910af87c..cd042179c 100644
--- a/tests/ui/lint-group-forbid-always-trumps-cli.stderr
+++ b/tests/ui/lint-group-forbid-always-trumps-cli.stderr
@@ -5,6 +5,7 @@ LL | let x = 1;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `-F unused-variables` implied by `-F unused`
+ = help: to override `-F unused` add `#[allow(unused_variables)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/cli-unknown-force-warn.rs b/tests/ui/lint/cli-unknown-force-warn.rs
index f3dea87a6..a9e4e4a60 100644
--- a/tests/ui/lint/cli-unknown-force-warn.rs
+++ b/tests/ui/lint/cli-unknown-force-warn.rs
@@ -1,7 +1,11 @@
// Checks that rustc correctly errors when passed an invalid lint with
// `--force-warn`. This is a regression test for issue #86958.
-//
+
+// check-pass
// compile-flags: --force-warn foo-qux
+
// error-pattern: unknown lint: `foo_qux`
+// error-pattern: requested on the command line with `--force-warn foo_qux`
+// error-pattern: `#[warn(unknown_lints)]` on by default
fn main() {}
diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr
index 9ce9f405a..2ee718a8c 100644
--- a/tests/ui/lint/cli-unknown-force-warn.stderr
+++ b/tests/ui/lint/cli-unknown-force-warn.stderr
@@ -1,11 +1,16 @@
-error[E0602]: unknown lint: `foo_qux`
+warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `foo_qux`
+warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
-error: aborting due to 2 previous errors
+warning[E0602]: unknown lint: `foo_qux`
+ |
+ = note: requested on the command line with `--force-warn foo_qux`
+
+warning: 3 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/command-line-lint-group-deny.stderr b/tests/ui/lint/command-line-lint-group-deny.stderr
index 04c3f6f26..59d8429ea 100644
--- a/tests/ui/lint/command-line-lint-group-deny.stderr
+++ b/tests/ui/lint/command-line-lint-group-deny.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-D non-snake-case` implied by `-D bad-style`
+ = help: to override `-D bad-style` add `#[allow(non_snake_case)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/command-line-lint-group-forbid.stderr b/tests/ui/lint/command-line-lint-group-forbid.stderr
index 736782140..486d32a9f 100644
--- a/tests/ui/lint/command-line-lint-group-forbid.stderr
+++ b/tests/ui/lint/command-line-lint-group-forbid.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-F non-snake-case` implied by `-F bad-style`
+ = help: to override `-F bad-style` add `#[allow(non_snake_case)]`
error: aborting due to previous error
diff --git a/tests/ui/lint/command-line-lint-group-warn.stderr b/tests/ui/lint/command-line-lint-group-warn.stderr
index e9c80b4ef..cfe346a5b 100644
--- a/tests/ui/lint/command-line-lint-group-warn.stderr
+++ b/tests/ui/lint/command-line-lint-group-warn.stderr
@@ -5,6 +5,7 @@ LL | let _InappropriateCamelCasing = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing`
|
= note: `-W non-snake-case` implied by `-W bad-style`
+ = help: to override `-W bad-style` add `#[allow(non_snake_case)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/expr-field.rs b/tests/ui/lint/expr-field.rs
new file mode 100644
index 000000000..638fbf521
--- /dev/null
+++ b/tests/ui/lint/expr-field.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+pub struct A {
+ pub x: u32,
+}
+
+#[deny(unused_comparisons)]
+pub fn foo(y: u32) -> A {
+ A {
+ #[allow(unused_comparisons)]
+ x: if y < 0 { 1 } else { 2 },
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
index d1b764b34..01c2ed84c 100644
--- a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | 0...100 => true,
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility`
+ = help: to override `--force-warn rust-2021-compatibility` add `#[allow(ellipsis_inclusive_range_patterns)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
index dc7b1b7b9..e925a195f 100644
--- a/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allow-warnings.stderr
@@ -5,6 +5,7 @@ LL | pub fn FUNCTION() {}
| ^^^^^^^^ help: convert the identifier to snake case: `function`
|
= note: `--force-warn non-snake-case` implied by `--force-warn nonstandard-style`
+ = help: to override `--force-warn nonstandard-style` add `#[allow(non_snake_case)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
index e17630fd3..b0cd3ddd2 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
index 72198541a..8c841916c 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
index 52c870ac2..c0144205d 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
@@ -7,6 +7,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
+ = help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/future-incompat-test.stderr b/tests/ui/lint/future-incompat-test.stderr
index 52674a843..2951f904f 100644
--- a/tests/ui/lint/future-incompat-test.stderr
+++ b/tests/ui/lint/future-incompat-test.stderr
@@ -6,4 +6,5 @@ LL | let x = 1;
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `-A unused-variables` implied by `-A unused`
+ = help: to override `-A unused` add `#[allow(unused_variables)]`
diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs
index 9c8c63681..43ceffb71 100644
--- a/tests/ui/lint/invalid_from_utf8.rs
+++ b/tests/ui/lint/invalid_from_utf8.rs
@@ -1,6 +1,8 @@
// check-pass
+#![feature(inline_const)]
#![feature(concat_bytes)]
+
#![warn(invalid_from_utf8_unchecked)]
#![warn(invalid_from_utf8)]
@@ -90,4 +92,29 @@ pub fn from_utf8() {
}
}
+pub fn from_utf8_with_indirections() {
+ let mut a = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8_mut(&mut a);
+ //~^ WARN calls to `std::str::from_utf8_mut`
+ let mut b = &mut a;
+ let mut c = b;
+ std::str::from_utf8_mut(c);
+ //~^ WARN calls to `std::str::from_utf8_mut`
+ let mut c = &[99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(c);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(&INVALID_1);
+ //~^ WARN calls to `std::str::from_utf8`
+ static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(&INVALID_2);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
+ std::str::from_utf8(INVALID_3);
+ //~^ WARN calls to `std::str::from_utf8`
+ const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
+ std::str::from_utf8(INVALID_4);
+ //~^ WARN calls to `std::str::from_utf8`
+}
+
fn main() {}
diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr
index 8e00d3bf8..884165d4f 100644
--- a/tests/ui/lint/invalid_from_utf8.stderr
+++ b/tests/ui/lint/invalid_from_utf8.stderr
@@ -1,43 +1,43 @@
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:19:9
+ --> $DIR/invalid_from_utf8.rs:21:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
- --> $DIR/invalid_from_utf8.rs:4:9
+ --> $DIR/invalid_from_utf8.rs:6:9
|
LL | #![warn(invalid_from_utf8_unchecked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:21:9
+ --> $DIR/invalid_from_utf8.rs:23:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:39:9
+ --> $DIR/invalid_from_utf8.rs:41:9
|
LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:41:9
+ --> $DIR/invalid_from_utf8.rs:43:9
|
LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:43:9
+ --> $DIR/invalid_from_utf8.rs:45:9
|
LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
@@ -45,7 +45,7 @@ LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
- --> $DIR/invalid_from_utf8.rs:45:9
+ --> $DIR/invalid_from_utf8.rs:47:9
|
LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
@@ -53,45 +53,45 @@ LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:62:9
+ --> $DIR/invalid_from_utf8.rs:64:9
|
LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
- --> $DIR/invalid_from_utf8.rs:5:9
+ --> $DIR/invalid_from_utf8.rs:7:9
|
LL | #![warn(invalid_from_utf8)]
| ^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:64:9
+ --> $DIR/invalid_from_utf8.rs:66:9
|
LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:82:9
+ --> $DIR/invalid_from_utf8.rs:84:9
|
LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
- | ^^^^^^^^^^^^^^^^^^^^-----------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:84:9
+ --> $DIR/invalid_from_utf8.rs:86:9
|
LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
- | ^^^^^^^^^^^^^^^^^^^^----------------------------------------------^
- | |
- | the literal was valid UTF-8 up to the 2 bytes
+ | ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+ | |
+ | the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:86:9
+ --> $DIR/invalid_from_utf8.rs:88:9
|
LL | std::str::from_utf8(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^-------------^
@@ -99,12 +99,69 @@ LL | std::str::from_utf8(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
- --> $DIR/invalid_from_utf8.rs:88:9
+ --> $DIR/invalid_from_utf8.rs:90:9
|
LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^---------------------------------^
| |
| the literal was valid UTF-8 up to the 2 bytes
-warning: 12 warnings emitted
+warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:97:5
+ |
+LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8_mut(&mut a);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:101:5
+ |
+LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL | std::str::from_utf8_mut(c);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:104:5
+ |
+LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(c);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:107:5
+ |
+LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(&INVALID_1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:110:5
+ |
+LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(&INVALID_2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:113:5
+ |
+LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(INVALID_3);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with a invalid literal always return an error
+ --> $DIR/invalid_from_utf8.rs:116:5
+ |
+LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
+ | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+LL | std::str::from_utf8(INVALID_4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 19 warnings emitted
diff --git a/tests/ui/lint/issue-99387.rs b/tests/ui/lint/issue-99387.rs
index ba5031167..571d4194f 100644
--- a/tests/ui/lint/issue-99387.rs
+++ b/tests/ui/lint/issue-99387.rs
@@ -2,7 +2,7 @@
//! opaque types.
#![feature(type_alias_impl_trait)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
pub type Successors<'a> = impl Iterator<Item = &'a ()>;
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
new file mode 100644
index 000000000..331136420
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
@@ -0,0 +1,29 @@
+#![deny(large_assignments)]
+#![feature(large_assignments)]
+#![move_size_limit = "1000"]
+// build-fail
+// only-x86_64
+
+// edition:2018
+// compile-flags: -Zmir-opt-level=0
+
+use std::{sync::Arc, rc::Rc};
+
+fn main() {
+ let _ = Arc::new([0; 9999]); // OK!
+ let _ = Box::new([0; 9999]); // OK!
+ let _ = Rc::new([0; 9999]); // OK!
+ let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
+}
+
+struct NotBox {
+ data: [u8; 9999],
+}
+
+impl NotBox {
+ fn new(data: [u8; 9999]) -> Self {
+ Self {
+ data, //~ ERROR large_assignments
+ }
+ }
+}
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
new file mode 100644
index 000000000..b45cbe5da
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
@@ -0,0 +1,23 @@
+error: moving 9999 bytes
+ --> $DIR/box_rc_arc_allowed.rs:16:13
+ |
+LL | let _ = NotBox::new([0; 9999]);
+ | ^^^^^^^^^^^^^^^^^^^^^^ 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/box_rc_arc_allowed.rs:1:9
+ |
+LL | #![deny(large_assignments)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: moving 9999 bytes
+ --> $DIR/box_rc_arc_allowed.rs:26:13
+ |
+LL | data,
+ | ^^^^ 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 2 previous errors
+
diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/lint/large_assignments/large_future.attribute.stderr
index 94f61caa2..734b7ff7b 100644
--- a/tests/ui/async-await/large_moves.option.stderr
+++ b/tests/ui/lint/large_assignments/large_future.attribute.stderr
@@ -1,31 +1,23 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
+ --> $DIR/large_future.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 = "..."]`
note: the lint level is defined here
- --> $DIR/large_moves.rs:1:9
+ --> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
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
+ --> $DIR/large_future.rs:20: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 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/lint/large_assignments/large_future.option.stderr
index 94f61caa2..734b7ff7b 100644
--- a/tests/ui/async-await/large_moves.attribute.stderr
+++ b/tests/ui/lint/large_assignments/large_future.option.stderr
@@ -1,31 +1,23 @@
error: moving 10024 bytes
- --> $DIR/large_moves.rs:19:14
+ --> $DIR/large_future.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 = "..."]`
note: the lint level is defined here
- --> $DIR/large_moves.rs:1:9
+ --> $DIR/large_future.rs:1:9
|
LL | #![deny(large_assignments)]
| ^^^^^^^^^^^^^^^^^
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
+ --> $DIR/large_future.rs:20: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 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/lint/large_assignments/large_future.rs
index c8ed6bafe..834746fa9 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/lint/large_assignments/large_future.rs
@@ -1,5 +1,5 @@
#![deny(large_assignments)]
-#![feature(large_assignments)]
+#![cfg_attr(attribute, feature(large_assignments))]
#![cfg_attr(attribute, move_size_limit = "1000")]
// build-fail
// only-x86_64
@@ -17,7 +17,6 @@ fn main() {
dbg!(y);
};
let z = (x, 42); //~ ERROR large_assignments
- //~^ ERROR large_assignments
let a = z.0; //~ ERROR large_assignments
let b = z.1;
}
diff --git a/tests/ui/lint/lint-ctypes-94223.rs b/tests/ui/lint/lint-ctypes-94223.rs
index 70dd2a71f..ac24f61b0 100644
--- a/tests/ui/lint/lint-ctypes-94223.rs
+++ b/tests/ui/lint/lint-ctypes-94223.rs
@@ -24,6 +24,13 @@ enum BadUnion {
type Foo = extern "C" fn([u8]);
//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe
+pub trait FooTrait {
+ type FooType;
+}
+
+pub type Foo2<T> = extern "C" fn(Option<&<T as FooTrait>::FooType>);
+//~^ ERROR `extern` fn uses type `Option<&<T as FooTrait>::FooType>`, which is not FFI-safe
+
pub struct FfiUnsafe;
#[allow(improper_ctypes_definitions)]
diff --git a/tests/ui/lint/lint-ctypes-94223.stderr b/tests/ui/lint/lint-ctypes-94223.stderr
index 49e64ed51..bd127cf60 100644
--- a/tests/ui/lint/lint-ctypes-94223.stderr
+++ b/tests/ui/lint/lint-ctypes-94223.stderr
@@ -66,8 +66,17 @@ LL | type Foo = extern "C" fn([u8]);
= help: consider using a raw pointer instead
= note: slices have no C equivalent
+error: `extern` fn uses type `Option<&<T as FooTrait>::FooType>`, which is not FFI-safe
+ --> $DIR/lint-ctypes-94223.rs:31:20
+ |
+LL | pub type Foo2<T> = extern "C" fn(Option<&<T as FooTrait>::FooType>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:34:17
+ --> $DIR/lint-ctypes-94223.rs:41:17
|
LL | pub static BAD: extern "C" fn(FfiUnsafe) = f;
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -75,13 +84,13 @@ LL | pub static BAD: extern "C" fn(FfiUnsafe) = f;
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:37:30
+ --> $DIR/lint-ctypes-94223.rs:44:30
|
LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -89,13 +98,13 @@ LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUns
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:37:56
+ --> $DIR/lint-ctypes-94223.rs:44:56
|
LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f);
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -103,13 +112,13 @@ LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUns
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe
- --> $DIR/lint-ctypes-94223.rs:41:22
+ --> $DIR/lint-ctypes-94223.rs:48:22
|
LL | pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f;
| ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -117,10 +126,10 @@ LL | pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f;
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
note: the type is defined here
- --> $DIR/lint-ctypes-94223.rs:27:1
+ --> $DIR/lint-ctypes-94223.rs:34:1
|
LL | pub struct FfiUnsafe;
| ^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 11 previous errors
+error: aborting due to 12 previous errors
diff --git a/tests/ui/lint/lint-ctypes-fn.rs b/tests/ui/lint/lint-ctypes-fn.rs
index d3b36a9d5..14831e247 100644
--- a/tests/ui/lint/lint-ctypes-fn.rs
+++ b/tests/ui/lint/lint-ctypes-fn.rs
@@ -1,6 +1,6 @@
#![feature(rustc_private)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
#![deny(improper_ctypes_definitions)]
extern crate libc;
diff --git a/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs
new file mode 100644
index 000000000..ca08eb23a
--- /dev/null
+++ b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.rs
@@ -0,0 +1,8 @@
+#![deny(improper_ctypes_definitions)]
+
+extern "C" fn foo<T: ?Sized + 'static>() -> Option<&'static T> {
+ //~^ ERROR `extern` fn uses type `Option<&T>`, which is not FFI-safe
+ None
+}
+
+fn main() {}
diff --git a/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr
new file mode 100644
index 000000000..f59fb3cc7
--- /dev/null
+++ b/tests/ui/lint/lint-ctypes-option-nonnull-unsized.stderr
@@ -0,0 +1,16 @@
+error: `extern` fn uses type `Option<&T>`, which is not FFI-safe
+ --> $DIR/lint-ctypes-option-nonnull-unsized.rs:3:45
+ |
+LL | extern "C" fn foo<T: ?Sized + 'static>() -> Option<&'static T> {
+ | ^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+note: the lint level is defined here
+ --> $DIR/lint-ctypes-option-nonnull-unsized.rs:1:9
+ |
+LL | #![deny(improper_ctypes_definitions)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lint/lint-ctypes.rs b/tests/ui/lint/lint-ctypes.rs
index 9165e14b7..3dd731625 100644
--- a/tests/ui/lint/lint-ctypes.rs
+++ b/tests/ui/lint/lint-ctypes.rs
@@ -1,6 +1,6 @@
#![feature(rustc_private)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
#![deny(improper_ctypes)]
extern crate libc;
diff --git a/tests/ui/lint/lint-pre-expansion-extern-module.stderr b/tests/ui/lint/lint-pre-expansion-extern-module.stderr
index ce3e8806a..8a6e1531d 100644
--- a/tests/ui/lint/lint-pre-expansion-extern-module.stderr
+++ b/tests/ui/lint/lint-pre-expansion-extern-module.stderr
@@ -7,6 +7,7 @@ LL | pub fn try() {}
= 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 <https://github.com/rust-lang/rust/issues/49716>
= note: `-W keyword-idents` implied by `-W rust-2018-compatibility`
+ = help: to override `-W rust-2018-compatibility` add `#[allow(keyword_idents)]`
warning: 1 warning emitted
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.rs b/tests/ui/lint/lint-removed-cmdline-deny.rs
new file mode 100644
index 000000000..8cf91cf60
--- /dev/null
+++ b/tests/ui/lint/lint-removed-cmdline-deny.rs
@@ -0,0 +1,13 @@
+// The raw_pointer_derived lint warns about its removal
+// cc #30346
+
+// compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
+
+// error-pattern:lint `raw_pointer_derive` has been removed
+// error-pattern:requested on the command line with `-D raw_pointer_derive`
+// error-pattern:requested on the command line with `-D renamed-and-removed-lints`
+
+#![warn(unused)]
+
+#[deny(warnings)]
+fn main() { let unused = (); }
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr
new file mode 100644
index 000000000..80c85d01e
--- /dev/null
+++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr
@@ -0,0 +1,28 @@
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+ = note: requested on the command line with `-D renamed-and-removed-lints`
+
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+
+error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+
+error: unused variable: `unused`
+ --> $DIR/lint-removed-cmdline-deny.rs:13:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
+ |
+note: the lint level is defined here
+ --> $DIR/lint-removed-cmdline-deny.rs:12:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/lint/lint-removed-cmdline.rs b/tests/ui/lint/lint-removed-cmdline.rs
index 462beabb9..34373df3a 100644
--- a/tests/ui/lint/lint-removed-cmdline.rs
+++ b/tests/ui/lint/lint-removed-cmdline.rs
@@ -4,6 +4,7 @@
// compile-flags:-D raw_pointer_derive
// error-pattern:lint `raw_pointer_derive` has been removed
+// error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
// error-pattern:requested on the command line with `-D raw_pointer_derive`
#![warn(unused)]
diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr
index 9be532ef2..ebfae34ad 100644
--- a/tests/ui/lint/lint-removed-cmdline.stderr
+++ b/tests/ui/lint/lint-removed-cmdline.stderr
@@ -1,6 +1,7 @@
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
@@ -11,13 +12,13 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
= note: requested on the command line with `-D raw_pointer_derive`
error: unused variable: `unused`
- --> $DIR/lint-removed-cmdline.rs:12:17
+ --> $DIR/lint-removed-cmdline.rs:13:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
- --> $DIR/lint-removed-cmdline.rs:11:8
+ --> $DIR/lint-removed-cmdline.rs:12:8
|
LL | #[deny(warnings)]
| ^^^^^^^^
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.rs b/tests/ui/lint/lint-renamed-cmdline-deny.rs
new file mode 100644
index 000000000..01629aaca
--- /dev/null
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.rs
@@ -0,0 +1,10 @@
+// compile-flags:-D renamed-and-removed-lints -D bare_trait_object
+
+// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
+// error-pattern:use the new name `bare_trait_objects`
+// error-pattern:requested on the command line with `-D bare_trait_object`
+// error-pattern:requested on the command line with `-D renamed-and-removed-lints`
+// error-pattern:unused
+
+#[deny(unused)]
+fn main() { let unused = (); }
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
new file mode 100644
index 000000000..df22ef60d
--- /dev/null
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
@@ -0,0 +1,31 @@
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+ = note: requested on the command line with `-D renamed-and-removed-lints`
+
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+
+error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = help: use the new name `bare_trait_objects`
+ = note: requested on the command line with `-D bare_trait_object`
+
+error: unused variable: `unused`
+ --> $DIR/lint-renamed-cmdline-deny.rs:10:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
+ |
+note: the lint level is defined here
+ --> $DIR/lint-renamed-cmdline-deny.rs:9:8
+ |
+LL | #[deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/lint/lint-renamed-cmdline.rs b/tests/ui/lint/lint-renamed-cmdline.rs
index c873771e3..fba7c3331 100644
--- a/tests/ui/lint/lint-renamed-cmdline.rs
+++ b/tests/ui/lint/lint-renamed-cmdline.rs
@@ -2,6 +2,7 @@
// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
// error-pattern:requested on the command line with `-D bare_trait_object`
+// error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
// error-pattern:unused
#[deny(unused)]
diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr
index 8dfd61ac9..a41284003 100644
--- a/tests/ui/lint/lint-renamed-cmdline.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline.stderr
@@ -1,23 +1,27 @@
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
+ = help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
error: unused variable: `unused`
- --> $DIR/lint-renamed-cmdline.rs:8:17
+ --> $DIR/lint-renamed-cmdline.rs:9:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
- --> $DIR/lint-renamed-cmdline.rs:7:8
+ --> $DIR/lint-renamed-cmdline.rs:8:8
|
LL | #[deny(unused)]
| ^^^^^^
diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr
index a11ee769c..858527822 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.stderr
+++ b/tests/ui/lint/lint-unexported-no-mangle.stderr
@@ -1,6 +1,7 @@
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs b/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
new file mode 100644
index 000000000..c7f8d434c
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
@@ -0,0 +1,4 @@
+// check-pass
+// compile-flags:-A unknown-lints -D bogus -D dead_cod
+
+fn main() { }
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs b/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
new file mode 100644
index 000000000..31bc20473
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
@@ -0,0 +1,9 @@
+// compile-flags:-D unknown-lints -D bogus -D dead_cod
+
+// error-pattern:unknown lint: `bogus`
+// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:requested on the command line with `-D dead_cod`
+// error-pattern:requested on the command line with `-D unknown-lints`
+// error-pattern:did you mean: `dead_code`
+
+fn main() { }
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
new file mode 100644
index 000000000..677b5edc8
--- /dev/null
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
@@ -0,0 +1,31 @@
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+ = note: requested on the command line with `-D unknown-lints`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+error[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.rs b/tests/ui/lint/lint-unknown-lint-cmdline.rs
index 7f3f55fba..81539cb6d 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.rs
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.rs
@@ -1,7 +1,9 @@
+// check-pass
// compile-flags:-D bogus -D dead_cod
// error-pattern:unknown lint: `bogus`
// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:`#[warn(unknown_lints)]` on by default
// error-pattern:unknown lint: `dead_cod`
// error-pattern:requested on the command line with `-D dead_cod`
// error-pattern:did you mean: `dead_code`
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
index 3855d5527..10db76ac4 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -1,21 +1,31 @@
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `dead_cod`
+warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
-error[E0602]: unknown lint: `dead_cod`
+warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
-error: aborting due to 4 previous errors
+warning[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+warning[E0602]: unknown lint: `dead_cod`
+ |
+ = help: did you mean: `dead_code`
+ = note: requested on the command line with `-D dead_cod`
+
+warning: 6 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
deleted file mode 100644
index cd3baa857..000000000
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-LL | wheeee(&no).await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
deleted file mode 100644
index aff2f7c32..000000000
--- a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-LL | wheeee(&no).await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
- |
-LL | let no = No {};
- | ^^
-note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:20:13
- |
-LL | wheeee(&no).await;
- | ^^ ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:20:13
- |
-LL | wheeee(&no).await;
- | ^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/dedup.rs b/tests/ui/lint/must_not_suspend/dedup.rs
index 96bdb7715..867bdf2ec 100644
--- a/tests/ui/lint/must_not_suspend/dedup.rs
+++ b/tests/ui/lint/must_not_suspend/dedup.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -16,8 +13,9 @@ async fn wheeee<T>(t: T) {
}
async fn yes() {
- let no = No {}; //~ ERROR `No` held across
- wheeee(&no).await; //[no_drop_tracking]~ ERROR `No` held across
+ let no = No {};
+ //~^ ERROR `No` held across
+ wheeee(&no).await;
drop(no);
}
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr
index cd3baa857..5d5b04a5d 100644
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/dedup.stderr
@@ -1,18 +1,19 @@
error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:9
+ --> $DIR/dedup.rs:16:9
|
LL | let no = No {};
| ^^
+LL |
LL | wheeee(&no).await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:9
+ --> $DIR/dedup.rs:16:9
|
LL | let no = No {};
| ^^
note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
+ --> $DIR/dedup.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs b/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs
deleted file mode 100644
index 1bc4a3812..000000000
--- a/tests/ui/lint/must_not_suspend/ref-drop-tracking.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// edition:2018
-// compile-flags: -Zdrop-tracking
-#![feature(must_not_suspend)]
-#![deny(must_not_suspend)]
-
-#[must_not_suspend = "You gotta use Umm's, ya know?"]
-struct Umm {
- i: i64
-}
-
-struct Bar {
- u: Umm,
-}
-
-async fn other() {}
-
-impl Bar {
- async fn uhoh(&mut self) {
- let guard = &mut self.u; //~ ERROR `Umm` held across
-
- other().await;
-
- *guard = Umm {
- i: 2
- }
- }
-}
-
-fn main() {
-}
diff --git a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr b/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
deleted file mode 100644
index 348880b9c..000000000
--- a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref-drop-tracking.rs:19:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-note: the lint level is defined here
- --> $DIR/ref-drop-tracking.rs:4:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
deleted file mode 100644
index fb18c2be9..000000000
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:13
- |
-LL | let guard = &mut self.u;
- | ^^^^^
-note: the lint level is defined here
- --> $DIR/ref.rs:7:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
deleted file mode 100644
index 6976dd349..000000000
--- a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:26
- |
-LL | let guard = &mut self.u;
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/ref.rs:7:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/ref.rs b/tests/ui/lint/must_not_suspend/ref.rs
index d05dcb83a..3b6ef39c9 100644
--- a/tests/ui/lint/must_not_suspend/ref.rs
+++ b/tests/ui/lint/must_not_suspend/ref.rs
@@ -1,8 +1,4 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
-
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -23,7 +19,6 @@ impl Bar {
other().await;
- let _g = &*guard;
*guard = Umm { i: 2 }
}
}
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/ref.stderr
index fb18c2be9..ed91a4a0b 100644
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/ref.stderr
@@ -1,5 +1,5 @@
error: reference to `Umm` held across a suspend point, but should not be
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
@@ -8,17 +8,17 @@ LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/ref.rs:22:13
+ --> $DIR/ref.rs:18:13
|
LL | let guard = &mut self.u;
| ^^^^^
note: the lint level is defined here
- --> $DIR/ref.rs:7:9
+ --> $DIR/ref.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
deleted file mode 100644
index 8c8ad1f37..000000000
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-...
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-note: the lint level is defined here
- --> $DIR/trait.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
deleted file mode 100644
index 8c8ad1f37..000000000
--- a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-...
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-note: the lint level is defined here
- --> $DIR/trait.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-LL |
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/trait.rs b/tests/ui/lint/must_not_suspend/trait.rs
index cc3ae298d..6c911cb4b 100644
--- a/tests/ui/lint/must_not_suspend/trait.rs
+++ b/tests/ui/lint/must_not_suspend/trait.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -25,9 +22,6 @@ pub async fn uhoh() {
let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across
other().await;
-
- drop(_guard1);
- drop(_guard2);
}
fn main() {
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.stderr
index 8c8ad1f37..2c03f8e82 100644
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/trait.stderr
@@ -1,5 +1,5 @@
error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
+ --> $DIR/trait.rs:21:9
|
LL | let _guard1 = r#impl();
| ^^^^^^^
@@ -8,18 +8,18 @@ LL | other().await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
+ --> $DIR/trait.rs:21:9
|
LL | let _guard1 = r#impl();
| ^^^^^^^
note: the lint level is defined here
- --> $DIR/trait.rs:6:9
+ --> $DIR/trait.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
+ --> $DIR/trait.rs:22:9
|
LL | let _guard2 = r#dyn();
| ^^^^^^^
@@ -28,7 +28,7 @@ LL | other().await;
| ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
+ --> $DIR/trait.rs:22:9
|
LL | let _guard2 = r#dyn();
| ^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
deleted file mode 100644
index e24cffdd0..000000000
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/unit.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
deleted file mode 100644
index e24cffdd0..000000000
--- a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/unit.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/unit.rs b/tests/ui/lint/must_not_suspend/unit.rs
index fbc51b366..af4a76caa 100644
--- a/tests/ui/lint/must_not_suspend/unit.rs
+++ b/tests/ui/lint/must_not_suspend/unit.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
#![feature(must_not_suspend)]
#![deny(must_not_suspend)]
@@ -10,6 +7,7 @@ struct Umm {
i: i64
}
+
fn bar() -> Umm {
Umm {
i: 1
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.stderr
index e24cffdd0..11c95c146 100644
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/unit.stderr
@@ -1,5 +1,5 @@
error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
@@ -7,17 +7,17 @@ LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:22:9
+ --> $DIR/unit.rs:20:9
|
LL | let _guard = bar();
| ^^^^^^
note: the lint level is defined here
- --> $DIR/unit.rs:6:9
+ --> $DIR/unit.rs:3:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
deleted file mode 100644
index 4f7b40a5e..000000000
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/warn.rs:7:9
- |
-LL | #![warn(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
deleted file mode 100644
index 4f7b40a5e..000000000
--- a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ----- the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/warn.rs:7:9
- |
-LL | #![warn(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/lint/must_not_suspend/warn.rs b/tests/ui/lint/must_not_suspend/warn.rs
index 5a4863169..2d5dd01e5 100644
--- a/tests/ui/lint/must_not_suspend/warn.rs
+++ b/tests/ui/lint/must_not_suspend/warn.rs
@@ -1,6 +1,3 @@
-// revisions: no_drop_tracking drop_tracking drop_tracking_mir
-// [drop_tracking] compile-flags: -Zdrop-tracking
-// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// run-pass
#![feature(must_not_suspend)]
@@ -21,9 +18,9 @@ fn bar() -> Umm {
async fn other() {}
pub async fn uhoh() {
- let _guard = bar(); //~ WARNING `Umm` held across
+ let guard = bar(); //~ WARNING `Umm` held across
other().await;
- drop(_guard);
+ drop(guard);
}
fn main() {
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/warn.stderr
index 4f7b40a5e..e59656e50 100644
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/warn.stderr
@@ -1,23 +1,23 @@
warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
LL | other().await;
| ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
+ --> $DIR/warn.rs:21:9
|
-LL | let _guard = bar();
- | ^^^^^^
+LL | let guard = bar();
+ | ^^^^^
note: the lint level is defined here
- --> $DIR/warn.rs:7:9
+ --> $DIR/warn.rs:4:9
|
LL | #![warn(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/no-coverage.rs b/tests/ui/lint/no-coverage.rs
index 07906a434..907d25d33 100644
--- a/tests/ui/lint/no-coverage.rs
+++ b/tests/ui/lint/no-coverage.rs
@@ -1,55 +1,55 @@
#![feature(extern_types)]
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
#![feature(impl_trait_in_assoc_type)]
#![warn(unused_attributes)]
-#![no_coverage]
-//~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+#![coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
-#[no_coverage]
-//~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+#[coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
trait Trait {
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
const X: u32;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T;
type U;
}
-#[no_coverage]
-//~^ WARN: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+#[coverage(off)]
+//~^ WARN: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
impl Trait for () {
const X: u32 = 0;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T = Self;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type U = impl Trait; //~ ERROR unconstrained opaque type
}
extern "C" {
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
static X: u32;
- #[no_coverage] //~ ERROR `#[no_coverage]` must be applied to coverable code
+ #[coverage(off)] //~ ERROR `#[coverage]` must be applied to coverable code
type T;
}
-#[no_coverage]
+#[coverage(off)]
fn main() {
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
let _ = ();
match () {
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
() => (),
}
- #[no_coverage]
- //~^ WARN `#[no_coverage]` may only be applied to function definitions
+ #[coverage(off)]
+ //~^ WARN `#[coverage]` may only be applied to function definitions
return ();
}
diff --git a/tests/ui/lint/no-coverage.stderr b/tests/ui/lint/no-coverage.stderr
index 404efbeac..a87b0fb49 100644
--- a/tests/ui/lint/no-coverage.stderr
+++ b/tests/ui/lint/no-coverage.stderr
@@ -1,8 +1,8 @@
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:8:1
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/no-coverage.rs:4:9
@@ -10,83 +10,83 @@ note: the lint level is defined here
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:20:1
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:42:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:47:9
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-warning: `#[no_coverage]` may only be applied to function definitions
+warning: `#[coverage]` may only be applied to function definitions
--> $DIR/no-coverage.rs:52:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:11:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | const X: u32;
| ------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:14:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T;
| ------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:25:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T = Self;
| -------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:28:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type U = impl Trait;
| -------------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:33:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | static X: u32;
| -------------- not coverable code
-error[E0788]: `#[no_coverage]` must be applied to coverable code
+error[E0788]: `#[coverage]` must be applied to coverable code
--> $DIR/no-coverage.rs:36:5
|
-LL | #[no_coverage]
- | ^^^^^^^^^^^^^^
+LL | #[coverage(off)]
+ | ^^^^^^^^^^^^^^^^
LL | type T;
| ------- not coverable code
-warning: `#[no_coverage]` does not propagate into items and must be applied to the contained functions directly
+warning: `#[coverage]` does not propagate into items and must be applied to the contained functions directly
--> $DIR/no-coverage.rs:5:1
|
-LL | #![no_coverage]
- | ^^^^^^^^^^^^^^^
+LL | #![coverage(off)]
+ | ^^^^^^^^^^^^^^^^^
error: unconstrained opaque type
--> $DIR/no-coverage.rs:29:14
diff --git a/tests/ui/lint/noop-method-call.fixed b/tests/ui/lint/noop-method-call.fixed
index eeb80279f..4d9834f7d 100644
--- a/tests/ui/lint/noop-method-call.fixed
+++ b/tests/ui/lint/noop-method-call.fixed
@@ -1,6 +1,7 @@
// check-pass
// run-rustfix
+#![feature(rustc_attrs)]
#![allow(unused)]
use std::borrow::Borrow;
@@ -49,3 +50,15 @@ fn non_generic(non_clone_type: &PlainType<u32>) {
non_clone_type;
//~^ WARN call to `.clone()` on a reference in this situation does nothing
}
+
+struct DiagnosticClone;
+impl Clone for DiagnosticClone {
+ #[rustc_diagnostic_item = "other_clone"]
+ fn clone(&self) -> Self {
+ DiagnosticClone
+ }
+}
+
+fn with_other_diagnostic_item(x: DiagnosticClone) {
+ x.clone();
+}
diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs
index 9569a0dfc..6242a00e0 100644
--- a/tests/ui/lint/noop-method-call.rs
+++ b/tests/ui/lint/noop-method-call.rs
@@ -1,6 +1,7 @@
// check-pass
// run-rustfix
+#![feature(rustc_attrs)]
#![allow(unused)]
use std::borrow::Borrow;
@@ -49,3 +50,15 @@ fn non_generic(non_clone_type: &PlainType<u32>) {
non_clone_type.clone();
//~^ WARN call to `.clone()` on a reference in this situation does nothing
}
+
+struct DiagnosticClone;
+impl Clone for DiagnosticClone {
+ #[rustc_diagnostic_item = "other_clone"]
+ fn clone(&self) -> Self {
+ DiagnosticClone
+ }
+}
+
+fn with_other_diagnostic_item(x: DiagnosticClone) {
+ x.clone();
+}
diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr
index aefc2706f..d04f44022 100644
--- a/tests/ui/lint/noop-method-call.stderr
+++ b/tests/ui/lint/noop-method-call.stderr
@@ -1,5 +1,5 @@
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:15:25
+ --> $DIR/noop-method-call.rs:16:25
|
LL | let _ = &mut encoded.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -8,7 +8,7 @@ LL | let _ = &mut encoded.clone();
= note: `#[warn(noop_method_call)]` on by default
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:17:21
+ --> $DIR/noop-method-call.rs:18:21
|
LL | let _ = &encoded.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -16,7 +16,7 @@ LL | let _ = &encoded.clone();
= note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:23:71
+ --> $DIR/noop-method-call.rs:24:71
|
LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -24,7 +24,7 @@ LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clon
= note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.deref()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:31:63
+ --> $DIR/noop-method-call.rs:32:63
|
LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
| ^^^^^^^^ help: remove this redundant call
@@ -32,7 +32,7 @@ LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
= note: the type `PlainType<u32>` does not implement `Deref`, so calling `deref` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.borrow()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:35:66
+ --> $DIR/noop-method-call.rs:36:66
|
LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
| ^^^^^^^^^ help: remove this redundant call
@@ -40,7 +40,7 @@ LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
= note: the type `PlainType<u32>` does not implement `Borrow`, so calling `borrow` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:44:19
+ --> $DIR/noop-method-call.rs:45:19
|
LL | non_clone_type.clone();
| ^^^^^^^^ help: remove this redundant call
@@ -48,7 +48,7 @@ LL | non_clone_type.clone();
= note: the type `PlainType<T>` does not implement `Clone`, so calling `clone` on `&PlainType<T>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:49:19
+ --> $DIR/noop-method-call.rs:50:19
|
LL | non_clone_type.clone();
| ^^^^^^^^ help: remove this redundant call
diff --git a/tests/ui/lint/ptr_null_checks.rs b/tests/ui/lint/ptr_null_checks.rs
index e677ea309..3028084e9 100644
--- a/tests/ui/lint/ptr_null_checks.rs
+++ b/tests/ui/lint/ptr_null_checks.rs
@@ -38,15 +38,15 @@ fn main() {
if (&mut 8 as *mut i32).is_null() {}
//~^ WARN references are not nullable
if ptr::from_mut(&mut 8).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (&8 as *const i32).is_null() {}
//~^ WARN references are not nullable
if ptr::from_ref(&8).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if ptr::from_ref(&8).cast_mut().is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
- //~^ WARN references are not nullable
+ //~^ WARN call is never null
if (&8 as *const i32) == std::ptr::null() {}
//~^ WARN references are not nullable
let ref_num = &8;
@@ -65,6 +65,12 @@ fn main() {
if (&*{ static_i32() } as *const i32).is_null() {}
//~^ WARN references are not nullable
+ // ---------------- Functions -------------------
+ if ptr::NonNull::new(&mut 8).unwrap().as_ptr().is_null() {}
+ //~^ WARN call is never null
+ if ptr::NonNull::<u8>::dangling().as_ptr().is_null() {}
+ //~^ WARN call is never null
+
// ----------------------------------------------
const ZPTR: *const () = 0 as *const _;
const NOT_ZPTR: *const () = 1 as *const _;
diff --git a/tests/ui/lint/ptr_null_checks.stderr b/tests/ui/lint/ptr_null_checks.stderr
index 3cee1804b..0edc1b865 100644
--- a/tests/ui/lint/ptr_null_checks.stderr
+++ b/tests/ui/lint/ptr_null_checks.stderr
@@ -117,13 +117,11 @@ LL | if (&mut 8 as *mut i32).is_null() {}
| |
| expression has type `&mut i32`
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_mut` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:40:8
|
LL | if ptr::from_mut(&mut 8).is_null() {}
- | ^^^^^^^^^^^^^^------^^^^^^^^^^^
- | |
- | expression has type `&mut i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: references are not nullable, so checking them for null will always return false
--> $DIR/ptr_null_checks.rs:42:8
@@ -133,29 +131,23 @@ LL | if (&8 as *const i32).is_null() {}
| |
| expression has type `&i32`
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:44:8
|
LL | if ptr::from_ref(&8).is_null() {}
- | ^^^^^^^^^^^^^^--^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:46:8
|
LL | if ptr::from_ref(&8).cast_mut().is_null() {}
- | ^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-warning: references are not nullable, so checking them for null will always return false
+warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
--> $DIR/ptr_null_checks.rs:48:8
|
LL | if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
- | ^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | expression has type `&i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: references are not nullable, so checking them for null will always return false
--> $DIR/ptr_null_checks.rs:50:8
@@ -221,5 +213,17 @@ LL | if (&*{ static_i32() } as *const i32).is_null() {}
| |
| expression has type `&i32`
-warning: 25 warnings emitted
+warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
+ --> $DIR/ptr_null_checks.rs:69:8
+ |
+LL | if ptr::NonNull::new(&mut 8).unwrap().as_ptr().is_null() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
+ --> $DIR/ptr_null_checks.rs:71:8
+ |
+LL | if ptr::NonNull::<u8>::dangling().as_ptr().is_null() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 27 warnings emitted
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index 6c38bca3d..fba8789e9 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -36,6 +36,12 @@ unsafe fn ref_to_mut() {
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::mem::transmute::<_, *mut i32>(num) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *std::cell::UnsafeCell::raw_get(
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ num as *const i32 as *const std::cell::UnsafeCell<i32>
+ );
let deferred = num as *const i32 as *mut i32;
let _num = &mut *deferred;
@@ -43,13 +49,35 @@ unsafe fn ref_to_mut() {
let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
let _num = &mut *deferred;
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let deferred_rebind = deferred;
+ let _num = &mut *deferred_rebind;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
let _num = &mut *(num as *const _ as usize as *mut i32);
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::mem::transmute::<_, *mut _>(num as *const i32) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
+ static NUM: &'static i32 = &2;
+ let num = NUM as *const i32 as *mut i32;
+ let num = num;
+ let num = num;
+ let _num = &mut *num;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
unsafe fn generic_ref_cast_mut<T>(this: &T) -> &mut T {
&mut *((this as *const _) as *mut _)
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
}
+
+ fn as_mut<T>(x: &T) -> &mut T {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ }
+
+ fn as_mut_i32(x: &i32) -> &mut i32 {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ }
}
unsafe fn assign_to_ref() {
@@ -71,14 +99,30 @@ unsafe fn assign_to_ref() {
//~^ ERROR assigning to `&T` is undefined behavior
*std::mem::transmute::<_, *mut i32>(num) += 1;
//~^ ERROR assigning to `&T` is undefined behavior
+ *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write(
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::mem::transmute::<*const i32, *mut i32>(num),
+ -1i32,
+ );
let value = num as *const i32 as *mut i32;
*value = 1;
//~^ ERROR assigning to `&T` is undefined behavior
+ let value_rebind = value;
+ *value_rebind = 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
*(num as *const i32).cast::<i32>().cast_mut() = 2;
//~^ ERROR assigning to `&T` is undefined behavior
*(num as *const _ as usize as *mut i32) = 2;
//~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write_unaligned(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
+ std::ptr::write_volatile(value, 2);
+ //~^ ERROR assigning to `&T` is undefined behavior
unsafe fn generic_assign_to_ref<T>(this: &T, a: T) {
*(this as *const _ as *mut _) = a;
@@ -86,6 +130,7 @@ unsafe fn assign_to_ref() {
}
}
+const RAW_PTR: *mut u8 = 1 as *mut u8;
unsafe fn no_warn() {
let num = &3i32;
let mut_num = &mut 3i32;
@@ -100,6 +145,23 @@ unsafe fn no_warn() {
let mut value = 3;
let value: *const i32 = &mut value;
*(value as *const i16 as *mut i16) = 42;
+ *RAW_PTR = 42; // RAW_PTR is defined outside the function body,
+ // make sure we don't ICE on it when trying to
+ // determine if we should lint on it or not.
+
+ fn safe_as_mut<T>(x: &std::cell::UnsafeCell<T>) -> &mut T {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
+
+ fn cell_as_mut(x: &std::cell::Cell<i32>) -> &mut i32 {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
+
+ #[repr(transparent)]
+ struct DoesContainUnsafeCell(std::cell::UnsafeCell<i32>);
+ fn safe_as_mut2(x: &DoesContainUnsafeCell) -> &mut DoesContainUnsafeCell {
+ unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ }
}
fn main() {}
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index 7ff9b76a8..8f89cf980 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -4,6 +4,7 @@ error: casting `&T` to `&mut T` is undefined behavior, even if the reference is
LL | let _num = &mut *(num as *const i32 as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
= note: `#[deny(invalid_reference_casting)]` on by default
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
@@ -11,150 +12,328 @@ error: casting `&T` to `&mut T` is undefined behavior, even if the reference is
|
LL | let _num = &mut *(num as *const i32).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:23:16
|
LL | let _num = &mut *std::ptr::from_ref(num).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:25:16
|
LL | let _num = &mut *std::ptr::from_ref({ num }).cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:27:16
|
LL | let _num = &mut *{ std::ptr::from_ref(num) }.cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:29:16
|
LL | let _num = &mut *(std::ptr::from_ref({ num }) as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:31:16
|
LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:33:16
|
LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut().cast_const().cast_mut();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:35:16
|
LL | let _num = &mut *(std::ptr::from_ref(static_u8()) as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:37:16
|
LL | let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:39:16
+ |
+LL | let _num = &mut *(std::mem::transmute::<_, *mut i32>(num) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
--> $DIR/reference_casting.rs:41:16
|
+LL | let _num = &mut *std::cell::UnsafeCell::raw_get(
+ | ________________^
+LL | |
+LL | | num as *const i32 as *const std::cell::UnsafeCell<i32>
+LL | | );
+ | |_____^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:47:16
+ |
LL | let deferred = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
LL | let _num = &mut *deferred;
| ^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:44:16
+ --> $DIR/reference_casting.rs:50:16
|
LL | let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
| ---------------------------------------------------------------------------- casting happend here
LL | let _num = &mut *deferred;
| ^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:46:16
+ --> $DIR/reference_casting.rs:53:16
+ |
+LL | let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
+ | ---------------------------------------------------------------------------- casting happend here
+...
+LL | let _num = &mut *deferred_rebind;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:55:16
|
LL | let _num = &mut *(num as *const _ as usize as *mut i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:50:9
+ --> $DIR/reference_casting.rs:57:16
+ |
+LL | let _num = &mut *(std::mem::transmute::<_, *mut _>(num as *const i32) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:64:16
+ |
+LL | let num = NUM as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | let _num = &mut *num;
+ | ^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:68:9
|
LL | &mut *((this as *const _) as *mut _)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:73:18
+ |
+LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:78:18
+ |
+LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:60:5
+ --> $DIR/reference_casting.rs:88:5
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:62:5
+ --> $DIR/reference_casting.rs:90:5
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:64:5
+ --> $DIR/reference_casting.rs:92:5
|
LL | *std::ptr::from_ref(num).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:66:5
+ --> $DIR/reference_casting.rs:94:5
|
LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:68:5
+ --> $DIR/reference_casting.rs:96:5
|
LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:70:5
+ --> $DIR/reference_casting.rs:98:5
|
LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:72:5
+ --> $DIR/reference_casting.rs:100:5
|
LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:102:5
+ |
+LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:76:5
+ --> $DIR/reference_casting.rs:104:5
+ |
+LL | / std::ptr::write(
+LL | |
+LL | | std::mem::transmute::<*const i32, *mut i32>(num),
+LL | | -1i32,
+LL | | );
+ | |_____^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:111:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
LL | *value = 1;
| ^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:114:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | *value_rebind = 1;
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:78:5
+ --> $DIR/reference_casting.rs:116:5
|
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:80:5
+ --> $DIR/reference_casting.rs:118:5
|
LL | *(num as *const _ as usize as *mut i32) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:84:9
+ --> $DIR/reference_casting.rs:120:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:122:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write_unaligned(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:124:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+...
+LL | std::ptr::write_volatile(value, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:128:9
|
LL | *(this as *const _ as *mut _) = a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
-error: aborting due to 25 previous errors
+error: aborting due to 38 previous errors
diff --git a/tests/ui/lint/trivial_casts.stderr b/tests/ui/lint/trivial_casts.stderr
index 74f962835..5e2115574 100644
--- a/tests/ui/lint/trivial_casts.stderr
+++ b/tests/ui/lint/trivial_casts.stderr
@@ -128,7 +128,7 @@ LL | let _ = &baz as &dyn Fn(i32);
|
= help: cast can be replaced by coercion; this might require a temporary variable
-error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:22]` as `&dyn Fn(i32)`
+error: trivial cast: `&{closure@$DIR/trivial_casts.rs:72:13: 72:22}` as `&dyn Fn(i32)`
--> $DIR/trivial_casts.rs:73:13
|
LL | let _ = &x as &dyn Fn(i32);
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
index 54d86c31f..ba32fb566 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.rs
@@ -26,6 +26,32 @@ fn doc_comment_on_expr(num: u8) -> bool {
num == 3
}
+fn doc_comment_on_expr_field() -> bool {
+ struct S { foo: i32 }
+
+ let x = S {
+ /// useless doc comment
+ //~^ ERROR: unused doc comment
+ foo: 3
+ };
+
+ true
+}
+
+fn doc_comment_on_pat_field() -> bool {
+ struct S { foo: i32 }
+
+ let S {
+ /// useless doc comment
+ //~^ ERROR: unused doc comment
+ foo
+ } = S {
+ foo: 3
+ };
+
+ true
+}
+
fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
//~^ ERROR: unused doc comment
diff --git a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
index 078b780d8..b5aa62157 100644
--- a/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
+++ b/tests/ui/lint/unused/unused-doc-comments-edge-cases.stderr
@@ -42,7 +42,29 @@ LL | num == 3
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:29:27
+ --> $DIR/unused-doc-comments-edge-cases.rs:33:9
+ |
+LL | /// useless doc comment
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | foo: 3
+ | ------ rustdoc does not generate documentation for expression fields
+ |
+ = help: use `//` for a plain comment
+
+error: unused doc comment
+ --> $DIR/unused-doc-comments-edge-cases.rs:45:9
+ |
+LL | /// useless doc comment
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | foo
+ | --- rustdoc does not generate documentation for pattern fields
+ |
+ = help: use `//` for a plain comment
+
+error: unused doc comment
+ --> $DIR/unused-doc-comments-edge-cases.rs:55:27
|
LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
| ^^^^^^^^^^^^ - rustdoc does not generate documentation for generic parameters
@@ -50,7 +72,7 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:33:5
+ --> $DIR/unused-doc-comments-edge-cases.rs:59:5
|
LL | /// unused doc comment
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +85,7 @@ LL | | }
= help: use `//` for a plain comment
error: unused doc comment
- --> $DIR/unused-doc-comments-edge-cases.rs:40:1
+ --> $DIR/unused-doc-comments-edge-cases.rs:66:1
|
LL | /// unused doc comment
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -89,7 +111,7 @@ help: you might have meant to return this value
LL | return true;
| ++++++ +
-error: aborting due to 8 previous errors
+error: aborting due to 10 previous errors
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/lint/unused/unused-parens-issue-106413.rs b/tests/ui/lint/unused/unused-parens-issue-106413.rs
new file mode 100644
index 000000000..7e76ab073
--- /dev/null
+++ b/tests/ui/lint/unused/unused-parens-issue-106413.rs
@@ -0,0 +1,32 @@
+// check-pass
+#![warn(unused_parens)]
+
+fn id<T>(t: T) -> T { t }
+
+fn main() {
+ // This should not warn
+ let _ = 1 as (i32) < 2;
+ let _ = id(1 as (i32) < 2);
+ let _ = id(1 as i32)
+ as (i32) < 2;
+ // These should warn
+ let _ = 1 as ((i32)) < 2; //~WARN unnecessary parentheses
+ let _ = 1 as (i32); //~WARN unnecessary parentheses
+ let _ = 1 as (i32) > 2; //~WARN unnecessary parentheses
+ let _ = id(1 as (i32)) //~WARN unnecessary parentheses
+ as (i32) < 2;
+ let _ = id(1 as (i32)) < 2; //~WARN unnecessary parentheses
+
+ // This should not warn
+ let _ = 1 as (i32) << 2;
+ let _ = id(1 as (i32) << 2);
+ let _ = id(1 as i32)
+ as (i32) << 2;
+ // These should warn
+ let _ = 1 as ((i32)) << 2; //~WARN unnecessary parentheses
+ let _ = 1 as (i32); //~WARN unnecessary parentheses
+ let _ = 1 as (i32) >> 2; //~WARN unnecessary parentheses
+ let _ = id(1 as (i32)) //~WARN unnecessary parentheses
+ as (i32) << 2;
+ let _ = id(1 as (i32)) << 2; //~WARN unnecessary parentheses
+}
diff --git a/tests/ui/lint/unused/unused-parens-issue-106413.stderr b/tests/ui/lint/unused/unused-parens-issue-106413.stderr
new file mode 100644
index 000000000..d2d8f76d9
--- /dev/null
+++ b/tests/ui/lint/unused/unused-parens-issue-106413.stderr
@@ -0,0 +1,127 @@
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:13:19
+ |
+LL | let _ = 1 as ((i32)) < 2;
+ | ^ ^
+ |
+note: the lint level is defined here
+ --> $DIR/unused-parens-issue-106413.rs:2:9
+ |
+LL | #![warn(unused_parens)]
+ | ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let _ = 1 as ((i32)) < 2;
+LL + let _ = 1 as (i32) < 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:14:18
+ |
+LL | let _ = 1 as (i32);
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32);
+LL + let _ = 1 as i32;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:15:18
+ |
+LL | let _ = 1 as (i32) > 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32) > 2;
+LL + let _ = 1 as i32 > 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:16:21
+ |
+LL | let _ = id(1 as (i32))
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32))
+LL + let _ = id(1 as i32)
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:18:21
+ |
+LL | let _ = id(1 as (i32)) < 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32)) < 2;
+LL + let _ = id(1 as i32) < 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:26:19
+ |
+LL | let _ = 1 as ((i32)) << 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as ((i32)) << 2;
+LL + let _ = 1 as (i32) << 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:27:18
+ |
+LL | let _ = 1 as (i32);
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32);
+LL + let _ = 1 as i32;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:28:18
+ |
+LL | let _ = 1 as (i32) >> 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = 1 as (i32) >> 2;
+LL + let _ = 1 as i32 >> 2;
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:29:21
+ |
+LL | let _ = id(1 as (i32))
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32))
+LL + let _ = id(1 as i32)
+ |
+
+warning: unnecessary parentheses around type
+ --> $DIR/unused-parens-issue-106413.rs:31:21
+ |
+LL | let _ = id(1 as (i32)) << 2;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = id(1 as (i32)) << 2;
+LL + let _ = id(1 as i32) << 2;
+ |
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs b/tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs
index 6e030f1cc..6e030f1cc 100644
--- a/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs
+++ b/tests/ui/loops/issue-69225-SCEVAddExpr-wrap-flag.rs
diff --git a/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs b/tests/ui/loops/issue-69225-layout-repeated-checked-add.rs
index 7f43e4d1a..7f43e4d1a 100644
--- a/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs
+++ b/tests/ui/loops/issue-69225-layout-repeated-checked-add.rs
diff --git a/tests/ui/loops/loop-break-value.rs b/tests/ui/loops/loop-break-value.rs
index 51c9a36a0..c35200520 100644
--- a/tests/ui/loops/loop-break-value.rs
+++ b/tests/ui/loops/loop-break-value.rs
@@ -95,4 +95,67 @@ fn main() {
break LOOP;
//~^ ERROR cannot find value `LOOP` in this scope
}
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break; //~ ERROR mismatched types
+ };
+
+ let _ = 'a: loop {
+ loop {
+ break; // This doesn't affect the expected break type of the 'a loop
+ loop {
+ loop {
+ break 'a 1;
+ }
+ }
+ }
+ break 'a; //~ ERROR mismatched types
+ };
+
+ loop {
+ break;
+ let _ = loop {
+ break 2;
+ loop {
+ break;
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ }
+
+ 'a: loop {
+ break;
+ let _ = 'a: loop {
+ //~^ WARNING label name `'a` shadows a label name that is already in scope
+ break 'a 2;
+ loop {
+ break 'a; //~ ERROR mismatched types
+ }
+ };
+ break 2; //~ ERROR mismatched types
+ };
+
+ loop { // point at the return type
+ break 2; //~ ERROR mismatched types
+ }
}
diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr
index 5525dbb90..6c83bc757 100644
--- a/tests/ui/loops/loop-break-value.stderr
+++ b/tests/ui/loops/loop-break-value.stderr
@@ -1,3 +1,21 @@
+warning: label name `'a` shadows a label name that is already in scope
+ --> $DIR/loop-break-value.rs:136:17
+ |
+LL | 'a: loop {
+ | -- first declared here
+LL | break;
+LL | let _ = 'a: loop {
+ | ^^ label `'a` already in scope
+
+warning: label name `'a` shadows a label name that is already in scope
+ --> $DIR/loop-break-value.rs:148:17
+ |
+LL | 'a: loop {
+ | -- first declared here
+LL | break;
+LL | let _ = 'a: loop {
+ | ^^ label `'a` already in scope
+
error[E0425]: cannot find value `LOOP` in this scope
--> $DIR/loop-break-value.rs:95:15
|
@@ -134,7 +152,10 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:4:31
|
LL | let val: ! = loop { break break; };
- | ^^^^^ expected `!`, found `()`
+ | --- ---- ^^^^^ expected `!`, found `()`
+ | | |
+ | | this loop is expected to be of type `!`
+ | expected because of this assignment
|
= note: expected type `!`
found unit type `()`
@@ -142,24 +163,38 @@ LL | let val: ! = loop { break break; };
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:11:19
|
+LL | break "asdf";
+ | ------------ expected because of this `break`
+LL | } else {
LL | break 123;
| ^^^ expected `&str`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:16:15
|
+LL | let _: i32 = loop {
+ | - ---- this loop is expected to be of type `i32`
+ | |
+ | expected because of this assignment
LL | break "asdf";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:21:31
|
+LL | let _: i32 = 'outer_loop: loop {
+ | - ---- this loop is expected to be of type `i32`
+ | |
+ | expected because of this assignment
+LL | loop {
LL | break 'outer_loop "nope";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:73:26
|
+LL | break;
+ | ----- expected because of this `break`
LL | break 'c 123;
| ^^^ expected `()`, found integer
@@ -167,7 +202,11 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:80:15
|
LL | break (break, break);
- | ^^^^^^^^^^^^^^ expected `()`, found `(!, !)`
+ | ^-----^^-----^
+ | || |
+ | || expected because of this `break`
+ | |expected because of this `break`
+ | expected `()`, found `(!, !)`
|
= note: expected unit type `()`
found tuple `(!, !)`
@@ -175,19 +214,119 @@ LL | break (break, break);
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:85:15
|
+LL | break;
+ | ----- expected because of this `break`
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:90:9
|
+LL | break 2;
+ | ------- expected because of this `break`
LL | break;
- | ^^^^^
- | |
- | expected integer, found `()`
- | help: give it a value of the expected type: `break value`
+ | ^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:108:9
+ |
+LL | break 'a 1;
+ | ---------- expected because of this `break`
+...
+LL | break;
+ | ^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:120:9
+ |
+LL | break 'a 1;
+ | ---------- expected because of this `break`
+...
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:131:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:140:17
+ |
+LL | break 2;
+ | ------- expected because of this `break`
+LL | loop {
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:143:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:152:17
+ |
+LL | break 'a 2;
+ | ---------- expected because of this `break`
+LL | loop {
+LL | break 'a;
+ | ^^^^^^^^ expected integer, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | break 'a value;
+ | +++++
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:155:15
+ |
+LL | break;
+ | ----- expected because of this `break`
+...
+LL | break 2;
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:159:15
+ |
+LL | fn main() {
+ | - expected `()` because of this return type
+...
+LL | loop { // point at the return type
+ | ---- this loop is expected to be of type `()`
+LL | break 2;
+ | ^ expected `()`, found integer
-error: aborting due to 17 previous errors; 1 warning emitted
+error: aborting due to 25 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0308, E0425, E0571.
For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/loops/loop-labeled-break-value.stderr b/tests/ui/loops/loop-labeled-break-value.stderr
index aa04d330f..694d6c306 100644
--- a/tests/ui/loops/loop-labeled-break-value.stderr
+++ b/tests/ui/loops/loop-labeled-break-value.stderr
@@ -2,28 +2,43 @@ error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:3:29
|
LL | let _: i32 = loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | - ---- ^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = loop { break 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:6:37
|
LL | let _: i32 = 'inner: loop { break 'inner };
- | ^^^^^^^^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 'inner 42`
+ | - ---- ^^^^^^^^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = 'inner: loop { break 'inner 42 };
+ | ++
error[E0308]: mismatched types
--> $DIR/loop-labeled-break-value.rs:9:45
|
LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } };
- | ^^^^^^^^^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 'inner2 42`
+ | - ---- ^^^^^^^^^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let _: i32 = 'inner2: loop { loop { break 'inner2 42 } };
+ | ++
error: aborting due to 3 previous errors
diff --git a/tests/ui/loops/loop-properly-diverging-2.stderr b/tests/ui/loops/loop-properly-diverging-2.stderr
index 5030a2935..1d1ae60cd 100644
--- a/tests/ui/loops/loop-properly-diverging-2.stderr
+++ b/tests/ui/loops/loop-properly-diverging-2.stderr
@@ -2,10 +2,15 @@ error[E0308]: mismatched types
--> $DIR/loop-properly-diverging-2.rs:2:23
|
LL | let x: i32 = loop { break };
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | - ---- ^^^^^ expected `i32`, found `()`
+ | | |
+ | | this loop is expected to be of type `i32`
+ | expected because of this assignment
+ |
+help: give it a value of the expected type
+ |
+LL | let x: i32 = loop { break 42 };
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/issue-2804.rs b/tests/ui/macros/issue-2804.rs
index 571028c5e..571028c5e 100644
--- a/tests/ui/issue-2804.rs
+++ b/tests/ui/macros/issue-2804.rs
diff --git a/tests/ui/issues/issue-39467.rs b/tests/ui/macros/issue-39467.rs
index 397751e4e..397751e4e 100644
--- a/tests/ui/issues/issue-39467.rs
+++ b/tests/ui/macros/issue-39467.rs
diff --git a/tests/ui/macros/must-use-in-macro-55516.stderr b/tests/ui/macros/must-use-in-macro-55516.stderr
index 8878b0eea..7bf4aaab5 100644
--- a/tests/ui/macros/must-use-in-macro-55516.stderr
+++ b/tests/ui/macros/must-use-in-macro-55516.stderr
@@ -6,6 +6,7 @@ LL | write!(&mut example, "{}", 42);
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `-W unused-must-use` implied by `-W unused`
+ = help: to override `-W unused` add `#[allow(unused_must_use)]`
= note: this warning originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
diff --git a/tests/ui/main-wrong-type.stderr b/tests/ui/main-wrong-type.stderr
index 43efaf884..1e5f36875 100644
--- a/tests/ui/main-wrong-type.stderr
+++ b/tests/ui/main-wrong-type.stderr
@@ -4,8 +4,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(foo: S) {
| ^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(S)`
+ = note: expected signature `fn()`
+ found signature `fn(S)`
error: aborting due to previous error
diff --git a/tests/ui/match/issue-72896.rs b/tests/ui/match/issue-72896-non-partial-eq-const.rs
index 3a8b82037..a3095f0be 100644
--- a/tests/ui/match/issue-72896.rs
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.rs
@@ -17,7 +17,8 @@ const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
fn main() {
match CONST_SET {
- CONST_SET => { /* ok */ }
+ CONST_SET => { /* ok */ } //~WARN: must implement `PartialEq`
+ //~| previously accepted
_ => panic!("match fell through?"),
}
}
diff --git a/tests/ui/match/issue-72896-non-partial-eq-const.stderr b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
new file mode 100644
index 000000000..a7fc0cfc0
--- /dev/null
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
@@ -0,0 +1,23 @@
+warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
+ |
+LL | CONST_SET => { /* ok */ }
+ | ^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
+ --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
+ |
+LL | CONST_SET => { /* ok */ }
+ | ^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
+ = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+
diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr
index 46ee8d517..7b8bdfe00 100644
--- a/tests/ui/match/match_non_exhaustive.stderr
+++ b/tests/ui/match/match_non_exhaustive.stderr
@@ -45,7 +45,8 @@ note: `E2` defined here
|
LL | pub enum E2 { A, B }
| ^^^^^^^^^^^
- = note: the matched value is of type `E2`, which is marked as non-exhaustive
+ = note: the matched value is of type `E2`
+ = note: `E2` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL | match e2 { E2::A => (), E2::B => (), _ => todo!() };
diff --git a/tests/ui/issues/issue-3707.rs b/tests/ui/methods/issue-3707.rs
index 0817c51ee..0817c51ee 100644
--- a/tests/ui/issues/issue-3707.rs
+++ b/tests/ui/methods/issue-3707.rs
diff --git a/tests/ui/issues/issue-3707.stderr b/tests/ui/methods/issue-3707.stderr
index 07c8101cb..07c8101cb 100644
--- a/tests/ui/issues/issue-3707.stderr
+++ b/tests/ui/methods/issue-3707.stderr
diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr
index a8afdeb84..a329b52e3 100644
--- a/tests/ui/methods/issues/issue-61525.stderr
+++ b/tests/ui/methods/issues/issue-61525.stderr
@@ -1,8 +1,8 @@
error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time
- --> $DIR/issue-61525.rs:14:33
+ --> $DIR/issue-61525.rs:14:19
|
LL | 1.query::<dyn ToString>("")
- | ----- ^^ doesn't have a size known at compile-time
+ | ----- ^^^^^^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/methods/method-missing-call.stderr b/tests/ui/methods/method-missing-call.stderr
index 040a65d16..bc508461b 100644
--- a/tests/ui/methods/method-missing-call.stderr
+++ b/tests/ui/methods/method-missing-call.stderr
@@ -9,7 +9,7 @@ help: use parentheses to call the method
LL | .get_x();
| ++
-error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:23]>, [closure@$DIR/method-missing-call.rs:28:23: 28:28]>`
+error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, {closure@$DIR/method-missing-call.rs:27:20: 27:23}>, {closure@$DIR/method-missing-call.rs:28:23: 28:28}>`
--> $DIR/method-missing-call.rs:29:16
|
LL | .filter_map;
diff --git a/tests/ui/mir/issue-92893.rs b/tests/ui/mir/issue-92893.rs
index 635050f37..6127d267e 100644
--- a/tests/ui/mir/issue-92893.rs
+++ b/tests/ui/mir/issue-92893.rs
@@ -1,7 +1,5 @@
struct Bug<A = [(); (let a = (), 1).1]> {
- //~^ `let` expressions are not supported here
- //~| `let` expressions in this position are unstable [E0658]
- //~| expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
a: A
}
diff --git a/tests/ui/mir/issue-92893.stderr b/tests/ui/mir/issue-92893.stderr
index 4a0fcce31..6c1a9dc03 100644
--- a/tests/ui/mir/issue-92893.stderr
+++ b/tests/ui/mir/issue-92893.stderr
@@ -3,24 +3,8 @@ error: expected expression, found `let` statement
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/issue-92893.rs:1:22
- |
-LL | struct Bug<A = [(); (let a = (), 1).1]> {
- | ^^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/mir/mir-inlining/always-encode-mirs.rs b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
new file mode 100644
index 000000000..f3731996c
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/always-encode-mirs.rs
@@ -0,0 +1,12 @@
+// Regression test for MIR inlining with -Zalways-encode-mir enabled in the auxiliary crate.
+// Previously we inlined function not eligible for inlining which lead to linking error:
+// undefined reference to `internal::S'
+//
+// aux-build:internal.rs
+// build-pass
+// compile-flags: -O
+extern crate internal;
+
+fn main() {
+ println!("{}", internal::f());
+}
diff --git a/tests/ui/mir/mir-inlining/auxiliary/internal.rs b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
new file mode 100644
index 000000000..fa0f9c2da
--- /dev/null
+++ b/tests/ui/mir/mir-inlining/auxiliary/internal.rs
@@ -0,0 +1,7 @@
+// compile-flags: -Zalways-encode-mir
+
+static S: usize = 42;
+
+pub fn f() -> &'static usize {
+ &S
+}
diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr
index 6b9ac3c58..d63cec489 100644
--- a/tests/ui/mismatched_types/cast-rfc0401.stderr
+++ b/tests/ui/mismatched_types/cast-rfc0401.stderr
@@ -82,13 +82,18 @@ error[E0606]: casting `f32` as `*const u8` is invalid
LL | let _ = f as *const u8;
| ^^^^^^^^^^^^^^
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-rfc0401.rs:39:13
|
LL | let _ = 3_i32 as bool;
- | ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0`
+ | ^^^^^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let _ = 3_i32 != 0;
+ | ~~~~
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `E` as `bool`
--> $DIR/cast-rfc0401.rs:40:13
|
LL | let _ = E::A as bool;
diff --git a/tests/ui/issues/issue-13033.rs b/tests/ui/mismatched_types/issue-13033.rs
index fdb356e70..fdb356e70 100644
--- a/tests/ui/issues/issue-13033.rs
+++ b/tests/ui/mismatched_types/issue-13033.rs
diff --git a/tests/ui/issues/issue-13033.stderr b/tests/ui/mismatched_types/issue-13033.stderr
index db2c1189e..db2c1189e 100644
--- a/tests/ui/issues/issue-13033.stderr
+++ b/tests/ui/mismatched_types/issue-13033.stderr
diff --git a/tests/ui/mismatched_types/issue-36053-2.stderr b/tests/ui/mismatched_types/issue-36053-2.stderr
index 4d230ce9a..bac27788a 100644
--- a/tests/ui/mismatched_types/issue-36053-2.stderr
+++ b/tests/ui/mismatched_types/issue-36053-2.stderr
@@ -15,7 +15,7 @@ help: consider adjusting the signature so it borrows its argument
LL | once::<&str>("str").fuse().filter(|a: &&str| true).count();
| +
-error[E0599]: the method `count` exists for struct `Filter<Fuse<Once<&str>>, [closure@issue-36053-2.rs:7:39]>`, but its trait bounds were not satisfied
+error[E0599]: the method `count` exists for struct `Filter<Fuse<Once<&str>>, {closure@issue-36053-2.rs:7:39}>`, but its trait bounds were not satisfied
--> $DIR/issue-36053-2.rs:7:55
|
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
@@ -28,12 +28,12 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
= note: doesn't satisfy `_: Iterator`
|
= note: the following trait bounds were not satisfied:
- `<[closure@$DIR/issue-36053-2.rs:7:39: 7:48] as FnOnce<(&&str,)>>::Output = bool`
- which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- `[closure@$DIR/issue-36053-2.rs:7:39: 7:48]: FnMut<(&&str,)>`
- which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
- which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
+ `<{closure@$DIR/issue-36053-2.rs:7:39: 7:48} as FnOnce<(&&str,)>>::Output = bool`
+ which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnMut<(&&str,)>`
+ which is required by `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ `Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
+ which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator`
error: aborting due to 2 previous errors
diff --git a/tests/ui/mismatched_types/normalize-fn-sig.stderr b/tests/ui/mismatched_types/normalize-fn-sig.stderr
index e3a064655..252e56387 100644
--- a/tests/ui/mismatched_types/normalize-fn-sig.stderr
+++ b/tests/ui/mismatched_types/normalize-fn-sig.stderr
@@ -8,7 +8,6 @@ LL | needs_i32_ref_fn(foo::<()>);
|
= note: expected fn pointer `fn(&'static i32, i32)`
found fn item `fn(i32, &'static i32) {foo::<()>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/normalize-fn-sig.rs:11:4
|
diff --git a/tests/ui/issues/issue-34721.fixed b/tests/ui/moves/issue-34721.fixed
index f135ad383..f135ad383 100644
--- a/tests/ui/issues/issue-34721.fixed
+++ b/tests/ui/moves/issue-34721.fixed
diff --git a/tests/ui/issues/issue-34721.rs b/tests/ui/moves/issue-34721.rs
index 14dd01766..14dd01766 100644
--- a/tests/ui/issues/issue-34721.rs
+++ b/tests/ui/moves/issue-34721.rs
diff --git a/tests/ui/issues/issue-34721.stderr b/tests/ui/moves/issue-34721.stderr
index f2bf22227..f2bf22227 100644
--- a/tests/ui/issues/issue-34721.stderr
+++ b/tests/ui/moves/issue-34721.stderr
diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr
index 3ac5e96c5..4eff08ead 100644
--- a/tests/ui/namespace/namespace-mix.stderr
+++ b/tests/ui/namespace/namespace-mix.stderr
@@ -114,6 +114,11 @@ LL | check(m1::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -128,6 +133,11 @@ LL | check(m2::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -142,6 +152,11 @@ LL | check(m2::S);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -156,6 +171,11 @@ LL | check(xm1::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -170,6 +190,11 @@ LL | check(xm2::S{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -184,6 +209,11 @@ LL | check(xm2::S);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -198,6 +228,11 @@ LL | check(m3::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -212,6 +247,11 @@ LL | check(m3::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -226,6 +266,11 @@ LL | check(m4::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -240,6 +285,11 @@ LL | check(m4::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -254,6 +304,11 @@ LL | check(xm3::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -268,6 +323,11 @@ LL | check(xm3::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -282,6 +342,11 @@ LL | check(xm4::TS{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -296,6 +361,11 @@ LL | check(xm4::TS);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -310,6 +380,11 @@ LL | check(m5::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -324,6 +399,11 @@ LL | check(m5::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -338,6 +418,11 @@ LL | check(m6::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -352,6 +437,11 @@ LL | check(m6::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -366,6 +456,11 @@ LL | check(xm5::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -380,6 +475,11 @@ LL | check(xm5::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -394,6 +494,11 @@ LL | check(xm6::US{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -408,6 +513,11 @@ LL | check(xm6::US);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -422,6 +532,11 @@ LL | check(m7::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -436,6 +551,11 @@ LL | check(m8::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -450,6 +570,11 @@ LL | check(m8::V);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -464,6 +589,11 @@ LL | check(xm7::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -478,6 +608,11 @@ LL | check(xm8::V{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -492,6 +627,11 @@ LL | check(xm8::V);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -506,6 +646,11 @@ LL | check(m9::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -520,6 +665,11 @@ LL | check(m9::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -534,6 +684,11 @@ LL | check(mA::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -548,6 +703,11 @@ LL | check(mA::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -562,6 +722,11 @@ LL | check(xm9::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -576,6 +741,11 @@ LL | check(xm9::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -590,6 +760,11 @@ LL | check(xmA::TV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -604,6 +779,11 @@ LL | check(xmA::TV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -618,6 +798,11 @@ LL | check(mB::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -632,6 +817,11 @@ LL | check(mB::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -646,6 +836,11 @@ LL | check(mC::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -660,6 +855,11 @@ LL | check(mC::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -674,6 +874,11 @@ LL | check(xmB::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -688,6 +893,11 @@ LL | check(xmB::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -702,6 +912,11 @@ LL | check(xmC::UV{});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
@@ -716,6 +931,11 @@ LL | check(xmC::UV);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/namespace-mix.rs:20:1
+ |
+LL | trait Impossible {}
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `check`
--> $DIR/namespace-mix.rs:21:13
|
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
deleted file mode 100644
index 0ccd441cc..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// gate-test-packed_bundled_libs
-
-// ignore-wasm32-bare
-// compile-flags: --crate-type rlib
-// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-// build-fail
-
-#[link(name = "rust_test_helpers", kind = "static", modifiers = "+bundle,+whole-archive")]
-extern "C" {}
-
-fn main() {}
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
deleted file mode 100644
index 8a9fed740..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-
-error: aborting due to previous error
-
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
deleted file mode 100644
index 18d4b52a3..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// gate-test-packed_bundled_libs
-
-// ignore-wasm32-bare
-// compile-flags: -l static:+bundle,+whole-archive=rust_test_helpers --crate-type rlib
-// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-// build-fail
-
-fn main() {}
diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
deleted file mode 100644
index 8a9fed740..000000000
--- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs
-
-error: aborting due to previous error
-
diff --git a/tests/ui/nested-ty-params.rs b/tests/ui/nested-ty-params.rs
index 85413acdb..25bac1ba2 100644
--- a/tests/ui/nested-ty-params.rs
+++ b/tests/ui/nested-ty-params.rs
@@ -1,4 +1,4 @@
-// error-pattern:can't use generic parameters from outer function
+// error-pattern:can't use generic parameters from outer item
fn hd<U>(v: Vec<U> ) -> U {
fn hd1(w: [U]) -> U { return w[0]; }
diff --git a/tests/ui/nested-ty-params.stderr b/tests/ui/nested-ty-params.stderr
index 8f4746f5e..a9cdec667 100644
--- a/tests/ui/nested-ty-params.stderr
+++ b/tests/ui/nested-ty-params.stderr
@@ -1,22 +1,22 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:16
|
LL | fn hd<U>(v: Vec<U> ) -> U {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn hd1(w: [U]) -> U { return w[0]; }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<U>`
+ | help: try introducing a local generic parameter here: `<U>`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:23
|
LL | fn hd<U>(v: Vec<U> ) -> U {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn hd1(w: [U]) -> U { return w[0]; }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<U>`
+ | help: try introducing a local generic parameter here: `<U>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
index 5b6f02351..49f55db1e 100644
--- a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
+++ b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
@@ -1,4 +1,4 @@
-error[E0271]: expected `[closure@fallback-closure-wrap.rs:18:40]` to be a closure that returns `()`, but it returns `!`
+error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to be a closure that returns `()`, but it returns `!`
--> $DIR/fallback-closure-wrap.rs:18:31
|
LL | let error = Closure::wrap(Box::new(move || {
@@ -10,7 +10,7 @@ LL | | }) as Box<dyn FnMut()>);
|
= note: expected unit type `()`
found type `!`
- = note: required for the cast from `Box<[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]>` to `Box<dyn FnMut()>`
+ = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47}>` to `Box<dyn FnMut()>`
error: aborting due to previous error
diff --git a/tests/ui/never_type/feature-gate-never_type_fallback.stderr b/tests/ui/never_type/feature-gate-never_type_fallback.stderr
index 2db1cc4b7..56aafbb4c 100644
--- a/tests/ui/never_type/feature-gate-never_type_fallback.stderr
+++ b/tests/ui/never_type/feature-gate-never_type_fallback.stderr
@@ -8,6 +8,11 @@ LL | foo(panic!())
| | this tail expression is of type `()`
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/feature-gate-never_type_fallback.rs:7:1
+ |
+LL | trait T {}
+ | ^^^^^^^
note: required by a bound in `foo`
--> $DIR/feature-gate-never_type_fallback.rs:13:16
|
diff --git a/tests/ui/never_type/impl_trait_fallback3.stderr b/tests/ui/never_type/impl_trait_fallback3.stderr
index 5d5d216fb..821d14156 100644
--- a/tests/ui/never_type/impl_trait_fallback3.stderr
+++ b/tests/ui/never_type/impl_trait_fallback3.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn a() -> Foo {
| ^^^ the trait `T` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl_trait_fallback3.rs:5:1
+ |
+LL | trait T {
+ | ^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/never_type/impl_trait_fallback4.stderr b/tests/ui/never_type/impl_trait_fallback4.stderr
index f2e216e90..67421ba8d 100644
--- a/tests/ui/never_type/impl_trait_fallback4.stderr
+++ b/tests/ui/never_type/impl_trait_fallback4.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn foo() -> impl T {
| ^^^^^^ the trait `T` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl_trait_fallback4.rs:3:1
+ |
+LL | trait T {
+ | ^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr
index 99dfce869..59292ed68 100644
--- a/tests/ui/never_type/issue-52443.stderr
+++ b/tests/ui/never_type/issue-52443.stderr
@@ -33,10 +33,12 @@ error[E0308]: mismatched types
--> $DIR/issue-52443.rs:4:17
|
LL | [(); loop { break }];
- | ^^^^^
- | |
- | expected `usize`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ^^^^^ expected `usize`, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | [(); loop { break 42 }];
+ | ++
error[E0015]: cannot convert `RangeFrom<usize>` into an iterator in constants
--> $DIR/issue-52443.rs:9:21
diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
index 06e902bca..54c16230f 100644
--- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
+++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `E: From<()>` is not satisfied
- --> $DIR/never-value-fallback-issue-66757.rs:28:26
+ --> $DIR/never-value-fallback-issue-66757.rs:28:6
|
LL | <E as From<_>>::from(never);
- | -------------------- ^^^^^ the trait `From<()>` is not implemented for `E`
- | |
- | required by a bound introduced by this call
+ | ^ the trait `From<()>` is not implemented for `E`
|
= help: the trait `From<!>` is implemented for `E`
diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
index 1e3a5328d..b3cb7813e 100644
--- a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
+++ b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
@@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
|
= note: defining type: test::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) i32)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) i32)),
(),
]
diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr
index bc4ba93f8..4f0156728 100644
--- a/tests/ui/nll/closure-requirements/escape-argument.stderr
+++ b/tests/ui/nll/closure-requirements/escape-argument.stderr
@@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
|
= note: defining type: test::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32)),
(),
]
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
index f8383cc42..ccf56bf6f 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
@@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| {
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?3 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?3 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?4
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
index 113173d8f..a16433c9d 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
index ba15199ab..9e0f16c0f 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
@@ -6,7 +6,7 @@ LL | foo(cell, |cell_a, cell_x| {
|
= note: defining type: case1::{closure#0} with closure args [
i32,
- for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
(),
]
@@ -36,7 +36,7 @@ LL | foo(cell, |cell_a, cell_x| {
|
= note: defining type: case2::{closure#0} with closure args [
i32,
- for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
(),
]
= note: number of external vids: 2
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
index f2bf83c6c..e4989e321 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?2
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
index 2734326ed..be35e62d0 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
index 5ab321eb6..8880dd816 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
|
= note: defining type: test::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
index 595fd5ff5..47774b63f 100644
--- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
@@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, x, y| {
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
index 62b0e3eed..3404bb128 100644
--- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?2
diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
index 6f2044d62..e40648912 100644
--- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
@@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
|
= note: defining type: supply::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
+ for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(),
]
= note: late-bound region is '?3
diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
index 7635f2ede..18fb7195d 100644
--- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
+++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a`
|
= note: defining type: test::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32,
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32,
(),
]
diff --git a/tests/ui/nll/issue-54556-stephaneyfx.stderr b/tests/ui/nll/issue-54556-stephaneyfx.stderr
index f9e82cb00..0dfea0fd7 100644
--- a/tests/ui/nll/issue-54556-stephaneyfx.stderr
+++ b/tests/ui/nll/issue-54556-stephaneyfx.stderr
@@ -12,7 +12,7 @@ LL | }
| -
| |
| `stmt` dropped here while still borrowed
- | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Map<Rows<'_>, [closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:19]>`
+ | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Map<Rows<'_>, {closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:19}>`
|
= note: the temporary is part of an expression at the end of a block;
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.rs b/tests/ui/nll/missing-universe-cause-issue-114907.rs
new file mode 100644
index 000000000..94acdccfc
--- /dev/null
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.rs
@@ -0,0 +1,40 @@
+// This is a non-regression test for issue #114907 where an ICE happened because of missing
+// `UniverseInfo`s accessed during diagnostics.
+//
+// A couple notes:
+// - the `FnOnce` bounds need an arg that is a reference
+// - a custom `Drop` is needed somewhere in the type that `accept` returns, to create universes
+// during liveness and dropck outlives computation
+
+// check-fail
+
+trait Role {
+ type Inner;
+}
+
+struct HandshakeCallback<C>(C);
+impl<C: FnOnce(&())> Role for HandshakeCallback<C> {
+ type Inner = ();
+}
+
+struct Handshake<R: Role> {
+ _inner: Option<R::Inner>,
+}
+impl<R: Role> Drop for Handshake<R> {
+ fn drop(&mut self) {}
+}
+
+fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> {
+ todo!()
+}
+
+fn main() {
+ let callback = |_| {};
+ accept(callback);
+ //~^ ERROR mismatched types
+ //~| ERROR mismatched types
+ //~| ERROR implementation of `FnOnce` is not general enough
+ //~| ERROR implementation of `FnOnce` is not general enough
+ //~| ERROR higher-ranked subtype error
+ //~| ERROR higher-ranked subtype error
+}
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
new file mode 100644
index 000000000..c3dd4257a
--- /dev/null
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
@@ -0,0 +1,79 @@
+error[E0308]: mismatched types
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected trait `for<'a> FnOnce<(&'a (),)>`
+ found trait `FnOnce<(&(),)>`
+note: this closure does not fulfill the lifetime requirements
+ --> $DIR/missing-universe-cause-issue-114907.rs:32:20
+ |
+LL | let callback = |_| {};
+ | ^^^
+note: the lifetime requirement is introduced here
+ --> $DIR/missing-universe-cause-issue-114907.rs:27:14
+ |
+LL | fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> {
+ | ^^^^^^^^^^^
+help: consider specifying the type of the closure parameters
+ |
+LL | let callback = |_: &_| {};
+ | ~~~~~~~
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error[E0308]: mismatched types
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:5
+ |
+LL | accept(callback);
+ | ^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected trait `for<'a> FnOnce<(&'a (),)>`
+ found trait `FnOnce<(&(),)>`
+note: this closure does not fulfill the lifetime requirements
+ --> $DIR/missing-universe-cause-issue-114907.rs:32:20
+ |
+LL | let callback = |_| {};
+ | ^^^
+note: the lifetime requirement is introduced here
+ --> $DIR/missing-universe-cause-issue-114907.rs:20:21
+ |
+LL | struct Handshake<R: Role> {
+ | ^^^^
+help: consider specifying the type of the closure parameters
+ |
+LL | let callback = |_: &_| {};
+ | ~~~~~~~
+
+error: higher-ranked subtype error
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:21
+ |
+LL | accept(callback);
+ | ^
+
+error: higher-ranked subtype error
+ --> $DIR/missing-universe-cause-issue-114907.rs:33:21
+ |
+LL | accept(callback);
+ | ^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
index 660211fe2..f58d49d84 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
@@ -6,7 +6,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
|
= note: defining type: generic::<T>::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) T)),
(),
]
= note: number of external vids: 2
@@ -28,7 +28,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
|
= note: defining type: generic_fail::<T>::{closure#0} with closure args [
i16,
- for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
+ for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) T)),
(),
]
= note: late-bound region is '?2
diff --git a/tests/ui/no-send-res-ports.stderr b/tests/ui/no-send-res-ports.stderr
index 75561f411..33446e9d1 100644
--- a/tests/ui/no-send-res-ports.stderr
+++ b/tests/ui/no-send-res-ports.stderr
@@ -4,7 +4,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
LL | thread::spawn(move|| {
| ------------- ^-----
| | |
- | _____|_____________within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`
+ | _____|_____________within this `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`
| | |
| | required by a bound introduced by this call
LL | |
@@ -13,7 +13,7 @@ LL | | println!("{:?}", y);
LL | | });
| |_____^ `Rc<()>` cannot be sent between threads safely
|
- = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`, the trait `Send` is not implemented for `Rc<()>`
+ = help: within `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`, the trait `Send` is not implemented for `Rc<()>`
note: required because it appears within the type `Port<()>`
--> $DIR/no-send-res-ports.rs:5:8
|
diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/not-clone-closure.stderr
index db9307c61..17cf938d1 100644
--- a/tests/ui/not-clone-closure.stderr
+++ b/tests/ui/not-clone-closure.stderr
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
+error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
--> $DIR/not-clone-closure.rs:11:23
|
LL | let hello = move || {
- | ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
+ | ------- within this `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`
...
LL | let hello = hello.clone();
- | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S`
+ | ^^^^^ within `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`, the trait `Clone` is not implemented for `S`
|
note: required because it's used within this closure
--> $DIR/not-clone-closure.rs:7:17
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
index cf5345b1c..d59fc1712 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
@@ -1,6 +1,5 @@
-//! This test checks that even if some associated types have
-//! `where Self: Sized` bounds, those without still need to be
-//! mentioned in trait objects.
+//! This test checks that associated types with `Self: Sized` cannot be projected
+//! from a `dyn Trait`.
trait Bop {
type Bar: Default
@@ -16,5 +15,4 @@ fn bop<T: Bop + ?Sized>() {
fn main() {
bop::<dyn Bop>();
- //~^ ERROR: the size for values of type `dyn Bop` cannot be known at compilation time
}
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
index f8488d842..224d33fb2 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
@@ -1,5 +1,5 @@
error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied
- --> $DIR/assoc_type_bounds_sized_used.rs:12:30
+ --> $DIR/assoc_type_bounds_sized_used.rs:11:30
|
LL | let _ = <T as Bop>::Bar::default();
| ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds
@@ -13,15 +13,15 @@ LL | fn bop<T: Bop + ?Sized>() where T: Sized {
| ++++++++++++++
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> $DIR/assoc_type_bounds_sized_used.rs:12:13
+ --> $DIR/assoc_type_bounds_sized_used.rs:11:14
|
LL | fn bop<T: Bop + ?Sized>() {
| - this type parameter needs to be `Sized`
LL | let _ = <T as Bop>::Bar::default();
- | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `Bop::Bar`
- --> $DIR/assoc_type_bounds_sized_used.rs:8:15
+ --> $DIR/assoc_type_bounds_sized_used.rs:7:15
|
LL | type Bar: Default
| --- required by a bound in this associated type
@@ -34,20 +34,7 @@ LL - fn bop<T: Bop + ?Sized>() {
LL + fn bop<T: Bop>() {
|
-error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time
- --> $DIR/assoc_type_bounds_sized_used.rs:18:11
- |
-LL | bop::<dyn Bop>();
- | ^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `dyn Bop`
-note: required by a bound in `bop`
- --> $DIR/assoc_type_bounds_sized_used.rs:11:11
- |
-LL | fn bop<T: Bop + ?Sized>() {
- | ^^^ required by this bound in `bop`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs
new file mode 100644
index 000000000..0b30a88fd
--- /dev/null
+++ b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs
@@ -0,0 +1,25 @@
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+trait Foo {
+ type Bar<'a>
+ where
+ Self: Sized;
+
+ fn test(&self);
+}
+
+impl Foo for () {
+ type Bar<'a> = () where Self: Sized;
+
+ fn test(&self) {}
+}
+
+fn test(x: &dyn Foo) {
+ x.test();
+}
+
+fn main() {
+ test(&());
+}
diff --git a/tests/ui/on-unimplemented/on-trait.stderr b/tests/ui/on-unimplemented/on-trait.stderr
index 4b040f1ac..4847a1a5a 100644
--- a/tests/ui/on-unimplemented/on-trait.stderr
+++ b/tests/ui/on-unimplemented/on-trait.stderr
@@ -5,6 +5,11 @@ LL | let y: Option<Vec<u8>> = collect(x.iter()); // this should give approxi
| ^^^^^^^ a collection of type `Option<Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
|
= help: the trait `MyFromIterator<&u8>` is not implemented for `Option<Vec<u8>>`
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-trait.rs:17:1
+ |
+LL | trait MyFromIterator<A> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `collect`
--> $DIR/on-trait.rs:22:39
|
@@ -18,6 +23,11 @@ LL | let x: String = foobar();
| ^^^^^^ test error `String` with `u8` `_` `u32` in `Foo`
|
= help: the trait `Foo<u8, _, u32>` is not implemented for `String`
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-trait.rs:7:3
+ |
+LL | pub trait Foo<Bar, Baz, Quux> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `foobar`
--> $DIR/on-trait.rs:12:24
|
diff --git a/tests/ui/on-unimplemented/parent-label.stderr b/tests/ui/on-unimplemented/parent-label.stderr
index 8cd7412fd..101a41512 100644
--- a/tests/ui/on-unimplemented/parent-label.stderr
+++ b/tests/ui/on-unimplemented/parent-label.stderr
@@ -8,6 +8,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -24,6 +29,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -41,6 +51,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
@@ -58,6 +73,11 @@ LL | f(Foo {});
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/parent-label.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/parent-label.rs:10:9
|
diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr
index a2357e49b..257dec200 100644
--- a/tests/ui/on-unimplemented/sum.stderr
+++ b/tests/ui/on-unimplemented/sum.stderr
@@ -1,8 +1,10 @@
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
- --> $DIR/sum.rs:4:25
+ --> $DIR/sum.rs:4:31
|
LL | vec![(), ()].iter().sum::<i32>();
- | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
@@ -19,10 +21,12 @@ note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
- --> $DIR/sum.rs:7:25
+ --> $DIR/sum.rs:7:35
|
LL | vec![(), ()].iter().product::<i32>();
- | ^^^^^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
+ | ------- ^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Product<&()>` is not implemented for `i32`
= help: the following other types implement trait `Product<A>`:
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
index 775961d3f..ae27db7a8 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
@@ -6,8 +6,5 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic(
- info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> () //~ ERROR return type should be `!`
-{
-}
+fn panic(info: PanicInfo) -> () {}
+//~^ `#[panic_handler]` function has wrong type [E0308]
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
index 8b044f766..85555c439 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
@@ -1,14 +1,12 @@
-error: return type should be `!`
- --> $DIR/panic-handler-bad-signature-1.rs:11:6
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-1.rs:9:16
|
-LL | ) -> ()
- | ^^
-
-error: argument should be `&PanicInfo`
- --> $DIR/panic-handler-bad-signature-1.rs:10:11
+LL | fn panic(info: PanicInfo) -> () {}
+ | ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>`
|
-LL | info: PanicInfo,
- | ^^^^^^^^^
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !`
+ found signature `for<'a> fn(PanicInfo<'a>)`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
index 727934000..3c3f1513f 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
@@ -6,9 +6,8 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic(
- info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> !
+fn panic(info: &'static PanicInfo) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
{
loop {}
}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
index 5ab693420..84eba2a5a 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
@@ -1,8 +1,12 @@
-error: argument should be `&PanicInfo`
- --> $DIR/panic-handler-bad-signature-2.rs:10:11
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-2.rs:9:1
|
-LL | info: &'static PanicInfo,
- | ^^^^^^^^^^^^^^^^^^
+LL | fn panic(info: &'static PanicInfo) -> !
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `for<'a> fn(&'static PanicInfo<'a>) -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
index ab9c9d7f4..9e17e32fb 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
@@ -6,6 +6,6 @@
use core::panic::PanicInfo;
#[panic_handler]
-fn panic() -> ! { //~ ERROR function should have one argument
+fn panic() -> ! { //~ #[panic_handler]` function has wrong type [E0308]
loop {}
}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
index 0a70181fd..cdf55ab65 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
@@ -1,8 +1,12 @@
-error: function should have one argument
+error[E0308]: `#[panic_handler]` function has wrong type
--> $DIR/panic-handler-bad-signature-3.rs:9:1
|
LL | fn panic() -> ! {
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `fn() -> _`
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.rs b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
new file mode 100644
index 000000000..97307d1b2
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
@@ -0,0 +1,13 @@
+// compile-flags:-C panic=abort
+
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo<'static>) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
+{
+ loop {}
+}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
new file mode 100644
index 000000000..20c175875
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
@@ -0,0 +1,12 @@
+error[E0308]: `#[panic_handler]` function has wrong type
+ --> $DIR/panic-handler-bad-signature-5.rs:9:1
+ |
+LL | fn panic(info: &PanicInfo<'static>) -> !
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+ |
+ = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+ found signature `for<'a> fn(&'a PanicInfo<'static>) -> _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.rs b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
new file mode 100644
index 000000000..8ea0275d7
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
@@ -0,0 +1,15 @@
+// compile-flags:-C panic=abort
+// only-x86_64
+
+#![feature(target_feature_11)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+#[target_feature(enable = "avx2")]
+//~^ ERROR `panic_impl` language item function is not allowed to have `#[target_feature]`
+fn panic(info: &PanicInfo) -> ! {
+ unimplemented!();
+}
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
new file mode 100644
index 000000000..4210a4200
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
@@ -0,0 +1,11 @@
+error: `panic_impl` language item function is not allowed to have `#[target_feature]`
+ --> $DIR/panic-handler-with-target-feature.rs:11:1
+ |
+LL | #[target_feature(enable = "avx2")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn panic(info: &PanicInfo) -> ! {
+ | ------------------------------- `panic_impl` language item function is not allowed to have `#[target_feature]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/panics/panic-in-cleanup.rs b/tests/ui/panics/panic-in-cleanup.rs
new file mode 100644
index 000000000..84880f188
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.rs
@@ -0,0 +1,23 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a destructor during cleanup
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+// ignore-msvc SEH doesn't do panic-during-cleanup the same way as everyone else
+
+struct Bomb;
+
+impl Drop for Bomb {
+ fn drop(&mut self) {
+ panic!("BOOM");
+ }
+}
+
+fn main() {
+ let _b = Bomb;
+ panic!();
+}
diff --git a/tests/ui/panics/panic-in-cleanup.run.stderr b/tests/ui/panics/panic-in-cleanup.run.stderr
new file mode 100644
index 000000000..e7def11b0
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.run.stderr
@@ -0,0 +1,9 @@
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5:
+explicit panic
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9:
+BOOM
+stack backtrace:
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a destructor during cleanup
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/panic-in-ffi.rs b/tests/ui/panics/panic-in-ffi.rs
new file mode 100644
index 000000000..d9f1fcee8
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.rs
@@ -0,0 +1,18 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a function that cannot unwind
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+#![feature(c_unwind)]
+
+extern "C" fn panic_in_ffi() {
+ panic!("Test");
+}
+
+fn main() {
+ panic_in_ffi();
+}
diff --git a/tests/ui/panics/panic-in-ffi.run.stderr b/tests/ui/panics/panic-in-ffi.run.stderr
new file mode 100644
index 000000000..a92a66c57
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.run.stderr
@@ -0,0 +1,7 @@
+thread 'main' panicked at $DIR/panic-in-ffi.rs:13:5:
+Test
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a function that cannot unwind
+stack backtrace:
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.rs b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
index 38a80f8b6..751959f55 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
index 2b648a0ca..664ebaa4c 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:57:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.rs b/tests/ui/panics/short-ice-remove-middle-frames.rs
index c872084f0..134e13233 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
index 5b3726840..bc252fde1 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:53:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
diff --git a/tests/ui/parser/default-unmatched.stderr b/tests/ui/parser/default-unmatched.stderr
index 331e003f6..de142411d 100644
--- a/tests/ui/parser/default-unmatched.stderr
+++ b/tests/ui/parser/default-unmatched.stderr
@@ -11,6 +11,8 @@ error: expected item, found reserved keyword `do`
|
LL | default do
| ^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr
index 18c8b0b7c..76a83aa01 100644
--- a/tests/ui/parser/expr-as-stmt.stderr
+++ b/tests/ui/parser/expr-as-stmt.stderr
@@ -217,7 +217,7 @@ LL | { true } || { true }
| ^^^^^^^^^^^ expected `bool`, found closure
|
= note: expected type `bool`
- found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:16]`
+ found closure `{closure@$DIR/expr-as-stmt.rs:51:14: 51:16}`
help: parentheses are required to parse this as an expression
|
LL | ({ true }) || { true }
diff --git a/tests/ui/parser/impl-parsing.stderr b/tests/ui/parser/impl-parsing.stderr
index 755addf14..a57cc075c 100644
--- a/tests/ui/parser/impl-parsing.stderr
+++ b/tests/ui/parser/impl-parsing.stderr
@@ -35,6 +35,8 @@ error: expected item, found keyword `unsafe`
|
LL | default unsafe FAIL
| ^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 6 previous errors
diff --git a/tests/ui/parser/issue-101477-enum.stderr b/tests/ui/parser/issue-101477-enum.stderr
index 1edca391e..94130671f 100644
--- a/tests/ui/parser/issue-101477-enum.stderr
+++ b/tests/ui/parser/issue-101477-enum.stderr
@@ -11,6 +11,8 @@ error: expected item, found `==`
|
LL | B == 2
| ^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs
new file mode 100644
index 000000000..3b6f43043
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs
@@ -0,0 +1 @@
+ 5 //~ ERROR expected item, found `5`
diff --git a/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr
new file mode 100644
index 000000000..0789c4548
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr
@@ -0,0 +1,10 @@
+error: expected item, found `5`
+ --> $DIR/issue-113110-non-item-at-module-root.rs:1:2
+ |
+LL | 5
+ | ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-17904-2.stderr b/tests/ui/parser/issues/issue-17904-2.stderr
index 9c7fdf6cc..7185a5e57 100644
--- a/tests/ui/parser/issues/issue-17904-2.stderr
+++ b/tests/ui/parser/issues/issue-17904-2.stderr
@@ -3,6 +3,8 @@ error: expected item, found keyword `where`
|
LL | struct Bar<T> { x: T } where T: Copy
| ^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-43196.stderr b/tests/ui/parser/issues/issue-43196.stderr
index 4f7ed5cc6..15bbb158c 100644
--- a/tests/ui/parser/issues/issue-43196.stderr
+++ b/tests/ui/parser/issues/issue-43196.stderr
@@ -11,6 +11,8 @@ error: expected item, found `|`
|
LL | |
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-62913.stderr b/tests/ui/parser/issues/issue-62913.stderr
index 6f385e8dc..c33e46837 100644
--- a/tests/ui/parser/issues/issue-62913.stderr
+++ b/tests/ui/parser/issues/issue-62913.stderr
@@ -17,6 +17,8 @@ error: expected item, found `"\u\"`
|
LL | "\u\"
| ^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 3 previous errors
diff --git a/tests/ui/parser/issues/issue-68890.stderr b/tests/ui/parser/issues/issue-68890.stderr
index 2a3bf6b41..0d7b53a67 100644
--- a/tests/ui/parser/issues/issue-68890.stderr
+++ b/tests/ui/parser/issues/issue-68890.stderr
@@ -15,6 +15,8 @@ error: expected item, found `)`
|
LL | enum e{A((?'a a+?+l))}
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 3 previous errors
diff --git a/tests/ui/parser/issues/issue-89388.stderr b/tests/ui/parser/issues/issue-89388.stderr
index cf28bef0f..366d05c2d 100644
--- a/tests/ui/parser/issues/issue-89388.stderr
+++ b/tests/ui/parser/issues/issue-89388.stderr
@@ -2,7 +2,12 @@ error: missing angle brackets in associated item path
--> $DIR/issue-89388.rs:5:24
|
LL | let _ = option.map([_]::to_vec);
- | ^^^^^^^^^^^ help: try: `<[_]>::to_vec`
+ | ^^^
+ |
+help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
+ |
+LL | let _ = option.map(<[_]>::to_vec);
+ | + +
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
new file mode 100644
index 000000000..cfbbd014d
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
@@ -0,0 +1,9 @@
+fn foo() {
+ match 0 {
+ _ => {}
+ }
+ if foo
+ }
+} //~ ERROR unexpected closing delimiter: `}`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
new file mode 100644
index 000000000..d568a4c58
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
@@ -0,0 +1,16 @@
+error: unexpected closing delimiter: `}`
+ --> $DIR/issue-98601-delimiter-error-1.rs:7:1
+ |
+LL | fn foo() {
+ | - this delimiter might not be properly closed...
+LL | match 0 {
+LL | _ => {}
+ | -- block is empty, you might have not meant to close it
+...
+LL | }
+ | - ...as it matches this but it has different indentation
+LL | }
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
new file mode 100644
index 000000000..254e816cf
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
@@ -0,0 +1,5 @@
+fn main() {
+ todo!();
+}
+
+fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
new file mode 100644
index 000000000..81dd39bb7
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
@@ -0,0 +1,14 @@
+error: unexpected closing delimiter: `)`
+ --> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
+ |
+LL | fn main() {
+ | - this opening brace...
+LL | todo!();
+LL | }
+ | - ...matches this closing brace
+LL |
+LL | fn other(_: i32)) {}
+ | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/keyword-union-as-identifier.rs b/tests/ui/parser/keyword-union-as-identifier.rs
new file mode 100644
index 000000000..7062557d7
--- /dev/null
+++ b/tests/ui/parser/keyword-union-as-identifier.rs
@@ -0,0 +1,72 @@
+// check-pass
+
+#![allow(non_camel_case_types)]
+#![allow(non_upper_case_globals)]
+
+mod union {
+ type union = i32;
+
+ pub struct Bar {
+ pub union: union,
+ }
+
+ pub fn union() -> Bar {
+ Bar {
+ union: 5
+ }
+ }
+}
+
+mod struct_union {
+ pub struct union {
+ pub union: u32
+ }
+ static union: union = union { union: 0 };
+
+ impl union {
+ pub fn union<'union>() -> &'union union {
+ &union
+ }
+ }
+ impl union {}
+ trait Foo {}
+ impl Foo for union {}
+ trait Bar {
+ fn bar() {}
+ }
+ impl Bar for union {}
+}
+
+mod union_union {
+ pub union union {
+ pub union: u32
+ }
+ const union: union = union { union: 0 };
+ impl union {
+ pub fn union() -> union {
+ union
+ }
+ }
+}
+
+mod trait_union {
+ pub trait union {
+ fn union() {}
+ }
+ impl union for () {}
+}
+
+macro_rules! ty {
+ ($ty:ty { $($field:ident:$field_ty:ty)* }) => {};
+}
+
+fn main() {
+ let union = union::union();
+ let _ = union.union;
+ let _ = struct_union::union::union().union;
+ let union = union_union::union::union();
+ let _ = unsafe { union.union };
+ <() as trait_union::union>::union();
+ ty!(union {});
+ ty!(union { union: union });
+}
diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs
index 155872f7a..533511ecf 100644
--- a/tests/ui/parser/macro/macro-expand-to-field.rs
+++ b/tests/ui/parser/macro/macro-expand-to-field.rs
@@ -1,5 +1,7 @@
// compile-flags: --crate-type=lib
+// https://github.com/rust-lang/rust/issues/113766
+
macro_rules! field {
($name:ident:$type:ty) => {
$name:$type
@@ -13,15 +15,14 @@ macro_rules! variant {
}
struct Struct {
+ //~^ NOTE while parsing this struct
field!(bar:u128),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
a: u32,
b: u32,
- field!(recovers:()), //~ NOTE macros cannot expand to struct fields
- //~^ ERROR unexpected token: `!`
- //~^^ NOTE unexpected token after this
+ field!(recovers:()),
}
enum EnumVariant {
@@ -35,7 +36,7 @@ enum EnumVariant {
//~^ NOTE macros cannot expand to enum variants
//~| ERROR unexpected token: `!`
//~| NOTE unexpected token after this
- Data {
+ Data { //~ NOTE while parsing this struct
field!(x:u32),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
@@ -44,27 +45,35 @@ enum EnumVariant {
}
enum EnumVariantField {
- Named {
+ Named { //~ NOTE while parsing this struct
field!(oopsies:()),
//~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
//~| unexpected token after this
field!(oopsies2:()),
- //~^ NOTE macros cannot expand to struct fields
- //~| ERROR unexpected token: `!`
- //~| unexpected token after this
},
}
union Union {
+ //~^ NOTE while parsing this union
A: u32,
field!(oopsies:()),
//~^ NOTE macros cannot expand to union fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
B: u32,
field!(recovers:()),
- //~^ NOTE macros cannot expand to union fields
+}
+
+// https://github.com/rust-lang/rust/issues/114636
+
+#[derive(Debug)]
+pub struct Lazy {
+ //~^ NOTE while parsing this struct
+ unreachable!()
+ //~^ NOTE macros cannot expand to struct fields
//~| ERROR unexpected token: `!`
- //~| unexpected token after this
+ //~| NOTE unexpected token after this
}
+
+fn main() {}
diff --git a/tests/ui/parser/macro/macro-expand-to-field.stderr b/tests/ui/parser/macro/macro-expand-to-field.stderr
index adcd032f5..0bb718000 100644
--- a/tests/ui/parser/macro/macro-expand-to-field.stderr
+++ b/tests/ui/parser/macro/macro-expand-to-field.stderr
@@ -1,21 +1,16 @@
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:16:10
+ --> $DIR/macro-expand-to-field.rs:19:10
|
+LL | struct Struct {
+ | ------ while parsing this struct
+LL |
LL | field!(bar:u128),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:22:10
- |
-LL | field!(recovers:()),
- | ^ unexpected token after this
- |
- = note: macros cannot expand to struct fields
-
-error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:28:12
+ --> $DIR/macro-expand-to-field.rs:29:12
|
LL | variant!(whoops),
| ^ unexpected token after this
@@ -23,7 +18,7 @@ LL | variant!(whoops),
= note: macros cannot expand to enum variants
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:34:12
+ --> $DIR/macro-expand-to-field.rs:35:12
|
LL | variant!(recovers),
| ^ unexpected token after this
@@ -31,44 +26,46 @@ LL | variant!(recovers),
= note: macros cannot expand to enum variants
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:39:14
+ --> $DIR/macro-expand-to-field.rs:40:14
|
+LL | Data {
+ | ---- while parsing this struct
LL | field!(x:u32),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:48:14
+ --> $DIR/macro-expand-to-field.rs:49:14
|
+LL | Named {
+ | ----- while parsing this struct
LL | field!(oopsies:()),
| ^ unexpected token after this
|
= note: macros cannot expand to struct fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:52:14
- |
-LL | field!(oopsies2:()),
- | ^ unexpected token after this
- |
- = note: macros cannot expand to struct fields
-
-error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:61:10
+ --> $DIR/macro-expand-to-field.rs:60:10
|
+LL | union Union {
+ | ----- while parsing this union
+...
LL | field!(oopsies:()),
| ^ unexpected token after this
|
= note: macros cannot expand to union fields
error: unexpected token: `!`
- --> $DIR/macro-expand-to-field.rs:66:10
+ --> $DIR/macro-expand-to-field.rs:73:16
|
-LL | field!(recovers:()),
- | ^ unexpected token after this
+LL | pub struct Lazy {
+ | ---- while parsing this struct
+LL |
+LL | unreachable!()
+ | ^ unexpected token after this
|
- = note: macros cannot expand to union fields
+ = note: macros cannot expand to struct fields
-error: aborting due to 9 previous errors
+error: aborting due to 7 previous errors
diff --git a/tests/ui/parser/shebang/shebang-doc-comment.stderr b/tests/ui/parser/shebang/shebang-doc-comment.stderr
index 2227d45ec..a36b2a2f7 100644
--- a/tests/ui/parser/shebang/shebang-doc-comment.stderr
+++ b/tests/ui/parser/shebang/shebang-doc-comment.stderr
@@ -3,6 +3,8 @@ error: expected item, found `[`
|
LL | [allow(unused_variables)]
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/parser/struct-literal-in-if.rs b/tests/ui/parser/struct-literal-in-if.rs
index 2ce2c8f18..c4a253c3d 100644
--- a/tests/ui/parser/struct-literal-in-if.rs
+++ b/tests/ui/parser/struct-literal-in-if.rs
@@ -14,4 +14,9 @@ fn main() {
}.hi() {
println!("yo");
}
+ if let true = Foo { //~ ERROR struct literals are not allowed here
+ x: 3
+ }.hi() {
+ println!("yo");
+ }
}
diff --git a/tests/ui/parser/struct-literal-in-if.stderr b/tests/ui/parser/struct-literal-in-if.stderr
index b5a9864bb..8b72469fc 100644
--- a/tests/ui/parser/struct-literal-in-if.stderr
+++ b/tests/ui/parser/struct-literal-in-if.stderr
@@ -14,5 +14,21 @@ LL | x: 3
LL ~ }).hi() {
|
-error: aborting due to previous error
+error: struct literals are not allowed here
+ --> $DIR/struct-literal-in-if.rs:17:19
+ |
+LL | if let true = Foo {
+ | ___________________^
+LL | | x: 3
+LL | | }.hi() {
+ | |_____^
+ |
+help: surround the struct literal with parentheses
+ |
+LL ~ if let true = (Foo {
+LL | x: 3
+LL ~ }).hi() {
+ |
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/struct-literal-in-match-guard.rs b/tests/ui/parser/struct-literal-in-match-guard.rs
index bf0551b5c..bbee60e28 100644
--- a/tests/ui/parser/struct-literal-in-match-guard.rs
+++ b/tests/ui/parser/struct-literal-in-match-guard.rs
@@ -3,6 +3,8 @@
// Unlike `if` condition, `match` guards accept struct literals.
// This is detected in <https://github.com/rust-lang/rust/pull/74566#issuecomment-663613705>.
+#![feature(if_let_guard)]
+
#[derive(PartialEq)]
struct Foo {
x: isize,
@@ -11,6 +13,7 @@ struct Foo {
fn foo(f: Foo) {
match () {
() if f == Foo { x: 42 } => {}
+ () if let Foo { x: 0.. } = Foo { x: 42 } => {}
_ => {}
}
}
diff --git a/tests/ui/parser/struct-literal-in-while.rs b/tests/ui/parser/struct-literal-in-while.rs
index 5000ce85b..86931f788 100644
--- a/tests/ui/parser/struct-literal-in-while.rs
+++ b/tests/ui/parser/struct-literal-in-while.rs
@@ -14,4 +14,9 @@ fn main() {
}.hi() {
println!("yo");
}
+ while let true = Foo { //~ ERROR struct literals are not allowed here
+ x: 3
+ }.hi() {
+ println!("yo");
+ }
}
diff --git a/tests/ui/parser/struct-literal-in-while.stderr b/tests/ui/parser/struct-literal-in-while.stderr
index 17e9277e0..13d003608 100644
--- a/tests/ui/parser/struct-literal-in-while.stderr
+++ b/tests/ui/parser/struct-literal-in-while.stderr
@@ -14,5 +14,21 @@ LL | x: 3
LL ~ }).hi() {
|
-error: aborting due to previous error
+error: struct literals are not allowed here
+ --> $DIR/struct-literal-in-while.rs:17:22
+ |
+LL | while let true = Foo {
+ | ______________________^
+LL | | x: 3
+LL | | }.hi() {
+ | |_____^
+ |
+help: surround the struct literal with parentheses
+ |
+LL ~ while let true = (Foo {
+LL | x: 3
+LL ~ }).hi() {
+ |
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
index 0852c7cb4..c715486e2 100644
--- a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
+++ b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr
@@ -24,7 +24,7 @@ LL | | }.hi() {
| |__________^ expected `bool`, found closure
|
= note: expected type `bool`
- found closure `[closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13]`
+ found closure `{closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13}`
help: use parentheses to call this closure
|
LL ~ while (|| Foo {
diff --git a/tests/ui/parser/virtual-structs.stderr b/tests/ui/parser/virtual-structs.stderr
index a5211d83f..268fc1057 100644
--- a/tests/ui/parser/virtual-structs.stderr
+++ b/tests/ui/parser/virtual-structs.stderr
@@ -3,6 +3,8 @@ error: expected item, found reserved keyword `virtual`
|
LL | virtual struct SuperStruct {
| ^^^^^^^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to previous error
diff --git a/tests/ui/pattern/issue-114896.rs b/tests/ui/pattern/issue-114896.rs
new file mode 100644
index 000000000..cde37f658
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.rs
@@ -0,0 +1,7 @@
+fn main() {
+ fn x(a: &char) {
+ let &b = a;
+ b.make_ascii_uppercase();
+//~^ cannot borrow `b` as mutable, as it is not declared as mutable
+ }
+}
diff --git a/tests/ui/pattern/issue-114896.stderr b/tests/ui/pattern/issue-114896.stderr
new file mode 100644
index 000000000..ffeb7bc13
--- /dev/null
+++ b/tests/ui/pattern/issue-114896.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
+ --> $DIR/issue-114896.rs:4:9
+ |
+LL | let &b = a;
+ | -- help: consider changing this to be mutable: `&(mut b)`
+LL | b.make_ascii_uppercase();
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr
index dea7c4695..43d92775e 100644
--- a/tests/ui/pattern/non-structural-match-types.stderr
+++ b/tests/ui/pattern/non-structural-match-types.stderr
@@ -1,10 +1,10 @@
-error: `[closure@$DIR/non-structural-match-types.rs:9:17: 9:19]` cannot be used in patterns
+error: `{closure@$DIR/non-structural-match-types.rs:9:17: 9:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:9:9
|
LL | const { || {} } => {},
| ^^^^^^^^^^^^^^^
-error: `[async block@$DIR/non-structural-match-types.rs:12:17: 12:25]` cannot be used in patterns
+error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:12:9
|
LL | const { async {} } => {},
diff --git a/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs b/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs
new file mode 100644
index 000000000..6f459b826
--- /dev/null
+++ b/tests/ui/pattern/usefulness/auxiliary/non-exhaustive.rs
@@ -0,0 +1,2 @@
+#[non_exhaustive]
+pub enum NonExhaustiveEnum { A, B }
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
index 0e0f0c3e1..df330c60b 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
@@ -77,6 +77,8 @@ LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
= note: the matched value is of type `(usize, bool)`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL | match $s { $($t)+ => {}, (_, _) => todo!() }
@@ -131,6 +133,8 @@ LL | m!((0isize, true), (isize::MIN..5, true)
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
= note: the matched value is of type `(isize, bool)`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL | match $s { $($t)+ => {}, (_, _) => todo!() }
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
new file mode 100644
index 000000000..0ee7856c6
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.rs
@@ -0,0 +1,12 @@
+fn main() {
+ let a = "";
+ let b = "";
+ match (a, b) {
+ //~^ ERROR non-exhaustive patterns: `(&_, _)` not covered [E0004]
+ //~| NOTE pattern `(&_, _)` not covered
+ //~| NOTE the matched value is of type `(&str, &str)`
+ //~| NOTE `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
+ ("a", "b") => {}
+ ("c", "d") => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
new file mode 100644
index 000000000..771fc320a
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-105479-str-non-exhaustiveness.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: `(&_, _)` not covered
+ --> $DIR/issue-105479-str-non-exhaustiveness.rs:4:11
+ |
+LL | match (a, b) {
+ | ^^^^^^ pattern `(&_, _)` not covered
+ |
+ = note: the matched value is of type `(&str, &str)`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ ("c", "d") => {},
+LL + (&_, _) => todo!()
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr
index ff755d681..da8bbdffb 100644
--- a/tests/ui/pattern/usefulness/issue-30240.stderr
+++ b/tests/ui/pattern/usefulness/issue-30240.stderr
@@ -5,6 +5,7 @@ LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
= note: the matched value is of type `&str`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ "hello" => {},
@@ -18,6 +19,7 @@ LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
= note: the matched value is of type `&str`
+ = note: `&str` cannot be matched exhaustively, so a wildcard `_` is necessary
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ "hello" => {},
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
new file mode 100644
index 000000000..8f58227ee
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
@@ -0,0 +1,67 @@
+struct A<T> {
+ a: T,
+}
+
+struct B<T, U>(T, U);
+
+fn main() {
+ match 0 {
+ //~^ ERROR non-exhaustive patterns: `_` not covered [E0004]
+ 0 => (),
+ 1..=usize::MAX => (),
+ }
+
+ match (0usize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ (0, 0) => (),
+ (1..=usize::MAX, 1..=usize::MAX) => (),
+ }
+
+ match (0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ (isize::MIN..=isize::MAX, 0) => (),
+ (isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+ }
+
+ // Should not report note about usize not having fixed max value
+ match Some(1usize) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ None => {}
+ }
+
+ match Some(4) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ Some(0) => (),
+ Some(1..=usize::MAX) => (),
+ None => (),
+ }
+
+ match Some(Some(Some(0))) {
+ //~^ ERROR non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ Some(Some(Some(0))) => (),
+ Some(Some(Some(1..=usize::MAX))) => (),
+ Some(Some(None)) => (),
+ Some(None) => (),
+ None => (),
+ }
+
+ match (A { a: 0usize }) {
+ //~^ ERROR non-exhaustive patterns: `A { .. }` not covered [E0004]
+ A { a: 0 } => (),
+ A { a: 1..=usize::MAX } => (),
+ }
+
+ match B(0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ B(isize::MIN..=isize::MAX, 0) => (),
+ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+ }
+
+ // Should report only the note about usize not having fixed max value and not report
+ // report the note about isize
+ match B(0isize, 0usize) {
+ //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ B(_, 0) => (),
+ B(_, 1..=usize::MAX) => (),
+ }
+}
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
new file mode 100644
index 000000000..ea1d99e20
--- /dev/null
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
@@ -0,0 +1,170 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:8:11
+ |
+LL | match 0 {
+ | ^ pattern `_` not covered
+ |
+ = note: the matched value is of type `usize`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ 1..=usize::MAX => (),
+LL ~ _ => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:14:11
+ |
+LL | match (0usize, 0usize) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ |
+ = note: the matched value is of type `(usize, usize)`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ (1..=usize::MAX, 1..=usize::MAX) => (),
+LL ~ (_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:20:11
+ |
+LL | match (0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ |
+ = note: the matched value is of type `(isize, usize)`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ (isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+LL ~ (_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:27:11
+ |
+LL | match Some(1usize) {
+ | ^^^^^^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<usize>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<usize>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None => {},
+LL + Some(_) => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:32:11
+ |
+LL | match Some(4) {
+ | ^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<usize>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None => (),
+LL ~ Some(_) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:39:11
+ |
+LL | match Some(Some(Some(0))) {
+ | ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(_)))` not covered
+ |
+note: `Option<Option<Option<usize>>>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ |
+ = note: not covered
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<Option<Option<usize>>>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None => (),
+LL ~ Some(Some(Some(_))) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `A { .. }` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:48:11
+ |
+LL | match (A { a: 0usize }) {
+ | ^^^^^^^^^^^^^^^^^ pattern `A { .. }` not covered
+ |
+note: `A<usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:1:8
+ |
+LL | struct A<T> {
+ | ^
+ = note: the matched value is of type `A<usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ A { a: 1..=usize::MAX } => (),
+LL ~ A { .. } => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:54:11
+ |
+LL | match B(0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ |
+note: `B<isize, usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
+ |
+LL | struct B<T, U>(T, U);
+ | ^
+ = note: the matched value is of type `B<isize, usize>`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
+LL ~ B(_, _) => todo!(),
+ |
+
+error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:62:11
+ |
+LL | match B(0isize, 0usize) {
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ |
+note: `B<isize, usize>` defined here
+ --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
+ |
+LL | struct B<T, U>(T, U);
+ | ^
+ = note: the matched value is of type `B<isize, usize>`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ B(_, 1..=usize::MAX) => (),
+LL ~ B(_, _) => todo!(),
+ |
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
new file mode 100644
index 000000000..3a8a74d1f
--- /dev/null
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
@@ -0,0 +1,18 @@
+// aux-build:non-exhaustive.rs
+
+extern crate non_exhaustive;
+
+use non_exhaustive::NonExhaustiveEnum;
+
+fn main() {
+ match Some(NonExhaustiveEnum::A) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered [E0004]
+ //~| NOTE pattern `Some(_)` not covered
+ //~| NOTE `Option<NonExhaustiveEnum>` defined here
+ //~| NOTE the matched value is of type `Option<NonExhaustiveEnum>`
+ //~| NOTE `NonExhaustiveEnum` is marked as non-exhaustive
+ Some(NonExhaustiveEnum::A) => {}
+ Some(NonExhaustiveEnum::B) => {}
+ None => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
new file mode 100644
index 000000000..9fbd871db
--- /dev/null
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.stderr
@@ -0,0 +1,22 @@
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/nested-non-exhaustive-enums.rs:8:11
+ |
+LL | match Some(NonExhaustiveEnum::A) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Some(_)` not covered
+ |
+note: `Option<NonExhaustiveEnum>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<NonExhaustiveEnum>`
+ = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None => {},
+LL + Some(_) => todo!()
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
index b8af566de..d798ec722 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
@@ -10,6 +10,8 @@ note: `Foo` defined here
LL | struct Foo {
| ^^^
= note: the matched value is of type `Foo`
+ = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
index e2a65ff85..50c7fc889 100644
--- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
@@ -10,6 +10,8 @@ note: `Foo` defined here
LL | struct Foo(isize, isize);
| ^^^
= note: the matched value is of type `Foo`
+ = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Foo(2, b) => println!("{}", b),
diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout
index 873def903..e1be98f85 100644
--- a/tests/ui/print_type_sizes/async.stdout
+++ b/tests/ui/print_type_sizes/async.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[async fn body@$DIR/async.rs:10:36: 13:2]`: 16386 bytes, alignment: 1 bytes
+print-type-size type: `{async fn body@$DIR/async.rs:10:36: 13:2}`: 16386 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.arg`: 8192 bytes
@@ -16,14 +16,9 @@ print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment
print-type-size variant `MaybeUninit`: 8192 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 8192 bytes
-print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
-print-type-size discriminant: 1 bytes
-print-type-size variant `Unresumed`: 0 bytes
-print-type-size variant `Returned`: 0 bytes
-print-type-size variant `Panicked`: 0 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async.rs:8:17: 8:19}>`: 1 bytes, alignment: 1 bytes
print-type-size field `.value`: 1 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async.rs:8:17: 8:19}>`: 1 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 1 bytes
print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 1 bytes
@@ -32,3 +27,8 @@ print-type-size discriminant: 1 bytes
print-type-size variant `Ready`: 0 bytes
print-type-size field `.0`: 0 bytes
print-type-size variant `Pending`: 0 bytes
+print-type-size type: `{async fn body@$DIR/async.rs:8:17: 8:19}`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout
index 2dcadde9e..f8c52a595 100644
--- a/tests/ui/print_type_sizes/generator.stdout
+++ b/tests/ui/print_type_sizes/generator.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes
+print-type-size type: `{generator@$DIR/generator.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.array`: 8192 bytes
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout
index fe0022cf5..f7bdee111 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.stdout
+++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[generator@$DIR/generator_discr_placement.rs:12:13: 12:15]`: 8 bytes, alignment: 4 bytes
+print-type-size type: `{generator@$DIR/generator_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 7 bytes
diff --git a/tests/ui/print_type_sizes/zero-sized-fields.stdout b/tests/ui/print_type_sizes/zero-sized-fields.stdout
index 72f59c4bb..e4d44241e 100644
--- a/tests/ui/print_type_sizes/zero-sized-fields.stdout
+++ b/tests/ui/print_type_sizes/zero-sized-fields.stdout
@@ -1,16 +1,16 @@
print-type-size type: `S5<(), Empty>`: 16 bytes, alignment: 4 bytes
+print-type-size field `.w`: 4 bytes
+print-type-size field `.x`: 4 bytes
+print-type-size field `.y`: 4 bytes
+print-type-size field `.z`: 4 bytes
print-type-size field `.tagw`: 0 bytes
print-type-size field `.unit`: 0 bytes
print-type-size field `.void`: 0 bytes
print-type-size field `.empty`: 0 bytes
print-type-size field `.tagz`: 0 bytes
-print-type-size field `.w`: 4 bytes
-print-type-size field `.x`: 4 bytes
-print-type-size field `.y`: 4 bytes
-print-type-size field `.z`: 4 bytes
print-type-size type: `S1`: 8 bytes, alignment: 4 bytes
-print-type-size field `.tag`: 0 bytes
print-type-size field `.x`: 4 bytes
print-type-size field `.y`: 4 bytes
+print-type-size field `.tag`: 0 bytes
print-type-size type: `Empty`: 0 bytes, alignment: 1 bytes
print-type-size type: `Void`: 0 bytes, alignment: 1 bytes
diff --git a/tests/ui/privacy/associated-item-privacy-inherent.rs b/tests/ui/privacy/associated-item-privacy-inherent.rs
index 7b7c734a9..81703ae10 100644
--- a/tests/ui/privacy/associated-item-privacy-inherent.rs
+++ b/tests/ui/privacy/associated-item-privacy-inherent.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces)]
mod priv_nominal {
pub struct Pub;
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index c686a2177..db77a6a72 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
mod priv_trait {
trait PrivTr {
diff --git a/tests/ui/privacy/associated-item-privacy-type-binding.rs b/tests/ui/privacy/associated-item-privacy-type-binding.rs
index 9826b83a3..95a4fbf63 100644
--- a/tests/ui/privacy/associated-item-privacy-type-binding.rs
+++ b/tests/ui/privacy/associated-item-privacy-type-binding.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro, associated_type_defaults)]
-#![allow(unused, private_in_public)]
+#![allow(private_interfaces, private_bounds)]
mod priv_trait {
trait PrivTr {
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.rs b/tests/ui/privacy/effective_visibilities_full_priv.rs
index a26ae3bd1..b96eddcab 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.rs
+++ b/tests/ui/privacy/effective_visibilities_full_priv.rs
@@ -1,5 +1,5 @@
#![feature(rustc_attrs)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
struct SemiPriv;
diff --git a/tests/ui/privacy/issue-30079.rs b/tests/ui/privacy/issue-30079.rs
index a02a932d0..ddba629f5 100644
--- a/tests/ui/privacy/issue-30079.rs
+++ b/tests/ui/privacy/issue-30079.rs
@@ -3,8 +3,7 @@ struct SemiPriv;
mod m1 {
struct Priv;
impl ::SemiPriv {
- pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
- //~^ WARNING hard error
+ pub fn f(_: Priv) {} //~ WARN type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
}
impl Priv {
diff --git a/tests/ui/privacy/issue-30079.stderr b/tests/ui/privacy/issue-30079.stderr
index 9179ff339..f1facba7c 100644
--- a/tests/ui/privacy/issue-30079.stderr
+++ b/tests/ui/privacy/issue-30079.stderr
@@ -1,15 +1,18 @@
-warning: private type `m1::Priv` in public interface (error E0446)
+warning: type `m1::Priv` is more private than the item `m1::<impl SemiPriv>::f`
--> $DIR/issue-30079.rs:6:9
|
LL | pub fn f(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^ associated function `m1::<impl SemiPriv>::f` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
+note: but type `m1::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/issue-30079.rs:4:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
error[E0446]: private type `m2::Priv` in public interface
- --> $DIR/issue-30079.rs:18:9
+ --> $DIR/issue-30079.rs:17:9
|
LL | struct Priv;
| ----------- `m2::Priv` declared as private
@@ -18,7 +21,7 @@ LL | type Target = Priv;
| ^^^^^^^^^^^ can't leak private type
error[E0446]: private type `m3::Priv` in public interface
- --> $DIR/issue-30079.rs:35:9
+ --> $DIR/issue-30079.rs:34:9
|
LL | struct Priv;
| ----------- `m3::Priv` declared as private
diff --git a/tests/ui/privacy/private-bounds-locally-allowed.rs b/tests/ui/privacy/private-bounds-locally-allowed.rs
new file mode 100644
index 000000000..96a007a64
--- /dev/null
+++ b/tests/ui/privacy/private-bounds-locally-allowed.rs
@@ -0,0 +1,7 @@
+// check-pass
+// compile-flags: --crate-type=lib
+
+#[allow(private_bounds)]
+pub trait Foo: FooImpl {}
+
+trait FooImpl {}
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.rs b/tests/ui/privacy/private-in-public-assoc-ty.rs
index d4d379bdb..5f7c4bcf2 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.rs
+++ b/tests/ui/privacy/private-in-public-assoc-ty.rs
@@ -22,14 +22,11 @@ mod m {
// applies only to the aliased types, not bounds.
pub trait PubTr {
type Alias1: PrivTr;
- //~^ WARN private trait `PrivTr` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN trait `PrivTr` is more private than the item `PubTr::Alias1`
type Alias2: PubTrAux1<Priv> = u8;
- //~^ WARN private type `Priv` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN type `Priv` is more private than the item `PubTr::Alias2`
type Alias3: PubTrAux2<A = Priv> = u8;
- //~^ WARN private type `Priv` in public interface
- //~| WARN this was previously accepted
+ //~^ WARN type `Priv` is more private than the item `PubTr::Alias3`
type Alias4 = Priv;
//~^ ERROR private type `Priv` in public interface
diff --git a/tests/ui/privacy/private-in-public-assoc-ty.stderr b/tests/ui/privacy/private-in-public-assoc-ty.stderr
index a59027d81..0931e6d99 100644
--- a/tests/ui/privacy/private-in-public-assoc-ty.stderr
+++ b/tests/ui/privacy/private-in-public-assoc-ty.stderr
@@ -7,36 +7,45 @@ LL | struct Priv;
LL | type A = Priv;
| ^^^^^^ can't leak private type
-warning: private trait `PrivTr` in public interface (error E0445)
+warning: trait `PrivTr` is more private than the item `PubTr::Alias1`
--> $DIR/private-in-public-assoc-ty.rs:24:9
|
LL | type Alias1: PrivTr;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias1` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
+note: but trait `PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:9:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-warning: private type `Priv` in public interface (error E0446)
- --> $DIR/private-in-public-assoc-ty.rs:27:9
+warning: type `Priv` is more private than the item `PubTr::Alias2`
+ --> $DIR/private-in-public-assoc-ty.rs:26:9
|
LL | type Alias2: PubTrAux1<Priv> = u8;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias2` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:8:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-warning: private type `Priv` in public interface (error E0446)
- --> $DIR/private-in-public-assoc-ty.rs:30:9
+warning: type `Priv` is more private than the item `PubTr::Alias3`
+ --> $DIR/private-in-public-assoc-ty.rs:28:9
|
LL | type Alias3: PubTrAux2<A = Priv> = u8;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `PubTr::Alias3` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-assoc-ty.rs:8:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:34:9
+ --> $DIR/private-in-public-assoc-ty.rs:31:9
|
LL | struct Priv;
| ----------- `Priv` declared as private
@@ -45,7 +54,7 @@ LL | type Alias4 = Priv;
| ^^^^^^^^^^^ can't leak private type
error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:41:9
+ --> $DIR/private-in-public-assoc-ty.rs:38:9
|
LL | struct Priv;
| ----------- `Priv` declared as private
@@ -53,8 +62,8 @@ LL | struct Priv;
LL | type Alias1 = Priv;
| ^^^^^^^^^^^ can't leak private type
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/private-in-public-assoc-ty.rs:44:9
+error[E0446]: private trait `PrivTr` in public interface
+ --> $DIR/private-in-public-assoc-ty.rs:41:9
|
LL | trait PrivTr {}
| ------------ `PrivTr` declared as private
@@ -64,5 +73,4 @@ LL | type Exist = impl PrivTr;
error: aborting due to 4 previous errors; 3 warnings emitted
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
+For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-lint.rs b/tests/ui/privacy/private-in-public-lint.rs
deleted file mode 100644
index 8b6e43601..000000000
--- a/tests/ui/privacy/private-in-public-lint.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-mod m1 {
- pub struct Pub;
- struct Priv;
-
- impl Pub {
- pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface
- }
-}
-
-mod m2 {
- pub struct Pub;
- struct Priv;
-
- impl Pub {
- pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface
- }
-}
-
-fn main() {}
diff --git a/tests/ui/privacy/private-in-public-lint.stderr b/tests/ui/privacy/private-in-public-lint.stderr
deleted file mode 100644
index 1e98e3bed..000000000
--- a/tests/ui/privacy/private-in-public-lint.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `m1::Priv` in public interface
- --> $DIR/private-in-public-lint.rs:6:9
- |
-LL | struct Priv;
- | ----------- `m1::Priv` declared as private
-...
-LL | pub fn f() -> Priv {Priv}
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `m2::Priv` in public interface
- --> $DIR/private-in-public-lint.rs:15:9
- |
-LL | struct Priv;
- | ----------- `m2::Priv` declared as private
-...
-LL | pub fn f() -> Priv {Priv}
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/private-in-public-non-principal-2.rs b/tests/ui/privacy/private-in-public-non-principal-2.rs
index db451d334..d7223c647 100644
--- a/tests/ui/privacy/private-in-public-non-principal-2.rs
+++ b/tests/ui/privacy/private-in-public-non-principal-2.rs
@@ -1,7 +1,7 @@
#![feature(auto_traits)]
#![feature(negative_impls)]
-#[allow(private_in_public)]
+#[allow(private_interfaces)]
mod m {
pub trait PubPrincipal {}
auto trait PrivNonPrincipal {}
diff --git a/tests/ui/privacy/private-in-public-non-principal.rs b/tests/ui/privacy/private-in-public-non-principal.rs
index a2284c930..e348a1816 100644
--- a/tests/ui/privacy/private-in-public-non-principal.rs
+++ b/tests/ui/privacy/private-in-public-non-principal.rs
@@ -1,19 +1,11 @@
#![feature(auto_traits)]
#![feature(negative_impls)]
-#![feature(type_privacy_lints)]
-#![deny(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
pub trait PubPrincipal {}
auto trait PrivNonPrincipal {}
pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
-//~^ WARN private trait `PrivNonPrincipal` in public interface
-//~| WARN this was previously accepted
-//~| ERROR trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+//~^ WARN trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
#[deny(missing_docs)]
fn container() {
diff --git a/tests/ui/privacy/private-in-public-non-principal.stderr b/tests/ui/privacy/private-in-public-non-principal.stderr
index 1387f59cb..63512f462 100644
--- a/tests/ui/privacy/private-in-public-non-principal.stderr
+++ b/tests/ui/privacy/private-in-public-non-principal.stderr
@@ -1,41 +1,27 @@
-warning: private trait `PrivNonPrincipal` in public interface (error E0445)
- --> $DIR/private-in-public-non-principal.rs:13:1
- |
-LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
-
-error: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
- --> $DIR/private-in-public-non-principal.rs:13:1
+warning: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
+ --> $DIR/private-in-public-non-principal.rs:7:1
|
LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `leak_dyn_nonprincipal` is reachable at visibility `pub`
|
note: but trait `PrivNonPrincipal` is only usable at visibility `pub(crate)`
- --> $DIR/private-in-public-non-principal.rs:11:1
+ --> $DIR/private-in-public-non-principal.rs:5:1
|
LL | auto trait PrivNonPrincipal {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/private-in-public-non-principal.rs:4:9
- |
-LL | #![deny(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
error: missing documentation for an associated function
- --> $DIR/private-in-public-non-principal.rs:21:9
+ --> $DIR/private-in-public-non-principal.rs:13:9
|
LL | pub fn check_doc_lint() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/private-in-public-non-principal.rs:18:8
+ --> $DIR/private-in-public-non-principal.rs:10:8
|
LL | #[deny(missing_docs)]
| ^^^^^^^^^^^^
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
index fe6ed4673..3fb543e96 100644
--- a/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
+++ b/tests/ui/privacy/private-in-public-type-alias-impl-trait.rs
@@ -1,7 +1,7 @@
// build-pass (FIXME(62277): could be check-pass?)
#![feature(impl_trait_in_assoc_type)]
#![feature(type_alias_impl_trait)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
pub type Pub = impl Default;
diff --git a/tests/ui/privacy/private-in-public-warn.rs b/tests/ui/privacy/private-in-public-warn.rs
index 0fa1de975..99d318e36 100644
--- a/tests/ui/privacy/private-in-public-warn.rs
+++ b/tests/ui/privacy/private-in-public-warn.rs
@@ -2,7 +2,7 @@
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_type_defaults)]
-#![deny(private_in_public)]
+#![deny(private_interfaces, private_bounds)]
#![allow(improper_ctypes)]
mod types {
@@ -12,30 +12,21 @@ mod types {
type Alias;
}
- pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ pub type Alias = Priv; //~ ERROR type `types::Priv` is more private than the item `types::Alias`
pub enum E {
- V1(Priv), //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ V1(Priv), //~ ERROR type `types::Priv` is more private than the item `E::V1::0`
+ V2 { field: Priv }, //~ ERROR type `types::Priv` is more private than the item `E::V2::field`
}
pub trait Tr {
- const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ const C: Priv = Priv; //~ ERROR type `types::Priv` is more private than the item `Tr::C`
type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
- fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ fn f1(arg: Priv) {} //~ ERROR type `types::Priv` is more private than the item `Tr::f1`
+ fn f2() -> Priv { panic!() } //~ ERROR type `types::Priv` is more private than the item `Tr::f2`
}
extern "C" {
- pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
- pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface
- //~^ WARNING hard error
+ pub static ES: Priv; //~ ERROR type `types::Priv` is more private than the item `types::ES`
+ pub fn ef1(arg: Priv); //~ ERROR type `types::Priv` is more private than the item `types::ef1`
+ pub fn ef2() -> Priv; //~ ERROR type `types::Priv` is more private than the item `types::ef2`
}
impl PubTr for Pub {
type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
@@ -47,22 +38,16 @@ mod traits {
pub struct Pub<T>(T);
pub trait PubTr {}
- pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface
- //~| WARNING hard error
- //~| WARNING bounds on generic parameters are not enforced in type aliases
- pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
- pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ pub type Alias<T: PrivTr> = T; //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Alias`
+ //~^ WARNING bounds on generic parameters are not enforced in type aliases
+ pub trait Tr1: PrivTr {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr1`
+ pub trait Tr2<T: PrivTr> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr2`
pub trait Tr3 {
type Alias: PrivTr;
- //~^ ERROR private trait `traits::PrivTr` in public interface
- //~| WARNING hard error
- fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+ fn f<T: PrivTr>(arg: T) {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
}
- impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface
- //~^ WARNING hard error
+ impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
impl<T: PrivTr> PubTr for Pub<T> {} // OK, trait impl predicates
}
@@ -72,20 +57,16 @@ mod traits_where {
pub trait PubTr {}
pub type Alias<T> where T: PrivTr = T;
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
//~| WARNING where clauses are not enforced in type aliases
pub trait Tr2<T> where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
pub trait Tr3 {
fn f<T>(arg: T) where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
}
impl<T> Pub<T> where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
impl<T> PubTr for Pub<T> where T: PrivTr {} // OK, trait impl predicates
}
@@ -96,14 +77,10 @@ mod generics {
pub trait PubTr<T> {}
pub trait Tr1: PrivTr<Pub> {}
- //~^ ERROR private trait `generics::PrivTr<generics::Pub>` in public interface
- //~| WARNING hard error
- pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
- pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
- pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Priv` in public interface
- //~^ WARNING hard error
+ //~^ ERROR trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+ pub trait Tr2: PubTr<Priv> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr2`
+ pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR type `generics::Priv` is more private than the item `generics::Tr3`
+ pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR type `generics::Priv` is more private than the item `Tr4`
}
mod impls {
@@ -200,8 +177,7 @@ mod aliases_pub {
pub trait Tr2: PrivUseAliasTr<PrivAlias> {} // OK
impl PrivAlias {
- pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
- //~^ WARNING hard error
+ pub fn f(arg: Priv) {} //~ ERROR type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
}
impl PrivUseAliasTr for PrivUseAlias {
type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
@@ -244,13 +220,10 @@ mod aliases_priv {
}
pub trait Tr1: PrivUseAliasTr {}
- //~^ ERROR private trait `PrivTr1` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- //~^ ERROR private trait `PrivTr1<Priv2>` in public interface
- //~| WARNING hard error
- //~| ERROR private type `Priv2` in public interface
- //~| WARNING hard error
+ //~^ ERROR trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+ //~| ERROR type `Priv2` is more private than the item `aliases_priv::Tr2`
impl PrivUseAlias {
pub fn f(arg: Priv) {} // OK
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 66f91ce6f..6497b7ff5 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -1,46 +1,58 @@
-error: private type `types::Priv` in public interface (error E0446)
+error: type `types::Priv` is more private than the item `types::Alias`
--> $DIR/private-in-public-warn.rs:15:5
|
LL | pub type Alias = Priv;
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ type alias `types::Alias` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/private-in-public-warn.rs:5:9
|
-LL | #![deny(private_in_public)]
- | ^^^^^^^^^^^^^^^^^
+LL | #![deny(private_interfaces, private_bounds)]
+ | ^^^^^^^^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:18:12
+error: type `types::Priv` is more private than the item `E::V1::0`
+ --> $DIR/private-in-public-warn.rs:17:12
|
LL | V1(Priv),
- | ^^^^
+ | ^^^^ field `E::V1::0` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:20:14
+error: type `types::Priv` is more private than the item `E::V2::field`
+ --> $DIR/private-in-public-warn.rs:18:14
|
LL | V2 { field: Priv },
- | ^^^^^^^^^^^
+ | ^^^^^^^^^^^ field `E::V2::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:24:9
+error: type `types::Priv` is more private than the item `Tr::C`
+ --> $DIR/private-in-public-warn.rs:21:9
|
LL | const C: Priv = Priv;
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^ associated constant `Tr::C` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:26:9
+ --> $DIR/private-in-public-warn.rs:22:9
|
LL | struct Priv;
| ----------- `types::Priv` declared as private
@@ -48,53 +60,68 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:27:9
+error: type `types::Priv` is more private than the item `Tr::f1`
+ --> $DIR/private-in-public-warn.rs:23:9
|
LL | fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ associated function `Tr::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:29:9
+error: type `types::Priv` is more private than the item `Tr::f2`
+ --> $DIR/private-in-public-warn.rs:24:9
|
LL | fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ associated function `Tr::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:33:9
+error: type `types::Priv` is more private than the item `types::ES`
+ --> $DIR/private-in-public-warn.rs:27:9
|
LL | pub static ES: Priv;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:35:9
+error: type `types::Priv` is more private than the item `types::ef1`
+ --> $DIR/private-in-public-warn.rs:28:9
|
LL | pub fn ef1(arg: Priv);
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: private type `types::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:37:9
+error: type `types::Priv` is more private than the item `types::ef2`
+ --> $DIR/private-in-public-warn.rs:29:9
|
LL | pub fn ef2() -> Priv;
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:9:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:41:9
+ --> $DIR/private-in-public-warn.rs:32:9
|
LL | struct Priv;
| ----------- `types::Priv` declared as private
@@ -102,134 +129,181 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:50:5
+error: trait `traits::PrivTr` is more private than the item `traits::Alias`
+ --> $DIR/private-in-public-warn.rs:41:5
|
LL | pub type Alias<T: PrivTr> = T;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `traits::Alias` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/private-in-public-warn.rs:5:29
+ |
+LL | #![deny(private_interfaces, private_bounds)]
+ | ^^^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:53:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr1`
+ --> $DIR/private-in-public-warn.rs:43:5
|
LL | pub trait Tr1: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:55:5
+error: trait `traits::PrivTr` is more private than the item `traits::Tr2`
+ --> $DIR/private-in-public-warn.rs:44:5
|
LL | pub trait Tr2<T: PrivTr> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:58:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
+ --> $DIR/private-in-public-warn.rs:46:9
|
LL | type Alias: PrivTr;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ associated type `traits::Tr3::Alias` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:61:9
+error: trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
+ --> $DIR/private-in-public-warn.rs:48:9
|
LL | fn f<T: PrivTr>(arg: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Tr3::f` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:64:5
+error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ --> $DIR/private-in-public-warn.rs:50:5
|
LL | impl<T: PrivTr> Pub<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:37:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:74:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
+ --> $DIR/private-in-public-warn.rs:59:5
|
LL | pub type Alias<T> where T: PrivTr = T;
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:78:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
+ --> $DIR/private-in-public-warn.rs:62:5
|
LL | pub trait Tr2<T> where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:82:9
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
+ --> $DIR/private-in-public-warn.rs:65:9
|
LL | fn f<T>(arg: T) where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `traits_where::PrivTr` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:86:5
+error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+ --> $DIR/private-in-public-warn.rs:68:5
|
LL | impl<T> Pub<T> where T: PrivTr {}
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:55:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error: private trait `generics::PrivTr<generics::Pub>` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:98:5
+error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
+ --> $DIR/private-in-public-warn.rs:79:5
|
LL | pub trait Tr1: PrivTr<Pub> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:76:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | trait PrivTr<T> {}
+ | ^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:101:5
+error: type `generics::Priv` is more private than the item `generics::Tr2`
+ --> $DIR/private-in-public-warn.rs:81:5
|
LL | pub trait Tr2: PubTr<Priv> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:103:5
+error: type `generics::Priv` is more private than the item `generics::Tr3`
+ --> $DIR/private-in-public-warn.rs:82:5
|
LL | pub trait Tr3: PubTr<[Priv; 1]> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
+ |
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error: private type `generics::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:105:5
+error: type `generics::Priv` is more private than the item `Tr4`
+ --> $DIR/private-in-public-warn.rs:83:5
|
LL | pub trait Tr4: PubTr<Pub<Priv>> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:74:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
error[E0446]: private type `impls::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:132:9
+ --> $DIR/private-in-public-warn.rs:109:9
|
LL | struct Priv;
| ----------- `impls::Priv` declared as private
@@ -237,17 +311,20 @@ LL | struct Priv;
LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private type `aliases_pub::Priv` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:203:9
+error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
+ --> $DIR/private-in-public-warn.rs:180:9
|
LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:153:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:207:9
+ --> $DIR/private-in-public-warn.rs:183:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -256,7 +333,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:210:9
+ --> $DIR/private-in-public-warn.rs:186:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -265,7 +342,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:213:9
+ --> $DIR/private-in-public-warn.rs:189:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -274,7 +351,7 @@ LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public-warn.rs:216:9
+ --> $DIR/private-in-public-warn.rs:192:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
@@ -282,35 +359,44 @@ LL | struct Priv;
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
-error: private trait `PrivTr1` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:246:5
+error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
+ --> $DIR/private-in-public-warn.rs:222:5
|
LL | pub trait Tr1: PrivUseAliasTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:208:5
+ |
+LL | trait PrivTr1<T = u8> {
+ | ^^^^^^^^^^^^^^^^^^^^^
-error: private trait `PrivTr1<Priv2>` in public interface (error E0445)
- --> $DIR/private-in-public-warn.rs:249:5
+error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
+ --> $DIR/private-in-public-warn.rs:224:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:208:5
+ |
+LL | trait PrivTr1<T = u8> {
+ | ^^^^^^^^^^^^^^^^^^^^^
-error: private type `Priv2` in public interface (error E0446)
- --> $DIR/private-in-public-warn.rs:249:5
+error: type `Priv2` is more private than the item `aliases_priv::Tr2`
+ --> $DIR/private-in-public-warn.rs:224:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public-warn.rs:206:5
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+LL | struct Priv2;
+ | ^^^^^^^^^^^^
warning: bounds on generic parameters are not enforced in type aliases
- --> $DIR/private-in-public-warn.rs:50:23
+ --> $DIR/private-in-public-warn.rs:41:23
|
LL | pub type Alias<T: PrivTr> = T;
| ^^^^^^
@@ -323,7 +409,7 @@ LL + pub type Alias<T> = T;
|
warning: where clauses are not enforced in type aliases
- --> $DIR/private-in-public-warn.rs:74:29
+ --> $DIR/private-in-public-warn.rs:59:29
|
LL | pub type Alias<T> where T: PrivTr = T;
| ^^^^^^^^^
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index dbd1c483f..f54f9e38f 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -1,3 +1,5 @@
+// check-pass
+
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
@@ -10,16 +12,16 @@ mod types {
type Alias;
}
- pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
- pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface
- pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface
+ pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `C`
+ pub static S: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `S`
+ pub fn f1(arg: Priv) {} //~ WARNING `types::Priv` is more private than the item `types::f1`
+ pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::f2`
+ pub struct S1(pub Priv); //~ WARNING type `types::Priv` is more private than the item `types::S1::0`
+ pub struct S2 { pub field: Priv } //~ WARNING `types::Priv` is more private than the item `S2::field`
impl Pub {
- pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
- pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
- pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+ pub const C: Priv = Priv; //~ WARNING type `types::Priv` is more private than the item `types::Pub::C`
+ pub fn f1(arg: Priv) {} //~ WARNING type `types::Priv` is more private than the item `types::Pub::f1`
+ pub fn f2() -> Priv { panic!() } //~ WARNING type `types::Priv` is more private than the item `types::Pub::f2`
}
}
@@ -28,11 +30,11 @@ mod traits {
pub struct Pub<T>(T);
pub trait PubTr {}
- pub enum E<T: PrivTr> { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface
- pub fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
- pub struct S1<T: PrivTr>(T); //~ ERROR private trait `traits::PrivTr` in public interface
- impl<T: PrivTr> Pub<T> { //~ ERROR private trait `traits::PrivTr` in public interface
- pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface
+ pub enum E<T: PrivTr> { V(T) } //~ WARNING trait `traits::PrivTr` is more private than the item `traits::E`
+ pub fn f<T: PrivTr>(arg: T) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::f`
+ pub struct S1<T: PrivTr>(T); //~ WARNING trait `traits::PrivTr` is more private than the item `traits::S1`
+ impl<T: PrivTr> Pub<T> { //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ pub fn f<U: PrivTr>(arg: U) {} //~ WARNING trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
}
}
@@ -42,15 +44,15 @@ mod traits_where {
pub trait PubTr {}
pub enum E<T> where T: PrivTr { V(T) }
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::E`
pub fn f<T>(arg: T) where T: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::f`
pub struct S1<T>(T) where T: PrivTr;
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
impl<T> Pub<T> where T: PrivTr {
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
pub fn f<U>(arg: U) where U: PrivTr {}
- //~^ ERROR private trait `traits_where::PrivTr` in public interface
+ //~^ WARNING trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
}
}
@@ -60,10 +62,10 @@ mod generics {
trait PrivTr<T> {}
pub trait PubTr<T> {}
- pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface
- pub fn f2(arg: Pub<Priv>) {} //~ ERROR private type `generics::Priv` in public interface
+ pub fn f1(arg: [Priv; 1]) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f1`
+ pub fn f2(arg: Pub<Priv>) {} //~ WARNING type `generics::Priv` is more private than the item `generics::f2`
pub fn f3(arg: Priv<Pub>) {}
- //~^ ERROR private type `generics::Priv<generics::Pub>` in public interface
+ //~^ WARNING type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
}
mod impls {
@@ -77,7 +79,7 @@ mod impls {
}
impl Pub {
- pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface
+ pub fn f(arg: Priv) {} //~ WARNING type `impls::Priv` is more private than the item `impls::Pub::f`
}
}
@@ -102,11 +104,11 @@ mod aliases_pub {
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ ERROR private trait `aliases_pub::PrivTr` in public interface
- //~| ERROR private type `aliases_pub::Priv` in public interface
+ //~^ WARNING trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+ //~| WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
impl PrivUseAlias {
- pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
+ pub fn f(arg: Priv) {}
}
}
@@ -128,11 +130,11 @@ mod aliases_priv {
}
impl PrivTr for Priv {}
- pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `Priv1` in public interface
- pub fn f2(arg: PrivAlias) {} //~ ERROR private type `Priv2` in public interface
+ pub fn f1(arg: PrivUseAlias) {} //~ WARNING type `Priv1` is more private than the item `aliases_priv::f1`
+ pub fn f2(arg: PrivAlias) {} //~ WARNING type `Priv2` is more private than the item `aliases_priv::f2`
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ ERROR private trait `aliases_priv::PrivTr` in public interface
- //~| ERROR private type `aliases_priv::Priv` in public interface
+ //~^ WARNING trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+ //~| WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
}
mod aliases_params {
@@ -141,8 +143,8 @@ mod aliases_params {
type Result<T> = ::std::result::Result<T, Priv>;
pub fn f2(arg: PrivAliasGeneric) {}
- //~^ ERROR private type `aliases_params::Priv` in public interface
- pub fn f3(arg: Result<u8>) {} //~ ERROR private type `aliases_params::Priv` in public interface
+ //~^ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f2`
+ pub fn f3(arg: Result<u8>) {} //~ WARNING type `aliases_params::Priv` is more private than the item `aliases_params::f3`
}
fn main() {}
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index 887eebf53..d8f9fd007 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -1,292 +1,376 @@
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:13:5
+warning: type `types::Priv` is more private than the item `C`
+ --> $DIR/private-in-public.rs:15:5
|
-LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
LL | pub const C: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:14:5
+ | ^^^^^^^^^^^^^^^^^ constant `C` is reachable at visibility `pub(crate)`
|
-LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub static S: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:15:5
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `S`
--> $DIR/private-in-public.rs:16:5
|
+LL | pub static S: Priv = Priv;
+ | ^^^^^^^^^^^^^^^^^^ static `S` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:17:19
+warning: type `types::Priv` is more private than the item `types::f1`
+ --> $DIR/private-in-public.rs:17:5
+ |
+LL | pub fn f1(arg: Priv) {}
+ | ^^^^^^^^^^^^^^^^^^^^ function `types::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub struct S1(pub Priv);
- | ^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:18:21
+warning: type `types::Priv` is more private than the item `types::f2`
+ --> $DIR/private-in-public.rs:18:5
+ |
+LL | pub fn f2() -> Priv { panic!() }
+ | ^^^^^^^^^^^^^^^^^^^ function `types::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub struct S2 { pub field: Priv }
- | ^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:20:9
+warning: type `types::Priv` is more private than the item `types::S1::0`
+ --> $DIR/private-in-public.rs:19:19
+ |
+LL | pub struct S1(pub Priv);
+ | ^^^^^^^^ field `types::S1::0` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub const C: Priv = Priv;
- | ^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
- --> $DIR/private-in-public.rs:21:9
+warning: type `types::Priv` is more private than the item `S2::field`
+ --> $DIR/private-in-public.rs:20:21
+ |
+LL | pub struct S2 { pub field: Priv }
+ | ^^^^^^^^^^^^^^^ field `S2::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
|
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f1(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `types::Priv` in public interface
+warning: type `types::Priv` is more private than the item `types::Pub::C`
--> $DIR/private-in-public.rs:22:9
|
+LL | pub const C: Priv = Priv;
+ | ^^^^^^^^^^^^^^^^^ associated constant `types::Pub::C` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
LL | struct Priv;
- | ----------- `types::Priv` declared as private
-...
-LL | pub fn f2() -> Priv { panic!() }
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:31:5
+warning: type `types::Priv` is more private than the item `types::Pub::f1`
+ --> $DIR/private-in-public.rs:23:9
|
-LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub enum E<T: PrivTr> { V(T) }
- | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL | pub fn f1(arg: Priv) {}
+ | ^^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:32:5
+warning: type `types::Priv` is more private than the item `types::Pub::f2`
+ --> $DIR/private-in-public.rs:24:9
|
-LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub fn f<T: PrivTr>(arg: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+LL | pub fn f2() -> Priv { panic!() }
+ | ^^^^^^^^^^^^^^^^^^^ associated function `types::Pub::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `types::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:9:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::E`
--> $DIR/private-in-public.rs:33:5
|
+LL | pub enum E<T: PrivTr> { V(T) }
+ | ^^^^^^^^^^^^^^^^^^^^^ enum `traits::E` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub struct S1<T: PrivTr>(T);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
+ = note: `#[warn(private_bounds)]` on by default
-error[E0445]: private trait `traits::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::f`
--> $DIR/private-in-public.rs:34:5
|
+LL | pub fn f<T: PrivTr>(arg: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | impl<T: PrivTr> Pub<T> {
- | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits::PrivTr` in public interface
- --> $DIR/private-in-public.rs:35:9
+warning: trait `traits::PrivTr` is more private than the item `traits::S1`
+ --> $DIR/private-in-public.rs:35:5
+ |
+LL | pub struct S1<T: PrivTr>(T);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ struct `traits::S1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
|
LL | trait PrivTr {}
- | ------------ `traits::PrivTr` declared as private
-...
-LL | pub fn f<U: PrivTr>(arg: U) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
- --> $DIR/private-in-public.rs:44:5
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
+ --> $DIR/private-in-public.rs:36:5
+ |
+LL | impl<T: PrivTr> Pub<T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
|
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub enum E<T> where T: PrivTr { V(T) }
- | ^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits::PrivTr` is more private than the item `traits::Pub::<T>::f`
+ --> $DIR/private-in-public.rs:37:9
+ |
+LL | pub fn f<U: PrivTr>(arg: U) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Pub::<T>::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:29:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::E`
--> $DIR/private-in-public.rs:46:5
|
+LL | pub enum E<T> where T: PrivTr { V(T) }
+ | ^^^^^^^^^^^^^ enum `traits_where::E` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub fn f<T>(arg: T) where T: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::f`
--> $DIR/private-in-public.rs:48:5
|
+LL | pub fn f<T>(arg: T) where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `traits_where::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | pub struct S1<T>(T) where T: PrivTr;
- | ^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::S1`
--> $DIR/private-in-public.rs:50:5
|
+LL | pub struct S1<T>(T) where T: PrivTr;
+ | ^^^^^^^^^^^^^^^^ struct `traits_where::S1` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
-LL | impl<T> Pub<T> where T: PrivTr {
- | ^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `traits_where::PrivTr` in public interface
- --> $DIR/private-in-public.rs:52:9
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
+ --> $DIR/private-in-public.rs:52:5
+ |
+LL | impl<T> Pub<T> where T: PrivTr {
+ | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
|
LL | trait PrivTr {}
- | ------------ `traits_where::PrivTr` declared as private
-...
+ | ^^^^^^^^^^^^
+
+warning: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub::<T>::f`
+ --> $DIR/private-in-public.rs:54:9
+ |
LL | pub fn f<U>(arg: U) where U: PrivTr {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Pub::<T>::f` is reachable at visibility `pub(crate)`
+ |
+note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:42:5
+ |
+LL | trait PrivTr {}
+ | ^^^^^^^^^^^^
-error[E0446]: private type `generics::Priv` in public interface
- --> $DIR/private-in-public.rs:63:5
+warning: type `generics::Priv` is more private than the item `generics::f1`
+ --> $DIR/private-in-public.rs:65:5
|
-LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv` declared as private
-...
LL | pub fn f1(arg: [Priv; 1]) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `generics::Priv` in public interface
- --> $DIR/private-in-public.rs:64:5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
|
LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv` declared as private
-...
-LL | pub fn f2(arg: Pub<Priv>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `generics::Priv<generics::Pub>` in public interface
- --> $DIR/private-in-public.rs:65:5
+warning: type `generics::Priv` is more private than the item `generics::f2`
+ --> $DIR/private-in-public.rs:66:5
+ |
+LL | pub fn f2(arg: Pub<Priv>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
|
LL | struct Priv<T = u8>(T);
- | ------------------- `generics::Priv<generics::Pub>` declared as private
-...
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: type `generics::Priv<generics::Pub>` is more private than the item `generics::f3`
+ --> $DIR/private-in-public.rs:67:5
+ |
LL | pub fn f3(arg: Priv<Pub>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `generics::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `generics::Priv<generics::Pub>` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:60:5
+ |
+LL | struct Priv<T = u8>(T);
+ | ^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `impls::Priv` in public interface
- --> $DIR/private-in-public.rs:80:9
+warning: type `impls::Priv` is more private than the item `impls::Pub::f`
+ --> $DIR/private-in-public.rs:82:9
|
-LL | struct Priv;
- | ----------- `impls::Priv` declared as private
-...
LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^ associated function `impls::Pub::f` is reachable at visibility `pub(crate)`
+ |
+note: but type `impls::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:72:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error[E0445]: private trait `aliases_pub::PrivTr` in public interface
- --> $DIR/private-in-public.rs:104:5
+warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+ --> $DIR/private-in-public.rs:106:5
|
-LL | trait PrivTr {
- | ------------ `aliases_pub::PrivTr` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+ |
+note: but trait `aliases_pub::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:100:5
+ |
+LL | trait PrivTr {
+ | ^^^^^^^^^^^^
-error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public.rs:104:5
+warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ --> $DIR/private-in-public.rs:106:5
|
-LL | struct Priv;
- | ----------- `aliases_pub::Priv` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_pub::Priv` in public interface
- --> $DIR/private-in-public.rs:109:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:87:5
|
LL | struct Priv;
- | ----------- `aliases_pub::Priv` declared as private
-...
-LL | pub fn f(arg: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `Priv1` in public interface
- --> $DIR/private-in-public.rs:131:5
+warning: type `Priv1` is more private than the item `aliases_priv::f1`
+ --> $DIR/private-in-public.rs:133:5
|
-LL | struct Priv1;
- | ------------ `Priv1` declared as private
-...
LL | pub fn f1(arg: PrivUseAlias) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f1` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv1` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:118:5
+ |
+LL | struct Priv1;
+ | ^^^^^^^^^^^^
-error[E0446]: private type `Priv2` in public interface
- --> $DIR/private-in-public.rs:132:5
+warning: type `Priv2` is more private than the item `aliases_priv::f2`
+ --> $DIR/private-in-public.rs:134:5
|
-LL | struct Priv2;
- | ------------ `Priv2` declared as private
-...
LL | pub fn f2(arg: PrivAlias) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `Priv2` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:119:5
+ |
+LL | struct Priv2;
+ | ^^^^^^^^^^^^
-error[E0445]: private trait `aliases_priv::PrivTr` in public interface
- --> $DIR/private-in-public.rs:133:5
+warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+ --> $DIR/private-in-public.rs:135:5
|
-LL | trait PrivTr {
- | ------------ `aliases_priv::PrivTr` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+ |
+note: but trait `aliases_priv::PrivTr` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:128:5
+ |
+LL | trait PrivTr {
+ | ^^^^^^^^^^^^
-error[E0446]: private type `aliases_priv::Priv` in public interface
- --> $DIR/private-in-public.rs:133:5
+warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ --> $DIR/private-in-public.rs:135:5
|
-LL | struct Priv;
- | ----------- `aliases_priv::Priv` declared as private
-...
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `aliases_params::Priv` in public interface
- --> $DIR/private-in-public.rs:143:5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_priv::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:116:5
|
LL | struct Priv;
- | ----------- `aliases_params::Priv` declared as private
-...
-LL | pub fn f2(arg: PrivAliasGeneric) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^
-error[E0446]: private type `aliases_params::Priv` in public interface
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f2`
--> $DIR/private-in-public.rs:145:5
|
+LL | pub fn f2(arg: PrivAliasGeneric) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f2` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:141:5
+ |
LL | struct Priv;
- | ----------- `aliases_params::Priv` declared as private
-...
+ | ^^^^^^^^^^^
+
+warning: type `aliases_params::Priv` is more private than the item `aliases_params::f3`
+ --> $DIR/private-in-public.rs:147:5
+ |
LL | pub fn f3(arg: Result<u8>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_params::f3` is reachable at visibility `pub(crate)`
+ |
+note: but type `aliases_params::Priv` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:141:5
+ |
+LL | struct Priv;
+ | ^^^^^^^^^^^
-error: aborting due to 32 previous errors
+warning: 31 warnings emitted
-Some errors have detailed explanations: E0445, E0446.
-For more information about an error, try `rustc --explain E0445`.
diff --git a/tests/ui/privacy/private-inferred-type-2.rs b/tests/ui/privacy/private-inferred-type-2.rs
index 15b263b38..1c4c52bea 100644
--- a/tests/ui/privacy/private-inferred-type-2.rs
+++ b/tests/ui/privacy/private-inferred-type-2.rs
@@ -1,4 +1,5 @@
// aux-build:private-inferred-type.rs
+#![allow(private_interfaces)]
extern crate private_inferred_type as ext;
diff --git a/tests/ui/privacy/private-inferred-type-2.stderr b/tests/ui/privacy/private-inferred-type-2.stderr
index 3a0fc03b4..8a905f5d8 100644
--- a/tests/ui/privacy/private-inferred-type-2.stderr
+++ b/tests/ui/privacy/private-inferred-type-2.stderr
@@ -1,17 +1,17 @@
error: type `Priv` is private
- --> $DIR/private-inferred-type-2.rs:16:5
+ --> $DIR/private-inferred-type-2.rs:17:5
|
LL | m::Pub::get_priv;
| ^^^^^^^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-inferred-type-2.rs:17:5
+ --> $DIR/private-inferred-type-2.rs:18:5
|
LL | m::Pub::static_method;
| ^^^^^^^^^^^^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-inferred-type-2.rs:18:5
+ --> $DIR/private-inferred-type-2.rs:19:5
|
LL | ext::Pub::static_method;
| ^^^^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/private-inferred-type.rs b/tests/ui/privacy/private-inferred-type.rs
index e8743dd96..8c07226fe 100644
--- a/tests/ui/privacy/private-inferred-type.rs
+++ b/tests/ui/privacy/private-inferred-type.rs
@@ -1,5 +1,5 @@
#![feature(decl_macro)]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
mod m {
fn priv_fn() {}
diff --git a/tests/ui/privacy/private-type-in-interface.rs b/tests/ui/privacy/private-type-in-interface.rs
index 7fbdbaf5f..39e0bf23c 100644
--- a/tests/ui/privacy/private-type-in-interface.rs
+++ b/tests/ui/privacy/private-type-in-interface.rs
@@ -1,6 +1,7 @@
// aux-build:private-inferred-type.rs
#![allow(warnings)]
+#![allow(private_interfaces)]
extern crate private_inferred_type as ext;
diff --git a/tests/ui/privacy/private-type-in-interface.stderr b/tests/ui/privacy/private-type-in-interface.stderr
index 4e87caa34..03225d84f 100644
--- a/tests/ui/privacy/private-type-in-interface.stderr
+++ b/tests/ui/privacy/private-type-in-interface.stderr
@@ -1,53 +1,53 @@
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:15:9
+ --> $DIR/private-type-in-interface.rs:16:9
|
LL | fn f(_: m::Alias) {}
| ^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:15:6
+ --> $DIR/private-type-in-interface.rs:16:6
|
LL | fn f(_: m::Alias) {}
| ^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:17:13
+ --> $DIR/private-type-in-interface.rs:18:13
|
LL | fn f_ext(_: ext::Alias) {}
| ^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:17:10
+ --> $DIR/private-type-in-interface.rs:18:10
|
LL | fn f_ext(_: ext::Alias) {}
| ^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:21:6
+ --> $DIR/private-type-in-interface.rs:22:6
|
LL | impl m::Alias {}
| ^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:22:14
+ --> $DIR/private-type-in-interface.rs:23:14
|
LL | impl Tr1 for ext::Alias {}
| ^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:23:10
+ --> $DIR/private-type-in-interface.rs:24:10
|
LL | type A = <m::Alias as m::Trait>::X;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ private type
error: type `Priv` is private
- --> $DIR/private-type-in-interface.rs:27:11
+ --> $DIR/private-type-in-interface.rs:28:11
|
LL | fn g() -> impl Tr2<m::Alias> { 0 }
| ^^^^^^^^^^^^^^^^^^ private type
error: type `ext::Priv` is private
- --> $DIR/private-type-in-interface.rs:28:15
+ --> $DIR/private-type-in-interface.rs:29:15
|
LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 }
| ^^^^^^^^^^^^^^^^^^^^ private type
diff --git a/tests/ui/privacy/restricted/private-in-public.rs b/tests/ui/privacy/restricted/private-in-public.rs
index 1e3dbdf73..80a7e6ad0 100644
--- a/tests/ui/privacy/restricted/private-in-public.rs
+++ b/tests/ui/privacy/restricted/private-in-public.rs
@@ -1,10 +1,11 @@
+// check-pass
mod foo {
struct Priv;
mod bar {
use foo::Priv;
pub(super) fn f(_: Priv) {}
- pub(crate) fn g(_: Priv) {} //~ ERROR E0446
- pub(crate) fn h(_: Priv) {} //~ ERROR E0446
+ pub(crate) fn g(_: Priv) {}
+ pub(crate) fn h(_: Priv) {}
}
}
diff --git a/tests/ui/privacy/restricted/private-in-public.stderr b/tests/ui/privacy/restricted/private-in-public.stderr
deleted file mode 100644
index 65d996f0f..000000000
--- a/tests/ui/privacy/restricted/private-in-public.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public.rs:6:9
- |
-LL | struct Priv;
- | ----------- `Priv` declared as private
-...
-LL | pub(crate) fn g(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error[E0446]: private type `Priv` in public interface
- --> $DIR/private-in-public.rs:7:9
- |
-LL | struct Priv;
- | ----------- `Priv` declared as private
-...
-LL | pub(crate) fn h(_: Priv) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs
index 46e249152..c6c5561c3 100644
--- a/tests/ui/privacy/unnameable_types.rs
+++ b/tests/ui/privacy/unnameable_types.rs
@@ -1,5 +1,4 @@
#![feature(type_privacy_lints)]
-#![allow(private_in_public)]
#![deny(unnameable_types)]
mod m {
@@ -21,10 +20,10 @@ mod m {
}
}
-pub trait Voldemort<T> {}
+pub trait Unnameable<T> {}
-impl Voldemort<m::PubStruct> for i32 {}
-impl Voldemort<m::PubE> for i32 {}
-impl<T> Voldemort<T> for u32 where T: m::PubTr {}
+impl Unnameable<m::PubStruct> for i32 {}
+impl Unnameable<m::PubE> for i32 {}
+impl<T> Unnameable<T> for u32 where T: m::PubTr {}
fn main() {}
diff --git a/tests/ui/privacy/unnameable_types.stderr b/tests/ui/privacy/unnameable_types.stderr
index 904127525..d68a11c97 100644
--- a/tests/ui/privacy/unnameable_types.stderr
+++ b/tests/ui/privacy/unnameable_types.stderr
@@ -1,23 +1,23 @@
error: struct `PubStruct` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:6:5
+ --> $DIR/unnameable_types.rs:5:5
|
LL | pub struct PubStruct(pub i32);
| ^^^^^^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
note: the lint level is defined here
- --> $DIR/unnameable_types.rs:3:9
+ --> $DIR/unnameable_types.rs:2:9
|
LL | #![deny(unnameable_types)]
| ^^^^^^^^^^^^^^^^
error: enum `PubE` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:8:5
+ --> $DIR/unnameable_types.rs:7:5
|
LL | pub enum PubE {
| ^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
error: trait `PubTr` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:12:5
+ --> $DIR/unnameable_types.rs:11:5
|
LL | pub trait PubTr {
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
diff --git a/tests/ui/privacy/where-priv-type.rs b/tests/ui/privacy/where-priv-type.rs
index 2e0a6b3e7..cd9cce7ec 100644
--- a/tests/ui/privacy/where-priv-type.rs
+++ b/tests/ui/privacy/where-priv-type.rs
@@ -3,14 +3,7 @@
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_bounds)]
-#![warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
struct PrivTy;
trait PrivTr {}
@@ -23,42 +16,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
pub struct S
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
where
PrivTy:
{}
pub enum E
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `E`
+//~^ WARNING type `PrivTy` is more private than the item `E`
where
PrivTy:
{}
pub fn f()
-//~^ WARNING private type `PrivTy` in public interface
-//~| WARNING hard error
-//~| WARNING type `PrivTy` is more private than the item `f`
+//~^ WARNING type `PrivTy` is more private than the item `f`
where
PrivTy:
{}
impl S
-//~^ ERROR private type `PrivTy` in public interface
-//~| WARNING type `PrivTy` is more private than the item `S`
+//~^ WARNING type `PrivTy` is more private than the item `S`
where
PrivTy:
{
pub fn f()
- //~^ WARNING private type `PrivTy` in public interface
- //~| WARNING hard error
- //~| WARNING type `PrivTy` is more private than the item `S::f`
+ //~^ WARNING type `PrivTy` is more private than the item `S::f`
where
PrivTy:
{}
@@ -90,7 +74,6 @@ where
{
type AssocTy = Const<{ my_const_fn(U) }>;
//~^ ERROR private type
- //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
fn assoc_fn() -> Self::AssocTy {
Const
}
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index d6baf22b3..dcc249c63 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -1,136 +1,72 @@
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:25:1
- |
-LL | pub struct S
- | ^^^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
- = note: `#[warn(private_in_public)]` on by default
-
warning: type `PrivTy` is more private than the item `S`
- --> $DIR/where-priv-type.rs:25:1
+ --> $DIR/where-priv-type.rs:18:1
|
LL | pub struct S
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-priv-type.rs:8:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:34:1
- |
-LL | pub enum E
- | ^^^^^^^^^^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+ = note: `#[warn(private_bounds)]` on by default
warning: type `PrivTy` is more private than the item `E`
- --> $DIR/where-priv-type.rs:34:1
+ --> $DIR/where-priv-type.rs:25:1
|
LL | pub enum E
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:43:1
- |
-LL | / pub fn f()
-LL | |
-LL | |
-LL | |
-LL | | where
-LL | | PrivTy:
- | |___________^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `f`
- --> $DIR/where-priv-type.rs:43:1
+ --> $DIR/where-priv-type.rs:32:1
|
LL | / pub fn f()
LL | |
-LL | |
-LL | |
LL | | where
LL | | PrivTy:
| |___________^ function `f` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-error[E0446]: private type `PrivTy` in public interface
- --> $DIR/where-priv-type.rs:52:1
- |
-LL | struct PrivTy;
- | ------------- `PrivTy` declared as private
-...
-LL | impl S
- | ^^^^^^ can't leak private type
-
warning: type `PrivTy` is more private than the item `S`
- --> $DIR/where-priv-type.rs:52:1
+ --> $DIR/where-priv-type.rs:39:1
|
LL | impl S
| ^^^^^^ implementation `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
-warning: private type `PrivTy` in public interface (error E0446)
- --> $DIR/where-priv-type.rs:58:5
- |
-LL | / pub fn f()
-LL | |
-LL | |
-LL | |
-LL | | where
-LL | | PrivTy:
- | |_______________^
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
-
warning: type `PrivTy` is more private than the item `S::f`
- --> $DIR/where-priv-type.rs:58:5
+ --> $DIR/where-priv-type.rs:44:5
|
LL | / pub fn f()
LL | |
-LL | |
-LL | |
LL | | where
LL | | PrivTy:
| |_______________^ associated function `S::f` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:15:1
+ --> $DIR/where-priv-type.rs:8:1
|
LL | struct PrivTy;
| ^^^^^^^^^^^^^
error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface
- --> $DIR/where-priv-type.rs:91:5
+ --> $DIR/where-priv-type.rs:75:5
|
LL | type AssocTy = Const<{ my_const_fn(U) }>;
| ^^^^^^^^^^^^ can't leak private type
@@ -138,23 +74,6 @@ LL | type AssocTy = Const<{ my_const_fn(U) }>;
LL | const fn my_const_fn(val: u8) -> u8 {
| ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private
-warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy`
- --> $DIR/where-priv-type.rs:91:5
- |
-LL | type AssocTy = Const<{ my_const_fn(U) }>;
- | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub`
- |
-note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)`
- --> $DIR/where-priv-type.rs:99:1
- |
-LL | const fn my_const_fn(val: u8) -> u8 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-priv-type.rs:9:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors; 10 warnings emitted
+error: aborting due to previous error; 5 warnings emitted
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
index c59fdb7c7..d5e797b52 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
@@ -1,14 +1,10 @@
+// check-pass
+
// priv-in-pub lint tests where the private trait bounds a public type
#![crate_type = "lib"]
#![feature(generic_const_exprs)]
-#![feature(type_privacy_lints)]
#![allow(incomplete_features)]
-#![warn(private_bounds)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
struct PrivTy;
trait PrivTr {}
@@ -22,38 +18,33 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; }
pub struct S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
where
PubTy: PrivTr
{}
pub enum E
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `E`
+//~^ WARNING trait `PrivTr` is more private than the item `E`
where
PubTy: PrivTr
{}
pub fn f()
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `f`
+//~^ WARNING trait `PrivTr` is more private than the item `f`
where
PubTy: PrivTr
{}
impl S
-//~^ ERROR private trait `PrivTr` in public interface
-//~| WARNING trait `PrivTr` is more private than the item `S`
+//~^ WARNING trait `PrivTr` is more private than the item `S`
where
PubTy: PrivTr
{
pub fn f()
- //~^ ERROR private trait `PrivTr` in public interface
- //~| WARNING trait `PrivTr` is more private than the item `S::f`
+ //~^ WARNING trait `PrivTr` is more private than the item `S::f`
where
PubTy: PrivTr
{}
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index e2d7ce446..c47687433 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -1,129 +1,69 @@
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | pub struct S
- | ^^^^^^^^^^^^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:24:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
|
LL | pub struct S
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/where-pub-type-impls-priv-trait.rs:7:9
- |
-LL | #![warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | pub enum E
- | ^^^^^^^^^^ can't leak private trait
+ = note: `#[warn(private_bounds)]` on by default
warning: trait `PrivTr` is more private than the item `E`
- --> $DIR/where-pub-type-impls-priv-trait.rs:32:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
|
LL | pub enum E
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | / pub fn f()
-LL | |
-LL | |
-LL | | where
-LL | | PubTy: PrivTr
- | |_________________^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
|
LL | / pub fn f()
LL | |
-LL | |
LL | | where
LL | | PubTy: PrivTr
| |_________________^ function `f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | impl S
- | ^^^^^^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:48:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
|
LL | impl S
| ^^^^^^ implementation `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error[E0445]: private trait `PrivTr` in public interface
- --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
- |
-LL | trait PrivTr {}
- | ------------ `PrivTr` declared as private
-...
-LL | / pub fn f()
-LL | |
-LL | |
-LL | | where
-LL | | PubTy: PrivTr
- | |_____________________^ can't leak private trait
-
warning: trait `PrivTr` is more private than the item `S::f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:54:5
+ --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
|
LL | / pub fn f()
LL | |
-LL | |
LL | | where
LL | | PubTy: PrivTr
| |_____________________^ associated function `S::f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:14:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
-error: aborting due to 5 previous errors; 5 warnings emitted
+warning: 5 warnings emitted
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs
index 868508761..ce327901b 100644
--- a/tests/ui/proc-macro/allowed-signatures.rs
+++ b/tests/ui/proc-macro/allowed-signatures.rs
@@ -3,7 +3,7 @@
// no-prefer-dynamic
#![crate_type = "proc-macro"]
-#![allow(private_in_public)]
+#![allow(private_interfaces)]
extern crate proc_macro;
use proc_macro::TokenStream;
diff --git a/tests/ui/proc-macro/auxiliary/api/mod.rs b/tests/ui/proc-macro/auxiliary/api/mod.rs
index 739c25132..3bea5d757 100644
--- a/tests/ui/proc-macro/auxiliary/api/mod.rs
+++ b/tests/ui/proc-macro/auxiliary/api/mod.rs
@@ -4,6 +4,7 @@
#![crate_type = "proc-macro"]
#![crate_name = "proc_macro_api_tests"]
#![feature(proc_macro_span)]
+#![feature(proc_macro_byte_character)]
#![deny(dead_code)] // catch if a test function is never called
extern crate proc_macro;
diff --git a/tests/ui/proc-macro/auxiliary/api/parse.rs b/tests/ui/proc-macro/auxiliary/api/parse.rs
index 27391f831..07c9f4649 100644
--- a/tests/ui/proc-macro/auxiliary/api/parse.rs
+++ b/tests/ui/proc-macro/auxiliary/api/parse.rs
@@ -29,12 +29,16 @@ fn test_display_literal() {
assert_eq!(Literal::character('\'').to_string(), "'\\''");
assert_eq!(Literal::character('"').to_string(), "'\"'");
assert_eq!(Literal::character('\u{1}').to_string(), "'\\u{1}'");
+
+ assert_eq!(Literal::byte_character(b'a').to_string(), "b'a'");
+ assert_eq!(Literal::byte_character(0).to_string(), "b'\\x00'");
}
fn test_parse_literal() {
assert_eq!("1".parse::<Literal>().unwrap().to_string(), "1");
assert_eq!("1.0".parse::<Literal>().unwrap().to_string(), "1.0");
assert_eq!("'a'".parse::<Literal>().unwrap().to_string(), "'a'");
+ assert_eq!("b'a'".parse::<Literal>().unwrap().to_string(), "b'a'");
assert_eq!("\"\n\"".parse::<Literal>().unwrap().to_string(), "\"\n\"");
assert_eq!("b\"\"".parse::<Literal>().unwrap().to_string(), "b\"\"");
assert_eq!("r##\"\"##".parse::<Literal>().unwrap().to_string(), "r##\"\"##");
diff --git a/tests/ui/proc-macro/auxiliary/print-tokens.rs b/tests/ui/proc-macro/auxiliary/print-tokens.rs
new file mode 100644
index 000000000..3a5767edb
--- /dev/null
+++ b/tests/ui/proc-macro/auxiliary/print-tokens.rs
@@ -0,0 +1,16 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{TokenStream, TokenTree};
+
+#[proc_macro]
+pub fn print_tokens(input: TokenStream) -> TokenStream {
+ println!("{:#?}", input);
+ for token in input {
+ println!("{token}");
+ }
+ TokenStream::new()
+}
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8a8246376..8716defa1 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Project` is not satisfied
|
LL | pub fn uwu() -> <() as Project>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/bad-projection.rs:9:1
+ |
+LL | trait Project {
+ | ^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/proc-macro/literal-to-string.rs b/tests/ui/proc-macro/literal-to-string.rs
new file mode 100644
index 000000000..494d17cbe
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.rs
@@ -0,0 +1,26 @@
+// check-pass
+// edition: 2021
+#![feature(c_str_literals)]
+
+// aux-build: print-tokens.rs
+extern crate print_tokens;
+
+fn main() {
+ print_tokens::print_tokens! {
+ 1
+ 17u8
+ 42.
+ 3.14f32
+ b'a'
+ b'\xFF'
+ 'c'
+ '\x32'
+ "\"str\""
+ r#""raw" str"#
+ r###"very ##"raw"## str"###
+ b"\"byte\" str"
+ br#""raw" "byte" str"#
+ c"\"c\" str"
+ cr#""raw" "c" str"#
+ }
+}
diff --git a/tests/ui/proc-macro/literal-to-string.stdout b/tests/ui/proc-macro/literal-to-string.stdout
new file mode 100644
index 000000000..7b27fcf79
--- /dev/null
+++ b/tests/ui/proc-macro/literal-to-string.stdout
@@ -0,0 +1,107 @@
+TokenStream [
+ Literal {
+ kind: Integer,
+ symbol: "1",
+ suffix: None,
+ span: #0 bytes(172..173),
+ },
+ Literal {
+ kind: Integer,
+ symbol: "17",
+ suffix: Some("u8"),
+ span: #0 bytes(182..186),
+ },
+ Literal {
+ kind: Float,
+ symbol: "42.",
+ suffix: None,
+ span: #0 bytes(195..198),
+ },
+ Literal {
+ kind: Float,
+ symbol: "3.14",
+ suffix: Some("f32"),
+ span: #0 bytes(207..214),
+ },
+ Literal {
+ kind: Byte,
+ symbol: "a",
+ suffix: None,
+ span: #0 bytes(223..227),
+ },
+ Literal {
+ kind: Byte,
+ symbol: "\xFF",
+ suffix: None,
+ span: #0 bytes(236..243),
+ },
+ Literal {
+ kind: Char,
+ symbol: "c",
+ suffix: None,
+ span: #0 bytes(252..255),
+ },
+ Literal {
+ kind: Char,
+ symbol: "\x32",
+ suffix: None,
+ span: #0 bytes(264..270),
+ },
+ Literal {
+ kind: Str,
+ symbol: "\\"str\\"",
+ suffix: None,
+ span: #0 bytes(279..288),
+ },
+ Literal {
+ kind: StrRaw(1),
+ symbol: "\"raw\" str",
+ suffix: None,
+ span: #0 bytes(297..311),
+ },
+ Literal {
+ kind: StrRaw(3),
+ symbol: "very ##\"raw\"## str",
+ suffix: None,
+ span: #0 bytes(320..347),
+ },
+ Literal {
+ kind: ByteStr,
+ symbol: "\\"byte\\" str",
+ suffix: None,
+ span: #0 bytes(356..371),
+ },
+ Literal {
+ kind: ByteStrRaw(1),
+ symbol: "\"raw\" \"byte\" str",
+ suffix: None,
+ span: #0 bytes(380..402),
+ },
+ Literal {
+ kind: CStr,
+ symbol: "\\"c\\" str",
+ suffix: None,
+ span: #0 bytes(411..423),
+ },
+ Literal {
+ kind: CStrRaw(1),
+ symbol: "\"raw\" \"c\" str",
+ suffix: None,
+ span: #0 bytes(432..451),
+ },
+]
+1
+17u8
+42.
+3.14f32
+b'a'
+b'\xFF'
+'c'
+'\x32'
+"\"str\""
+r#""raw" str"#
+r###"very ##"raw"## str"###
+b"\"byte\" str"
+br#""raw" "byte" str"#
+c"\"c\" str"
+cr#""raw" "c" str"#
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
index cdeea6224..7930964c8 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs
@@ -1,44 +1,24 @@
-#![feature(type_privacy_lints)]
-#![allow(non_camel_case_types)] // genus is always capitalized
-#![warn(private_interfaces)]
-//~^ NOTE the lint level is defined here
+// check-pass
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
+#![allow(non_camel_case_types)] // genus is always capitalized
pub(crate) struct Snail;
-//~^ NOTE `Snail` declared as private
-//~| NOTE but type `Snail` is only usable at visibility `pub(crate)`
mod sea {
pub(super) struct Turtle;
- //~^ NOTE `Turtle` declared as crate-private
- //~| NOTE but type `Turtle` is only usable at visibility `pub(crate)`
}
struct Tortoise;
-//~^ NOTE `Tortoise` declared as private
-//~| NOTE but type `Tortoise` is only usable at visibility `pub(crate)`
pub struct Shell<T> {
pub(crate) creature: T,
}
pub type Helix_pomatia = Shell<Snail>;
-//~^ ERROR private type `Snail` in public interface
-//~| WARNING type `Snail` is more private than the item `Helix_pomatia`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Helix_pomatia` is reachable at visibility `pub`
+//~^ WARNING type `Snail` is more private than the item `Helix_pomatia`
pub type Dermochelys_coriacea = Shell<sea::Turtle>;
-//~^ ERROR crate-private type `Turtle` in public interface
-//~| WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
-//~| NOTE can't leak crate-private type
-//~| NOTE type alias `Dermochelys_coriacea` is reachable at visibility `pub`
+//~^ WARNING type `Turtle` is more private than the item `Dermochelys_coriacea`
pub type Testudo_graeca = Shell<Tortoise>;
-//~^ ERROR private type `Tortoise` in public interface
-//~| WARNING type `Tortoise` is more private than the item `Testudo_graeca`
-//~| NOTE can't leak private type
-//~| NOTE type alias `Testudo_graeca` is reachable at visibility `pub`
+//~^ WARNING type `Tortoise` is more private than the item `Testudo_graeca`
fn main() {}
diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
index 20e51e190..26dfa2e7d 100644
--- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
+++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr
@@ -1,71 +1,39 @@
-error[E0446]: private type `Snail` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
- |
-LL | pub(crate) struct Snail;
- | ----------------------- `Snail` declared as private
-...
-LL | pub type Helix_pomatia = Shell<Snail>;
- | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
warning: type `Snail` is more private than the item `Helix_pomatia`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:17:1
|
LL | pub type Helix_pomatia = Shell<Snail>;
| ^^^^^^^^^^^^^^^^^^^^^^ type alias `Helix_pomatia` is reachable at visibility `pub`
|
note: but type `Snail` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:10:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:5:1
|
LL | pub(crate) struct Snail;
| ^^^^^^^^^^^^^^^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:3:9
- |
-LL | #![warn(private_interfaces)]
- | ^^^^^^^^^^^^^^^^^^
-
-error[E0446]: crate-private type `Turtle` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
- |
-LL | pub(super) struct Turtle;
- | ------------------------ `Turtle` declared as crate-private
-...
-LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type
+ = note: `#[warn(private_interfaces)]` on by default
warning: type `Turtle` is more private than the item `Dermochelys_coriacea`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:19:1
|
LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `Dermochelys_coriacea` is reachable at visibility `pub`
|
note: but type `Turtle` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:15:5
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:8:5
|
LL | pub(super) struct Turtle;
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0446]: private type `Tortoise` in public interface
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
- |
-LL | struct Tortoise;
- | --------------- `Tortoise` declared as private
-...
-LL | pub type Testudo_graeca = Shell<Tortoise>;
- | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
-
warning: type `Tortoise` is more private than the item `Testudo_graeca`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1
|
LL | pub type Testudo_graeca = Shell<Tortoise>;
| ^^^^^^^^^^^^^^^^^^^^^^^ type alias `Testudo_graeca` is reachable at visibility `pub`
|
note: but type `Tortoise` is only usable at visibility `pub(crate)`
- --> $DIR/issue-33174-restricted-type-in-public-interface.rs:20:1
+ --> $DIR/issue-33174-restricted-type-in-public-interface.rs:11:1
|
LL | struct Tortoise;
| ^^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: 3 warnings emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/pub/pub-restricted-error-fn.stderr b/tests/ui/pub/pub-restricted-error-fn.stderr
index 0511a821a..ca5d8e1b5 100644
--- a/tests/ui/pub/pub-restricted-error-fn.stderr
+++ b/tests/ui/pub/pub-restricted-error-fn.stderr
@@ -11,6 +11,8 @@ error: expected item, found `(`
|
LL | pub(crate) () fn foo() {}
| ^ expected item
+ |
+ = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 2 previous errors
diff --git a/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs
index db455fada..a15956853 100644
--- a/tests/ui/range/issue-54505-no-std.rs
+++ b/tests/ui/range/issue-54505-no-std.rs
@@ -17,9 +17,9 @@ extern "C" fn eh_personality() {}
static EH_CATCH_TYPEINFO: u8 = 0;
#[panic_handler]
-fn panic_handler() {}
-//~^ ERROR return type should be `!`
-//~| ERROR function should have one argument
+fn panic_handler(_: &core::panic::PanicInfo) -> ! {
+ unimplemented!();
+}
// take a reference to any built-in range
fn take_range(_r: &impl RangeBounds<i8>) {}
diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr
index 13563d194..1694d514f 100644
--- a/tests/ui/range/issue-54505-no-std.stderr
+++ b/tests/ui/range/issue-54505-no-std.stderr
@@ -1,15 +1,3 @@
-error: return type should be `!`
- --> $DIR/issue-54505-no-std.rs:20:20
- |
-LL | fn panic_handler() {}
- | ^
-
-error: function should have one argument
- --> $DIR/issue-54505-no-std.rs:20:1
- |
-LL | fn panic_handler() {}
- | ^^^^^^^^^^^^^^^^^^
-
error[E0308]: mismatched types
--> $DIR/issue-54505-no-std.rs:29:16
|
@@ -130,6 +118,6 @@ help: consider borrowing here
LL | take_range(&(..=42));
| ++ +
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/range/range-1.stderr b/tests/ui/range/range-1.stderr
index 277d9b268..96c1ffb2f 100644
--- a/tests/ui/range/range-1.stderr
+++ b/tests/ui/range/range-1.stderr
@@ -19,7 +19,7 @@ LL | for i in false..true {}
i64
i128
usize
- and 5 others
+ and 8 others
= note: required for `std::ops::Range<bool>` to implement `Iterator`
= note: required for `std::ops::Range<bool>` to implement `IntoIterator`
diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr
index 543b73084..5df8af484 100644
--- a/tests/ui/recursion/issue-83150.stderr
+++ b/tests/ui/recursion/issue-83150.stderr
@@ -9,12 +9,12 @@ LL | func(&mut iter.map(|x| x + 1))
= help: a `loop` may express intention better if this is on purpose
= note: `#[warn(unconditional_recursion)]` on by default
-error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>: Iterator`
+error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
- = note: required for `&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
+ = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator`
= note: 65 redundant requirements hidden
- = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
+ = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
index f2328cf3b..a9a92b7a6 100644
--- a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
index 9c5004981..e96559937 100644
--- a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b isize, &'c mut &'d isize, &'e mut &'f isize)`
found fn item `for<'a, 'b, 'c> fn(&'a mut &isize, &'b mut &isize, &'c mut &isize) {a::<'_, '_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
index 766a3d033..8d82ff958 100644
--- a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
+++ b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr
@@ -8,7 +8,6 @@ LL | want_G(baz);
|
= note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S`
found fn item `for<'a> fn(&'a S) -> &'a S {baz}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
note: function defined here
--> $DIR/regions-fn-subtyping-return-static-fail.rs:20:4
|
diff --git a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
index 2fab29865..53a5612d2 100644
--- a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
+++ b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
@@ -8,7 +8,6 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error: aborting due to previous error
diff --git a/tests/ui/reify-intrinsic.stderr b/tests/ui/reify-intrinsic.stderr
index 9f9034a30..310b6c224 100644
--- a/tests/ui/reify-intrinsic.stderr
+++ b/tests/ui/reify-intrinsic.stderr
@@ -8,7 +8,6 @@ LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr
|
= note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize`
found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
- = note: when the arguments and return types match, functions can be coerced to function pointers
error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid
--> $DIR/reify-intrinsic.rs:11:13
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index 2acfde4be..d4fea2b19 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -5,7 +5,7 @@
// [avr] compile-flags: --target=avr-unknown-gnu-atmega328 --crate-type=rlib
// [msp430] needs-llvm-components: msp430
// [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib
-#![feature(no_core, lang_items, intrinsics, staged_api)]
+#![feature(no_core, lang_items, intrinsics, staged_api, rustc_attrs)]
#![no_core]
#![crate_type = "lib"]
#![stable(feature = "", since = "")]
diff --git a/tests/ui/repr/explicit-rust-repr-conflicts.rs b/tests/ui/repr/explicit-rust-repr-conflicts.rs
new file mode 100644
index 000000000..22dd12d31
--- /dev/null
+++ b/tests/ui/repr/explicit-rust-repr-conflicts.rs
@@ -0,0 +1,23 @@
+#[repr(C, Rust)] //~ ERROR conflicting representation hints
+struct S {
+ a: i32,
+}
+
+
+#[repr(Rust)] //~ ERROR conflicting representation hints
+#[repr(C)]
+struct T {
+ a: i32,
+}
+
+#[repr(Rust, u64)] //~ ERROR conflicting representation hints
+enum U {
+ V,
+}
+
+#[repr(Rust, simd)]
+//~^ ERROR conflicting representation hints
+//~| ERROR SIMD types are experimental and possibly buggy
+struct F32x4(f32, f32, f32, f32);
+
+fn main() {}
diff --git a/tests/ui/repr/explicit-rust-repr-conflicts.stderr b/tests/ui/repr/explicit-rust-repr-conflicts.stderr
new file mode 100644
index 000000000..7126da574
--- /dev/null
+++ b/tests/ui/repr/explicit-rust-repr-conflicts.stderr
@@ -0,0 +1,39 @@
+error[E0658]: SIMD types are experimental and possibly buggy
+ --> $DIR/explicit-rust-repr-conflicts.rs:18:1
+ |
+LL | #[repr(Rust, simd)]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information
+ = help: add `#![feature(repr_simd)]` to the crate attributes to enable
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:1:8
+ |
+LL | #[repr(C, Rust)]
+ | ^ ^^^^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:7:8
+ |
+LL | #[repr(Rust)]
+ | ^^^^
+LL | #[repr(C)]
+ | ^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:13:8
+ |
+LL | #[repr(Rust, u64)]
+ | ^^^^ ^^^
+
+error[E0566]: conflicting representation hints
+ --> $DIR/explicit-rust-repr-conflicts.rs:18:8
+ |
+LL | #[repr(Rust, simd)]
+ | ^^^^ ^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0566, E0658.
+For more information about an error, try `rustc --explain E0566`.
diff --git a/tests/ui/repr/invalid_repr_list_help.stderr b/tests/ui/repr/invalid_repr_list_help.stderr
index 48a6af3dd..7ffe1287e 100644
--- a/tests/ui/repr/invalid_repr_list_help.stderr
+++ b/tests/ui/repr/invalid_repr_list_help.stderr
@@ -4,7 +4,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:6:8
@@ -12,7 +12,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu = "a")]
| ^^^^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:9:8
@@ -20,7 +20,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu(4))]
| ^^^^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error[E0552]: unrecognized representation hint
--> $DIR/invalid_repr_list_help.rs:14:8
@@ -28,7 +28,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu, u8)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
warning: unknown `doc` attribute `owo`
--> $DIR/invalid_repr_list_help.rs:20:7
@@ -46,7 +46,7 @@ error[E0552]: unrecognized representation hint
LL | #[repr(uwu)]
| ^^^
|
- = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
+ = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
error: aborting due to 5 previous errors; 1 warning emitted
diff --git a/tests/ui/repr/repr-transparent-non-exhaustive.rs b/tests/ui/repr/repr-transparent-non-exhaustive.rs
index 506f1dcf3..84dd3f492 100644
--- a/tests/ui/repr/repr-transparent-non-exhaustive.rs
+++ b/tests/ui/repr/repr-transparent-non-exhaustive.rs
@@ -93,4 +93,44 @@ pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
//~| WARN this was previously accepted by the compiler
+#[repr(transparent)]
+pub struct T17(NonExhaustive, Sized);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T18(NonExhaustive, NonExhaustive);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T19(NonExhaustive, Private);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T19Flipped(Private, NonExhaustive);
+//~^ ERROR zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+//~| WARN this was previously accepted by the compiler
+
+#[repr(transparent)]
+pub struct T20(NonExhaustive);
+// Okay, since it's the only field.
+
+#[repr(transparent)]
+pub struct T21(NonExhaustive, InternalNonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T21Flipped(InternalNonExhaustive, NonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T22(NonExhaustive, InternalPrivate);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
+#[repr(transparent)]
+pub struct T22Flipped(InternalPrivate, NonExhaustive);
+// Okay, since there's only 1 foreign non-exhaustive type.
+
fn main() {}
diff --git a/tests/ui/repr/repr-transparent-non-exhaustive.stderr b/tests/ui/repr/repr-transparent-non-exhaustive.stderr
index 16edf59c7..808b9bc98 100644
--- a/tests/ui/repr/repr-transparent-non-exhaustive.stderr
+++ b/tests/ui/repr/repr-transparent-non-exhaustive.stderr
@@ -123,5 +123,45 @@ LL | pub struct T16(Sized, ExternalIndirection<NonExhaustiveVariant>);
= note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
= note: this enum contains `NonExhaustiveVariant`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
-error: aborting due to 12 previous errors
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:97:16
+ |
+LL | pub struct T17(NonExhaustive, Sized);
+ | ^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:102:31
+ |
+LL | pub struct T18(NonExhaustive, NonExhaustive);
+ | ^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:107:31
+ |
+LL | pub struct T19(NonExhaustive, Private);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `Private`, which contains private fields, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: zero-sized fields in `repr(transparent)` cannot contain external non-exhaustive types
+ --> $DIR/repr-transparent-non-exhaustive.rs:112:32
+ |
+LL | pub struct T19Flipped(Private, NonExhaustive);
+ | ^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #78586 <https://github.com/rust-lang/rust/issues/78586>
+ = note: this struct contains `NonExhaustive`, which is marked with `#[non_exhaustive]`, and makes it not a breaking change to become non-zero-sized in the future.
+
+error: aborting due to 16 previous errors
diff --git a/tests/ui/repr/repr-transparent.rs b/tests/ui/repr/repr-transparent.rs
index 8c9d1639c..87cf59ce9 100644
--- a/tests/ui/repr/repr-transparent.rs
+++ b/tests/ui/repr/repr-transparent.rs
@@ -23,23 +23,26 @@ struct ContainsMultipleZst(PhantomData<*const i32>, NoFields);
struct ContainsZstAndNonZst((), [i32; 2]);
#[repr(transparent)]
-struct MultipleNonZst(u8, u8); //~ ERROR needs at most one non-zero-sized field
+struct MultipleNonZst(u8, u8); //~ ERROR needs at most one field with non-trivial size or alignment
trait Mirror { type It: ?Sized; }
impl<T: ?Sized> Mirror for T { type It = Self; }
#[repr(transparent)]
pub struct StructWithProjection(f32, <f32 as Mirror>::It);
-//~^ ERROR needs at most one non-zero-sized field
+//~^ ERROR needs at most one field with non-trivial size or alignment
#[repr(transparent)]
-struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1
+struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR needs at most one field with non-trivial size or alignment
#[repr(align(32))]
struct ZstAlign32<T>(PhantomData<T>);
#[repr(transparent)]
-struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
+struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR needs at most one field with non-trivial size or alignment
+
+#[repr(transparent)]
+struct WrapsZstWithAlignment([i32; 0]);
#[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum
enum Void {} //~ ERROR transparent enum needs exactly one variant, but has 0
@@ -58,7 +61,7 @@ enum UnitFieldEnum {
enum TooManyFieldsEnum {
Foo(u32, String),
}
-//~^^^ ERROR transparent enum needs at most one non-zero-sized field, but has 2
+//~^^^ ERROR transparent enum needs at most one field with non-trivial size or alignment, but has 2
#[repr(transparent)]
enum MultipleVariants { //~ ERROR transparent enum needs exactly one variant, but has 2
@@ -67,13 +70,13 @@ enum MultipleVariants { //~ ERROR transparent enum needs exactly one variant, bu
}
#[repr(transparent)]
-enum NontrivialAlignZstEnum {
- Foo(u32, [u16; 0]), //~ ERROR alignment larger than 1
+enum NontrivialAlignZstEnum { //~ ERROR needs at most one field with non-trivial size or alignment
+ Foo(u32, [u16; 0]),
}
#[repr(transparent)]
-enum GenericAlignEnum<T> {
- Foo { bar: ZstAlign32<T>, baz: u32 } //~ ERROR alignment larger than 1
+enum GenericAlignEnum<T> { //~ ERROR needs at most one field with non-trivial size or alignment
+ Foo { bar: ZstAlign32<T>, baz: u32 }
}
#[repr(transparent)]
@@ -82,7 +85,7 @@ union UnitUnion {
}
#[repr(transparent)]
-union TooManyFields { //~ ERROR transparent union needs at most one non-zero-sized field, but has 2
+union TooManyFields { //~ ERROR transparent union needs at most one field with non-trivial size or alignment, but has 2
u: u32,
s: i32
}
diff --git a/tests/ui/repr/repr-transparent.stderr b/tests/ui/repr/repr-transparent.stderr
index 028fc25db..d0c78a841 100644
--- a/tests/ui/repr/repr-transparent.stderr
+++ b/tests/ui/repr/repr-transparent.stderr
@@ -1,35 +1,41 @@
-error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
--> $DIR/repr-transparent.rs:26:1
|
LL | struct MultipleNonZst(u8, u8);
- | ^^^^^^^^^^^^^^^^^^^^^ -- -- this field is non-zero-sized
+ | ^^^^^^^^^^^^^^^^^^^^^ -- -- this field has non-zero size or requires alignment
| | |
- | | this field is non-zero-sized
- | needs at most one non-zero-sized field, but has 2
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0690]: transparent struct needs at most one non-zero-sized field, but has 2
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
--> $DIR/repr-transparent.rs:32:1
|
LL | pub struct StructWithProjection(f32, <f32 as Mirror>::It);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- ------------------- this field is non-zero-sized
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- ------------------- this field has non-zero size or requires alignment
| | |
- | | this field is non-zero-sized
- | needs at most one non-zero-sized field, but has 2
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0691]: zero-sized field in transparent struct has alignment larger than 1
- --> $DIR/repr-transparent.rs:36:32
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:36:1
|
LL | struct NontrivialAlignZst(u32, [u16; 0]);
- | ^^^^^^^^ has alignment of 2, which is larger than 1
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ --- -------- this field has non-zero size or requires alignment
+ | | |
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
-error[E0691]: zero-sized field in transparent struct has alignment larger than 1
- --> $DIR/repr-transparent.rs:42:24
+error[E0690]: transparent struct needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:42:1
|
LL | struct GenericAlign<T>(ZstAlign32<T>, u32);
- | ^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
+ | ^^^^^^^^^^^^^^^^^^^^^^ ------------- --- this field has non-zero size or requires alignment
+ | | |
+ | | this field has non-zero size or requires alignment
+ | needs at most one field with non-trivial size or alignment, but has 2
error[E0084]: unsupported representation for zero-variant enum
- --> $DIR/repr-transparent.rs:44:1
+ --> $DIR/repr-transparent.rs:47:1
|
LL | #[repr(transparent)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -37,23 +43,23 @@ LL | enum Void {}
| --------- zero-variant enum
error[E0731]: transparent enum needs exactly one variant, but has 0
- --> $DIR/repr-transparent.rs:45:1
+ --> $DIR/repr-transparent.rs:48:1
|
LL | enum Void {}
| ^^^^^^^^^ needs exactly one variant, but has 0
-error[E0690]: the variant of a transparent enum needs at most one non-zero-sized field, but has 2
- --> $DIR/repr-transparent.rs:58:1
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:61:1
|
LL | enum TooManyFieldsEnum {
- | ^^^^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2
+ | ^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo(u32, String),
- | --- ------ this field is non-zero-sized
+ | --- ------ this field has non-zero size or requires alignment
| |
- | this field is non-zero-sized
+ | this field has non-zero size or requires alignment
error[E0731]: transparent enum needs exactly one variant, but has 2
- --> $DIR/repr-transparent.rs:64:1
+ --> $DIR/repr-transparent.rs:67:1
|
LL | enum MultipleVariants {
| ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2
@@ -62,29 +68,37 @@ LL | Foo(String),
LL | Bar,
| --- too many variants in `MultipleVariants`
-error[E0691]: zero-sized field in transparent enum has alignment larger than 1
- --> $DIR/repr-transparent.rs:71:14
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:73:1
|
+LL | enum NontrivialAlignZstEnum {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo(u32, [u16; 0]),
- | ^^^^^^^^ has alignment of 2, which is larger than 1
+ | --- -------- this field has non-zero size or requires alignment
+ | |
+ | this field has non-zero size or requires alignment
-error[E0691]: zero-sized field in transparent enum has alignment larger than 1
- --> $DIR/repr-transparent.rs:76:11
+error[E0690]: the variant of a transparent enum needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:78:1
|
+LL | enum GenericAlignEnum<T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | Foo { bar: ZstAlign32<T>, baz: u32 }
- | ^^^^^^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
+ | ------------------ -------- this field has non-zero size or requires alignment
+ | |
+ | this field has non-zero size or requires alignment
-error[E0690]: transparent union needs at most one non-zero-sized field, but has 2
- --> $DIR/repr-transparent.rs:85:1
+error[E0690]: transparent union needs at most one field with non-trivial size or alignment, but has 2
+ --> $DIR/repr-transparent.rs:88:1
|
LL | union TooManyFields {
- | ^^^^^^^^^^^^^^^^^^^ needs at most one non-zero-sized field, but has 2
+ | ^^^^^^^^^^^^^^^^^^^ needs at most one field with non-trivial size or alignment, but has 2
LL | u: u32,
- | ------ this field is non-zero-sized
+ | ------ this field has non-zero size or requires alignment
LL | s: i32
- | ------ this field is non-zero-sized
+ | ------ this field has non-zero size or requires alignment
error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0084, E0690, E0691, E0731.
+Some errors have detailed explanations: E0084, E0690, E0731.
For more information about an error, try `rustc --explain E0084`.
diff --git a/tests/ui/resolve/associated-fn-called-as-fn.stderr b/tests/ui/resolve/associated-fn-called-as-fn.stderr
index fbdea30d5..7d28b959a 100644
--- a/tests/ui/resolve/associated-fn-called-as-fn.stderr
+++ b/tests/ui/resolve/associated-fn-called-as-fn.stderr
@@ -2,13 +2,23 @@ error[E0425]: cannot find function `collect_primary` in this scope
--> $DIR/associated-fn-called-as-fn.rs:6:30
|
LL | '0'..='9' => collect_primary(&c),
- | ^^^^^^^^^^^^^^^ help: you might have meant to call the associated function: `Self::collect_primary`
+ | ^^^^^^^^^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | '0'..='9' => Self::collect_primary(&c),
+ | ++++++
error[E0425]: cannot find function `collect_primary` in this scope
--> $DIR/associated-fn-called-as-fn.rs:23:30
|
LL | '0'..='9' => collect_primary(&c),
- | ^^^^^^^^^^^^^^^ help: you might have meant to call the associated function: `Self::collect_primary`
+ | ^^^^^^^^^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | '0'..='9' => Self::collect_primary(&c),
+ | ++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/bad-expr-path.stderr b/tests/ui/resolve/bad-expr-path.stderr
index 411130913..0392c1fa2 100644
--- a/tests/ui/resolve/bad-expr-path.stderr
+++ b/tests/ui/resolve/bad-expr-path.stderr
@@ -16,8 +16,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(Vec<String>)`
+ = note: expected signature `fn()`
+ found signature `fn(Vec<String>)`
error[E0425]: cannot find function `log` in this scope
--> $DIR/bad-expr-path.rs:4:5
diff --git a/tests/ui/resolve/bad-expr-path2.stderr b/tests/ui/resolve/bad-expr-path2.stderr
index af3ca99c5..9238b1f70 100644
--- a/tests/ui/resolve/bad-expr-path2.stderr
+++ b/tests/ui/resolve/bad-expr-path2.stderr
@@ -16,8 +16,8 @@ error[E0580]: `main` function has wrong type
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
- = note: expected fn pointer `fn()`
- found fn pointer `fn(Vec<String>)`
+ = note: expected signature `fn()`
+ found signature `fn(Vec<String>)`
error[E0425]: cannot find function `log` in this scope
--> $DIR/bad-expr-path2.rs:6:5
diff --git a/tests/ui/resolve/bad-type-env-capture.stderr b/tests/ui/resolve/bad-type-env-capture.stderr
index b6282c2d0..941b6b7a6 100644
--- a/tests/ui/resolve/bad-type-env-capture.stderr
+++ b/tests/ui/resolve/bad-type-env-capture.stderr
@@ -1,12 +1,12 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/bad-type-env-capture.rs:2:15
|
LL | fn foo<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(b: T) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to previous error
diff --git a/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
new file mode 100644
index 000000000..b5f139590
--- /dev/null
+++ b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
@@ -0,0 +1,18 @@
+struct Foo {
+ field: u32,
+}
+
+impl Foo {
+ fn field(&self) -> u32 {
+ self.field
+ }
+
+ fn new() -> Foo {
+ field; //~ ERROR cannot find value `field` in this scope
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+ fn clone(&self) -> Foo {
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+}
+fn main() {}
diff --git a/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr
new file mode 100644
index 000000000..3c44c1c24
--- /dev/null
+++ b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.stderr
@@ -0,0 +1,41 @@
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:11:9
+ |
+LL | field: u32,
+ | ---------- a field by that name exists in `Self`
+...
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | field;
+ | ^^^^^
+
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:12:15
+ |
+LL | field: u32,
+ | ---------- a field by that name exists in `Self`
+...
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | Foo { field }
+ | ^^^^^
+
+error[E0425]: cannot find value `field` in this scope
+ --> $DIR/field-and-method-in-self-not-available-in-assoc-fn.rs:15:15
+ |
+LL | fn field(&self) -> u32 {
+ | ----- a method by that name is available on `Self` here
+...
+LL | Foo { field }
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | Foo { field: self.field }
+ | ++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr
new file mode 100644
index 000000000..4f8538292
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.default.stderr
@@ -0,0 +1,28 @@
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:12:20
+ |
+LL | fn outer<T: Tr>() { // outer function
+ | - type parameter from outer item
+LL | const K: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:19:24
+ |
+LL | impl<T> Tr for T { // outer impl block
+ | - type parameter from outer item
+LL | const C: u32 = {
+LL | const I: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:27:20
+ |
+LL | struct S<T: Tr>(U32<{ // outer struct
+ | - type parameter from outer item
+LL | const _: u32 = T::C;
+ | ^^^^ use of generic parameter from outer item
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr
new file mode 100644
index 000000000..1cb55842b
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.generic_const_items.stderr
@@ -0,0 +1,34 @@
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:12:20
+ |
+LL | fn outer<T: Tr>() { // outer function
+ | - type parameter from outer item
+LL | const K: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:19:24
+ |
+LL | impl<T> Tr for T { // outer impl block
+ | - type parameter from outer item
+LL | const C: u32 = {
+LL | const I: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error[E0401]: can't use generic parameters from outer item
+ --> $DIR/generic-params-from-outer-item-in-const-item.rs:27:20
+ |
+LL | struct S<T: Tr>(U32<{ // outer struct
+ | - type parameter from outer item
+LL | const _: u32 = T::C;
+ | - ^^^^ use of generic parameter from outer item
+ | |
+ | help: try introducing a local generic parameter here: `<T>`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs
new file mode 100644
index 000000000..e5647d72c
--- /dev/null
+++ b/tests/ui/resolve/generic-params-from-outer-item-in-const-item.rs
@@ -0,0 +1,39 @@
+// Regression test for issue #115720.
+// If a const item contains generic params from an outer items, only suggest
+// turning the const item generic if the feature `generic_const_items` is enabled.
+
+// revisions: default generic_const_items
+
+#![cfg_attr(generic_const_items, feature(generic_const_items))]
+#![feature(generic_const_exprs)] // only used for the test case "outer struct"
+#![allow(incomplete_features)]
+
+fn outer<T: Tr>() { // outer function
+ const K: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+}
+
+impl<T> Tr for T { // outer impl block
+ const C: u32 = {
+ const I: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+ I
+ };
+}
+
+struct S<T: Tr>(U32<{ // outer struct
+ const _: u32 = T::C;
+ //~^ ERROR can't use generic parameters from outer item
+ //[generic_const_items]~| HELP try introducing a local generic parameter here
+ 0
+}>);
+
+trait Tr {
+ const C: u32;
+}
+
+struct U32<const N: u32>;
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-103474.stderr b/tests/ui/resolve/issue-103474.stderr
index 415d23155..e48fb31ec 100644
--- a/tests/ui/resolve/issue-103474.stderr
+++ b/tests/ui/resolve/issue-103474.stderr
@@ -19,7 +19,7 @@ error[E0425]: cannot find function `first` in this scope
LL | first()
| ^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.first()
| +++++
diff --git a/tests/ui/resolve/issue-12796.rs b/tests/ui/resolve/issue-12796.rs
index 942d6b9a5..de3e73437 100644
--- a/tests/ui/resolve/issue-12796.rs
+++ b/tests/ui/resolve/issue-12796.rs
@@ -1,7 +1,7 @@
trait Trait {
fn outer(&self) {
fn inner(_: &Self) {
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
}
diff --git a/tests/ui/resolve/issue-12796.stderr b/tests/ui/resolve/issue-12796.stderr
index a01fd2d65..ef59d0036 100644
--- a/tests/ui/resolve/issue-12796.stderr
+++ b/tests/ui/resolve/issue-12796.stderr
@@ -1,10 +1,10 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-12796.rs:3:22
|
LL | fn inner(_: &Self) {
| ^^^^
| |
- | use of generic parameter from outer function
+ | use of generic parameter from outer item
| can't use `Self` here
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-14254.stderr b/tests/ui/resolve/issue-14254.stderr
index 690a40f7e..9284b4bab 100644
--- a/tests/ui/resolve/issue-14254.stderr
+++ b/tests/ui/resolve/issue-14254.stderr
@@ -8,13 +8,23 @@ error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:30:9
|
LL | x;
- | ^ help: you might have meant to use the available field: `self.x`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.x;
+ | +++++
error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:32:9
|
LL | y;
- | ^ help: you might have meant to use the available field: `self.y`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.y;
+ | +++++
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:34:9
@@ -31,7 +41,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:38:9
@@ -43,13 +53,23 @@ error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:47:9
|
LL | x;
- | ^ help: you might have meant to use the available field: `self.x`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.x;
+ | +++++
error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:49:9
|
LL | y;
- | ^ help: you might have meant to use the available field: `self.y`
+ | ^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.y;
+ | +++++
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:51:9
@@ -66,7 +86,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:55:9
@@ -83,7 +103,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:73:9
@@ -94,7 +114,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:82:9
@@ -105,7 +125,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:91:9
@@ -116,7 +136,7 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:100:9
@@ -127,55 +147,95 @@ LL | bah;
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:19:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:28:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:45:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:62:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:71:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:80:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:89:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:98:9
|
LL | baz();
- | ^^^ help: you might have meant to call the method: `self.baz`
+ | ^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.baz();
+ | +++++
error: aborting due to 24 previous errors
diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr
index 30f5f0595..5f75ae988 100644
--- a/tests/ui/resolve/issue-2356.stderr
+++ b/tests/ui/resolve/issue-2356.stderr
@@ -1,8 +1,11 @@
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5
|
+LL | whiskers: isize,
+ | --------------- a field by that name exists in `Self`
+...
LL | whiskers -= other;
- | ^^^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^^^
error[E0424]: expected value, found module `self`
--> $DIR/issue-2356.rs:65:8
@@ -21,13 +24,21 @@ error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:79:5
|
LL | whiskers = 0;
- | ^^^^^^^^ help: you might have meant to use the available field: `self.whiskers`
+ | ^^^^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.whiskers = 0;
+ | +++++
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:84:5
|
+LL | whiskers: isize,
+ | --------------- a field by that name exists in `Self`
+...
LL | whiskers = 4;
- | ^^^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^^^
error[E0424]: expected value, found module `self`
--> $DIR/issue-2356.rs:92:5
@@ -47,19 +58,34 @@ error[E0425]: cannot find function `clone` in this scope
--> $DIR/issue-2356.rs:24:5
|
LL | clone();
- | ^^^^^ help: you might have meant to call the method: `self.clone`
+ | ^^^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.clone();
+ | +++++
error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:31:5
|
LL | default();
- | ^^^^^^^ help: you might have meant to call the associated function: `Self::default`
+ | ^^^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | Self::default();
+ | ++++++
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
LL | shave(4);
- | ^^^^^ help: you might have meant to call the associated function: `Self::shave`
+ | ^^^^^
+ |
+help: you might have meant to call the associated function
+ |
+LL | Self::shave(4);
+ | ++++++
error[E0425]: cannot find function `purr` in this scope
--> $DIR/issue-2356.rs:43:5
@@ -73,7 +99,7 @@ error[E0425]: cannot find function `static_method` in this scope
LL | static_method();
| ^^^^^^^^^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::static_method();
| ++++++
@@ -102,7 +128,7 @@ error[E0425]: cannot find function `grow_older` in this scope
LL | grow_older();
| ^^^^^^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::grow_older();
| ++++++
diff --git a/tests/ui/resolve/issue-3021-c.rs b/tests/ui/resolve/issue-3021-c.rs
index 94ed1fdf7..bd21d1244 100644
--- a/tests/ui/resolve/issue-3021-c.rs
+++ b/tests/ui/resolve/issue-3021-c.rs
@@ -1,8 +1,8 @@
fn siphash<T>() {
trait U {
- fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function
- //~^ ERROR can't use generic parameters from outer function
+ fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer item
+ //~^ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/resolve/issue-3021-c.stderr b/tests/ui/resolve/issue-3021-c.stderr
index 5176efc3a..537bbaf7b 100644
--- a/tests/ui/resolve/issue-3021-c.stderr
+++ b/tests/ui/resolve/issue-3021-c.stderr
@@ -1,24 +1,24 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3021-c.rs:4:24
|
LL | fn siphash<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL |
LL | trait U {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | fn g(&self, x: T) -> T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-3021-c.rs:4:30
|
LL | fn siphash<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL |
LL | trait U {
- | - help: try using a local generic parameter instead: `<T>`
+ | - help: try introducing a local generic parameter here: `<T>`
LL | fn g(&self, x: T) -> T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/issue-60057.stderr b/tests/ui/resolve/issue-60057.stderr
index 4d915fcd9..a2ab86443 100644
--- a/tests/ui/resolve/issue-60057.stderr
+++ b/tests/ui/resolve/issue-60057.stderr
@@ -1,14 +1,22 @@
error[E0425]: cannot find value `banana` in this scope
--> $DIR/issue-60057.rs:8:21
|
+LL | banana: u8,
+ | ---------- a field by that name exists in `Self`
+...
LL | banana: banana
- | ^^^^^^ a field by this name exists in `Self`
+ | ^^^^^^
error[E0425]: cannot find value `banana` in this scope
--> $DIR/issue-60057.rs:14:21
|
LL | banana: banana
- | ^^^^^^ help: you might have meant to use the available field: `self.banana`
+ | ^^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | banana: self.banana
+ | +++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs b/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
index ce45f630e..4fa3f12d0 100644
--- a/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
+++ b/tests/ui/resolve/issue-65025-extern-static-parent-generics.rs
@@ -1,7 +1,7 @@
unsafe fn foo<A>() {
extern "C" {
static baz: *const A;
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
let bar: *const u64 = core::mem::transmute(&baz);
diff --git a/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr b/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
index 6bbf76dd1..3e9c3fd11 100644
--- a/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
+++ b/tests/ui/resolve/issue-65025-extern-static-parent-generics.stderr
@@ -1,11 +1,11 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65025-extern-static-parent-generics.rs:3:28
|
LL | unsafe fn foo<A>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | extern "C" {
LL | static baz: *const A;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-65035-static-with-parent-generics.rs b/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
index f96c04841..bc99584a8 100644
--- a/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
+++ b/tests/ui/resolve/issue-65035-static-with-parent-generics.rs
@@ -1,26 +1,26 @@
fn f<T>() {
extern "C" {
static a: *const T;
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
fn g<T: Default>() {
static a: *const T = Default::default();
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
fn h<const N: usize>() {
extern "C" {
static a: [u8; N];
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
fn i<const N: usize>() {
static a: [u8; N] = [0; N];
- //~^ ERROR can't use generic parameters from outer function
- //~| ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
+ //~| ERROR can't use generic parameters from outer item
}
fn main() {}
diff --git a/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr b/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
index 7ed572f80..f1fe1a600 100644
--- a/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
+++ b/tests/ui/resolve/issue-65035-static-with-parent-generics.stderr
@@ -1,44 +1,44 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:3:26
|
LL | fn f<T>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | extern "C" {
LL | static a: *const T;
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:9:22
|
LL | fn g<T: Default>() {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | static a: *const T = Default::default();
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:15:24
|
LL | fn h<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | extern "C" {
LL | static a: [u8; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:21:20
|
LL | fn i<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | static a: [u8; N] = [0; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/issue-65035-static-with-parent-generics.rs:21:29
|
LL | fn i<const N: usize>() {
- | - const parameter from outer function
+ | - const parameter from outer item
LL | static a: [u8; N] = [0; N];
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
error: aborting due to 5 previous errors
diff --git a/tests/ui/issues/issue-6642.rs b/tests/ui/resolve/issue-6642.rs
index f80f6fffe..f80f6fffe 100644
--- a/tests/ui/issues/issue-6642.rs
+++ b/tests/ui/resolve/issue-6642.rs
diff --git a/tests/ui/issues/issue-6642.stderr b/tests/ui/resolve/issue-6642.stderr
index 6668108d0..6668108d0 100644
--- a/tests/ui/issues/issue-6642.stderr
+++ b/tests/ui/resolve/issue-6642.stderr
diff --git a/tests/ui/resolve/resolve-assoc-suggestions.stderr b/tests/ui/resolve/resolve-assoc-suggestions.stderr
index 8def9aa20..3d9d4ffaa 100644
--- a/tests/ui/resolve/resolve-assoc-suggestions.stderr
+++ b/tests/ui/resolve/resolve-assoc-suggestions.stderr
@@ -14,13 +14,23 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-assoc-suggestions.rs:20:9
|
LL | field;
- | ^^^^^ help: you might have meant to use the available field: `self.field`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.field;
+ | +++++
error[E0412]: cannot find type `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:23:16
|
LL | let _: Type;
- | ^^^^ help: you might have meant to use the associated type: `Self::Type`
+ | ^^^^
+ |
+help: you might have meant to use the associated type
+ |
+LL | let _: Self::Type;
+ | ++++++
error[E0531]: cannot find tuple struct or tuple variant `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:25:13
@@ -50,7 +60,12 @@ error[E0425]: cannot find value `method` in this scope
--> $DIR/resolve-assoc-suggestions.rs:34:9
|
LL | method;
- | ^^^^^^ help: you might have meant to refer to the method: `self.method`
+ | ^^^^^^
+ |
+help: you might have meant to refer to the method
+ |
+LL | self.method;
+ | +++++
error: aborting due to 9 previous errors
diff --git a/tests/ui/resolve/resolve-speculative-adjustment.stderr b/tests/ui/resolve/resolve-speculative-adjustment.stderr
index be11a7ebe..fb15472bd 100644
--- a/tests/ui/resolve/resolve-speculative-adjustment.stderr
+++ b/tests/ui/resolve/resolve-speculative-adjustment.stderr
@@ -8,13 +8,23 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-speculative-adjustment.rs:23:9
|
LL | field;
- | ^^^^^ help: you might have meant to use the available field: `self.field`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.field;
+ | +++++
error[E0425]: cannot find function `method` in this scope
--> $DIR/resolve-speculative-adjustment.rs:25:9
|
LL | method();
- | ^^^^^^ help: you might have meant to call the method: `self.method`
+ | ^^^^^^
+ |
+help: you might have meant to call the method
+ |
+LL | self.method();
+ | +++++
error[E0425]: cannot find function `method` in this scope
--> $DIR/resolve-speculative-adjustment.rs:19:13
diff --git a/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs b/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
index c77a66524..2d5f34c62 100644
--- a/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
+++ b/tests/ui/resolve/resolve-type-param-in-item-in-trait.rs
@@ -6,7 +6,7 @@ trait TraitA<A> {
fn outer(&self) {
enum Foo<B> {
Variance(A)
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
}
@@ -14,21 +14,21 @@ trait TraitA<A> {
trait TraitB<A> {
fn outer(&self) {
struct Foo<B>(A);
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
trait TraitC<A> {
fn outer(&self) {
struct Foo<B> { a: A }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
trait TraitD<A> {
fn outer(&self) {
fn foo<B>(a: A) { }
- //~^ ERROR can't use generic parameters from outer function
+ //~^ ERROR can't use generic parameters from outer item
}
}
diff --git a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
index 0a6d1cc3b..1ab56fdc5 100644
--- a/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
+++ b/tests/ui/resolve/resolve-type-param-in-item-in-trait.stderr
@@ -1,46 +1,46 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:8:22
|
LL | trait TraitA<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | enum Foo<B> {
- | - help: try using a local generic parameter instead: `A,`
+ | - help: try introducing a local generic parameter here: `A,`
LL | Variance(A)
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:16:23
|
LL | trait TraitB<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | struct Foo<B>(A);
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:23:28
|
LL | trait TraitC<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | struct Foo<B> { a: A }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/resolve-type-param-in-item-in-trait.rs:30:22
|
LL | trait TraitD<A> {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn outer(&self) {
LL | fn foo<B>(a: A) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `A,`
+ | help: try introducing a local generic parameter here: `A,`
error: aborting due to 4 previous errors
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed
new file mode 100644
index 000000000..fc68884fe
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed
@@ -0,0 +1,16 @@
+// run-rustfix
+// compile-flags: --cfg=whatever -Aunused
+
+use y::z;
+#[cfg(whatever)]
+use y::Whatever;
+
+mod y {
+ pub(crate) fn z() {}
+ pub(crate) struct Whatever;
+}
+
+fn main() {
+ z();
+ //~^ ERROR cannot find function `z` in this scope
+}
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs
new file mode 100644
index 000000000..38a109570
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+// compile-flags: --cfg=whatever -Aunused
+
+#[cfg(whatever)]
+use y::Whatever;
+
+mod y {
+ pub(crate) fn z() {}
+ pub(crate) struct Whatever;
+}
+
+fn main() {
+ z();
+ //~^ ERROR cannot find function `z` in this scope
+}
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr
new file mode 100644
index 000000000..d3574851d
--- /dev/null
+++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find function `z` in this scope
+ --> $DIR/suggest-import-without-clobbering-attrs.rs:13:5
+ |
+LL | z();
+ | ^ not found in this scope
+ |
+help: consider importing this function
+ |
+LL + use y::z;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
index f32e0404e..0306c8af8 100644
--- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
+++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr
@@ -1,20 +1,20 @@
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:7:16
|
+LL | config: String,
+ | -------------- a field by that name exists in `Self`
+...
LL | Self { config }
- | ^^^^^^
- | |
- | a field by this name exists in `Self`
- | help: a local variable with a similar name exists: `cofig`
+ | ^^^^^^ help: a local variable with a similar name exists: `cofig`
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:11:20
|
+LL | config: String,
+ | -------------- a field by that name exists in `Self`
+...
LL | println!("{config}");
- | ^^^^^^
- | |
- | a field by this name exists in `Self`
- | help: a local variable with a similar name exists: `cofig`
+ | ^^^^^^ help: a local variable with a similar name exists: `cofig`
error[E0425]: cannot find value `config` in this scope
--> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:15:20
@@ -25,7 +25,7 @@ LL | println!("{config}");
help: you might have meant to use the available field
|
LL | println!("{self.config}");
- | ~~~~~~~~~~~
+ | +++++
help: a local variable with a similar name exists
|
LL | println!("{cofig}");
@@ -43,7 +43,7 @@ LL | fn ba() {}
help: you might have meant to refer to the associated function
|
LL | Self::bah;
- | ~~~~~~~~~
+ | ++++++
help: a function with a similar name exists
|
LL | ba;
@@ -61,7 +61,7 @@ LL | const BARR: u32 = 3;
help: you might have meant to use the associated `const`
|
LL | Self::BAR;
- | ~~~~~~~~~
+ | ++++++
help: a constant with a similar name exists
|
LL | BARR;
@@ -79,7 +79,7 @@ LL | type Bar = String;
help: you might have meant to use the associated type
|
LL | let foo: Self::Baz = "".to_string();
- | ~~~~~~~~~
+ | ++++++
help: a type alias with a similar name exists
|
LL | let foo: Bar = "".to_string();
@@ -97,7 +97,7 @@ LL | fn ba() {}
help: you might have meant to call the method
|
LL | self.baz();
- | ~~~~~~~~
+ | +++++
help: a function with a similar name exists
|
LL | ba();
diff --git a/tests/ui/resolve/unresolved_static_type_field.stderr b/tests/ui/resolve/unresolved_static_type_field.stderr
index 06926b53d..035dc9b96 100644
--- a/tests/ui/resolve/unresolved_static_type_field.stderr
+++ b/tests/ui/resolve/unresolved_static_type_field.stderr
@@ -1,8 +1,11 @@
error[E0425]: cannot find value `cx` in this scope
--> $DIR/unresolved_static_type_field.rs:9:11
|
+LL | cx: bool,
+ | -------- a field by that name exists in `Self`
+...
LL | f(cx);
- | ^^ a field by this name exists in `Self`
+ | ^^
error: aborting due to previous error
diff --git a/tests/ui/resolve/use-self-in-inner-fn.rs b/tests/ui/resolve/use-self-in-inner-fn.rs
index eccb315fe..f4dfa4c40 100644
--- a/tests/ui/resolve/use-self-in-inner-fn.rs
+++ b/tests/ui/resolve/use-self-in-inner-fn.rs
@@ -4,9 +4,9 @@ impl A {
//~^ NOTE `Self` type implicitly declared here, by this `impl`
fn banana(&mut self) {
fn peach(this: &Self) {
- //~^ ERROR can't use generic parameters from outer function
- //~| NOTE use of generic parameter from outer function
- //~| NOTE use a type here instead
+ //~^ ERROR can't use generic parameters from outer item
+ //~| NOTE use of generic parameter from outer item
+ //~| NOTE refer to the type directly here instead
}
}
}
diff --git a/tests/ui/resolve/use-self-in-inner-fn.stderr b/tests/ui/resolve/use-self-in-inner-fn.stderr
index 966093499..832aaacaf 100644
--- a/tests/ui/resolve/use-self-in-inner-fn.stderr
+++ b/tests/ui/resolve/use-self-in-inner-fn.stderr
@@ -1,4 +1,4 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/use-self-in-inner-fn.rs:6:25
|
LL | impl A {
@@ -7,8 +7,8 @@ LL | impl A {
LL | fn peach(this: &Self) {
| ^^^^
| |
- | use of generic parameter from outer function
- | use a type here instead
+ | use of generic parameter from outer item
+ | refer to the type directly here instead
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
index 872cb9b8b..4e7f3098a 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum.stderr
@@ -28,7 +28,8 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
+ = note: `NonExhaustiveEnum` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ NonExhaustiveEnum::Struct { .. } => "third",
@@ -46,7 +47,7 @@ note: `NonExhaustiveEnum` defined here
|
LL | pub enum NonExhaustiveEnum {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: the matched value is of type `NonExhaustiveEnum`, which is marked as non-exhaustive
+ = note: the matched value is of type `NonExhaustiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ match enum_unit {
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
index 0cab47170..f0e111b57 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs
@@ -1,7 +1,7 @@
#![feature(start)]
#[start]
-#[track_caller] //~ ERROR `start` is not allowed to be `#[track_caller]`
+#[track_caller] //~ ERROR `#[start]` function is not allowed to be `#[track_caller]`
fn start(_argc: isize, _argv: *const *const u8) -> isize {
panic!("{}: oh no", std::panic::Location::caller());
}
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
index 454c98ff9..b6ef62152 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
+++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr
@@ -1,10 +1,10 @@
-error: `start` is not allowed to be `#[track_caller]`
+error: `#[start]` function is not allowed to be `#[track_caller]`
--> $DIR/error-with-start.rs:4:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize {
- | -------------------------------------------------------- `start` is not allowed to be `#[track_caller]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to be `#[track_caller]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
new file mode 100644
index 000000000..5c42c0d8b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs
@@ -0,0 +1,26 @@
+// Ensure if let guards can be used in constant expressions.
+// build-pass
+
+#![feature(if_let_guard)]
+
+const fn match_if_let(x: Option<i32>, y: Option<i32>) -> i32 {
+ match x {
+ None if let Some(a @ 5) = y => a,
+ Some(z) if let (Some(_), 12) = (y, z) => 2,
+ _ => 3,
+ }
+}
+
+const ASSERTS: usize = {
+ assert!(match_if_let(None, Some(5)) == 5);
+ assert!(match_if_let(Some(12), Some(3)) == 2);
+ assert!(match_if_let(None, Some(4)) == 3);
+ assert!(match_if_let(Some(11), Some(3)) == 3);
+ assert!(match_if_let(Some(12), None) == 3);
+ assert!(match_if_let(None, None) == 3);
+ 0
+};
+
+fn main() {
+ let _: [(); ASSERTS];
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
new file mode 100644
index 000000000..b4eb54139
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs
@@ -0,0 +1,18 @@
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn match_option(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => {}
+ None if let y = x => {}
+ }
+}
+
+fn main() {
+ let x = ();
+ match x {
+ //~^ ERROR non-exhaustive patterns: `()` not covered
+ y if let z = y => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
new file mode 100644
index 000000000..ddd08854f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr
@@ -0,0 +1,35 @@
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/exhaustive.rs:5:11
+ |
+LL | match x {
+ | ^ pattern `None` not covered
+ |
+note: `Option<u32>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<u32>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ None if let y = x => {},
+LL + None => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `()` not covered
+ --> $DIR/exhaustive.rs:14:11
+ |
+LL | match x {
+ | ^ pattern `()` not covered
+ |
+ = note: the matched value is of type `()`
+ = note: match arms with guards don't count towards exhaustivity
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ y if let z = y => {},
+LL + () => todo!()
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
index 3beb20f0a..b8c0eb3e6 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs
@@ -8,14 +8,10 @@ fn _if_let_guard() {
//~^ ERROR `if let` guards are experimental
() if (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (((let 0 = 1))) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && let 0 = 1 => {}
//~^ ERROR `if let` guards are experimental
@@ -26,36 +22,22 @@ fn _if_let_guard() {
//~| ERROR `let` expressions in this position are unstable
() if (let 0 = 1) && true => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if true && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
() if (let 0 = 1) && (let 0 = 1) => {}
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
//~^ ERROR `if let` guards are experimental
//~| ERROR `let` expressions in this position are unstable
//~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
- //~| ERROR `let` expressions in this position are unstable
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
() if let Range { start: _, end: _ } = (true..true) && false => {}
@@ -76,13 +58,9 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable
- //~| ERROR expected expression, found `let` statement
- //~| ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
match () {
#[cfg(FALSE)]
() if let 0 = 1 => {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
index dc182ce46..62534b555 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr
@@ -2,87 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:10:16
|
LL | () if (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:15:18
- |
-LL | () if (((let 0 = 1))) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:33:24
- |
-LL | () if true && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:16
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:38:31
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:82:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:92:15
- |
-LL | macro_rules! use_expr {
- | --------------------- when calling this macro
-...
-LL | use_expr!(let 0 = 1);
- | ^^^ no rules expected this token in macro call
- |
-note: while trying to match meta-variable `$e:expr`
- --> $DIR/feature-gate.rs:71:10
- |
-LL | ($e:expr) => {
- | ^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -92,135 +11,140 @@ note: `let`s wrapped in parentheses are not supported in a context with let chai
LL | () if (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:15:18
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:13:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:15:18
+ --> $DIR/feature-gate.rs:13:18
|
LL | () if (((let 0 = 1))) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:28:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:24:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:28:16
+ --> $DIR/feature-gate.rs:24:16
|
LL | () if (let 0 = 1) && true => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:33:24
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:27:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:33:24
+ --> $DIR/feature-gate.rs:27:24
|
LL | () if true && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:38:16
+ --> $DIR/feature-gate.rs:30:16
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:38:31
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:30:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:38:31
+ --> $DIR/feature-gate.rs:30:31
|
LL | () if (let 0 = 1) && (let 0 = 1) => {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:42
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:55
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:55
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:46:68
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:34:68
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:46:42
+ --> $DIR/feature-gate.rs:34:42
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:78:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:60:16
|
LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/feature-gate.rs:82:16
+error: expected expression, found `let` statement
+ --> $DIR/feature-gate.rs:62:16
|
LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/feature-gate.rs:82:16
+
+error: no rules expected the token `let`
+ --> $DIR/feature-gate.rs:70:15
|
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
+LL | macro_rules! use_expr {
+ | --------------------- when calling this macro
+...
+LL | use_expr!(let 0 = 1);
+ | ^^^ no rules expected this token in macro call
+ |
+note: while trying to match meta-variable `$e:expr`
+ --> $DIR/feature-gate.rs:53:10
+ |
+LL | ($e:expr) => {
+ | ^^^^^^^
error[E0658]: `if let` guards are experimental
--> $DIR/feature-gate.rs:7:12
@@ -233,7 +157,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:20:12
+ --> $DIR/feature-gate.rs:16:12
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -243,7 +167,7 @@ LL | () if true && let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:24:12
+ --> $DIR/feature-gate.rs:20:12
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^^^^^^^^^^^^
@@ -253,7 +177,7 @@ LL | () if let 0 = 1 && true => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:46:12
+ --> $DIR/feature-gate.rs:34:12
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -263,7 +187,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:61:12
+ --> $DIR/feature-gate.rs:43:12
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -273,7 +197,7 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `if let` guards are experimental
- --> $DIR/feature-gate.rs:88:12
+ --> $DIR/feature-gate.rs:66:12
|
LL | () if let 0 = 1 => {}
| ^^^^^^^^^^^^
@@ -283,25 +207,7 @@ LL | () if let 0 = 1 => {}
= help: you can write `if matches!(<expr>, <pattern>)` instead of `if let <pattern> = <expr>`
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:10:16
- |
-LL | () if (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:15:18
- |
-LL | () if (((let 0 = 1))) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:20:23
+ --> $DIR/feature-gate.rs:16:23
|
LL | () if true && let 0 = 1 => {}
| ^^^^^^^^^
@@ -310,7 +216,7 @@ LL | () if true && let 0 = 1 => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:24:15
+ --> $DIR/feature-gate.rs:20:15
|
LL | () if let 0 = 1 && true => {}
| ^^^^^^^^^
@@ -319,43 +225,7 @@ LL | () if let 0 = 1 && true => {}
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:28:16
- |
-LL | () if (let 0 = 1) && true => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:33:24
- |
-LL | () if true && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:38:16
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:38:31
- |
-LL | () if (let 0 = 1) && (let 0 = 1) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:15
+ --> $DIR/feature-gate.rs:34:15
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -364,7 +234,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:28
+ --> $DIR/feature-gate.rs:34:28
|
LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
| ^^^^^^^^^
@@ -373,34 +243,7 @@ LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 =
= help: add `#![feature(let_chains)]` to the crate attributes to enable
error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:42
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:55
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:46:68
- |
-LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {}
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:61:15
+ --> $DIR/feature-gate.rs:43:15
|
LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -408,24 +251,6 @@ LL | () if let Range { start: _, end: _ } = (true..true) && false => {}
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:78:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:82:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 45 previous errors
+error: aborting due to 23 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
new file mode 100644
index 000000000..792225e65
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs
@@ -0,0 +1,15 @@
+// References to by-move bindings in an if-let guard *cannot* be used after the guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(mut y) if let Some(ref z) = y => {
+ //~^ ERROR: cannot move out of `x.0` because it is borrowed
+ let _z: &String = z;
+ let _y: Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
new file mode 100644
index 000000000..b8e1bb324
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr
@@ -0,0 +1,15 @@
+error[E0505]: cannot move out of `x.0` because it is borrowed
+ --> $DIR/guard-lifetime-1.rs:8:14
+ |
+LL | Some(mut y) if let Some(ref z) = y => {
+ | ^^^^^
+ | |
+ | move out of `x.0` occurs here
+ | borrow of `x.0` occurs here
+LL |
+LL | let _z: &String = z;
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
new file mode 100644
index 000000000..aa2154e3e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs
@@ -0,0 +1,16 @@
+// References to by-mutable-ref bindings in an if-let guard *can* be used after the guard.
+
+// check-pass
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<String>> = Some(Some(String::new()));
+ match x {
+ Some(ref mut y) if let Some(ref z) = *y => {
+ let _z: &String = z;
+ let _y: &mut Option<String> = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
new file mode 100644
index 000000000..9353c9d92
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs
@@ -0,0 +1,14 @@
+// Check mutable bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(mut y) if let Some(ref mut z) = y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
new file mode 100644
index 000000000..009d15338
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-1.rs:8:33
+ |
+LL | Some(mut y) if let Some(ref mut z) = y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
new file mode 100644
index 000000000..4efa02f57
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs
@@ -0,0 +1,14 @@
+// Check mutable reference bindings cannot be mutated by an if-let guard.
+
+#![feature(if_let_guard)]
+
+fn main() {
+ let mut x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(ref mut y) if let Some(ref mut z) = *y => {
+ //~^ ERROR cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ let _: &mut i32 = z;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
new file mode 100644
index 000000000..07e7c6a2c
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard
+ --> $DIR/guard-mutability-2.rs:8:37
+ |
+LL | Some(ref mut y) if let Some(ref mut z) = *y => {
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = note: variables bound in patterns are immutable until the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
new file mode 100644
index 000000000..423a2cd53
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs
@@ -0,0 +1,16 @@
+// Expression macros can't expand to a let match guard.
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ ($e:expr) => { let Some(x) = $e }
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn main() {
+ match () {
+ () if m!(Some(5)) => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
new file mode 100644
index 000000000..00c1c303d
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr
@@ -0,0 +1,14 @@
+error: expected expression, found `let` statement
+ --> $DIR/macro-expanded.rs:7:20
+ |
+LL | ($e:expr) => { let Some(x) = $e }
+ | ^^^
+...
+LL | () if m!(Some(5)) => {}
+ | ----------- in this macro invocation
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+ = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
new file mode 100644
index 000000000..5c333cd77
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs
@@ -0,0 +1,97 @@
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => (),
+ (1, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn same_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn different_patterns(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if let y = x && c => (),
+ (_, 2) if let z = x => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn different_patterns_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) if c && let y = x => (),
+ (_, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x && c => (), //~ ERROR use of moved value: `x`
+ _ => (),
+ }
+}
+
+fn or_pattern_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if c && let y = x => (),
+ _ => (),
+ }
+}
+
+fn use_in_arm(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x && c => false,
+ _ => { *x == 1 }, //~ ERROR use of moved value: `x`
+ };
+}
+
+fn use_in_arm_ok(c: bool) {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if c && let y = x => false,
+ _ => { *x == 1 },
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
new file mode 100644
index 000000000..d27fde582
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
@@ -0,0 +1,67 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:12:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => (),
+ | - value moved here
+LL | (1, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:36:27
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) if let y = x && c => (),
+ | - value moved here
+LL | (_, 2) if let z = x => (),
+ | ^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:59:36
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) | (_, 2) if let y = x && c => (),
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, _) | (_, 2) if let ref y = x && c => (),
+ | +++
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-if-let-chain.rs:82:16
+ |
+LL | let x: Box<_> = Box::new(1);
+ | - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if let y = x && c => false,
+ | - value moved here
+LL | _ => { *x == 1 },
+ | ^^ value used here after move
+ |
+help: borrow this binding in the pattern to avoid moving the value
+ |
+LL | (1, 2) if let ref y = x && c => false,
+ | +++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
new file mode 100644
index 000000000..071b86e2e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs
@@ -0,0 +1,41 @@
+// Check that borrowck knows that moves in the pattern for if-let guards
+// only happen when the pattern is matched.
+
+// build-pass
+
+#![feature(if_let_guard)]
+#![allow(irrefutable_let_patterns)]
+
+fn same_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => (),
+ (1, 2) if let z = x => (),
+ _ => (),
+ }
+}
+
+fn or_pattern() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, _) | (_, 2) if let y = x => (),
+ _ => (),
+ }
+}
+
+fn main() {
+ let x: Box<_> = Box::new(1);
+
+ let v = (1, 2);
+
+ match v {
+ (1, 2) if let y = x => false,
+ _ => { *x == 1 },
+ };
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
new file mode 100644
index 000000000..f12824db9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs
@@ -0,0 +1,25 @@
+// Parenthesised let "expressions" are not allowed in guards
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+#[cfg(FALSE)]
+fn un_cfged() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
+
+fn main() {
+ match () {
+ () if let 0 = 1 => {}
+ () if (let 0 = 1) => {}
+ //~^ ERROR expected expression, found `let` statement
+ () if (((let 0 = 1))) => {}
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
new file mode 100644
index 000000000..0c16d9c54
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr
@@ -0,0 +1,54 @@
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:10:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:10:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:12:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:12:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:20:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:20:16
+ |
+LL | () if (let 0 = 1) => {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/parens.rs:22:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/parens.rs:22:18
+ |
+LL | () if (((let 0 = 1))) => {}
+ | ^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
new file mode 100644
index 000000000..d91b3a358
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
@@ -0,0 +1,18 @@
+// Macros can be used for (parts of) the pattern and expression in an if let guard
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+macro_rules! m {
+ (pattern $i:ident) => { Some($i) };
+ (expression $e:expr) => { $e };
+}
+
+fn main() {
+ match () {
+ () if let m!(pattern x) = m!(expression Some(4)) => {}
+ () if let [m!(pattern y)] = [Some(8 + m!(expression 4))] => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
new file mode 100644
index 000000000..dba292ef9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs
@@ -0,0 +1,23 @@
+// Check shadowing in if let guards works as expected.
+// check-pass
+
+#![feature(if_let_guard)]
+#![feature(let_chains)]
+
+fn main() {
+ let x: Option<Option<i32>> = Some(Some(6));
+ match x {
+ Some(x) if let Some(x) = x => {
+ let _: i32 = x;
+ }
+ _ => {}
+ }
+
+ let y: Option<Option<Option<i32>>> = Some(Some(Some(-24)));
+ match y {
+ Some(y) if let Some(y) = y && let Some(y) = y => {
+ let _: i32 = y;
+ }
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
new file mode 100644
index 000000000..ef7a772e6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(if_let_guard)]
+
+struct S;
+
+fn get<T>() -> Option<T> {
+ None
+}
+
+fn main() {
+ match get() {
+ x if let Some(S) = x => {}
+ _ => {}
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
index b0ac5dc44..e08ffe42d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr
@@ -13,7 +13,6 @@ LL | let foo: fn() = foo;
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
index 50e8ce2fd..221c0416d 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs
@@ -5,5 +5,5 @@
#[start]
#[target_feature(enable = "avx2")]
-//~^ ERROR `start` is not allowed to have `#[target_feature]`
+//~^ ERROR `#[start]` function is not allowed to have `#[target_feature]`
fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
index 07687f3c7..b49f8afd9 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr
@@ -1,11 +1,11 @@
-error: `start` is not allowed to have `#[target_feature]`
+error: `#[start]` function is not allowed to have `#[target_feature]`
--> $DIR/issue-108645-target-feature-on-start.rs:7:1
|
LL | #[target_feature(enable = "avx2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 }
- | -------------------------------------------------------- `start` is not allowed to have `#[target_feature]`
+ | -------------------------------------------------------- `#[start]` function is not allowed to have `#[target_feature]`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
deleted file mode 100644
index f8e033937..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// compile-flags:--extern му_сгате
-// edition:2018
-
-use му_сгате::baz; //~ ERROR cannot load a crate with a non-ascii name `му_сгате`
-
-fn main() {}
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
deleted file mode 100644
index 05fc4fb22..000000000
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: cannot load a crate with a non-ascii name `му_сгате`
- --> $DIR/crate_name_nonascii_forbidden-2.rs:4:5
- |
-LL | use му_сгате::baz;
- | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
index c07ba54af..c07ba54af 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.rs
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.rs
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
index a8f3abe59..5aade17cb 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden-1.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/crate_name_nonascii_forbidden.stderr
@@ -1,5 +1,5 @@
error: cannot load a crate with a non-ascii name `ьаг`
- --> $DIR/crate_name_nonascii_forbidden-1.rs:1:1
+ --> $DIR/crate_name_nonascii_forbidden.rs:1:1
|
LL | extern crate ьаг;
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
index e6dee2a1d..cb3be59be 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.rs
@@ -3,7 +3,7 @@
fn let_or_guard(x: Result<Option<i32>, ()>) {
match x {
Ok(opt) if let Some(4) = opt || false => {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
_ => {}
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
index 26850998c..4b85fdd50 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ast-validate-guards.stderr
@@ -1,4 +1,4 @@
-error: `let` expressions are not supported here
+error: expected expression, found `let` statement
--> $DIR/ast-validate-guards.rs:5:20
|
LL | Ok(opt) if let Some(4) = opt || false => {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
new file mode 100644
index 000000000..530458064
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs
@@ -0,0 +1,14 @@
+// Regression test for #104172
+
+const N: usize = {
+ struct U;
+ !let y = 42;
+ //~^ ERROR expected expression, found `let` statement
+ 3
+};
+
+struct S {
+ x: [(); N]
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
new file mode 100644
index 000000000..3eaccde3b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.stderr
@@ -0,0 +1,10 @@
+error: expected expression, found `let` statement
+ --> $DIR/avoid-invalid-mir.rs:5:6
+ |
+LL | !let y = 42;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
index e0dded152..2c0571a7b 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.rs
@@ -1,19 +1,18 @@
+// check-pass
+
fn and_chain() {
let z;
if true && { z = 3; true} && z == 3 {}
- //~^ ERROR E0381
}
fn and_chain_2() {
let z;
true && { z = 3; true} && z == 3;
- //~^ ERROR E0381
}
fn or_chain() {
let z;
if false || { z = 3; false} || z == 3 {}
- //~^ ERROR E0381
}
fn main() {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
deleted file mode 100644
index 30d5a6779..000000000
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/chains-without-let.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:3:34
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if true && { z = 3; true} && z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:9:31
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | true && { z = 3; true} && z == 3;
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error[E0381]: used binding `z` is possibly-uninitialized
- --> $DIR/chains-without-let.rs:15:36
- |
-LL | let z;
- | - binding declared here but left uninitialized
-LL | if false || { z = 3; false} || z == 3 {}
- | ----- ^ `z` used here but it is possibly-uninitialized
- | |
- | binding initialized here in some conditions
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0381`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
new file mode 100644
index 000000000..096036bb1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs
@@ -0,0 +1,340 @@
+// Check that we don't suggest enabling a feature for code that's
+// not accepted even with that feature.
+
+#![allow(irrefutable_let_patterns)]
+
+use std::ops::Range;
+
+fn main() {}
+
+fn _if() {
+ if (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _while() {
+ while (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (((let 0 = 1))) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && true {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while (let 0 = 1) && (let 0 = 1) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+}
+
+fn _macros() {
+ macro_rules! use_expr {
+ ($e:expr) => {
+ if $e {}
+ while $e {}
+ }
+ }
+ use_expr!((let 0 = 1 && 0 == 0));
+ //~^ ERROR expected expression, found `let` statement
+ use_expr!((let 0 = 1));
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_if_expr() {
+ if &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ if let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ if (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ if (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ if x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ if true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ if (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ if let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ if let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ if let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ if let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ if let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn nested_within_while_expr() {
+ while &let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while !let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while *let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while -let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ while let 0 = 0? {}
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ while (let 0 = 0)? {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true || let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+ while (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true && (true || let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while true || (true && let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ while x = let 0 = 0 {}
+ //~^ ERROR expected expression, found `let` statement
+
+ while true..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while ..(let 0 = 0) {}
+ //~^ ERROR expected expression, found `let` statement
+ while (let 0 = 0).. {}
+ //~^ ERROR expected expression, found `let` statement
+
+ // Binds as `(let ... = true)..true &&/|| false`.
+ while let Range { start: _, end: _ } = true..true && false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+ while let Range { start: _, end: _ } = true..true || false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: F, end } = F)..(|| true)`.
+ const F: fn() -> bool = || true;
+ while let Range { start: F, end } = F..|| true {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ // Binds as `(let Range { start: true, end } = t)..(&&false)`.
+ let t = &&true;
+ while let Range { start: true, end } = t..&&false {}
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR mismatched types
+
+ while let true = let true = true {}
+ //~^ ERROR expected expression, found `let` statement
+}
+
+fn not_error_because_clarified_intent() {
+ if let Range { start: _, end: _ } = (true..true || false) { }
+
+ if let Range { start: _, end: _ } = (true..true && false) { }
+
+ while let Range { start: _, end: _ } = (true..true || false) { }
+
+ while let Range { start: _, end: _ } = (true..true && false) { }
+}
+
+fn outside_if_and_while_expr() {
+ &let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ !let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ *let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ -let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ let _ = let _ = 3;
+ //~^ ERROR expected expression, found `let` statement
+
+ fn _check_try_binds_tighter() -> Result<(), ()> {
+ let 0 = 0?;
+ //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+ Ok(())
+ }
+ (let 0 = 0)?;
+ //~^ ERROR expected expression, found `let` statement
+
+ true || let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+ (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ true && (true || let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+
+ let mut x = true;
+ x = let 0 = 0;
+ //~^ ERROR expected expression, found `let` statement
+
+ true..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ ..(let 0 = 0);
+ //~^ ERROR expected expression, found `let` statement
+ (let 0 = 0)..;
+ //~^ ERROR expected expression, found `let` statement
+
+ (let Range { start: _, end: _ } = true..true || false);
+ //~^ ERROR mismatched types
+ //~| ERROR expected expression, found `let` statement
+
+ (let true = let true = true);
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+
+ {
+ #[cfg(FALSE)]
+ let x = true && let y = 1;
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ {
+ [1, 2, 3][let _ = ()]
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ // Check function tail position.
+ &let 0 = 0
+ //~^ ERROR expected expression, found `let` statement
+}
+
+// Let's make sure that `let` inside const generic arguments are considered.
+fn inside_const_generic_arguments() {
+ struct A<const B: bool>;
+ impl<const B: bool> A<{B}> { const O: u32 = 5; }
+
+ if let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ while let A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O = 5 {}
+
+ if A::<{
+ true && let 1 = 1
+ //~^ ERROR expected expression, found `let` statement
+ }>::O == 5 {}
+
+ // In the cases above we have `ExprKind::Block` to help us out.
+ // Below however, we would not have a block and so an implementation might go
+ // from visiting expressions to types without banning `let` expressions down the tree.
+ // This tests ensures that we are not caught by surprise should the parser
+ // admit non-IDENT expressions in const generic arguments.
+
+ if A::<
+ true && let 1 = 1
+ //~^ ERROR expressions must be enclosed in braces
+ //~| ERROR expected expression, found `let` statement
+ >::O == 5 {}
+}
+
+fn with_parenthesis() {
+ let opt = Some(Some(1i32));
+
+ if (let Some(a) = opt && true) {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt) && (let Some(b) = a) {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+
+ if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (let Some(b) = a)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
+ }
+ if (let Some(a) = opt && (true)) && true {
+ //~^ ERROR expected expression, found `let` statement
+ }
+
+ #[cfg(FALSE)]
+ let x = (true && let y = 1);
+ //~^ ERROR expected expression, found `let` statement
+
+ #[cfg(FALSE)]
+ {
+ ([1, 2, 3][let _ = ()])
+ //~^ ERROR expected expression, found `let` statement
+ }
+}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
new file mode 100644
index 000000000..31f389512
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr
@@ -0,0 +1,1021 @@
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:11:9
+ |
+LL | if (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:14:11
+ |
+LL | if (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:17:9
+ |
+LL | if (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:20:17
+ |
+LL | if true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:9
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:23:24
+ |
+LL | if (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:22
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:35
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:27:9
+ |
+LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:34:12
+ |
+LL | while (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:37:14
+ |
+LL | while (((let 0 = 1))) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:40:12
+ |
+LL | while (let 0 = 1) && true {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:43:20
+ |
+LL | while true && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:12
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:46:27
+ |
+LL | while (let 0 = 1) && (let 0 = 1) {}
+ | ^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:25
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:38
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:50:12
+ |
+LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:70:9
+ |
+LL | if &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:73:9
+ |
+LL | if !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:75:9
+ |
+LL | if *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:77:9
+ |
+LL | if -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:85:9
+ |
+LL | if (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:16
+ |
+LL | if true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:88:13
+ |
+LL | if true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:90:17
+ |
+LL | if (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:92:25
+ |
+LL | if true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:94:25
+ |
+LL | if true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:98:12
+ |
+LL | if x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:15
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:104:11
+ |
+LL | if ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:106:9
+ |
+LL | if (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:8
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:8
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:8
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:8
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:129:19
+ |
+LL | if let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:134:12
+ |
+LL | while &let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:137:12
+ |
+LL | while !let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:139:12
+ |
+LL | while *let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:141:12
+ |
+LL | while -let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:149:12
+ |
+LL | while (let 0 = 0)? {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:19
+ |
+LL | while true || let 0 = 0 {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `||` operators are not supported in let chain expressions
+ --> $DIR/disallowed-positions-without-feature-gate.rs:152:16
+ |
+LL | while true || let 0 = 0 {}
+ | ^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:154:20
+ |
+LL | while (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:156:28
+ |
+LL | while true && (true || let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:158:28
+ |
+LL | while true || (true && let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:162:15
+ |
+LL | while x = let 0 = 0 {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:18
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:168:14
+ |
+LL | while ..(let 0 = 0) {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:170:12
+ |
+LL | while (let 0 = 0).. {}
+ | ^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:11
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:11
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:11
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:11
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:193:22
+ |
+LL | while let true = let true = true {}
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:208:6
+ |
+LL | &let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:211:6
+ |
+LL | !let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:213:6
+ |
+LL | *let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:215:6
+ |
+LL | -let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:217:13
+ |
+LL | let _ = let _ = 3;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:225:6
+ |
+LL | (let 0 = 0)?;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:228:13
+ |
+LL | true || let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:230:14
+ |
+LL | (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:232:22
+ |
+LL | true && (true || let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:236:9
+ |
+LL | x = let 0 = 0;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:239:12
+ |
+LL | true..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:241:8
+ |
+LL | ..(let 0 = 0);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:243:6
+ |
+LL | (let 0 = 0)..;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:6
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:6
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:250:17
+ |
+LL | (let true = let true = true);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:256:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:262:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:267:6
+ |
+LL | &let 0 = 0
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:277:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:282:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:287:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:17
+ |
+LL | true && let 1 = 1
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions-without-feature-gate.rs:298:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:307:9
+ |
+LL | if (let Some(a) = opt && true) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:311:9
+ |
+LL | if (let Some(a) = opt) && true {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:9
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:314:32
+ |
+LL | if (let Some(a) = opt) && (let Some(b) = a) {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:319:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:9
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:323:31
+ |
+LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
+ | ^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+note: `let`s wrapped in parentheses are not supported in a context with let chains
+ --> $DIR/disallowed-positions-without-feature-gate.rs:327:9
+ |
+LL | if (let Some(a) = opt && (true)) && true {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:332:22
+ |
+LL | let x = (true && let y = 1);
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:337:20
+ |
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:63:16
+ |
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions-without-feature-gate.rs:65:16
+ |
+LL | use_expr!((let 0 = 1));
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:101:8
+ |
+LL | if true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:110:12
+ |
+LL | if let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:113:12
+ |
+LL | if let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:119:12
+ |
+LL | if let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:125:12
+ |
+LL | if let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:81:20
+ |
+LL | if let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:165:11
+ |
+LL | while true..(let 0 = 0) {}
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:174:15
+ |
+LL | while let Range { start: _, end: _ } = true..true && false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:177:15
+ |
+LL | while let Range { start: _, end: _ } = true..true || false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:183:15
+ |
+LL | while let Range { start: F, end } = F..|| true {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
+ | |
+ | expected fn pointer, found `Range<_>`
+ |
+ = note: expected fn pointer `fn() -> bool`
+ found struct `std::ops::Range<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:189:15
+ |
+LL | while let Range { start: true, end } = t..&&false {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:145:23
+ |
+LL | while let 0 = 0? {}
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/disallowed-positions-without-feature-gate.rs:246:10
+ |
+LL | (let Range { start: _, end: _ } = true..true || false);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
+ | |
+ | expected `bool`, found `Range<_>`
+ |
+ = note: expected type `bool`
+ found struct `std::ops::Range<_>`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/disallowed-positions-without-feature-gate.rs:221:17
+ |
+LL | let 0 = 0?;
+ | ^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error: aborting due to 105 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
index 2a9a5472b..4ac3ea53a 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs
@@ -27,64 +27,46 @@ fn main() {}
fn _if() {
if (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
fn _while() {
while (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (((let 0 = 1))) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 1) && (let 0 = 1) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
@@ -97,32 +79,21 @@ fn _macros() {
}
}
use_expr!((let 0 = 1 && 0 == 0));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!((let 0 = 1));
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_if_expr() {
if &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
if let 0 = 0? {}
@@ -130,91 +101,63 @@ fn nested_within_if_expr() {
Ok(())
}
if (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
if x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
if ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
if (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
if let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
if let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
if let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
if let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn nested_within_while_expr() {
while &let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while !let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while *let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while -let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
while let 0 = 0? {}
@@ -222,72 +165,51 @@ fn nested_within_while_expr() {
Ok(())
}
while (let 0 = 0)? {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true && (true || let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true || (true && let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
while x = let 0 = 0 {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while true..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
while ..(let 0 = 0) {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
while (let 0 = 0).. {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
// Binds as `(let ... = true)..true &&/|| false`.
while let Range { start: _, end: _ } = true..true && false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let Range { start: _, end: _ } = true..true || false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: F, end } = F)..(|| true)`.
const F: fn() -> bool = || true;
while let Range { start: F, end } = F..|| true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
// Binds as `(let Range { start: true, end } = t)..(&&false)`.
let t = &&true;
while let Range { start: true, end } = t..&&false {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR mismatched types
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR mismatched types
while let true = let true = true {}
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
fn not_error_because_clarified_intent() {
@@ -302,20 +224,14 @@ fn not_error_because_clarified_intent() {
fn outside_if_and_while_expr() {
&let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
!let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
*let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR type `bool` cannot be dereferenced
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
-let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR cannot apply unary operator `-` to type `bool`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
fn _check_try_binds_tighter() -> Result<(), ()> {
let 0 = 0?;
@@ -323,44 +239,32 @@ fn outside_if_and_while_expr() {
Ok(())
}
(let 0 = 0)?;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR the `?` operator can only be used in a function that returns `Result`
- //~| ERROR the `?` operator can only be applied to values that implement `Try`
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true || let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true && (true || let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
let mut x = true;
x = let 0 = 0;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
true..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
..(let 0 = 0);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let 0 = 0)..;
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
(let Range { start: _, end: _ } = true..true || false);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
+ //~^ ERROR mismatched types
//~| ERROR expected expression, found `let` statement
(let true = let true = true);
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
{
@@ -377,9 +281,7 @@ fn outside_if_and_while_expr() {
// Check function tail position.
&let 0 = 0
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR mismatched types
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
// Let's make sure that `let` inside const generic arguments are considered.
@@ -389,20 +291,17 @@ fn inside_const_generic_arguments() {
if let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
while let A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O = 5 {}
if A::<{
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}>::O == 5 {}
// In the cases above we have `ExprKind::Block` to help us out.
@@ -413,8 +312,7 @@ fn inside_const_generic_arguments() {
if A::<
true && let 1 = 1
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expressions must be enclosed in braces
+ //~^ ERROR expressions must be enclosed in braces
//~| ERROR expected expression, found `let` statement
>::O == 5 {}
}
@@ -423,38 +321,29 @@ fn with_parenthesis() {
let opt = Some(Some(1i32));
if (let Some(a) = opt && true) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (let Some(a) = opt) && (let Some(b) = a) {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if let Some(a) = opt && (true && true) {
}
if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (let Some(b) = a)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
}
if (let Some(a) = opt && (true)) && true {
- //~^ ERROR `let` expressions are not supported here
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
}
if (true && (true)) && let Some(a) = opt {
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
index 81933173c..ab58abf4d 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr
@@ -2,503 +2,6 @@ error: expected expression, found `let` statement
--> $DIR/disallowed-positions.rs:29:9
|
LL | if (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:33:11
- |
-LL | if (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:37:9
- |
-LL | if (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:41:17
- |
-LL | if true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:9
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:45:24
- |
-LL | if (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:35
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:48
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:51:61
- |
-LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:61:12
- |
-LL | while (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:65:14
- |
-LL | while (((let 0 = 1))) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:69:12
- |
-LL | while (let 0 = 1) && true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:73:20
- |
-LL | while true && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:12
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:77:27
- |
-LL | while (let 0 = 1) && (let 0 = 1) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:38
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:51
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:83:64
- |
-LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:110:9
- |
-LL | if &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:115:9
- |
-LL | if !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:118:9
- |
-LL | if *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:122:9
- |
-LL | if -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:138:16
- |
-LL | if true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:141:17
- |
-LL | if (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:144:25
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:147:25
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:152:12
- |
-LL | if x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:196:19
- |
-LL | if let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:202:12
- |
-LL | while &let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:207:12
- |
-LL | while !let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:210:12
- |
-LL | while *let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:214:12
- |
-LL | while -let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:230:19
- |
-LL | while true || let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:233:20
- |
-LL | while (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:236:28
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:239:28
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:244:15
- |
-LL | while x = let 0 = 0 {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:288:22
- |
-LL | while let true = let true = true {}
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:304:6
- |
-LL | &let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:308:6
- |
-LL | !let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:311:6
- |
-LL | *let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:315:6
- |
-LL | -let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:331:13
- |
-LL | true || let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:334:14
- |
-LL | (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:337:22
- |
-LL | true && (true || let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:342:9
- |
-LL | x = let 0 = 0;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:356:6
- |
-LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:6
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:361:17
- |
-LL | (let true = let true = true);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:368:25
- |
-LL | let x = true && let y = 1;
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:374:19
- |
-LL | [1, 2, 3][let _ = ()]
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:379:6
- |
-LL | &let 0 = 0
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:391:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:397:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:403:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:415:17
- |
-LL | true && let 1 = 1
- | ^^^
-
-error: expressions must be enclosed in braces to be used as const generic arguments
- --> $DIR/disallowed-positions.rs:415:9
- |
-LL | true && let 1 = 1
- | ^^^^^^^^^^^^^^^^^
- |
-help: enclose the `const` expression in braces
- |
-LL | { true && let 1 = 1 }
- | + +
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:425:9
- |
-LL | if (let Some(a) = opt && true) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:430:9
- |
-LL | if (let Some(a) = opt) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:9
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:434:32
- |
-LL | if (let Some(a) = opt) && (let Some(b) = a) {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:443:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:9
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:449:31
- |
-LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:455:9
- |
-LL | if (let Some(a) = opt && (true)) && true {
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:472:22
- |
-LL | let x = (true && let y = 1);
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:477:20
- |
-LL | ([1, 2, 3][let _ = ()])
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^
-
-error: expected expression, found `let` statement
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:29:9
- |
-LL | if (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
@@ -508,1012 +11,863 @@ note: `let`s wrapped in parentheses are not supported in a context with let chai
LL | if (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:33:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:33:11
+ --> $DIR/disallowed-positions.rs:32:11
|
LL | if (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:37:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:37:9
+ --> $DIR/disallowed-positions.rs:35:9
|
LL | if (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:41:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:41:17
+ --> $DIR/disallowed-positions.rs:38:17
|
LL | if true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:9
+ --> $DIR/disallowed-positions.rs:41:9
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:45:24
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:45:24
+ --> $DIR/disallowed-positions.rs:41:24
|
LL | if (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:35
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:48
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:48
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:51:61
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:45:61
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:51:35
+ --> $DIR/disallowed-positions.rs:45:35
|
LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:61:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:61:12
+ --> $DIR/disallowed-positions.rs:52:12
|
LL | while (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:65:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:65:14
+ --> $DIR/disallowed-positions.rs:55:14
|
LL | while (((let 0 = 1))) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:69:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:69:12
+ --> $DIR/disallowed-positions.rs:58:12
|
LL | while (let 0 = 1) && true {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:73:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:73:20
+ --> $DIR/disallowed-positions.rs:61:20
|
LL | while true && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:12
+ --> $DIR/disallowed-positions.rs:64:12
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:77:27
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:77:27
+ --> $DIR/disallowed-positions.rs:64:27
|
LL | while (let 0 = 1) && (let 0 = 1) {}
| ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:38
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:51
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:51
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:83:64
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:68:64
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:83:38
+ --> $DIR/disallowed-positions.rs:68:38
|
LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:99:16
- |
-LL | use_expr!((let 0 = 1 && 0 == 0));
- | ^^^^^^^^^^^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:103:16
- |
-LL | use_expr!((let 0 = 1));
- | ^^^^^^^^^
-
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:110:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:88:9
|
LL | if &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:115:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:91:9
|
LL | if !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:118:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:93:9
|
LL | if *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:122:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:95:9
|
LL | if -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:132:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:103:9
|
LL | if (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:132:9
- |
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:138:16
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:106:16
|
LL | if true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:138:13
+ --> $DIR/disallowed-positions.rs:106:13
|
LL | if true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:141:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:108:17
|
LL | if (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:141:14
- |
-LL | if (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:144:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:110:25
|
LL | if true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:144:22
- |
-LL | if true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:147:25
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:112:25
|
LL | if true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:147:17
- |
-LL | if true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:152:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:116:12
|
LL | if x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:157:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:119:15
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:157:15
- |
-LL | if true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:161:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:122:11
|
LL | if ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:161:11
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:165:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:124:9
|
LL | if (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:165:9
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:171:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:128:8
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:175:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:131:8
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:182:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:137:8
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:190:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:143:8
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:196:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:147:19
|
LL | if let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:202:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:152:12
|
LL | while &let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:207:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:155:12
|
LL | while !let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:210:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:157:12
|
LL | while *let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:214:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:159:12
|
LL | while -let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:224:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:167:12
|
LL | while (let 0 = 0)? {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:224:12
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:230:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:170:19
|
LL | while true || let 0 = 0 {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:230:16
+ --> $DIR/disallowed-positions.rs:170:16
|
LL | while true || let 0 = 0 {}
| ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:233:20
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:172:20
|
LL | while (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:233:17
- |
-LL | while (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:236:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:174:28
|
LL | while true && (true || let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:236:25
- |
-LL | while true && (true || let 0 = 0) {}
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:239:28
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:176:28
|
LL | while true || (true && let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:239:20
- |
-LL | while true || (true && let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:244:15
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:180:15
|
LL | while x = let 0 = 0 {}
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:249:18
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:183:18
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:249:18
- |
-LL | while true..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:253:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:186:14
|
LL | while ..(let 0 = 0) {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:253:14
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:257:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:188:12
|
LL | while (let 0 = 0).. {}
| ^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:257:12
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:263:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:192:11
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:267:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:195:11
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:274:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:201:11
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:282:11
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:207:11
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:288:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:211:22
|
LL | while let true = let true = true {}
- | ^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:304:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:226:6
|
LL | &let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:308:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:229:6
|
LL | !let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:311:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:231:6
|
LL | *let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:315:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:233:6
|
LL | -let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:325:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:241:6
|
LL | (let 0 = 0)?;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:325:6
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:331:13
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:244:13
|
LL | true || let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:331:10
- |
-LL | true || let 0 = 0;
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:334:14
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:246:14
|
LL | (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:334:11
- |
-LL | (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:337:22
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:248:22
|
LL | true && (true || let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `||` operators are not supported in let chain expressions
- --> $DIR/disallowed-positions.rs:337:19
- |
-LL | true && (true || let 0 = 0);
- | ^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:342:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:252:9
|
LL | x = let 0 = 0;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:346:12
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:255:12
|
LL | true..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:346:12
- |
-LL | true..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:349:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:257:8
|
LL | ..(let 0 = 0);
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:349:8
- |
-LL | ..(let 0 = 0);
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:352:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:259:6
|
LL | (let 0 = 0)..;
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:352:6
- |
-LL | (let 0 = 0)..;
- | ^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:356:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:262:6
|
LL | (let Range { start: _, end: _ } = true..true || false);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:361:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:6
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:361:6
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:266:17
|
LL | (let true = let true = true);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:272:25
+ |
+LL | let x = true && let y = 1;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:278:19
+ |
+LL | [1, 2, 3][let _ = ()]
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:379:6
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:283:6
|
LL | &let 0 = 0
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:391:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:293:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:397:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:298:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:403:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:303:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:415:17
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:314:17
|
LL | true && let 1 = 1
- | ^^^^^^^^^
+ | ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:425:9
+error: expressions must be enclosed in braces to be used as const generic arguments
+ --> $DIR/disallowed-positions.rs:314:9
+ |
+LL | true && let 1 = 1
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: enclose the `const` expression in braces
+ |
+LL | { true && let 1 = 1 }
+ | + +
+
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:425:9
+ --> $DIR/disallowed-positions.rs:323:9
|
LL | if (let Some(a) = opt && true) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:430:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:430:9
+ --> $DIR/disallowed-positions.rs:327:9
|
LL | if (let Some(a) = opt) && true {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:9
+ --> $DIR/disallowed-positions.rs:330:9
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:434:32
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:434:32
+ --> $DIR/disallowed-positions.rs:330:32
|
LL | if (let Some(a) = opt) && (let Some(b) = a) {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:9
+ --> $DIR/disallowed-positions.rs:337:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:443:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:443:31
+ --> $DIR/disallowed-positions.rs:337:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:9
+ --> $DIR/disallowed-positions.rs:341:9
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:449:31
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:449:31
+ --> $DIR/disallowed-positions.rs:341:31
|
LL | if (let Some(a) = opt && (let Some(b) = a)) && true {
| ^^^^^^^^^^^^^^^
-error: `let` expressions are not supported here
- --> $DIR/disallowed-positions.rs:455:9
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
note: `let`s wrapped in parentheses are not supported in a context with let chains
- --> $DIR/disallowed-positions.rs:455:9
+ --> $DIR/disallowed-positions.rs:345:9
|
LL | if (let Some(a) = opt && (true)) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:110:8
- |
-LL | if &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - if &let 0 = 0 {}
-LL + if let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:118:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:361:22
|
-LL | if *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:122:8
+LL | let x = (true && let y = 1);
+ | ^^^
|
-LL | if -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:132:8
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:366:20
|
-LL | if (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
+LL | ([1, 2, 3][let _ = ()])
+ | ^^^
|
- = help: the trait `Try` is not implemented for `bool`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:132:19
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:81:16
|
-LL | fn nested_within_if_expr() {
- | -------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | if (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
+LL | use_expr!((let 0 = 1 && 0 == 0));
+ | ^^^
|
- = help: the trait `FromResidual<_>` is not implemented for `()`
+ = note: only supported directly in conditions of `if` and `while` expressions
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:152:8
- |
-LL | if x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
+error: expected expression, found `let` statement
+ --> $DIR/disallowed-positions.rs:83:16
|
-help: you might have meant to compare for equality
+LL | use_expr!((let 0 = 1));
+ | ^^^
|
-LL | if x == let 0 = 0 {}
- | +
+ = note: only supported directly in conditions of `if` and `while` expressions
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:157:8
+ --> $DIR/disallowed-positions.rs:119:8
|
LL | if true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1522,25 +876,7 @@ LL | if true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:161:8
- |
-LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:165:8
- |
-LL | if (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:12
+ --> $DIR/disallowed-positions.rs:128:12
|
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1551,16 +887,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:171:8
- |
-LL | if let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:12
+ --> $DIR/disallowed-positions.rs:131:12
|
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1571,16 +898,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:175:8
- |
-LL | if let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:12
+ --> $DIR/disallowed-positions.rs:137:12
|
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1591,29 +909,7 @@ LL | if let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:41
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:182:41: 182:43]`
-help: use parentheses to call this closure
- |
-LL | if let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:182:8
- |
-LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:12
+ --> $DIR/disallowed-positions.rs:143:12
|
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1623,29 +919,8 @@ LL | if let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:44
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - if let Range { start: true, end } = t..&&false {}
-LL + if let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:190:8
- |
-LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:128:20
+ --> $DIR/disallowed-positions.rs:99:20
|
LL | if let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
@@ -1653,61 +928,7 @@ LL | if let 0 = 0? {}
= help: the trait `Try` is not implemented for `{integer}`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:202:11
- |
-LL | while &let 0 = 0 {}
- | ^^^^^^^^^^ expected `bool`, found `&bool`
- |
-help: consider removing the borrow
- |
-LL - while &let 0 = 0 {}
-LL + while let 0 = 0 {}
- |
-
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:210:11
- |
-LL | while *let 0 = 0 {}
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:214:11
- |
-LL | while -let 0 = 0 {}
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:224:11
- |
-LL | while (let 0 = 0)? {}
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:224:22
- |
-LL | fn nested_within_while_expr() {
- | ----------------------------- this function should return `Result` or `Option` to accept `?`
-...
-LL | while (let 0 = 0)? {}
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:244:11
- |
-LL | while x = let 0 = 0 {}
- | ^^^^^^^^^^^^^ expected `bool`, found `()`
- |
-help: you might have meant to compare for equality
- |
-LL | while x == let 0 = 0 {}
- | +
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:249:11
+ --> $DIR/disallowed-positions.rs:183:11
|
LL | while true..(let 0 = 0) {}
| ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
@@ -1716,25 +937,7 @@ LL | while true..(let 0 = 0) {}
found struct `std::ops::Range<bool>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:253:11
- |
-LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
- |
- = note: expected type `bool`
- found struct `RangeTo<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:257:11
- |
-LL | while (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
- |
- = note: expected type `bool`
- found struct `RangeFrom<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:15
+ --> $DIR/disallowed-positions.rs:192:15
|
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1745,16 +948,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:263:11
- |
-LL | while let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:15
+ --> $DIR/disallowed-positions.rs:195:15
|
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1765,16 +959,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:267:11
- |
-LL | while let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:15
+ --> $DIR/disallowed-positions.rs:201:15
|
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
@@ -1785,29 +970,7 @@ LL | while let Range { start: F, end } = F..|| true {}
found struct `std::ops::Range<_>`
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:44
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^ expected `bool`, found closure
- |
- = note: expected type `bool`
- found closure `[closure@$DIR/disallowed-positions.rs:274:44: 274:46]`
-help: use parentheses to call this closure
- |
-LL | while let Range { start: F, end } = F..(|| true)() {}
- | + +++
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:274:11
- |
-LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:15
+ --> $DIR/disallowed-positions.rs:207:15
|
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
@@ -1817,68 +980,16 @@ LL | while let Range { start: true, end } = t..&&false {}
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:47
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^ expected `bool`, found `&&bool`
- |
-help: consider removing the `&&`
- |
-LL - while let Range { start: true, end } = t..&&false {}
-LL + while let Range { start: true, end } = t..false {}
- |
-
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:282:11
- |
-LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
- |
- = note: expected type `bool`
- found struct `std::ops::Range<bool>`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:220:23
+ --> $DIR/disallowed-positions.rs:163:23
|
LL | while let 0 = 0? {}
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error[E0614]: type `bool` cannot be dereferenced
- --> $DIR/disallowed-positions.rs:311:5
- |
-LL | *let 0 = 0;
- | ^^^^^^^^^^
-
-error[E0600]: cannot apply unary operator `-` to type `bool`
- --> $DIR/disallowed-positions.rs:315:5
- |
-LL | -let 0 = 0;
- | ^^^^^^^^^^ cannot apply unary operator `-`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:325:5
- |
-LL | (let 0 = 0)?;
- | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
- |
- = help: the trait `Try` is not implemented for `bool`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/disallowed-positions.rs:325:16
- |
-LL | fn outside_if_and_while_expr() {
- | ------------------------------ this function should return `Result` or `Option` to accept `?`
-...
-LL | (let 0 = 0)?;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:356:10
+ --> $DIR/disallowed-positions.rs:262:10
|
LL | (let Range { start: _, end: _ } = true..true || false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
@@ -1888,24 +999,15 @@ LL | (let Range { start: _, end: _ } = true..true || false);
= note: expected type `bool`
found struct `std::ops::Range<_>`
-error[E0308]: mismatched types
- --> $DIR/disallowed-positions.rs:379:5
- |
-LL | fn outside_if_and_while_expr() {
- | - help: try adding a return type: `-> &bool`
-...
-LL | &let 0 = 0
- | ^^^^^^^^^^ expected `()`, found `&bool`
-
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/disallowed-positions.rs:321:17
+ --> $DIR/disallowed-positions.rs:237:17
|
LL | let 0 = 0?;
| ^^ the `?` operator cannot be applied to type `{integer}`
|
= help: the trait `Try` is not implemented for `{integer}`
-error: aborting due to 215 previous errors
+error: aborting due to 104 previous errors
-Some errors have detailed explanations: E0277, E0308, E0600, E0614.
+Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
index 2a6c14435..3c572054e 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs
@@ -14,7 +14,6 @@ fn main() {
};
let Some(n) = opt && let another = n else {
//~^ ERROR a `&&` expression cannot be directly assigned in `let...else`
- //~| ERROR `let` expressions are not supported here
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR expected expression, found `let` statement
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
index 9bc3e7541..0442f1218 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
@@ -14,6 +14,8 @@ error: expected expression, found `let` statement
|
LL | let Some(n) = opt && let another = n else {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: a `&&` expression cannot be directly assigned in `let...else`
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
@@ -27,13 +29,13 @@ LL | let Some(n) = (opt && let another = n) else {
| + +
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:5
|
LL | if let Some(n) = opt else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:25
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:25
|
LL | if let Some(n) = opt else {
| ^
@@ -44,31 +46,31 @@ LL + let Some(n) = opt else {
|
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:5
|
LL | if let Some(n) = opt && n == 1 else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:35
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:35
|
LL | if let Some(n) = opt && n == 1 else {
| ^
error: this `if` expression is missing a block after the condition
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:5
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:5
|
LL | if let Some(n) = opt && let another = n else {
| ^^
|
help: add a block here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:44
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:44
|
LL | if let Some(n) = opt && let another = n else {
| ^
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:38:33
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:37:33
|
LL | while let Some(n) = opt else {
| ----- ----------------- ^^^^ expected `{`
@@ -77,7 +79,7 @@ LL | while let Some(n) = opt else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:44:43
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:43:43
|
LL | while let Some(n) = opt && n == 1 else {
| ----- --------------------------- ^^^^ expected `{`
@@ -86,7 +88,7 @@ LL | while let Some(n) = opt && n == 1 else {
| while parsing the body of this `while` expression
error: expected `{`, found keyword `else`
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:50:52
+ --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:49:52
|
LL | while let Some(n) = opt && let another = n else {
| ----- ------------------------------------ ^^^^ expected `{`
@@ -94,14 +96,6 @@ LL | while let Some(n) = opt && let another = n else {
| | this `while` condition successfully parsed
| while parsing the body of this `while` expression
-error: `let` expressions are not supported here
- --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
- |
-LL | let Some(n) = opt && let another = n else {
- | ^^^^^^^^^^^^^^^
- |
- = note: only supported directly in conditions of `if` and `while` expressions
-
error[E0308]: mismatched types
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
|
@@ -142,6 +136,6 @@ LL | let Some(n) = opt && let another = n else {
= note: expected type `bool`
found enum `Option<_>`
-error: aborting due to 14 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
index 2b407ef51..bca7564ef 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs
@@ -43,8 +43,7 @@ fn _macros() {
macro_rules! noop_expr { ($e:expr) => {}; }
noop_expr!((let 0 = 1));
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
macro_rules! use_expr {
($e:expr) => {
@@ -53,8 +52,7 @@ fn _macros() {
}
}
#[cfg(FALSE)] (let 0 = 1);
- //~^ ERROR `let` expressions in this position are unstable [E0658]
- //~| ERROR expected expression, found `let` statement
+ //~^ ERROR expected expression, found `let` statement
use_expr!(let 0 = 1);
//~^ ERROR no rules expected the token `let`
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
index 7a43b71fc..6f7473675 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr
@@ -1,17 +1,21 @@
error: expected expression, found `let` statement
- --> $DIR/feature-gate.rs:55:20
+ --> $DIR/feature-gate.rs:54:20
|
LL | #[cfg(FALSE)] (let 0 = 1);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/feature-gate.rs:45:17
|
LL | noop_expr!((let 0 = 1));
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: no rules expected the token `let`
- --> $DIR/feature-gate.rs:58:15
+ --> $DIR/feature-gate.rs:56:15
|
LL | macro_rules! use_expr {
| --------------------- when calling this macro
@@ -20,7 +24,7 @@ LL | use_expr!(let 0 = 1);
| ^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
- --> $DIR/feature-gate.rs:50:10
+ --> $DIR/feature-gate.rs:49:10
|
LL | ($e:expr) => {
| ^^^^^^^
@@ -97,24 +101,6 @@ LL | while let Range { start: _, end: _ } = (true..true) && false {}
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:55:20
- |
-LL | #[cfg(FALSE)] (let 0 = 1);
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error[E0658]: `let` expressions in this position are unstable
- --> $DIR/feature-gate.rs:45:17
- |
-LL | noop_expr!((let 0 = 1));
- | ^^^^^^^^^
- |
- = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
- = help: add `#![feature(let_chains)]` to the crate attributes to enable
-
-error: aborting due to 13 previous errors
+error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
index a942d1f4c..dce1c19ff 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
@@ -13,6 +13,7 @@ fn main() {
if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
//~^ ERROR expected expression, found `let` statement
//~| ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
@@ -31,6 +32,7 @@ fn main() {
{
if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
//~^ ERROR expected expression, found `let` statement
+ //~| ERROR expected expression, found `let` statement
true
}
}
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
index d1ce83c72..247fad2e9 100644
--- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr
@@ -3,36 +3,64 @@ error: expected expression, found `let` statement
|
LL | let _ = &&let Some(x) = Some(42);
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
--> $DIR/invalid-let-in-a-valid-let-context.rs:13:57
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:13:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:23:23
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:24:23
|
LL | [1, 2, 3][let _ = ()];
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:32:47
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:47
|
LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+
+error: expected expression, found `let` statement
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:33:12
+ |
+LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
error: expected expression, found `let` statement
- --> $DIR/invalid-let-in-a-valid-let-context.rs:40:21
+ --> $DIR/invalid-let-in-a-valid-let-context.rs:42:21
|
LL | let x = let y = 1;
| ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 4fcfe9d47..ad11c090f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:5
+ --> $DIR/assoc-type-const-bound-usage.rs:12:6
|
LL | <T as Foo>::Assoc::foo();
- | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ | ^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
index 2d9c49af8..452bf757d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
- --> $DIR/call-const-trait-method-fail.rs:25:7
+ --> $DIR/call-const-trait-method-fail.rs:25:5
|
LL | a.plus(b)
- | ^^^^ the trait `Plus` is not implemented for `u32`
+ | ^ the trait `Plus` is not implemented for `u32`
|
= help: the trait `Plus` is implemented for `u32`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
index 2c99d8bf1..15f062edf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
new file mode 100644
index 000000000..f25390a90
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-parse-not-item.stderr
@@ -0,0 +1,8 @@
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-parse-not-item.rs:7:32
+ |
+LL | const fn test() -> impl ~const Fn() {
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
index 96ffca651..4c45b0e56 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method-fail.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method-fail.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
index fd0c29118..a8ef244ea 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
@@ -1,15 +1,8 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closure-trait-method.rs:15:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closure-trait-method.rs:14:39
|
-LL | x(())
- | ^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
- | ++++++++++++++++++++++++++++++++
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
index abf2a2dc5..6d61b23e4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -1,39 +1,26 @@
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:12:5
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:8:19
|
-LL | f() * 7
- | ^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
- | +++++++++++++++++++++++++
+LL | F: ~const FnOnce() -> u8,
+ | ^^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:5
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:9:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | F: ~const FnMut() -> u8,
+ | ^^^^^^^^^^^^^
-error[E0015]: cannot call non-const closure in constant functions
- --> $DIR/const-closures.rs:24:11
- |
-LL | f() + f()
- | ^^^
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:10:19
|
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
+LL | F: ~const Fn() -> u8,
+ | ^^^^^^^^^^
+
+error: ~const can only be applied to `#[const_trait]` traits
+ --> $DIR/const-closures.rs:23:27
|
-LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
- | +++++++++++++++++++++++++
+LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
+ | ^^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
new file mode 100644
index 000000000..da2778f61
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(effects)]
+
+pub const fn owo() {}
+
+fn main() {
+ // make sure falling back ty/int vars doesn't cause const fallback to be skipped...
+ // See issue: 115791.
+ let _ = 1;
+ if false {
+ let x = panic!();
+ }
+
+ let _ = owo;
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
new file mode 100644
index 000000000..2f474d978
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/infer-fallback.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+const fn a() {}
+
+fn foo<F: FnOnce()>(a: F) {}
+
+fn main() {
+ let _ = a;
+ foo(a);
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index e8d0eec02..c94563d35 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause-const.rs:15:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 11f0c4016..255878e17 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
--> $DIR/trait-where-clause.rs:14:5
|
LL | T::b();
- | ^^^^ the trait `Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::b`
--> $DIR/trait-where-clause.rs:8:24
diff --git a/tests/ui/rmeta/auxiliary/rmeta-meta.rs b/tests/ui/rmeta/auxiliary/rmeta-meta.rs
index 6d8ed95bd..6d4350495 100644
--- a/tests/ui/rmeta/auxiliary/rmeta-meta.rs
+++ b/tests/ui/rmeta/auxiliary/rmeta-meta.rs
@@ -6,3 +6,7 @@
pub struct Foo {
pub field: i32,
}
+
+pub fn missing_optimized_mir() {
+ println!("indeed");
+}
diff --git a/tests/ui/rmeta/no_optitimized_mir.rs b/tests/ui/rmeta/no_optitimized_mir.rs
new file mode 100644
index 000000000..c503005f1
--- /dev/null
+++ b/tests/ui/rmeta/no_optitimized_mir.rs
@@ -0,0 +1,11 @@
+// aux-build:rmeta-meta.rs
+// no-prefer-dynamic
+// build-fail
+
+// Check that we do not ICE when we need optimized MIR but it is missing.
+
+extern crate rmeta_meta;
+
+fn main() {
+ rmeta_meta::missing_optimized_mir();
+}
diff --git a/tests/ui/rmeta/no_optitimized_mir.stderr b/tests/ui/rmeta/no_optitimized_mir.stderr
new file mode 100644
index 000000000..a17024c53
--- /dev/null
+++ b/tests/ui/rmeta/no_optitimized_mir.stderr
@@ -0,0 +1,10 @@
+error: missing optimized MIR for an item in the crate `rmeta_meta`
+ |
+note: missing optimized MIR for this item (was the crate `rmeta_meta` compiled with `--emit=metadata`?)
+ --> $DIR/auxiliary/rmeta-meta.rs:10:1
+ |
+LL | pub fn missing_optimized_mir() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/rust-2018/trait-import-suggestions.rs b/tests/ui/rust-2018/trait-import-suggestions.rs
index 9c67c3f4b..900b3d093 100644
--- a/tests/ui/rust-2018/trait-import-suggestions.rs
+++ b/tests/ui/rust-2018/trait-import-suggestions.rs
@@ -1,6 +1,6 @@
// edition:2018
// aux-build:trait-import-suggestions.rs
-// compile-flags:--extern trait-import-suggestions
+// compile-flags:--extern trait_import_suggestions
mod foo {
mod foobar {
diff --git a/tests/ui/sanitize/cfg.rs b/tests/ui/sanitize/cfg.rs
index c0f08a6d1..761c646ec 100644
--- a/tests/ui/sanitize/cfg.rs
+++ b/tests/ui/sanitize/cfg.rs
@@ -1,23 +1,31 @@
// Verifies that when compiling with -Zsanitizer=option,
// the `#[cfg(sanitize = "option")]` attribute is configured.
-// needs-sanitizer-support
-// needs-sanitizer-address
-// needs-sanitizer-cfi
-// needs-sanitizer-kcfi
-// needs-sanitizer-leak
-// needs-sanitizer-memory
-// needs-sanitizer-thread
// check-pass
-// revisions: address leak memory thread
+// revisions: address cfi kcfi leak memory thread
+//compile-flags: -Ctarget-feature=-crt-static
+//[address]needs-sanitizer-address
//[address]compile-flags: -Zsanitizer=address --cfg address
+//[cfi]needs-sanitizer-cfi
//[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi
-//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi
+//[cfi]compile-flags: -Clto -Ccodegen-units=1
+//[kcfi]needs-llvm-components: x86
+//[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi --target x86_64-unknown-none
+//[leak]needs-sanitizer-leak
//[leak]compile-flags: -Zsanitizer=leak --cfg leak
+//[memory]needs-sanitizer-memory
//[memory]compile-flags: -Zsanitizer=memory --cfg memory
+//[thread]needs-sanitizer-thread
//[thread]compile-flags: -Zsanitizer=thread --cfg thread
-#![feature(cfg_sanitize)]
+#![feature(cfg_sanitize, no_core, lang_items)]
+#![crate_type="lib"]
+#![no_core]
+
+#[lang="sized"]
+trait Sized { }
+#[lang="copy"]
+trait Copy { }
#[cfg(all(sanitize = "address", address))]
fn main() {}
@@ -36,3 +44,7 @@ fn main() {}
#[cfg(all(sanitize = "thread", thread))]
fn main() {}
+
+pub fn check() {
+ main();
+}
diff --git a/tests/ui/self/class-missing-self.stderr b/tests/ui/self/class-missing-self.stderr
index 3c37d8197..ca7a89620 100644
--- a/tests/ui/self/class-missing-self.stderr
+++ b/tests/ui/self/class-missing-self.stderr
@@ -2,7 +2,12 @@ error[E0425]: cannot find value `meows` in this scope
--> $DIR/class-missing-self.rs:9:7
|
LL | meows += 1;
- | ^^^^^ help: you might have meant to use the available field: `self.meows`
+ | ^^^^^
+ |
+help: you might have meant to use the available field
+ |
+LL | self.meows += 1;
+ | +++++
error[E0425]: cannot find function `sleep` in this scope
--> $DIR/class-missing-self.rs:10:7
@@ -10,7 +15,7 @@ error[E0425]: cannot find function `sleep` in this scope
LL | sleep();
| ^^^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.sleep();
| +++++
diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs
index 0ff2203ec..6ba93e46f 100644
--- a/tests/ui/simd/intrinsic/generic-elements.rs
+++ b/tests/ui/simd/intrinsic/generic-elements.rs
@@ -1,6 +1,7 @@
// build-fail
-#![feature(repr_simd, platform_intrinsics, rustc_attrs)]
+#![feature(repr_simd, platform_intrinsics, rustc_attrs, adt_const_params)]
+#![allow(incomplete_features)]
#[repr(simd)]
#[derive(Copy, Clone)]
@@ -35,6 +36,7 @@ extern "platform-intrinsic" {
fn simd_extract<T, E>(x: T, idx: u32) -> E;
fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
+ fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
}
fn main() {
@@ -71,5 +73,29 @@ fn main() {
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
simd_shuffle::<_, _, i32x2>(x, x, IDX8);
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
+
+ const I2: &[u32] = &[0; 2];
+ simd_shuffle_generic::<i32, i32, I2>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ const I4: &[u32] = &[0; 4];
+ simd_shuffle_generic::<i32, i32, I4>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ const I8: &[u32] = &[0; 8];
+ simd_shuffle_generic::<i32, i32, I8>(0, 0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+
+ simd_shuffle_generic::<_, f32x2, I2>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ simd_shuffle_generic::<_, f32x4, I4>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+ simd_shuffle_generic::<_, f32x8, I8>(x, x);
+//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
+
+ simd_shuffle_generic::<_, i32x8, I2>(x, x);
+ //~^ ERROR expected return type of length 2, found `i32x8` with length 8
+ simd_shuffle_generic::<_, i32x8, I4>(x, x);
+ //~^ ERROR expected return type of length 4, found `i32x8` with length 8
+ simd_shuffle_generic::<_, i32x2, I8>(x, x);
+ //~^ ERROR expected return type of length 8, found `i32x2` with length 2
}
}
diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr
index 115d9d4b3..26e013449 100644
--- a/tests/ui/simd/intrinsic/generic-elements.stderr
+++ b/tests/ui/simd/intrinsic/generic-elements.stderr
@@ -1,75 +1,129 @@
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:44:9
+ --> $DIR/generic-elements.rs:46:9
|
LL | simd_insert(0, 0, 0);
| ^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64`
- --> $DIR/generic-elements.rs:46:9
+ --> $DIR/generic-elements.rs:48:9
|
LL | simd_insert(x, 0, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32`
- --> $DIR/generic-elements.rs:48:9
+ --> $DIR/generic-elements.rs:50:9
|
LL | simd_extract::<_, f32>(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:52:9
+ --> $DIR/generic-elements.rs:54:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:55:9
+ --> $DIR/generic-elements.rs:57:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:58:9
+ --> $DIR/generic-elements.rs:60:9
|
LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
- --> $DIR/generic-elements.rs:61:9
+ --> $DIR/generic-elements.rs:63:9
|
LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
- --> $DIR/generic-elements.rs:63:9
+ --> $DIR/generic-elements.rs:65:9
|
LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- --> $DIR/generic-elements.rs:65:9
+ --> $DIR/generic-elements.rs:67:9
|
LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8
- --> $DIR/generic-elements.rs:68:9
+ --> $DIR/generic-elements.rs:70:9
|
LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8
- --> $DIR/generic-elements.rs:70:9
+ --> $DIR/generic-elements.rs:72:9
|
LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2
- --> $DIR/generic-elements.rs:72:9
+ --> $DIR/generic-elements.rs:74:9
|
LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 12 previous errors
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:78:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I2>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:81:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I4>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:84:9
+ |
+LL | simd_shuffle_generic::<i32, i32, I8>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ --> $DIR/generic-elements.rs:87:9
+ |
+LL | simd_shuffle_generic::<_, f32x2, I2>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+ --> $DIR/generic-elements.rs:89:9
+ |
+LL | simd_shuffle_generic::<_, f32x4, I4>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
+ --> $DIR/generic-elements.rs:91:9
+ |
+LL | simd_shuffle_generic::<_, f32x8, I8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8
+ --> $DIR/generic-elements.rs:94:9
+ |
+LL | simd_shuffle_generic::<_, i32x8, I2>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8
+ --> $DIR/generic-elements.rs:96:9
+ |
+LL | simd_shuffle_generic::<_, i32x8, I4>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2
+ --> $DIR/generic-elements.rs:98:9
+ |
+LL | simd_shuffle_generic::<_, i32x2, I8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 21 previous errors
For more information about this error, try `rustc --explain E0511`.
diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr
new file mode 100644
index 000000000..fc66b1956
--- /dev/null
+++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr
@@ -0,0 +1,12 @@
+error: overly complex generic constant
+ --> $DIR/monomorphize-shuffle-index.rs:29:45
+ |
+LL | return simd_shuffle_generic::<_, _, { &Self::I }>(a, b);
+ | ^^--------^^
+ | |
+ | pointer casts are not allowed in generic constants
+ |
+ = help: consider moving this anonymous constant into a `const` function
+
+error: aborting due to previous error
+
diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs
index 2467baa08..db7953f06 100644
--- a/tests/ui/simd/monomorphize-shuffle-index.rs
+++ b/tests/ui/simd/monomorphize-shuffle-index.rs
@@ -1,8 +1,14 @@
-//run-pass
-#![feature(repr_simd, platform_intrinsics)]
+//[old]run-pass
+//[generic_with_fn]run-pass
+// revisions: old generic generic_with_fn
+#![feature(repr_simd, platform_intrinsics, adt_const_params, generic_const_exprs)]
+#![allow(incomplete_features)]
extern "platform-intrinsic" {
+ #[cfg(old)]
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
+ #[cfg(any(generic, generic_with_fn))]
+ fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U;
}
#[derive(Copy, Clone)]
@@ -11,12 +17,24 @@ struct Simd<T, const N: usize>([T; N]);
trait Shuffle<const N: usize> {
const I: [u32; N];
-
- unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N> {
- simd_shuffle(a, b, Self::I)
+ const J: &'static [u32] = &Self::I;
+
+ unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N>
+ where
+ Thing<{ Self::J }>:,
+ {
+ #[cfg(old)]
+ return simd_shuffle(a, b, Self::I);
+ #[cfg(generic)]
+ return simd_shuffle_generic::<_, _, { &Self::I }>(a, b);
+ //[generic]~^ overly complex generic constant
+ #[cfg(generic_with_fn)]
+ return simd_shuffle_generic::<_, _, { Self::J }>(a, b);
}
}
+struct Thing<const X: &'static [u32]>;
+
fn main() {
struct I1;
impl Shuffle<4> for I1 {
diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index ba8da2e75..29a606c4f 100644
--- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -42,7 +42,7 @@ LL | f(Box::new(|a| {
| --- captured by this `FnMut` closure
LL |
LL | foo(f);
- | ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58]`, which does not implement the `Copy` trait
+ | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait
error[E0505]: cannot move out of `f` because it is borrowed
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
diff --git a/tests/ui/span/issue-29595.stderr b/tests/ui/span/issue-29595.stderr
index 92445e407..7d603cdbf 100644
--- a/tests/ui/span/issue-29595.stderr
+++ b/tests/ui/span/issue-29595.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied
|
LL | let a: u8 = Tr::C;
| ^^^^^ the trait `Tr` is not implemented for `u8`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-29595.rs:1:1
+ |
+LL | trait Tr {
+ | ^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/span/move-closure.stderr b/tests/ui/span/move-closure.stderr
index dcc607896..2127b8202 100644
--- a/tests/ui/span/move-closure.stderr
+++ b/tests/ui/span/move-closure.stderr
@@ -7,7 +7,7 @@ LL | let x: () = move || ();
| expected due to this
|
= note: expected unit type `()`
- found closure `[closure@$DIR/move-closure.rs:5:17: 5:24]`
+ found closure `{closure@$DIR/move-closure.rs:5:17: 5:24}`
help: use parentheses to call this closure
|
LL | let x: () = (move || ())();
diff --git a/tests/ui/span/send-is-not-static-std-sync.rs b/tests/ui/span/send-is-not-static-std-sync.rs
index f8ab5243c..9c1ee2871 100644
--- a/tests/ui/span/send-is-not-static-std-sync.rs
+++ b/tests/ui/span/send-is-not-static-std-sync.rs
@@ -46,7 +46,7 @@ fn channel() {
tx.send(&z).unwrap();
}
//~^^ ERROR `z` does not live long enough
- // (channels lack #[may_dangle], thus their dtors are implicit uses of `z`)
+ tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
}
fn main() {}
diff --git a/tests/ui/span/send-is-not-static-std-sync.stderr b/tests/ui/span/send-is-not-static-std-sync.stderr
index eaba415ad..46534b391 100644
--- a/tests/ui/span/send-is-not-static-std-sync.stderr
+++ b/tests/ui/span/send-is-not-static-std-sync.stderr
@@ -75,11 +75,9 @@ LL | tx.send(&z).unwrap();
| ^^ borrowed value does not live long enough
LL | }
| - `z` dropped here while still borrowed
-...
-LL | }
- | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `Sender`
- |
- = note: values in a scope are dropped in the opposite order they are defined
+LL |
+LL | tx.use_ref(); // (channel drop glue does not use `z` => needs explicit use)
+ | -- borrow later used here
error: aborting due to 6 previous errors
diff --git a/tests/ui/specialization/issue-38091.stderr b/tests/ui/specialization/issue-38091.stderr
index f2210a407..4d840482b 100644
--- a/tests/ui/specialization/issue-38091.stderr
+++ b/tests/ui/specialization/issue-38091.stderr
@@ -14,6 +14,11 @@ error[E0277]: the trait bound `(): Valid` is not satisfied
LL | default type Ty = ();
| ^^ the trait `Valid` is not implemented for `()`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-38091.rs:20:1
+ |
+LL | trait Valid {}
+ | ^^^^^^^^^^^
note: required by a bound in `Iterate::Ty`
--> $DIR/issue-38091.rs:5:14
|
diff --git a/tests/ui/specialization/specialization-default-types.stderr b/tests/ui/specialization/specialization-default-types.stderr
index ecccf29a1..774ac9536 100644
--- a/tests/ui/specialization/specialization-default-types.stderr
+++ b/tests/ui/specialization/specialization-default-types.stderr
@@ -12,7 +12,7 @@ error[E0308]: mismatched types
--> $DIR/specialization-default-types.rs:15:9
|
LL | default type Output = Box<T>;
- | ----------------------------- expected this associated type
+ | ----------------------------- associated type is `default` and may be overridden
LL | default fn generate(self) -> Self::Output {
| ------------ expected `<T as Example>::Output` because of return type
LL | Box::new(self)
diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr
index b68352b51..86c4eaa7e 100644
--- a/tests/ui/static/static-reference-to-fn-1.stderr
+++ b/tests/ui/static/static-reference-to-fn-1.stderr
@@ -7,7 +7,6 @@ LL | func: &foo,
= note: expected reference `&fn() -> Option<isize>`
found reference `&fn() -> Option<isize> {foo}`
= note: fn items are distinct from fn pointers
- = note: when the arguments and return types match, functions can be coerced to function pointers
help: consider casting to a fn pointer
|
LL | func: &(foo as fn() -> Option<isize>),
diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr
index d723ff538..813e65e45 100644
--- a/tests/ui/stats/hir-stats.stderr
+++ b/tests/ui/stats/hir-stats.stderr
@@ -146,33 +146,33 @@ hir-stats - Trait 192 ( 2.1%) 4
hir-stats WherePredicate 192 ( 2.1%) 3 64
hir-stats - BoundPredicate 192 ( 2.1%) 3
hir-stats Block 288 ( 3.2%) 6 48
-hir-stats Pat 360 ( 4.0%) 5 72
+hir-stats Pat 360 ( 3.9%) 5 72
hir-stats - Wild 72 ( 0.8%) 1
hir-stats - Struct 72 ( 0.8%) 1
hir-stats - Binding 216 ( 2.4%) 3
hir-stats GenericParam 400 ( 4.4%) 5 80
-hir-stats Generics 560 ( 6.2%) 10 56
-hir-stats Ty 720 ( 8.0%) 15 48
+hir-stats Generics 560 ( 6.1%) 10 56
+hir-stats Ty 720 ( 7.9%) 15 48
hir-stats - Ptr 48 ( 0.5%) 1
hir-stats - Ref 48 ( 0.5%) 1
-hir-stats - Path 624 ( 6.9%) 13
-hir-stats Expr 768 ( 8.5%) 12 64
+hir-stats - Path 624 ( 6.8%) 13
+hir-stats Expr 768 ( 8.4%) 12 64
hir-stats - Path 64 ( 0.7%) 1
hir-stats - Struct 64 ( 0.7%) 1
hir-stats - Match 64 ( 0.7%) 1
hir-stats - InlineAsm 64 ( 0.7%) 1
hir-stats - Lit 128 ( 1.4%) 2
hir-stats - Block 384 ( 4.2%) 6
-hir-stats Item 880 ( 9.7%) 11 80
-hir-stats - Trait 80 ( 0.9%) 1
-hir-stats - Enum 80 ( 0.9%) 1
-hir-stats - ExternCrate 80 ( 0.9%) 1
-hir-stats - ForeignMod 80 ( 0.9%) 1
-hir-stats - Impl 80 ( 0.9%) 1
-hir-stats - Fn 160 ( 1.8%) 2
-hir-stats - Use 320 ( 3.5%) 4
-hir-stats Path 1_240 (13.7%) 31 40
-hir-stats PathSegment 1_920 (21.2%) 40 48
+hir-stats Item 968 (10.6%) 11 88
+hir-stats - Trait 88 ( 1.0%) 1
+hir-stats - Enum 88 ( 1.0%) 1
+hir-stats - ExternCrate 88 ( 1.0%) 1
+hir-stats - ForeignMod 88 ( 1.0%) 1
+hir-stats - Impl 88 ( 1.0%) 1
+hir-stats - Fn 176 ( 1.9%) 2
+hir-stats - Use 352 ( 3.9%) 4
+hir-stats Path 1_240 (13.6%) 31 40
+hir-stats PathSegment 1_920 (21.0%) 40 48
hir-stats ----------------------------------------------------------------
-hir-stats Total 9_048
+hir-stats Total 9_136
hir-stats
diff --git a/tests/ui/stats/meta-stats.rs b/tests/ui/stats/meta-stats.rs
new file mode 100644
index 000000000..2d38e0882
--- /dev/null
+++ b/tests/ui/stats/meta-stats.rs
@@ -0,0 +1,7 @@
+// build-pass
+// dont-check-compiler-stderr
+// compile-flags: -Zmeta-stats
+
+#![crate_type = "lib"]
+
+pub fn a() {}
diff --git a/tests/ui/issues/issue-17431-6.rs b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
index b7e49873d..b7e49873d 100644
--- a/tests/ui/issues/issue-17431-6.rs
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
diff --git a/tests/ui/issues/issue-17431-6.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
index e0a822550..e0a822550 100644
--- a/tests/ui/issues/issue-17431-6.stderr
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
diff --git a/tests/ui/issues/issue-17431-7.rs b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
index 4fd786278..4fd786278 100644
--- a/tests/ui/issues/issue-17431-7.rs
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
diff --git a/tests/ui/issues/issue-17431-7.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
index ecf072b8e..ecf072b8e 100644
--- a/tests/ui/issues/issue-17431-7.stderr
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
diff --git a/tests/ui/structs-enums/rec-align-u32.rs b/tests/ui/structs-enums/rec-align-u32.rs
index ee704198d..b3c323d2a 100644
--- a/tests/ui/structs-enums/rec-align-u32.rs
+++ b/tests/ui/structs-enums/rec-align-u32.rs
@@ -3,7 +3,7 @@
#![allow(unused_unsafe)]
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs
index f21c9b2c8..de008bcc0 100644
--- a/tests/ui/structs-enums/rec-align-u64.rs
+++ b/tests/ui/structs-enums/rec-align-u64.rs
@@ -5,7 +5,7 @@
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
@@ -37,6 +37,7 @@ struct Outer {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
diff --git a/tests/ui/issues/issue-17431-1.rs b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
index 3b692cc0e..3b692cc0e 100644
--- a/tests/ui/issues/issue-17431-1.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
diff --git a/tests/ui/issues/issue-17431-1.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
index e3af8976c..e3af8976c 100644
--- a/tests/ui/issues/issue-17431-1.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
diff --git a/tests/ui/issues/issue-17431-2.rs b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
index f7b9c6a55..f7b9c6a55 100644
--- a/tests/ui/issues/issue-17431-2.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
diff --git a/tests/ui/issues/issue-17431-2.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
index 39a99ec1e..39a99ec1e 100644
--- a/tests/ui/issues/issue-17431-2.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
diff --git a/tests/ui/issues/issue-17431-3.rs b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
index 83a63a88b..83a63a88b 100644
--- a/tests/ui/issues/issue-17431-3.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
diff --git a/tests/ui/issues/issue-17431-3.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
index 394134c78..394134c78 100644
--- a/tests/ui/issues/issue-17431-3.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
diff --git a/tests/ui/issues/issue-17431-4.rs b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
index 48f0dba2a..48f0dba2a 100644
--- a/tests/ui/issues/issue-17431-4.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
diff --git a/tests/ui/issues/issue-17431-4.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
index 3d141e44b..3d141e44b 100644
--- a/tests/ui/issues/issue-17431-4.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
diff --git a/tests/ui/issues/issue-17431-5.rs b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
index 0fd6ee611..0fd6ee611 100644
--- a/tests/ui/issues/issue-17431-5.rs
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
diff --git a/tests/ui/issues/issue-17431-5.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
index 44a90a6fe..44a90a6fe 100644
--- a/tests/ui/issues/issue-17431-5.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
diff --git a/tests/ui/suggestions/assoc-const-as-fn.stderr b/tests/ui/suggestions/assoc-const-as-fn.stderr
index 3b6e947c5..d55d968b6 100644
--- a/tests/ui/suggestions/assoc-const-as-fn.stderr
+++ b/tests/ui/suggestions/assoc-const-as-fn.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied
- --> $DIR/assoc-const-as-fn.rs:14:40
+ --> $DIR/assoc-const-as-fn.rs:14:6
|
LL | <T as GlUniformScalar>::FACTORY(1, value);
- | ------------------------------- ^^^^^ the trait `GlUniformScalar` is not implemented for `T`
- | |
- | required by a bound introduced by this call
+ | ^ the trait `GlUniformScalar` is not implemented for `T`
|
help: consider further restricting this bound
|
diff --git a/tests/ui/suggestions/assoc-const-without-self.stderr b/tests/ui/suggestions/assoc-const-without-self.stderr
index 88d72da70..05528d277 100644
--- a/tests/ui/suggestions/assoc-const-without-self.stderr
+++ b/tests/ui/suggestions/assoc-const-without-self.stderr
@@ -4,7 +4,7 @@ error[E0425]: cannot find value `A_CONST` in this scope
LL | A_CONST
| ^^^^^^^ not found in this scope
|
-help: consider using the associated constant
+help: consider using the associated constant on `Self`
|
LL | Self::A_CONST
| ++++++
diff --git a/tests/ui/suggestions/assoc-type-in-method-return.stderr b/tests/ui/suggestions/assoc-type-in-method-return.stderr
index 202e4a16e..df3828ad4 100644
--- a/tests/ui/suggestions/assoc-type-in-method-return.stderr
+++ b/tests/ui/suggestions/assoc-type-in-method-return.stderr
@@ -2,7 +2,12 @@ error[E0412]: cannot find type `Bla` in this scope
--> $DIR/assoc-type-in-method-return.rs:3:25
|
LL | fn to_bla(&self) -> Bla;
- | ^^^ help: you might have meant to use the associated type: `Self::Bla`
+ | ^^^
+ |
+help: you might have meant to use the associated type
+ |
+LL | fn to_bla(&self) -> Self::Bla;
+ | ++++++
error: aborting due to previous error
diff --git a/tests/ui/suggestions/assoc_fn_without_self.rs b/tests/ui/suggestions/assoc_fn_without_self.rs
index 778d98477..35c16ef3e 100644
--- a/tests/ui/suggestions/assoc_fn_without_self.rs
+++ b/tests/ui/suggestions/assoc_fn_without_self.rs
@@ -17,4 +17,12 @@ impl S {
bar(); //~ ERROR cannot find function `bar` in this scope
baz(2, 3); //~ ERROR cannot find function `baz` in this scope
}
+ fn d(&self) {
+ fn c() {
+ foo(); //~ ERROR cannot find function `foo` in this scope
+ }
+ foo(); //~ ERROR cannot find function `foo` in this scope
+ bar(); //~ ERROR cannot find function `bar` in this scope
+ baz(2, 3); //~ ERROR cannot find function `baz` in this scope
+ }
}
diff --git a/tests/ui/suggestions/assoc_fn_without_self.stderr b/tests/ui/suggestions/assoc_fn_without_self.stderr
index febdd6733..9cee7c7ee 100644
--- a/tests/ui/suggestions/assoc_fn_without_self.stderr
+++ b/tests/ui/suggestions/assoc_fn_without_self.stderr
@@ -4,7 +4,7 @@ error[E0425]: cannot find function `foo` in this scope
LL | foo();
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::foo();
| ++++++
@@ -12,31 +12,68 @@ LL | Self::foo();
error[E0425]: cannot find function `bar` in this scope
--> $DIR/assoc_fn_without_self.rs:17:9
|
+LL | fn bar(&self) {}
+ | --- a method by that name is available on `Self` here
+...
+LL | bar();
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `baz` in this scope
+ --> $DIR/assoc_fn_without_self.rs:18:9
+ |
+LL | baz(2, 3);
+ | ^^^ not found in this scope
+ |
+help: consider using the associated function on `Self`
+ |
+LL | Self::baz(2, 3);
+ | ++++++
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/assoc_fn_without_self.rs:14:13
+ |
+LL | foo();
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/assoc_fn_without_self.rs:24:9
+ |
+LL | foo();
+ | ^^^ not found in this scope
+ |
+help: consider using the associated function on `Self`
+ |
+LL | Self::foo();
+ | ++++++
+
+error[E0425]: cannot find function `bar` in this scope
+ --> $DIR/assoc_fn_without_self.rs:25:9
+ |
LL | bar();
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the method on `Self`
|
LL | self.bar();
| +++++
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/assoc_fn_without_self.rs:18:9
+ --> $DIR/assoc_fn_without_self.rs:26:9
|
LL | baz(2, 3);
| ^^^ not found in this scope
|
-help: consider using the associated function
+help: consider using the associated function on `Self`
|
LL | Self::baz(2, 3);
| ++++++
error[E0425]: cannot find function `foo` in this scope
- --> $DIR/assoc_fn_without_self.rs:14:13
+ --> $DIR/assoc_fn_without_self.rs:22:13
|
LL | foo();
| ^^^ not found in this scope
-error: aborting due to 4 previous errors
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
index 8ed62f854..3065f83ea 100644
--- a/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
+++ b/tests/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
@@ -18,16 +18,16 @@ help: use parentheses to call this function
LL | bar(foo());
| ++
-error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future
+error[E0277]: `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:12:9
|
LL | bar(async_closure);
- | --- ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` is not a future
+ | --- ^^^^^^^^^^^^^ `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}` is not a future
| |
| required by a bound introduced by this call
|
- = help: the trait `Future` is not implemented for closure `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]`
- = note: [closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33] must be a future or must implement `IntoFuture` to be awaited
+ = help: the trait `Future` is not implemented for closure `{closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33}`
+ = note: {closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33} must be a future or must implement `IntoFuture` to be awaited
note: required by a bound in `bar`
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16
|
diff --git a/tests/ui/suggestions/auxiliary/extern-issue-98562.rs b/tests/ui/suggestions/auxiliary/extern-issue-98562.rs
new file mode 100644
index 000000000..948e40549
--- /dev/null
+++ b/tests/ui/suggestions/auxiliary/extern-issue-98562.rs
@@ -0,0 +1,26 @@
+pub trait TraitE {
+ type I3;
+}
+
+pub trait TraitD {
+ type I3;
+}
+
+pub trait TraitC {
+ type I1;
+ type I2;
+}
+
+pub trait TraitB {
+ type Item;
+}
+
+pub trait TraitA<G1, G2, G3> {
+ fn baz<
+ U: TraitC<I1 = G1, I2 = G2> + TraitD<I3 = G3> + TraitE,
+ V: TraitD<I3 = G1>
+ >(_: U, _: V) -> Self
+ where
+ U: TraitB,
+ <U as TraitB>::Item: Copy;
+}
diff --git a/tests/ui/suggestions/call-boxed.stderr b/tests/ui/suggestions/call-boxed.stderr
index 9b31ee07c..11823ff09 100644
--- a/tests/ui/suggestions/call-boxed.stderr
+++ b/tests/ui/suggestions/call-boxed.stderr
@@ -6,10 +6,10 @@ LL | let mut x = 1i32;
LL | let y = Box::new(|| 1);
| -- the found closure
LL | x = y;
- | ^ expected `i32`, found `Box<[closure@call-boxed.rs:3:22]>`
+ | ^ expected `i32`, found `Box<{closure@call-boxed.rs:3:22}>`
|
= note: expected type `i32`
- found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>`
+ found struct `Box<{closure@$DIR/call-boxed.rs:3:22: 3:24}>`
help: use parentheses to call this closure
|
LL | x = y();
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
index 0232d4c8d..5093448d2 100644
--- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -79,7 +79,7 @@ LL | | }
| |_____^ expected `Pin<Box<...>>`, found `async` block
|
= note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
- found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]`
+ found `async` block `{async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6}`
help: you need to pin and box this expression
|
LL ~ Box::pin(async {
diff --git a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
index 955148315..75a3ae1a8 100644
--- a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
+++ b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
@@ -16,11 +16,11 @@ help: use parentheses to call this function
LL | bar(foo());
| ++
-error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]: T` is not satisfied
+error[E0277]: the trait bound `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}: T` is not satisfied
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9
|
LL | bar(closure);
- | --- ^^^^^^^ the trait `T` is not implemented for closure `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]`
+ | --- ^^^^^^^ the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
index a137db8cd..40bb87c8a 100644
--- a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
+++ b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr
@@ -271,7 +271,7 @@ LL | let _: usize = closure;
| expected due to this
|
= note: expected type `usize`
- found closure `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21]`
+ found closure `{closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:21}`
help: use parentheses to call this closure
|
LL | let _: usize = closure();
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index 4de9da89c..c8ce146ce 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.stderr
+++ b/tests/ui/suggestions/issue-84973-blacklist.stderr
@@ -31,11 +31,11 @@ LL + #[derive(Clone)]
LL | struct S;
|
-error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned
+error[E0277]: `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned
--> $DIR/issue-84973-blacklist.rs:17:13
|
LL | f_unpin(static || { yield; });
- | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]`
+ | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/issue-89333.stderr b/tests/ui/suggestions/issue-89333.stderr
index f73f1147d..4739f11dd 100644
--- a/tests/ui/suggestions/issue-89333.stderr
+++ b/tests/ui/suggestions/issue-89333.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'a> &'a _: Trait` is not satisfied
LL | test(&|| 0);
| ^^^^ the trait `for<'a> Trait` is not implemented for `&'a _`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-89333.rs:9:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `test`
--> $DIR/issue-89333.rs:11:55
|
diff --git a/tests/ui/suggestions/issue-98562.rs b/tests/ui/suggestions/issue-98562.rs
new file mode 100644
index 000000000..de04050d5
--- /dev/null
+++ b/tests/ui/suggestions/issue-98562.rs
@@ -0,0 +1,12 @@
+// aux-build:extern-issue-98562.rs
+
+extern crate extern_issue_98562;
+use extern_issue_98562::TraitA;
+
+struct X;
+impl TraitA<u8, u16, u32> for X {
+ //~^ ERROR not all trait items implemented
+}
+//~^ HELP implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }`
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-98562.stderr b/tests/ui/suggestions/issue-98562.stderr
new file mode 100644
index 000000000..7897fa441
--- /dev/null
+++ b/tests/ui/suggestions/issue-98562.stderr
@@ -0,0 +1,11 @@
+error[E0046]: not all trait items implemented, missing: `baz`
+ --> $DIR/issue-98562.rs:7:1
+ |
+LL | impl TraitA<u8, u16, u32> for X {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `baz` in implementation
+ |
+ = help: implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index 93cfa60b5..318ea4083 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -12,7 +12,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap
LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
| ------ ------------- opaque type defined here
| |
- | hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here
+ | hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here
...
LL | / move || {
LL | |
diff --git a/tests/ui/suggestions/missing-assoc-fn.stderr b/tests/ui/suggestions/missing-assoc-fn.stderr
index 77fa95628..84cb6e985 100644
--- a/tests/ui/suggestions/missing-assoc-fn.stderr
+++ b/tests/ui/suggestions/missing-assoc-fn.stderr
@@ -28,7 +28,7 @@ error[E0046]: not all trait items implemented, missing: `from_iter`
LL | impl FromIterator<()> for X {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation
|
- = help: implement the missing item: `fn from_iter<T>(_: T) -> Self where T: IntoIterator, std::iter::IntoIterator::Item = () { todo!() }`
+ = help: implement the missing item: `fn from_iter<T: IntoIterator<Item = ()>>(_: T) -> Self { todo!() }`
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/return-closures.stderr b/tests/ui/suggestions/return-closures.stderr
index 8b856d8de..f0810bbb2 100644
--- a/tests/ui/suggestions/return-closures.stderr
+++ b/tests/ui/suggestions/return-closures.stderr
@@ -8,7 +8,7 @@ LL | |x: &i32| 1i32
| ^^^^^^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/return-closures.rs:3:5: 3:14]`
+ found closure `{closure@$DIR/return-closures.rs:3:5: 3:14}`
error[E0308]: mismatched types
--> $DIR/return-closures.rs:9:5
@@ -20,7 +20,7 @@ LL | || i
| ^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/return-closures.rs:9:5: 9:7]`
+ found closure `{closure@$DIR/return-closures.rs:9:5: 9:7}`
error: aborting due to 2 previous errors
diff --git a/tests/ui/suggestions/sugg-else-for-closure.stderr b/tests/ui/suggestions/sugg-else-for-closure.stderr
index 09553b93c..80ad3f9e4 100644
--- a/tests/ui/suggestions/sugg-else-for-closure.stderr
+++ b/tests/ui/suggestions/sugg-else-for-closure.stderr
@@ -7,8 +7,8 @@ LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
| arguments to this method are incorrect
|
= note: expected reference `&str`
- found closure `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]`
-help: the return type of this call is `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]` due to the type of the argument passed
+ found closure `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}`
+help: the return type of this call is `{closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28}` due to the type of the argument passed
--> $DIR/sugg-else-for-closure.rs:6:14
|
LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
diff --git a/tests/ui/suggestions/suggest-box.stderr b/tests/ui/suggestions/suggest-box.stderr
index 9a4e9fef4..e5d5ecc0b 100644
--- a/tests/ui/suggestions/suggest-box.stderr
+++ b/tests/ui/suggestions/suggest-box.stderr
@@ -11,7 +11,7 @@ LL | | };
| |_____^ expected `Box<dyn Fn() -> Result<(), ()>>`, found closure
|
= note: expected struct `Box<dyn Fn() -> Result<(), ()>>`
- found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]`
+ found closure `{closure@$DIR/suggest-box.rs:4:47: 4:49}`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
help: store this in the heap by calling `Box::new`
|
diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr
index 24bedb529..19e9af145 100644
--- a/tests/ui/suggestions/unnamable-types.stderr
+++ b/tests/ui/suggestions/unnamable-types.stderr
@@ -19,7 +19,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
LL | const C: _ = || 42;
| ^ not allowed in type signatures
|
-note: however, the inferred type `[closure@unnamable-types.rs:17:14]` cannot be named
+note: however, the inferred type `{closure@unnamable-types.rs:17:14}` cannot be named
--> $DIR/unnamable-types.rs:17:14
|
LL | const C: _ = || 42;
@@ -31,7 +31,7 @@ error: missing type for `const` item
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
| ^
|
-note: however, the inferred type `S<[closure@unnamable-types.rs:23:31]>` cannot be named
+note: however, the inferred type `S<{closure@unnamable-types.rs:23:31}>` cannot be named
--> $DIR/unnamable-types.rs:23:11
|
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
@@ -55,7 +55,7 @@ error: missing type for `const` item
LL | const G = || -> i32 { yield 0; return 1; };
| ^
|
-note: however, the inferred type `[generator@$DIR/unnamable-types.rs:37:11: 37:20]` cannot be named
+note: however, the inferred type `{generator@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named
--> $DIR/unnamable-types.rs:37:11
|
LL | const G = || -> i32 { yield 0; return 1; };
diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr
index c1cbefac8..61d27ec69 100644
--- a/tests/ui/symbol-names/basic.legacy.stderr
+++ b/tests/ui/symbol-names/basic.legacy.stderr
@@ -1,10 +1,10 @@
-error: symbol-name(_ZN5basic4main17h6fc0c8d27b1a289fE)
+error: symbol-name(_ZN5basic4main17h9308686d0228fa1dE)
--> $DIR/basic.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
-error: demangling(basic::main::h6fc0c8d27b1a289f)
+error: demangling(basic::main::h9308686d0228fa1d)
--> $DIR/basic.rs:8:1
|
LL | #[rustc_symbol_name]
diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr
index 7dd68e6e3..eb65f3b58 100644
--- a/tests/ui/symbol-names/issue-60925.legacy.stderr
+++ b/tests/ui/symbol-names/issue-60925.legacy.stderr
@@ -1,10 +1,10 @@
-error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hab58a402db4ebf3aE)
+error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h84ab5dafbd2a1508E)
--> $DIR/issue-60925.rs:21:9
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
-error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hab58a402db4ebf3a)
+error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h84ab5dafbd2a1508)
--> $DIR/issue-60925.rs:21:9
|
LL | #[rustc_symbol_name]
diff --git a/tests/ui/test-attrs/issue-36768.rs b/tests/ui/test-attrs/issue-36768.rs
index f671cbc82..7531f3621 100644
--- a/tests/ui/test-attrs/issue-36768.rs
+++ b/tests/ui/test-attrs/issue-36768.rs
@@ -1,6 +1,6 @@
// run-pass
// compile-flags:--test
-#![deny(private_in_public)]
+#![deny(private_interfaces)]
#[test] fn foo() {}
mod foo {}
diff --git a/tests/ui/track-diagnostics/track.rs b/tests/ui/track-diagnostics/track.rs
index 61b9137ea..97bd7789a 100644
--- a/tests/ui/track-diagnostics/track.rs
+++ b/tests/ui/track-diagnostics/track.rs
@@ -6,6 +6,11 @@
// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
// normalize-stderr-test "note: rustc .+ running on .+" -> "note: rustc $$VERSION running on $$TARGET"
+// The test becomes too flaky if we care about exact args. If `-Z ui-testing`
+// from compiletest and `-Z track-diagnostics` from `// compile-flags` at the
+// top of this file are present, then assume all args are present.
+// normalize-stderr-test "note: compiler flags: .*-Z ui-testing.*-Z track-diagnostics" -> "note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics"
+
fn main() {
break rust
}
diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr
index 8256c1f5f..60254dc47 100644
--- a/tests/ui/track-diagnostics/track.stderr
+++ b/tests/ui/track-diagnostics/track.stderr
@@ -20,6 +20,8 @@ note: we would appreciate a joke overview: https://github.com/rust-lang/rust/iss
note: rustc $VERSION running on $TARGET
+note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics
+
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0268, E0425.
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
new file mode 100644
index 000000000..91525bc90
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
@@ -0,0 +1,6 @@
+// Regression test for one part of issue #105306.
+
+fn main() {
+ let _ = Option::<[u8]>::None;
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+}
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
new file mode 100644
index 000000000..32f6b00b2
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/enum-unit-variant-trait-bound.rs:4:22
+ |
+LL | let _ = Option::<[u8]>::None;
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+note: required by a bound in `None`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/trait-bounds/issue-82038.rs b/tests/ui/trait-bounds/issue-82038.rs
new file mode 100644
index 000000000..11de714fa
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.rs
@@ -0,0 +1,9 @@
+// Failed bound `bool: Foo` must not point at the `Self: Clone` line
+
+trait Foo {
+ fn my_method() where Self: Clone;
+}
+
+fn main() {
+ <bool as Foo>::my_method(); //~ERROR [E0277]
+}
diff --git a/tests/ui/trait-bounds/issue-82038.stderr b/tests/ui/trait-bounds/issue-82038.stderr
new file mode 100644
index 000000000..30bb4a0a8
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `bool: Foo` is not satisfied
+ --> $DIR/issue-82038.rs:8:6
+ |
+LL | <bool as Foo>::my_method();
+ | ^^^^ the trait `Foo` is not implemented for `bool`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-82038.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr
index 56acfbe80..4c2d8e9f0 100644
--- a/tests/ui/traits/bad-method-typaram-kind.stderr
+++ b/tests/ui/traits/bad-method-typaram-kind.stderr
@@ -2,7 +2,9 @@ error[E0277]: `T` cannot be sent between threads safely
--> $DIR/bad-method-typaram-kind.rs:2:13
|
LL | 1.bar::<T>();
- | ^ `T` cannot be sent between threads safely
+ | --- ^ `T` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
|
note: required by a bound in `Bar::bar`
--> $DIR/bad-method-typaram-kind.rs:6:14
diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
index 61237a63e..530264b34 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
LL | fn explode(x: Foo<u32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `u32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-fns.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-in-fns.rs:3:14
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `f32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-fns.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums-in-fns.rs:7:12
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
index 8a4374226..372bbabbd 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied
LL | impl PolyTrait<Foo<u16>> for Struct {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-in-impls.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-in-impls.rs:3:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
index 20bbe69c0..01cf76c62 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | let baz: Foo<usize> = loop { };
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-locals.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-locals.rs:5:14
|
@@ -16,6 +21,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied
LL | x: 3
| ^ the trait `Trait` is not implemented for `{integer}`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-locals.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-locals.rs:5:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.stderr b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
index fda734e85..fa14aff68 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | static X: Foo<usize> = Foo {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-static.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-static.rs:5:14
|
diff --git a/tests/ui/traits/bound/on-structs-and-enums.stderr b/tests/ui/traits/bound/on-structs-and-enums.stderr
index fe05b8634..606f76485 100644
--- a/tests/ui/traits/bound/on-structs-and-enums.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums.stderr
@@ -20,6 +20,11 @@ error[E0277]: the trait bound `isize: Trait` is not satisfied
LL | a: Foo<isize>,
| ^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums.rs:3:14
|
@@ -32,6 +37,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums.rs:7:12
|
@@ -76,6 +86,11 @@ error[E0277]: the trait bound `i32: Trait` is not satisfied
LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums.rs:3:14
|
@@ -88,6 +103,11 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
LL | DictionaryLike { field: Bar<u8> },
| ^^^^^^^ the trait `Trait` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums.rs:1:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/on-structs-and-enums.rs:7:12
|
diff --git a/tests/ui/traits/deny-builtin-object-impl.current.stderr b/tests/ui/traits/deny-builtin-object-impl.current.stderr
index 5c1987426..8ca3d3a05 100644
--- a/tests/ui/traits/deny-builtin-object-impl.current.stderr
+++ b/tests/ui/traits/deny-builtin-object-impl.current.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied
LL | test_not_object::<dyn NotObject>();
| ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/deny-builtin-object-impl.rs:10:1
+ |
+LL | trait NotObject {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `test_not_object`
--> $DIR/deny-builtin-object-impl.rs:14:23
|
diff --git a/tests/ui/traits/deny-builtin-object-impl.next.stderr b/tests/ui/traits/deny-builtin-object-impl.next.stderr
index 5c1987426..8ca3d3a05 100644
--- a/tests/ui/traits/deny-builtin-object-impl.next.stderr
+++ b/tests/ui/traits/deny-builtin-object-impl.next.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied
LL | test_not_object::<dyn NotObject>();
| ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/deny-builtin-object-impl.rs:10:1
+ |
+LL | trait NotObject {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `test_not_object`
--> $DIR/deny-builtin-object-impl.rs:14:23
|
diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
index 934d20b22..a5d0e6ab0 100644
--- a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
+++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
@@ -5,13 +5,16 @@ LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
| ^^^^^^^ not found in this scope
error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied
- --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:6
|
LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
- | ----------------------------- ^^^^^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`
- | |
- | required by a bound introduced by this call
+ | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:3:1
|
+LL | trait Foo<'x, T> {}
+ | ^^^^^^^^^^^^^^^^
note: required for `i32` to implement `RefFoo<i32>`
--> $DIR/dont-autoderef-ty-with-escaping-var.rs:9:9
|
diff --git a/tests/ui/traits/impl-bounds-checking.stderr b/tests/ui/traits/impl-bounds-checking.stderr
index 1f969efe1..bfa8213ab 100644
--- a/tests/ui/traits/impl-bounds-checking.stderr
+++ b/tests/ui/traits/impl-bounds-checking.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied
LL | impl Getter<isize> for isize {
| ^^^^^ the trait `Clone2` is not implemented for `isize`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/impl-bounds-checking.rs:1:1
+ |
+LL | pub trait Clone2 {
+ | ^^^^^^^^^^^^^^^^
note: required by a bound in `Getter`
--> $DIR/impl-bounds-checking.rs:6:17
|
diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
index 656e0d0bf..7027fa69e 100644
--- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
+++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
@@ -24,12 +24,10 @@ LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
| ++++++++++++++++
error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
- --> $DIR/repeated-supertrait-ambig.rs:34:37
+ --> $DIR/repeated-supertrait-ambig.rs:34:6
|
LL | <dyn CompareToInts>::same_as(c, 22)
- | ---------------------------- ^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
|
= help: the following other types implement trait `CompareTo<T>`:
<i64 as CompareTo<i64>>
diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs
index bb2b13664..74c7afd6b 100644
--- a/tests/ui/traits/issue-105231.rs
+++ b/tests/ui/traits/issue-105231.rs
@@ -1,9 +1,9 @@
+//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
struct A<T>(B<T>);
//~^ ERROR recursive types `A` and `B` have infinite size
struct B<T>(A<A<T>>);
trait Foo {}
impl<T> Foo for T where T: Send {}
-//~^ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
impl Foo for B<u8> {}
fn main() {}
diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr
index 76a710673..fe20c47c5 100644
--- a/tests/ui/traits/issue-105231.stderr
+++ b/tests/ui/traits/issue-105231.stderr
@@ -1,5 +1,5 @@
error[E0072]: recursive types `A` and `B` have infinite size
- --> $DIR/issue-105231.rs:1:1
+ --> $DIR/issue-105231.rs:2:1
|
LL | struct A<T>(B<T>);
| ^^^^^^^^^^^ ---- recursive without indirection
@@ -15,14 +15,10 @@ LL ~ struct B<T>(Box<A<A<T>>>);
|
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
- --> $DIR/issue-105231.rs:5:28
- |
-LL | impl<T> Foo for T where T: Send {}
- | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
- --> $DIR/issue-105231.rs:3:8
+ --> $DIR/issue-105231.rs:4:8
|
LL | struct B<T>(A<A<T>>);
| ^
diff --git a/tests/ui/issues/issue-66768.rs b/tests/ui/traits/issue-66768.rs
index ce42c8b01..ce42c8b01 100644
--- a/tests/ui/issues/issue-66768.rs
+++ b/tests/ui/traits/issue-66768.rs
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index d4fea05fe..33cc186ac 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -35,23 +35,12 @@ help: consider specifying the generic argument
LL | opts.get::<Q>(opt.as_ref());
| +++++
-error[E0283]: type annotations needed
+error[E0282]: type annotations needed
--> $DIR/issue-77982.rs:13:59
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
- | --------- ^^^^
- | |
- | required by a bound introduced by this call
- |
- = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
- - impl From<Ipv4Addr> for u32;
- - impl From<NonZeroU32> for u32;
- - impl From<bool> for u32;
- - impl From<char> for u32;
- - impl From<u16> for u32;
- - impl From<u8> for u32;
- - impl<T> From<!> for T;
- - impl<T> From<T> for T;
+ | ^^^^
+ |
help: try using a fully qualified path to specify the expected types
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect();
@@ -95,4 +84,5 @@ LL | let _: Box<T> = (&()).bar();
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0283`.
+Some errors have detailed explanations: E0282, E0283.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
index c6fc7bb12..4593fa2c4 100644
--- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
+++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
@@ -23,7 +23,7 @@ LL | impl<T, I: Iterator<Item = T>> Iterator for IteratorOfWrapped<T, I> {
| |
| unsatisfied trait bound introduced here
= note: 256 redundant requirements hidden
- = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>` to implement `Iterator`
+ = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/traits/issue-99875.stderr b/tests/ui/traits/issue-99875.stderr
index fb6eebbd2..29e875715 100644
--- a/tests/ui/traits/issue-99875.stderr
+++ b/tests/ui/traits/issue-99875.stderr
@@ -16,11 +16,11 @@ help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`,
LL | takes(function as fn(Argument) -> Return);
| +++++++++++++++++++++++++
-error[E0277]: the trait bound `[closure@$DIR/issue-99875.rs:14:11: 14:34]: Trait` is not satisfied
+error[E0277]: the trait bound `{closure@$DIR/issue-99875.rs:14:11: 14:34}: Trait` is not satisfied
--> $DIR/issue-99875.rs:14:11
|
LL | takes(|_: Argument| -> Return { todo!() });
- | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `[closure@$DIR/issue-99875.rs:14:11: 14:34]`
+ | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/issue-99875.rs:14:11: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
index 8eda64e44..46677a583 100644
--- a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
+++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr
@@ -5,6 +5,8 @@ LL | impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
| --------------------------------------------------------- first implementation here
LL | impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc`
+ |
+ = note: downstream crates may implement trait `TraitB` for type `std::boxed::Box<_>`
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/new-solver/async.fail.stderr
index 72fa2eb31..44097b556 100644
--- a/tests/ui/traits/new-solver/async.fail.stderr
+++ b/tests/ui/traits/new-solver/async.fail.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32`
+error[E0271]: type mismatch resolving `<{async block@$DIR/async.rs:12:17: 12:25} as Future>::Output == i32`
--> $DIR/async.rs:12:17
|
LL | needs_async(async {});
diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
index e311a4af2..6b54718e3 100644
--- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
@@ -1,4 +1,4 @@
-// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir
+// compile-flags: -Ztrait-solver=next
// edition: 2021
// revisions: pass fail
//[pass] check-pass
diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
index f7551739b..4eaa25961 100644
--- a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
+++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr
@@ -1,10 +1,8 @@
error[E0277]: expected a `Fn<_>` closure, found `fn() -> str`
- --> $DIR/builtin-fn-must-return-sized.rs:15:27
+ --> $DIR/builtin-fn-must-return-sized.rs:15:11
|
LL | foo::<fn() -> str, _>(None, ());
- | --------------------- ^^^^ expected an `Fn<_>` closure, found `fn() -> str`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^ expected an `Fn<_>` closure, found `fn() -> str`
|
= help: the trait `Fn<_>` is not implemented for `fn() -> str`
note: required by a bound in `foo`
diff --git a/tests/ui/traits/new-solver/canonicalize-effect-var.rs b/tests/ui/traits/new-solver/canonicalize-effect-var.rs
new file mode 100644
index 000000000..35b69ed1a
--- /dev/null
+++ b/tests/ui/traits/new-solver/canonicalize-effect-var.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(effects)]
+#![feature(const_trait_impl)]
+
+#[const_trait]
+trait Foo {
+ fn foo();
+}
+
+trait Bar {}
+
+impl const Foo for i32 {
+ fn foo() {}
+}
+
+impl<T> const Foo for T where T: Bar {
+ fn foo() {}
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
index 5d5f325e4..73d46c4df 100644
--- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
@@ -1,3 +1,7 @@
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
+WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <<LocalTy as Overflow>::Assoc as std::marker::Sized>
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1
|
@@ -6,6 +10,8 @@ LL | impl<T: Copy> Trait for T {}
LL | struct LocalTy;
LL | impl Trait for <LocalTy as Overflow>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
+ |
+ = note: upstream crates may add a new impl of trait `std::marker::Copy` for type `<LocalTy as Overflow>::Assoc` in future versions
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
index 7d3535e1f..a86115671 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -5,10 +5,10 @@ LL | impls::<W<_>>();
| ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
- --> $DIR/fixpoint-exponential-growth.rs:29:5
+ --> $DIR/fixpoint-exponential-growth.rs:29:13
|
LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^
+ | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`)
note: required by a bound in `impls`
diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
index 4b8846da5..a3404da51 100644
--- a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
+++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `(): Trait`
- --> $DIR/double-cycle-inductive-coinductive.rs:32:5
+ --> $DIR/double-cycle-inductive-coinductive.rs:32:19
|
LL | impls_trait::<()>();
- | ^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
note: required by a bound in `impls_trait`
@@ -12,10 +12,10 @@ LL | fn impls_trait<T: Trait>() {}
| ^^^^^ required by this bound in `impls_trait`
error[E0275]: overflow evaluating the requirement `(): TraitRev`
- --> $DIR/double-cycle-inductive-coinductive.rs:35:5
+ --> $DIR/double-cycle-inductive-coinductive.rs:35:23
|
LL | impls_trait_rev::<()>();
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
note: required by a bound in `impls_trait_rev`
diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
new file mode 100644
index 000000000..279063923
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs
@@ -0,0 +1,53 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs)]
+
+// Check that we correctly rerun the trait solver for heads of cycles,
+// even if they are not the root.
+
+struct A<T: ?Sized>(*const T);
+struct B<T: ?Sized>(*const T);
+struct C<T: ?Sized>(*const T);
+
+#[rustc_coinductive]
+trait Trait<'a, 'b> {}
+trait NotImplemented {}
+
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for A<T> where B<T>: Trait<'a, 'b> {}
+
+// With this the root of `B<T>` is `A<T>`, even if the other impl does
+// not have a cycle with `A<T>`. This candidate never applies because of
+// the `A<T>: NotImplemented` bound.
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for B<T>
+where
+ A<T>: Trait<'a, 'b>,
+ A<T>: NotImplemented,
+{
+}
+
+// This impl directly requires 'b to be equal to 'static.
+//
+// Because of the coinductive cycle through `C<T>` it also requires
+// 'a to be 'static.
+impl<'a, T: ?Sized> Trait<'a, 'static> for B<T>
+where
+ C<T>: Trait<'a, 'a>,
+{}
+
+// In the first iteration of `B<T>: Trait<'a, 'b>` we don't add any
+// constraints here, only after setting the provisional result to require
+// `'b == 'static` do we also add that constraint for `'a`.
+impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for C<T>
+where
+ B<T>: Trait<'a, 'b>,
+{}
+
+fn impls_trait<'a, 'b, T: Trait<'a, 'b> + ?Sized>() {}
+
+fn check<'a, T: ?Sized>() {
+ impls_trait::<'a, 'static, A<T>>();
+ //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {
+ check::<()>();
+}
diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr
new file mode 100644
index 000000000..4cbd08981
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+ --> $DIR/fixpoint-rerun-all-cycle-heads.rs:47:5
+ |
+LL | fn check<'a, T: ?Sized>() {
+ | -- lifetime `'a` defined here
+LL | impls_trait::<'a, 'static, A<T>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
index 3cfe7ab87..f06b98a79 100644
--- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
@@ -39,7 +39,7 @@ fn impls_ar<T: AR>() {}
fn main() {
impls_a::<()>();
- // FIXME(-Ztrait-solver=next): This is broken and should error.
+ //~^ ERROR overflow evaluating the requirement `(): A`
impls_ar::<()>();
//~^ ERROR overflow evaluating the requirement `(): AR`
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
index 0e1c86c1b..859b3f3f1 100644
--- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
@@ -1,8 +1,21 @@
+error[E0275]: overflow evaluating the requirement `(): A`
+ --> $DIR/inductive-not-on-stack.rs:41:15
+ |
+LL | impls_a::<()>();
+ | ^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
+note: required by a bound in `impls_a`
+ --> $DIR/inductive-not-on-stack.rs:25:15
+ |
+LL | fn impls_a<T: A>() {}
+ | ^ required by this bound in `impls_a`
+
error[E0275]: overflow evaluating the requirement `(): AR`
- --> $DIR/inductive-not-on-stack.rs:44:5
+ --> $DIR/inductive-not-on-stack.rs:44:16
|
LL | impls_ar::<()>();
- | ^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
note: required by a bound in `impls_ar`
@@ -11,6 +24,6 @@ note: required by a bound in `impls_ar`
LL | fn impls_ar<T: AR>() {}
| ^^ required by this bound in `impls_ar`
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs
new file mode 100644
index 000000000..b9798c79d
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs
@@ -0,0 +1,19 @@
+// compile-flags: -Ztrait-solver=next-coherence
+
+// Makes sure we don't ICE on associated const projection when the feature gate
+// is not enabled, since we should avoid encountering ICEs on stable if possible.
+
+trait Bar {
+ const ASSOC: usize;
+}
+impl Bar for () {
+ const ASSOC: usize = 1;
+}
+
+trait Foo {}
+impl Foo for () {}
+impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+//~^ ERROR associated const equality is incomplete
+//~| ERROR conflicting implementations of trait `Foo` for type `()`
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
new file mode 100644
index 000000000..7ad495a35
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
@@ -0,0 +1,21 @@
+error[E0658]: associated const equality is incomplete
+ --> $DIR/dont-ice-on-assoc-projection.rs:15:32
+ |
+LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+ | ^^^^^^^^^
+ |
+ = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
+ = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
+
+error[E0119]: conflicting implementations of trait `Foo` for type `()`
+ --> $DIR/dont-ice-on-assoc-projection.rs:15:1
+ |
+LL | impl Foo for () {}
+ | --------------- first implementation here
+LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
+ | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0119, E0658.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
index ec1c3231a..a31bfd958 100644
--- a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
+++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed: cannot satisfy `Foo: Send`
- --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5
+ --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18
|
LL | needs_send::<Foo>();
- | ^^^^^^^^^^^^^^^^^
+ | ^^^
|
= note: cannot satisfy `Foo: Send`
note: required by a bound in `needs_send`
diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr
index d94d41e35..e3fe4bf5a 100644
--- a/tests/ui/traits/new-solver/generator.fail.stderr
+++ b/tests/ui/traits/new-solver/generator.fail.stderr
@@ -1,4 +1,4 @@
-error[E0277]: the trait bound `[generator@$DIR/generator.rs:18:21: 18:23]: Generator<A>` is not satisfied
+error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Generator<A>` is not satisfied
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
@@ -10,7 +10,7 @@ LL | |
LL | |
LL | | yield ();
LL | | });
- | |_____^ the trait `Generator<A>` is not implemented for `[generator@$DIR/generator.rs:18:21: 18:23]`
+ | |_____^ the trait `Generator<A>` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}`
|
note: required by a bound in `needs_generator`
--> $DIR/generator.rs:14:28
@@ -18,7 +18,7 @@ note: required by a bound in `needs_generator`
LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator<A>>::Yield == B`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Yield == B`
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
@@ -38,7 +38,7 @@ note: required by a bound in `needs_generator`
LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
| ^^^^^^^^^ required by this bound in `needs_generator`
-error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator<A>>::Return == C`
+error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Return == C`
--> $DIR/generator.rs:18:21
|
LL | needs_generator(|| {
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index 28a99cbbc..beed40f36 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -5,10 +5,10 @@ LL | impls::<W<_>>();
| ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
- --> $DIR/exponential-trait-goals.rs:17:5
+ --> $DIR/exponential-trait-goals.rs:17:13
|
LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^
+ | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`exponential_trait_goals`)
note: required by a bound in `impls`
diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/new-solver/overflow/global-cache.stderr
index f3b86a083..ebb03d84b 100644
--- a/tests/ui/traits/new-solver/overflow/global-cache.stderr
+++ b/tests/ui/traits/new-solver/overflow/global-cache.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `Inc<Inc<Inc<Inc<Inc<Inc<Inc<...>>>>>>>: Trait`
- --> $DIR/global-cache.rs:21:5
+ --> $DIR/global-cache.rs:21:19
|
LL | impls_trait::<Four<Four<Four<Four<()>>>>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`)
note: required by a bound in `impls_trait`
diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs
new file mode 100644
index 000000000..539c9614e
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs
@@ -0,0 +1,12 @@
+//~ ERROR overflow evaluating the requirement `Self well-formed`
+//~| ERROR overflow evaluating the requirement `Self: Trait`
+
+// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE.
+// compile-flags: -Ztrait-solver=next --crate-type=lib
+// check-fail
+
+#![recursion_limit = "0"]
+trait Trait {}
+impl Trait for u32 {}
+//~^ ERROR overflow evaluating the requirement `u32: Trait`
+//~| ERROR overflow evaluating the requirement `u32 well-formed`
diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr
new file mode 100644
index 000000000..16b25d90a
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr
@@ -0,0 +1,27 @@
+error[E0275]: overflow evaluating the requirement `Self: Trait`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `Self well-formed`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `u32: Trait`
+ --> $DIR/recursion-limit-zero-issue-115351.rs:10:16
+ |
+LL | impl Trait for u32 {}
+ | ^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error[E0275]: overflow evaluating the requirement `u32 well-formed`
+ --> $DIR/recursion-limit-zero-issue-115351.rs:10:16
+ |
+LL | impl Trait for u32 {}
+ | ^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`)
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
index eebaf21d7..1dc63fae9 100644
--- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar`
- --> $DIR/recursive-self-normalization-2.rs:16:5
+ --> $DIR/recursive-self-normalization-2.rs:16:17
|
LL | needs_bar::<T::Assoc1>();
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`)
note: required by a bound in `needs_bar`
diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
index 6a87fe2f1..afc5bfa54 100644
--- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
@@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Bar`
- --> $DIR/recursive-self-normalization.rs:12:5
+ --> $DIR/recursive-self-normalization.rs:12:17
|
LL | needs_bar::<T::Assoc>();
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`)
note: required by a bound in `needs_bar`
diff --git a/tests/ui/traits/new-solver/projection-discr-kind.stderr b/tests/ui/traits/new-solver/projection-discr-kind.stderr
index 03e28f993..e14953f19 100644
--- a/tests/ui/traits/new-solver/projection-discr-kind.stderr
+++ b/tests/ui/traits/new-solver/projection-discr-kind.stderr
@@ -6,6 +6,11 @@ LL | needs_bar(std::mem::discriminant(&x));
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-discr-kind.rs:10:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
note: required by a bound in `needs_bar`
--> $DIR/projection-discr-kind.rs:11:22
|
diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
index 83a0452b0..b311ac6b5 100644
--- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
+++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr
@@ -1,8 +1,8 @@
error[E0283]: type annotations needed: cannot satisfy `T: Bar`
- --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:5
+ --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:17
|
LL | needs_bar::<T>();
- | ^^^^^^^^^^^^^^
+ | ^
|
= note: cannot satisfy `T: Bar`
= help: the trait `Bar` is implemented for `T`
diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs
index 91c6dfb8e..bbae67f0b 100644
--- a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs
+++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs
@@ -4,7 +4,7 @@
fn b()
where
for<const C: usize> [(); C]: Copy,
- //~^ ERROR cannot capture late-bound const parameter in a constant
+ //~^ ERROR cannot capture late-bound const parameter in constant
{
}
diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
index 69bb605bf..d65892ec6 100644
--- a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
+++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr
@@ -7,7 +7,7 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
-error: cannot capture late-bound const parameter in a constant
+error: cannot capture late-bound const parameter in constant
--> $DIR/capture-late-ct-in-anon.rs:6:30
|
LL | for<const C: usize> [(); C]: Copy,
diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr
index 7bd02550f..240bcef7d 100644
--- a/tests/ui/traits/non_lifetime_binders/fail.stderr
+++ b/tests/ui/traits/non_lifetime_binders/fail.stderr
@@ -13,6 +13,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied
LL | fail();
| ^^^^ the trait `Trait` is not implemented for `T`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/fail.rs:6:1
+ |
+LL | trait Trait {}
+ | ^^^^^^^^^^^
note: required by a bound in `fail`
--> $DIR/fail.rs:10:15
|
diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
index 3903bfe9b..64f09f823 100644
--- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
+++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs
@@ -5,7 +5,7 @@
fn foo() -> usize
where
for<T> [i32; { let _: T = todo!(); 0 }]:,
- //~^ ERROR cannot capture late-bound type parameter in a constant
+ //~^ ERROR cannot capture late-bound type parameter in constant
{}
fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
index fafff02de..dc54e1acc 100644
--- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
+++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr
@@ -15,7 +15,7 @@ LL | #![feature(non_lifetime_binders, generic_const_exprs)]
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
-error: cannot capture late-bound type parameter in a constant
+error: cannot capture late-bound type parameter in constant
--> $DIR/late-bound-in-anon-ct.rs:7:27
|
LL | for<T> [i32; { let _: T = todo!(); 0 }]:,
diff --git a/tests/ui/traits/object-does-not-impl-trait.stderr b/tests/ui/traits/object-does-not-impl-trait.stderr
index f1dd508a4..81d67255a 100644
--- a/tests/ui/traits/object-does-not-impl-trait.stderr
+++ b/tests/ui/traits/object-does-not-impl-trait.stderr
@@ -6,6 +6,11 @@ LL | fn take_object(f: Box<dyn Foo>) { take_foo(f); }
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/object-does-not-impl-trait.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
note: required by a bound in `take_foo`
--> $DIR/object-does-not-impl-trait.rs:5:15
|
diff --git a/tests/ui/traits/object/enforce-supertrait-projection.rs b/tests/ui/traits/object/enforce-supertrait-projection.rs
index 2c9b41eea..0ea944ec2 100644
--- a/tests/ui/traits/object/enforce-supertrait-projection.rs
+++ b/tests/ui/traits/object/enforce-supertrait-projection.rs
@@ -7,7 +7,7 @@ trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {}
fn transmute<A, B>(x: A) -> B {
foo::<A, B, dyn Trait<A = A, B = B>>(x)
- //~^ ERROR type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
+ //~^ ERROR type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B`
}
fn foo<A, B, T: ?Sized>(x: T::A) -> B
diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr
index 848b4e69a..2fb94d348 100644
--- a/tests/ui/traits/object/enforce-supertrait-projection.stderr
+++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B`
+error[E0271]: type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B`
--> $DIR/enforce-supertrait-projection.rs:9:17
|
LL | fn transmute<A, B>(x: A) -> B {
diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr
index 542e3a28a..632f0f816 100644
--- a/tests/ui/traits/reservation-impl/no-use.next.stderr
+++ b/tests/ui/traits/reservation-impl/no-use.next.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): MyTrait` is not satisfied
- --> $DIR/no-use.rs:11:26
+ --> $DIR/no-use.rs:11:6
|
LL | <() as MyTrait>::foo(&());
- | -------------------- ^^^ the trait `MyTrait` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `MyTrait` is not implemented for `()`
|
= help: the trait `MyTrait` is implemented for `()`
diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr
index 542e3a28a..632f0f816 100644
--- a/tests/ui/traits/reservation-impl/no-use.old.stderr
+++ b/tests/ui/traits/reservation-impl/no-use.old.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): MyTrait` is not satisfied
- --> $DIR/no-use.rs:11:26
+ --> $DIR/no-use.rs:11:6
|
LL | <() as MyTrait>::foo(&());
- | -------------------- ^^^ the trait `MyTrait` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `MyTrait` is not implemented for `()`
|
= help: the trait `MyTrait` is implemented for `()`
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
index 206ab0789..d37943b92 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
@@ -1,3 +1,4 @@
+//~ ERROR overflow
// A regression test for #111729 checking that we correctly
// track recursion depth for obligations returned by confirmation.
use std::panic::RefUnwindSafe;
@@ -14,7 +15,6 @@ struct RootDatabase {
}
impl<T: RefUnwindSafe> Database for T {
- //~^ ERROR overflow
type Storage = SalsaStorage;
}
impl Database for RootDatabase {
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
index 4123a8199..8f9ce3ef1 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
@@ -1,17 +1,13 @@
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:9
- |
-LL | impl<T: RefUnwindSafe> Database for T {
- | ^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
note: required because it appears within the type `RootDatabase`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:12:8
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
|
LL | struct RootDatabase {
| ^^^^^^^^^^^^
note: required for `RootDatabase` to implement `Database`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:24
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
|
LL | impl<T: RefUnwindSafe> Database for T {
| ------------- ^^^^^^^^ ^
diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs
new file mode 100644
index 000000000..c6f9e3456
--- /dev/null
+++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs
@@ -0,0 +1,15 @@
+fn use_iterator<I>(itr: I)
+where
+ I: IntoIterator<Item = i32>,
+{
+}
+
+fn pass_iterator<I>(i: &dyn IntoIterator<Item = i32, IntoIter = I>)
+where
+ I: Iterator<Item = i32>,
+{
+ use_iterator(i);
+ //~^ ERROR `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+}
+
+fn main() {}
diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr
new file mode 100644
index 000000000..bd0e7ca2c
--- /dev/null
+++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr
@@ -0,0 +1,22 @@
+error[E0277]: `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+ --> $DIR/dont-suggest-unsize-deref.rs:11:18
+ |
+LL | use_iterator(i);
+ | ------------ ^ `&dyn IntoIterator<IntoIter = I, Item = i32>` is not an iterator
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Iterator` is not implemented for `&dyn IntoIterator<IntoIter = I, Item = i32>`
+ = note: required for `&dyn IntoIterator<IntoIter = I, Item = i32>` to implement `IntoIterator`
+note: required by a bound in `use_iterator`
+ --> $DIR/dont-suggest-unsize-deref.rs:3:8
+ |
+LL | fn use_iterator<I>(itr: I)
+ | ------------ required by a bound in this function
+LL | where
+LL | I: IntoIterator<Item = i32>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `use_iterator`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.fixed b/tests/ui/traits/suggest-dereferences/issue-39029.fixed
index a1abf668b..a1abf668b 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.fixed
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.fixed
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.rs b/tests/ui/traits/suggest-dereferences/issue-39029.rs
index 90d097105..90d097105 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.rs
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.rs
diff --git a/tests/ui/traits/suggest-deferences/issue-39029.stderr b/tests/ui/traits/suggest-dereferences/issue-39029.stderr
index 49105de3d..49105de3d 100644
--- a/tests/ui/traits/suggest-deferences/issue-39029.stderr
+++ b/tests/ui/traits/suggest-dereferences/issue-39029.stderr
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.fixed b/tests/ui/traits/suggest-dereferences/issue-62530.fixed
index 406caaa00..406caaa00 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.fixed
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.fixed
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.rs b/tests/ui/traits/suggest-dereferences/issue-62530.rs
index 53846be73..53846be73 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.rs
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.rs
diff --git a/tests/ui/traits/suggest-deferences/issue-62530.stderr b/tests/ui/traits/suggest-dereferences/issue-62530.stderr
index e47ae0b65..e47ae0b65 100644
--- a/tests/ui/traits/suggest-deferences/issue-62530.stderr
+++ b/tests/ui/traits/suggest-dereferences/issue-62530.stderr
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.fixed b/tests/ui/traits/suggest-dereferences/multiple-0.fixed
index b7160b75c..b7160b75c 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.fixed
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.fixed
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.rs b/tests/ui/traits/suggest-dereferences/multiple-0.rs
index 9ac55177f..9ac55177f 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.rs
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.rs
diff --git a/tests/ui/traits/suggest-deferences/multiple-0.stderr b/tests/ui/traits/suggest-dereferences/multiple-0.stderr
index 6a4d4b8d5..6a4d4b8d5 100644
--- a/tests/ui/traits/suggest-deferences/multiple-0.stderr
+++ b/tests/ui/traits/suggest-dereferences/multiple-0.stderr
diff --git a/tests/ui/traits/suggest-deferences/multiple-1.rs b/tests/ui/traits/suggest-dereferences/multiple-1.rs
index 91c6c7924..91c6c7924 100644
--- a/tests/ui/traits/suggest-deferences/multiple-1.rs
+++ b/tests/ui/traits/suggest-dereferences/multiple-1.rs
diff --git a/tests/ui/traits/suggest-deferences/multiple-1.stderr b/tests/ui/traits/suggest-dereferences/multiple-1.stderr
index 6e12321c2..6e12321c2 100644
--- a/tests/ui/traits/suggest-deferences/multiple-1.stderr
+++ b/tests/ui/traits/suggest-dereferences/multiple-1.stderr
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
index 7a8433f90..7a8433f90 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.fixed
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs
index 51bac2107..51bac2107 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.rs
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs
diff --git a/tests/ui/traits/suggest-deferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
index 1363fb8c4..1363fb8c4 100644
--- a/tests/ui/traits/suggest-deferences/root-obligation.stderr
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed
index ea3d1bf85..ea3d1bf85 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs
index 9eda68027..9eda68027 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs
diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr
index ede31a2c7..ede31a2c7 100644
--- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr
+++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.rs b/tests/ui/traits/suggest-fully-qualified-closure.rs
index c077921c0..6bbb6a95d 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.rs
+++ b/tests/ui/traits/suggest-fully-qualified-closure.rs
@@ -1,6 +1,6 @@
// check-fail
// known-bug: #103705
-// normalize-stderr-test "\[closure@.*\]" -> "[closure@]"
+// normalize-stderr-test "\{closure@.*\}" -> "{closure@}"
// normalize-stderr-test "\+* ~" -> "+++ ~"
// The output of this currently suggests writing a closure in the qualified path.
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 3df623c14..2aea3783f 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -6,7 +6,7 @@ LL | q.lol(||());
|
help: try using a fully qualified path to specify the expected types
|
-LL | <Qqq as MyTrait<T>>::lol::<[closure@]>(&q, ||());
+LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
error[E0283]: type annotations needed
@@ -25,7 +25,7 @@ LL | impl MyTrait<u64> for Qqq{
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using a fully qualified path to specify the expected types
|
-LL | <Qqq as MyTrait<T>>::lol::<[closure@]>(&q, ||());
+LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr
index f3a4c6890..e3bbf768c 100644
--- a/tests/ui/traits/suggest-where-clause.stderr
+++ b/tests/ui/traits/suggest-where-clause.stderr
@@ -38,10 +38,10 @@ LL + fn check<T: Iterator, U>() {
|
error[E0277]: the trait bound `u64: From<T>` is not satisfied
- --> $DIR/suggest-where-clause.rs:15:5
+ --> $DIR/suggest-where-clause.rs:15:6
|
LL | <u64 as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `u64`
+ | ^^^ the trait `From<T>` is not implemented for `u64`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
@@ -49,10 +49,10 @@ LL | fn check<T: Iterator, U: ?Sized>() where u64: From<T> {
| ++++++++++++++++++
error[E0277]: the trait bound `u64: From<<T as Iterator>::Item>` is not satisfied
- --> $DIR/suggest-where-clause.rs:18:5
+ --> $DIR/suggest-where-clause.rs:18:6
|
LL | <u64 as From<<T as Iterator>::Item>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
+ | ^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
@@ -60,10 +60,10 @@ LL | fn check<T: Iterator, U: ?Sized>() where u64: From<<T as Iterator>::Item> {
| ++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `Misc<_>: From<T>` is not satisfied
- --> $DIR/suggest-where-clause.rs:23:5
+ --> $DIR/suggest-where-clause.rs:23:6
|
LL | <Misc<_> as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
+ | ^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
error[E0277]: the size for values of type `[T]` cannot be known at compilation time
--> $DIR/suggest-where-clause.rs:28:20
diff --git a/tests/ui/traits/unsend-future.rs b/tests/ui/traits/unsend-future.rs
index fbbc07b11..a8367573f 100644
--- a/tests/ui/traits/unsend-future.rs
+++ b/tests/ui/traits/unsend-future.rs
@@ -13,6 +13,7 @@ fn require_handler<H: Handler>(h: H) {}
async fn handler() {
let a = &1 as *const i32;
async {}.await;
+ let b = a;
}
fn main() {
diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr
index 6ce1cf452..01829021b 100644
--- a/tests/ui/traits/unsend-future.stderr
+++ b/tests/ui/traits/unsend-future.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/unsend-future.rs:19:21
+ --> $DIR/unsend-future.rs:20:21
|
LL | require_handler(handler)
| ^^^^^^^ future returned by `handler` is not `Send`
@@ -12,8 +12,6 @@ LL | let a = &1 as *const i32;
| - has type `*const i32` which is not `Send`
LL | async {}.await;
| ^^^^^ await occurs here, with `a` maybe used later
-LL | }
- | - `a` is later dropped here
note: required by a bound in `require_handler`
--> $DIR/unsend-future.rs:11:23
|
diff --git a/tests/ui/traits/vtable-res-trait-param.stderr b/tests/ui/traits/vtable-res-trait-param.stderr
index 2b3e3de9b..4cfceefb2 100644
--- a/tests/ui/traits/vtable-res-trait-param.stderr
+++ b/tests/ui/traits/vtable-res-trait-param.stderr
@@ -6,6 +6,11 @@ LL | b.gimme_an_a(y)
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/vtable-res-trait-param.rs:1:1
+ |
+LL | trait TraitA {
+ | ^^^^^^^^^^^^
note: required by a bound in `TraitB::gimme_an_a`
--> $DIR/vtable-res-trait-param.rs:6:21
|
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
index 546fcbaa3..b61291633 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
//! If visibility is assumed, a transmutation should be accepted even if the
//! destination type contains an unreachable field (e.g., a public field with a
//! private type). (This rule is distinct from type privacy, which still may
@@ -29,7 +31,7 @@ mod dst {
#[repr(C)] pub(self) struct Zst; // <- unreachable type
#[repr(C)] pub(in super) struct Dst {
- pub(in super) field: Zst, //~ ERROR private type
+ pub(in super) field: Zst, //~ WARNING type `dst::Zst` is more private than the item `Dst::field`
}
}
diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
index be83b7ce3..80099388d 100644
--- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `dst::Zst` in public interface
- --> $DIR/should_accept_if_dst_has_unreachable_field.rs:32:9
+warning: type `dst::Zst` is more private than the item `Dst::field`
+ --> $DIR/should_accept_if_dst_has_unreachable_field.rs:34:9
|
-LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
- | -------------------- `dst::Zst` declared as private
-...
LL | pub(in super) field: Zst,
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Dst::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `dst::Zst` is only usable at visibility `pub(self)`
+ --> $DIR/should_accept_if_dst_has_unreachable_field.rs:31:16
+ |
+LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
index 9c8345a8e..e7742058c 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs
@@ -1,3 +1,5 @@
+// check-pass
+
//! The presence of an unreachable field in the source type (e.g., a public
//! field with a private type does not affect transmutability. (This rule is
//! distinct from type privacy, which still may forbid naming such types.)
@@ -19,7 +21,7 @@ mod src {
#[repr(C)] pub(self) struct Zst; // <- unreachable type
#[repr(C)] pub(in super) struct Src {
- pub(in super) field: Zst, //~ ERROR private type
+ pub(in super) field: Zst, //~ WARNING type `src::Zst` is more private than the item `Src::field`
}
}
diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
index 39b73302e..55fb33923 100644
--- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
+++ b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr
@@ -1,12 +1,15 @@
-error[E0446]: private type `src::Zst` in public interface
- --> $DIR/should_accept_if_src_has_unreachable_field.rs:22:9
+warning: type `src::Zst` is more private than the item `Src::field`
+ --> $DIR/should_accept_if_src_has_unreachable_field.rs:24:9
|
-LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
- | -------------------- `src::Zst` declared as private
-...
LL | pub(in super) field: Zst,
- | ^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Src::field` is reachable at visibility `pub(crate)`
+ |
+note: but type `src::Zst` is only usable at visibility `pub(self)`
+ --> $DIR/should_accept_if_src_has_unreachable_field.rs:21:16
+ |
+LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/transmute/issue-115402-overflow-size.rs b/tests/ui/transmute/issue-115402-overflow-size.rs
new file mode 100644
index 000000000..91168041e
--- /dev/null
+++ b/tests/ui/transmute/issue-115402-overflow-size.rs
@@ -0,0 +1,27 @@
+#![crate_type = "lib"]
+#![feature(transmutability)]
+mod assert {
+ use std::mem::BikeshedIntrinsicFrom;
+ struct Context;
+
+ pub fn is_maybe_transmutable<Src, Dst>()
+ where
+ Dst: BikeshedIntrinsicFrom<Src, Context>,
+ {
+ }
+}
+
+fn main() {
+ pub union Uninit {
+ a: [u8; usize::MAX],
+ }
+
+ #[repr(C)]
+ struct ExplicitlyPadded(Uninit);
+
+ assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
+ //~^ ERROR `()` cannot be safely transmuted into `ExplicitlyPadded`
+
+ assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
+ //~^ ERROR `ExplicitlyPadded` cannot be safely transmuted into `()`
+}
diff --git a/tests/ui/transmute/issue-115402-overflow-size.stderr b/tests/ui/transmute/issue-115402-overflow-size.stderr
new file mode 100644
index 000000000..08d180f64
--- /dev/null
+++ b/tests/ui/transmute/issue-115402-overflow-size.stderr
@@ -0,0 +1,33 @@
+error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` in the defining scope of `assert::Context`
+ --> $DIR/issue-115402-overflow-size.rs:22:41
+ |
+LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
+ | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture
+ |
+note: required by a bound in `is_maybe_transmutable`
+ --> $DIR/issue-115402-overflow-size.rs:9:14
+ |
+LL | pub fn is_maybe_transmutable<Src, Dst>()
+ | --------------------- required by a bound in this function
+LL | where
+LL | Dst: BikeshedIntrinsicFrom<Src, Context>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
+
+error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` in the defining scope of `assert::Context`
+ --> $DIR/issue-115402-overflow-size.rs:25:55
+ |
+LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
+ | ^^ values of the type `ExplicitlyPadded` are too big for the current architecture
+ |
+note: required by a bound in `is_maybe_transmutable`
+ --> $DIR/issue-115402-overflow-size.rs:9:14
+ |
+LL | pub fn is_maybe_transmutable<Src, Dst>()
+ | --------------------- required by a bound in this function
+LL | where
+LL | Dst: BikeshedIntrinsicFrom<Src, Context>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/trivial-bounds/trivial-bounds-leak.stderr b/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
index 02c5d5d24..be472a507 100644
--- a/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
+++ b/tests/ui/trivial-bounds/trivial-bounds-leak.stderr
@@ -27,6 +27,12 @@ LL | Foo::test(&4i32);
| --------- ^^^^^ the trait `Foo` is not implemented for `i32`
| |
| required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/trivial-bounds-leak.rs:4:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/trivial-bounds-leak.rs:26:22
@@ -36,6 +42,11 @@ LL | generic_function(5i32);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/trivial-bounds-leak.rs:4:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
note: required by a bound in `generic_function`
--> $DIR/trivial-bounds-leak.rs:29:24
|
diff --git a/tests/ui/issues/issue-32709.rs b/tests/ui/try-trait/issue-32709.rs
index c05bfdc4c..c05bfdc4c 100644
--- a/tests/ui/issues/issue-32709.rs
+++ b/tests/ui/try-trait/issue-32709.rs
diff --git a/tests/ui/issues/issue-32709.stderr b/tests/ui/try-trait/issue-32709.stderr
index 94e8f9295..94e8f9295 100644
--- a/tests/ui/issues/issue-32709.stderr
+++ b/tests/ui/try-trait/issue-32709.stderr
diff --git a/tests/ui/tuple/wrong_argument_ice-4.stderr b/tests/ui/tuple/wrong_argument_ice-4.stderr
index d8569ebf6..1fbf180c6 100644
--- a/tests/ui/tuple/wrong_argument_ice-4.stderr
+++ b/tests/ui/tuple/wrong_argument_ice-4.stderr
@@ -8,7 +8,7 @@ LL | | let b = 1;
LL | | });
| | -
| | |
- | |_____unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]`
+ | |_____unexpected argument of type `{closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15}`
| help: remove the extra argument
|
note: closure defined here
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
index fd3f9c614..660950d59 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
@@ -5,8 +5,8 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391]
- //~| ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391]
+ //~^ ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
+ //~| ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
pub fn foo() -> Foo {
22_u32
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
index 5bd0f76c3..d86988266 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/auto-trait-leakage3.rs:7:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -10,15 +10,15 @@ note: ...which requires type-checking `m::bar`...
LL | is_send(foo());
| ^^^^^^^
= note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/auto-trait-leakage3.rs:6:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/auto-trait-leakage3.rs:7:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/auto-trait-leakage3.rs:7:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -29,12 +29,12 @@ note: ...which requires type-checking `m::bar`...
|
LL | pub fn bar() {
| ^^^^^^^^^^^^
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/auto-trait-leakage3.rs:6:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/auto-trait-leakage3.rs:7:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
new file mode 100644
index 000000000..54a225100
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs
@@ -0,0 +1,21 @@
+// crate foo
+
+#![feature(type_alias_impl_trait)]
+
+type Tait = impl Sized;
+fn _constrain() -> Tait {}
+
+struct WrapperWithDrop<T>(T);
+impl<T> Drop for WrapperWithDrop<T> {
+ fn drop(&mut self) {}
+}
+
+pub struct Foo(WrapperWithDrop<Tait>);
+
+trait Id {
+ type Id: ?Sized;
+}
+impl<T: ?Sized> Id for T {
+ type Id = T;
+}
+pub struct Bar(WrapperWithDrop<<Tait as Id>::Id>);
diff --git a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
index 9a50c0f98..31fea42fa 100644
--- a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
+++ b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs
@@ -1,5 +1,5 @@
// compile-flags: --edition=2021
-// check-pass
+// build-pass
#![feature(type_alias_impl_trait)]
fn main() {
diff --git a/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
new file mode 100644
index 000000000..7c2d68cce
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/destructure_tait-ice-113594.rs
@@ -0,0 +1,19 @@
+// build-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+pub struct Foo {
+ /// This type must have nontrivial drop glue
+ field: String,
+}
+
+pub type Tait = impl Sized;
+
+pub async fn ice_cold(beverage: Tait) {
+ // Must destructure at least one field of `Foo`
+ let Foo { field } = beverage;
+ _ = field;
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs b/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs
new file mode 100644
index 000000000..8568b26be
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/destructure_tait-layout_of-ice-113594.rs
@@ -0,0 +1,23 @@
+// build-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+fn foo<T>(x: T) {
+ type Opaque<T> = impl Sized;
+ let foo: Opaque<T> = (x,);
+ let (a,): (T,) = foo;
+}
+
+const fn bar<T: Copy>(x: T) {
+ type Opaque<T: Copy> = impl Copy;
+ let foo: Opaque<T> = (x, 2u32);
+ let (a, b): (T, u32) = foo;
+}
+
+fn main() {
+ foo::<u32>(1);
+ bar::<u32>(1);
+ const CONST: () = bar::<u32>(42u32);
+ CONST
+}
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
index 5f75fdc71..4f424b8c6 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.rs
@@ -1,11 +1,7 @@
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type OneLifetime<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type OneLifetime<'a, 'b> = impl std::fmt::Debug;
fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> {
a
diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
index 546598e8a..0c50a84e8 100644
--- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
+++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr
@@ -1,11 +1,11 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/different_lifetimes_defining_uses.rs:15:5
+ --> $DIR/different_lifetimes_defining_uses.rs:11:5
|
LL | b
| ^ expected `&'a u32`, got `&'b u32`
|
note: previous use here
- --> $DIR/different_lifetimes_defining_uses.rs:11:5
+ --> $DIR/different_lifetimes_defining_uses.rs:7:5
|
LL | a
| ^
diff --git a/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs b/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs
new file mode 100644
index 000000000..51d287049
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/drop-shim-relates-opaque-issue-114375.rs
@@ -0,0 +1,10 @@
+// aux-build:drop-shim-relates-opaque-aux.rs
+// compile-flags: -Zvalidate-mir --crate-type=lib
+// build-pass
+
+extern crate drop_shim_relates_opaque_aux;
+
+pub fn drop_foo(_: drop_shim_relates_opaque_aux::Foo) {}
+pub fn drop_bar(_: drop_shim_relates_opaque_aux::Bar) {}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
new file mode 100644
index 000000000..bf27e76db
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs
@@ -0,0 +1,22 @@
+#![feature(type_alias_impl_trait)]
+
+pub trait Trait<'a> {
+ type Assoc;
+}
+
+trait Test<'a> {}
+
+pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>;
+//~^ ERROR cannot capture late-bound lifetime in type alias impl trait
+
+impl Trait<'_> for () {
+ type Assoc = ();
+}
+
+impl Test<'_> for () {}
+
+fn constrain() -> Foo {
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr
new file mode 100644
index 000000000..8205a60cc
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr
@@ -0,0 +1,8 @@
+error: cannot capture late-bound lifetime in type alias impl trait
+ --> $DIR/escaping-bound-var.rs:9:57
+ |
+LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>;
+ | -- lifetime defined here ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
index 14ced3418..169d4f8d5 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs
@@ -2,11 +2,7 @@
fn main() {}
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Two<'a, 'b> = impl std::fmt::Debug;
fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
//~^ ERROR non-defining opaque type use
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
index 4da69a705..b03bf2466 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr
@@ -1,25 +1,25 @@
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_lifetime_param.rs:11:26
+ --> $DIR/generic_duplicate_lifetime_param.rs:7:26
|
LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
| ^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_lifetime_param.rs:9:20
+ --> $DIR/generic_duplicate_lifetime_param.rs:5:20
|
-LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | type Two<'a, 'b> = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_lifetime_param.rs:13:5
+ --> $DIR/generic_duplicate_lifetime_param.rs:9:5
|
LL | t
| ^
|
note: lifetime used multiple times
- --> $DIR/generic_duplicate_lifetime_param.rs:9:10
+ --> $DIR/generic_duplicate_lifetime_param.rs:5:10
|
-LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+LL | type Two<'a, 'b> = impl std::fmt::Debug;
| ^^ ^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
index 1e391b55a..e3c6f4d87 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
@@ -14,11 +14,7 @@ fn main() {}
// test that unused generic parameters are ok
type TwoTys<T, U> = impl Debug;
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
+type TwoLifetimes<'a, 'b> = impl Debug;
type TwoConsts<const X: usize, const Y: usize> = impl Debug;
diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
index d8330771d..495308a6c 100644
--- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr
@@ -1,5 +1,5 @@
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:25:30
+ --> $DIR/generic_duplicate_param_use.rs:21:30
|
LL | fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
| ^^^^^^^^^^^^ generic argument `T` used twice
@@ -11,7 +11,7 @@ LL | type TwoTys<T, U> = impl Debug;
| ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:27:5
+ --> $DIR/generic_duplicate_param_use.rs:23:5
|
LL | t
| ^
@@ -23,49 +23,49 @@ LL | type TwoTys<T, U> = impl Debug;
| ^ ^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:31:36
+ --> $DIR/generic_duplicate_param_use.rs:27:36
|
LL | fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
| ^^^^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_param_use.rs:21:29
+ --> $DIR/generic_duplicate_param_use.rs:17:29
|
-LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | type TwoLifetimes<'a, 'b> = impl Debug;
+ | ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:33:5
+ --> $DIR/generic_duplicate_param_use.rs:29:5
|
LL | t
| ^
|
note: lifetime used multiple times
- --> $DIR/generic_duplicate_param_use.rs:21:19
+ --> $DIR/generic_duplicate_param_use.rs:17:19
|
-LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>;
+LL | type TwoLifetimes<'a, 'b> = impl Debug;
| ^^ ^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:37:50
+ --> $DIR/generic_duplicate_param_use.rs:33:50
|
LL | fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
| ^^^^^^^^^^^^^^^ generic argument `N` used twice
|
note: for this opaque type
- --> $DIR/generic_duplicate_param_use.rs:23:50
+ --> $DIR/generic_duplicate_param_use.rs:19:50
|
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
| ^^^^^^^^^^
error: non-defining opaque type use in defining scope
- --> $DIR/generic_duplicate_param_use.rs:39:5
+ --> $DIR/generic_duplicate_param_use.rs:35:5
|
LL | t
| ^
|
note: constant used multiple times
- --> $DIR/generic_duplicate_param_use.rs:23:16
+ --> $DIR/generic_duplicate_param_use.rs:19:16
|
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
index 106efefba..e109c38c9 100644
--- a/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
+++ b/tests/ui/type-alias-impl-trait/generic_lifetime_param.rs
@@ -1,11 +1,10 @@
-// check-pass
+// build-pass (FIXME(62277): could be check-pass?)
#![feature(type_alias_impl_trait)]
fn main() {}
-type Region<'a> = impl std::fmt::Debug + 'a;
-
+type Region<'a> = impl std::fmt::Debug;
fn region<'b>(a: &'b ()) -> Region<'b> {
a
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
index 6f9434255..469a493b0 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs
@@ -1,7 +1,7 @@
#![feature(type_alias_impl_trait)]
mod test_lifetime_param {
- type Ty<'a> = impl Sized + 'a;
+ type Ty<'a> = impl Sized;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() }
@@ -9,7 +9,7 @@ mod test_lifetime_param {
}
mod test_higher_kinded_lifetime_param {
- type Ty<'a> = impl Sized + 'a;
+ type Ty<'a> = impl Sized;
fn defining(a: &str) -> Ty<'_> { a }
fn assert_static<'a: 'static>() {}
fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() }
diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
index 4f99236f4..06c119287 100644
--- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
+++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds.rs
@@ -1,16 +1,20 @@
// check-pass
-#![feature(impl_trait_in_assoc_type)]
+#![feature(impl_trait_in_assoc_type, type_alias_impl_trait)]
-trait Callable {
- type Output;
- fn call() -> Self::Output;
-}
+mod foo {
+ pub trait Callable {
+ type Output;
+ fn call() -> Self::Output;
+ }
-impl<'a> Callable for &'a () {
- type Output = impl Sized;
- fn call() -> Self::Output {}
+ pub type OutputHelper = impl Sized;
+ impl<'a> Callable for &'a () {
+ type Output = OutputHelper;
+ fn call() -> Self::Output {}
+ }
}
+use foo::*;
fn test<'a>() -> impl Sized {
<&'a () as Callable>::call()
diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs
new file mode 100644
index 000000000..f6cbbf04d
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs
@@ -0,0 +1,29 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR cycle detected when computing layout of
+
+#![feature(impl_trait_in_assoc_type)]
+
+use core::future::Future;
+
+trait Recur {
+ type Recur: Future<Output = ()>;
+
+ fn recur(self) -> Self::Recur;
+}
+
+async fn recur(t: impl Recur) {
+ t.recur().await;
+}
+
+impl Recur for () {
+ type Recur = impl Future<Output = ()>;
+
+ fn recur(self) -> Self::Recur {
+ async move { recur(self).await; }
+ }
+}
+
+fn main() {
+ recur(());
+}
diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr
new file mode 100644
index 000000000..2063becdb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr
@@ -0,0 +1,19 @@
+error[E0391]: cycle detected when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`
+ |
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
+ = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
+ = note: ...which requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}`...
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<<() as Recur>::Recur>`...
+ = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
+ = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
+ = note: ...which again requires computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`, completing the cycle
+note: cycle used when elaborating drops for `<impl at $DIR/indirect-recursion-issue-112047.rs:19:1: 19:18>::recur`
+ --> $DIR/indirect-recursion-issue-112047.rs:22:5
+ |
+LL | fn recur(self) -> Self::Recur {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
index 41530dda9..4ab059d05 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/inference-cycle.rs:5:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -10,15 +10,15 @@ note: ...which requires type-checking `m::bar`...
LL | is_send(foo()); // Today: error
| ^^^^^^^
= note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/inference-cycle.rs:4:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/inference-cycle.rs:5:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
--> $DIR/inference-cycle.rs:5:20
|
LL | pub type Foo = impl std::fmt::Debug;
@@ -29,12 +29,12 @@ note: ...which requires type-checking `m::bar`...
|
LL | pub fn bar() {
| ^^^^^^^^^^^^
- = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in module `m`
- --> $DIR/inference-cycle.rs:4:1
+ = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `m::Foo::{opaque#0}`
+ --> $DIR/inference-cycle.rs:5:20
|
-LL | mod m {
- | ^^^^^
+LL | pub type Foo = impl std::fmt::Debug;
+ | ^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
index 6148131b4..e4054e14a 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
@@ -4,6 +4,11 @@ error[E0391]: cycle detected when computing type of `Bug::{opaque#0}`
LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
| ^^^^^^^^^^^^^^^^^^^^^^
|
+note: ...which requires computing type of opaque `Bug::{opaque#0}`...
+ --> $DIR/issue-53092-2.rs:4:18
+ |
+LL | type Bug<T, U> = impl Fn(T) -> U + Copy;
+ | ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `CONST_BUG`...
--> $DIR/issue-53092-2.rs:6:1
|
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr
index a4f6359b9..a86856247 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr
@@ -23,7 +23,7 @@ LL | || -> Closure { || () }
| ^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-63279.rs:7:21: 7:23]`
+ found closure `{closure@$DIR/issue-63279.rs:7:21: 7:23}`
help: use parentheses to call this closure
|
LL | || -> Closure { (|| ())() }
@@ -36,7 +36,7 @@ LL | || -> Closure { || () }
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/issue-63279.rs:7:5: 7:18]`
+ found closure `{closure@$DIR/issue-63279.rs:7:5: 7:18}`
help: use parentheses to call this closure
|
LL | (|| -> Closure { || () })()
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.rs b/tests/ui/type-alias-impl-trait/issue-89686.rs
index 058417bdb..de070fc9d 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.rs
+++ b/tests/ui/type-alias-impl-trait/issue-89686.rs
@@ -4,7 +4,7 @@
use std::future::Future;
-type G<'a, T> = impl Future<Output = ()> + 'a;
+type G<'a, T> = impl Future<Output = ()>;
trait Trait {
type F: Future<Output = ()>;
diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr
index 3b95a575a..b636ada8b 100644
--- a/tests/ui/type-alias-impl-trait/issue-89686.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr
@@ -6,7 +6,7 @@ LL | async move { self.f().await }
|
help: consider restricting type parameter `T`
|
-LL | type G<'a, T: Trait> = impl Future<Output = ()> + 'a;
+LL | type G<'a, T: Trait> = impl Future<Output = ()>;
| +++++++
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr
index 8d7f7a07b..26605cdd2 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<[generator@$DIR/issue-94429.rs:17:9: 17:16] as Generator>::Yield == ()`
+error[E0271]: type mismatch resolving `<{generator@$DIR/issue-94429.rs:17:9: 17:16} as Generator>::Yield == ()`
--> $DIR/issue-94429.rs:15:26
|
LL | fn run(&mut self) -> Self::Gen {
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
index 01d1f5db1..c584a58cb 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs
@@ -1,7 +1,8 @@
#![feature(type_alias_impl_trait)]
-type Opaque<'a, T> = impl Sized;
+type Opaque2<T> = impl Sized;
+type Opaque<'a, T> = Opaque2<T>;
fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
-//~^ ERROR: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
+//~^ ERROR: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
index d666e668d..6bcae6e53 100644
--- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
+++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr
@@ -1,8 +1,9 @@
-error[E0700]: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds
- --> $DIR/missing_lifetime_bound.rs:4:47
+error[E0700]: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds
+ --> $DIR/missing_lifetime_bound.rs:5:47
|
-LL | type Opaque<'a, T> = impl Sized;
- | ---------- opaque type defined here
+LL | type Opaque2<T> = impl Sized;
+ | ---------- opaque type defined here
+LL | type Opaque<'a, T> = Opaque2<T>;
LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x }
| -- ^
| |
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
index 65eb2952e..3f122f106 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.rs
@@ -1,10 +1,6 @@
#![feature(type_alias_impl_trait)]
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Foo<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Foo<'a, 'b> = impl std::fmt::Debug;
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
(i, i) //~ ERROR concrete type differs from previous
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
index d7676b8e9..81e603e23 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-lifetimes.stderr
@@ -1,5 +1,5 @@
error: concrete type differs from previous defining opaque type use
- --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:10:5
+ --> $DIR/multiple-def-uses-in-one-fn-lifetimes.rs:6:5
|
LL | (i, i)
| ^^^^^^
diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
index 21fca047a..83fd9a1da 100644
--- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
+++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-pass.rs
@@ -7,11 +7,7 @@ fn f<A: ToString + Clone, B: ToString + Clone>(a: A, b: B) -> (X<A, B>, X<A, B>)
(a.clone(), a)
}
-pub trait Captures<'a> {}
-
-impl<'a, T: ?Sized> Captures<'a> for T {}
-
-type Foo<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>;
+type Foo<'a, 'b> = impl std::fmt::Debug;
fn foo<'x, 'y>(i: &'x i32, j: &'y i32) -> (Foo<'x, 'y>, Foo<'y, 'x>) {
(i, j)
diff --git a/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs
new file mode 100644
index 000000000..1ccd1b0cb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs
@@ -0,0 +1,40 @@
+// edition: 2021
+// build-fail
+//~^^ ERROR overflow evaluating the requirement `<() as B>::Assoc == _`
+
+#![feature(rustc_attrs)]
+#![feature(impl_trait_in_assoc_type)]
+
+#[rustc_coinductive]
+trait A {
+ type Assoc;
+
+ fn test() -> Self::Assoc;
+}
+
+#[rustc_coinductive]
+trait B {
+ type Assoc;
+
+ fn test() -> Self::Assoc;
+}
+
+impl<T: A> B for T {
+ type Assoc = impl Sized;
+
+ fn test() -> <Self as B>::Assoc {
+ <T as A>::test()
+ }
+}
+
+fn main() {
+ <() as A>::test();
+}
+
+impl<T: B> A for T {
+ type Assoc = impl Sized;
+
+ fn test() -> <Self as A>::Assoc {
+ <T as B>::test()
+ }
+}
diff --git a/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr
new file mode 100644
index 000000000..49c59f7eb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/mututally-recursive-overflow.stderr
@@ -0,0 +1,5 @@
+error[E0275]: overflow evaluating the requirement `<() as B>::Assoc == _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
new file mode 100644
index 000000000..fec0fdc46
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
@@ -0,0 +1,9 @@
+#![feature(type_alias_impl_trait)]
+
+pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+//~^ ERROR use of undeclared lifetime name `'db`
+//~| ERROR cannot find type `Key` in this scope
+//~| ERROR unconstrained opaque type
+//~| ERROR unconstrained opaque type
+
+pub fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
new file mode 100644
index 000000000..d4aeace4a
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
@@ -0,0 +1,47 @@
+error[E0261]: use of undeclared lifetime name `'db`
+ --> $DIR/nested-impl-trait-in-tait.rs:3:40
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^ undeclared lifetime
+ |
+ = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+help: consider making the bound lifetime-generic with a new `'db` lifetime
+ |
+LL | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>;
+ | ++++++++
+help: consider introducing lifetime `'db` here
+ |
+LL | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | +++++
+
+error[E0412]: cannot find type `Key` in this scope
+ --> $DIR/nested-impl-trait-in-tait.rs:3:44
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^ not found in this scope
+ |
+help: consider importing this struct
+ |
+LL + use std::thread::local_impl::Key;
+ |
+
+error: unconstrained opaque type
+ --> $DIR/nested-impl-trait-in-tait.rs:3:17
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: unconstrained opaque type
+ --> $DIR/nested-impl-trait-in-tait.rs:3:49
+ |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+ | ^^^^^^^^^^^^^
+ |
+ = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0261, E0412.
+For more information about an error, try `rustc --explain E0261`.
diff --git a/tests/ui/type-alias-impl-trait/normalize-alias-type.rs b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
new file mode 100644
index 000000000..7c62002b9
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/normalize-alias-type.rs
@@ -0,0 +1,32 @@
+// check-pass
+// compile-flags: -Z mir-opt-level=3
+#![feature(type_alias_impl_trait)]
+#![crate_type = "lib"]
+pub trait Tr {
+ fn get(&self) -> u32;
+}
+
+impl Tr for (u32,) {
+ #[inline]
+ fn get(&self) -> u32 { self.0 }
+}
+
+pub fn tr1() -> impl Tr {
+ (32,)
+}
+
+pub fn tr2() -> impl Tr {
+ struct Inner {
+ x: X,
+ }
+ type X = impl Tr;
+ impl Tr for Inner {
+ fn get(&self) -> u32 {
+ self.x.get()
+ }
+ }
+
+ Inner {
+ x: tr1(),
+ }
+}
diff --git a/tests/ui/type-alias-impl-trait/privacy.rs b/tests/ui/type-alias-impl-trait/privacy.rs
index aa092f6f8..3efbfaf09 100644
--- a/tests/ui/type-alias-impl-trait/privacy.rs
+++ b/tests/ui/type-alias-impl-trait/privacy.rs
@@ -1,8 +1,10 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
type Foo = (impl Sized, u8);
pub fn foo() -> Foo {
- //~^ ERROR private type alias `Foo` in public interface
+ //~^ WARNING type alias `Foo` is more private than the item `foo`
(42, 42)
}
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/privacy.stderr b/tests/ui/type-alias-impl-trait/privacy.stderr
index e8c6039cd..50870905c 100644
--- a/tests/ui/type-alias-impl-trait/privacy.stderr
+++ b/tests/ui/type-alias-impl-trait/privacy.stderr
@@ -1,11 +1,15 @@
-error[E0446]: private type alias `Foo` in public interface
- --> $DIR/privacy.rs:4:1
+warning: type alias `Foo` is more private than the item `foo`
+ --> $DIR/privacy.rs:6:1
|
-LL | type Foo = (impl Sized, u8);
- | -------- `Foo` declared as private
LL | pub fn foo() -> Foo {
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type alias
+ | ^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
+ |
+note: but type alias `Foo` is only usable at visibility `pub(crate)`
+ --> $DIR/privacy.rs:5:1
+ |
+LL | type Foo = (impl Sized, u8);
+ | ^^^^^^^^
+ = note: `#[warn(private_interfaces)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index 813185c13..c62fd88f4 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -1,4 +1,4 @@
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -10,21 +10,15 @@ note: ...which requires type-checking `not_good`...
LL | is_send::<Foo>();
| ^^^^^^^^^^^^^^
= note: ...which requires evaluating trait selection obligation `Foo: core::marker::Send`...
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -35,18 +29,12 @@ note: ...which requires type-checking `not_good`...
|
LL | fn not_good() {
| ^^^^^^^^^^^^^
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
@@ -71,7 +59,7 @@ note: required by a bound in `is_send`
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
+error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
|
LL | type Foo = impl Debug;
@@ -82,18 +70,12 @@ note: ...which requires type-checking `not_gooder`...
|
LL | fn not_gooder() -> Foo {
| ^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/reveal_local.rs:1:1
- |
-LL | / #![feature(type_alias_impl_trait)]
-LL | |
-LL | | use std::fmt::Debug;
-LL | |
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
+ = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `Foo::{opaque#0}`
+ --> $DIR/reveal_local.rs:5:12
+ |
+LL | type Foo = impl Debug;
+ | ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr
new file mode 100644
index 000000000..844103d77
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.current.stderr
@@ -0,0 +1,29 @@
+error: internal compiler error: no errors encountered even though `delay_span_bug` issued
+
+error: internal compiler error: {OpaqueTypeKey { def_id: DefId(get_rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }) } }}
+ |
+ =
+
+
+error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(get_rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }))), bound_vars: [] } } }
+ --> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
+ |
+LL | query(get_rpit);
+ | ^^^^^^^^^^^^^^^
+ |
+
+ --> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
+ |
+LL | query(get_rpit);
+ | ^^^^^^^^^^^^^^^
+
+
+
+
+
+
+
+query stack during panic:
+end of query stack
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
new file mode 100644
index 000000000..0f0002f77
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
@@ -0,0 +1,32 @@
+//! This tries to prove the APIT's bounds in a canonical query,
+//! which doesn't know anything about the defining scope of either
+//! opaque type and thus makes a random choice as to which opaque type
+//! becomes the hidden type of the other. When we leave the canonical
+//! query, we attempt to actually check the defining anchor, but now we
+//! have a situation where the RPIT gets constrained outside its anchor.
+
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+//[next] check-pass
+
+//[current] known-bug: #108498
+//[current] failure-status: 101
+//[current] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
+//[current] normalize-stderr-test: "(?m)note: .*$" -> ""
+//[current] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
+//[current] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque = impl Sized;
+
+fn get_rpit() -> impl Clone {}
+
+fn query(_: impl FnOnce() -> Opaque) {}
+
+fn test() -> Opaque {
+ query(get_rpit);
+ get_rpit()
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
new file mode 100644
index 000000000..9d7e647dd
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query_2.rs
@@ -0,0 +1,18 @@
+// The canonical query `Projection(<get_rpit as FnOnce>::Output = Opaque)`
+// is the *only* site that defines `Opaque` in MIR typeck.
+//
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque = impl Sized;
+
+fn get_rpit() -> impl Sized {}
+
+fn query(_: impl FnOnce() -> Opaque) {}
+
+fn test(_: Opaque) {
+ query(get_rpit);
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/self_implication.rs b/tests/ui/type-alias-impl-trait/self_implication.rs
index 4e805ee30..65659a0f3 100644
--- a/tests/ui/type-alias-impl-trait/self_implication.rs
+++ b/tests/ui/type-alias-impl-trait/self_implication.rs
@@ -22,9 +22,9 @@ fn bar() {
}
// desugared
- type FooX<'a> = impl Sized;
+ type FooX = impl Sized;
impl<'a> Foo<'a> {
- fn foo(&self) -> FooX<'a> {}
+ fn foo(&self) -> FooX {}
}
// use site
diff --git a/tests/ui/type-alias-impl-trait/tait-normalize.rs b/tests/ui/type-alias-impl-trait/tait-normalize.rs
new file mode 100644
index 000000000..26d94dbb4
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/tait-normalize.rs
@@ -0,0 +1,14 @@
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+fn enum_upvar() {
+ type T = impl Copy;
+ let foo: T = Some((1u32, 2u32));
+ let x = move || match foo {
+ None => (),
+ Some((a, b)) => (),
+ };
+}
+
+fn main(){}
diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs
new file mode 100644
index 000000000..e92cf2513
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/variance.rs
@@ -0,0 +1,44 @@
+#![feature(rustc_attrs, type_alias_impl_trait, impl_trait_in_assoc_type)]
+#![allow(internal_features)]
+#![rustc_variance_of_opaques]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+type NotCapturedEarly<'a> = impl Sized; //~ [o]
+
+type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ [o]
+
+// TAIT does *not* capture `'b`
+type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ [o]
+
+// TAIT does *not* capture `'b`
+type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ [o]
+
+type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR [o, o, o]
+
+trait Foo<'i> {
+ type ImplicitCapture<'a>;
+
+ type ExplicitCaptureFromHeader<'a>;
+
+ type ExplicitCaptureFromGat<'a>;
+}
+
+impl<'i> Foo<'i> for &'i () {
+ type ImplicitCapture<'a> = impl Sized; //~ [o, o]
+
+ type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o]
+
+ type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o]
+}
+
+impl<'i> Foo<'i> for () {
+ type ImplicitCapture<'a> = impl Sized; //~ [o, o]
+
+ type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [o, o]
+
+ type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [o, o]
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr
new file mode 100644
index 000000000..1794447c8
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/variance.stderr
@@ -0,0 +1,68 @@
+error: [o]
+ --> $DIR/variance.rs:8:29
+ |
+LL | type NotCapturedEarly<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:10:26
+ |
+LL | type CapturedEarly<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:13:56
+ |
+LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>;
+ | ^^^^^^^^^^
+
+error: [o]
+ --> $DIR/variance.rs:16:49
+ |
+LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o, o]
+ --> $DIR/variance.rs:18:27
+ |
+LL | type Bar<'a, 'b: 'b, T> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:29:32
+ |
+LL | type ImplicitCapture<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:31:42
+ |
+LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:33:39
+ |
+LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:37:32
+ |
+LL | type ImplicitCapture<'a> = impl Sized;
+ | ^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:39:42
+ |
+LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: [o, o]
+ --> $DIR/variance.rs:41:39
+ |
+LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
diff --git a/tests/ui/type/subtyping-opaque-type.rs b/tests/ui/type/subtyping-opaque-type.rs
new file mode 100644
index 000000000..beda232ea
--- /dev/null
+++ b/tests/ui/type/subtyping-opaque-type.rs
@@ -0,0 +1,19 @@
+// check-pass
+// compile-flags: -Zvalidate-mir
+trait Duh {}
+
+impl Duh for i32 {}
+
+trait Trait {
+ type Assoc: Duh;
+}
+
+impl<R: Duh, F: FnMut() -> R> Trait for F {
+ type Assoc = R;
+}
+
+fn foo() -> impl Trait<Assoc = impl Send> {
+ || 42
+}
+
+fn main() {}
diff --git a/tests/ui/type/type-arg-out-of-scope.rs b/tests/ui/type/type-arg-out-of-scope.rs
index 02aad0077..c36f9904e 100644
--- a/tests/ui/type/type-arg-out-of-scope.rs
+++ b/tests/ui/type/type-arg-out-of-scope.rs
@@ -1,4 +1,4 @@
-// error-pattern:can't use generic parameters from outer function
+// error-pattern:can't use generic parameters from outer item
fn foo<T>(x: T) {
fn bar(f: Box<dyn FnMut(T) -> T>) { }
}
diff --git a/tests/ui/type/type-arg-out-of-scope.stderr b/tests/ui/type/type-arg-out-of-scope.stderr
index 7f18b4510..8665001e2 100644
--- a/tests/ui/type/type-arg-out-of-scope.stderr
+++ b/tests/ui/type/type-arg-out-of-scope.stderr
@@ -1,22 +1,22 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/type-arg-out-of-scope.rs:3:29
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(f: Box<dyn FnMut(T) -> T>) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/type-arg-out-of-scope.rs:3:35
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bar(f: Box<dyn FnMut(T) -> T>) { }
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `<T>`
+ | help: try introducing a local generic parameter here: `<T>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/type/type-error-break-tail.stderr b/tests/ui/type/type-error-break-tail.stderr
index 16dc6475c..9a02bc287 100644
--- a/tests/ui/type/type-error-break-tail.stderr
+++ b/tests/ui/type/type-error-break-tail.stderr
@@ -2,13 +2,16 @@ error[E0308]: mismatched types
--> $DIR/type-error-break-tail.rs:3:20
|
LL | fn loop_ending() -> i32 {
- | --- expected `i32` because of return type
+ | --- expected `i32` because of this return type
LL | loop {
+ | ---- this loop is expected to be of type `i32`
LL | if false { break; }
- | ^^^^^
- | |
- | expected `i32`, found `()`
- | help: give it a value of the expected type: `break 42`
+ | ^^^^^ expected `i32`, found `()`
+ |
+help: give it a value of the expected type
+ |
+LL | if false { break 42; }
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/issues/auxiliary/issue-29181.rs b/tests/ui/typeck/auxiliary/issue-29181.rs
index bd1a9be4e..bd1a9be4e 100644
--- a/tests/ui/issues/auxiliary/issue-29181.rs
+++ b/tests/ui/typeck/auxiliary/issue-29181.rs
diff --git a/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs
new file mode 100644
index 000000000..d93963329
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-fn-return-type.rs
@@ -0,0 +1,10 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within a return type
+// produces a type mismatch error instead of triggering a const eval cycle
+
+#[allow(unused_braces)]
+fn func() -> [u8; { () } ] { //~ ERROR mismatched types
+ loop {}
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr
new file mode 100644
index 000000000..88ed96e14
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-fn-return-type.rs:6:21
+ |
+LL | fn func() -> [u8; { () } ] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
new file mode 100644
index 000000000..a1b9a7eba
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
@@ -0,0 +1,20 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within the return type
+// of an impl fn produces a type mismatch error instead of triggering
+// a const eval cycle
+
+
+trait Trait {
+ fn func<const N: u32>() -> [ (); N ];
+}
+
+struct S {}
+
+#[allow(unused_braces)]
+impl Trait for S {
+ fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types
+ N
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
new file mode 100644
index 000000000..9843651b1
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-impl-fn-return-type.rs:15:40
+ |
+LL | fn func<const N: u32>() -> [ (); { () }] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs
new file mode 100644
index 000000000..9eee4ab3d
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.rs
@@ -0,0 +1,12 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block in a struct's type arg
+// produces a type mismatch error instead of triggering a const eval cycle
+
+#[allow(unused_braces)]
+struct S<const N: usize> {
+ arr: [u8; N]
+}
+
+fn main() {
+ let s = S::<{ () }> { arr: [5, 6, 7]}; //~ ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr
new file mode 100644
index 000000000..3307e76d9
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-struct-type-arg.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-struct-type-arg.rs:11:19
+ |
+LL | let s = S::<{ () }> { arr: [5, 6, 7]};
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs
new file mode 100644
index 000000000..8e2eec349
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.rs
@@ -0,0 +1,13 @@
+// Regression test for #114918
+// Test that a const generic enclosed in a block within the return type
+// of a trait method produces a type mismatch error instead of triggering
+// a const eval cycle
+
+#[allow(unused_braces)]
+trait Trait {
+ fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types
+ N
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr
new file mode 100644
index 000000000..6bc0de77a
--- /dev/null
+++ b/tests/ui/typeck/issue-114918/const-in-trait-fn-return-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-in-trait-fn-return-type.rs:8:40
+ |
+LL | fn func<const N: u32>() -> [ (); { () }] {
+ | ^^ expected `usize`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/issues/issue-29181.rs b/tests/ui/typeck/issue-29181.rs
index 70e5bc019..70e5bc019 100644
--- a/tests/ui/issues/issue-29181.rs
+++ b/tests/ui/typeck/issue-29181.rs
diff --git a/tests/ui/issues/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr
index 53addf2fe..53addf2fe 100644
--- a/tests/ui/issues/issue-29181.stderr
+++ b/tests/ui/typeck/issue-29181.stderr
diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr
index b622122f3..d65c4306a 100644
--- a/tests/ui/typeck/issue-31173.stderr
+++ b/tests/ui/typeck/issue-31173.stderr
@@ -1,4 +1,4 @@
-error[E0271]: expected `TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:21]>` to be an iterator that yields `&_`, but it yields `u8`
+error[E0271]: expected `TakeWhile<&mut IntoIter<u8>, {closure@issue-31173.rs:7:21}>` to be an iterator that yields `&_`, but it yields `u8`
--> $DIR/issue-31173.rs:11:10
|
LL | .cloned()
@@ -21,7 +21,7 @@ LL | | })
note: required by a bound in `cloned`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut IntoIter<u8>, [closure@issue-31173.rs:7:21]>>`, but its trait bounds were not satisfied
+error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut IntoIter<u8>, {closure@issue-31173.rs:7:21}>>`, but its trait bounds were not satisfied
--> $DIR/issue-31173.rs:12:10
|
LL | let temp: Vec<u8> = it
@@ -43,10 +43,10 @@ LL | | .collect();
= note: doesn't satisfy `_: Iterator`
|
= note: the following trait bounds were not satisfied:
- `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_`
- which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
- `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
- which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
+ `<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_`
+ which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
+ `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
+ which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator`
error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
index 08eab0253..a75024aa2 100644
--- a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
+++ b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr
@@ -1,10 +1,8 @@
error[E0277]: the trait bound `(): Marker<u32>` is not satisfied
- --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:17
+ --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:13
|
LL | check::<()>(());
- | ----------- ^^ the trait `Marker<u32>` is not implemented for `()`
- | |
- | required by a bound introduced by this call
+ | ^^ the trait `Marker<u32>` is not implemented for `()`
|
note: required by a bound in `check`
--> $DIR/issue-90804-incorrect-reference-suggestion.rs:7:17
diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr
index f9a240963..7be46ac07 100644
--- a/tests/ui/typeck/return_type_containing_closure.stderr
+++ b/tests/ui/typeck/return_type_containing_closure.stderr
@@ -5,7 +5,7 @@ LL | vec!['a'].iter().map(|c| c)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, ...>`
|
= note: expected unit type `()`
- found struct `Map<std::slice::Iter<'_, char>, [closure@$DIR/return_type_containing_closure.rs:3:26: 3:29]>`
+ found struct `Map<std::slice::Iter<'_, char>, {closure@$DIR/return_type_containing_closure.rs:3:26: 3:29}>`
help: consider using a semicolon here
|
LL | vec!['a'].iter().map(|c| c);
diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr
index 0c5e7e3ce..a4325b01f 100644
--- a/tests/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr
@@ -443,7 +443,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
| ^ not allowed in type signatures
|
-note: however, the inferred type `Map<Filter<Range<i32>, [closure@typeck_type_placeholder_item.rs:229:29]>, [closure@typeck_type_placeholder_item.rs:229:49]>` cannot be named
+note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:229:29}>, {closure@typeck_type_placeholder_item.rs:229:49}>` cannot be named
--> $DIR/typeck_type_placeholder_item.rs:229:14
|
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
index 85adf7751..ae0a06e63 100644
--- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
+++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr
@@ -1,10 +1,8 @@
error[E0277]: cannot add `u32` to `i32`
- --> $DIR/ufcs-qpath-self-mismatch.rs:4:31
+ --> $DIR/ufcs-qpath-self-mismatch.rs:4:6
|
LL | <i32 as Add<u32>>::add(1, 2);
- | ---------------------- ^ no implementation for `i32 + u32`
- | |
- | required by a bound introduced by this call
+ | ^^^ no implementation for `i32 + u32`
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
diff --git a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
index 482fd3cb4..e2d867ff2 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
@@ -1,8 +1,8 @@
-error[E0599]: no method named `call` found for closure `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29]` in the current scope
+error[E0599]: no method named `call` found for closure `{closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29}` in the current scope
--> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10
|
LL | mut_.call((0, ));
- | ^^^^ method not found in `[closure@unboxed-closures-static-call-wrong-trait.rs:6:26]`
+ | ^^^^ method not found in `{closure@unboxed-closures-static-call-wrong-trait.rs:6:26}`
error: aborting due to previous error
diff --git a/tests/ui/unevaluated_fixed_size_array_len.stderr b/tests/ui/unevaluated_fixed_size_array_len.stderr
index 5e67b2c44..b04a7b7f2 100644
--- a/tests/ui/unevaluated_fixed_size_array_len.stderr
+++ b/tests/ui/unevaluated_fixed_size_array_len.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied
- --> $DIR/unevaluated_fixed_size_array_len.rs:12:5
+ --> $DIR/unevaluated_fixed_size_array_len.rs:12:6
|
LL | <[(); 0] as Foo>::foo()
- | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`
+ | ^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`
|
= help: the trait `Foo` is implemented for `[(); 1]`
diff --git a/tests/ui/union/projection-as-union-type-error-2.stderr b/tests/ui/union/projection-as-union-type-error-2.stderr
index bab226f27..21f4ea103 100644
--- a/tests/ui/union/projection-as-union-type-error-2.stderr
+++ b/tests/ui/union/projection-as-union-type-error-2.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u8: NotImplemented` is not satisfied
LL | a: <Foo as Identity>::Identity,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotImplemented` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-as-union-type-error-2.rs:9:1
+ |
+LL | trait NotImplemented {}
+ | ^^^^^^^^^^^^^^^^^^^^
note: required for `u8` to implement `Identity`
--> $DIR/projection-as-union-type-error-2.rs:11:25
|
diff --git a/tests/ui/union/projection-as-union-type-error.stderr b/tests/ui/union/projection-as-union-type-error.stderr
index e4fbe9603..2b0241caf 100644
--- a/tests/ui/union/projection-as-union-type-error.stderr
+++ b/tests/ui/union/projection-as-union-type-error.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `u8: Identity` is not satisfied
|
LL | a: <Foo as Identity>::Identity,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Identity` is not implemented for `u8`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/projection-as-union-type-error.rs:6:1
+ |
+LL | pub trait Identity {
+ | ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
new file mode 100644
index 000000000..192bbba5a
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
@@ -0,0 +1,37 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+struct F {
+ field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous structs are unimplemented
+ _: struct { field: u8 },
+ //~^ ERROR anonymous structs are unimplemented
+}
+
+struct G {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+union H {
+ field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous structs are unimplemented
+ _: struct { field: u8 },
+ //~^ ERROR anonymous structs are unimplemented
+}
+
+union I {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+enum K {
+ M {
+ _ : struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+ //~^ ERROR unnamed fields are not allowed outside of structs or unions
+ //~| ERROR anonymous structs are unimplemented
+ },
+ N {
+ _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
new file mode 100644
index 000000000..fd731766c
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
@@ -0,0 +1,78 @@
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:5:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_structs.rs:12:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:16:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_structs.rs:23:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_structs.rs:28:9
+ |
+LL | _ : struct { field: u8 },
+ | -^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous structs are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_structs.rs:28:13
+ |
+LL | _ : struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_structs.rs:33:9
+ |
+LL | _ : u8,
+ | -^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:5:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:7:8
+ |
+LL | _: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:16:12
+ |
+LL | field: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:18:8
+ |
+LL | _: struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: anonymous structs are unimplemented
+ --> $DIR/restrict_anonymous_structs.rs:28:13
+ |
+LL | _ : struct { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
new file mode 100644
index 000000000..c69266089
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
@@ -0,0 +1,37 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+struct F {
+ field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous unions are unimplemented
+ _: union { field: u8 },
+ //~^ ERROR anonymous unions are unimplemented
+}
+
+struct G {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+union H {
+ field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR anonymous unions are unimplemented
+ _: union { field: u8 },
+ //~^ ERROR anonymous unions are unimplemented
+}
+
+union I {
+ _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
+}
+
+enum K {
+ M {
+ _ : union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+ //~^ ERROR unnamed fields are not allowed outside of structs or unions
+ //~| ERROR anonymous unions are unimplemented
+ },
+ N {
+ _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
new file mode 100644
index 000000000..c65cad775
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
@@ -0,0 +1,78 @@
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:5:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_unions.rs:12:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:16:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields can only have struct or union types
+ --> $DIR/restrict_anonymous_unions.rs:23:5
+ |
+LL | _: (u8, u8),
+ | ^ -------- not a struct or union
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_unions.rs:28:9
+ |
+LL | _ : union { field: u8 },
+ | -^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous unions are not allowed outside of unnamed struct or union fields
+ --> $DIR/restrict_anonymous_unions.rs:28:13
+ |
+LL | _ : union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+
+error: unnamed fields are not allowed outside of structs or unions
+ --> $DIR/restrict_anonymous_unions.rs:33:9
+ |
+LL | _ : u8,
+ | -^^^^^
+ | |
+ | unnamed field declared here
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:5:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:7:8
+ |
+LL | _: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:16:12
+ |
+LL | field: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:18:8
+ |
+LL | _: union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: anonymous unions are unimplemented
+ --> $DIR/restrict_anonymous_unions.rs:28:13
+ |
+LL | _ : union { field: u8 },
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
index aa73b824a..32f8d2f45 100644
--- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
@@ -1,18 +1,18 @@
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
= note: requested on the command line with `-D unknown-lints`
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
error: aborting due to 3 previous errors
diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
index 82851c800..dd9ecf02f 100644
--- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
@@ -1,18 +1,18 @@
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
= note: requested on the command line with `-W unknown-lints`
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
- = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
warning: 3 warnings emitted
diff --git a/tests/ui/unreachable-code.rs b/tests/ui/unreachable-code.rs
index 28b938edc..64174db7a 100644
--- a/tests/ui/unreachable-code.rs
+++ b/tests/ui/unreachable-code.rs
@@ -2,25 +2,32 @@
#![allow(unused_must_use)]
#![allow(dead_code)]
-
#![allow(path_statements)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
+#![feature(if_let_guard)]
-fn id(x: bool) -> bool { x }
+fn id(x: bool) -> bool {
+ x
+}
fn call_id() {
let c = panic!();
id(c);
}
-fn call_id_2() { id(true) && id(return); }
+fn call_id_2() {
+ id(true) && id(return);
+}
-fn call_id_3() { id(return) && id(return); }
+fn call_id_3() {
+ id(return) && id(return);
+}
fn ret_guard() {
match 2 {
x if (return) => { x; }
+ x if let true = return => { x; }
_ => {}
}
}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
new file mode 100644
index 000000000..a192f3445
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
@@ -0,0 +1,17 @@
+// edition: 2024
+// compile-flags: -Zunstable-options
+// check-pass
+
+#![crate_type = "lib"]
+
+#![deny(unused_unsafe)]
+
+unsafe fn unsf() {}
+
+unsafe fn foo() {
+ unsf();
+ //~^ WARN call to unsafe function is unsafe and requires unsafe block
+
+ // no unused_unsafe
+ unsafe { unsf(); }
+}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
new file mode 100644
index 000000000..fbc621f4d
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
@@ -0,0 +1,16 @@
+warning: call to unsafe function is unsafe and requires unsafe block (error E0133)
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:11:1
+ |
+LL | unsafe fn foo() {
+ | ^^^^^^^^^^^^^^^
+ = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.rs b/tests/ui/unsafe/initializing-ranged-via-ctor.rs
new file mode 100644
index 000000000..ca44fa7e4
--- /dev/null
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.rs
@@ -0,0 +1,11 @@
+#![feature(rustc_attrs)]
+#![allow(internal_features)]
+
+#[derive(Debug)]
+#[rustc_layout_scalar_valid_range_start(2)]
+struct NonZeroAndOneU8(u8);
+
+fn main() {
+ println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap());
+ //~^ ERROR found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+}
diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.stderr b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
new file mode 100644
index 000000000..d34554c66
--- /dev/null
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
@@ -0,0 +1,16 @@
+error[E0277]: expected a `FnOnce<({integer},)>` closure, found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ --> $DIR/initializing-ranged-via-ctor.rs:9:34
+ |
+LL | println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap());
+ | --- ^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `FnOnce<({integer},)>` is not implemented for fn item `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ = note: unsafe function cannot be called generically without an unsafe block
+note: required by a bound in `Option::<T>::map`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
new file mode 100644
index 000000000..68559338d
--- /dev/null
+++ b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs
@@ -0,0 +1,16 @@
+// Regression test for #115348.
+
+unsafe fn uwu() {}
+
+// Tests that the false-positive warning "unnecessary `unsafe` block"
+// should not be reported, when the error "non-exhaustive patterns"
+// appears.
+
+fn foo(x: Option<u32>) {
+ match x {
+ //~^ ERROR non-exhaustive patterns: `None` not covered
+ Some(_) => unsafe { uwu() },
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr
new file mode 100644
index 000000000..7384899b9
--- /dev/null
+++ b/tests/ui/unsafe/issue-115348-false-positive-warning-of-unnecessary-unsafe.stderr
@@ -0,0 +1,21 @@
+error[E0004]: non-exhaustive patterns: `None` not covered
+ --> $DIR/issue-115348-false-positive-warning-of-unnecessary-unsafe.rs:10:11
+ |
+LL | match x {
+ | ^ pattern `None` not covered
+ |
+note: `Option<u32>` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
+ = note: the matched value is of type `Option<u32>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ Some(_) => unsafe { uwu() },
+LL ~ None => todo!(),
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs
new file mode 100644
index 000000000..a91e57951
--- /dev/null
+++ b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.rs
@@ -0,0 +1,10 @@
+#![feature(rustc_attrs)]
+
+#[derive(Debug)]
+#[rustc_layout_scalar_valid_range_start(2)]
+struct NonZeroAndOneU8(u8);
+
+fn main() {
+ let x: fn(u8) -> NonZeroAndOneU8 = NonZeroAndOneU8;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr
new file mode 100644
index 000000000..660c40704
--- /dev/null
+++ b/tests/ui/unsafe/ranged-ctor-as-fn-ptr.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/ranged-ctor-as-fn-ptr.rs:8:40
+ |
+LL | let x: fn(u8) -> NonZeroAndOneU8 = NonZeroAndOneU8;
+ | ------------------------- ^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+ | |
+ | expected due to this
+ |
+ = note: expected fn pointer `fn(_) -> NonZeroAndOneU8`
+ found struct constructor `unsafe fn(_) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+ = note: unsafe functions cannot be coerced into safe function pointers
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/unsized/issue-115203.rs b/tests/ui/unsized/issue-115203.rs
new file mode 100644
index 000000000..5fe7bd642
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.rs
@@ -0,0 +1,11 @@
+// compile-flags: --emit link
+
+fn main() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[]] => (),
+ _ => (),
+ }
+}
diff --git a/tests/ui/unsized/issue-115203.stderr b/tests/ui/unsized/issue-115203.stderr
new file mode 100644
index 000000000..3ee734988
--- /dev/null
+++ b/tests/ui/unsized/issue-115203.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115203.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-115809.rs b/tests/ui/unsized/issue-115809.rs
new file mode 100644
index 000000000..ff25365ea
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.rs
@@ -0,0 +1,13 @@
+// compile-flags: --emit=link -Zmir-opt-level=2 -Zpolymorphize=on
+
+fn foo<T>() {
+ let a: [i32; 0] = [];
+ match [a[..]] {
+ //~^ ERROR cannot move a value of type `[i32]
+ //~| ERROR cannot move out of type `[i32]`, a non-copy slice
+ [[x]] => {}
+ _ => (),
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/issue-115809.stderr b/tests/ui/unsized/issue-115809.stderr
new file mode 100644
index 000000000..a92554b79
--- /dev/null
+++ b/tests/ui/unsized/issue-115809.stderr
@@ -0,0 +1,19 @@
+error[E0161]: cannot move a value of type `[i32]`
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^ the size of `[i32]` cannot be statically determined
+
+error[E0508]: cannot move out of type `[i32]`, a non-copy slice
+ --> $DIR/issue-115809.rs:5:12
+ |
+LL | match [a[..]] {
+ | ^^^^^
+ | |
+ | cannot move out of here
+ | move occurs because value has type `[i32]`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr
index 97618ed05..aa7f9c78f 100644
--- a/tests/ui/unsized/issue-75707.stderr
+++ b/tests/ui/unsized/issue-75707.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied
LL | f::<dyn Processing<Call = MyCall>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-75707.rs:1:1
+ |
+LL | pub trait Callback {
+ | ^^^^^^^^^^^^^^^^^^
note: required by a bound in `f`
--> $DIR/issue-75707.rs:9:9
|
diff --git a/tests/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr
index 3ef9a8753..a11243980 100644
--- a/tests/ui/unsized/unsized3.stderr
+++ b/tests/ui/unsized/unsized3.stderr
@@ -1,12 +1,10 @@
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:7:13
+ --> $DIR/unsized3.rs:7:10
|
LL | fn f1<X: ?Sized>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f2::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f2`
--> $DIR/unsized3.rs:10:7
@@ -24,14 +22,12 @@ LL | fn f2<X: ?Sized>(x: &X) {
| ++++++++
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:18:13
+ --> $DIR/unsized3.rs:18:10
|
LL | fn f3<X: ?Sized + T>(x: &X) {
| - this type parameter needs to be `Sized`
LL | f4::<X>(x);
- | ------- ^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^ doesn't have a size known at compile-time
|
note: required by a bound in `f4`
--> $DIR/unsized3.rs:21:7
diff --git a/tests/ui/wf/hir-wf-canonicalized.stderr b/tests/ui/wf/hir-wf-canonicalized.stderr
index 9fd0f9c81..21122e37d 100644
--- a/tests/ui/wf/hir-wf-canonicalized.stderr
+++ b/tests/ui/wf/hir-wf-canonicalized.stderr
@@ -3,12 +3,24 @@ error[E0277]: the trait bound `Bar<'a, T>: Foo` is not satisfied
|
LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<'a, T>`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/hir-wf-canonicalized.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error[E0277]: the trait bound `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static): Foo` is not satisfied
--> $DIR/hir-wf-canonicalized.rs:10:15
|
LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/hir-wf-canonicalized.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
error[E0277]: the size for values of type `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` cannot be known at compilation time
--> $DIR/hir-wf-canonicalized.rs:10:15
diff --git a/tests/ui/wf/issue-95665.stderr b/tests/ui/wf/issue-95665.stderr
index b1cda59a9..f80cd41a4 100644
--- a/tests/ui/wf/issue-95665.stderr
+++ b/tests/ui/wf/issue-95665.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
LL | static VAR: Struct<u8>;
| ^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-95665.rs:4:1
+ |
+LL | pub trait Trait: {}
+ | ^^^^^^^^^^^^^^^
note: required by a bound in `Struct`
--> $DIR/issue-95665.rs:6:22
|
diff --git a/tests/ui/wf/wf-complex-assoc-type.stderr b/tests/ui/wf/wf-complex-assoc-type.stderr
index ef613e313..6a623bec8 100644
--- a/tests/ui/wf/wf-complex-assoc-type.stderr
+++ b/tests/ui/wf/wf-complex-assoc-type.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `bool: MyTrait` is not satisfied
LL | type MyItem = Option<((AssertMyTrait<bool>, u8))>;
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `bool`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-complex-assoc-type.rs:1:1
+ |
+LL | trait MyTrait {}
+ | ^^^^^^^^^^^^^
note: required by a bound in `AssertMyTrait`
--> $DIR/wf-complex-assoc-type.rs:2:25
|
diff --git a/tests/ui/wf/wf-foreign-fn-decl-ret.stderr b/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
index b03023b5f..0e9360104 100644
--- a/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
+++ b/tests/ui/wf/wf-foreign-fn-decl-ret.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
|
LL | pub fn lint_me() -> <() as Foo>::Assoc;
| ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-foreign-fn-decl-ret.rs:6:1
+ |
+LL | pub trait Foo {
+ | ^^^^^^^^^^^^^
error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied
--> $DIR/wf-foreign-fn-decl-ret.rs:14:32
@@ -10,6 +16,11 @@ error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied
LL | pub fn lint_me_aswell() -> Bar<u32>;
| ^^^^^^^^ the trait `Unsatisfied` is not implemented for `u32`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-foreign-fn-decl-ret.rs:1:1
+ |
+LL | pub trait Unsatisfied {}
+ | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `Bar`
--> $DIR/wf-foreign-fn-decl-ret.rs:4:19
|
diff --git a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
index e460cdcd3..52f46562c 100644
--- a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
+++ b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `DefaultAllocator: Allocator` is not satisfied
|
LL | struct Foo(Matrix<<DefaultAllocator as Allocator>::Buffer>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `DefaultAllocator`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:23:1
+ |
+LL | pub trait Allocator { type Buffer; }
+ | ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
index 191a8ca8e..29b36f44a 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<'b> fn(&'b ()): Foo` is not satisfied
LL | called()
| ^^^^^^ the trait `for<'b> Foo` is not implemented for `fn(&'b ())`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/higher-ranked-fn-type.rs:6:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
index ce409f627..54afeaa7e 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_t
LL | called()
| ^^^^^^ the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b) }) ())`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/higher-ranked-fn-type.rs:6:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
diff --git a/tests/ui/where-clauses/where-clause-method-substituion.stderr b/tests/ui/where-clauses/where-clause-method-substituion.stderr
index 8c47ed6d4..2f3b615a1 100644
--- a/tests/ui/where-clauses/where-clause-method-substituion.stderr
+++ b/tests/ui/where-clauses/where-clause-method-substituion.stderr
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `X: Foo<X>` is not satisfied
LL | 1.method::<X>();
| ^ the trait `Foo<X>` is not implemented for `X`
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/where-clause-method-substituion.rs:1:1
+ |
+LL | trait Foo<T> {
+ | ^^^^^^^^^^^^
note: required by a bound in `Bar::method`
--> $DIR/where-clause-method-substituion.rs:6:34
|