summaryrefslogtreecommitdiffstats
path: root/tests/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/abi/compatibility.rs1
-rw-r--r--tests/ui/allocator/not-an-allocator.stderr3
-rw-r--r--tests/ui/array-slice-vec/vector-no-ann.stderr2
-rw-r--r--tests/ui/asm/aarch64/interpolated-idents.stderr7
-rw-r--r--tests/ui/asm/x86_64/interpolated-idents.stderr7
-rw-r--r--tests/ui/asm/x86_64/issue-96797.rs9
-rw-r--r--tests/ui/associated-consts/associated-const-ambiguity-report.stderr8
-rw-r--r--tests/ui/associated-consts/defaults-not-assumed-fail.stderr1
-rw-r--r--tests/ui/associated-consts/issue-105330.rs10
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr82
-rw-r--r--tests/ui/associated-consts/issue-58022.rs1
-rw-r--r--tests/ui/associated-consts/issue-58022.stderr22
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr14
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr2
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr2
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.rs1
-rw-r--r--tests/ui/associated-inherent-types/issue-109071.no_gate.stderr2
-rw-r--r--tests/ui/associated-inherent-types/issue-109789.stderr1
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr2
-rw-r--r--tests/ui/associated-inherent-types/regionck-1.stderr11
-rw-r--r--tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr2
-rw-r--r--tests/ui/associated-item/associated-item-duplicate-names-3.stderr2
-rw-r--r--tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs28
-rw-r--r--tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr18
-rw-r--r--tests/ui/associated-type-bounds/duplicate.rs132
-rw-r--r--tests/ui/associated-type-bounds/duplicate.stderr144
-rw-r--r--tests/ui/associated-type-bounds/elision.stderr2
-rw-r--r--tests/ui/associated-type-bounds/issue-71443-1.stderr2
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.stderr2
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed14
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs14
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr16
-rw-r--r--tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr24
-rw-r--r--tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr12
-rw-r--r--tests/ui/associated-types/associated-types-coherence-failure.stderr8
-rw-r--r--tests/ui/associated-types/associated-types-in-ambiguous-context.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-incomplete-object.rs6
-rw-r--r--tests/ui/associated-types/associated-types-incomplete-object.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-issue-20346.stderr2
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.rs1
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr14
-rw-r--r--tests/ui/associated-types/associated-types-path-1.stderr4
-rw-r--r--tests/ui/associated-types/hr-associated-type-bound-2.stderr6
-rw-r--r--tests/ui/associated-types/hr-associated-type-bound-param-2.stderr1
-rw-r--r--tests/ui/associated-types/hr-associated-type-projection-1.stderr4
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-1.stderr8
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-2.stderr7
-rw-r--r--tests/ui/associated-types/issue-22560.stderr2
-rw-r--r--tests/ui/associated-types/issue-23595-1.stderr2
-rw-r--r--tests/ui/associated-types/missing-associated-types.stderr10
-rw-r--r--tests/ui/async-await/async-await-let-else.stderr6
-rw-r--r--tests/ui/async-await/async-trait-fn.current.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.next.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.rs7
-rw-r--r--tests/ui/async-await/async-trait-fn.stderr42
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr2
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.rs8
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr18
-rw-r--r--tests/ui/async-await/coroutine-desc.rs (renamed from tests/ui/async-await/generator-desc.rs)0
-rw-r--r--tests/ui/async-await/coroutine-desc.stderr (renamed from tests/ui/async-await/generator-desc.stderr)20
-rw-r--r--tests/ui/async-await/coroutine-not-future.rs (renamed from tests/ui/async-await/generator-not-future.rs)24
-rw-r--r--tests/ui/async-await/coroutine-not-future.stderr81
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs10
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr23
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.current.stderr98
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.next.stderr98
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.rs1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.stderr24
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.rs25
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.stderr42
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout6
-rw-r--r--tests/ui/async-await/generator-not-future.stderr81
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example.rs6
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-generics.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.stderr4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.stderr4
-rw-r--r--tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.rs1
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.stderr4
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.rs26
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.stderr25
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs1
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr12
-rw-r--r--tests/ui/async-await/in-trait/early-bound-1.rs4
-rw-r--r--tests/ui/async-await/in-trait/early-bound-2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err.rs1
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err.stderr2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs3
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.stderr12
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.rs1
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/implied-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs2
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr6
-rw-r--r--tests/ui/async-await/in-trait/issue-102138.rs3
-rw-r--r--tests/ui/async-await/in-trait/issue-102219.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102310.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-104678.rs2
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.rs1
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.stderr16
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr6
-rw-r--r--tests/ui/async-await/in-trait/nested-rpit.rs3
-rw-r--r--tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs2
-rw-r--r--tests/ui/async-await/in-trait/object-safety.rs1
-rw-r--r--tests/ui/async-await/in-trait/object-safety.stderr4
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.stderr8
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.stderr2
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr8
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.rs19
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.stderr9
-rw-r--r--tests/ui/async-await/in-trait/warn.rs22
-rw-r--r--tests/ui/async-await/in-trait/warn.stderr20
-rw-r--r--tests/ui/async-await/issue-108572.fixed16
-rw-r--r--tests/ui/async-await/issue-108572.rs7
-rw-r--r--tests/ui/async-await/issue-108572.stderr9
-rw-r--r--tests/ui/async-await/issue-60709.rs2
-rw-r--r--tests/ui/async-await/issue-61793.rs2
-rw-r--r--tests/ui/async-await/issue-62658.rs2
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr2
-rw-r--r--tests/ui/async-await/issue-66312.rs2
-rw-r--r--tests/ui/async-await/issue-66312.stderr11
-rw-r--r--tests/ui/async-await/issue-68112.stderr2
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.stderr2
-rw-r--r--tests/ui/async-await/issue-73137.rs2
-rw-r--r--tests/ui/async-await/issues/issue-51719.rs4
-rw-r--r--tests/ui/async-await/issues/issue-59972.rs2
-rw-r--r--tests/ui/async-await/issues/issue-60655-latebound-regions.rs2
-rw-r--r--tests/ui/async-await/issues/issue-64477-2.rs2
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs (renamed from tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs)10
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr6
-rw-r--r--tests/ui/async-await/issues/issue-95307.rs3
-rw-r--r--tests/ui/async-await/issues/issue-95307.stderr18
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr8
-rw-r--r--tests/ui/async-await/no-async-const.rs1
-rw-r--r--tests/ui/async-await/no-async-const.stderr11
-rw-r--r--tests/ui/async-await/no-unsafe-async.rs2
-rw-r--r--tests/ui/async-await/no-unsafe-async.stderr5
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.stderr4
-rw-r--r--tests/ui/async-await/pin-needed-to-poll.stderr8
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr4
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr9
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-late.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr8
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr6
-rw-r--r--tests/ui/async-await/send-bound-async-closure.rs2
-rw-r--r--tests/ui/async-await/task-context-arg.rs2
-rw-r--r--tests/ui/async-await/unnecessary-await.rs5
-rw-r--r--tests/ui/async-await/unnecessary-await.stderr15
-rw-r--r--tests/ui/atomic-from-mut-not-available.stderr4
-rw-r--r--tests/ui/attributes/const-stability-on-macro.rs2
-rw-r--r--tests/ui/attributes/const-stability-on-macro.stderr4
-rw-r--r--tests/ui/attributes/statement-attribute-validation.rs39
-rw-r--r--tests/ui/attributes/statement-attribute-validation.stderr56
-rw-r--r--tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr8
-rw-r--r--tests/ui/auto-traits/has-arguments.rs10
-rw-r--r--tests/ui/auto-traits/has-arguments.stderr11
-rw-r--r--tests/ui/auto-traits/pre-cfg.rs8
-rw-r--r--tests/ui/auto-traits/pre-cfg.stderr13
-rw-r--r--tests/ui/binding/issue-53114-borrow-checks.rs13
-rw-r--r--tests/ui/binding/issue-53114-borrow-checks.stderr81
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.fixed10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.rs10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.stderr17
-rw-r--r--tests/ui/block-result/block-must-not-have-result-res.stderr2
-rw-r--r--tests/ui/block-result/issue-20862.stderr2
-rw-r--r--tests/ui/block-result/issue-22645.stderr2
-rw-r--r--tests/ui/block-result/issue-5500.stderr2
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs14
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr19
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds.rs22
-rw-r--r--tests/ui/borrowck/alias-liveness/gat-static.rs29
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs16
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr16
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked.rs16
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-capture.rs17
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-type-param.rs14
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-type-param.stderr13
-rw-r--r--tests/ui/borrowck/alias-liveness/rpit-static.rs22
-rw-r--r--tests/ui/borrowck/alias-liveness/rpitit-static.rs18
-rw-r--r--tests/ui/borrowck/alias-liveness/rtn-static.rs23
-rw-r--r--tests/ui/borrowck/alias-liveness/rtn-static.stderr11
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-match.stderr40
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr138
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr50
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr138
-rw-r--r--tests/ui/borrowck/issue-62107-match-arm-scopes.rs2
-rw-r--r--tests/ui/borrowck/issue-62107-match-arm-scopes.stderr5
-rw-r--r--tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs4
-rw-r--r--tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr6
-rw-r--r--tests/ui/borrowck/let_underscore_temporary.rs38
-rw-r--r--tests/ui/borrowck/let_underscore_temporary.stderr40
-rw-r--r--tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr1
-rw-r--r--tests/ui/bounds-lifetime.rs2
-rw-r--r--tests/ui/bounds-lifetime.stderr4
-rw-r--r--tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr7
-rw-r--r--tests/ui/c-variadic/issue-86053-1.stderr10
-rw-r--r--tests/ui/cast/ptr-to-ptr-different-regions.rs24
-rw-r--r--tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr2
-rw-r--r--tests/ui/check-cfg/allow-at-crate-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-macro-cfg.rs2
-rw-r--r--tests/ui/check-cfg/allow-same-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-same-level.stderr3
-rw-r--r--tests/ui/check-cfg/allow-top-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-upper-level.rs2
-rw-r--r--tests/ui/check-cfg/compact-names.rs2
-rw-r--r--tests/ui/check-cfg/compact-names.stderr3
-rw-r--r--tests/ui/check-cfg/compact-values.rs2
-rw-r--r--tests/ui/check-cfg/compact-values.stderr2
-rw-r--r--tests/ui/check-cfg/concat-values.rs13
-rw-r--r--tests/ui/check-cfg/concat-values.stderr19
-rw-r--r--tests/ui/check-cfg/diagnotics.rs2
-rw-r--r--tests/ui/check-cfg/diagnotics.stderr13
-rw-r--r--tests/ui/check-cfg/empty-names.rs10
-rw-r--r--tests/ui/check-cfg/empty-names.stderr10
-rw-r--r--tests/ui/check-cfg/empty-values.rs10
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr25
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr25
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.feature.stderr33
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.full.stderr33
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.rs34
-rw-r--r--tests/ui/check-cfg/exhaustive-names.empty_names.stderr15
-rw-r--r--tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr15
-rw-r--r--tests/ui/check-cfg/exhaustive-names.rs12
-rw-r--r--tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr17
-rw-r--r--tests/ui/check-cfg/exhaustive-values.empty_values.stderr (renamed from tests/ui/check-cfg/empty-values.stderr)4
-rw-r--r--tests/ui/check-cfg/exhaustive-values.rs13
-rw-r--r--tests/ui/check-cfg/exhaustive-values.without_names.stderr13
-rw-r--r--tests/ui/check-cfg/invalid-arguments.any_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.anything_else.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.giberich.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.mixed_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.rs34
-rw-r--r--tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unterminated.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-cfg-name.rs14
-rw-r--r--tests/ui/check-cfg/invalid-cfg-value.rs18
-rw-r--r--tests/ui/check-cfg/mix.cfg.stderr (renamed from tests/ui/check-cfg/mix.stderr)106
-rw-r--r--tests/ui/check-cfg/mix.names_values.stderr192
-rw-r--r--tests/ui/check-cfg/mix.rs6
-rw-r--r--tests/ui/check-cfg/no-expected-values.empty.stderr (renamed from tests/ui/check-cfg/no-values.stderr)8
-rw-r--r--tests/ui/check-cfg/no-expected-values.mixed.stderr23
-rw-r--r--tests/ui/check-cfg/no-expected-values.rs20
-rw-r--r--tests/ui/check-cfg/no-expected-values.simple.stderr23
-rw-r--r--tests/ui/check-cfg/no-expected-values.values.stderr23
-rw-r--r--tests/ui/check-cfg/no-values.rs14
-rw-r--r--tests/ui/check-cfg/order-independant.names_after.stderr4
-rw-r--r--tests/ui/check-cfg/order-independant.names_before.stderr4
-rw-r--r--tests/ui/check-cfg/stmt-no-ice.rs2
-rw-r--r--tests/ui/check-cfg/stmt-no-ice.stderr3
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr (renamed from tests/ui/check-cfg/invalid-cfg-name.stderr)4
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.names.stderr10
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.rs16
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr (renamed from tests/ui/check-cfg/invalid-cfg-value.stderr)8
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.rs22
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.values.stderr25
-rw-r--r--tests/ui/check-cfg/unknown-values.rs17
-rw-r--r--tests/ui/check-cfg/values-target-json.stderr2
-rw-r--r--tests/ui/check-cfg/well-known-names.rs2
-rw-r--r--tests/ui/check-cfg/well-known-names.stderr14
-rw-r--r--tests/ui/check-cfg/well-known-values.rs2
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr10
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs3
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr12
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr4
-rw-r--r--tests/ui/closures/add_semicolon_non_block_closure.stderr2
-rw-r--r--tests/ui/closures/binder/implicit-return.stderr4
-rw-r--r--tests/ui/closures/binder/implicit-stuff.stderr4
-rw-r--r--tests/ui/closures/closure-expected.rs2
-rw-r--r--tests/ui/closures/closure-expected.stderr4
-rw-r--r--tests/ui/closures/coerce-unsafe-to-closure.stderr2
-rw-r--r--tests/ui/closures/infer-signature-from-impl.next.stderr16
-rw-r--r--tests/ui/closures/infer-signature-from-impl.rs20
-rw-r--r--tests/ui/closures/issue-25439.rs2
-rw-r--r--tests/ui/closures/issue-25439.stderr2
-rw-r--r--tests/ui/codegen/issue-79865-llvm-miscompile.rs2
-rw-r--r--tests/ui/codemap_tests/tab.stderr2
-rw-r--r--tests/ui/coercion/issue-53475.stderr7
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs1
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr13
-rw-r--r--tests/ui/coherence/coherence-negative-outlives-lifetimes.rs2
-rw-r--r--tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr11
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.next.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.old.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-trait-alias.rs4
-rw-r--r--tests/ui/coherence/coherence-overlap-trait-alias.stderr16
-rw-r--r--tests/ui/coherence/coherence-overlap-upstream.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-with-regions.rs8
-rw-r--r--tests/ui/coherence/coherence-overlap-with-regions.stderr11
-rw-r--r--tests/ui/coherence/coherence-wasm-bindgen.stderr14
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.rs (renamed from tests/ui/coherence/coherence-with-generator.rs)10
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.stock.stderr (renamed from tests/ui/coherence/coherence-with-generator.stock.stderr)8
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr11
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr11
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr12
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.rs29
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr12
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr38
-rw-r--r--tests/ui/compare-method/bad-self-type.stderr4
-rw-r--r--tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr1
-rw-r--r--tests/ui/const-generics/assoc_const_eq_diagnostic.stderr1
-rw-r--r--tests/ui/const-generics/const-arg-in-const-arg.rs2
-rw-r--r--tests/ui/const-generics/const-argument-if-length.full.stderr16
-rw-r--r--tests/ui/const-generics/defaults/default-annotation.rs6
-rw-r--r--tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs2
-rw-r--r--tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr19
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.stderr4
-rw-r--r--tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr8
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.rs13
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr12
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-67945-1.full.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74950.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-83249.stderr15
-rw-r--r--tests/ui/const-generics/occurs-check/unused-substs-1.stderr2
-rw-r--r--tests/ui/const-ptr/allowed_slices.rs2
-rw-r--r--tests/ui/const-ptr/forbidden_slices.rs14
-rw-r--r--tests/ui/const-ptr/forbidden_slices.stderr114
-rw-r--r--tests/ui/const-ptr/out_of_bounds_read.stderr6
-rw-r--r--tests/ui/const_prop/overwrite_with_const_with_params.rs21
-rw-r--r--tests/ui/consts/assert-type-intrinsics.rs1
-rw-r--r--tests/ui/consts/assert-type-intrinsics.stderr12
-rw-r--r--tests/ui/consts/const-adt-align-mismatch.rs2
-rw-r--r--tests/ui/consts/const-blocks/fn-call-in-non-const.stderr6
-rw-r--r--tests/ui/consts/const-blocks/trait-error.stderr6
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.stderr8
-rw-r--r--tests/ui/consts/const-deref-ptr.rs1
-rw-r--r--tests/ui/consts/const-deref-ptr.stderr2
-rw-r--r--tests/ui/consts/const-err-late.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs14
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr4
-rw-r--r--tests/ui/consts/const-eval/dangling.rs10
-rw-r--r--tests/ui/consts/const-eval/dangling.stderr9
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr10
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr6
-rw-r--r--tests/ui/consts/const-eval/issue-114994-fail.rs14
-rw-r--r--tests/ui/consts/const-eval/issue-114994-fail.stderr21
-rw-r--r--tests/ui/consts/const-eval/issue-114994.rs18
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr1
-rw-r--r--tests/ui/consts/const-eval/issue-49296.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr21
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.normal.stderr (renamed from tests/ui/consts/const-eval/issue-50814-2.stderr)6
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.rs2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.rs2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr11
-rw-r--r--tests/ui/consts/const-eval/nrvo.rs3
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/partial_ptr_overwrite.stderr2
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs4
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.rs45
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.stderr42
-rw-r--r--tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr1
-rw-r--r--tests/ui/consts/const-eval/ub-enum.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr40
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr40
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.rs10
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.rs20
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr67
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.rs2
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr8
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const-late.rs20
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const-late.stderr11
-rw-r--r--tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs1
-rw-r--r--tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr10
-rw-r--r--tests/ui/consts/const-fn-in-vec.rs8
-rw-r--r--tests/ui/consts/const-fn-in-vec.stderr44
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr20
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr20
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs9
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr26
-rw-r--r--tests/ui/consts/const-points-to-static.32bit.stderr2
-rw-r--r--tests/ui/consts/const-points-to-static.64bit.stderr2
-rw-r--r--tests/ui/consts/const-unsized.rs4
-rw-r--r--tests/ui/consts/const-unsized.stderr44
-rw-r--r--tests/ui/consts/const_discriminant.rs1
-rw-r--r--tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs32
-rw-r--r--tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr34
-rw-r--r--tests/ui/consts/const_in_pattern/issue-44333.rs4
-rw-r--r--tests/ui/consts/const_in_pattern/issue-44333.stderr4
-rw-r--r--tests/ui/consts/const_in_pattern/issue-78057.rs1
-rw-r--r--tests/ui/consts/const_in_pattern/issue-78057.stderr17
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.rs5
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.stderr33
-rw-r--r--tests/ui/consts/copy-intrinsic.stderr4
-rw-r--r--tests/ui/consts/enum-discr-type-err.stderr1
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.rs13
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr8
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr10
-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-102117.stderr15
-rw-r--r--tests/ui/consts/issue-116186.rs12
-rw-r--r--tests/ui/consts/issue-116186.stderr21
-rw-r--r--tests/ui/consts/issue-17718-const-bad-values.stderr1
-rw-r--r--tests/ui/consts/issue-34784.rs21
-rw-r--r--tests/ui/consts/issue-39974.rs1
-rw-r--r--tests/ui/consts/issue-39974.stderr13
-rw-r--r--tests/ui/consts/issue-63952.32bit.stderr2
-rw-r--r--tests/ui/consts/issue-63952.64bit.stderr2
-rw-r--r--tests/ui/consts/issue-67696-const-prop-ice.rs2
-rw-r--r--tests/ui/consts/issue-79690.64bit.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const_2.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr9
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr9
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.rs1
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.stderr6
-rw-r--r--tests/ui/consts/missing_span_in_backtrace.rs2
-rw-r--r--tests/ui/consts/missing_span_in_backtrace.stderr2
-rw-r--r--tests/ui/consts/offset_from_ub.stderr6
-rw-r--r--tests/ui/consts/offset_ub.rs2
-rw-r--r--tests/ui/consts/offset_ub.stderr8
-rw-r--r--tests/ui/consts/uninhabited-const-issue-61744.stderr2
-rw-r--r--tests/ui/coroutine/addassign-yield.rs (renamed from tests/ui/generator/addassign-yield.rs)2
-rw-r--r--tests/ui/coroutine/async-coroutine-issue-67158.rs6
-rw-r--r--tests/ui/coroutine/async-coroutine-issue-67158.stderr (renamed from tests/ui/generator/async-generator-issue-67158.stderr)4
-rw-r--r--tests/ui/coroutine/auto-trait-regions.rs (renamed from tests/ui/generator/auto-trait-regions.rs)6
-rw-r--r--tests/ui/coroutine/auto-trait-regions.stderr (renamed from tests/ui/generator/auto-trait-regions.stderr)0
-rw-r--r--tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs11
-rw-r--r--tests/ui/coroutine/auxiliary/unwind-aux.rs11
-rw-r--r--tests/ui/coroutine/auxiliary/xcrate-reachable.rs14
-rw-r--r--tests/ui/coroutine/auxiliary/xcrate.rs18
-rw-r--r--tests/ui/coroutine/borrow-in-tail-expr.rs (renamed from tests/ui/generator/borrow-in-tail-expr.rs)2
-rw-r--r--tests/ui/coroutine/borrowing.rs (renamed from tests/ui/generator/borrowing.rs)4
-rw-r--r--tests/ui/coroutine/borrowing.stderr (renamed from tests/ui/generator/borrowing.stderr)4
-rw-r--r--tests/ui/coroutine/clone-impl-async.rs (renamed from tests/ui/generator/clone-impl-async.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl-async.stderr (renamed from tests/ui/generator/clone-impl-async.stderr)0
-rw-r--r--tests/ui/coroutine/clone-impl-static.rs (renamed from tests/ui/generator/clone-impl-static.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl-static.stderr (renamed from tests/ui/generator/clone-impl-static.stderr)8
-rw-r--r--tests/ui/coroutine/clone-impl.rs (renamed from tests/ui/generator/clone-impl.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl.stderr (renamed from tests/ui/generator/clone-impl.stderr)40
-rw-r--r--tests/ui/coroutine/conditional-drop.rs (renamed from tests/ui/generator/conditional-drop.rs)4
-rw-r--r--tests/ui/coroutine/control-flow.rs (renamed from tests/ui/generator/control-flow.rs)10
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.migrate.stderr (renamed from tests/ui/generator/generator-region-requirements.migrate.stderr)0
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.rs (renamed from tests/ui/generator/generator-region-requirements.rs)8
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.stderr (renamed from tests/ui/generator/generator-region-requirements.stderr)4
-rw-r--r--tests/ui/coroutine/coroutine-resume-after-panic.rs (renamed from tests/ui/generator/generator-resume-after-panic.rs)8
-rw-r--r--tests/ui/coroutine/coroutine-with-nll.rs (renamed from tests/ui/generator/generator-with-nll.rs)4
-rw-r--r--tests/ui/coroutine/coroutine-with-nll.stderr (renamed from tests/ui/generator/generator-with-nll.stderr)4
-rw-r--r--tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs35
-rw-r--r--tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr (renamed from tests/ui/generator/generator-yielding-or-returning-itself.stderr)32
-rw-r--r--tests/ui/coroutine/derived-drop-parent-expr.rs (renamed from tests/ui/generator/derived-drop-parent-expr.rs)2
-rw-r--r--tests/ui/coroutine/discriminant.rs (renamed from tests/ui/generator/discriminant.rs)14
-rw-r--r--tests/ui/coroutine/drop-and-replace.rs (renamed from tests/ui/generator/drop-and-replace.rs)10
-rw-r--r--tests/ui/coroutine/drop-control-flow.rs (renamed from tests/ui/generator/drop-control-flow.rs)6
-rw-r--r--tests/ui/coroutine/drop-env.rs (renamed from tests/ui/generator/drop-env.rs)4
-rw-r--r--tests/ui/coroutine/drop-track-addassign-yield.rs (renamed from tests/ui/generator/drop-track-addassign-yield.rs)2
-rw-r--r--tests/ui/coroutine/drop-tracking-parent-expression.rs (renamed from tests/ui/generator/drop-tracking-parent-expression.rs)2
-rw-r--r--tests/ui/coroutine/drop-tracking-parent-expression.stderr (renamed from tests/ui/generator/drop-tracking-parent-expression.stderr)24
-rw-r--r--tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs (renamed from tests/ui/generator/drop-tracking-yielding-in-match-guards.rs)2
-rw-r--r--tests/ui/coroutine/drop-yield-twice.rs (renamed from tests/ui/generator/drop-yield-twice.rs)4
-rw-r--r--tests/ui/coroutine/drop-yield-twice.stderr (renamed from tests/ui/generator/drop-yield-twice.stderr)8
-rw-r--r--tests/ui/coroutine/dropck-resume.rs (renamed from tests/ui/generator/dropck-resume.rs)8
-rw-r--r--tests/ui/coroutine/dropck-resume.stderr (renamed from tests/ui/generator/dropck-resume.stderr)2
-rw-r--r--tests/ui/coroutine/dropck.rs (renamed from tests/ui/generator/dropck.rs)6
-rw-r--r--tests/ui/coroutine/dropck.stderr (renamed from tests/ui/generator/dropck.stderr)8
-rw-r--r--tests/ui/coroutine/gen_block.e2024.stderr19
-rw-r--r--tests/ui/coroutine/gen_block.none.stderr49
-rw-r--r--tests/ui/coroutine/gen_block.rs17
-rw-r--r--tests/ui/coroutine/gen_block_is_coro.rs18
-rw-r--r--tests/ui/coroutine/gen_block_is_coro.stderr21
-rw-r--r--tests/ui/coroutine/gen_block_is_iter.rs19
-rw-r--r--tests/ui/coroutine/gen_block_is_no_future.rs8
-rw-r--r--tests/ui/coroutine/gen_block_is_no_future.stderr12
-rw-r--r--tests/ui/coroutine/gen_block_iterate.rs35
-rw-r--r--tests/ui/coroutine/gen_block_move.fixed17
-rw-r--r--tests/ui/coroutine/gen_block_move.rs17
-rw-r--r--tests/ui/coroutine/gen_block_move.stderr30
-rw-r--r--tests/ui/coroutine/gen_block_panic.rs26
-rw-r--r--tests/ui/coroutine/gen_block_panic.stderr12
-rw-r--r--tests/ui/coroutine/gen_fn.e2024.stderr10
-rw-r--r--tests/ui/coroutine/gen_fn.none.stderr8
-rw-r--r--tests/ui/coroutine/gen_fn.rs8
-rw-r--r--tests/ui/coroutine/issue-102645.rs (renamed from tests/ui/generator/issue-102645.rs)4
-rw-r--r--tests/ui/coroutine/issue-102645.stderr (renamed from tests/ui/generator/issue-102645.stderr)2
-rw-r--r--tests/ui/coroutine/issue-105084.rs (renamed from tests/ui/generator/issue-105084.rs)12
-rw-r--r--tests/ui/coroutine/issue-105084.stderr (renamed from tests/ui/generator/issue-105084.stderr)10
-rw-r--r--tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs (renamed from tests/ui/generator/issue-110929-generator-conflict-error-ice.rs)2
-rw-r--r--tests/ui/coroutine/issue-113279.rs (renamed from tests/ui/generator/issue-113279.rs)6
-rw-r--r--tests/ui/coroutine/issue-113279.stderr (renamed from tests/ui/generator/issue-113279.stderr)0
-rw-r--r--tests/ui/coroutine/issue-44197.rs (renamed from tests/ui/generator/issue-44197.rs)12
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr)2
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.rs)2
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr)2
-rw-r--r--tests/ui/coroutine/issue-48048.rs (renamed from tests/ui/generator/issue-48048.rs)4
-rw-r--r--tests/ui/coroutine/issue-48048.stderr (renamed from tests/ui/generator/issue-48048.stderr)2
-rw-r--r--tests/ui/coroutine/issue-52304.rs11
-rw-r--r--tests/ui/coroutine/issue-52398.rs (renamed from tests/ui/generator/issue-52398.rs)6
-rw-r--r--tests/ui/coroutine/issue-52398.stderr (renamed from tests/ui/generator/issue-52398.stderr)8
-rw-r--r--tests/ui/coroutine/issue-53548-1.rs (renamed from tests/ui/generator/issue-53548-1.rs)2
-rw-r--r--tests/ui/coroutine/issue-53548.rs (renamed from tests/ui/generator/issue-53548.rs)4
-rw-r--r--tests/ui/coroutine/issue-57017.rs (renamed from tests/ui/generator/issue-57017.rs)2
-rw-r--r--tests/ui/coroutine/issue-57084.rs (renamed from tests/ui/generator/issue-57084.rs)8
-rw-r--r--tests/ui/coroutine/issue-57084.stderr (renamed from tests/ui/generator/issue-57084.stderr)4
-rw-r--r--tests/ui/coroutine/issue-57478.rs (renamed from tests/ui/generator/issue-57478.rs)2
-rw-r--r--tests/ui/coroutine/issue-58888.rs (renamed from tests/ui/generator/issue-58888.rs)6
-rw-r--r--tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs (renamed from tests/ui/generator/issue-61442-stmt-expr-with-drop.rs)4
-rw-r--r--tests/ui/coroutine/issue-62506-two_awaits.rs (renamed from tests/ui/generator/issue-62506-two_awaits.rs)2
-rw-r--r--tests/ui/coroutine/issue-64620-yield-array-element.rs9
-rw-r--r--tests/ui/coroutine/issue-64620-yield-array-element.stderr (renamed from tests/ui/generator/issue-64620-yield-array-element.stderr)2
-rw-r--r--tests/ui/coroutine/issue-68112.rs (renamed from tests/ui/generator/issue-68112.rs)26
-rw-r--r--tests/ui/coroutine/issue-68112.stderr (renamed from tests/ui/generator/issue-68112.stderr)24
-rw-r--r--tests/ui/coroutine/issue-69017.rs (renamed from tests/ui/generator/issue-69017.rs)8
-rw-r--r--tests/ui/coroutine/issue-69039.rs (renamed from tests/ui/generator/issue-69039.rs)12
-rw-r--r--tests/ui/coroutine/issue-87142.rs32
-rw-r--r--tests/ui/coroutine/issue-88653.rs (renamed from tests/ui/generator/issue-88653.rs)12
-rw-r--r--tests/ui/coroutine/issue-88653.stderr (renamed from tests/ui/generator/issue-88653.stderr)8
-rw-r--r--tests/ui/coroutine/issue-91477.rs (renamed from tests/ui/generator/issue-91477.rs)2
-rw-r--r--tests/ui/coroutine/issue-91477.stderr (renamed from tests/ui/generator/issue-91477.stderr)2
-rw-r--r--tests/ui/coroutine/issue-93161.rs (renamed from tests/ui/generator/issue-93161.rs)0
-rw-r--r--tests/ui/coroutine/iterator-count.rs (renamed from tests/ui/generator/iterator-count.rs)14
-rw-r--r--tests/ui/coroutine/layout-error.rs (renamed from tests/ui/generator/layout-error.rs)2
-rw-r--r--tests/ui/coroutine/layout-error.stderr (renamed from tests/ui/generator/layout-error.stderr)0
-rw-r--r--tests/ui/coroutine/live-upvar-across-yield.rs (renamed from tests/ui/generator/live-upvar-across-yield.rs)4
-rw-r--r--tests/ui/coroutine/match-bindings.rs (renamed from tests/ui/generator/match-bindings.rs)4
-rw-r--r--tests/ui/coroutine/match-bindings.stderr (renamed from tests/ui/generator/match-bindings.stderr)4
-rw-r--r--tests/ui/coroutine/metadata-sufficient-for-layout.rs (renamed from tests/ui/generator/metadata-sufficient-for-layout.rs)10
-rw-r--r--tests/ui/coroutine/metadata-sufficient-for-layout.stderr (renamed from tests/ui/generator/metadata-sufficient-for-layout.stderr)0
-rw-r--r--tests/ui/coroutine/nested_coroutine.rs21
-rw-r--r--tests/ui/coroutine/niche-in-coroutine.rs (renamed from tests/ui/generator/niche-in-generator.rs)4
-rw-r--r--tests/ui/coroutine/non-static-is-unpin.rs (renamed from tests/ui/generator/non-static-is-unpin.rs)4
-rw-r--r--tests/ui/coroutine/not-send-sync.rs (renamed from tests/ui/generator/not-send-sync.rs)6
-rw-r--r--tests/ui/coroutine/not-send-sync.stderr (renamed from tests/ui/generator/not-send-sync.stderr)16
-rw-r--r--tests/ui/coroutine/overlap-locals.rs (renamed from tests/ui/generator/overlap-locals.rs)2
-rw-r--r--tests/ui/coroutine/panic-drops-resume.rs (renamed from tests/ui/generator/panic-drops-resume.rs)6
-rw-r--r--tests/ui/coroutine/panic-drops.rs (renamed from tests/ui/generator/panic-drops.rs)4
-rw-r--r--tests/ui/coroutine/panic-safe.rs (renamed from tests/ui/generator/panic-safe.rs)4
-rw-r--r--tests/ui/coroutine/parent-expression.rs (renamed from tests/ui/generator/parent-expression.rs)2
-rw-r--r--tests/ui/coroutine/parent-expression.stderr (renamed from tests/ui/generator/parent-expression.stderr)24
-rw-r--r--tests/ui/coroutine/partial-drop.rs (renamed from tests/ui/generator/partial-drop.rs)2
-rw-r--r--tests/ui/coroutine/partial-initialization-across-yield.rs (renamed from tests/ui/generator/partial-initialization-across-yield.rs)4
-rw-r--r--tests/ui/coroutine/partial-initialization-across-yield.stderr (renamed from tests/ui/generator/partial-initialization-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/pattern-borrow.rs (renamed from tests/ui/generator/pattern-borrow.rs)4
-rw-r--r--tests/ui/coroutine/pattern-borrow.stderr (renamed from tests/ui/generator/pattern-borrow.stderr)2
-rw-r--r--tests/ui/coroutine/pin-box-coroutine.rs13
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-1.rs (renamed from tests/ui/generator/print/generator-print-verbose-1.rs)24
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-1.stderr (renamed from tests/ui/generator/print/generator-print-verbose-1.stderr)42
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-2.rs (renamed from tests/ui/generator/print/generator-print-verbose-2.rs)8
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-2.stderr (renamed from tests/ui/generator/print/generator-print-verbose-2.stderr)24
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-3.rs (renamed from tests/ui/generator/print/generator-print-verbose-3.rs)4
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-3.stderr (renamed from tests/ui/generator/print/generator-print-verbose-3.stderr)8
-rw-r--r--tests/ui/coroutine/reborrow-mut-upvar.rs (renamed from tests/ui/generator/reborrow-mut-upvar.rs)4
-rw-r--r--tests/ui/coroutine/reborrow-mut-upvar.stderr (renamed from tests/ui/generator/reborrow-mut-upvar.stderr)4
-rw-r--r--tests/ui/coroutine/ref-escapes-but-not-over-yield.rs (renamed from tests/ui/generator/ref-escapes-but-not-over-yield.rs)6
-rw-r--r--tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr (renamed from tests/ui/generator/ref-escapes-but-not-over-yield.stderr)8
-rw-r--r--tests/ui/coroutine/ref-upvar-not-send.rs (renamed from tests/ui/generator/ref-upvar-not-send.rs)12
-rw-r--r--tests/ui/coroutine/ref-upvar-not-send.stderr (renamed from tests/ui/generator/ref-upvar-not-send.stderr)10
-rw-r--r--tests/ui/coroutine/reinit-in-match-guard.rs (renamed from tests/ui/generator/reinit-in-match-guard.rs)2
-rw-r--r--tests/ui/coroutine/resume-after-return.rs (renamed from tests/ui/generator/resume-after-return.rs)8
-rw-r--r--tests/ui/coroutine/resume-arg-late-bound.rs (renamed from tests/ui/generator/resume-arg-late-bound.rs)8
-rw-r--r--tests/ui/coroutine/resume-arg-late-bound.stderr (renamed from tests/ui/generator/resume-arg-late-bound.stderr)6
-rw-r--r--tests/ui/coroutine/resume-arg-size.rs (renamed from tests/ui/generator/resume-arg-size.rs)8
-rw-r--r--tests/ui/coroutine/resume-live-across-yield.rs (renamed from tests/ui/generator/resume-live-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/retain-resume-ref.rs (renamed from tests/ui/generator/retain-resume-ref.rs)6
-rw-r--r--tests/ui/coroutine/retain-resume-ref.stderr (renamed from tests/ui/generator/retain-resume-ref.stderr)0
-rw-r--r--tests/ui/coroutine/self_referential_gen_block.rs17
-rw-r--r--tests/ui/coroutine/self_referential_gen_block.stderr11
-rw-r--r--tests/ui/coroutine/size-moved-locals.rs (renamed from tests/ui/generator/size-moved-locals.rs)14
-rw-r--r--tests/ui/coroutine/sized-yield.rs14
-rw-r--r--tests/ui/coroutine/sized-yield.stderr26
-rw-r--r--tests/ui/coroutine/smoke-resume-args.rs (renamed from tests/ui/generator/smoke-resume-args.rs)10
-rw-r--r--tests/ui/coroutine/smoke.rs (renamed from tests/ui/generator/smoke.rs)32
-rw-r--r--tests/ui/coroutine/static-coroutine.rs20
-rw-r--r--tests/ui/coroutine/static-mut-reference-across-yield.rs (renamed from tests/ui/generator/static-mut-reference-across-yield.rs)2
-rw-r--r--tests/ui/coroutine/static-not-unpin.current.stderr (renamed from tests/ui/generator/static-not-unpin.current.stderr)6
-rw-r--r--tests/ui/coroutine/static-not-unpin.next.stderr (renamed from tests/ui/generator/static-not-unpin.next.stderr)6
-rw-r--r--tests/ui/coroutine/static-not-unpin.rs (renamed from tests/ui/generator/static-not-unpin.rs)6
-rw-r--r--tests/ui/coroutine/static-reference-across-yield.rs (renamed from tests/ui/generator/static-reference-across-yield.rs)2
-rw-r--r--tests/ui/coroutine/too-live-local-in-immovable-gen.rs (renamed from tests/ui/generator/too-live-local-in-immovable-gen.rs)8
-rw-r--r--tests/ui/coroutine/too-live-local-in-immovable-gen.stderr (renamed from tests/ui/generator/too-live-local-in-immovable-gen.stderr)6
-rw-r--r--tests/ui/coroutine/too-many-parameters.rs8
-rw-r--r--tests/ui/coroutine/too-many-parameters.stderr (renamed from tests/ui/generator/too-many-parameters.stderr)2
-rw-r--r--tests/ui/coroutine/type-mismatch-error.rs (renamed from tests/ui/generator/type-mismatch-error.rs)6
-rw-r--r--tests/ui/coroutine/type-mismatch-error.stderr (renamed from tests/ui/generator/type-mismatch-error.stderr)0
-rw-r--r--tests/ui/coroutine/type-mismatch-signature-deduction.rs (renamed from tests/ui/generator/type-mismatch-signature-deduction.rs)6
-rw-r--r--tests/ui/coroutine/type-mismatch-signature-deduction.stderr (renamed from tests/ui/generator/type-mismatch-signature-deduction.stderr)4
-rw-r--r--tests/ui/coroutine/unresolved-ct-var.rs (renamed from tests/ui/generator/unresolved-ct-var.rs)0
-rw-r--r--tests/ui/coroutine/unresolved-ct-var.stderr (renamed from tests/ui/generator/unresolved-ct-var.stderr)0
-rw-r--r--tests/ui/coroutine/unsized-capture-across-yield.rs (renamed from tests/ui/generator/unsized-capture-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/unsized-capture-across-yield.stderr (renamed from tests/ui/generator/unsized-capture-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/unsized-local-across-yield.rs (renamed from tests/ui/generator/unsized-local-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/unsized-local-across-yield.stderr (renamed from tests/ui/generator/unsized-local-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/unwind-abort-mix.rs13
-rw-r--r--tests/ui/coroutine/witness-ignore-fake-reads.rs (renamed from tests/ui/generator/witness-ignore-fake-reads.rs)0
-rw-r--r--tests/ui/coroutine/xcrate-reachable.rs (renamed from tests/ui/generator/xcrate-reachable.rs)4
-rw-r--r--tests/ui/coroutine/xcrate.rs (renamed from tests/ui/generator/xcrate.rs)10
-rw-r--r--tests/ui/coroutine/yield-in-args-rev.rs (renamed from tests/ui/generator/yield-in-args-rev.rs)4
-rw-r--r--tests/ui/coroutine/yield-in-args-rev.stderr (renamed from tests/ui/generator/yield-in-args-rev.stderr)4
-rw-r--r--tests/ui/coroutine/yield-in-args.rs (renamed from tests/ui/generator/yield-in-args.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-args.stderr (renamed from tests/ui/generator/yield-in-args.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-const.rs (renamed from tests/ui/generator/yield-in-const.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-const.stderr (renamed from tests/ui/generator/yield-in-const.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-function.rs (renamed from tests/ui/generator/yield-in-function.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-function.stderr (renamed from tests/ui/generator/yield-in-function.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-initializer.rs (renamed from tests/ui/generator/yield-in-initializer.rs)4
-rw-r--r--tests/ui/coroutine/yield-in-initializer.stderr (renamed from tests/ui/generator/yield-in-initializer.stderr)4
-rw-r--r--tests/ui/coroutine/yield-in-static.rs (renamed from tests/ui/generator/yield-in-static.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-static.stderr (renamed from tests/ui/generator/yield-in-static.stderr)2
-rw-r--r--tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs (renamed from tests/ui/generator/yield-outside-generator-issue-78653.rs)4
-rw-r--r--tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr (renamed from tests/ui/generator/yield-outside-generator-issue-78653.stderr)6
-rw-r--r--tests/ui/coroutine/yield-subtype.rs (renamed from tests/ui/generator/yield-subtype.rs)4
-rw-r--r--tests/ui/coroutine/yield-subtype.stderr (renamed from tests/ui/generator/yield-subtype.stderr)4
-rw-r--r--tests/ui/coroutine/yield-while-iterating.rs (renamed from tests/ui/generator/yield-while-iterating.rs)6
-rw-r--r--tests/ui/coroutine/yield-while-iterating.stderr (renamed from tests/ui/generator/yield-while-iterating.stderr)4
-rw-r--r--tests/ui/coroutine/yield-while-local-borrowed.rs (renamed from tests/ui/generator/yield-while-local-borrowed.rs)16
-rw-r--r--tests/ui/coroutine/yield-while-local-borrowed.stderr (renamed from tests/ui/generator/yield-while-local-borrowed.stderr)12
-rw-r--r--tests/ui/coroutine/yield-while-ref-reborrowed.rs (renamed from tests/ui/generator/yield-while-ref-reborrowed.rs)8
-rw-r--r--tests/ui/coroutine/yield-while-ref-reborrowed.stderr (renamed from tests/ui/generator/yield-while-ref-reborrowed.stderr)4
-rw-r--r--tests/ui/coroutine/yielding-in-match-guards.rs (renamed from tests/ui/generator/yielding-in-match-guards.rs)2
-rw-r--r--tests/ui/crate-loading/invalid-rlib.rs1
-rw-r--r--tests/ui/crate-loading/invalid-rlib.stderr1
-rw-r--r--tests/ui/debuginfo/sroa-fragment-debuginfo.rs2
-rw-r--r--tests/ui/deduplicate-diagnostics.duplicate.stderr4
-rw-r--r--tests/ui/deprecation/deprecation-sanity.stderr10
-rw-r--r--tests/ui/deprecation/staged-deprecation-in-future.rs6
-rw-r--r--tests/ui/derives/deriving-bounds.stderr2
-rw-r--r--tests/ui/derives/deriving-meta-unknown-trait.stderr2
-rw-r--r--tests/ui/derives/deriving-primitive.stderr2
-rw-r--r--tests/ui/derives/deriving-with-repr-packed-move-errors.rs96
-rw-r--r--tests/ui/derives/deriving-with-repr-packed-move-errors.stderr174
-rw-r--r--tests/ui/derives/deriving-with-repr-packed.stderr1
-rw-r--r--tests/ui/derives/issue-36617.stderr40
-rw-r--r--tests/ui/deriving/deriving-all-codegen.stdout15
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs8
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr83
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs20
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr43
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs18
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr47
-rw-r--r--tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs6
-rw-r--r--tests/ui/did_you_mean/bad-assoc-ty.stderr2
-rw-r--r--tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs38
-rw-r--r--tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr27
-rw-r--r--tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs47
-rw-r--r--tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr50
-rw-r--r--tests/ui/did_you_mean/issue-105225-named-args.rs10
-rw-r--r--tests/ui/did_you_mean/issue-105225-named-args.stderr22
-rw-r--r--tests/ui/did_you_mean/issue-105225.fixed21
-rw-r--r--tests/ui/did_you_mean/issue-105225.rs21
-rw-r--r--tests/ui/did_you_mean/issue-105225.stderr72
-rw-r--r--tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs24
-rw-r--r--tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr19
-rw-r--r--tests/ui/drop/dynamic-drop.rs14
-rw-r--r--tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr4
-rw-r--r--tests/ui/error-codes/E0004.stderr6
-rw-r--r--tests/ui/error-codes/E0030-teach.stderr2
-rw-r--r--tests/ui/error-codes/E0030.stderr2
-rw-r--r--tests/ui/error-codes/E0034.stderr4
-rw-r--r--tests/ui/error-codes/E0191.stderr2
-rw-r--r--tests/ui/error-codes/E0220.stderr2
-rw-r--r--tests/ui/error-codes/E0221.stderr6
-rw-r--r--tests/ui/error-codes/E0223.stderr2
-rw-r--r--tests/ui/error-codes/E0282.rs2
-rw-r--r--tests/ui/error-codes/E0282.stderr6
-rw-r--r--tests/ui/error-codes/E0283.rs8
-rw-r--r--tests/ui/error-codes/E0283.stderr6
-rw-r--r--tests/ui/error-codes/E0311.fixed2
-rw-r--r--tests/ui/error-codes/E0311.stderr20
-rw-r--r--tests/ui/error-codes/E0374.stderr5
-rw-r--r--tests/ui/error-codes/E0377.stderr2
-rw-r--r--tests/ui/error-codes/E0396-fixed.stderr2
-rw-r--r--tests/ui/error-codes/E0396.rs2
-rw-r--r--tests/ui/error-codes/E0396.stderr24
-rw-r--r--tests/ui/error-codes/E0401.stderr14
-rw-r--r--tests/ui/error-codes/E0452.stderr6
-rw-r--r--tests/ui/error-codes/E0453.stderr2
-rw-r--r--tests/ui/error-codes/E0463.rs7
-rw-r--r--tests/ui/error-codes/E0463.stderr9
-rw-r--r--tests/ui/error-codes/E0476.stderr4
-rw-r--r--tests/ui/error-codes/E0583.stderr1
-rw-r--r--tests/ui/error-codes/E0602.stderr2
-rw-r--r--tests/ui/error-codes/E0719.stderr8
-rw-r--r--tests/ui/error-codes/E0789.stderr2
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.normal.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.rs12
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix.normal.stderr (renamed from tests/ui/errors/remap-path-prefix.stderr)2
-rw-r--r--tests/ui/errors/remap-path-prefix.rs3
-rw-r--r--tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr9
-rw-r--r--tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr9
-rw-r--r--tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs10
-rw-r--r--tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr27
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed10
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs10
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr38
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs6
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr16
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed9
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs9
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr36
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs7
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr25
-rw-r--r--tests/ui/extern/extern-wrong-value-type.rs2
-rw-r--r--tests/ui/extern/extern-wrong-value-type.stderr4
-rw-r--r--tests/ui/feature-gates/doc-rust-logo.rs5
-rw-r--r--tests/ui/feature-gates/doc-rust-logo.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-associated_type_bounds.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr6
-rw-r--r--tests/ui/feature-gates/feature-gate-closure_track_caller.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-closure_track_caller.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr28
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.none.stderr66
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr28
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.rs15
-rw-r--r--tests/ui/feature-gates/feature-gate-generators.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-generators.stderr37
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-lint-reasons.stderr1
-rw-r--r--tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr109
-rw-r--r--tests/ui/feature-gates/feature-gate-offset-of-enum.rs15
-rw-r--r--tests/ui/feature-gates/feature-gate-offset-of-enum.stderr37
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr18
-rw-r--r--tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr30
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-staged_api.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-staged_api.stderr8
-rw-r--r--tests/ui/feature-gates/feature-gate-strict_provenance.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr2
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-bench.stderr6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr96
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-test.stderr6
-rw-r--r--tests/ui/fn/fn-trait-formatting.rs2
-rw-r--r--tests/ui/fn/fn-trait-formatting.stderr4
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr6
-rw-r--r--tests/ui/for/issue-20605.next.stderr12
-rw-r--r--tests/ui/generator/async-generator-issue-67158.rs6
-rw-r--r--tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs11
-rw-r--r--tests/ui/generator/auxiliary/xcrate-reachable.rs14
-rw-r--r--tests/ui/generator/auxiliary/xcrate.rs18
-rw-r--r--tests/ui/generator/generator-yielding-or-returning-itself.rs35
-rw-r--r--tests/ui/generator/issue-52304.rs11
-rw-r--r--tests/ui/generator/issue-64620-yield-array-element.rs9
-rw-r--r--tests/ui/generator/issue-87142.rs32
-rw-r--r--tests/ui/generator/nested_generators.rs21
-rw-r--r--tests/ui/generator/pin-box-generator.rs13
-rw-r--r--tests/ui/generator/sized-yield.rs14
-rw-r--r--tests/ui/generator/sized-yield.stderr26
-rw-r--r--tests/ui/generator/static-generators.rs20
-rw-r--r--tests/ui/generator/too-many-parameters.rs8
-rw-r--r--tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs18
-rw-r--r--tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr24
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.rs8
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.stderr8
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-91762.stderr5
-rw-r--r--tests/ui/generic-associated-types/gat-in-trait-path.base.stderr3
-rw-r--r--tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr1
-rw-r--r--tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs20
-rw-r--r--tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68643-broken-mir.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68643-broken-mir.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68644-codegen-selection.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68648-2.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-68656-unsized-values.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-76535.base.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-79422.base.stderr6
-rw-r--r--tests/ui/generic-associated-types/issue-84931.rs3
-rw-r--r--tests/ui/generic-associated-types/issue-84931.stderr35
-rw-r--r--tests/ui/generic-associated-types/issue-86787.rs4
-rw-r--r--tests/ui/generic-associated-types/issue-86787.stderr21
-rw-r--r--tests/ui/generic-associated-types/issue-88360.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-91139.stderr2
-rw-r--r--tests/ui/generic-associated-types/missing-bounds.stderr6
-rw-r--r--tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs1
-rw-r--r--tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr34
-rw-r--r--tests/ui/generic-const-items/inference-failure.stderr2
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr2
-rw-r--r--tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr1
-rw-r--r--tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/fn-ptr.rs2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr1
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr4
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr2
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs25
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs32
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs28
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr13
-rw-r--r--tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr2
-rw-r--r--tests/ui/impl-trait/async_scope_creep.rs13
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.next.stderr (renamed from tests/ui/impl-trait/auto-trait.stderr)2
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.old.stderr12
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.rs (renamed from tests/ui/impl-trait/auto-trait.rs)3
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.rs2
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr68
-rw-r--r--tests/ui/impl-trait/bivariant-lifetime-liveness.rs15
-rw-r--r--tests/ui/impl-trait/bounds_regression.rs10
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.rs4
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.stderr27
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.rs23
-rw-r--r--tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-constraint.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/early.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/encode.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr1
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.rs17
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102301.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs3
-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.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety-sized.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr20
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-variances.rs14
-rw-r--r--tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/refine.rs12
-rw-r--r--tests/ui/impl-trait/in-trait/refine.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.rs21
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.stderr10
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.fixed5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/variances-of-gat.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/where-clause.rs1
-rw-r--r--tests/ui/impl-trait/issue-55872-2.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.rs10
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-62742.stderr5
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.stderr2
-rw-r--r--tests/ui/impl-trait/lifetimes.rs4
-rw-r--r--tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr7
-rw-r--r--tests/ui/impl-trait/negative-reasoning.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr23
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr25
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.rs2
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.stderr2
-rw-r--r--tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr6
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr6
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.rs (renamed from tests/ui/impl-trait/recursive-generator.rs)10
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.stderr (renamed from tests/ui/impl-trait/recursive-generator.stderr)6
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs14
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr16
-rw-r--r--tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs2
-rw-r--r--tests/ui/impl-trait/type_parameters_captured.stderr7
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.fixed2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.rs2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.stderr5
-rw-r--r--tests/ui/impl-trait/universal-mismatched-type.stderr2
-rw-r--r--tests/ui/impl-trait/where-allowed-2.stderr6
-rw-r--r--tests/ui/impl-trait/where-allowed.rs79
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr146
-rw-r--r--tests/ui/impl-unused-tps.rs5
-rw-r--r--tests/ui/impl-unused-tps.stderr37
-rw-r--r--tests/ui/implied-bounds/issue-100690.rs4
-rw-r--r--tests/ui/implied-bounds/issue-100690.stderr4
-rw-r--r--tests/ui/imports/ambiguous-9.stderr1
-rw-r--r--tests/ui/imports/issue-28134.stderr5
-rw-r--r--tests/ui/imports/issue-55457.stderr2
-rw-r--r--tests/ui/imports/issue-56125.stderr12
-rw-r--r--tests/ui/imports/pub-reexport-empty.rs25
-rw-r--r--tests/ui/imports/pub-reexport-empty.stderr20
-rw-r--r--tests/ui/imports/reexports.rs5
-rw-r--r--tests/ui/imports/reexports.stderr34
-rw-r--r--tests/ui/indexing/index-help.stderr3
-rw-r--r--tests/ui/indexing/indexing-requires-a-uint.stderr3
-rw-r--r--tests/ui/inference/cannot-infer-closure-circular.stderr3
-rw-r--r--tests/ui/inference/issue-104649.stderr2
-rw-r--r--tests/ui/inference/issue-107090.rs6
-rw-r--r--tests/ui/inference/issue-107090.stderr17
-rw-r--r--tests/ui/inference/issue-71584.rs1
-rw-r--r--tests/ui/inference/issue-71584.stderr2
-rw-r--r--tests/ui/inference/issue-72690.stderr16
-rw-r--r--tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs61
-rw-r--r--tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr98
-rw-r--r--tests/ui/inference/multiple-impl-apply.rs48
-rw-r--r--tests/ui/inference/multiple-impl-apply.stderr23
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.rs2
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.stderr11
-rw-r--r--tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr14
-rw-r--r--tests/ui/inference/question-mark-type-infer.stderr7
-rw-r--r--tests/ui/infinite/infinite-struct.stderr6
-rw-r--r--tests/ui/inline-const/expr-unsafe.thir.stderr3
-rw-r--r--tests/ui/inline-const/pat-unsafe-err.rs14
-rw-r--r--tests/ui/inline-const/pat-unsafe-err.thir.stderr19
-rw-r--r--tests/ui/inline-const/pat-unsafe.rs15
-rw-r--r--tests/ui/inline-const/pat-unsafe.thir.stderr20
-rw-r--r--tests/ui/instrument-coverage/bad-value.bad.stderr2
-rw-r--r--tests/ui/instrument-coverage/bad-value.blank.stderr2
-rw-r--r--tests/ui/instrument-coverage/bad-value.rs5
-rw-r--r--tests/ui/instrument-coverage/off-values.rs9
-rw-r--r--tests/ui/instrument-coverage/on-values.rs11
-rw-r--r--tests/ui/instrument-coverage/unstable.branch.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.except-unused-functions.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.except-unused-generics.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.rs6
-rw-r--r--tests/ui/integral-indexing.stderr24
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.rs4
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.stderr8
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/invalid-llvm-passes.rs (renamed from tests/ui/invalid/invalid-llvm-passes.rs)0
-rw-r--r--tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr (renamed from tests/ui/invalid/invalid-llvm-passes.stderr)0
-rw-r--r--tests/ui/invalid-module-declaration/invalid-module-declaration.stderr1
-rw-r--r--tests/ui/invalid/invalid-plugin-attr.rs7
-rw-r--r--tests/ui/invalid/invalid-plugin-attr.stderr22
-rw-r--r--tests/ui/invalid_dispatch_from_dyn_impls.stderr24
-rw-r--r--tests/ui/issues/issue-12187-1.stderr4
-rw-r--r--tests/ui/issues/issue-12187-2.stderr4
-rw-r--r--tests/ui/issues/issue-12567.stderr12
-rw-r--r--tests/ui/issues/issue-16966.stderr13
-rw-r--r--tests/ui/issues/issue-17551.stderr2
-rw-r--r--tests/ui/issues/issue-19380.rs1
-rw-r--r--tests/ui/issues/issue-19380.stderr27
-rw-r--r--tests/ui/issues/issue-19482.rs2
-rw-r--r--tests/ui/issues/issue-19482.stderr2
-rw-r--r--tests/ui/issues/issue-20225.stderr6
-rw-r--r--tests/ui/issues/issue-21950.stderr2
-rw-r--r--tests/ui/issues/issue-22034.rs2
-rw-r--r--tests/ui/issues/issue-22034.stderr4
-rw-r--r--tests/ui/issues/issue-22434.rs2
-rw-r--r--tests/ui/issues/issue-22434.stderr2
-rw-r--r--tests/ui/issues/issue-23024.rs2
-rw-r--r--tests/ui/issues/issue-23024.stderr2
-rw-r--r--tests/ui/issues/issue-23966.stderr4
-rw-r--r--tests/ui/issues/issue-24036.stderr9
-rw-r--r--tests/ui/issues/issue-24446.rs2
-rw-r--r--tests/ui/issues/issue-24446.stderr49
-rw-r--r--tests/ui/issues/issue-28344.stderr4
-rw-r--r--tests/ui/issues/issue-33571.stderr1
-rw-r--r--tests/ui/issues/issue-34334.stderr3
-rw-r--r--tests/ui/issues/issue-37534.rs6
-rw-r--r--tests/ui/issues/issue-37534.stderr12
-rw-r--r--tests/ui/issues/issue-40000.stderr1
-rw-r--r--tests/ui/issues/issue-43355.stderr2
-rw-r--r--tests/ui/issues/issue-45801.stderr1
-rw-r--r--tests/ui/issues/issue-46101.stderr2
-rw-r--r--tests/ui/issues/issue-47715.rs8
-rw-r--r--tests/ui/issues/issue-47715.stderr8
-rw-r--r--tests/ui/issues/issue-51154.stderr2
-rw-r--r--tests/ui/issues/issue-53251.stderr1
-rw-r--r--tests/ui/issues/issue-59494.rs2
-rw-r--r--tests/ui/issues/issue-59494.stderr4
-rw-r--r--tests/ui/issues/issue-66667-function-cmp-cycle.stderr6
-rw-r--r--tests/ui/issues/issue-66923-show-error-for-correct-call.stderr6
-rw-r--r--tests/ui/issues/issue-69306.stderr12
-rw-r--r--tests/ui/issues/issue-77919.rs2
-rw-r--r--tests/ui/issues/issue-77919.stderr2
-rw-r--r--tests/ui/issues/issue-87199.rs6
-rw-r--r--tests/ui/issues/issue-87199.stderr18
-rw-r--r--tests/ui/iterators/collect-into-slice.stderr20
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.fixed42
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.rs42
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.stderr157
-rw-r--r--tests/ui/iterators/invalid-iterator-chain.stderr32
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ret.stderr2
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_ret.stderr4
-rw-r--r--tests/ui/layout/cannot-transmute-unnormalizable-type.rs3
-rw-r--r--tests/ui/layout/cannot-transmute-unnormalizable-type.stderr14
-rw-r--r--tests/ui/layout/issue-84108.rs2
-rw-r--r--tests/ui/layout/issue-84108.stderr24
-rw-r--r--tests/ui/layout/too-big-with-padding.rs18
-rw-r--r--tests/ui/layout/too-big-with-padding.stderr8
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs22
-rw-r--r--tests/ui/lifetimes/borrowck-let-suggestion.stderr4
-rw-r--r--tests/ui/lifetimes/issue-105675.stderr1
-rw-r--r--tests/ui/lifetimes/issue-26638.stderr4
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.rs19
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr51
-rw-r--r--tests/ui/lifetimes/issue-77175.rs2
-rw-r--r--tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr49
-rw-r--r--tests/ui/lifetimes/lifetime-errors/issue_74400.stderr7
-rw-r--r--tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed2
-rw-r--r--tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr20
-rw-r--r--tests/ui/limits/issue-55878.stderr1
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.many.stderr2
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.one.stderr2
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.rs10
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.bpf.stderr2
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.ptx.stderr2
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.rs8
-rw-r--r--tests/ui/lint/bare-trait-objects-path.stderr2
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.stderr2
-rw-r--r--tests/ui/lint/command-line-register-unknown-lint-tool.stderr1
-rw-r--r--tests/ui/lint/crate_level_only_lint.stderr12
-rw-r--r--tests/ui/lint/forbid-group-group-2.stderr8
-rw-r--r--tests/ui/lint/forbid-group-member.stderr2
-rw-r--r--tests/ui/lint/forbid-member-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/cap-lints-allow.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/warnings-lint-group.stderr2
-rw-r--r--tests/ui/lint/issue-80988.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-attr.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-cmdline.stderr1
-rw-r--r--tests/ui/lint/lint-malformed.stderr6
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-removed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-stability-deprecated.stderr6
-rw-r--r--tests/ui/lint/lint-type-overflow.stderr42
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.stderr4
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.fixed8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.rs8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.stderr74
-rw-r--r--tests/ui/lint/missing-copy-implementations-non-exhaustive.rs25
-rw-r--r--tests/ui/lint/must_not_suspend/gated.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/tuple-mismatch.rs4
-rw-r--r--tests/ui/lint/reasons-erroneous.rs28
-rw-r--r--tests/ui/lint/reasons-erroneous.stderr94
-rw-r--r--tests/ui/lint/reference_casting.rs8
-rw-r--r--tests/ui/lint/reference_casting.stderr60
-rw-r--r--tests/ui/lint/register-tool-lint.stderr1
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs30
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs8
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr30
-rw-r--r--tests/ui/lint/unaligned_references.rs23
-rw-r--r--tests/ui/lint/unaligned_references.stderr52
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.rs17
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.stderr29
-rw-r--r--tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs6
-rw-r--r--tests/ui/lint/unused/lint-unused-imports.rs2
-rw-r--r--tests/ui/lint/unused/unused-closure.rs4
-rw-r--r--tests/ui/liveness/liveness-upvars.rs8
-rw-r--r--tests/ui/loops/loop-break-value.stderr2
-rw-r--r--tests/ui/lub-glb/old-lub-glb-object.stderr1
-rw-r--r--tests/ui/macros/assert-long-condition.rs9
-rw-r--r--tests/ui/macros/assert-long-condition.run.stderr4
-rw-r--r--tests/ui/macros/builtin-std-paths-fail.stderr8
-rw-r--r--tests/ui/macros/meta-item-absolute-path.stderr2
-rw-r--r--tests/ui/macros/stringify.rs1066
-rw-r--r--tests/ui/malformed/do-not-ice-on-note_and_explain.rs7
-rw-r--r--tests/ui/malformed/do-not-ice-on-note_and_explain.stderr79
-rw-r--r--tests/ui/malformed/malformed-plugin-1.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-1.stderr16
-rw-r--r--tests/ui/malformed/malformed-plugin-2.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-2.stderr16
-rw-r--r--tests/ui/malformed/malformed-plugin-3.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-3.stderr17
-rw-r--r--tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr7
-rw-r--r--tests/ui/match/match-range-fail-2.stderr6
-rw-r--r--tests/ui/match/match_non_exhaustive.stderr4
-rw-r--r--tests/ui/match/validate-range-endpoints.rs59
-rw-r--r--tests/ui/match/validate-range-endpoints.stderr84
-rw-r--r--tests/ui/methods/disambiguate-multiple-blanket-impl.rs38
-rw-r--r--tests/ui/methods/disambiguate-multiple-blanket-impl.stderr63
-rw-r--r--tests/ui/methods/disambiguate-multiple-impl.rs37
-rw-r--r--tests/ui/methods/disambiguate-multiple-impl.stderr63
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait-2.rs54
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait-2.stderr132
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait.rs32
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait.stderr63
-rw-r--r--tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr2
-rw-r--r--tests/ui/methods/method-ambig-two-traits-from-bounds.stderr8
-rw-r--r--tests/ui/methods/method-ambig-two-traits-from-impls2.stderr4
-rw-r--r--tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr4
-rw-r--r--tests/ui/mir/alignment/addrof_alignment.rs (renamed from tests/ui/mir/addrof_alignment.rs)3
-rw-r--r--tests/ui/mir/alignment/i686-pc-windows-msvc.rs (renamed from tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs)4
-rw-r--r--tests/ui/mir/alignment/misaligned_lhs.rs (renamed from tests/ui/mir/mir_alignment_check.rs)4
-rw-r--r--tests/ui/mir/alignment/misaligned_rhs.rs13
-rw-r--r--tests/ui/mir/alignment/packed.rs29
-rw-r--r--tests/ui/mir/alignment/place_computation.rs16
-rw-r--r--tests/ui/mir/alignment/place_without_read.rs9
-rw-r--r--tests/ui/mir/alignment/two_pointers.rs15
-rw-r--r--tests/ui/mir/build-async-error-body-correctly.rs8
-rw-r--r--tests/ui/mir/build-async-error-body-correctly.stderr17
-rw-r--r--tests/ui/mir/issue-71793-inline-args-storage.rs2
-rw-r--r--tests/ui/mir/mir_match_test.rs1
-rw-r--r--tests/ui/mir/remove-zsts-query-cycle.rs2
-rw-r--r--tests/ui/mismatched_types/async-unwrap-suggestion.rs22
-rw-r--r--tests/ui/mismatched_types/async-unwrap-suggestion.stderr25
-rw-r--r--tests/ui/mismatched_types/issue-19109.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-35030.stderr2
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs23
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr55
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed31
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs31
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr93
-rw-r--r--tests/ui/mismatched_types/recovered-block.rs6
-rw-r--r--tests/ui/mismatched_types/recovered-block.stderr8
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs4
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr6
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr1
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr1
-rw-r--r--tests/ui/modules/special_module_name.stderr2
-rw-r--r--tests/ui/native-library-link-flags/modifiers-override.stderr2
-rw-r--r--tests/ui/never_type/never-from-impl-is-reserved.stderr2
-rw-r--r--tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr1
-rw-r--r--tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr1
-rw-r--r--tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr5
-rw-r--r--tests/ui/nll/coroutine-distinct-lifetime.rs (renamed from tests/ui/nll/generator-distinct-lifetime.rs)4
-rw-r--r--tests/ui/nll/coroutine-upvar-mutability.rs (renamed from tests/ui/nll/generator-upvar-mutability.rs)4
-rw-r--r--tests/ui/nll/coroutine-upvar-mutability.stderr (renamed from tests/ui/nll/generator-upvar-mutability.stderr)2
-rw-r--r--tests/ui/nll/extra-unused-mut.rs4
-rw-r--r--tests/ui/nll/issue-48623-coroutine.rs (renamed from tests/ui/nll/issue-48623-generator.rs)6
-rw-r--r--tests/ui/nll/issue-48623-coroutine.stderr (renamed from tests/ui/nll/issue-48623-generator.stderr)6
-rw-r--r--tests/ui/nll/issue-55850.rs10
-rw-r--r--tests/ui/nll/issue-55850.stderr2
-rw-r--r--tests/ui/nll/issue-97997.stderr1
-rw-r--r--tests/ui/nll/issue-98589-closures-relate-named-regions.stderr8
-rw-r--r--tests/ui/nll/issue-98693.stderr7
-rw-r--r--tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr10
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.stderr3
-rw-r--r--tests/ui/nll/move-errors.stderr2
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr36
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr36
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs33
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr40
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr40
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs20
-rw-r--r--tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr2
-rw-r--r--tests/ui/nll/ty-outlives/impl-trait-outlives.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-implied-bounds.stderr7
-rw-r--r--tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr22
-rw-r--r--tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr22
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-closure.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr12
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr6
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr6
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-none.stderr5
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-fn-body.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-fn.stderr10
-rw-r--r--tests/ui/nll/type-check-pointer-comparisons.stderr4
-rw-r--r--tests/ui/nll/user-annotations/normalization-2.stderr2
-rw-r--r--tests/ui/nll/user-annotations/normalization-infer.stderr49
-rw-r--r--tests/ui/noexporttypeexe.stderr4
-rw-r--r--tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds2.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds2.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed10
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs10
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr20
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_others.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_others.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr2
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.stderr4
-rw-r--r--tests/ui/object-safety/issue-19538.stderr2
-rw-r--r--tests/ui/object-safety/object-safety-issue-22040.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-no-static.curr.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr8
-rw-r--r--tests/ui/offset-of/offset-of-enum.rs9
-rw-r--r--tests/ui/offset-of/offset-of-enum.stderr40
-rw-r--r--tests/ui/offset-of/offset-of-output-type.stderr2
-rw-r--r--tests/ui/offset-of/offset-of-private.rs13
-rw-r--r--tests/ui/offset-of/offset-of-private.stderr22
-rw-r--r--tests/ui/on-unimplemented/impl-substs.stderr3
-rw-r--r--tests/ui/on-unimplemented/on-impl.stderr3
-rw-r--r--tests/ui/on-unimplemented/slice-index.stderr3
-rw-r--r--tests/ui/or-patterns/exhaustiveness-pass.rs6
-rw-r--r--tests/ui/or-patterns/missing-bindings.stderr84
-rw-r--r--tests/ui/or-patterns/or-patterns-syntactic-fail.stderr8
-rw-r--r--tests/ui/packed/packed-struct-drop-aligned.rs8
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs (renamed from tests/ui/parser/assoc-const-underscore-syntactic-pass.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-1.rs (renamed from tests/ui/parser/assoc-oddities-1.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-1.stderr (renamed from tests/ui/parser/assoc-oddities-1.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-2.rs (renamed from tests/ui/parser/assoc-oddities-2.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-2.stderr (renamed from tests/ui/parser/assoc-oddities-2.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-semantic-fail.rs (renamed from tests/ui/parser/assoc-static-semantic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-semantic-fail.stderr (renamed from tests/ui/parser/assoc-static-semantic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-syntactic-fail.rs (renamed from tests/ui/parser/assoc-static-syntactic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr (renamed from tests/ui/parser/assoc-static-syntactic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-type-in-type-arg.rs (renamed from tests/ui/parser/assoc-type-in-type-arg.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-type-in-type-arg.stderr (renamed from tests/ui/parser/assoc-type-in-type-arg.stderr)0
-rw-r--r--tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.rs)0
-rw-r--r--tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-2.rs (renamed from tests/ui/parser/attr-bad-meta-2.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-2.stderr (renamed from tests/ui/parser/attr-bad-meta-2.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-3.rs (renamed from tests/ui/parser/attr-bad-meta-3.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-3.stderr (renamed from tests/ui/parser/attr-bad-meta-3.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta.rs (renamed from tests/ui/parser/attr-bad-meta.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta.stderr (renamed from tests/ui/parser/attr-bad-meta.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-before-eof.rs (renamed from tests/ui/parser/attr-before-eof.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-before-eof.stderr (renamed from tests/ui/parser/attr-before-eof.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-fn.rs (renamed from tests/ui/parser/attr-dangling-in-fn.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-fn.stderr (renamed from tests/ui/parser/attr-dangling-in-fn.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-mod.rs (renamed from tests/ui/parser/attr-dangling-in-mod.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-mod.stderr (renamed from tests/ui/parser/attr-dangling-in-mod.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs (renamed from tests/ui/parser/attr-stmt-expr-attr-bad.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr (renamed from tests/ui/parser/attr-stmt-expr-attr-bad.stderr)1
-rw-r--r--tests/ui/parser/attribute/attr-with-a-semicolon.rs (renamed from tests/ui/parser/attr-with-a-semicolon.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-with-a-semicolon.stderr (renamed from tests/ui/parser/attr-with-a-semicolon.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr.rs (renamed from tests/ui/parser/attr.rs)0
-rw-r--r--tests/ui/parser/attribute/attr.stderr (renamed from tests/ui/parser/attr.stderr)0
-rw-r--r--tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs (renamed from tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs)0
-rw-r--r--tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr (renamed from tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr)0
-rw-r--r--tests/ui/parser/attribute/attrs-after-extern-mod.rs (renamed from tests/ui/parser/attrs-after-extern-mod.rs)0
-rw-r--r--tests/ui/parser/attribute/attrs-after-extern-mod.stderr (renamed from tests/ui/parser/attrs-after-extern-mod.stderr)0
-rw-r--r--tests/ui/parser/break-in-unlabeled-block-in-macro.rs43
-rw-r--r--tests/ui/parser/break-in-unlabeled-block-in-macro.stderr69
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.fixed11
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.rs11
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.stderr27
-rw-r--r--tests/ui/parser/deep-unmatched-angle-brackets.rs17
-rw-r--r--tests/ui/parser/deep-unmatched-angle-brackets.stderr13
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs9
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr18
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims.rs14
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims.stderr18
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.fixed27
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.rs11
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.stderr45
-rw-r--r--tests/ui/parser/emoji-identifiers.stderr6
-rw-r--r--tests/ui/parser/fn-header-semantic-fail.rs10
-rw-r--r--tests/ui/parser/fn-header-semantic-fail.stderr77
-rw-r--r--tests/ui/parser/issue-116781.rs8
-rw-r--r--tests/ui/parser/issue-116781.stderr16
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.fixed (renamed from tests/ui/parser/issue-100197-mut-let.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.rs (renamed from tests/ui/parser/issue-100197-mut-let.rs)0
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.stderr (renamed from tests/ui/parser/issue-100197-mut-let.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.fixed (renamed from tests/ui/parser/issue-101477-enum.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.rs (renamed from tests/ui/parser/issue-101477-enum.rs)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.stderr (renamed from tests/ui/parser/issue-101477-enum.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.fixed (renamed from tests/ui/parser/issue-101477-let.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.rs (renamed from tests/ui/parser/issue-101477-let.rs)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.stderr (renamed from tests/ui/parser/issue-101477-let.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-102806.rs (renamed from tests/ui/parser/issue-102806.rs)0
-rw-r--r--tests/ui/parser/issues/issue-102806.stderr (renamed from tests/ui/parser/issue-102806.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103143.rs (renamed from tests/ui/parser/issue-103143.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103143.stderr (renamed from tests/ui/parser/issue-103143.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103381.fixed (renamed from tests/ui/parser/issue-103381.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-103381.rs (renamed from tests/ui/parser/issue-103381.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103381.stderr (renamed from tests/ui/parser/issue-103381.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103425.rs (renamed from tests/ui/parser/issue-103425.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103425.stderr (renamed from tests/ui/parser/issue-103425.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103451.rs (renamed from tests/ui/parser/issue-103451.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103451.stderr (renamed from tests/ui/parser/issue-103451.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs (renamed from tests/ui/parser/issue-103748-ICE-wrong-braces.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr (renamed from tests/ui/parser/issue-103748-ICE-wrong-braces.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104620.rs (renamed from tests/ui/parser/issue-104620.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104620.stderr (renamed from tests/ui/parser/issue-104620.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.rs (renamed from tests/ui/parser/issue-104867-inc-dec-2.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.stderr (renamed from tests/ui/parser/issue-104867-inc-dec-2.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.rs (renamed from tests/ui/parser/issue-104867-inc-dec.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.stderr (renamed from tests/ui/parser/issue-104867-inc-dec.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-105366.fixed (renamed from tests/ui/parser/issue-105366.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-105366.rs (renamed from tests/ui/parser/issue-105366.rs)0
-rw-r--r--tests/ui/parser/issues/issue-105366.stderr (renamed from tests/ui/parser/issue-105366.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-105634.rs (renamed from tests/ui/parser/issue-105634.rs)0
-rw-r--r--tests/ui/parser/issues/issue-107705.rs (renamed from tests/ui/parser/issue-107705.rs)0
-rw-r--r--tests/ui/parser/issues/issue-107705.stderr (renamed from tests/ui/parser/issue-107705.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.fixed9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.rs9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.stderr14
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr11
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.rs (renamed from tests/ui/parser/issue-108495-dec.rs)0
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.stderr (renamed from tests/ui/parser/issue-108495-dec.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-112188.fixed (renamed from tests/ui/parser/issue-112188.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-112188.rs (renamed from tests/ui/parser/issue-112188.rs)0
-rw-r--r--tests/ui/parser/issues/issue-112188.stderr (renamed from tests/ui/parser/issue-112188.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-113342.rs (renamed from tests/ui/parser/issue-113342.rs)0
-rw-r--r--tests/ui/parser/issues/issue-113342.stderr (renamed from tests/ui/parser/issue-113342.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-15980.rs3
-rw-r--r--tests/ui/parser/issues/issue-15980.stderr13
-rw-r--r--tests/ui/parser/issues/issue-17718-parse-const.rs (renamed from tests/ui/parser/issue-17718-parse-const.rs)0
-rw-r--r--tests/ui/parser/issues/issue-32505.rs1
-rw-r--r--tests/ui/parser/issues/issue-32505.stderr18
-rw-r--r--tests/ui/parser/issues/issue-39616.rs (renamed from tests/ui/parser/issue-39616.rs)0
-rw-r--r--tests/ui/parser/issues/issue-39616.stderr (renamed from tests/ui/parser/issue-39616.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-49257.rs (renamed from tests/ui/parser/issue-49257.rs)0
-rw-r--r--tests/ui/parser/issues/issue-49257.stderr (renamed from tests/ui/parser/issue-49257.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-52496.stderr9
-rw-r--r--tests/ui/parser/issues/issue-61858.rs (renamed from tests/ui/parser/issue-61858.rs)0
-rw-r--r--tests/ui/parser/issues/issue-61858.stderr (renamed from tests/ui/parser/issue-61858.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs (renamed from tests/ui/parser/issue-68091-unicode-ident-after-if.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr (renamed from tests/ui/parser/issue-68091-unicode-ident-after-if.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs (renamed from tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr (renamed from tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-1.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-1.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-2.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-2.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-3.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-3.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-81804.rs (renamed from tests/ui/parser/issue-81804.rs)0
-rw-r--r--tests/ui/parser/issues/issue-81804.stderr (renamed from tests/ui/parser/issue-81804.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-81827.rs (renamed from tests/ui/parser/issue-81827.rs)0
-rw-r--r--tests/ui/parser/issues/issue-81827.stderr (renamed from tests/ui/parser/issue-81827.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-84117.stderr3
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs22
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr28
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs2
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.rs (renamed from tests/ui/parser/issue-87694-duplicated-pub.rs)0
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.stderr (renamed from tests/ui/parser/issue-87694-duplicated-pub.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.rs (renamed from tests/ui/parser/issue-87694-misplaced-pub.rs)0
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.stderr (renamed from tests/ui/parser/issue-87694-misplaced-pub.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-89396.fixed4
-rw-r--r--tests/ui/parser/issues/issue-89396.rs4
-rw-r--r--tests/ui/parser/issues/issue-89396.stderr4
-rw-r--r--tests/ui/parser/issues/issue-90728.rs (renamed from tests/ui/parser/issue-90728.rs)0
-rw-r--r--tests/ui/parser/issues/issue-90728.stderr (renamed from tests/ui/parser/issue-90728.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-91421.rs (renamed from tests/ui/parser/issue-91421.rs)0
-rw-r--r--tests/ui/parser/issues/issue-91421.stderr (renamed from tests/ui/parser/issue-91421.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr)0
-rw-r--r--tests/ui/parser/macro/macro-repeat.stderr2
-rw-r--r--tests/ui/parser/missing-fat-arrow.rs38
-rw-r--r--tests/ui/parser/missing-fat-arrow.stderr78
-rw-r--r--tests/ui/parser/mod_file_not_exist.stderr1
-rw-r--r--tests/ui/parser/mod_file_not_exist_windows.stderr1
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.fixed2
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.rs2
-rw-r--r--tests/ui/parser/recover-quantified-closure.stderr4
-rw-r--r--tests/ui/parser/removed-syntax-fn-sigil.rs3
-rw-r--r--tests/ui/parser/removed-syntax-fn-sigil.stderr14
-rw-r--r--tests/ui/parser/removed-syntax-with-2.stderr5
-rw-r--r--tests/ui/parser/semi-in-let-chain.rs27
-rw-r--r--tests/ui/parser/semi-in-let-chain.stderr50
-rw-r--r--tests/ui/parser/ternary_operator.rs59
-rw-r--r--tests/ui/parser/ternary_operator.stderr91
-rw-r--r--tests/ui/parser/unsafe-mod.stderr1
-rw-r--r--tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs6
-rw-r--r--tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr13
-rw-r--r--tests/ui/parser/variadic-ffi-semantic-restrictions.rs17
-rw-r--r--tests/ui/parser/variadic-ffi-semantic-restrictions.stderr103
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr2
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed18
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs18
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr58
-rw-r--r--tests/ui/pattern/issue-115599.rs7
-rw-r--r--tests/ui/pattern/issue-115599.stderr11
-rw-r--r--tests/ui/pattern/issue-94866.stderr4
-rw-r--r--tests/ui/pattern/non-structural-match-types.mir.stderr14
-rw-r--r--tests/ui/pattern/non-structural-match-types.rs7
-rw-r--r--tests/ui/pattern/non-structural-match-types.stderr14
-rw-r--r--tests/ui/pattern/non-structural-match-types.thir.stderr14
-rw-r--r--tests/ui/pattern/patkind-litrange-no-expr.stderr2
-rw-r--r--tests/ui/pattern/slice-patterns-irrefutable.stderr3
-rw-r--r--tests/ui/pattern/usefulness/conflicting_bindings.rs24
-rw-r--r--tests/ui/pattern/usefulness/conflicting_bindings.stderr66
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.rs55
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.stderr184
-rw-r--r--tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr18
-rw-r--r--tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr94
-rw-r--r--tests/ui/pattern/usefulness/empty-match.normal.stderr94
-rw-r--r--tests/ui/pattern/usefulness/empty-match.rs18
-rw-r--r--tests/ui/pattern/usefulness/floats.rs40
-rw-r--r--tests/ui/pattern/usefulness/floats.stderr52
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs20
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr53
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr2
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr140
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs6
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs10
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr18
-rw-r--r--tests/ui/pattern/usefulness/issue-35609.stderr3
-rw-r--r--tests/ui/pattern/usefulness/issue-39362.stderr6
-rw-r--r--tests/ui/pattern/usefulness/issue-40221.stderr6
-rw-r--r--tests/ui/pattern/usefulness/issue-56379.stderr10
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs16
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr68
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs18
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr54
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr4
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-match.stderr8
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs53
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr75
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-errors.rs4
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-errors.stderr4
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs2
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr2
-rw-r--r--tests/ui/pattern/usefulness/slice_of_empty.rs22
-rw-r--r--tests/ui/pattern/usefulness/slice_of_empty.stderr39
-rw-r--r--tests/ui/pattern/usefulness/stable-gated-patterns.stderr6
-rw-r--r--tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr6
-rw-r--r--tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr10
-rw-r--r--tests/ui/pattern/usefulness/unstable-gated-patterns.stderr6
-rw-r--r--tests/ui/polymorphization/coroutine.rs (renamed from tests/ui/polymorphization/generators.rs)24
-rw-r--r--tests/ui/polymorphization/coroutine.stderr (renamed from tests/ui/polymorphization/generators.stderr)12
-rw-r--r--tests/ui/print_type_sizes/coroutine.rs (renamed from tests/ui/print_type_sizes/generator.rs)8
-rw-r--r--tests/ui/print_type_sizes/coroutine.stdout (renamed from tests/ui/print_type_sizes/generator.stdout)2
-rw-r--r--tests/ui/print_type_sizes/coroutine_discr_placement.rs (renamed from tests/ui/print_type_sizes/generator_discr_placement.rs)4
-rw-r--r--tests/ui/print_type_sizes/coroutine_discr_placement.stdout (renamed from tests/ui/print_type_sizes/generator_discr_placement.stdout)2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.stderr2
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr38
-rw-r--r--tests/ui/privacy/privacy1.stderr1
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr2
-rw-r--r--tests/ui/privacy/private-in-public.rs8
-rw-r--r--tests/ui/privacy/private-in-public.stderr22
-rw-r--r--tests/ui/privacy/private-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/private-variant-reexport.stderr8
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.rs40
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.stderr44
-rw-r--r--tests/ui/privacy/suggest-box-new.fixed15
-rw-r--r--tests/ui/privacy/suggest-box-new.rs15
-rw-r--r--tests/ui/privacy/suggest-box-new.stderr20
-rw-r--r--tests/ui/privacy/where-priv-type.stderr7
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr7
-rw-r--r--tests/ui/proc-macro/bad-projection.rs2
-rw-r--r--tests/ui/proc-macro/bad-projection.stderr30
-rw-r--r--tests/ui/proc-macro/issue-37788.stderr2
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.rs30
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.stderr5
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.stdout768
-rw-r--r--tests/ui/proc-macro/macro-namespace-reserved-2.stderr1
-rw-r--r--tests/ui/proc-macro/pretty-print-hack-show.local.stderr6
-rw-r--r--tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr6
-rw-r--r--tests/ui/proc-macro/resolve-error.stderr8
-rw-r--r--tests/ui/proc-macro/resolved-located-at.stderr2
-rw-r--r--tests/ui/proc-macro/span-preservation.stderr8
-rw-r--r--tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr4
-rw-r--r--tests/ui/reachable/reachable-unnameable-type-alias.rs4
-rw-r--r--tests/ui/recursion_limit/empty.stderr2
-rw-r--r--tests/ui/recursion_limit/invalid_digit.stderr2
-rw-r--r--tests/ui/recursion_limit/overflow.stderr2
-rw-r--r--tests/ui/regions/closure-in-projection-issue-97405.rs2
-rw-r--r--tests/ui/regions/closure-in-projection-issue-97405.stderr12
-rw-r--r--tests/ui/regions/regions-close-associated-type-into-object.stderr40
-rw-r--r--tests/ui/regions/regions-close-object-into-object-4.stderr29
-rw-r--r--tests/ui/regions/regions-close-object-into-object-5.stderr29
-rw-r--r--tests/ui/regions/regions-close-over-type-parameter-1.stderr11
-rw-r--r--tests/ui/regions/regions-close-param-into-object.stderr24
-rw-r--r--tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr5
-rw-r--r--tests/ui/regions/regions-infer-bound-from-trait-self.stderr11
-rw-r--r--tests/ui/regions/regions-infer-bound-from-trait.stderr8
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs6
-rw-r--r--tests/ui/repr/repr-align-assign.stderr4
-rw-r--r--tests/ui/repr/repr-align.stderr12
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.rs5
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.stderr14
-rw-r--r--tests/ui/resolve/issue-116164.rs19
-rw-r--r--tests/ui/resolve/issue-116164.stderr14
-rw-r--r--tests/ui/resolve/issue-55673.fixed21
-rw-r--r--tests/ui/resolve/issue-55673.rs9
-rw-r--r--tests/ui/resolve/issue-55673.stderr24
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs2
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr31
-rw-r--r--tests/ui/resolve/issue-82865.stderr7
-rw-r--r--tests/ui/resolve/resolve-inconsistent-names.stderr42
-rw-r--r--tests/ui/return/return-impl-trait-bad.stderr8
-rw-r--r--tests/ui/return/return-impl-trait.stderr4
-rw-r--r--tests/ui/return/return-struct.stderr4
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs30
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr93
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs9
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr15
-rw-r--r--tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr75
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr31
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs53
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs85
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr125
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs40
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr7
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr13
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs12
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr21
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr26
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs504
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr32
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr59
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs27
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr69
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs9
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr34
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr32
-rw-r--r--tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr1
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr7
-rw-r--r--tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr2
-rw-r--r--tests/ui/rust-2018/edition-lint-nested-paths.stderr2
-rw-r--r--tests/ui/rust-2018/edition-lint-paths.stderr2
-rw-r--r--tests/ui/rust-2018/uniform-paths/cross-crate.stderr1
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr2
-rw-r--r--tests/ui/sanitize/issue-111184-coroutine-witness.rs (renamed from tests/ui/sanitize/issue-111184-generator-witness.rs)2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr2
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.default.stderr13
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.feature.stderr (renamed from tests/ui/self/arbitrary-self-from-method-substs.stderr)2
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.rs8
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr2
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr1
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed3
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr10
-rw-r--r--tests/ui/self/self-impl.stderr4
-rw-r--r--tests/ui/self/self_type_keyword.rs2
-rw-r--r--tests/ui/self/self_type_keyword.stderr27
-rw-r--r--tests/ui/simd/array-trait.rs1
-rw-r--r--tests/ui/simd/array-trait.stderr9
-rw-r--r--tests/ui/sized/unsized-binding.rs5
-rw-r--r--tests/ui/sized/unsized-binding.stderr13
-rw-r--r--tests/ui/span/issue-37767.stderr8
-rw-r--r--tests/ui/span/issue-39698.stderr34
-rw-r--r--tests/ui/span/issue-43927-non-ADT-derive.stderr8
-rw-r--r--tests/ui/span/lint-unused-unsafe-thir.rs61
-rw-r--r--tests/ui/span/lint-unused-unsafe-thir.stderr50
-rw-r--r--tests/ui/span/lint-unused-unsafe.mir.stderr376
-rw-r--r--tests/ui/span/lint-unused-unsafe.rs8
-rw-r--r--tests/ui/span/lint-unused-unsafe.thir.stderr1402
-rw-r--r--tests/ui/specialization/issue-52050.stderr10
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.rs1
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.stderr14
-rw-r--r--tests/ui/stability-attribute/stability-attribute-issue-43027.rs8
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity-4.rs5
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity-4.stderr13
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity.rs33
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity.stderr66
-rw-r--r--tests/ui/stability-attribute/stability-attribute-trait-impl.rs4
-rw-r--r--tests/ui/stability-attribute/stability-attribute-trait-impl.stderr2
-rw-r--r--tests/ui/str/str-idx.stderr9
-rw-r--r--tests/ui/str/str-mut-idx.stderr9
-rw-r--r--tests/ui/structs/method-chain-expression-failure.rs31
-rw-r--r--tests/ui/structs/method-chain-expression-failure.stderr15
-rw-r--r--tests/ui/structs/struct-path-associated-type.stderr6
-rw-r--r--tests/ui/suggestions/chain-method-call-mutation-in-place.stderr5
-rw-r--r--tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr2
-rw-r--r--tests/ui/suggestions/deref-path-method.stderr7
-rw-r--r--tests/ui/suggestions/dont-suggest-ref/simple.stderr8
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr4
-rw-r--r--tests/ui/suggestions/impl-trait-missing-lifetime.stderr6
-rw-r--r--tests/ui/suggestions/issue-101623.stderr3
-rw-r--r--tests/ui/suggestions/issue-102972.fixed41
-rw-r--r--tests/ui/suggestions/issue-102972.rs25
-rw-r--r--tests/ui/suggestions/issue-102972.stderr56
-rw-r--r--tests/ui/suggestions/issue-104961.fixed4
-rw-r--r--tests/ui/suggestions/issue-104961.rs4
-rw-r--r--tests/ui/suggestions/issue-104961.stderr4
-rw-r--r--tests/ui/suggestions/issue-109291.stderr7
-rw-r--r--tests/ui/suggestions/issue-61963.stderr5
-rw-r--r--tests/ui/suggestions/issue-62843.stderr2
-rw-r--r--tests/ui/suggestions/issue-81839.stderr15
-rw-r--r--tests/ui/suggestions/issue-83892.stderr2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.rs2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.stderr4
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.fixed14
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.rs6
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.stderr104
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed7
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs7
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr23
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr99
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed47
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.rs47
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr71
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed52
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs52
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr66
-rw-r--r--tests/ui/suggestions/missing-lifetime-specifier.stderr8
-rw-r--r--tests/ui/suggestions/path-display.stderr2
-rw-r--r--tests/ui/suggestions/restrict-existing-type-bounds.stderr4
-rw-r--r--tests/ui/suggestions/return-closures.stderr4
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.fixed5
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.rs5
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.stderr14
-rw-r--r--tests/ui/suggestions/slice-issue-87994.stderr8
-rw-r--r--tests/ui/suggestions/suggest-dereferencing-index.stderr3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.fixed3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.rs3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.stderr7
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.fixed14
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.rs3
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.stderr4
-rw-r--r--tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr2
-rw-r--r--tests/ui/suggestions/trait-hidden-method.stderr2
-rw-r--r--tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr2
-rw-r--r--tests/ui/suggestions/unnamable-types.rs2
-rw-r--r--tests/ui/suggestions/unnamable-types.stderr2
-rw-r--r--tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.bad.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.blank.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.no-value.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.rs6
-rw-r--r--tests/ui/symbol-mangling-version/stable.rs5
-rw-r--r--tests/ui/symbol-mangling-version/unstable.legacy.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/unstable.rs6
-rw-r--r--tests/ui/target-feature/gate.rs1
-rw-r--r--tests/ui/target-feature/gate.stderr2
-rw-r--r--tests/ui/target-feature/similar-feature-suggestion.stderr4
-rw-r--r--tests/ui/target-feature/unstable-feature.rs6
-rw-r--r--tests/ui/target-feature/unstable-feature.stderr6
-rw-r--r--tests/ui/thread-local/thread-local-static.mir.stderr (renamed from tests/ui/thread-local/thread-local-static.stderr)10
-rw-r--r--tests/ui/thread-local/thread-local-static.rs3
-rw-r--r--tests/ui/thread-local/thread-local-static.thir.stderr44
-rw-r--r--tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs2
-rw-r--r--tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr2
-rw-r--r--tests/ui/tool_lints.stderr1
-rw-r--r--tests/ui/trait-bounds/impl-bound-with-references-error.stderr7
-rw-r--r--tests/ui/trait-bounds/mismatch-fn-trait.stderr20
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed11
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs11
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr20
-rw-r--r--tests/ui/traits/alias/object-fail.stderr2
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs43
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr109
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs2
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr4
-rw-r--r--tests/ui/traits/associated_type_bound/impl-is-shadowed.rs21
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs4
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr4
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.rs2
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.stderr19
-rw-r--r--tests/ui/traits/coercion-generic-bad.stderr1
-rw-r--r--tests/ui/traits/copy-guessing.stderr2
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs4
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr16
-rw-r--r--tests/ui/traits/issue-33140-hack-boundaries.stderr2
-rw-r--r--tests/ui/traits/issue-38404.stderr1
-rw-r--r--tests/ui/traits/issue-38604.stderr2
-rw-r--r--tests/ui/traits/issue-52893.stderr2
-rw-r--r--tests/ui/traits/issue-59029-1.stderr6
-rw-r--r--tests/ui/traits/issue-77982.rs1
-rw-r--r--tests/ui/traits/issue-77982.stderr32
-rw-r--r--tests/ui/traits/item-privacy.stderr26
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.rs1
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.stderr16
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.rs1
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.stderr40
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr11
-rw-r--r--tests/ui/traits/new-solver/coherence/issue-102048.stderr12
-rw-r--r--tests/ui/traits/new-solver/coroutine.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/coroutine.rs32
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs3
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr11
-rw-r--r--tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs10
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr2
-rw-r--r--tests/ui/traits/new-solver/fn-trait.rs8
-rw-r--r--tests/ui/traits/new-solver/fn-trait.stderr14
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr15
-rw-r--r--tests/ui/traits/new-solver/generator.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/generator.rs32
-rw-r--r--tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs9
-rw-r--r--tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr14
-rw-r--r--tests/ui/traits/new-solver/object-unsafety.stderr2
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs3
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.rs2
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-unconstrained.stderr12
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr12
-rw-r--r--tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs19
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.stderr11
-rw-r--r--tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr3
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs4
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr16
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.rs7
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr18
-rw-r--r--tests/ui/traits/object/print_vtable_sizes.stdout22
-rw-r--r--tests/ui/traits/object/safety.stderr2
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.rs4
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.stderr4
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.fixed2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.rs2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.stderr4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr16
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr32
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr36
-rw-r--r--tests/ui/traits/test-2.stderr9
-rw-r--r--tests/ui/try-block/try-block-bad-type.stderr1
-rw-r--r--tests/ui/try-trait/bad-interconversion.stderr9
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test2.stderr2
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test3.stderr2
-rw-r--r--tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr12
-rw-r--r--tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr1
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr48
-rw-r--r--tests/ui/type-alias-impl-trait/closure_parent_substs.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.stderr23
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr48
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr50
-rw-r--r--tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs39
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs39
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-simplified.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs27
-rw-r--r--tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs44
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.fixed19
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.rs17
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr73
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs14
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr17
-rw-r--r--tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.fail.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr7
-rw-r--r--tests/ui/type-inference/sort_by_key.stderr11
-rw-r--r--tests/ui/type/type-check/cannot_infer_local_or_vec.stderr2
-rw-r--r--tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs6
-rw-r--r--tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr15
-rw-r--r--tests/ui/type/type-check/point-at-inference-issue-116155.rs17
-rw-r--r--tests/ui/type/type-check/point-at-inference-issue-116155.stderr18
-rw-r--r--tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr1
-rw-r--r--tests/ui/typeck/bad-index-due-to-nested.stderr4
-rw-r--r--tests/ui/typeck/escaping_bound_vars.rs16
-rw-r--r--tests/ui/typeck/escaping_bound_vars.stderr10
-rw-r--r--tests/ui/typeck/issue-104513-ice.rs2
-rw-r--r--tests/ui/typeck/issue-104513-ice.stderr2
-rw-r--r--tests/ui/typeck/issue-107087.stderr2
-rw-r--r--tests/ui/typeck/issue-110052.stderr2
-rw-r--r--tests/ui/typeck/issue-114529-illegal-break-with-value.rs20
-rw-r--r--tests/ui/typeck/issue-114529-illegal-break-with-value.stderr29
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs2
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr8
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs96
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr237
-rw-r--r--tests/ui/typeck/issue-13853.stderr2
-rw-r--r--tests/ui/typeck/issue-36708.stderr7
-rw-r--r--tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr2
-rw-r--r--tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr2
-rw-r--r--tests/ui/typeck/issue-91267.stderr2
-rw-r--r--tests/ui/typeck/issue-91334.rs2
-rw-r--r--tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr4
-rw-r--r--tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr2
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.rs1
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.stderr31
-rw-r--r--tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs2
-rw-r--r--tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr2
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr4
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs23
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr44
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs32
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr123
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr6
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr12
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr6
-rw-r--r--tests/ui/uninhabited/diverging-guard.rs10
-rw-r--r--tests/ui/union/issue-81199.rs1
-rw-r--r--tests/ui/union/issue-81199.stderr19
-rw-r--r--tests/ui/union/union-unsafe.mir.stderr28
-rw-r--r--tests/ui/union/union-unsafe.rs14
-rw-r--r--tests/ui/union/union-unsafe.thir.stderr30
-rw-r--r--tests/ui/union/union-unsized.mirunsafeck.stderr31
-rw-r--r--tests/ui/union/union-unsized.rs2
-rw-r--r--tests/ui/union/union-unsized.thirunsafeck.stderr31
-rw-r--r--tests/ui/unknown-lint-tool-name.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr2
-rw-r--r--tests/ui/unresolved/auxiliary/library.rs1
-rw-r--r--tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs31
-rw-r--r--tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr25
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed19
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs19
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr14
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr (renamed from tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr)4
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs10
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr16
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.stderr2
-rw-r--r--tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr6
-rw-r--r--tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr10
-rw-r--r--tests/ui/unsafe/ranged_ints2.rs1
-rw-r--r--tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr10
-rw-r--r--tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr16
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed (renamed from tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed)19
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr (renamed from tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr)26
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.rs19
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed73
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr99
-rw-r--r--tests/ui/unsized/maybe-bounds-where.rs4
-rw-r--r--tests/ui/unsized/maybe-bounds-where.stderr16
-rw-r--r--tests/ui/unsized/unsize-coerce-multiple-adt-params.rs29
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.rs1
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.stderr14
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.rs1
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.stderr14
-rw-r--r--tests/ui/unsized/unsized7.rs1
-rw-r--r--tests/ui/unsized/unsized7.stderr14
-rw-r--r--tests/ui/use/use-super-global-path.stderr2
-rw-r--r--tests/ui/weird-exprs.rs2
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.rs1
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.stderr16
-rw-r--r--tests/ui/wf/issue-110157.rs1
-rw-r--r--tests/ui/wf/issue-110157.stderr25
-rw-r--r--tests/ui/wf/unnormalized-projection-guides-inference.rs24
-rw-r--r--tests/ui/wf/wf-const-type.rs1
-rw-r--r--tests/ui/wf/wf-const-type.stderr20
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr3
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj.stderr3
-rw-r--r--tests/ui/wf/wf-fn-where-clause.stderr18
-rw-r--r--tests/ui/wf/wf-impl-associated-type-region.stderr4
-rw-r--r--tests/ui/wf/wf-in-fn-type-static.stderr14
-rw-r--r--tests/ui/wf/wf-in-obj-type-static.stderr7
-rw-r--r--tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr8
-rw-r--r--tests/ui/wf/wf-static-type.rs1
-rw-r--r--tests/ui/wf/wf-static-type.stderr20
-rw-r--r--tests/ui/wf/wf-trait-associated-type-region.stderr11
-rw-r--r--tests/ui/wf/wf-unsafe-trait-obj-match.stderr10
2057 files changed, 20769 insertions, 8366 deletions
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
index 1f049b178..0cdf22971 100644
--- a/tests/ui/abi/compatibility.rs
+++ b/tests/ui/abi/compatibility.rs
@@ -30,6 +30,7 @@
// revisions: loongarch64
//[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
//[loongarch64] needs-llvm-components: loongarch
+//[loongarch64] min-llvm-version: 17
// revisions: wasm
//[wasm] compile-flags: --target wasm32-unknown-unknown
//[wasm] needs-llvm-components: webassembly
diff --git a/tests/ui/allocator/not-an-allocator.stderr b/tests/ui/allocator/not-an-allocator.stderr
index 62bb0679f..e1967b700 100644
--- a/tests/ui/allocator/not-an-allocator.stderr
+++ b/tests/ui/allocator/not-an-allocator.stderr
@@ -18,6 +18,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -29,6 +30,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -40,6 +42,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
diff --git a/tests/ui/array-slice-vec/vector-no-ann.stderr b/tests/ui/array-slice-vec/vector-no-ann.stderr
index d2ea08aa4..619417a73 100644
--- a/tests/ui/array-slice-vec/vector-no-ann.stderr
+++ b/tests/ui/array-slice-vec/vector-no-ann.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
--> $DIR/vector-no-ann.rs:2:9
|
LL | let _foo = Vec::new();
- | ^^^^
+ | ^^^^ ---------- type must be known at this point
|
help: consider giving `_foo` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/asm/aarch64/interpolated-idents.stderr b/tests/ui/asm/aarch64/interpolated-idents.stderr
index f6c50c2e1..74cb992f2 100644
--- a/tests/ui/asm/aarch64/interpolated-idents.stderr
+++ b/tests/ui/asm/aarch64/interpolated-idents.stderr
@@ -33,12 +33,7 @@ LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $in
LL | / m!(in out lateout inout inlateout const sym
LL | | pure nomem readonly preserves_flags
LL | | noreturn nostack options);
- | | -
- | |________________________________|
- | |________________________________in this macro invocation
- | |________________________________in this macro invocation
- | |________________________________in this macro invocation
- | in this macro invocation
+ | |________________________________- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/asm/x86_64/interpolated-idents.stderr b/tests/ui/asm/x86_64/interpolated-idents.stderr
index 80a8c8c77..a91bc768f 100644
--- a/tests/ui/asm/x86_64/interpolated-idents.stderr
+++ b/tests/ui/asm/x86_64/interpolated-idents.stderr
@@ -33,12 +33,7 @@ LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $in
LL | / m!(in out lateout inout inlateout const sym
LL | | pure nomem readonly preserves_flags
LL | | noreturn nostack att_syntax options);
- | | -
- | |___________________________________________|
- | |___________________________________________in this macro invocation
- | |___________________________________________in this macro invocation
- | |___________________________________________in this macro invocation
- | in this macro invocation
+ | |___________________________________________- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs
index 951dd949b..6c22c2f6c 100644
--- a/tests/ui/asm/x86_64/issue-96797.rs
+++ b/tests/ui/asm/x86_64/issue-96797.rs
@@ -11,7 +11,14 @@ use std::arch::global_asm;
#[no_mangle]
fn my_func() {}
-global_asm!("call_foobar: jmp {}", sym foobar);
+global_asm!("
+.globl call_foobar
+.type call_foobar,@function
+.pushsection .text.call_foobar,\"ax\",@progbits
+call_foobar: jmp {}
+.size call_foobar, .-call_foobar
+.popsection
+", sym foobar);
fn foobar() {}
diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
index 5435f2232..e39224f2c 100644
--- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
+++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
@@ -14,14 +14,12 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
|
LL | const ID: i32 = 3;
| ^^^^^^^^^^^^^
-help: disambiguate the associated constant for candidate #1
- |
-LL | const X: i32 = <i32 as Foo>::ID;
- | ~~~~~~~~~~~~~~
-help: disambiguate the associated constant for candidate #2
+help: use fully-qualified syntax to disambiguate
|
LL | const X: i32 = <i32 as Bar>::ID;
| ~~~~~~~~~~~~~~
+LL | const X: i32 = <i32 as Foo>::ID;
+ | ~~~~~~~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
index d65991234..ac5ec8e05 100644
--- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
+++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
@@ -24,6 +24,7 @@ note: erroneous constant encountered
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-105330.rs b/tests/ui/associated-consts/issue-105330.rs
index 86e45f10b..6c6dae864 100644
--- a/tests/ui/associated-consts/issue-105330.rs
+++ b/tests/ui/associated-consts/issue-105330.rs
@@ -9,13 +9,11 @@ impl TraitWAssocConst for impl Demo { //~ ERROR E0404
}
fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658
- foo::<Demo>()(); //~ ERROR E0271
- //~^ ERROR E0618
- //~| ERROR E0277
+ foo::<Demo>()();
}
-fn main<A: TraitWAssocConst<A=32>>() { //~ ERROR E0131
+fn main<A: TraitWAssocConst<A=32>>() {
//~^ ERROR E0658
- foo::<Demo>(); //~ ERROR E0277
- //~^ ERROR E0271
+ //~| ERROR E0131
+ foo::<Demo>();
}
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index 927422fa8..aeedf6b19 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -25,7 +25,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() {
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
error[E0658]: associated const equality is incomplete
- --> $DIR/issue-105330.rs:17:29
+ --> $DIR/issue-105330.rs:15:29
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^
@@ -33,91 +33,19 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
= 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[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
--> $DIR/issue-105330.rs:6:27
|
LL | impl TraitWAssocConst for impl Demo {
| ^^^^^^^^^
error[E0131]: `main` function is not allowed to have generic parameters
- --> $DIR/issue-105330.rs:17:8
+ --> $DIR/issue-105330.rs:15:8
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:12:11
- |
-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
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:12:11
- |
-LL | foo::<Demo>()();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error[E0618]: expected function, found `()`
- --> $DIR/issue-105330.rs:12:5
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ----------------------------------- `foo::<Demo>` defined here returns `()`
-LL | foo::<Demo>()();
- | ^^^^^^^^^^^^^--
- | |
- | call expression requires function
-
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:19:11
- |
-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
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:19:11
- |
-LL | foo::<Demo>();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error: aborting due to 11 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658.
+Some errors have detailed explanations: E0131, E0404, E0562, E0658.
For more information about an error, try `rustc --explain E0131`.
diff --git a/tests/ui/associated-consts/issue-58022.rs b/tests/ui/associated-consts/issue-58022.rs
index 2a8a1eaa6..8e2a441f2 100644
--- a/tests/ui/associated-consts/issue-58022.rs
+++ b/tests/ui/associated-consts/issue-58022.rs
@@ -11,6 +11,7 @@ impl Bar<[u8]> {
const SIZE: usize = 32;
fn new(slice: &[u8; Self::SIZE]) -> Self {
+ //~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
Foo(Box::new(*slice))
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
}
diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr
index 56d85c066..82cbc9ed3 100644
--- a/tests/ui/associated-consts/issue-58022.stderr
+++ b/tests/ui/associated-consts/issue-58022.stderr
@@ -7,13 +7,27 @@ LL |
LL | fn new(slice: &[u8; Foo::SIZE]) -> Self;
| ^^^^^^^^^ cannot refer to the associated constant of trait
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/issue-58022.rs:13:41
+ |
+LL | fn new(slice: &[u8; Self::SIZE]) -> Self {
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`
+note: required because it appears within the type `Bar<[u8]>`
+ --> $DIR/issue-58022.rs:8:12
+ |
+LL | pub struct Bar<T: ?Sized>(T);
+ | ^^^
+ = note: the return type of a function must have a statically known size
+
error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo`
- --> $DIR/issue-58022.rs:14:9
+ --> $DIR/issue-58022.rs:15:9
|
LL | Foo(Box::new(*slice))
| ^^^ not a function, tuple struct or tuple variant
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0423, E0790.
-For more information about an error, try `rustc --explain E0423`.
+Some errors have detailed explanations: E0277, E0423, E0790.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
index 464b59c24..0620725ca 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
@@ -10,6 +10,18 @@ note: required by a bound in `Ty::Pr`
LL | type Pr<T: Copy> = T;
| ^^^^ required by this bound in `Ty::Pr`
-error: aborting due to previous error
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/generic-associated-types-bad.rs:16:27
+ |
+LL | const _: Ty::Pr<String> = String::new();
+ | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `Ty::Pr`
+ --> $DIR/generic-associated-types-bad.rs:10:16
+ |
+LL | type Pr<T: Copy> = T;
+ | ^^^^ required by this bound in `Ty::Pr`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
index 4f371b24e..fcf828c21 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Vec<()>: Copy` is not satisfied
- --> $DIR/generic-associated-types-bad.rs:20:12
+ --> $DIR/generic-associated-types-bad.rs:21:12
|
LL | let _: Ty::Pr<Vec<()>>;
| ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<()>`
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
index 74ec39424..94c205218 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
- --> $DIR/generic-associated-types-bad.rs:25:12
+ --> $DIR/generic-associated-types-bad.rs:26:12
|
LL | fn user<'a>() {
| -- lifetime `'a` defined here
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
index e66392a0a..f5deec422 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
@@ -14,6 +14,7 @@ impl Ty {
#[cfg(item)]
const _: Ty::Pr<String> = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied
+//[item]~^ the trait bound `String: Copy` is not satisfied
fn main() {
#[cfg(local)]
diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
index 6f206f2b8..866a53f57 100644
--- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
+++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
@@ -33,7 +33,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-109071.rs:15:22
|
LL | fn T() -> Option<Self::Item> {}
- | ^^^^^^^^^^ help: use the fully-qualified path: `<Windows<T> as IntoIterator>::Item`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<Windows<T> as IntoIterator>::Item`
error: aborting due to 4 previous errors
diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr
index 84fc85cd0..e844f6795 100644
--- a/tests/ui/associated-inherent-types/issue-109789.stderr
+++ b/tests/ui/associated-inherent-types/issue-109789.stderr
@@ -15,6 +15,7 @@ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
= note: expected struct `Foo<fn(&'static ())>`
found struct `Foo<for<'a> fn(&'a ())>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
index 88c72042c..9206b4f6d 100644
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12
|
LL | let _: S::<bool>::Pr = ();
- | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<S<bool> as Tr>::Pr`
+ | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<S<bool> as Tr>::Pr`
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr
index b17d89ca3..62a008682 100644
--- a/tests/ui/associated-inherent-types/regionck-1.stderr
+++ b/tests/ui/associated-inherent-types/regionck-1.stderr
@@ -2,9 +2,14 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regionck-1.rs:9:30
|
LL | type NoTyOutliv<'a, T> = &'a T;
- | ^^^^^- help: consider adding a where clause: `where T: 'a`
- | |
- | ...so that the reference type `&'a T` does not outlive the data it points at
+ | -- ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | type NoTyOutliv<'a, T: 'a> = &'a T;
+ | ++++
error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
--> $DIR/regionck-1.rs:10:31
diff --git a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
index 97088b79f..f7a47be8d 100644
--- a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
+++ b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/ambiguous-associated-type-with-generics.rs:13:13
|
LL | let _x: <dyn Trait<i32>>::Ty;
- | ^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<dyn Trait<i32> as Assoc>::Ty`
+ | ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<dyn Trait<i32> as Assoc>::Ty`
error: aborting due to previous error
diff --git a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
index d0c170620..a2346e292 100644
--- a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
+++ b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
@@ -13,7 +13,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-item-duplicate-names-3.rs:18:12
|
LL | let x: Baz::Bar = 5;
- | ^^^^^^^^ help: use the fully-qualified path: `<Baz as Foo>::Bar`
+ | ^^^^^^^^ help: use fully-qualified syntax: `<Baz as Foo>::Bar`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs
new file mode 100644
index 000000000..c1047d856
--- /dev/null
+++ b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs
@@ -0,0 +1,28 @@
+use std::collections::HashMap;
+use std::hash::Hash;
+
+trait LowT: Identify {}
+
+trait Identify {
+ type Id: Clone + Hash + PartialEq + Eq;
+ fn identify(&self) -> Self::Id;
+}
+
+struct MapStore<L, I>
+where
+ L: LowT + Identify<Id = I>,
+{
+ lows: HashMap<I, L>,
+}
+
+impl<L, I> MapStore<L, I>
+where
+ L: LowT + Identify<Id = I>,
+ I: Clone + Hash + PartialEq + Eq,
+{
+ fn remove_low(&mut self, low: &impl LowT) {
+ let _low = self.lows.remove(low.identify()).unwrap(); //~ ERROR mismatched types
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr
new file mode 100644
index 000000000..78bf93c32
--- /dev/null
+++ b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs:24:37
+ |
+LL | let _low = self.lows.remove(low.identify()).unwrap();
+ | ------ ^^^^^^^^^^^^^^ expected `&I`, found associated type
+ | |
+ | arguments to this method are incorrect
+ |
+ = note: expected reference `&I`
+ found associated type `<impl LowT as Identify>::Id`
+ = help: consider constraining the associated type `<impl LowT as Identify>::Id` to `&I`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
+note: method defined here
+ --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs
index 4b8bf52c3..5019804d4 100644
--- a/tests/ui/associated-type-bounds/duplicate.rs
+++ b/tests/ui/associated-type-bounds/duplicate.rs
@@ -5,258 +5,258 @@ use std::iter;
use std::mem::ManuallyDrop;
struct SI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
struct SW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
struct SW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
enum EI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
enum EW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
enum EW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
union UI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
union UW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
union UW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FW1<T>()
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FW2<T>()
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FW3<T>()
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type TAW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type TAW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS1: Iterator<Item: Copy, Item: Send> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS2: Iterator<Item: Copy, Item: Copy> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS3: Iterator<Item: 'static, Item: 'static> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW1
where
Self: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW2
where
Self: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW3
where
Self: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRA1 {
type A: Iterator<Item: Copy, Item: Send>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
trait TRA2 {
type A: Iterator<Item: Copy, Item: Copy>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
trait TRA3 {
type A: Iterator<Item: 'static, Item: 'static>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn main() {}
diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr
index 08721eff7..3888e6223 100644
--- a/tests/ui/associated-type-bounds/duplicate.stderr
+++ b/tests/ui/associated-type-bounds/duplicate.stderr
@@ -1,4 +1,4 @@
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:7:36
|
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -6,7 +6,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:11:36
|
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -14,7 +14,7 @@ LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:15:39
|
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -22,7 +22,7 @@ LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:21:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -30,7 +30,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:28:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -38,7 +38,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:35:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -46,7 +46,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:41:34
|
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -54,7 +54,7 @@ LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:45:34
|
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -62,7 +62,7 @@ LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:49:37
|
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -70,7 +70,7 @@ LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:55:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -78,7 +78,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:62:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -86,7 +86,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:69:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -94,7 +94,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:75:35
|
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -102,7 +102,7 @@ LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:79:35
|
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -110,7 +110,7 @@ LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:83:38
|
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -118,7 +118,7 @@ LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:89:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -126,7 +126,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:96:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -134,7 +134,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:103:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -142,7 +142,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:109:32
|
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
@@ -150,7 +150,7 @@ LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:111:32
|
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
@@ -158,7 +158,7 @@ LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:113:35
|
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
@@ -166,7 +166,7 @@ LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:117:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -174,7 +174,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:123:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -182,7 +182,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:129:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -190,7 +190,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:134:42
|
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
@@ -198,7 +198,7 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:138:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
@@ -206,7 +206,7 @@ LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:142:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
@@ -214,7 +214,7 @@ LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:146:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
@@ -222,7 +222,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:148:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
@@ -230,7 +230,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:150:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
@@ -238,7 +238,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:153:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
@@ -246,7 +246,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:155:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
@@ -254,7 +254,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:157:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
@@ -262,7 +262,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:161:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -270,7 +270,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:166:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -278,7 +278,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:171:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -286,7 +286,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:175:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
@@ -294,7 +294,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:177:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
@@ -302,7 +302,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:179:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
@@ -310,7 +310,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:181:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
@@ -318,7 +318,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:183:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
@@ -326,7 +326,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:185:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
@@ -334,7 +334,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:188:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
@@ -342,7 +342,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:190:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
@@ -350,7 +350,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:192:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
@@ -358,7 +358,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
@@ -366,15 +366,17 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
@@ -382,15 +384,17 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
@@ -398,15 +402,17 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -414,7 +420,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:211:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -422,7 +428,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:217:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -430,7 +436,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
@@ -438,15 +444,17 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
@@ -454,15 +462,17 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
@@ -470,15 +480,17 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:255:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
@@ -486,7 +498,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:257:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
@@ -494,7 +506,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:259:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
@@ -502,7 +514,7 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:243:34
|
LL | type A: Iterator<Item: Copy, Item: Send>;
@@ -510,7 +522,7 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:247:34
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
@@ -518,7 +530,7 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:251:37
|
LL | type A: Iterator<Item: 'static, Item: 'static>;
diff --git a/tests/ui/associated-type-bounds/elision.stderr b/tests/ui/associated-type-bounds/elision.stderr
index cc10bbcc0..a29e32a78 100644
--- a/tests/ui/associated-type-bounds/elision.stderr
+++ b/tests/ui/associated-type-bounds/elision.stderr
@@ -17,7 +17,7 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()>
| ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
| | |
| | expected `Option<&()>` because of return type
- | this type parameter
+ | found this type parameter
|
= note: expected enum `Option<&()>`
found enum `Option<impl Iterator<Item = &'_ ()>>`
diff --git a/tests/ui/associated-type-bounds/issue-71443-1.stderr b/tests/ui/associated-type-bounds/issue-71443-1.stderr
index 15cc9646b..09c8ec2e2 100644
--- a/tests/ui/associated-type-bounds/issue-71443-1.stderr
+++ b/tests/ui/associated-type-bounds/issue-71443-1.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-71443-1.rs:6:5
|
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
- | - help: try adding a return type: `-> Incorrect`
+ | - help: try adding a return type: `-> Incorrect`
LL | Incorrect
| ^^^^^^^^^ expected `()`, found `Incorrect`
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
index 61299550e..2a308f837 100644
--- a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
@@ -1,4 +1,4 @@
-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
+error[E0191]: the value of the associated types `Item`, `Item`, `IntoIter` and `IntoIter` in `IntoIterator` must be specified
--> $DIR/overlaping-bound-suggestion.rs:7:13
|
LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
index b8be132e6..65f7a72fb 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
index b8be132e6..65f7a72fb 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
index 58ce41d1a..4f332fa13 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
index 95ef7d82f..1714dac12 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
index 98c1a2827..c4dc5d362 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
index 1066c420c..6c2645ae5 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
index 98c1a2827..c4dc5d362 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
index 1066c420c..6c2645ae5 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
index 3dd9249a7..7f0647534 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
@@ -2,7 +2,7 @@
// edition: 2021
// [with] check-pass
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
index 9962f4706..9d4bb356c 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
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 edce1045e..5b96676d0 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
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
index b631dd0eb..d2a445f33 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
index b631dd0eb..d2a445f33 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
index 6884305d7..d5a29616a 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
index 490bfdc4c..1a2f84715 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.rs b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
index a52562d78..0679b96f6 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
index 5b1c4cb0b..fb6538fa0 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/missing.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed
new file mode 100644
index 000000000..b9f26a402
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed
@@ -0,0 +1,14 @@
+// run-rustfix
+trait O {
+ type M;
+}
+trait U<A: O> {
+ const N: A::M;
+}
+impl<D> O for D {
+ type M = u8;
+}
+impl<C: O<M = u8>> U<C> for u16 {
+ const N: C::M = 4u8; //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs
new file mode 100644
index 000000000..abff6af73
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs
@@ -0,0 +1,14 @@
+// run-rustfix
+trait O {
+ type M;
+}
+trait U<A: O> {
+ const N: A::M;
+}
+impl<D> O for D {
+ type M = u8;
+}
+impl<C: O> U<C> for u16 {
+ const N: C::M = 4u8; //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr
new file mode 100644
index 000000000..b104f38ce
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/suggest-contraining-assoc-type-because-of-assoc-const.rs:12:21
+ |
+LL | const N: C::M = 4u8;
+ | ^^^ expected associated type, found `u8`
+ |
+ = note: expected associated type `<C as O>::M`
+ found type `u8`
+help: consider constraining the associated type `<C as O>::M` to `u8`
+ |
+LL | impl<C: O<M = u8>> U<C> for u16 {
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
index 236552baf..df01e1e37 100644
--- a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
+++ b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
@@ -10,11 +10,11 @@ LL | type Color;
LL | fn a<C:Vehicle+Box>(_: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
@@ -31,11 +31,11 @@ LL | type Color;
LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~~~~~
@@ -52,11 +52,11 @@ LL | type Color;
LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~~~~~
@@ -73,11 +73,11 @@ LL | type Color;
LL | fn e(&self, _: X::Color) where X : Box;
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
| ~~~~~~~~~~~~~~~~
@@ -94,11 +94,11 @@ LL | type Color;
LL | fn f(&self, _: X::Color) where X : Box { }
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~
@@ -115,11 +115,11 @@ LL | type Color;
LL | fn d(&self, _: X::Color) where X : Box { }
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
index e765f9323..66037054e 100644
--- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
+++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
@@ -18,11 +18,11 @@ LL | type Color;
LL | fn dent<C:BoxCar>(c: C, color: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
| ~~~~~~~~~~~~
@@ -45,7 +45,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
T: Vehicle::Color = COLOR,
T: Box::Color = COLOR
-error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
+error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30
|
LL | type Color;
@@ -71,16 +71,16 @@ LL | type Color;
LL | fn paint<C:BoxCar>(c: C, d: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
| ~~~~~~~~~~~~
-error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
+error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
|
LL | type Color;
diff --git a/tests/ui/associated-types/associated-types-coherence-failure.stderr b/tests/ui/associated-types/associated-types-coherence-failure.stderr
index 40c02dca3..211613b37 100644
--- a/tests/ui/associated-types/associated-types-coherence-failure.stderr
+++ b/tests/ui/associated-types/associated-types-coherence-failure.stderr
@@ -2,19 +2,19 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Co
--> $DIR/associated-types-coherence-failure.rs:21:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
- | ------------------------------------------------------------ first implementation here
+ | ----------------------------------------------------------------------------- first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`
--> $DIR/associated-types-coherence-failure.rs:28:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
- | ------------------------------------------------------------ first implementation here
+ | ----------------------------------------------------------------------------- first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
index 1ff6fd4b8..d361643f0 100644
--- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
+++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
@@ -13,7 +13,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
|
LL | trait Foo where Foo::Assoc: Bar {
- | ^^^^^^^^^^ help: use the fully-qualified path: `<Self as Foo>::Assoc`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Foo>::Assoc`
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:27:10
@@ -21,7 +21,7 @@ error[E0223]: ambiguous associated type
LL | type X = std::ops::Deref::Target;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
-help: use the fully-qualified path
+help: use fully-qualified syntax
|
LL | type X = <CString as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -37,7 +37,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
LL | fn grab(&self) -> Grab::Value;
- | ^^^^^^^^^^^ help: use the fully-qualified path: `<Self as Grab>::Value`
+ | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
diff --git a/tests/ui/associated-types/associated-types-incomplete-object.rs b/tests/ui/associated-types/associated-types-incomplete-object.rs
index 4627dfd2b..f6e4bdfbf 100644
--- a/tests/ui/associated-types/associated-types-incomplete-object.rs
+++ b/tests/ui/associated-types/associated-types-incomplete-object.rs
@@ -21,11 +21,11 @@ pub fn main() {
let a = &42isize as &dyn Foo<A=usize, B=char>;
let b = &42isize as &dyn Foo<A=usize>;
- //~^ ERROR the value of the associated type `B` (from trait `Foo`) must be specified
+ //~^ ERROR the value of the associated type `B` in `Foo` must be specified
let c = &42isize as &dyn Foo<B=char>;
- //~^ ERROR the value of the associated type `A` (from trait `Foo`) must be specified
+ //~^ ERROR the value of the associated type `A` in `Foo` must be specified
let d = &42isize as &dyn Foo;
- //~^ ERROR the value of the associated types `A` (from trait `Foo`), `B` (from trait
+ //~^ ERROR the value of the associated types `A` and `B` in `Foo`
}
diff --git a/tests/ui/associated-types/associated-types-incomplete-object.stderr b/tests/ui/associated-types/associated-types-incomplete-object.stderr
index 32866c714..0c9761afe 100644
--- a/tests/ui/associated-types/associated-types-incomplete-object.stderr
+++ b/tests/ui/associated-types/associated-types-incomplete-object.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `B` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `B` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:23:30
|
LL | type B;
@@ -7,7 +7,7 @@ LL | type B;
LL | let b = &42isize as &dyn Foo<A=usize>;
| ^^^^^^^^^^^^ help: specify the associated type: `Foo<A=usize, B = Type>`
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:26:30
|
LL | type A;
@@ -16,7 +16,7 @@ LL | type A;
LL | let c = &42isize as &dyn Foo<B=char>;
| ^^^^^^^^^^^ help: specify the associated type: `Foo<B=char, A = Type>`
-error[E0191]: the value of the associated types `A` (from trait `Foo`), `B` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated types `A` and `B` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:29:30
|
LL | type A;
diff --git a/tests/ui/associated-types/associated-types-issue-20346.stderr b/tests/ui/associated-types/associated-types-issue-20346.stderr
index b1708b96e..f38407986 100644
--- a/tests/ui/associated-types/associated-types-issue-20346.stderr
+++ b/tests/ui/associated-types/associated-types-issue-20346.stderr
@@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<
--> $DIR/associated-types-issue-20346.rs:34:36
|
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
- | - this type parameter
+ | - found this type parameter
...
LL | is_iterator_of::<Option<T>, _>(&adapter);
| ------------------------------ ^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
index c373c5855..cc0101d63 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
@@ -21,6 +21,7 @@ trait Other {
impl<T:Get> Other for T {
fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
//~^ ERROR the trait bound `(T, U): Get` is not satisfied
+ //~| ERROR the trait bound `(T, U): Get` is not satisfied
}
fn main() { }
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 b3f2e16ba..9ebc45387 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
@@ -21,6 +21,18 @@ help: consider further restricting `Self`
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
| +++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: the trait bound `(T, U): Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-supertrait.rs:22:5
+ |
+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: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-types/associated-types-path-1.stderr b/tests/ui/associated-types/associated-types-path-1.stderr
index a67f77e37..cab9dcec0 100644
--- a/tests/ui/associated-types/associated-types-path-1.stderr
+++ b/tests/ui/associated-types/associated-types-path-1.stderr
@@ -16,11 +16,11 @@ LL | type A;
LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {}
| ^^^^ ambiguous associated type `A`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
| ~~~~~~~~~~~~
diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
index 749986f09..8ccbc9fb5 100644
--- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr
+++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
@@ -1,8 +1,10 @@
error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>`
--> $DIR/hr-associated-type-bound-2.rs:11:1
|
-LL | impl X<'_> for u32
- | ^^^^^^^^^^^^^^^^^^
+LL | / impl X<'_> for u32
+LL | | where
+LL | | for<'b> <Self as X<'b>>::U: Clone,
+ | |______________________________________^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`)
note: required for `u32` to implement `for<'b> X<'b>`
diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
index 366670269..1a749007a 100644
--- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
+++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
@@ -45,6 +45,7 @@ LL | trait Z<'a, T: ?Sized>
...
LL | for<'b> <T as Z<'b, u16>>::W: Clone,
| ^^^^^ required by this bound in `Z`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr
index dd0389c34..425cfdca0 100644
--- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr
+++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr
@@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/hr-associated-type-projection-1.rs:13:33
|
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
- | - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
+ | - ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
+ | |
+ | expected this type parameter
|
= note: expected type parameter `T`
found associated type `<T as Deref>::Target`
diff --git a/tests/ui/associated-types/impl-wf-cycle-1.stderr b/tests/ui/associated-types/impl-wf-cycle-1.stderr
index 206060f19..53022dcb4 100644
--- a/tests/ui/associated-types/impl-wf-cycle-1.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-1.stderr
@@ -1,8 +1,12 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-1.rs:15:1
|
-LL | impl<T: Grault> Grault for (T,)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: Grault> Grault for (T,)
+LL | |
+LL | | where
+LL | | Self::A: Baz,
+LL | | Self::B: Fiz,
+ | |_________________^
|
note: required for `(T,)` to implement `Grault`
--> $DIR/impl-wf-cycle-1.rs:15:17
diff --git a/tests/ui/associated-types/impl-wf-cycle-2.stderr b/tests/ui/associated-types/impl-wf-cycle-2.stderr
index 771ba751e..81c58be92 100644
--- a/tests/ui/associated-types/impl-wf-cycle-2.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-2.stderr
@@ -1,8 +1,11 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-2.rs:7:1
|
-LL | impl<T: Grault> Grault for (T,)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: Grault> Grault for (T,)
+LL | |
+LL | | where
+LL | | Self::A: Copy,
+ | |__________________^
|
note: required for `(T,)` to implement `Grault`
--> $DIR/impl-wf-cycle-2.rs:7:17
diff --git a/tests/ui/associated-types/issue-22560.stderr b/tests/ui/associated-types/issue-22560.stderr
index 2b88cf0b4..46e6e3951 100644
--- a/tests/ui/associated-types/issue-22560.stderr
+++ b/tests/ui/associated-types/issue-22560.stderr
@@ -9,7 +9,7 @@ LL | type Test = dyn Add + Sub;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/issue-22560.rs:9:17
|
LL | type Output;
diff --git a/tests/ui/associated-types/issue-23595-1.stderr b/tests/ui/associated-types/issue-23595-1.stderr
index 4307477a5..3443c4925 100644
--- a/tests/ui/associated-types/issue-23595-1.stderr
+++ b/tests/ui/associated-types/issue-23595-1.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarchy`), `Children` (from trait `Hierarchy`), `Value` (from trait `Hierarchy`) must be specified
+error[E0191]: the value of the associated types `Value`, `ChildKey` and `Children` in `Hierarchy` must be specified
--> $DIR/issue-23595-1.rs:8:58
|
LL | type Value;
diff --git a/tests/ui/associated-types/missing-associated-types.stderr b/tests/ui/associated-types/missing-associated-types.stderr
index f617df984..e9669afe8 100644
--- a/tests/ui/associated-types/missing-associated-types.stderr
+++ b/tests/ui/associated-types/missing-associated-types.stderr
@@ -9,7 +9,7 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:12:21
|
LL | type A;
@@ -38,7 +38,7 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `Add`), `Output` (from trait `Div`), `Output` (from trait `Div`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` and `B` in `Z`, `Output` and `Output` in `Div`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:15:21
|
LL | type A;
@@ -74,7 +74,7 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:18:21
|
LL | type A;
@@ -102,7 +102,7 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:21:21
|
LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
@@ -115,7 +115,7 @@ help: specify the associated types
LL | type Bat<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Fine<Rhs>;
| ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
-error[E0191]: the value of the associated types `Output` (from trait `Div`), `Output` (from trait `Mul`) must be specified
+error[E0191]: the value of the associated types `Output` in `Div`, `Output` in `Mul` must be specified
--> $DIR/missing-associated-types.rs:24:21
|
LL | type Bal<Rhs> = dyn X<Rhs>;
diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr
index 9a1c17822..b360aab6b 100644
--- a/tests/ui/async-await/async-await-let-else.stderr
+++ b/tests/ui/async-await/async-await-let-else.stderr
@@ -22,7 +22,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/async-await-let-else.rs:47:13
|
LL | async fn foo2(x: Option<bool>) {
- | - within this `impl Future<Output = ()>`
+ | ------------------------------ within this `impl Future<Output = ()>`
...
LL | is_send(foo2(Some(true)));
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
@@ -30,7 +30,7 @@ LL | is_send(foo2(Some(true)));
| 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
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:24:29
|
LL | async fn bar2<T>(_: T) -> ! {
@@ -39,7 +39,7 @@ LL | | panic!()
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
diff --git a/tests/ui/async-await/async-trait-fn.current.stderr b/tests/ui/async-await/async-trait-fn.current.stderr
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.current.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:7:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:8:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.next.stderr b/tests/ui/async-await/async-trait-fn.next.stderr
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.next.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:7:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:8:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.rs b/tests/ui/async-await/async-trait-fn.rs
index 04123badb..4e5e3ba83 100644
--- a/tests/ui/async-await/async-trait-fn.rs
+++ b/tests/ui/async-await/async-trait-fn.rs
@@ -1,9 +1,10 @@
// edition:2018
+// check-pass
trait T {
- async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
- async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
- async fn baz() { //~ ERROR functions in traits cannot be declared `async`
+ async fn foo() {}
+ async fn bar(&self) {}
+ async fn baz() {
// Nested item must not ICE.
fn a() {}
}
diff --git a/tests/ui/async-await/async-trait-fn.stderr b/tests/ui/async-await/async-trait-fn.stderr
deleted file mode 100644
index 68ebe3507..000000000
--- a/tests/ui/async-await/async-trait-fn.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:4:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:5:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
index 2114fb59b..f9e5bf675 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
@@ -23,7 +23,7 @@ LL | S::f();
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:24:5
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
|
LL | f();
| ^^^ call to unsafe function
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
index c941dc27a..14cc0dc61 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
@@ -20,6 +20,10 @@ async fn g() {
}
fn main() {
- S::f(); //[mir]~ ERROR call to unsafe function is unsafe
- f(); //[mir]~ ERROR call to unsafe function is unsafe
+ S::f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe
+ f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `f` is unsafe
}
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
index 68d97d3fd..ba3303fe7 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
@@ -14,6 +14,22 @@ LL | f();
|
= note: consult the function's documentation for information on how to avoid undefined behavior
-error: aborting due to 2 previous errors
+error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/async-await/generator-desc.rs b/tests/ui/async-await/coroutine-desc.rs
index 500812016..500812016 100644
--- a/tests/ui/async-await/generator-desc.rs
+++ b/tests/ui/async-await/coroutine-desc.rs
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/coroutine-desc.stderr
index d3e951cfe..e4cb0915a 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/coroutine-desc.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:10:19
+ --> $DIR/coroutine-desc.rs:10:19
|
LL | fun(async {}, async {});
| --- -------- ^^^^^^^^ expected `async` block, found a different `async` block
@@ -7,16 +7,16 @@ 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/coroutine-desc.rs:10:9: 10:17}`
+ found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:27}`
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:12:16
+ --> $DIR/coroutine-desc.rs:12:16
|
LL | fun(one(), two());
| --- ^^^^^ expected future, found a different future
@@ -26,13 +26,13 @@ LL | fun(one(), two());
= help: consider `await`ing on both `Future`s
= note: distinct uses of `impl Trait` result in different opaque types
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:14:26
+ --> $DIR/coroutine-desc.rs:14:26
|
LL | fun((async || {})(), (async || {})());
| --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
@@ -40,10 +40,10 @@ 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/coroutine-desc.rs:14:19: 14:21}`
+ found `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:36: 14:38}`
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
diff --git a/tests/ui/async-await/generator-not-future.rs b/tests/ui/async-await/coroutine-not-future.rs
index 37d7cfa6f..b18635fea 100644
--- a/tests/ui/async-await/generator-not-future.rs
+++ b/tests/ui/async-await/coroutine-not-future.rs
@@ -1,42 +1,42 @@
// edition:2018
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::future::Future;
-use std::ops::Generator;
+use std::ops::Coroutine;
async fn async_fn() {}
fn returns_async_block() -> impl Future<Output = ()> {
async {}
}
-fn returns_generator() -> impl Generator<(), Yield = (), Return = ()> {
+fn returns_coroutine() -> impl Coroutine<(), Yield = (), Return = ()> {
|| {
let _: () = yield ();
}
}
fn takes_future(_f: impl Future<Output = ()>) {}
-fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
+fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
fn main() {
// okay:
takes_future(async_fn());
takes_future(returns_async_block());
takes_future(async {});
- takes_generator(returns_generator());
- takes_generator(|| {
+ takes_coroutine(returns_coroutine());
+ takes_coroutine(|| {
let _: () = yield ();
});
- // async futures are not generators:
- takes_generator(async_fn());
+ // async futures are not coroutines:
+ takes_coroutine(async_fn());
//~^ ERROR the trait bound
- takes_generator(returns_async_block());
+ takes_coroutine(returns_async_block());
//~^ ERROR the trait bound
- takes_generator(async {});
+ takes_coroutine(async {});
//~^ ERROR the trait bound
- // generators are not futures:
- takes_future(returns_generator());
+ // coroutines are not futures:
+ takes_future(returns_coroutine());
//~^ ERROR is not a future
takes_future(|ctx| {
//~^ ERROR is not a future
diff --git a/tests/ui/async-await/coroutine-not-future.stderr b/tests/ui/async-await/coroutine-not-future.stderr
new file mode 100644
index 000000000..130c5ef52
--- /dev/null
+++ b/tests/ui/async-await/coroutine-not-future.stderr
@@ -0,0 +1,81 @@
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:31:21
+ |
+LL | takes_coroutine(async_fn());
+ | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:33:21
+ |
+LL | takes_coroutine(returns_async_block());
+ | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:35:21
+ |
+LL | takes_coroutine(async {});
+ | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future
+ --> $DIR/coroutine-not-future.rs:39:18
+ |
+LL | takes_future(returns_coroutine());
+ | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
+ = note: impl Coroutine<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
+note: required by a bound in `takes_future`
+ --> $DIR/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ --> $DIR/coroutine-not-future.rs:41:18
+ |
+LL | takes_future(|ctx| {
+ | _____------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | | ctx = yield ();
+LL | | });
+ | |_____^ `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ |
+ = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}`
+ = note: {coroutine@$DIR/coroutine-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/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
new file mode 100644
index 000000000..ced4434a7
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
@@ -0,0 +1,10 @@
+// check-fail
+// edition:2021
+
+// test for issue-114912 - debug ice: attempted to add with overflow
+
+async fn main() {
+ //~^ ERROR `main` function is not allowed to be `async`
+ [0usize; 0xffff_ffff_ffff_ffff].await;
+ //~^ ERROR `[usize; usize::MAX]` is not a future
+}
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
new file mode 100644
index 000000000..8c9d06c79
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `[usize; usize::MAX]` is not a future
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:8:37
+ |
+LL | [0usize; 0xffff_ffff_ffff_ffff].await;
+ | -^^^^^
+ | ||
+ | |`[usize; usize::MAX]` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `[usize; usize::MAX]`
+ = note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `[usize; usize::MAX]` to implement `IntoFuture`
+
+error[E0752]: `main` function is not allowed to be `async`
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:6:1
+ |
+LL | async fn main() {
+ | ^^^^^^^^^^^^^^^ `main` function is not allowed to be `async`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0752.
+For more information about an error, try `rustc --explain E0277`.
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 cfb0ebe38..0d3ee8a93 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
@@ -23,6 +23,7 @@ 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<(&(),)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:5:1
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:7:12
- |
-LL | fn baz() { async fn foo() {} }
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:9:1
- |
-LL | async fn async_baz() {
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:10:5
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:16:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:38:9
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:28:9
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:33:13
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
-
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:5:1
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:7:12
- |
-LL | fn baz() { async fn foo() {} }
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:9:1
- |
-LL | async fn async_baz() {
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:10:5
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:16:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:38:9
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:28:9
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:33:13
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
-
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.rs b/tests/ui/async-await/edition-deny-async-fns-2015.rs
index 6bd6d879a..9059f99ba 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs
@@ -16,7 +16,6 @@ impl Foo {
trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
- //~^ ERROR functions in traits cannot be declared `async`
}
fn main() {
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
index ba918eb28..c40cdc5ac 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -53,7 +53,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:36:9
+ --> $DIR/edition-deny-async-fns-2015.rs:35:9
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -62,7 +62,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:26:9
+ --> $DIR/edition-deny-async-fns-2015.rs:25:9
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -71,7 +71,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:31:13
+ --> $DIR/edition-deny-async-fns-2015.rs:30:13
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -79,20 +79,6 @@ LL | async fn bar() {}
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:18:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
+For more information about this error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs b/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
deleted file mode 100644
index 792f378cb..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// edition:2021
-
-// RPITIT is not enough to allow use of async functions
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
-trait T {
- async fn foo(); //~ ERROR functions in traits cannot be declared `async`
-}
-
-// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
-// feature-gate-return_position_impl_trait_in_trait.rs)
-trait T2 {
- async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
-}
-
-trait T3 {
- fn foo() -> impl std::future::Future<Output = ()>;
-}
-
-impl T3 for () {
- async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
-}
-
-fn main() {}
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr b/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
deleted file mode 100644
index 2a5fbd1ec..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:8:5
- |
-LL | async fn foo();
- | -----^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:14:5
- |
-LL | async fn foo() -> impl Sized;
- | -----^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:22:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index d63911b0d..b0447a582 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -19,18 +19,18 @@ print-type-size variant `Suspend0`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Suspend1`: 3076 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1026 bytes
-print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes, alignment: 1 bytes
print-type-size local `.__awaitee`: 1025 bytes
print-type-size variant `Suspend2`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Returned`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr
deleted file mode 100644
index 540501b98..000000000
--- a/tests/ui/async-await/generator-not-future.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:31:21
- |
-LL | takes_generator(async_fn());
- | --------------- ^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:33:21
- |
-LL | takes_generator(returns_async_block());
- | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<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
- --> $DIR/generator-not-future.rs:35:21
- |
-LL | takes_generator(async {});
- | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: `impl Generator<Yield = (), Return = ()>` is not a future
- --> $DIR/generator-not-future.rs:39:18
- |
-LL | takes_future(returns_generator());
- | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Generator<Yield = (), Return = ()>` is not a future
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Future` is not implemented for `impl Generator<Yield = (), Return = ()>`
- = note: impl Generator<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- --> $DIR/generator-not-future.rs:41:18
- |
-LL | takes_future(|ctx| {
- | _____------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | | ctx = yield ();
-LL | | });
- | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- |
- = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}`
- = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs
index 3e2739a16..8d8950047 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -1,20 +1,19 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
type MyAssoc;
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
}
impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U {
type MyAssoc = (&'a U, &'b T);
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) {
(self, key)
}
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
index 06413fe6f..c8fd2d8f6 100644
--- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
@@ -1,15 +1,16 @@
// run-pass
// edition:2021
-#![feature(async_fn_in_trait)]
use std::future::Future;
trait AsyncTrait {
+ #[allow(async_fn_in_trait)]
async fn default_impl() {
assert!(false);
}
+ #[allow(async_fn_in_trait)]
async fn call_default_impl() {
Self::default_impl().await
}
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
index 38ba29718..c26f6625f 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
index 168ef8e9e..b70b36adb 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:11:5
|
LL | async fn foo(&self) -> i32 {
- | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:7:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
index 1b1b3cffd..c5a984102 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
index 60fa534a6..6392ce86e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-boxed.rs:15:5
+ --> $DIR/async-example-desugared-boxed.rs:11:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
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 3505690f1..ce93bd626 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
@@ -1,15 +1,14 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
-#![allow(incomplete_features)]
+#![feature(lint_reasons)]
use std::future::Future;
use std::pin::Pin;
use std::task::Poll;
pub trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
index feeda719e..f7a351eff 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
@@ -1,10 +1,6 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
index 71473e745..c287b9a5b 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::task::Poll;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
index 567a36a86..1eda6fe65 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-manual.rs:23:5
+ --> $DIR/async-example-desugared-manual.rs:19:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
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 0a5023176..78904d87a 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -1,13 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-example.rs b/tests/ui/async-await/in-trait/async-example.rs
index abf94ef74..a32f979df 100644
--- a/tests/ui/async-await/in-trait/async-example.rs
+++ b/tests/ui/async-await/in-trait/async-example.rs
@@ -1,11 +1,11 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
+
+ #[allow(async_fn_in_trait)]
async fn bar(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
index a73d55adf..8dc0574c7 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
use std::hash::Hash;
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
index 5c8d64fc6..3cc35b214 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
@@ -1,36 +1,30 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, U: 'a;
+ | ++++ ++ ++ +++++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, T: 'a;
+ | ++++ ++ ++ +++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs
index 67000e577..6004916a4 100644
--- a/tests/ui/async-await/in-trait/async-generics.rs
+++ b/tests/ui/async-await/in-trait/async-generics.rs
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T, U> {
async fn foo(&self) -> &(T, U);
}
diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr
index 6ae73d9e3..3b27f8fe2 100644
--- a/tests/ui/async-await/in-trait/async-generics.stderr
+++ b/tests/ui/async-await/in-trait/async-generics.stderr
@@ -1,36 +1,30 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U);
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where U: 'a;
+ | ++++ ++ ++ +++++++++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U);
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a;
+ | ++++ ++ ++ +++++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
index d5481d277..3721b0135 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
@@ -1,12 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized;
}
diff --git a/tests/ui/async-await/in-trait/async-lifetimes.rs b/tests/ui/async-await/in-trait/async-lifetimes.rs
index f298e45d2..cb4b871cb 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes.rs
@@ -1,10 +1,8 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T);
}
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.rs b/tests/ui/async-await/in-trait/async-recursive-generic.rs
index 6839abd38..c6031ce28 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.rs
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T> {
async fn foo_recursive(&self, n: usize) -> T;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
index cab173bdd..cf0bcd741 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:11:48
+ --> $DIR/async-recursive-generic.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> T {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs
index 61119f809..09f1ffe49 100644
--- a/tests/ui/async-await/in-trait/async-recursive.rs
+++ b/tests/ui/async-await/in-trait/async-recursive.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
async fn foo_recursive(&self, n: usize) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive.stderr b/tests/ui/async-await/in-trait/async-recursive.stderr
index 9feff37b3..b959652ea 100644
--- a/tests/ui/async-await/in-trait/async-recursive.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:11:48
+ --> $DIR/async-recursive.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
- | ^^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
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
index bba886f17..57c9b3ae8 100644
--- a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
+++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
@@ -1,7 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
-
pub trait Foo {
async fn test();
}
diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs
index 98dddc126..5adede5b5 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.rs
+++ b/tests/ui/async-await/in-trait/bad-signatures.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn bar(&abc self);
diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr
index 7cbd96e24..127a343a9 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.stderr
+++ b/tests/ui/async-await/in-trait/bad-signatures.stderr
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword
error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| -----^^^^
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs
new file mode 100644
index 000000000..8e62b3e0e
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.rs
@@ -0,0 +1,26 @@
+// edition: 2021
+
+trait Foo {
+ type T;
+
+ async fn foo(&self) -> Self::T;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+impl Foo for Bar {
+ //~^ ERROR conflicting implementations of trait `Foo` for type `Bar`
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.stderr b/tests/ui/async-await/in-trait/coherence-constrained.stderr
new file mode 100644
index 000000000..570a357ca
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.stderr
@@ -0,0 +1,25 @@
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:14:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:22:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0119]: conflicting implementations of trait `Foo` for type `Bar`
+ --> $DIR/coherence-constrained.rs:18:1
+ |
+LL | impl Foo for Bar {
+ | ---------------- first implementation here
+...
+LL | impl Foo for Bar {
+ | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0119, E0284.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
index afd3db5e0..18b0fa485 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -1,7 +1,6 @@
// edition: 2021
// known-bug: #108309
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
index 7c750bf51..5e2be0862 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
@@ -1,24 +1,24 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/dont-project-to-specializable-projection.rs:14:35
+ --> $DIR/dont-project-to-specializable-projection.rs:13:5
|
LL | default async fn foo(_: T) -> &'static str {
- | ^^^^^^^^^^^^ expected associated type, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future
|
note: type in trait
- --> $DIR/dont-project-to-specializable-projection.rs:10:27
+ --> $DIR/dont-project-to-specializable-projection.rs:9:5
|
LL | async fn foo(_: T) -> &'static str;
- | ^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(_) -> impl Future<Output = &'static str>`
found signature `fn(_) -> impl Future<Output = &'static str>`
error: async associated function in trait cannot be specialized
- --> $DIR/dont-project-to-specializable-projection.rs:14:5
+ --> $DIR/dont-project-to-specializable-projection.rs:13:5
|
LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
+ = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/early-bound-1.rs b/tests/ui/async-await/in-trait/early-bound-1.rs
index 6b3b14201..ddcb477a1 100644
--- a/tests/ui/async-await/in-trait/early-bound-1.rs
+++ b/tests/ui/async-await/in-trait/early-bound-1.rs
@@ -1,10 +1,8 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/early-bound-2.rs b/tests/ui/async-await/in-trait/early-bound-2.rs
index 270443229..3eba5bf75 100644
--- a/tests/ui/async-await/in-trait/early-bound-2.rs
+++ b/tests/ui/async-await/in-trait/early-bound-2.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.rs b/tests/ui/async-await/in-trait/fn-not-async-err.rs
index 9598d53bc..60077a7e0 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.stderr b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
index 579801d0f..cd085074a 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/fn-not-async-err.rs:11:5
+ --> $DIR/fn-not-async-err.rs:10:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
index 78017429f..ed626edc4 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
@@ -1,6 +1,6 @@
// edition: 2021
+// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -11,7 +11,6 @@ trait MyTrait {
impl MyTrait for i32 {
fn foo(&self) -> impl Future<Output = i32> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
deleted file mode 100644
index 37d9669c0..000000000
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/fn-not-async-err2.rs:13:22
- |
-LL | fn foo(&self) -> impl Future<Output = i32> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.rs b/tests/ui/async-await/in-trait/generics-mismatch.rs
index fc29783c0..51fdc2fe8 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.rs
+++ b/tests/ui/async-await/in-trait/generics-mismatch.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.stderr b/tests/ui/async-await/in-trait/generics-mismatch.stderr
index 3518aa05c..647cc698f 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
- --> $DIR/generics-mismatch.rs:11:18
+ --> $DIR/generics-mismatch.rs:10:18
|
LL | trait Foo {
| ---
diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs
index 52bceb3cc..0d8177c8e 100644
--- a/tests/ui/async-await/in-trait/implied-bounds.rs
+++ b/tests/ui/async-await/in-trait/implied-bounds.rs
@@ -1,12 +1,13 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait TcpStack {
type Connection<'a>: Sized where Self: 'a;
fn connect<'a>(&'a self) -> Self::Connection<'a>;
+
+ #[allow(async_fn_in_trait)]
async fn async_connect<'a>(&'a self) -> Self::Connection<'a>;
}
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
index 2fe6b473d..8443cbcf4 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
@@ -2,8 +2,6 @@
// build-fail
//~^^ ERROR cycle detected when computing layout of
-#![feature(async_fn_in_trait)]
-
fn main() {
let _ = async {
A.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
index 41e84466a..ce02c1e99 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
@@ -1,8 +1,8 @@
-error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
+error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35: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: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35:6}`, completing the cycle
+ = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:6:13: 8: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
diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs
index f61b34ed9..221b830fc 100644
--- a/tests/ui/async-await/in-trait/issue-102138.rs
+++ b/tests/ui/async-await/in-trait/issue-102138.rs
@@ -1,7 +1,6 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -10,6 +9,8 @@ async fn yield_now() {}
trait AsyncIterator {
type Item;
+
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item>;
}
diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs
index 9a35f6515..1f32cf691 100644
--- a/tests/ui/async-await/in-trait/issue-102219.rs
+++ b/tests/ui/async-await/in-trait/issue-102219.rs
@@ -2,9 +2,9 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait T {
+ #[allow(async_fn_in_trait)]
async fn foo();
}
diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs
index 49c3e9fee..c6321dfcb 100644
--- a/tests/ui/async-await/in-trait/issue-102310.rs
+++ b/tests/ui/async-await/in-trait/issue-102310.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait SpiDevice {
+ #[allow(async_fn_in_trait)]
async fn transaction<F, R>(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs
index e396df4e5..db2fa3026 100644
--- a/tests/ui/async-await/in-trait/issue-104678.rs
+++ b/tests/ui/async-await/in-trait/issue-104678.rs
@@ -1,13 +1,13 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
pub trait Pool {
type Conn;
+ #[allow(async_fn_in_trait)]
async fn async_callback<'a, F: FnOnce(&'a Self::Conn) -> Fut, Fut: Future<Output = ()>>(
&'a self,
callback: F,
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
index bb793df5d..b45d1758d 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn foo<'a>(&self);
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
index 86592269c..3841ab934 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:11:17
+ --> $DIR/lifetime-mismatch.rs:10:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.rs b/tests/ui/async-await/in-trait/missing-feature-flag.rs
index 34dd50a1c..898299a7d 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.rs
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.rs
@@ -1,6 +1,5 @@
// edition:2018
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
index f6aba1fcd..b7a9e98fc 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.stderr
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/missing-feature-flag.rs:12:1
+ --> $DIR/missing-feature-flag.rs:11:1
|
LL | async fn foo(_: T) -> &'static str;
| ----------------------------------- `foo` from trait
@@ -7,8 +7,14 @@ LL | async fn foo(_: T) -> &'static str;
LL | impl<T> MyTrait<T> for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+error[E0308]: mismatched types
+ --> $DIR/missing-feature-flag.rs:15:42
+ |
+LL | async fn foo(_: i32) -> &'static str {}
+ | ^^ expected `&str`, found `()`
+
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
- --> $DIR/missing-feature-flag.rs:16:5
+ --> $DIR/missing-feature-flag.rs:15:5
|
LL | impl<T> MyTrait<T> for MyStruct {}
| ------------------------------- parent `impl` is here
@@ -18,12 +24,6 @@ LL | async fn foo(_: i32) -> &'static str {}
|
= note: to specialize, `foo` in the parent `impl` must be marked `default`
-error[E0308]: mismatched types
- --> $DIR/missing-feature-flag.rs:16:42
- |
-LL | async fn foo(_: i32) -> &'static str {}
- | ^^ expected `&str`, found `()`
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0308, E0520.
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.rs b/tests/ui/async-await/in-trait/missing-send-bound.rs
index dbcc66576..596aece74 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.rs
+++ b/tests/ui/async-await/in-trait/missing-send-bound.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn bar();
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 7e59d94d4..139bd06c7 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -1,17 +1,17 @@
error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:14:20
+ --> $DIR/missing-send-bound.rs:13:20
|
LL | assert_is_send(test::<T>());
| ^^^^^^^^^^^ future returned by `test` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/missing-send-bound.rs:10:5
+ --> $DIR/missing-send-bound.rs:9:5
|
LL | T::bar().await;
| ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
note: required by a bound in `assert_is_send`
- --> $DIR/missing-send-bound.rs:18:27
+ --> $DIR/missing-send-bound.rs:17:27
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
diff --git a/tests/ui/async-await/in-trait/nested-rpit.rs b/tests/ui/async-await/in-trait/nested-rpit.rs
index 9cdc23bbc..ccae08acc 100644
--- a/tests/ui/async-await/in-trait/nested-rpit.rs
+++ b/tests/ui/async-await/in-trait/nested-rpit.rs
@@ -1,14 +1,13 @@
// edition: 2021
// check-pass
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
use std::marker::PhantomData;
trait Lockable<K, V> {
+ #[allow(async_fn_in_trait)]
async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>;
}
diff --git a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
index c4008f2b7..9eb396f32 100644
--- a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
+++ b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
@@ -5,12 +5,12 @@
// We were not normalizing opaques with escaping bound vars during codegen,
// leading to later errors during debuginfo computation.
-#![feature(async_fn_in_trait)]
#[derive(Clone, Copy)]
pub struct SharedState {}
pub trait State {
+ #[allow(async_fn_in_trait)]
async fn execute(self, shared_state: &SharedState);
}
diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs
index 441539e5d..5e5375b08 100644
--- a/tests/ui/async-await/in-trait/object-safety.rs
+++ b/tests/ui/async-await/in-trait/object-safety.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn foo(&self);
diff --git a/tests/ui/async-await/in-trait/object-safety.stderr b/tests/ui/async-await/in-trait/object-safety.stderr
index ccdf9d887..5b9fd98ac 100644
--- a/tests/ui/async-await/in-trait/object-safety.stderr
+++ b/tests/ui/async-await/in-trait/object-safety.stderr
@@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:10:12
+ --> $DIR/object-safety.rs:9:12
|
LL | let x: &dyn Foo = todo!();
| ^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:6:14
+ --> $DIR/object-safety.rs:5:14
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.rs b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
index a14dfceed..2286316dd 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait<'a, 'b, T> {
async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
index e573b8517..4694e6080 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
@@ -1,5 +1,5 @@
error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/return-not-existing-pair.rs:10:20
+ --> $DIR/return-not-existing-pair.rs:9:20
|
LL | impl<'a, 'b, T, U> MyTrait<T> for U {
| ^^^^^^^^^^ expected lifetime parameters
@@ -10,13 +10,13 @@ LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
| +++++++
error[E0412]: cannot find type `ConnImpl` in this scope
- --> $DIR/return-not-existing-pair.rs:6:48
+ --> $DIR/return-not-existing-pair.rs:5:48
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ^^^^^^^^ not found in this scope
error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/return-not-existing-pair.rs:12:5
+ --> $DIR/return-not-existing-pair.rs:11:5
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ------------------------------------------------------------ `&self` used in trait
@@ -25,7 +25,7 @@ LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
error[E0308]: mismatched types
- --> $DIR/return-not-existing-pair.rs:12:42
+ --> $DIR/return-not-existing-pair.rs:11:42
|
LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^ expected `(&U, &T)`, found `()`
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
index 254b9a782..d23ef093b 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(return_position_impl_trait_in_trait)]
struct Wrapper<T>(T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
index 059934d24..a66dd13bb 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/return-not-existing-type-wrapping-rpitit.rs:8:25
+ --> $DIR/return-not-existing-type-wrapping-rpitit.rs:7:25
|
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
| ^^^^^^^ not found in this scope
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.rs b/tests/ui/async-await/in-trait/return-type-suggestion.rs
index cdab4ea0f..2b19b24cf 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.rs
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
trait A {
async fn e() {
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
index 179c9ed93..363870619 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:7:9
+ --> $DIR/return-type-suggestion.rs:6:9
|
LL | Ok(())
| ^^^^^^ expected `()`, found `Result<(), _>`
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
index 33c005874..affe6cded 100644
--- 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
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
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
index 96b623d69..02bfee1a2 100644
--- 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
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
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
index 4319a1411..da51f10af 100644
--- 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
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-async-fn-in-trait.rs:14:16
+ --> $DIR/send-on-async-fn-in-trait.rs:13:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,7 +8,7 @@ LL | needs_send(T::test());
|
= 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
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
@@ -19,7 +19,7 @@ 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
+ --> $DIR/send-on-async-fn-in-trait.rs:15:16
|
LL | needs_send(T::test2());
| ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
@@ -28,7 +28,7 @@ LL | needs_send(T::test2());
|
= 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
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
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
index 83b69d72a..f0d750714 100644
--- 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
@@ -1,8 +1,6 @@
// aux-build:foreign-async-fn.rs
// edition:2021
-#![feature(async_fn_in_trait)]
-
extern crate foreign_async_fn;
use foreign_async_fn::Foo;
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
index f337a04ba..482707351 100644
--- 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
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:9:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,12 +8,12 @@ LL | needs_send(T::test());
|
= 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
+ --> $DIR/auxiliary/foreign-async-fn.rs:4:5
|
LL | async fn test();
| ^^^^^^^^^^^^^^^^
note: required by a bound in `needs_send`
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:8:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.rs b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
new file mode 100644
index 000000000..c06f9f005
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
@@ -0,0 +1,19 @@
+// edition: 2021
+
+pub(crate) trait Inbox<M> {
+ async fn next(self) -> M;
+}
+
+pub(crate) trait Actor: Sized {
+ type Message;
+
+ async fn on_mount(self, _: impl Inbox<Self::Message>);
+}
+
+impl<'a> Actor for () {
+//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ type Message = &'a ();
+ async fn on_mount(self, _: impl Inbox<&'a ()>) {}
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
new file mode 100644
index 000000000..2cb0da2e8
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/unconstrained-impl-region.rs:13:6
+ |
+LL | impl<'a> Actor for () {
+ | ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/async-await/in-trait/warn.rs b/tests/ui/async-await/in-trait/warn.rs
new file mode 100644
index 000000000..71f3822df
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.rs
@@ -0,0 +1,22 @@
+// edition: 2021
+
+#![deny(async_fn_in_trait)]
+
+pub trait Foo {
+ async fn not_send();
+ //~^ ERROR use of `async fn` in public traits is discouraged
+}
+
+mod private {
+ pub trait FooUnreachable {
+ async fn not_send();
+ // No warning
+ }
+}
+
+pub(crate) trait FooCrate {
+ async fn not_send();
+ // No warning
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/warn.stderr b/tests/ui/async-await/in-trait/warn.stderr
new file mode 100644
index 000000000..d0278628c
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.stderr
@@ -0,0 +1,20 @@
+error: use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified
+ --> $DIR/warn.rs:6:5
+ |
+LL | async fn not_send();
+ | ^^^^^
+ |
+ = note: you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`
+note: the lint level is defined here
+ --> $DIR/warn.rs:3:9
+ |
+LL | #![deny(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+help: you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change
+ |
+LL - async fn not_send();
+LL + fn not_send() -> impl std::future::Future<Output = ()> + Send;
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-108572.fixed b/tests/ui/async-await/issue-108572.fixed
new file mode 100644
index 000000000..8f0133d97
--- /dev/null
+++ b/tests/ui/async-await/issue-108572.fixed
@@ -0,0 +1,16 @@
+// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
+
+use std::future::Future;
+fn foo() -> impl Future<Output=()> {
+ async { }
+}
+
+fn bar(cx: &mut std::task::Context<'_>) {
+ let fut = foo();
+ let mut pinned = std::pin::pin!(fut);
+ pinned.as_mut().poll(cx);
+ //~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
+}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs
index efcb8b8eb..359658076 100644
--- a/tests/ui/async-await/issue-108572.rs
+++ b/tests/ui/async-await/issue-108572.rs
@@ -1,12 +1,15 @@
// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
use std::future::Future;
fn foo() -> impl Future<Output=()> {
async { }
}
-fn main() {
+fn bar(cx: &mut std::task::Context<'_>) {
let fut = foo();
- fut.poll();
+ fut.poll(cx);
//~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr
index 0dbcf4d66..588669092 100644
--- a/tests/ui/async-await/issue-108572.stderr
+++ b/tests/ui/async-await/issue-108572.stderr
@@ -1,11 +1,16 @@
error[E0599]: no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope
- --> $DIR/issue-108572.rs:10:9
+ --> $DIR/issue-108572.rs:12:9
|
-LL | fut.poll();
+LL | fut.poll(cx);
| ^^^^ method not found in `impl Future<Output = ()>`
|
= help: method `poll` found on `Pin<&mut impl Future<Output = ()>>`, see documentation for `std::pin::Pin`
= help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice
+help: consider pinning the expression
+ |
+LL ~ let mut pinned = std::pin::pin!(fut);
+LL ~ pinned.as_mut().poll(cx);
+ |
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs
index 61f6ed1b7..2cda40e9e 100644
--- a/tests/ui/async-await/issue-60709.rs
+++ b/tests/ui/async-await/issue-60709.rs
@@ -1,5 +1,5 @@
// This used to compile the future down to ud2, due to uninhabited types being
-// handled incorrectly in generators.
+// handled incorrectly in coroutines.
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
// run-pass
diff --git a/tests/ui/async-await/issue-61793.rs b/tests/ui/async-await/issue-61793.rs
index 9180e1d81..bb861cf60 100644
--- a/tests/ui/async-await/issue-61793.rs
+++ b/tests/ui/async-await/issue-61793.rs
@@ -1,5 +1,5 @@
// This testcase used to ICE in codegen due to inconsistent field reordering
-// in the generator state, claiming a ZST field was after a non-ZST field,
+// in the coroutine state, claiming a ZST field was after a non-ZST field,
// while those two fields were at the same offset (which is impossible).
// That is, memory ordering of `(X, ())`, but offsets of `((), X)`.
diff --git a/tests/ui/async-await/issue-62658.rs b/tests/ui/async-await/issue-62658.rs
index d0af01e0c..8e6d070ea 100644
--- a/tests/ui/async-await/issue-62658.rs
+++ b/tests/ui/async-await/issue-62658.rs
@@ -1,4 +1,4 @@
-// This test created a generator whose size was not rounded to a multiple of its
+// This test created a coroutine whose size was not rounded to a multiple of its
// alignment. This caused an assertion error in codegen.
// build-pass
diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 573da1034..4bbb7731b 100644
--- a/tests/ui/async-await/issue-64130-3-other.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output
--> $DIR/issue-64130-3-other.rs:25:12
|
LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
+ | -------------- within this `impl Future<Output = ()>`
...
LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
diff --git a/tests/ui/async-await/issue-66312.rs b/tests/ui/async-await/issue-66312.rs
index 9224971ec..fbc58697d 100644
--- a/tests/ui/async-await/issue-66312.rs
+++ b/tests/ui/async-await/issue-66312.rs
@@ -6,7 +6,7 @@ trait Test<T> {
async fn f() {
let x = Some(2);
- if x.is_some() {
+ if x.is_some() { //~ ERROR mismatched types
println!("Some");
}
}
diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr
index 80d294a10..dad5807cb 100644
--- a/tests/ui/async-await/issue-66312.stderr
+++ b/tests/ui/async-await/issue-66312.stderr
@@ -7,6 +7,13 @@ LL | fn is_some(self: T);
= note: type of `self` must be `Self` or a type that dereferences to it
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/issue-66312.rs:9:8
+ |
+LL | if x.is_some() {
+ | ^^^^^^^^^^^ expected `bool`, found `()`
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0307, E0308.
+For more information about an error, try `rustc --explain E0307`.
diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr
index 17b619ebe..1cd8beac2 100644
--- a/tests/ui/async-await/issue-68112.stderr
+++ b/tests/ui/async-await/issue-68112.stderr
@@ -45,7 +45,7 @@ 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: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-68112.rs:47:31
|
LL | async fn ready2<T>(t: T) -> T {
diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr
index ab834daa8..d0605d7e1 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.stderr
@@ -18,7 +18,7 @@ note: required because it's used within this closure
|
LL | baz(|| async {
| ^^
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-70935-complex-spans.rs:12:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs
index c43ce2cad..2d16f1936 100644
--- a/tests/ui/async-await/issue-73137.rs
+++ b/tests/ui/async-await/issue-73137.rs
@@ -28,7 +28,7 @@ fn main() {
a: async { 0 }.await,
};
- // An error in the generator transform caused `b` to be overwritten with `a` when `b` was
+ // An error in the coroutine transform caused `b` to be overwritten with `a` when `b` was
// borrowed.
nop(&action.b);
assert_ne!(0usize, unsafe { std::mem::transmute(action.b) });
diff --git a/tests/ui/async-await/issues/issue-51719.rs b/tests/ui/async-await/issues/issue-51719.rs
index 09241f982..1cf388cd8 100644
--- a/tests/ui/async-await/issues/issue-51719.rs
+++ b/tests/ui/async-await/issues/issue-51719.rs
@@ -1,10 +1,10 @@
// edition:2018
//
-// Tests that the .await syntax can't be used to make a generator
+// Tests that the .await syntax can't be used to make a coroutine
async fn foo() {}
-fn make_generator() {
+fn make_coroutine() {
let _gen = || foo().await;
//~^ ERROR `await` is only allowed inside `async` functions and blocks
}
diff --git a/tests/ui/async-await/issues/issue-59972.rs b/tests/ui/async-await/issues/issue-59972.rs
index c2e24a96b..f60ec04c3 100644
--- a/tests/ui/async-await/issues/issue-59972.rs
+++ b/tests/ui/async-await/issues/issue-59972.rs
@@ -1,4 +1,4 @@
-// Incorrect handling of uninhabited types could cause us to mark generator
+// Incorrect handling of uninhabited types could cause us to mark coroutine
// types as entirely uninhabited, when they were in fact constructible. This
// caused us to hit "unreachable" code (illegal instruction on x86).
diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
index 66a3b07c3..ee28a2733 100644
--- a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
+++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
@@ -19,7 +19,7 @@ async fn async_nop(_: &u8) {}
pub type ServeFut = impl Future<Output=()>;
-// Late bound regions occur in the generator witness type here.
+// Late bound regions occur in the coroutine witness type here.
fn serve() -> ServeFut {
async move {
let x = 5;
diff --git a/tests/ui/async-await/issues/issue-64477-2.rs b/tests/ui/async-await/issues/issue-64477-2.rs
index 2360b57cc..53ec3b065 100644
--- a/tests/ui/async-await/issues/issue-64477-2.rs
+++ b/tests/ui/async-await/issues/issue-64477-2.rs
@@ -2,7 +2,7 @@
//
// In the past, the code generated by `format!` produced temporaries in the surrounding scope that
// borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which
-// meant that when `format!` was used in an async block, the resulting generator was not `Send`.
+// meant that when `format!` was used in an async block, the resulting coroutine was not `Send`.
// See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details
// and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example.
//
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
index 725caddae..9ed7a5d21 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead.
// run-fail
@@ -8,7 +8,7 @@
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
async fn foo() {
}
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
index 5909c3a5e..51e9a54e4 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead. Should also test what happens when it panics.
// run-fail
@@ -8,7 +8,7 @@
// edition:2018
// ignore-wasm no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::panic;
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
index 9fc5667d6..e16b86f95 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
@@ -1,17 +1,17 @@
-// issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should
-// be talking about `async fn`s instead. Regression test added to make sure generators still
+// issue 65419 - Attempting to run an `async fn` after completion mentions coroutines when it should
+// be talking about `async fn`s instead. Regression test added to make sure coroutines still
// panic when resumed after completion.
// run-fail
-// error-pattern:generator resumed after completion
+// error-pattern:coroutine resumed after completion
// edition:2018
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
- ops::Generator,
+ ops::Coroutine,
pin::Pin,
};
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index f36269e8f..2a712aee9 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,14 +6,14 @@ LL | g(issue_67893::run())
| |
| required by a bound introduced by this call
|
- ::: $DIR/auxiliary/issue_67893.rs:9:20
+ ::: $DIR/auxiliary/issue_67893.rs:9:1
|
LL | pub async fn run() {
- | - within this `impl Future<Output = ()>`
+ | ------------------ within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
= 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
+note: required because it's used within this `async` fn body
--> $DIR/auxiliary/issue_67893.rs:9:20
|
LL | pub async fn run() {
diff --git a/tests/ui/async-await/issues/issue-95307.rs b/tests/ui/async-await/issues/issue-95307.rs
index f7e48070c..35dce2c62 100644
--- a/tests/ui/async-await/issues/issue-95307.rs
+++ b/tests/ui/async-await/issues/issue-95307.rs
@@ -5,8 +5,7 @@
pub trait C {
async fn new() -> [u8; _];
- //~^ ERROR: functions in traits cannot be declared `async`
- //~| ERROR: using `_` for array lengths is unstable
+ //~^ ERROR: using `_` for array lengths is unstable
//~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment
}
diff --git a/tests/ui/async-await/issues/issue-95307.stderr b/tests/ui/async-await/issues/issue-95307.stderr
index a497cebe3..fdc6d5de1 100644
--- a/tests/ui/async-await/issues/issue-95307.stderr
+++ b/tests/ui/async-await/issues/issue-95307.stderr
@@ -1,16 +1,3 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-95307.rs:7:5
- |
-LL | async fn new() -> [u8; _];
- | -----^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/issue-95307.rs:7:28
|
@@ -26,7 +13,6 @@ LL | async fn new() -> [u8; _];
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0658, E0706.
-For more information about an error, try `rustc --explain E0658`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index f789ad2a0..9442609e8 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,17 +1,17 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
|
LL | async fn rec_1() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:1
|
LL | async fn rec_2() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/no-async-const.rs b/tests/ui/async-await/no-async-const.rs
index 963460c11..c9941d1c5 100644
--- a/tests/ui/async-await/no-async-const.rs
+++ b/tests/ui/async-await/no-async-const.rs
@@ -3,3 +3,4 @@
pub async const fn x() {}
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
+//~| ERROR functions cannot be both `const` and `async`
diff --git a/tests/ui/async-await/no-async-const.stderr b/tests/ui/async-await/no-async-const.stderr
index a51dc88a4..524d778c0 100644
--- a/tests/ui/async-await/no-async-const.stderr
+++ b/tests/ui/async-await/no-async-const.stderr
@@ -9,5 +9,14 @@ LL | pub async const fn x() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/no-async-const.rs:4:5
+ |
+LL | pub async const fn x() {}
+ | ----^^^^^-^^^^^----------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/no-unsafe-async.rs b/tests/ui/async-await/no-unsafe-async.rs
index f40154e16..7c6811d81 100644
--- a/tests/ui/async-await/no-unsafe-async.rs
+++ b/tests/ui/async-await/no-unsafe-async.rs
@@ -9,3 +9,5 @@ impl S {
#[cfg(FALSE)]
unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
+
+fn main() {}
diff --git a/tests/ui/async-await/no-unsafe-async.stderr b/tests/ui/async-await/no-unsafe-async.stderr
index f23d17d6b..49b112f93 100644
--- a/tests/ui/async-await/no-unsafe-async.stderr
+++ b/tests/ui/async-await/no-unsafe-async.stderr
@@ -1,16 +1,11 @@
error: expected one of `extern` or `fn`, found keyword `async`
--> $DIR/no-unsafe-async.rs:7:12
|
-LL | impl S {
- | - while parsing this item list starting here
-LL | #[cfg(FALSE)]
LL | unsafe async fn g() {}
| -------^^^^^
| | |
| | expected one of `extern` or `fn`
| help: `async` must come before `unsafe`: `async unsafe`
-LL | }
- | - the item list ends here
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index 3fed7c972..1004303d5 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,7 +1,7 @@
// build-pass
// edition:2018
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
foo();
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs
index 75acb442e..815cc916b 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.rs
+++ b/tests/ui/async-await/partial-drop-partial-reinit.rs
@@ -26,7 +26,7 @@ impl Drop for NotSend {
impl !Send for NotSend {}
async fn foo() {
- //~^ NOTE used within this `async fn` body
+ //~^ NOTE used within this `async` fn body
//~| NOTE within this `impl Future
let mut x = (NotSend {},);
drop(x.0);
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr
index 85e1830c7..310a29239 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.stderr
+++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr
@@ -7,12 +7,12 @@ LL | gimme_send(foo());
| required by a bound introduced by this call
...
LL | async fn foo() {
- | - within this `impl Future<Output = ()>`
+ | -------------- 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: `(NotSend,)`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/partial-drop-partial-reinit.rs:28:16
|
LL | async fn foo() {
diff --git a/tests/ui/async-await/pin-needed-to-poll.stderr b/tests/ui/async-await/pin-needed-to-poll.stderr
index b1f4a73aa..964709dae 100644
--- a/tests/ui/async-await/pin-needed-to-poll.stderr
+++ b/tests/ui/async-await/pin-needed-to-poll.stderr
@@ -6,14 +6,12 @@ LL | struct Sleep;
...
LL | self.sleep.poll(cx)
| ^^^^ method not found in `Sleep`
- --> $SRC_DIR/core/src/future/future.rs:LL:COL
|
- = note: the method is available for `Pin<&mut Sleep>` here
+help: consider pinning the expression
|
-help: consider wrapping the receiver expression with the appropriate type
+LL ~ let mut pinned = std::pin::pin!(self.sleep);
+LL ~ pinned.as_mut().poll(cx)
|
-LL | Pin::new(&mut self.sleep).poll(cx)
- | +++++++++++++ +
error: aborting due to previous error
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 63f64f445..64917329c 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:5:40
+ --> $DIR/recursive-async-impl-trait-type.rs:5:1
|
LL | async fn recursive_async_function() -> () {
- | ^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.rs b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
index 0ecbca5c1..07f2130ba 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
@@ -2,7 +2,6 @@
// known-bug: #110963
#![feature(return_type_notation)]
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check<'a: 'a>(&'a mut self) -> bool;
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 969094a2c..feae2698e 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
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -21,13 +21,13 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -40,10 +40,11 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
index 17b5d775d..7533844fb 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-late.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
@@ -3,7 +3,6 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check(&mut self) -> bool;
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
index 8f4590203..6a47f1ab9 100644
--- 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
@@ -1,5 +1,5 @@
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
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= 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
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
@@ -17,7 +17,7 @@ LL | build(Bar);
|
= 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
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ------^^^-
@@ -25,7 +25,7 @@ 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
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:19:39
|
LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
| ^^^^ required by this bound in `build`
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
index 6fab71787..4837815fa 100644
--- 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
@@ -1,5 +1,5 @@
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
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
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
index b2cd9707d..e581e5ffd 100644
--- 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
@@ -4,7 +4,6 @@
//[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
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
index e55104ee9..0ceb62d44 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
index 8626648b5..4a52e807b 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/rtn-implied-in-supertrait.rs:4:68
+ --> $DIR/rtn-implied-in-supertrait.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
index 028e526b5..891b30638 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
@@ -1,6 +1,6 @@
// edition:2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super1<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
index 5bc8dbde4..d9caab587 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound-ambig.rs:3:31
+ --> $DIR/super-method-bound-ambig.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs
index 58ea3578d..6025cda2f 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
index ac0668d3c..64fda71c1 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound.rs:4:31
+ --> $DIR/super-method-bound.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
index 19bcfe304..a85596a9f 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.rs
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
trait IntFactory {
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
index c8cec4946..eb6917fc7 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/supertrait-bound.rs:3:49
+ --> $DIR/supertrait-bound.rs:3:12
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
index 7871a2fed..ac320cfc6 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
index 76928c5d7..da94d9d1e 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/ty-or-ct-params.rs:3:31
+ --> $DIR/ty-or-ct-params.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+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
diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs
index 4e9e7309b..2ec006da3 100644
--- a/tests/ui/async-await/send-bound-async-closure.rs
+++ b/tests/ui/async-await/send-bound-async-closure.rs
@@ -2,7 +2,7 @@
// check-pass
// This test verifies that we do not create a query cycle when typechecking has several inference
-// variables that point to the same generator interior type.
+// variables that point to the same coroutine interior type.
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs
index 937723ca7..45b18d56b 100644
--- a/tests/ui/async-await/task-context-arg.rs
+++ b/tests/ui/async-await/task-context-arg.rs
@@ -10,7 +10,7 @@
use std::future::Future;
// The compiler produces a closure as part of this function. That closure initially takes an
-// argument _task_context. Later, when the MIR for that closure is transformed into a generator
+// argument _task_context. Later, when the MIR for that closure is transformed into a coroutine
// state machine, _task_context is demoted to not be an argument, but just part of an unnamed
// argument. If we emit debug info saying that both _task_context and the unnamed argument are both
// argument number 2, then LLVM will fail with "conflicting debug info for argument". See
diff --git a/tests/ui/async-await/unnecessary-await.rs b/tests/ui/async-await/unnecessary-await.rs
index cd1e28714..93b68f018 100644
--- a/tests/ui/async-await/unnecessary-await.rs
+++ b/tests/ui/async-await/unnecessary-await.rs
@@ -31,4 +31,9 @@ async fn with_macros() {
f!(());
}
+// Regression test for issue #117014.
+async fn desugaring_span_ctxt() {
+ for x in [] {}.await //~ ERROR `()` is not a future
+}
+
fn main() {}
diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr
index 9a2a035b2..620370a61 100644
--- a/tests/ui/async-await/unnecessary-await.stderr
+++ b/tests/ui/async-await/unnecessary-await.stderr
@@ -49,6 +49,19 @@ LL | f!(());
= note: required for `()` to implement `IntoFuture`
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 3 previous errors
+error[E0277]: `()` is not a future
+ --> $DIR/unnecessary-await.rs:36:20
+ |
+LL | for x in [] {}.await
+ | -^^^^^
+ | ||
+ | |`()` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/atomic-from-mut-not-available.stderr b/tests/ui/atomic-from-mut-not-available.stderr
index d1ebca8a2..c15d19b15 100644
--- a/tests/ui/atomic-from-mut-not-available.stderr
+++ b/tests/ui/atomic-from-mut-not-available.stderr
@@ -3,6 +3,10 @@ error[E0599]: no function or associated item named `from_mut` found for struct `
|
LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64);
| ^^^^^^^^ function or associated item not found in `AtomicU64`
+ |
+note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::new` which returns `AtomicU64`
+ --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL
+ = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/attributes/const-stability-on-macro.rs b/tests/ui/attributes/const-stability-on-macro.rs
index 412af195d..af268ccd5 100644
--- a/tests/ui/attributes/const-stability-on-macro.rs
+++ b/tests/ui/attributes/const-stability-on-macro.rs
@@ -1,7 +1,7 @@
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "foo", since = "0")]
+#[rustc_const_stable(feature = "foo", since = "3.3.3")]
//~^ ERROR macros cannot have const stability attributes
macro_rules! foo {
() => {};
diff --git a/tests/ui/attributes/const-stability-on-macro.stderr b/tests/ui/attributes/const-stability-on-macro.stderr
index c3da02c79..28f31e3d4 100644
--- a/tests/ui/attributes/const-stability-on-macro.stderr
+++ b/tests/ui/attributes/const-stability-on-macro.stderr
@@ -1,8 +1,8 @@
error: macros cannot have const stability attributes
--> $DIR/const-stability-on-macro.rs:4:1
|
-LL | #[rustc_const_stable(feature = "foo", since = "0")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
+LL | #[rustc_const_stable(feature = "foo", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
LL |
LL | macro_rules! foo {
| ---------------- const stability attribute affects this macro
diff --git a/tests/ui/attributes/statement-attribute-validation.rs b/tests/ui/attributes/statement-attribute-validation.rs
new file mode 100644
index 000000000..31407364a
--- /dev/null
+++ b/tests/ui/attributes/statement-attribute-validation.rs
@@ -0,0 +1,39 @@
+// test for #117058 - check that attributes are validated on various kinds of statements.
+
+struct A;
+
+fn func() {}
+
+fn main() {
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ if true {
+ } else {
+ }
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ (1);
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ match 1 {
+ _ => {}
+ }
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ while false {}
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ {}
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ A {};
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ func();
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ A;
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ loop {}
+}
diff --git a/tests/ui/attributes/statement-attribute-validation.stderr b/tests/ui/attributes/statement-attribute-validation.stderr
new file mode 100644
index 000000000..06f447be5
--- /dev/null
+++ b/tests/ui/attributes/statement-attribute-validation.stderr
@@ -0,0 +1,56 @@
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:8:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:13:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:16:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:21:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:24:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:27:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:30:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:33:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:36:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
index a1fb4d678..225b8e8f3 100644
--- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
+++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
@@ -3,11 +3,15 @@ error: `unix_sigpipe` attribute cannot be used at crate level
|
LL | #![unix_sigpipe = "inherit"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[unix_sigpipe = "inherit"]
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - #![unix_sigpipe = "inherit"]
+LL + #[unix_sigpipe = "inherit"]
+ |
error: aborting due to previous error
diff --git a/tests/ui/auto-traits/has-arguments.rs b/tests/ui/auto-traits/has-arguments.rs
new file mode 100644
index 000000000..f579eb677
--- /dev/null
+++ b/tests/ui/auto-traits/has-arguments.rs
@@ -0,0 +1,10 @@
+#![feature(auto_traits)]
+
+auto trait Trait1<'outer> {}
+//~^ ERROR auto traits cannot have generic parameters
+
+fn f<'a>(x: impl Trait1<'a>) {}
+
+fn main() {
+ f("");
+}
diff --git a/tests/ui/auto-traits/has-arguments.stderr b/tests/ui/auto-traits/has-arguments.stderr
new file mode 100644
index 000000000..3bba74bad
--- /dev/null
+++ b/tests/ui/auto-traits/has-arguments.stderr
@@ -0,0 +1,11 @@
+error[E0567]: auto traits cannot have generic parameters
+ --> $DIR/has-arguments.rs:3:18
+ |
+LL | auto trait Trait1<'outer> {}
+ | ------^^^^^^^^ help: remove the parameters
+ | |
+ | auto trait cannot have generic parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0567`.
diff --git a/tests/ui/auto-traits/pre-cfg.rs b/tests/ui/auto-traits/pre-cfg.rs
new file mode 100644
index 000000000..e6e840dcb
--- /dev/null
+++ b/tests/ui/auto-traits/pre-cfg.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+#[cfg(FALSE)]
+auto trait Foo {}
+//~^ WARN `auto` traits are unstable
+//~| WARN unstable syntax can change at any point in the future, causing a hard error!
+
+fn main() {}
diff --git a/tests/ui/auto-traits/pre-cfg.stderr b/tests/ui/auto-traits/pre-cfg.stderr
new file mode 100644
index 000000000..6efa05b43
--- /dev/null
+++ b/tests/ui/auto-traits/pre-cfg.stderr
@@ -0,0 +1,13 @@
+warning: `auto` traits are unstable
+ --> $DIR/pre-cfg.rs:4:1
+ |
+LL | auto trait Foo {}
+ | ^^^^
+ |
+ = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
+ = help: add `#![feature(auto_traits)]` to the crate attributes to enable
+ = warning: unstable syntax can change at any point in the future, causing a hard error!
+ = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/binding/issue-53114-borrow-checks.rs b/tests/ui/binding/issue-53114-borrow-checks.rs
index 7646472f4..6ab1f4f47 100644
--- a/tests/ui/binding/issue-53114-borrow-checks.rs
+++ b/tests/ui/binding/issue-53114-borrow-checks.rs
@@ -1,8 +1,9 @@
+// check-pass
// Issue #53114: NLL's borrow check had some deviations from the old borrow
// checker, and both had some deviations from our ideal state. This test
// captures the behavior of how `_` bindings are handled with respect to how we
// flag expressions that are meant to request unsafe blocks.
-#![allow(irrefutable_let_patterns)]
+#![allow(irrefutable_let_patterns, dropping_references)]
struct M;
fn let_wild_gets_moved_expr() {
@@ -19,29 +20,23 @@ fn let_wild_gets_moved_expr() {
fn match_moved_expr_to_wild() {
let m = M;
drop(m);
- match m { _ => { } } // #53114: should eventually be accepted too
- //~^ ERROR [E0382]
+ match m { _ => { } } // #53114: accepted too
let mm = (M, M); // variation on above with `_` in substructure
match mm { (_x, _) => { } }
match mm { (_, _y) => { } }
- //~^ ERROR [E0382]
match mm { (_, _) => { } }
- //~^ ERROR [E0382]
}
fn if_let_moved_expr_to_wild() {
let m = M;
drop(m);
- if let _ = m { } // #53114: should eventually be accepted too
- //~^ ERROR [E0382]
+ if let _ = m { } // #53114: accepted too
let mm = (M, M); // variation on above with `_` in substructure
if let (_x, _) = mm { }
if let (_, _y) = mm { }
- //~^ ERROR [E0382]
if let (_, _) = mm { }
- //~^ ERROR [E0382]
}
fn let_wild_gets_borrowed_expr() {
diff --git a/tests/ui/binding/issue-53114-borrow-checks.stderr b/tests/ui/binding/issue-53114-borrow-checks.stderr
deleted file mode 100644
index 0ec2ae883..000000000
--- a/tests/ui/binding/issue-53114-borrow-checks.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0382]: use of moved value: `m`
- --> $DIR/issue-53114-borrow-checks.rs:22:11
- |
-LL | let m = M;
- | - move occurs because `m` has type `M`, which does not implement the `Copy` trait
-LL | drop(m);
- | - value moved here
-LL | match m { _ => { } } // #53114: should eventually be accepted too
- | ^ value used here after move
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:27:11
- |
-LL | match mm { (_x, _) => { } }
- | -- value partially moved here
-LL | match mm { (_, _y) => { } }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | match mm { (ref _x, _) => { } }
- | +++
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:29:11
- |
-LL | match mm { (_, _y) => { } }
- | -- value partially moved here
-LL |
-LL | match mm { (_, _) => { } }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | match mm { (_, ref _y) => { } }
- | +++
-
-error[E0382]: use of moved value: `m`
- --> $DIR/issue-53114-borrow-checks.rs:36:16
- |
-LL | let m = M;
- | - move occurs because `m` has type `M`, which does not implement the `Copy` trait
-LL | drop(m);
- | - value moved here
-LL | if let _ = m { } // #53114: should eventually be accepted too
- | ^ value used here after move
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:41:22
- |
-LL | if let (_x, _) = mm { }
- | -- value partially moved here
-LL | if let (_, _y) = mm { }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | if let (ref _x, _) = mm { }
- | +++
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:43:21
- |
-LL | if let (_, _y) = mm { }
- | -- value partially moved here
-LL |
-LL | if let (_, _) = mm { }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | if let (_, ref _y) = mm { }
- | +++
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.fixed b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
new file mode 100644
index 000000000..b47372c90
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo();
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.rs b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
new file mode 100644
index 000000000..14671de7e
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo()
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.stderr b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
new file mode 100644
index 000000000..fca042b1c
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
@@ -0,0 +1,17 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/false-binop-caused-by-missing-semi.rs:7:8
+ |
+LL | / foo()
+LL | | *x = 0;
+ | | - ^
+ | |______|
+ | cannot assign to this expression
+ |
+help: you might have meant to write a semicolon here
+ |
+LL | foo();
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/block-result/block-must-not-have-result-res.stderr b/tests/ui/block-result/block-must-not-have-result-res.stderr
index 0080d06dd..b7427462b 100644
--- a/tests/ui/block-result/block-must-not-have-result-res.stderr
+++ b/tests/ui/block-result/block-must-not-have-result-res.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/block-must-not-have-result-res.rs:5:9
|
LL | fn drop(&mut self) {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | true
| ^^^^ expected `()`, found `bool`
diff --git a/tests/ui/block-result/issue-20862.stderr b/tests/ui/block-result/issue-20862.stderr
index 17b524fe3..1df3a6836 100644
--- a/tests/ui/block-result/issue-20862.stderr
+++ b/tests/ui/block-result/issue-20862.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-20862.rs:2:5
|
LL | fn foo(x: i32) {
- | - help: a return type might be missing here: `-> _`
+ | - help: a return type might be missing here: `-> _`
LL | |y| x + y
| ^^^^^^^^^ expected `()`, found closure
|
diff --git a/tests/ui/block-result/issue-22645.stderr b/tests/ui/block-result/issue-22645.stderr
index 677b40aaa..1064848f5 100644
--- a/tests/ui/block-result/issue-22645.stderr
+++ b/tests/ui/block-result/issue-22645.stderr
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
--> $DIR/issue-22645.rs:15:3
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | let b = Bob + 3.5;
LL | b + 3
| ^^^^^ expected `()`, found `Bob`
diff --git a/tests/ui/block-result/issue-5500.stderr b/tests/ui/block-result/issue-5500.stderr
index 8cd4bd658..417991e9e 100644
--- a/tests/ui/block-result/issue-5500.stderr
+++ b/tests/ui/block-result/issue-5500.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-5500.rs:2:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | &panic!()
| ^^^^^^^^^ expected `()`, found `&_`
|
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs
new file mode 100644
index 000000000..05884f674
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs
@@ -0,0 +1,14 @@
+trait Trait {
+ type Gat<'a: 'b, 'b: 'c, 'c>: 'c;
+}
+
+fn get_func<'a, T: Trait>(_: &'a str) -> fn(T::Gat<'a, '_, 'static>) {
+ loop {}
+}
+
+fn test<T: Trait>() {
+ let func = get_func::<T>(&String::new()); //~ ERROR temporary value dropped
+ drop(func);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr
new file mode 100644
index 000000000..7fd0cb9bb
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr
@@ -0,0 +1,19 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/escaping-bounds-2.rs:10:31
+ |
+LL | let func = get_func::<T>(&String::new());
+ | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+LL | drop(func);
+ | ---- borrow later used here
+ |
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = String::new();
+LL ~ let func = get_func::<T>(&binding);
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs
new file mode 100644
index 000000000..3ccdc78e6
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+// Ensure that we don't ICE when an alias that has escaping bound vars is
+// required to be live. This is because the code that allows us to deduce an
+// appropriate outlives bound for a given alias type (in this test, a
+// projection) does not handle aliases with escaping bound vars.
+// See <https://github.com/rust-lang/rust/issues/117455>.
+
+trait Foo {
+ type Assoc<'a, 'b>: 'static;
+}
+
+struct MentionsLifetimeAndType<'a, T>(&'a (), T);
+
+fn foo<'a, 'b, T: Foo>(_: <T as Foo>::Assoc<'a, 'b>) {}
+
+fn test<'b, T: Foo>() {
+ let y: MentionsLifetimeAndType<'_, for<'a> fn(<T as Foo>::Assoc<'a, 'b>)> =
+ MentionsLifetimeAndType(&(), foo);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/gat-static.rs b/tests/ui/borrowck/alias-liveness/gat-static.rs
new file mode 100644
index 000000000..92153124a
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/gat-static.rs
@@ -0,0 +1,29 @@
+// check-pass
+
+trait Foo {
+ type Assoc<'a>
+ where
+ Self: 'a;
+
+ fn assoc(&mut self) -> Self::Assoc<'_>;
+}
+
+fn overlapping_mut<T>(mut t: T)
+where
+ T: Foo,
+ for<'a> T::Assoc<'a>: 'static,
+{
+ let a = t.assoc();
+ let b = t.assoc();
+}
+
+fn live_past_borrow<T>(mut t: T)
+where
+ T: Foo,
+ for<'a> T::Assoc<'a>: 'static {
+ let x = t.assoc();
+ drop(t);
+ drop(x);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs
new file mode 100644
index 000000000..1f26c7bab
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs
@@ -0,0 +1,16 @@
+// known-bug: #42940
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Outlives<'a>: 'a {}
+impl<'a, T: 'a> Outlives<'a> for T {}
+
+// Test that we treat `for<'a> Opaque: 'a` as `Opaque: 'static`
+fn test<'o>(v: &'o Vec<i32>) -> impl Captures<'o> + for<'a> Outlives<'a> {}
+
+fn statik() -> impl Sized {
+ test(&vec![])
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr
new file mode 100644
index 000000000..58a42d8af
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr
@@ -0,0 +1,16 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/higher-ranked-outlives-for-capture.rs:13:11
+ |
+LL | test(&vec![])
+ | ------^^^^^^-
+ | | |
+ | | creates a temporary value which is freed while still in use
+ | argument requires that borrow lasts for `'static`
+LL | }
+ | - temporary value is freed at the end of this statement
+ |
+ = note: this error originates in the macro `vec` (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 E0716`.
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked.rs b/tests/ui/borrowck/alias-liveness/higher-ranked.rs
new file mode 100644
index 000000000..afd0d3b31
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Outlives<'a>: 'a {}
+impl<'a, T: 'a> Outlives<'a> for T {}
+
+// Test that we treat `for<'a> Opaque: 'a` as `Opaque: 'static`
+fn test<'o>(v: &'o Vec<i32>) -> impl Captures<'o> + for<'a> Outlives<'a> {}
+
+fn opaque_doesnt_use_temporary() {
+ let a = test(&vec![]);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-capture.rs b/tests/ui/borrowck/alias-liveness/opaque-capture.rs
new file mode 100644
index 000000000..f4ca2728b
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-capture.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+// Check that opaques capturing early and late-bound vars correctly mark
+// regions required to be live using the item bounds.
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn captures_temp_late<'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}
+fn captures_temp_early<'a: 'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}
+
+fn test() {
+ let x = captures_temp_early(&vec![]);
+ let y = captures_temp_late(&vec![]);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.rs b/tests/ui/borrowck/alias-liveness/opaque-type-param.rs
new file mode 100644
index 000000000..a292463b2
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.rs
@@ -0,0 +1,14 @@
+// known-bug: #42940
+
+trait Trait {}
+impl Trait for () {}
+
+fn foo<'a>(s: &'a str) -> impl Trait + 'static {
+ bar(s)
+}
+
+fn bar<P: AsRef<str>>(s: P) -> impl Trait + 'static {
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr
new file mode 100644
index 000000000..e1fbbc14f
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr
@@ -0,0 +1,13 @@
+error[E0700]: hidden type for `impl Trait + 'static` captures lifetime that does not appear in bounds
+ --> $DIR/opaque-type-param.rs:7:5
+ |
+LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static {
+ | -- -------------------- opaque type defined here
+ | |
+ | hidden type `impl Trait + 'static` captures the lifetime `'a` as defined here
+LL | bar(s)
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/borrowck/alias-liveness/rpit-static.rs b/tests/ui/borrowck/alias-liveness/rpit-static.rs
new file mode 100644
index 000000000..45da3edb8
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rpit-static.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn foo(x: &mut i32) -> impl Sized + Captures<'_> + 'static {}
+
+fn overlapping_mut() {
+ let i = &mut 1;
+ let x = foo(i);
+ let y = foo(i);
+}
+
+fn live_past_borrow() {
+ let y;
+ {
+ let x = &mut 1;
+ y = foo(x);
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rpitit-static.rs b/tests/ui/borrowck/alias-liveness/rpitit-static.rs
new file mode 100644
index 000000000..2cc68d2bf
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rpitit-static.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+trait Foo {
+ fn rpitit(&mut self) -> impl Sized + 'static;
+}
+
+fn live_past_borrow<T: Foo>(mut t: T) {
+ let x = t.rpitit();
+ drop(t);
+ drop(x);
+}
+
+fn overlapping_mut<T: Foo>(mut t: T) {
+ let a = t.rpitit();
+ let b = t.rpitit();
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.rs b/tests/ui/borrowck/alias-liveness/rtn-static.rs
new file mode 100644
index 000000000..1f136b8b9
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rtn-static.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+#![feature(return_type_notation)]
+//~^ WARN the feature `return_type_notation` is incomplete
+
+trait Foo {
+ fn borrow(&mut self) -> impl Sized + '_;
+}
+
+fn live_past_borrow<T: Foo<borrow(): 'static>>(mut t: T) {
+ let x = t.borrow();
+ drop(t);
+ drop(x);
+}
+
+// Test that the `'_` item bound in `borrow` does not cause us to
+// overlook the `'static` RTN bound.
+fn overlapping_mut<T: Foo<borrow(): 'static>>(mut t: T) {
+ let x = t.borrow();
+ let x = t.borrow();
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.stderr b/tests/ui/borrowck/alias-liveness/rtn-static.stderr
new file mode 100644
index 000000000..e9202db2c
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rtn-static.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/rtn-static.rs:3: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/borrowck/borrowck-move-out-from-array-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
index ced4d002b..d2a5da66d 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
@@ -42,8 +42,8 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _, _] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -53,8 +53,8 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -64,8 +64,8 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _, _] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -75,8 +75,8 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -108,8 +108,8 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
index 67b00c1dd..d82777684 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
@@ -44,13 +44,13 @@ LL | [_, _, (ref _x, _)] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:44:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:45:10
|
LL | [_x, _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_y @ .., _, _] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -59,13 +59,13 @@ LL | [ref _x, _, _] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:55:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:56:16
|
LL | [.., _x] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -74,13 +74,13 @@ LL | [.., ref _x] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:66:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:67:10
|
LL | [(_x, _), _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_y @ .., _, _] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -89,13 +89,13 @@ LL | [(ref _x, _), _, _] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:77:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:78:16
|
LL | [.., (_x, _)] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -134,13 +134,13 @@ LL | [_, _, ref _y @ ..] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:110:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:111:13
|
LL | [x @ .., _] => {}
| - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
index 97db70f34..1e401b7e9 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
@@ -1,3 +1,4 @@
+// check-pass
// Due to #53114, which causes a "read" of the `_` patterns,
// the borrow-checker refuses this code, while it should probably be allowed.
// Once the bug is fixed, the test, which is derived from a
@@ -15,7 +16,6 @@ fn move_out_from_begin_and_one_from_end() {
[_, _, _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., _y, _] => {}
}
}
@@ -26,7 +26,6 @@ fn move_out_from_begin_field_and_end_field() {
[_, _, (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_, _y)] => {}
}
}
@@ -39,7 +38,6 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
@@ -50,7 +48,6 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _] => {}
}
}
@@ -61,7 +58,6 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
@@ -72,7 +68,6 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _] => {}
}
}
@@ -83,7 +78,6 @@ fn move_out_by_const_subslice_and_index_field() {
[_, _y @ ..] => {}
}
match a {
- //~^ ERROR use of partially moved value
[(_x, _), _, _] => {}
}
}
@@ -94,7 +88,6 @@ fn move_out_by_const_subslice_and_end_index_field() {
[_y @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_x, _)] => {}
}
}
@@ -107,7 +100,6 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
deleted file mode 100644
index 47429ea3e..000000000
--- a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:17:11
- |
-LL | [_, _, _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:28:11
- |
-LL | [_, _, (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:41:11
- |
-LL | [_x, _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _x, _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:52:11
- |
-LL | [.., _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:63:11
- |
-LL | [(_x, _), _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [(ref _x, _), _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:74:11
- |
-LL | [.., (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11
- |
-LL | [_, _y @ ..] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, ref _y @ ..] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11
- |
-LL | [_y @ .., _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _y @ .., _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11
- |
-LL | [x @ .., _, _] => {}
- | - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref x @ .., _, _] => {}
- | +++
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
index 604a25cdc..fbcf126f3 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
@@ -42,8 +42,8 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR [E0382]
[ref _y @ .., _, _] => {}
+ //~^ ERROR [E0382]
}
}
@@ -53,8 +53,8 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR [E0382]
[_, _, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
@@ -64,8 +64,8 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR [E0382]
[ref _y @ .., _, _] => {}
+ //~^ ERROR [E0382]
}
}
@@ -75,8 +75,8 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR [E0382]
[_, _, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
@@ -108,8 +108,8 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _] => {}
}
match a {
- //~^ ERROR [E0382]
[_, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
index bfab13d42..da76b5c4a 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
@@ -43,14 +43,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [_, _, (ref _x, _)] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:44:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:45:10
|
LL | [_x, _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [ref _y @ .., _, _] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -58,14 +58,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [ref _x, _, _] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:55:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:56:16
|
LL | [.., _x] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -73,14 +73,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [.., ref _x] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:66:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:67:10
|
LL | [(_x, _), _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [ref _y @ .., _, _] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -88,14 +88,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [(ref _x, _), _, _] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:77:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:78:16
|
LL | [.., (_x, _)] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -133,14 +133,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [_, _, ref _y @ ..] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:111:13
|
LL | [x @ .., _] => {}
| - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
index 017ca90b8..2f6ce430b 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
@@ -1,3 +1,4 @@
+// check-pass
// Due to #53114, which causes a "read" of the `_` patterns,
// the borrow-checker refuses this code, while it should probably be allowed.
// Once the bug is fixed, the test, which is derived from a
@@ -15,7 +16,6 @@ fn move_out_from_begin_and_one_from_end() {
[_, _, _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., ref _y, _] => {}
}
}
@@ -26,7 +26,6 @@ fn move_out_from_begin_field_and_end_field() {
[_, _, (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_, ref _y)] => {}
}
}
@@ -39,7 +38,6 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
@@ -50,7 +48,6 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[ref _y @ .., _] => {}
}
}
@@ -61,7 +58,6 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
@@ -72,7 +68,6 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[ref _y @ .., _] => {}
}
}
@@ -83,7 +78,6 @@ fn move_out_by_const_subslice_and_index_field() {
[_, _y @ ..] => {}
}
match a {
- //~^ ERROR use of partially moved value
[(ref _x, _), _, _] => {}
}
}
@@ -94,7 +88,6 @@ fn move_out_by_const_subslice_and_end_index_field() {
[_y @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (ref _x, _)] => {}
}
}
@@ -107,7 +100,6 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
deleted file mode 100644
index 8412c24fe..000000000
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:17:11
- |
-LL | [_, _, _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:28:11
- |
-LL | [_, _, (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:41:11
- |
-LL | [_x, _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _x, _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:52:11
- |
-LL | [.., _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:63:11
- |
-LL | [(_x, _), _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [(ref _x, _), _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:74:11
- |
-LL | [.., (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11
- |
-LL | [_, _y @ ..] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, ref _y @ ..] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11
- |
-LL | [_y @ .., _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _y @ .., _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11
- |
-LL | [x @ .., _, _] => {}
- | - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref x @ .., _, _] => {}
- | +++
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/borrowck/issue-62107-match-arm-scopes.rs b/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
index 93ce34d2f..7dbcad9d3 100644
--- a/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
+++ b/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
@@ -1,8 +1,8 @@
fn main() {
let e: i32;
match e {
- //~^ ERROR E0381
ref u if true => {}
+ //~^ ERROR E0381
ref v if true => {
let tx = 0;
&tx;
diff --git a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
index 9683da919..8fe8fa710 100644
--- a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
+++ b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
@@ -1,10 +1,11 @@
error[E0381]: used binding `e` isn't initialized
- --> $DIR/issue-62107-match-arm-scopes.rs:3:11
+ --> $DIR/issue-62107-match-arm-scopes.rs:4:9
|
LL | let e: i32;
| - binding declared here but left uninitialized
LL | match e {
- | ^ `e` used here but it isn't initialized
+LL | ref u if true => {}
+ | ^^^^^ `e` used here but it isn't initialized
|
help: consider assigning a value
|
diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
index d067ff447..b52939ffc 100644
--- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
+++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
@@ -13,10 +13,10 @@ impl MarketMultiplier {
}
}
-async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied
- LockedMarket(generator.lock().unwrap().buy())
+ LockedMarket(coroutine.lock().unwrap().buy())
}
struct LockedMarket<T>(T);
diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
index 73e0aaf1e..516c1d065 100644
--- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
+++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
@@ -1,7 +1,7 @@
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| |
| expected 0 lifetime arguments
@@ -15,7 +15,7 @@ LL | struct LockedMarket<T>(T);
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `T`
@@ -25,7 +25,7 @@ LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^ -
help: add missing generic argument
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
| +++
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/let_underscore_temporary.rs b/tests/ui/borrowck/let_underscore_temporary.rs
index 835cd2079..a5ea3b3a7 100644
--- a/tests/ui/borrowck/let_underscore_temporary.rs
+++ b/tests/ui/borrowck/let_underscore_temporary.rs
@@ -52,4 +52,42 @@ fn let_ascribe(string: &Option<&str>, mut num: Option<i32>) {
};
}
+fn matched(string: &Option<&str>, mut num: Option<i32>) {
+ match if let Some(s) = *string { s.len() } else { 0 } {
+ _ => {}
+ };
+ match if let Some(s) = &num { s } else { &0 } {
+ _ => {}
+ };
+ match if let Some(s) = &mut num {
+ *s += 1;
+ s
+ } else {
+ &mut 0
+ //~^ ERROR temporary value dropped while borrowed
+ } {
+ _ => {}
+ };
+ match if let Some(ref s) = num { s } else { &0 } {
+ _ => {}
+ };
+ match if let Some(mut s) = num {
+ s += 1;
+ s
+ } else {
+ 0
+ } {
+ _ => {}
+ };
+ match if let Some(ref mut s) = num {
+ *s += 1;
+ s
+ } else {
+ &mut 0
+ //~^ ERROR temporary value dropped while borrowed
+ } {
+ _ => {}
+ };
+}
+
fn main() {}
diff --git a/tests/ui/borrowck/let_underscore_temporary.stderr b/tests/ui/borrowck/let_underscore_temporary.stderr
index 74f3598c4..6bccf3291 100644
--- a/tests/ui/borrowck/let_underscore_temporary.stderr
+++ b/tests/ui/borrowck/let_underscore_temporary.stderr
@@ -74,6 +74,44 @@ LL | | };
|
= note: consider using a `let` binding to create a longer lived value
-error: aborting due to 4 previous errors
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/let_underscore_temporary.rs:66:14
+ |
+LL | match if let Some(s) = &mut num {
+ | ___________-
+LL | | *s += 1;
+LL | | s
+LL | | } else {
+LL | | &mut 0
+ | | ^ creates a temporary value which is freed while still in use
+LL | |
+LL | | } {
+ | | -
+ | | |
+ | |_____temporary value is freed at the end of this statement
+ | borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/let_underscore_temporary.rs:86:14
+ |
+LL | match if let Some(ref mut s) = num {
+ | ___________-
+LL | | *s += 1;
+LL | | s
+LL | | } else {
+LL | | &mut 0
+ | | ^ creates a temporary value which is freed while still in use
+LL | |
+LL | | } {
+ | | -
+ | | |
+ | |_____temporary value is freed at the end of this statement
+ | borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
index 930fea915..7ebea3c03 100644
--- a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
+++ b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
@@ -53,6 +53,7 @@ note: ...does not necessarily outlive the lifetime `'c` as defined here
|
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
| ^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration
--> $DIR/regions-bound-missing-bound-in-impl.rs:42:20
diff --git a/tests/ui/bounds-lifetime.rs b/tests/ui/bounds-lifetime.rs
index 31aa4011b..e3e635a4e 100644
--- a/tests/ui/bounds-lifetime.rs
+++ b/tests/ui/bounds-lifetime.rs
@@ -2,6 +2,6 @@ type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this
type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context
type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context
type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context
-type E = dyn for<T> Fn(); //~ ERROR only lifetime parameters can be used in this context
+type E = dyn for<T, U> Fn(); //~ ERROR only lifetime parameters can be used in this context
fn main() {}
diff --git a/tests/ui/bounds-lifetime.stderr b/tests/ui/bounds-lifetime.stderr
index f0bfe784c..bbae835d8 100644
--- a/tests/ui/bounds-lifetime.stderr
+++ b/tests/ui/bounds-lifetime.stderr
@@ -28,8 +28,8 @@ LL | type D = for<'a, T> fn();
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/bounds-lifetime.rs:5:18
|
-LL | type E = dyn for<T> Fn();
- | ^
+LL | type E = dyn for<T, U> Fn();
+ | ^ ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
index e2b177b95..0e2c6c60b 100644
--- a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
+++ b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/builtin-superkinds-self-type.rs:10:16
|
LL | impl <T: Sync> Foo for T { }
- | ^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/builtin-superkinds-self-type.rs:6:24
|
LL | trait Foo : Sized+Sync+'static {
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl <T: Sync + 'static> Foo for T { }
| +++++++++
diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr
index 5a02f4aa9..69e19e1d4 100644
--- a/tests/ui/c-variadic/issue-86053-1.stderr
+++ b/tests/ui/c-variadic/issue-86053-1.stderr
@@ -50,13 +50,7 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic
--> $DIR/issue-86053-1.rs:11:12
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
- | ^^^
-
-error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/issue-86053-1.rs:11:36
- |
-LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
- | ^^^
+ | ^^^ ^^^
error[E0412]: cannot find type `F` in this scope
--> $DIR/issue-86053-1.rs:11:48
@@ -76,6 +70,6 @@ help: you might be missing a type parameter
LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self ,
| +++
-error: aborting due to 11 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/cast/ptr-to-ptr-different-regions.rs b/tests/ui/cast/ptr-to-ptr-different-regions.rs
new file mode 100644
index 000000000..5592e613a
--- /dev/null
+++ b/tests/ui/cast/ptr-to-ptr-different-regions.rs
@@ -0,0 +1,24 @@
+// check-pass
+
+// https://github.com/rust-lang/rust/issues/113257
+
+#![deny(trivial_casts)] // The casts here are not trivial.
+
+struct Foo<'a> { a: &'a () }
+
+fn extend_lifetime_very_very_safely<'a>(v: *const Foo<'a>) -> *const Foo<'static> {
+ // This should pass because raw pointer casts can do anything they want.
+ v as *const Foo<'static>
+}
+
+trait Trait {}
+
+fn assert_static<'a>(ptr: *mut (dyn Trait + 'a)) -> *mut (dyn Trait + 'static) {
+ ptr as _
+}
+
+fn main() {
+ let unit = ();
+ let foo = Foo { a: &unit };
+ let _long: *const Foo<'static> = extend_lifetime_very_very_safely(&foo);
+}
diff --git a/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr b/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
index 9ce4710d6..75df314e0 100644
--- a/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
+++ b/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
@@ -25,6 +25,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
|
= 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 #91632 <https://github.com/rust-lang/rust/issues/91632>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
@@ -34,6 +35,7 @@ LL | #![cfg_attr(foo, crate_name="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 #91632 <https://github.com/rust-lang/rust/issues/91632>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/check-cfg/allow-at-crate-level.rs b/tests/ui/check-cfg/allow-at-crate-level.rs
index ce3383a29..1629d2e0b 100644
--- a/tests/ui/check-cfg/allow-at-crate-level.rs
+++ b/tests/ui/check-cfg/allow-at-crate-level.rs
@@ -1,7 +1,7 @@
// This test check that #![allow(unexpected_cfgs)] works with --cfg
//
// check-pass
-// compile-flags: --cfg=unexpected --check-cfg=names() -Z unstable-options
+// compile-flags: --cfg=unexpected --check-cfg=cfg() -Z unstable-options
#![allow(unexpected_cfgs)]
diff --git a/tests/ui/check-cfg/allow-macro-cfg.rs b/tests/ui/check-cfg/allow-macro-cfg.rs
index 8016a4d19..ea26355ac 100644
--- a/tests/ui/check-cfg/allow-macro-cfg.rs
+++ b/tests/ui/check-cfg/allow-macro-cfg.rs
@@ -1,7 +1,7 @@
// This test check that local #[allow(unexpected_cfgs)] works
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
fn foo() {
diff --git a/tests/ui/check-cfg/allow-same-level.rs b/tests/ui/check-cfg/allow-same-level.rs
index 6c869dc42..29491e0b3 100644
--- a/tests/ui/check-cfg/allow-same-level.rs
+++ b/tests/ui/check-cfg/allow-same-level.rs
@@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
#[cfg(FALSE)]
diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr
index 7797de584..b0c459fab 100644
--- a/tests/ui/check-cfg/allow-same-level.stderr
+++ b/tests/ui/check-cfg/allow-same-level.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `FALSE`
--> $DIR/allow-same-level.rs:7:7
|
LL | #[cfg(FALSE)]
| ^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/allow-top-level.rs b/tests/ui/check-cfg/allow-top-level.rs
index d14b0eae5..df06f655d 100644
--- a/tests/ui/check-cfg/allow-top-level.rs
+++ b/tests/ui/check-cfg/allow-top-level.rs
@@ -1,7 +1,7 @@
// This test check that a top-level #![allow(unexpected_cfgs)] works
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![allow(unexpected_cfgs)]
diff --git a/tests/ui/check-cfg/allow-upper-level.rs b/tests/ui/check-cfg/allow-upper-level.rs
index 04340694d..bd5c97815 100644
--- a/tests/ui/check-cfg/allow-upper-level.rs
+++ b/tests/ui/check-cfg/allow-upper-level.rs
@@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
mod aa {
diff --git a/tests/ui/check-cfg/compact-names.rs b/tests/ui/check-cfg/compact-names.rs
index bff807400..4f7168255 100644
--- a/tests/ui/check-cfg/compact-names.rs
+++ b/tests/ui/check-cfg/compact-names.rs
@@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![feature(cfg_target_compact)]
diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr
index f1fc4285a..b0228774b 100644
--- a/tests/ui/check-cfg/compact-names.stderr
+++ b/tests/ui/check-cfg/compact-names.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `target_architecture`
--> $DIR/compact-names.rs:11:28
|
LL | #[cfg(target(os = "linux", architecture = "arm"))]
| ^^^^^^^^^^^^^^^^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/compact-values.rs b/tests/ui/check-cfg/compact-values.rs
index 1f1705784..13c072fe9 100644
--- a/tests/ui/check-cfg/compact-values.rs
+++ b/tests/ui/check-cfg/compact-values.rs
@@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
// check-pass
-// compile-flags:--check-cfg=values() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![feature(cfg_target_compact)]
diff --git a/tests/ui/check-cfg/compact-values.stderr b/tests/ui/check-cfg/compact-values.stderr
index b7269a652..bb2f4915b 100644
--- a/tests/ui/check-cfg/compact-values.stderr
+++ b/tests/ui/check-cfg/compact-values.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `X`
--> $DIR/compact-values.rs:11:28
|
LL | #[cfg(target(os = "linux", arch = "X"))]
diff --git a/tests/ui/check-cfg/concat-values.rs b/tests/ui/check-cfg/concat-values.rs
new file mode 100644
index 000000000..0f9178ce6
--- /dev/null
+++ b/tests/ui/check-cfg/concat-values.rs
@@ -0,0 +1,13 @@
+// check-pass
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(my_cfg,values("foo")) --check-cfg=cfg(my_cfg,values("bar"))
+
+#[cfg(my_cfg)]
+//~^ WARNING unexpected `cfg` condition value
+fn my_cfg() {}
+
+#[cfg(my_cfg = "unk")]
+//~^ WARNING unexpected `cfg` condition value
+fn my_cfg() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/concat-values.stderr b/tests/ui/check-cfg/concat-values.stderr
new file mode 100644
index 000000000..da2bd7d6a
--- /dev/null
+++ b/tests/ui/check-cfg/concat-values.stderr
@@ -0,0 +1,19 @@
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/concat-values.rs:5:7
+ |
+LL | #[cfg(my_cfg)]
+ | ^^^^^^
+ |
+ = note: expected values for `my_cfg` are: `bar`, `foo`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/concat-values.rs:9:7
+ |
+LL | #[cfg(my_cfg = "unk")]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: expected values for `my_cfg` are: `bar`, `foo`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/diagnotics.rs b/tests/ui/check-cfg/diagnotics.rs
index 49e127d07..45875bddc 100644
--- a/tests/ui/check-cfg/diagnotics.rs
+++ b/tests/ui/check-cfg/diagnotics.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --check-cfg=values(no_values) -Z unstable-options
+// compile-flags: --check-cfg=cfg(feature,values("foo")) --check-cfg=cfg(no_values) -Z unstable-options
#[cfg(featur)]
//~^ WARNING unexpected `cfg` condition name
diff --git a/tests/ui/check-cfg/diagnotics.stderr b/tests/ui/check-cfg/diagnotics.stderr
index 8b9fef09d..31c0db03a 100644
--- a/tests/ui/check-cfg/diagnotics.stderr
+++ b/tests/ui/check-cfg/diagnotics.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:4:7
|
LL | #[cfg(featur)]
@@ -7,19 +7,18 @@ LL | #[cfg(featur)]
= help: expected values for `feature` are: `foo`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:8:7
|
LL | #[cfg(featur = "foo")]
| ^^^^^^^^^^^^^^
|
- = help: expected values for `feature` are: `foo`
help: there is a config with a similar name and value
|
LL | #[cfg(feature = "foo")]
| ~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:12:7
|
LL | #[cfg(featur = "fo")]
@@ -31,13 +30,13 @@ help: there is a config with a similar name and different values
LL | #[cfg(feature = "foo")]
| ~~~~~~~~~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `no_value`
--> $DIR/diagnotics.rs:19:7
|
LL | #[cfg(no_value)]
| ^^^^^^^^ help: there is a config with a similar name: `no_values`
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `no_value`
--> $DIR/diagnotics.rs:23:7
|
LL | #[cfg(no_value = "foo")]
@@ -48,7 +47,7 @@ help: there is a config with a similar name and no value
LL | #[cfg(no_values)]
| ~~~~~~~~~
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `bar`
--> $DIR/diagnotics.rs:27:7
|
LL | #[cfg(no_values = "bar")]
diff --git a/tests/ui/check-cfg/empty-names.rs b/tests/ui/check-cfg/empty-names.rs
deleted file mode 100644
index 046ff0364..000000000
--- a/tests/ui/check-cfg/empty-names.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check warning for unexpected cfg
-//
-// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
-
-#[cfg(unknown_key = "value")]
-//~^ WARNING unexpected `cfg` condition name
-pub fn f() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/empty-names.stderr b/tests/ui/check-cfg/empty-names.stderr
deleted file mode 100644
index f926d1133..000000000
--- a/tests/ui/check-cfg/empty-names.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: unexpected `cfg` condition name
- --> $DIR/empty-names.rs:6:7
- |
-LL | #[cfg(unknown_key = "value")]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = note: `#[warn(unexpected_cfgs)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/check-cfg/empty-values.rs b/tests/ui/check-cfg/empty-values.rs
deleted file mode 100644
index 9bda42e5d..000000000
--- a/tests/ui/check-cfg/empty-values.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check warning for unexpected cfg value
-//
-// check-pass
-// compile-flags: --check-cfg=values() -Z unstable-options
-
-#[cfg(test = "value")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn f() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
new file mode 100644
index 000000000..53ccc0f4d
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `empty_cfg` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
new file mode 100644
index 000000000..5e8b74054
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `empty_names_values` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
new file mode 100644
index 000000000..7705a665e
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
@@ -0,0 +1,33 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/exhaustive-names-values.rs:20:7
+ |
+LL | #[cfg(feature = "unk")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `std`
+
+warning: unexpected condition value `` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
new file mode 100644
index 000000000..f0224a2e3
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
@@ -0,0 +1,33 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/exhaustive-names-values.rs:20:7
+ |
+LL | #[cfg(feature = "unk")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `std`
+
+warning: unexpected `full` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.rs b/tests/ui/check-cfg/exhaustive-names-values.rs
new file mode 100644
index 000000000..f553d93ca
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.rs
@@ -0,0 +1,34 @@
+// Check warning for unexpected cfg in the code and in the CLI
+// arguments (here the revision cfg).
+//
+// check-pass
+// revisions: empty_names_values empty_cfg feature full
+// compile-flags: -Z unstable-options
+// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values()
+// [empty_cfg]compile-flags: --check-cfg=cfg()
+// [feature]compile-flags: --check-cfg=cfg(feature,values("std"))
+// [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg()
+
+#[cfg(unknown_key = "value")]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+#[cfg(test = "value")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+#[cfg(feature = "unk")]
+//[feature]~^ WARNING unexpected `cfg` condition value
+//[full]~^^ WARNING unexpected `cfg` condition value
+pub fn feat() {}
+
+#[cfg(feature = "std")]
+pub fn feat() {}
+
+#[cfg(windows)]
+pub fn win() {}
+
+#[cfg(unix)]
+pub fn unix() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-names.empty_names.stderr b/tests/ui/check-cfg/exhaustive-names.empty_names.stderr
new file mode 100644
index 000000000..6190ff714
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.empty_names.stderr
@@ -0,0 +1,15 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names.rs:8:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `empty_names` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr b/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr
new file mode 100644
index 000000000..f338434cd
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr
@@ -0,0 +1,15 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names.rs:8:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `exhaustive_names` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names.rs b/tests/ui/check-cfg/exhaustive-names.rs
new file mode 100644
index 000000000..b86a7f84e
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.rs
@@ -0,0 +1,12 @@
+// Check warning for unexpected cfg
+//
+// check-pass
+// revisions: empty_names exhaustive_names
+// [empty_names]compile-flags: --check-cfg=names() -Z unstable-options
+// [exhaustive_names]compile-flags: --check-cfg=cfg() -Z unstable-options
+
+#[cfg(unknown_key = "value")]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr
new file mode 100644
index 000000000..999b27028
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr
@@ -0,0 +1,17 @@
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `empty_cfg` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/empty-values.stderr b/tests/ui/check-cfg/exhaustive-values.empty_values.stderr
index a0168b2ca..77ddc3510 100644
--- a/tests/ui/check-cfg/empty-values.stderr
+++ b/tests/ui/check-cfg/exhaustive-values.empty_values.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/empty-values.rs:6:7
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
|
LL | #[cfg(test = "value")]
| ^^^^----------
diff --git a/tests/ui/check-cfg/exhaustive-values.rs b/tests/ui/check-cfg/exhaustive-values.rs
new file mode 100644
index 000000000..8a1689ba8
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.rs
@@ -0,0 +1,13 @@
+// Check warning for unexpected cfg value
+//
+// check-pass
+// revisions: empty_values empty_cfg without_names
+// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options
+// [empty_cfg]compile-flags: --check-cfg=cfg() -Z unstable-options
+// [without_names]compile-flags: --check-cfg=cfg(any()) -Z unstable-options
+
+#[cfg(test = "value")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-values.without_names.stderr b/tests/ui/check-cfg/exhaustive-values.without_names.stderr
new file mode 100644
index 000000000..77ddc3510
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.without_names.stderr
@@ -0,0 +1,13 @@
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/check-cfg/invalid-arguments.any_values.stderr b/tests/ui/check-cfg/invalid-arguments.any_values.stderr
new file mode 100644
index 000000000..f9a9c4a6e
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.any_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),values())` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
index 850924d99..925664bb3 100644
--- a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
+++ b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
@@ -1,2 +1,2 @@
-error: invalid `--check-cfg` argument: `anything_else(...)` (expected `names(name1, name2, ... nameN)` or `values(name, "value1", "value2", ... "valueN")`)
+error: invalid `--check-cfg` argument: `anything_else(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
diff --git a/tests/ui/check-cfg/invalid-arguments.giberich.stderr b/tests/ui/check-cfg/invalid-arguments.giberich.stderr
new file mode 100644
index 000000000..d427033fc
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.giberich.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr
new file mode 100644
index 000000000..0dc44d9ac
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr
new file mode 100644
index 000000000..d0a1453e3
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr
new file mode 100644
index 000000000..9239f8cce
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr
new file mode 100644
index 000000000..4c406143d
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` (`values()` arguments cannot specify string literals and `any()` at the same time)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr
new file mode 100644
index 000000000..6f1db1b13
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),any())` (`any()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr
new file mode 100644
index 000000000..bce305b09
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` (`values()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr
new file mode 100644
index 000000000..748ce231a
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` (`any()` in `values()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr
new file mode 100644
index 000000000..daf38147f
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(foo))` (`any()` must be empty)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr
new file mode 100644
index 000000000..79f83e802
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` (`any()` must be empty)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.rs b/tests/ui/check-cfg/invalid-arguments.rs
index 5090ce3e8..a56f48e0a 100644
--- a/tests/ui/check-cfg/invalid-arguments.rs
+++ b/tests/ui/check-cfg/invalid-arguments.rs
@@ -2,9 +2,35 @@
//
// check-fail
// revisions: anything_else names_simple_ident values_simple_ident values_string_literals
-// [anything_else]compile-flags: -Z unstable-options --check-cfg=anything_else(...)
-// [names_simple_ident]compile-flags: -Z unstable-options --check-cfg=names("NOT_IDENT")
-// [values_simple_ident]compile-flags: -Z unstable-options --check-cfg=values("NOT_IDENT")
-// [values_string_literals]compile-flags: -Z unstable-options --check-cfg=values(test,12)
+// revisions: string_for_name_1 string_for_name_2 multiple_any multiple_values
+// revisions: multiple_values_any not_empty_any not_empty_values_any
+// revisions: values_any_missing_values values_any_before_ident ident_in_values_1
+// revisions: ident_in_values_2 unknown_meta_item_1 unknown_meta_item_2 unknown_meta_item_3
+// revisions: mixed_values_any mixed_any any_values giberich unterminated
+//
+// compile-flags: -Z unstable-options
+// [anything_else]compile-flags: --check-cfg=anything_else(...)
+// [names_simple_ident]compile-flags: --check-cfg=names("NOT_IDENT")
+// [values_simple_ident]compile-flags: --check-cfg=values("NOT_IDENT")
+// [values_string_literals]compile-flags: --check-cfg=values(test,12)
+// [string_for_name_1]compile-flags: --check-cfg=cfg("NOT_IDENT")
+// [string_for_name_2]compile-flags: --check-cfg=cfg(foo,"NOT_IDENT",bar)
+// [multiple_any]compile-flags: --check-cfg=cfg(any(),any())
+// [multiple_values]compile-flags: --check-cfg=cfg(foo,values(),values())
+// [multiple_values_any]compile-flags: --check-cfg=cfg(foo,values(any(),any()))
+// [not_empty_any]compile-flags: --check-cfg=cfg(any(foo))
+// [not_empty_values_any]compile-flags: --check-cfg=cfg(foo,values(any(bar)))
+// [values_any_missing_values]compile-flags: --check-cfg=cfg(foo,any())
+// [values_any_before_ident]compile-flags: --check-cfg=cfg(values(any()),foo)
+// [ident_in_values_1]compile-flags: --check-cfg=cfg(foo,values(bar))
+// [ident_in_values_2]compile-flags: --check-cfg=cfg(foo,values("bar",bar,"bar"))
+// [unknown_meta_item_1]compile-flags: --check-cfg=abc()
+// [unknown_meta_item_2]compile-flags: --check-cfg=cfg(foo,test())
+// [unknown_meta_item_3]compile-flags: --check-cfg=cfg(foo,values(test()))
+// [mixed_values_any]compile-flags: --check-cfg=cfg(foo,values("bar",any()))
+// [mixed_any]compile-flags: --check-cfg=cfg(any(),values(any()))
+// [any_values]compile-flags: --check-cfg=cfg(any(),values())
+// [giberich]compile-flags: --check-cfg=cfg(...)
+// [unterminated]compile-flags: --check-cfg=cfg(
fn main() {}
diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr
new file mode 100644
index 000000000..c6f6834ff
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr
new file mode 100644
index 000000000..ab3dc86cd
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr
new file mode 100644
index 000000000..c04b15ec2
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `abc()` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr
new file mode 100644
index 000000000..cee65f988
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,test())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr
new file mode 100644
index 000000000..2441e2537
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unterminated.stderr b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr
new file mode 100644
index 000000000..80161a6aa
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr
new file mode 100644
index 000000000..fc93ec8fb
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr
new file mode 100644
index 000000000..f41672fcb
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,any())` (`cfg(any())` can only be provided in isolation)
+
diff --git a/tests/ui/check-cfg/invalid-cfg-name.rs b/tests/ui/check-cfg/invalid-cfg-name.rs
deleted file mode 100644
index 8499d3d44..000000000
--- a/tests/ui/check-cfg/invalid-cfg-name.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Check warning for invalid configuration name
-//
-// edition:2018
-// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
-
-#[cfg(widnows)]
-//~^ WARNING unexpected `cfg` condition name
-pub fn f() {}
-
-#[cfg(windows)]
-pub fn g() {}
-
-pub fn main() {}
diff --git a/tests/ui/check-cfg/invalid-cfg-value.rs b/tests/ui/check-cfg/invalid-cfg-value.rs
deleted file mode 100644
index 9e428d367..000000000
--- a/tests/ui/check-cfg/invalid-cfg-value.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Check warning for invalid configuration value
-//
-// edition:2018
-// check-pass
-// compile-flags: --check-cfg=values(feature,"serde","full") --cfg=feature="rand" -Z unstable-options
-
-#[cfg(feature = "sedre")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn f() {}
-
-#[cfg(feature = "serde")]
-pub fn g() {}
-
-#[cfg(feature = "rand")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn h() {}
-
-pub fn main() {}
diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.cfg.stderr
index 07c514aed..daa200440 100644
--- a/tests/ui/check-cfg/mix.stderr
+++ b/tests/ui/check-cfg/mix.cfg.stderr
@@ -1,40 +1,42 @@
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:11:7
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:15:7
|
LL | #[cfg(widnows)]
| ^^^^^^^ help: there is a config with a similar name: `windows`
|
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:15:7
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/mix.rs:19:7
|
LL | #[cfg(feature)]
| ^^^^^^^- help: specify a config value: `= "foo"`
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:22:7
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:26:7
|
LL | #[cfg(feature = "bar")]
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:26:7
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:30:7
|
LL | #[cfg(feature = "zebra")]
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:30:12
+warning: unexpected `cfg` condition name: `uu`
+ --> $DIR/mix.rs:34:12
|
LL | #[cfg_attr(uu, test)]
| ^^
+ |
+ = help: expected names are: `cfg`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `names_values`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
warning: unexpected condition value `bar` for condition name `feature`
|
@@ -44,142 +46,142 @@ warning: unexpected `unknown_name` as condition name
|
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:39:10
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:43:10
|
LL | cfg!(widnows);
| ^^^^^^^ help: there is a config with a similar name: `windows`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:42:10
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:46:10
|
LL | cfg!(feature = "bar");
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:44:10
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:48:10
|
LL | cfg!(feature = "zebra");
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:46:10
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:50:10
|
LL | cfg!(xxx = "foo");
| ^^^^^^^^^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:48:10
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:52:10
|
LL | cfg!(xxx);
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:50:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:54:14
|
LL | cfg!(any(xxx, windows));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:52:14
+warning: unexpected `cfg` condition value: `bad`
+ --> $DIR/mix.rs:56:14
|
LL | cfg!(any(feature = "bad", windows));
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:54:23
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:58:23
|
LL | cfg!(any(windows, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:56:20
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:60:20
|
LL | cfg!(all(unix, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:58:14
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:62:14
|
LL | cfg!(all(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:58:18
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:62:18
|
LL | cfg!(all(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:61:14
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:65:14
|
LL | cfg!(any(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:61:18
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:65:18
|
LL | cfg!(any(aa, bb));
| ^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:64:20
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:68:20
|
LL | cfg!(any(unix, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:66:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:70:14
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:66:19
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:70:19
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:69:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:14
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:69:25
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:25
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:14
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:14
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:33
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:33
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:52
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:52
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/check-cfg/mix.names_values.stderr b/tests/ui/check-cfg/mix.names_values.stderr
new file mode 100644
index 000000000..daa200440
--- /dev/null
+++ b/tests/ui/check-cfg/mix.names_values.stderr
@@ -0,0 +1,192 @@
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:15:7
+ |
+LL | #[cfg(widnows)]
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+ |
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/mix.rs:19:7
+ |
+LL | #[cfg(feature)]
+ | ^^^^^^^- help: specify a config value: `= "foo"`
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:26:7
+ |
+LL | #[cfg(feature = "bar")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:30:7
+ |
+LL | #[cfg(feature = "zebra")]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `uu`
+ --> $DIR/mix.rs:34:12
+ |
+LL | #[cfg_attr(uu, test)]
+ | ^^
+ |
+ = help: expected names are: `cfg`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `names_values`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+
+warning: unexpected condition value `bar` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: unexpected `unknown_name` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:43:10
+ |
+LL | cfg!(widnows);
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:46:10
+ |
+LL | cfg!(feature = "bar");
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:48:10
+ |
+LL | cfg!(feature = "zebra");
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:50:10
+ |
+LL | cfg!(xxx = "foo");
+ | ^^^^^^^^^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:52:10
+ |
+LL | cfg!(xxx);
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:54:14
+ |
+LL | cfg!(any(xxx, windows));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `bad`
+ --> $DIR/mix.rs:56:14
+ |
+LL | cfg!(any(feature = "bad", windows));
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:58:23
+ |
+LL | cfg!(any(windows, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:60:20
+ |
+LL | cfg!(all(unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:62:14
+ |
+LL | cfg!(all(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:62:18
+ |
+LL | cfg!(all(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:65:14
+ |
+LL | cfg!(any(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:65:18
+ |
+LL | cfg!(any(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:68:20
+ |
+LL | cfg!(any(unix, feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:70:14
+ |
+LL | cfg!(any(xxx, feature = "zebra"));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:70:19
+ |
+LL | cfg!(any(xxx, feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:14
+ |
+LL | cfg!(any(xxx, unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:25
+ |
+LL | cfg!(any(xxx, unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:14
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:33
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:52
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: 28 warnings emitted
+
diff --git a/tests/ui/check-cfg/mix.rs b/tests/ui/check-cfg/mix.rs
index 9adf5c46e..d7b3b4953 100644
--- a/tests/ui/check-cfg/mix.rs
+++ b/tests/ui/check-cfg/mix.rs
@@ -3,7 +3,11 @@
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
//
// check-pass
-// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" --cfg unknown_name -Z unstable-options
+// revisions: names_values cfg
+// compile-flags: --cfg feature="bar" --cfg unknown_name -Z unstable-options
+// compile-flags: --check-cfg=cfg(names_values,cfg)
+// [names_values]compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo")
+// [cfg]compile-flags: --check-cfg=cfg(feature,values("foo"))
#[cfg(windows)]
fn do_windows_stuff() {}
diff --git a/tests/ui/check-cfg/no-values.stderr b/tests/ui/check-cfg/no-expected-values.empty.stderr
index ffa87dc58..5d261b2a5 100644
--- a/tests/ui/check-cfg/no-values.stderr
+++ b/tests/ui/check-cfg/no-expected-values.empty.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/no-values.rs:6:7
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^--------
@@ -9,8 +9,8 @@ LL | #[cfg(feature = "foo")]
= note: no expected value for `feature`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/no-values.rs:10:7
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
|
LL | #[cfg(test = "foo")]
| ^^^^--------
diff --git a/tests/ui/check-cfg/no-expected-values.mixed.stderr b/tests/ui/check-cfg/no-expected-values.mixed.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.mixed.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-expected-values.rs b/tests/ui/check-cfg/no-expected-values.rs
new file mode 100644
index 000000000..9e2a9f09a
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.rs
@@ -0,0 +1,20 @@
+// Check that we detect unexpected value when none are allowed
+//
+// check-pass
+// revisions: values simple mixed empty
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(values,simple,mixed,empty)
+// [values]compile-flags: --check-cfg=values(test) --check-cfg=values(feature)
+// [simple]compile-flags: --check-cfg=cfg(test) --check-cfg=cfg(feature)
+// [mixed]compile-flags: --check-cfg=cfg(test,feature)
+// [empty]compile-flags: --check-cfg=cfg(test,feature,values())
+
+#[cfg(feature = "foo")]
+//~^ WARNING unexpected `cfg` condition value
+fn do_foo() {}
+
+#[cfg(test = "foo")]
+//~^ WARNING unexpected `cfg` condition value
+fn do_foo() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/no-expected-values.simple.stderr b/tests/ui/check-cfg/no-expected-values.simple.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.simple.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-expected-values.values.stderr b/tests/ui/check-cfg/no-expected-values.values.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.values.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-values.rs b/tests/ui/check-cfg/no-values.rs
deleted file mode 100644
index 8c80f56cb..000000000
--- a/tests/ui/check-cfg/no-values.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Check that we detect unexpected value when none are allowed
-//
-// check-pass
-// compile-flags: --check-cfg=values(test) --check-cfg=values(feature) -Z unstable-options
-
-#[cfg(feature = "foo")]
-//~^ WARNING unexpected `cfg` condition value
-fn do_foo() {}
-
-#[cfg(test = "foo")]
-//~^ WARNING unexpected `cfg` condition value
-fn do_foo() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/order-independant.names_after.stderr b/tests/ui/check-cfg/order-independant.names_after.stderr
index 91b81428b..a308358e4 100644
--- a/tests/ui/check-cfg/order-independant.names_after.stderr
+++ b/tests/ui/check-cfg/order-independant.names_after.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: (none)
--> $DIR/order-independant.rs:8:7
|
LL | #[cfg(a)]
@@ -7,7 +7,7 @@ LL | #[cfg(a)]
= note: expected values for `a` are: `b`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:12:7
|
LL | #[cfg(a = "unk")]
diff --git a/tests/ui/check-cfg/order-independant.names_before.stderr b/tests/ui/check-cfg/order-independant.names_before.stderr
index 91b81428b..a308358e4 100644
--- a/tests/ui/check-cfg/order-independant.names_before.stderr
+++ b/tests/ui/check-cfg/order-independant.names_before.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: (none)
--> $DIR/order-independant.rs:8:7
|
LL | #[cfg(a)]
@@ -7,7 +7,7 @@ LL | #[cfg(a)]
= note: expected values for `a` are: `b`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:12:7
|
LL | #[cfg(a = "unk")]
diff --git a/tests/ui/check-cfg/stmt-no-ice.rs b/tests/ui/check-cfg/stmt-no-ice.rs
index cf76487ed..383e830a1 100644
--- a/tests/ui/check-cfg/stmt-no-ice.rs
+++ b/tests/ui/check-cfg/stmt-no-ice.rs
@@ -1,7 +1,7 @@
// This test checks that there is no ICE with this code
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags:--check-cfg=cfg() -Z unstable-options
fn main() {
#[cfg(crossbeam_loom)]
diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr
index da65b5969..900ea4e4d 100644
--- a/tests/ui/check-cfg/stmt-no-ice.stderr
+++ b/tests/ui/check-cfg/stmt-no-ice.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `crossbeam_loom`
--> $DIR/stmt-no-ice.rs:7:11
|
LL | #[cfg(crossbeam_loom)]
| ^^^^^^^^^^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/invalid-cfg-name.stderr b/tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr
index ed09f8cb6..513f7ac7f 100644
--- a/tests/ui/check-cfg/invalid-cfg-name.stderr
+++ b/tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition name
- --> $DIR/invalid-cfg-name.rs:7:7
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/unexpected-cfg-name.rs:9:7
|
LL | #[cfg(widnows)]
| ^^^^^^^ help: there is a config with a similar name: `windows`
diff --git a/tests/ui/check-cfg/unexpected-cfg-name.names.stderr b/tests/ui/check-cfg/unexpected-cfg-name.names.stderr
new file mode 100644
index 000000000..513f7ac7f
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-name.names.stderr
@@ -0,0 +1,10 @@
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/unexpected-cfg-name.rs:9:7
+ |
+LL | #[cfg(widnows)]
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+ |
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/check-cfg/unexpected-cfg-name.rs b/tests/ui/check-cfg/unexpected-cfg-name.rs
new file mode 100644
index 000000000..15c3aa6e0
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-name.rs
@@ -0,0 +1,16 @@
+// Check warning for unexpected configuration name
+//
+// check-pass
+// revisions: names exhaustive
+// compile-flags: --check-cfg=cfg(names,exhaustive)
+// [names]compile-flags: --check-cfg=names() -Z unstable-options
+// [exhaustive]compile-flags: --check-cfg=cfg() -Z unstable-options
+
+#[cfg(widnows)]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+#[cfg(windows)]
+pub fn g() {}
+
+pub fn main() {}
diff --git a/tests/ui/check-cfg/invalid-cfg-value.stderr b/tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr
index 776d264a7..2ed7f9005 100644
--- a/tests/ui/check-cfg/invalid-cfg-value.stderr
+++ b/tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/invalid-cfg-value.rs:7:7
+warning: unexpected `cfg` condition value: `sedre`
+ --> $DIR/unexpected-cfg-value.rs:11:7
|
LL | #[cfg(feature = "sedre")]
| ^^^^^^^^^^-------
@@ -9,8 +9,8 @@ LL | #[cfg(feature = "sedre")]
= note: expected values for `feature` are: `full`, `serde`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/invalid-cfg-value.rs:14:7
+warning: unexpected `cfg` condition value: `rand`
+ --> $DIR/unexpected-cfg-value.rs:18:7
|
LL | #[cfg(feature = "rand")]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/check-cfg/unexpected-cfg-value.rs b/tests/ui/check-cfg/unexpected-cfg-value.rs
new file mode 100644
index 000000000..a84458071
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-value.rs
@@ -0,0 +1,22 @@
+// Check warning for invalid configuration value in the code and
+// in the cli
+//
+// check-pass
+// revisions: values cfg
+// compile-flags: --cfg=feature="rand" -Z unstable-options
+// compile-flags: --check-cfg=cfg(values,cfg)
+// [values]compile-flags: --check-cfg=values(feature,"serde","full")
+// [cfg]compile-flags: --check-cfg=cfg(feature,values("serde","full"))
+
+#[cfg(feature = "sedre")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+#[cfg(feature = "serde")]
+pub fn g() {}
+
+#[cfg(feature = "rand")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn h() {}
+
+pub fn main() {}
diff --git a/tests/ui/check-cfg/unexpected-cfg-value.values.stderr b/tests/ui/check-cfg/unexpected-cfg-value.values.stderr
new file mode 100644
index 000000000..2ed7f9005
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-value.values.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition value: `sedre`
+ --> $DIR/unexpected-cfg-value.rs:11:7
+ |
+LL | #[cfg(feature = "sedre")]
+ | ^^^^^^^^^^-------
+ | |
+ | help: there is a expected value with a similar name: `"serde"`
+ |
+ = note: expected values for `feature` are: `full`, `serde`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `rand`
+ --> $DIR/unexpected-cfg-value.rs:18:7
+ |
+LL | #[cfg(feature = "rand")]
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `full`, `serde`
+
+warning: unexpected condition value `rand` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/unknown-values.rs b/tests/ui/check-cfg/unknown-values.rs
new file mode 100644
index 000000000..c082a2f25
--- /dev/null
+++ b/tests/ui/check-cfg/unknown-values.rs
@@ -0,0 +1,17 @@
+// Check that no warning is emitted for unknown cfg value
+//
+// check-pass
+// revisions: simple mixed with_values
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(simple,mixed,with_values)
+// [simple]compile-flags: --check-cfg=cfg(foo,values(any()))
+// [mixed]compile-flags: --check-cfg=cfg(foo) --check-cfg=cfg(foo,values(any()))
+// [with_values]compile-flags:--check-cfg=cfg(foo,values(any())) --check-cfg=cfg(foo,values("aa"))
+
+#[cfg(foo = "value")]
+pub fn f() {}
+
+#[cfg(foo)]
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr
index c705152d9..e71149f33 100644
--- a/tests/ui/check-cfg/values-target-json.stderr
+++ b/tests/ui/check-cfg/values-target-json.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linuz`
--> $DIR/values-target-json.rs:13:7
|
LL | #[cfg(target_os = "linuz")]
diff --git a/tests/ui/check-cfg/well-known-names.rs b/tests/ui/check-cfg/well-known-names.rs
index e57fb69a1..1dcb419b4 100644
--- a/tests/ui/check-cfg/well-known-names.rs
+++ b/tests/ui/check-cfg/well-known-names.rs
@@ -1,7 +1,7 @@
// This test checks that we lint on non well known names and that we don't lint on well known names
//
// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[cfg(target_oz = "linux")]
//~^ WARNING unexpected `cfg` condition name
diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr
index 34c5d6172..3001289b7 100644
--- a/tests/ui/check-cfg/well-known-names.stderr
+++ b/tests/ui/check-cfg/well-known-names.stderr
@@ -1,14 +1,16 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `target_oz`
--> $DIR/well-known-names.rs:6:7
|
LL | #[cfg(target_oz = "linux")]
- | ---------^^^^^^^^^^
- | |
- | help: there is a config with a similar name: `target_os`
+ | ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unexpected_cfgs)]` on by default
+help: there is a config with a similar name and value
+ |
+LL | #[cfg(target_os = "linux")]
+ | ~~~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `features`
--> $DIR/well-known-names.rs:13:7
|
LL | #[cfg(features = "foo")]
@@ -16,7 +18,7 @@ LL | #[cfg(features = "foo")]
| |
| help: there is a config with a similar name: `feature`
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `uniw`
--> $DIR/well-known-names.rs:20:7
|
LL | #[cfg(uniw)]
diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs
index 96375dc8d..8b56c8729 100644
--- a/tests/ui/check-cfg/well-known-values.rs
+++ b/tests/ui/check-cfg/well-known-values.rs
@@ -2,7 +2,7 @@
// values
//
// check-pass
-// compile-flags: --check-cfg=values() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[cfg(target_os = "linuz")]
//~^ WARNING unexpected `cfg` condition value
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index b381f5a4a..6877d8f5b 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linuz`
--> $DIR/well-known-values.rs:7:7
|
LL | #[cfg(target_os = "linuz")]
@@ -9,7 +9,7 @@ LL | #[cfg(target_os = "linuz")]
= 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
+warning: unexpected `cfg` condition value: `0`
--> $DIR/well-known-values.rs:14:7
|
LL | #[cfg(target_has_atomic = "0")]
@@ -19,7 +19,7 @@ LL | #[cfg(target_has_atomic = "0")]
|
= note: expected values for `target_has_atomic` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `aa`
--> $DIR/well-known-values.rs:21:7
|
LL | #[cfg(unix = "aa")]
@@ -29,7 +29,7 @@ LL | #[cfg(unix = "aa")]
|
= note: no expected value for `unix`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `miri`
--> $DIR/well-known-values.rs:28:7
|
LL | #[cfg(miri = "miri")]
@@ -39,7 +39,7 @@ LL | #[cfg(miri = "miri")]
|
= note: no expected value for `miri`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linux`
--> $DIR/well-known-values.rs:35:7
|
LL | #[cfg(doc = "linux")]
diff --git a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
index 914ebbe26..106485e04 100644
--- a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
+++ b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
@@ -26,7 +26,8 @@ pub fn edge_case_str(event: String) {
pub fn edge_case_raw_ptr(event: *const i32) {
let _ = || {
match event {
- NUMBER_POINTER => (),
+ NUMBER_POINTER => (), //~WARN behave unpredictably
+ //~| previously accepted
_ => (),
};
};
diff --git a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr
new file mode 100644
index 000000000..c83ba4197
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr
@@ -0,0 +1,12 @@
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/match-edge-cases_1.rs:29:13
+ |
+LL | NUMBER_POINTER => (),
+ | ^^^^^^^^^^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
+
+warning: 1 warning emitted
+
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 0807f4590..85426dd9a 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
@@ -5,10 +5,10 @@ LL | let _b = || { match l1 { L1::A => () } };
| ^^ pattern `L1::B` not covered
|
note: `L1` defined here
- --> $DIR/non-exhaustive-match.rs:12:14
+ --> $DIR/non-exhaustive-match.rs:12:6
|
LL | enum L1 { A, B }
- | -- ^ not covered
+ | ^^ - not covered
= note: the matched value is of type `L1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/closures/add_semicolon_non_block_closure.stderr b/tests/ui/closures/add_semicolon_non_block_closure.stderr
index ed829fc98..6f9c309ed 100644
--- a/tests/ui/closures/add_semicolon_non_block_closure.stderr
+++ b/tests/ui/closures/add_semicolon_non_block_closure.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/add_semicolon_non_block_closure.rs:8:12
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | foo(|| bar())
| ^^^^^ expected `()`, found `i32`
|
diff --git a/tests/ui/closures/binder/implicit-return.stderr b/tests/ui/closures/binder/implicit-return.stderr
index 5bfb97113..35db34ce2 100644
--- a/tests/ui/closures/binder/implicit-return.stderr
+++ b/tests/ui/closures/binder/implicit-return.stderr
@@ -1,8 +1,8 @@
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/implicit-return.rs:4:34
+ --> $DIR/implicit-return.rs:4:33
|
LL | let _f = for<'a> |_: &'a ()| {};
- | ------- ^
+ | ------- ^
| |
| `for<...>` is here
diff --git a/tests/ui/closures/binder/implicit-stuff.stderr b/tests/ui/closures/binder/implicit-stuff.stderr
index 779a08a44..cec2a60ba 100644
--- a/tests/ui/closures/binder/implicit-stuff.stderr
+++ b/tests/ui/closures/binder/implicit-stuff.stderr
@@ -41,10 +41,10 @@ LL | let _ = for<'a> |x: &'a ()| -> &() { x };
| ^ explicit lifetime name needed here
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/implicit-stuff.rs:5:22
+ --> $DIR/implicit-stuff.rs:5:21
|
LL | let _ = for<> || {};
- | ----- ^
+ | ----- ^
| |
| `for<...>` is here
diff --git a/tests/ui/closures/closure-expected.rs b/tests/ui/closures/closure-expected.rs
index 68cac3dd8..d730bcd1f 100644
--- a/tests/ui/closures/closure-expected.rs
+++ b/tests/ui/closures/closure-expected.rs
@@ -1,5 +1,5 @@
fn main() {
let x = Some(1);
let y = x.or_else(4);
- //~^ ERROR expected a `FnOnce<()>` closure, found `{integer}`
+ //~^ ERROR expected a `FnOnce()` closure, found `{integer}`
}
diff --git a/tests/ui/closures/closure-expected.stderr b/tests/ui/closures/closure-expected.stderr
index 87a5d67a4..565038f51 100644
--- a/tests/ui/closures/closure-expected.stderr
+++ b/tests/ui/closures/closure-expected.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/closure-expected.rs:3:23
|
LL | let y = x.or_else(4);
- | ------- ^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ------- ^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/closures/coerce-unsafe-to-closure.stderr b/tests/ui/closures/coerce-unsafe-to-closure.stderr
index 449cd0b31..bd4ab13a2 100644
--- a/tests/ui/closures/coerce-unsafe-to-closure.stderr
+++ b/tests/ui/closures/coerce-unsafe-to-closure.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
+error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
--> $DIR/coerce-unsafe-to-closure.rs:2:44
|
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
diff --git a/tests/ui/closures/infer-signature-from-impl.next.stderr b/tests/ui/closures/infer-signature-from-impl.next.stderr
new file mode 100644
index 000000000..973517066
--- /dev/null
+++ b/tests/ui/closures/infer-signature-from-impl.next.stderr
@@ -0,0 +1,16 @@
+error[E0282]: type annotations needed
+ --> $DIR/infer-signature-from-impl.rs:17:16
+ |
+LL | needs_foo(|x| {
+ | ^
+LL | x.to_string();
+ | - type must be known at this point
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | needs_foo(|x: /* Type */| {
+ | ++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/closures/infer-signature-from-impl.rs b/tests/ui/closures/infer-signature-from-impl.rs
new file mode 100644
index 000000000..6e8c94177
--- /dev/null
+++ b/tests/ui/closures/infer-signature-from-impl.rs
@@ -0,0 +1,20 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+//[next] known-bug: trait-system-refactor-initiative#71
+//[current] check-pass
+
+trait Foo {}
+fn needs_foo<T>(_: T)
+where
+ Wrap<T>: Foo,
+{
+}
+
+struct Wrap<T>(T);
+impl<T> Foo for Wrap<T> where T: Fn(i32) {}
+
+fn main() {
+ needs_foo(|x| {
+ x.to_string();
+ });
+}
diff --git a/tests/ui/closures/issue-25439.rs b/tests/ui/closures/issue-25439.rs
index 4f73ff3e3..0269270b1 100644
--- a/tests/ui/closures/issue-25439.rs
+++ b/tests/ui/closures/issue-25439.rs
@@ -5,5 +5,5 @@ fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 {
}
fn main() {
- fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644]
+ fix(|_, x| x); //~ ERROR closure/coroutine type that references itself [E0644]
}
diff --git a/tests/ui/closures/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr
index dadae23fd..5e889e6c1 100644
--- a/tests/ui/closures/issue-25439.stderr
+++ b/tests/ui/closures/issue-25439.stderr
@@ -1,4 +1,4 @@
-error[E0644]: closure/generator type that references itself
+error[E0644]: closure/coroutine type that references itself
--> $DIR/issue-25439.rs:8:9
|
LL | fix(|_, x| x);
diff --git a/tests/ui/codegen/issue-79865-llvm-miscompile.rs b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
index b77f09f8e..6f994a5cb 100644
--- a/tests/ui/codegen/issue-79865-llvm-miscompile.rs
+++ b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
@@ -4,7 +4,7 @@
// Regression test for issue #79865.
// The assertion will fail when compiled with Rust 1.56..=1.59
-// due to a LLVM miscompilation.
+// due to an LLVM miscompilation.
use std::arch::x86_64::*;
diff --git a/tests/ui/codemap_tests/tab.stderr b/tests/ui/codemap_tests/tab.stderr
index c3f19d20d..d2de74865 100644
--- a/tests/ui/codemap_tests/tab.stderr
+++ b/tests/ui/codemap_tests/tab.stderr
@@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/tab.rs:8:2
|
LL | fn foo() {
- | - help: try adding a return type: `-> &'static str`
+ | - help: try adding a return type: `-> &'static str`
LL | "bar boo"
| ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&str`
diff --git a/tests/ui/coercion/issue-53475.stderr b/tests/ui/coercion/issue-53475.stderr
index 522c50dca..4778611bf 100644
--- a/tests/ui/coercion/issue-53475.stderr
+++ b/tests/ui/coercion/issue-53475.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-53475.rs:10:1
|
LL | impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<T: 'static> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
| +++++++++
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
index 20ff87549..bce3b0fd7 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
+++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
@@ -6,5 +6,6 @@
trait NotObjectSafe { fn eq(&self, other: Self); }
impl NotObjectSafe for dyn NotObjectSafe { }
//~^ ERROR E0038
+//~| ERROR E0046
fn main() { }
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
index e9090c1b6..1dcc30ee6 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
+++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
@@ -13,6 +13,15 @@ LL | trait NotObjectSafe { fn eq(&self, other: Self); }
| this trait cannot be made into an object...
= help: consider moving `eq` to another trait
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `eq`
+ --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:1
+ |
+LL | trait NotObjectSafe { fn eq(&self, other: Self); }
+ | -------------------------- `eq` from trait
+LL | impl NotObjectSafe for dyn NotObjectSafe { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0038, E0046.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
index 3acf0d8d3..0e16d12a1 100644
--- a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
+++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
@@ -1,5 +1,5 @@
// revisions: stock with_negative_coherence
-//[with_negative_coherence] check-pass
+//[with_negative_coherence] known-bug: unknown
#![feature(negative_impls)]
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
new file mode 100644
index 000000000..097cc4e0f
--- /dev/null
+++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_`
+ --> $DIR/coherence-negative-outlives-lifetimes.rs:14:1
+ |
+LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
+ | ---------------------------------------------- first implementation here
+LL | impl<'a, T> MyTrait<'a> for &'a T {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.next.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
index 9d62efbc3..6c2e9466b 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.next.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
@@ -10,7 +10,7 @@ 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
+ | --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
index 9d62efbc3..6c2e9466b 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.old.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
@@ -10,7 +10,7 @@ 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
+ | --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.rs b/tests/ui/coherence/coherence-overlap-trait-alias.rs
index 9d9c76af9..d42a666c5 100644
--- a/tests/ui/coherence/coherence-overlap-trait-alias.rs
+++ b/tests/ui/coherence/coherence-overlap-trait-alias.rs
@@ -13,8 +13,6 @@ impl B for u32 {}
trait C {}
impl<T: AB> C for T {}
impl C for u32 {}
-//~^ ERROR
-// FIXME it's giving an ungreat error but unsure if we care given that it's using an internal rustc
-// attribute and an artificial code path for testing purposes
+//~^ ERROR conflicting implementations of trait `C` for type `u32`
fn main() {}
diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.stderr b/tests/ui/coherence/coherence-overlap-trait-alias.stderr
index 668b8319b..687f3af00 100644
--- a/tests/ui/coherence/coherence-overlap-trait-alias.stderr
+++ b/tests/ui/coherence/coherence-overlap-trait-alias.stderr
@@ -1,17 +1,11 @@
-error[E0283]: type annotations needed: cannot satisfy `u32: C`
- --> $DIR/coherence-overlap-trait-alias.rs:15:12
- |
-LL | impl C for u32 {}
- | ^^^
- |
-note: multiple `impl`s satisfying `u32: C` found
- --> $DIR/coherence-overlap-trait-alias.rs:14:1
+error[E0119]: conflicting implementations of trait `C` for type `u32`
+ --> $DIR/coherence-overlap-trait-alias.rs:15:1
|
LL | impl<T: AB> C for T {}
- | ^^^^^^^^^^^^^^^^^^^
+ | ------------------- first implementation here
LL | impl C for u32 {}
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ conflicting implementation for `u32`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0283`.
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-upstream.stderr b/tests/ui/coherence/coherence-overlap-upstream.stderr
index f6145c188..8272c8875 100644
--- a/tests/ui/coherence/coherence-overlap-upstream.stderr
+++ b/tests/ui/coherence/coherence-overlap-upstream.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`
--> $DIR/coherence-overlap-upstream.rs:13:1
|
LL | impl<T> Foo for T where T: Remote {}
- | ----------------- first implementation here
+ | --------------------------------- first implementation here
LL | impl Foo for i16 {}
| ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
|
diff --git a/tests/ui/coherence/coherence-overlap-with-regions.rs b/tests/ui/coherence/coherence-overlap-with-regions.rs
index 32f01f418..9945c8e6c 100644
--- a/tests/ui/coherence/coherence-overlap-with-regions.rs
+++ b/tests/ui/coherence/coherence-overlap-with-regions.rs
@@ -1,4 +1,10 @@
-// check-pass
+// known-bug: unknown
+
+// This fails because we currently perform negative coherence in coherence mode.
+// This means that when looking for a negative predicate, we also assemble a
+// coherence-unknowable predicate. Since confirming the negative impl has region
+// obligations, we don't prefer the impl over the unknowable predicate
+// unconditionally and instead flounder.
#![feature(negative_impls)]
#![feature(rustc_attrs)]
diff --git a/tests/ui/coherence/coherence-overlap-with-regions.stderr b/tests/ui/coherence/coherence-overlap-with-regions.stderr
new file mode 100644
index 000000000..fd25f0978
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-with-regions.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&_`
+ --> $DIR/coherence-overlap-with-regions.rs:20:1
+ |
+LL | impl<T: Foo> Bar for T {}
+ | ---------------------- first implementation here
+LL | impl<T> Bar for &T where T: 'static {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr
index 89615f0fb..600cd42d8 100644
--- a/tests/ui/coherence/coherence-wasm-bindgen.stderr
+++ b/tests/ui/coherence/coherence-wasm-bindgen.stderr
@@ -1,11 +1,17 @@
error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn Fn(&_) -> _`
--> $DIR/coherence-wasm-bindgen.rs:28:1
|
-LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
- | ------------------------------------------------------------ first implementation here
+LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
+LL | | where
+LL | | A: FromWasmAbi,
+LL | | R: ReturnWasmAbi,
+ | |_____________________- first implementation here
...
-LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn Fn(&_) -> _`
+LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
+LL | | where
+LL | | A: RefFromWasmAbi,
+LL | | R: ReturnWasmAbi,
+ | |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _`
|
= 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 #56105 <https://github.com/rust-lang/rust/issues/56105>
diff --git a/tests/ui/coherence/coherence-with-generator.rs b/tests/ui/coherence/coherence-with-coroutine.rs
index 5eb8dc2a4..21857d7fe 100644
--- a/tests/ui/coherence/coherence-with-generator.rs
+++ b/tests/ui/coherence/coherence-with-coroutine.rs
@@ -1,13 +1,13 @@
// Test that encountering closures during coherence does not cause issues.
-#![feature(type_alias_impl_trait, generators)]
+#![feature(type_alias_impl_trait, coroutines)]
#![cfg_attr(specialized, feature(specialization))]
#![allow(incomplete_features)]
// revisions: stock specialized
// [specialized]check-pass
-type OpaqueGenerator = impl Sized;
-fn defining_use() -> OpaqueGenerator {
+type OpaqueCoroutine = impl Sized;
+fn defining_use() -> OpaqueCoroutine {
|| {
for i in 0..10 {
yield i;
@@ -17,8 +17,8 @@ fn defining_use() -> OpaqueGenerator {
struct Wrapper<T>(T);
trait Trait {}
-impl Trait for Wrapper<OpaqueGenerator> {}
+impl Trait for Wrapper<OpaqueCoroutine> {}
impl<T: Sync> Trait for Wrapper<T> {}
-//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
+//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
fn main() {}
diff --git a/tests/ui/coherence/coherence-with-generator.stock.stderr b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
index 478ac4912..b2a9135c5 100644
--- a/tests/ui/coherence/coherence-with-generator.stock.stderr
+++ b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
@@ -1,10 +1,10 @@
-error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
- --> $DIR/coherence-with-generator.rs:21:1
+error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
+ --> $DIR/coherence-with-coroutine.rs:21:1
|
-LL | impl Trait for Wrapper<OpaqueGenerator> {}
+LL | impl Trait for Wrapper<OpaqueCoroutine> {}
| --------------------------------------- first implementation here
LL | impl<T: Sync> Trait for Wrapper<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueGenerator>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueCoroutine>`
error: aborting due to previous error
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
index 0dd28706e..9b2dbc66c 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
@@ -1,11 +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 From<()> for S {
+ | ------------------- first implementation here
...
-LL | impl<I> From<I> for S
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+LL | / impl<I> From<I> for S
+LL | |
+LL | | where
+LL | | I: Iterator<Item = ()>,
+ | |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
index 0dd28706e..9b2dbc66c 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
@@ -1,11 +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 From<()> for S {
+ | ------------------- first implementation here
...
-LL | impl<I> From<I> for S
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+LL | / impl<I> From<I> for S
+LL | |
+LL | | where
+LL | | I: Iterator<Item = ()>,
+ | |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr
new file mode 100644
index 000000000..4cf50b4f2
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&_`
+ --> $DIR/negative-coherence-considering-regions.rs:22:1
+ |
+LL | impl<T> Bar for T where T: Foo {}
+ | ------------------------------ first implementation here
+...
+LL | impl<T> Bar for &T {}
+ | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.rs b/tests/ui/coherence/negative-coherence-considering-regions.rs
new file mode 100644
index 000000000..597a59726
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.rs
@@ -0,0 +1,29 @@
+// revisions: any_lt static_lt
+//[static_lt] known-bug: unknown
+
+// This fails because we currently perform negative coherence in coherence mode.
+// This means that when looking for a negative predicate, we also assemble a
+// coherence-unknowable predicate. Since confirming the negative impl has region
+// obligations, we don't prefer the impl over the unknowable predicate
+// unconditionally and instead flounder.
+
+#![feature(negative_impls)]
+#![feature(with_negative_coherence)]
+
+trait Foo {}
+
+impl<T> !Foo for &'static T {}
+
+trait Bar {}
+
+impl<T> Bar for T where T: Foo {}
+
+#[cfg(any_lt)]
+impl<T> Bar for &T {}
+//[any_lt]~^ ERROR conflicting implementations of trait `Bar` for type `&_`
+
+#[cfg(static_lt)]
+impl<T> Bar for &'static T {}
+
+
+fn main() {}
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr
new file mode 100644
index 000000000..87e7be2aa
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&'static _`
+ --> $DIR/negative-coherence-considering-regions.rs:26:1
+ |
+LL | impl<T> Bar for T where T: Foo {}
+ | ------------------------------ first implementation here
+...
+LL | impl<T> Bar for &'static T {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&'static _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
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 89289767b..4f32639a6 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
@@ -1,11 +1,16 @@
error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
|
-LL | #[derive(PartialEq, Default)]
- | --------- the second impl is here
+LL | #[derive(PartialEq, Default)]
+ | --------- the second impl is here
...
-LL | impl<T, Q> PartialEq<Q> for Interval<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
+LL | / impl<T, Q> PartialEq<Q> for Interval<T>
+LL | |
+LL | |
+LL | | where
+LL | | T: Borrow<Q>,
+LL | | Q: ?Sized + PartialOrd,
+ | |___________________________^ the first impl is here
|
= 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>
@@ -19,3 +24,28 @@ LL | #![deny(coinductive_overlap_in_coherence)]
error: aborting due to previous error
+Future incompatibility report: Future breakage diagnostic:
+error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
+ --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
+ |
+LL | #[derive(PartialEq, Default)]
+ | --------- the second impl is here
+...
+LL | / impl<T, Q> PartialEq<Q> for Interval<T>
+LL | |
+LL | |
+LL | | where
+LL | | T: Borrow<Q>,
+LL | | Q: ?Sized + PartialOrd,
+ | |___________________________^ the first impl is here
+ |
+ = 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
+ |
+LL | #![deny(coinductive_overlap_in_coherence)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr
index f632a53f2..a87b713c2 100644
--- a/tests/ui/compare-method/bad-self-type.stderr
+++ b/tests/ui/compare-method/bad-self-type.stderr
@@ -28,10 +28,10 @@ LL | fn foo(self);
found signature `fn(Box<MyFuture>)`
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/bad-self-type.rs:24:18
+ --> $DIR/bad-self-type.rs:24:17
|
LL | fn bar(self) {}
- | ^ expected `Option<()>`, found `()`
+ | ^ expected `Option<()>`, found `()`
|
note: type in trait
--> $DIR/bad-self-type.rs:18:21
diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
index d5b4349c0..12557ff63 100644
--- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
+++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
@@ -74,6 +74,7 @@ LL | #[cfg(feature = $expr)]
LL | generate_s10!(concat!("nonexistent"));
| ------------------------------------- in this macro invocation
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 11 previous errors
diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
index d7e5e50cb..6d5cd4547 100644
--- a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
+++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
@@ -39,6 +39,7 @@ note: associated constant defined here
|
LL | const MODE: Mode;
| ^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/const-arg-in-const-arg.rs b/tests/ui/const-generics/const-arg-in-const-arg.rs
index 9eaa54347..c1a4c3dc3 100644
--- a/tests/ui/const-generics/const-arg-in-const-arg.rs
+++ b/tests/ui/const-generics/const-arg-in-const-arg.rs
@@ -1,5 +1,5 @@
// revisions: min
-// we use a single revision because t his shoudl have a `full` revision
+// we use a single revision because this should have a `full` revision
// but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work
#![cfg_attr(full, feature(generic_const_exprs))]
diff --git a/tests/ui/const-generics/const-argument-if-length.full.stderr b/tests/ui/const-generics/const-argument-if-length.full.stderr
index 7997026df..315b0f0a0 100644
--- a/tests/ui/const-generics/const-argument-if-length.full.stderr
+++ b/tests/ui/const-generics/const-argument-if-length.full.stderr
@@ -1,3 +1,11 @@
+error: unconstrained generic constant
+ --> $DIR/const-argument-if-length.rs:17:10
+ |
+LL | pad: [u8; is_zst::<T>()],
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
+
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:15:12
|
@@ -22,14 +30,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | value: Box<T>,
| ++++ +
-error: unconstrained generic constant
- --> $DIR/const-argument-if-length.rs:17:10
- |
-LL | pad: [u8; is_zst::<T>()],
- | ^^^^^^^^^^^^^^^^^^^
- |
- = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
-
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/defaults/default-annotation.rs b/tests/ui/const-generics/defaults/default-annotation.rs
index 7a9f5732f..587ad78e2 100644
--- a/tests/ui/const-generics/defaults/default-annotation.rs
+++ b/tests/ui/const-generics/defaults/default-annotation.rs
@@ -4,12 +4,12 @@
// FIXME(const_generics_defaults): It seems like we aren't testing the right thing here,
// I would assume that we want the attributes to apply to the const parameter defaults
// themselves.
-#![stable(feature = "const_default_test", since="none")]
+#![stable(feature = "const_default_test", since = "3.3.3")]
-#[unstable(feature = "const_default_stable", issue="none")]
+#[unstable(feature = "const_default_stable", issue = "none")]
pub struct ConstDefaultUnstable<const N: usize = 3>;
-#[stable(feature = "const_default_unstable", since="none")]
+#[stable(feature = "const_default_unstable", since = "3.3.3")]
pub struct ConstDefaultStable<const N: usize = {
3
}>;
diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
index 29aa0f59d..c254b4ee0 100644
--- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
+++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
@@ -15,7 +15,7 @@ fn bad_infer_fn<_>() {}
fn main() {
- let a: All<_, _, _>;
+ let a: All<_, _, _>; //~ ERROR struct takes 2 generic arguments but 3
all_fn();
let v: [u8; _];
let v: [u8; 10] = [0; _];
diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
index e6d0c743d..a6b736261 100644
--- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
+++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
@@ -19,6 +19,21 @@ LL | struct BadInfer<_>;
= help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `_` to be a const parameter, use `const _: usize` instead
-error: aborting due to 3 previous errors
+error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied
+ --> $DIR/infer-arg-test.rs:18:10
+ |
+LL | let a: All<_, _, _>;
+ | ^^^ - help: remove this generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: struct defined here, with 2 generic parameters: `T`, `N`
+ --> $DIR/infer-arg-test.rs:3:8
+ |
+LL | struct All<'a, T, const N: usize> {
+ | ^^^ - --------------
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0392`.
+Some errors have detailed explanations: E0107, E0392.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
index 6b2a0153f..5f612780f 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
@@ -3,6 +3,7 @@
// failure-status: 101
// normalize-stderr-test "note: .*\n\n" -> ""
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
// rustc-env:RUST_BACKTRACE=0
// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
index 79ed82e02..9b66fc502 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
@@ -1,9 +1,9 @@
-error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
+error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:LL:CC: SizeOf MIR operator called for unsized type dyn Debug
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
Box<dyn Any>
query stack during panic:
-#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
+#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:26:1: 28:32>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
end of query stack
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
index 4e1d71f15..b7ec65712 100644
--- a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
@@ -5,13 +5,17 @@ LL | fn use_dyn(v: &dyn Foo) {
| ^^^^^^^ `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-err-ret.rs:8:23
+ --> $DIR/object-safety-err-ret.rs:8:8
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn test(&self) -> [u8; bar::<Self>()];
- | ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type
+ | ^^^^ ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type
+ | |
+ | ...because method `test` references the `Self` type in its `where` clause
= help: consider moving `test` to another trait
+ = help: consider moving `test` to another trait
+ = help: only type `()` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
new file mode 100644
index 000000000..5813f0981
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
@@ -0,0 +1,13 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait Q {
+ const ASSOC: usize;
+}
+
+impl<const N: u64> Q for [u8; N] {}
+//~^ ERROR not all trait items implemented
+
+pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
+
+pub fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
new file mode 100644
index 000000000..0314d7ed2
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `ASSOC`
+ --> $DIR/type_mismatch.rs:8:1
+ |
+LL | const ASSOC: usize;
+ | ------------------ `ASSOC` from trait
+...
+LL | impl<const N: u64> Q for [u8; N] {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index 796966b22..5832dbe17 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-100313.rs:10:13
|
LL | *(B as *const bool as *mut bool) = false;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc7 which is read-only
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to ALLOC0 which is read-only
|
note: inside `T::<&true>::set_false`
--> $DIR/issue-100313.rs:10:13
diff --git a/tests/ui/const-generics/issues/issue-67945-1.full.stderr b/tests/ui/const-generics/issues/issue-67945-1.full.stderr
index 8879aec35..ee17ec3c6 100644
--- a/tests/ui/const-generics/issues/issue-67945-1.full.stderr
+++ b/tests/ui/const-generics/issues/issue-67945-1.full.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-67945-1.rs:10:20
|
LL | struct Bug<S> {
- | - this type parameter
+ | - expected this type parameter
...
LL | let x: S = MaybeUninit::uninit();
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr
index a5dbe10b7..54ef1ea1e 100644
--- a/tests/ui/const-generics/issues/issue-74950.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74950.min.stderr
@@ -15,6 +15,7 @@ LL | struct Outer<const I: Inner>;
|
= 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -24,6 +25,7 @@ LL | struct Outer<const I: Inner>;
|
= 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -33,6 +35,7 @@ LL | struct Outer<const I: Inner>;
|
= 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -42,6 +45,7 @@ LL | struct Outer<const I: Inner>;
|
= 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/const-generics/issues/issue-83249.stderr b/tests/ui/const-generics/issues/issue-83249.stderr
index 7491fdc8a..5187434ff 100644
--- a/tests/ui/const-generics/issues/issue-83249.stderr
+++ b/tests/ui/const-generics/issues/issue-83249.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-83249.rs:19:9
|
LL | let _ = foo([0; 1]);
- | ^
+ | ^ --- ------ type must be known at this point
+ | |
+ | required by a bound introduced by this call
|
+ = note: cannot satisfy `_: Foo`
+ = help: the trait `Foo` is implemented for `u8`
+note: required by a bound in `foo`
+ --> $DIR/issue-83249.rs:12:11
+ |
+LL | fn foo<T: Foo>(_: [u8; T::N]) -> T {
+ | ^^^ required by this bound in `foo`
help: consider giving this pattern a type
|
LL | let _: /* Type */ = foo([0; 1]);
@@ -11,4 +20,4 @@ LL | let _: /* Type */ = foo([0; 1]);
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
index 51ef354e3..61d055e80 100644
--- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
+++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied
LL | let _ = A;
| ^ the trait `Bar<_>` is not implemented for `A<_>`
|
- = help: the trait `Bar<N>` is implemented for `A<7>`
+ = help: the trait `Bar<_>` is implemented for `A<7>`
note: required by a bound in `A`
--> $DIR/unused-substs-1.rs:9:11
|
diff --git a/tests/ui/const-ptr/allowed_slices.rs b/tests/ui/const-ptr/allowed_slices.rs
index 3f19cd4d8..3561338a7 100644
--- a/tests/ui/const-ptr/allowed_slices.rs
+++ b/tests/ui/const-ptr/allowed_slices.rs
@@ -2,8 +2,6 @@
#![feature(
slice_from_ptr_range,
const_slice_from_ptr_range,
- pointer_byte_offsets,
- const_pointer_byte_offsets
)]
use std::{
mem::MaybeUninit,
diff --git a/tests/ui/const-ptr/forbidden_slices.rs b/tests/ui/const-ptr/forbidden_slices.rs
index 192b6a46d..0374ac7f7 100644
--- a/tests/ui/const-ptr/forbidden_slices.rs
+++ b/tests/ui/const-ptr/forbidden_slices.rs
@@ -1,13 +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"
-// normalize-stderr-test "alloc\d+" -> "allocN"
-// error-pattern: could not evaluate static initializer
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*A(LLOC)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+
#![feature(
slice_from_ptr_range,
const_slice_from_ptr_range,
- pointer_byte_offsets,
- const_pointer_byte_offsets
)]
use std::{
mem::{size_of, MaybeUninit},
@@ -17,10 +14,13 @@ use std::{
// Null is never valid for reads
pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
+//~^ ERROR: it is undefined behavior to use this value
pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
+//~^ ERROR: it is undefined behavior to use this value
// Out of bounds
pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
+//~^ ERROR: it is undefined behavior to use this value
// Reading uninitialized data
pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }; //~ ERROR: it is undefined behavior to use this value
@@ -39,6 +39,7 @@ pub static S7: &[u16] = unsafe {
// Unaligned read
pub static S8: &[u64] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
let ptr = (&D4 as *const [u32; 2] as *const u32).byte_add(1).cast::<u64>();
from_raw_parts(ptr, 1)
@@ -66,8 +67,9 @@ pub static R6: &[bool] = unsafe {
from_ptr_range(ptr..ptr.add(4))
};
pub static R7: &[u16] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
- from_ptr_range(ptr..ptr.add(4)) //~ inside `R7`
+ from_ptr_range(ptr..ptr.add(4))
};
pub static R8: &[u64] = unsafe {
let ptr = (&D4 as *const [u32; 2] as *const u32).byte_add(1).cast::<u64>();
diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr
index 294bc77aa..105683940 100644
--- a/tests/ui/const-ptr/forbidden_slices.stderr
+++ b/tests/ui/const-ptr/forbidden_slices.stderr
@@ -1,41 +1,35 @@
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
- |
-note: inside `std::slice::from_raw_parts::<'_, u32>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S0`
- --> $DIR/forbidden_slices.rs:19:34
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:16:1
|
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
-note: inside `std::slice::from_raw_parts::<'_, ()>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S1`
- --> $DIR/forbidden_slices.rs:20:33
- |
-LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:18:1
|
- = note: dereferencing pointer failed: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
-note: inside `std::slice::from_raw_parts::<'_, u32>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S2`
- --> $DIR/forbidden_slices.rs:23:34
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:22:1
|
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
+ |
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:26:1
@@ -83,18 +77,16 @@ LL | pub static S7: &[u16] = unsafe {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:41:1
|
-note: inside `std::slice::from_raw_parts::<'_, u64>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S8`
- --> $DIR/forbidden_slices.rs:44:5
+LL | pub static S8: &[u64] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
|
-LL | from_raw_parts(ptr, 1)
- | ^^^^^^^^^^^^^^^^^^^^^^
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -106,7 +98,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R0`
- --> $DIR/forbidden_slices.rs:47:34
+ --> $DIR/forbidden_slices.rs:48:34
|
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,7 +113,7 @@ note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
note: inside `from_ptr_range::<'_, ()>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R1`
- --> $DIR/forbidden_slices.rs:48:33
+ --> $DIR/forbidden_slices.rs:49:33
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -130,18 +122,18 @@ LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC10 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u32>::add`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `R2`
- --> $DIR/forbidden_slices.rs:51:25
+ --> $DIR/forbidden_slices.rs:52:25
|
LL | from_ptr_range(ptr..ptr.add(2))
| ^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:53:1
+ --> $DIR/forbidden_slices.rs:54:1
|
LL | pub static R4: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -152,7 +144,7 @@ LL | pub static R4: &[u8] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:58:1
+ --> $DIR/forbidden_slices.rs:59:1
|
LL | pub static R5: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -165,7 +157,7 @@ LL | pub static R5: &[u8] = unsafe {
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:63:1
+ --> $DIR/forbidden_slices.rs:64:1
|
LL | pub static R6: &[bool] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -175,30 +167,26 @@ LL | pub static R6: &[bool] = unsafe {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:69:1
|
- = note: accessing memory with alignment 1, but alignment 2 is required
+LL | pub static R7: &[u16] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
|
-note: inside `std::slice::from_raw_parts::<'_, u16>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `from_ptr_range::<'_, u16>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `R7`
- --> $DIR/forbidden_slices.rs:70:5
- |
-LL | from_ptr_range(ptr..ptr.add(4))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC11 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u64>::add`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `R8`
- --> $DIR/forbidden_slices.rs:74:25
+ --> $DIR/forbidden_slices.rs:76:25
|
LL | from_ptr_range(ptr..ptr.add(1))
| ^^^^^^^^^^
@@ -213,7 +201,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R9`
- --> $DIR/forbidden_slices.rs:79:34
+ --> $DIR/forbidden_slices.rs:81:34
|
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -228,7 +216,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R10`
- --> $DIR/forbidden_slices.rs:80:35
+ --> $DIR/forbidden_slices.rs:82:35
|
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr
index c5c0a1cde..be75f76b2 100644
--- a/tests/ui/const-ptr/out_of_bounds_read.stderr
+++ b/tests/ui/const-ptr/out_of_bounds_read.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -14,7 +14,7 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -29,7 +29,7 @@ LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/const_prop/overwrite_with_const_with_params.rs b/tests/ui/const_prop/overwrite_with_const_with_params.rs
new file mode 100644
index 000000000..6f533919a
--- /dev/null
+++ b/tests/ui/const_prop/overwrite_with_const_with_params.rs
@@ -0,0 +1,21 @@
+// compile-flags: -O
+// run-pass
+
+// Regression test for https://github.com/rust-lang/rust/issues/118328
+
+#![allow(unused_assignments)]
+
+struct SizeOfConst<T>(std::marker::PhantomData<T>);
+impl<T> SizeOfConst<T> {
+ const SIZE: usize = std::mem::size_of::<T>();
+}
+
+fn size_of<T>() -> usize {
+ let mut a = 0;
+ a = SizeOfConst::<T>::SIZE;
+ a
+}
+
+fn main() {
+ assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>());
+}
diff --git a/tests/ui/consts/assert-type-intrinsics.rs b/tests/ui/consts/assert-type-intrinsics.rs
index b4fd423be..32b5f5c92 100644
--- a/tests/ui/consts/assert-type-intrinsics.rs
+++ b/tests/ui/consts/assert-type-intrinsics.rs
@@ -1,5 +1,4 @@
#![feature(never_type)]
-#![feature(const_assert_type2)]
#![feature(core_intrinsics)]
use std::intrinsics;
diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr
index 3c03b03de..66c4f0f9c 100644
--- a/tests/ui/consts/assert-type-intrinsics.stderr
+++ b/tests/ui/consts/assert-type-intrinsics.stderr
@@ -1,20 +1,20 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:12:9
+ --> $DIR/assert-type-intrinsics.rs:11:9
|
LL | MaybeUninit::<!>::uninit().assume_init();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:12:36
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:11:36
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:16:9
+ --> $DIR/assert-type-intrinsics.rs:15:9
|
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:16:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:15:9
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:20:9
+ --> $DIR/assert-type-intrinsics.rs:19:9
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:20:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:19:9
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const-adt-align-mismatch.rs b/tests/ui/consts/const-adt-align-mismatch.rs
index bd51bc9f2..89b3a9b74 100644
--- a/tests/ui/consts/const-adt-align-mismatch.rs
+++ b/tests/ui/consts/const-adt-align-mismatch.rs
@@ -12,7 +12,7 @@ enum Foo {
}
// NOTE(eddyb) Don't make this a const, needs to be a static
-// so it is always instantiated as a LLVM constant value.
+// so it is always instantiated as an LLVM constant value.
static FOO: Foo = Foo::C;
fn main() {
diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
index 174103eeb..eb8b8ac75 100644
--- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -6,13 +6,17 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
|
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
LL | struct Bar;
|
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Option<Bar> = no_copy();
+LL ~ let _: [Option<Bar>; 2] = [ARRAY_REPEAT_VALUE; 2];
+ |
error: aborting due to previous error
diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr
index 06fa4b0b1..858ffa820 100644
--- a/tests/ui/consts/const-blocks/trait-error.stderr
+++ b/tests/ui/consts/const-blocks/trait-error.stderr
@@ -10,9 +10,13 @@ note: required for `Foo<String>` to implement `Copy`
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Foo<String> = Foo(String::new());
+LL ~ [ARRAY_REPEAT_VALUE; 4];
+ |
error: aborting due to previous error
diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr
index 54fafded0..d8971eb99 100644
--- a/tests/ui/consts/const-compare-bytes-ub.stderr
+++ b/tests/ui/consts/const-compare-bytes-ub.stderr
@@ -20,25 +20,25 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:22:9
|
LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc6 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:26:9
|
LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc13 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC1 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:30:9
|
LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc17[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:34:9
|
LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc25[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC3[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:38:9
diff --git a/tests/ui/consts/const-deref-ptr.rs b/tests/ui/consts/const-deref-ptr.rs
index 4aca75e3a..2607d4de2 100644
--- a/tests/ui/consts/const-deref-ptr.rs
+++ b/tests/ui/consts/const-deref-ptr.rs
@@ -3,5 +3,6 @@
fn main() {
static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
//~^ ERROR could not evaluate static initializer
+ //~| dangling pointer
println!("{}", C);
}
diff --git a/tests/ui/consts/const-deref-ptr.stderr b/tests/ui/consts/const-deref-ptr.stderr
index 22cb6451e..16eb6b016 100644
--- a/tests/ui/consts/const-deref-ptr.stderr
+++ b/tests/ui/consts/const-deref-ptr.stderr
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
--> $DIR/const-deref-ptr.rs:4:29
|
LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0xdeadbeef[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0xdeadbeef[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr
index 85bc56bae..35c3d0001 100644
--- a/tests/ui/consts/const-err-late.stderr
+++ b/tests/ui/consts/const-err-late.stderr
@@ -27,6 +27,8 @@ note: erroneous constant encountered
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs
new file mode 100644
index 000000000..c1460fdd9
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs
@@ -0,0 +1,14 @@
+// only-wasm32
+// compile-flags:-C target-feature=-simd128
+// build-pass
+
+#![crate_type = "lib"]
+
+#[cfg(target_feature = "simd128")]
+compile_error!("simd128 target feature should be disabled");
+
+// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988
+const A: () = simd128_fn();
+
+#[target_feature(enable = "simd128")]
+const fn simd128_fn() {}
diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
index e41dea873..e6cd25e42 100644
--- a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_raw_ptr_ops2.rs:7:26
|
LL | const Z2: i32 = unsafe { *(42 as *const i32) };
- | ^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
error[E0080]: evaluation of constant value failed
--> $DIR/const_raw_ptr_ops2.rs:9:26
|
LL | const Z3: i32 = unsafe { *(44 as *const i32) };
- | ^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/dangling.rs b/tests/ui/consts/const-eval/dangling.rs
deleted file mode 100644
index 4fcf87921..000000000
--- a/tests/ui/consts/const-eval/dangling.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use std::mem;
-
-// Make sure we error with the right kind of error on a too large slice.
-const TEST: () = { unsafe {
- let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
- let _val = &*slice; //~ ERROR: evaluation of constant value failed
- //~| slice is bigger than largest supported object
-} };
-
-fn main() {}
diff --git a/tests/ui/consts/const-eval/dangling.stderr b/tests/ui/consts/const-eval/dangling.stderr
deleted file mode 100644
index 92d70573d..000000000
--- a/tests/ui/consts/const-eval/dangling.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/dangling.rs:6:16
- |
-LL | let _val = &*slice;
- | ^^^^^^^ invalid metadata in wide pointer: slice is bigger than largest supported object
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
index a0f4519ea..82de91eff 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= 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: 4, align: 4) {
- ╾─alloc2──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
index d2bffa425..de23aafe0 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= 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: 8, align: 8) {
- ╾───────alloc2────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
index b6d89a58d..a717a5f82 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
@@ -5,10 +5,10 @@
use std::intrinsics;
const _X: &'static u8 = unsafe {
+ //~^ error: dangling pointer in final constant
let ptr = intrinsics::const_allocate(4, 4);
intrinsics::const_deallocate(ptr, 4, 4);
&*ptr
- //~^ error: evaluation of constant value failed
};
const _Y: u8 = unsafe {
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
index b50ef0c68..5f4630f6f 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
@@ -1,14 +1,14 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/dealloc_intrinsic_dangling.rs:10:5
+error: encountered dangling pointer in final constant
+ --> $DIR/dealloc_intrinsic_dangling.rs:7:1
|
-LL | &*ptr
- | ^^^^^ dereferencing pointer failed: alloc2 has been freed, so this pointer is dangling
+LL | const _X: &'static u8 = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_dangling.rs:18:5
|
LL | *reference
- | ^^^^^^^^^^ dereferencing pointer failed: alloc4 has been freed, so this pointer is dangling
+ | ^^^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
index 0884ade45..916344a7b 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_duplicate.rs:9:5
|
LL | intrinsics::const_deallocate(ptr, 4, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc2 has been freed, so this pointer is dangling
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
index 4c23957a1..4b1f0f686 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
@@ -2,19 +2,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:8:5
|
LL | intrinsics::const_deallocate(ptr, 4, 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc2 has size 4 and alignment 4, but gave size 4 and alignment 2
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC0 has size 4 and alignment 4, but gave size 4 and alignment 2
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:13:5
|
LL | intrinsics::const_deallocate(ptr, 2, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc4 has size 4 and alignment 4, but gave size 2 and alignment 4
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC1 has size 4 and alignment 4, but gave size 2 and alignment 4
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:19:5
|
LL | intrinsics::const_deallocate(ptr, 3, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc6 has size 4 and alignment 4, but gave size 3 and alignment 4
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC2 has size 4 and alignment 4, but gave size 3 and alignment 4
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:25:5
diff --git a/tests/ui/consts/const-eval/issue-114994-fail.rs b/tests/ui/consts/const-eval/issue-114994-fail.rs
new file mode 100644
index 000000000..723504640
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994-fail.rs
@@ -0,0 +1,14 @@
+// This checks that function pointer signatures that are referenced mutably
+// but contain a &mut T parameter still fail in a constant context: see issue #114994.
+//
+// check-fail
+
+const fn use_mut_const_fn(_f: &mut fn(&mut String)) { //~ ERROR mutable references are not allowed in constant functions
+ ()
+}
+
+const fn use_mut_const_tuple_fn(_f: (fn(), &mut u32)) { //~ ERROR mutable references are not allowed in constant functions
+
+}
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/issue-114994-fail.stderr b/tests/ui/consts/const-eval/issue-114994-fail.stderr
new file mode 100644
index 000000000..4dae8ea9b
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994-fail.stderr
@@ -0,0 +1,21 @@
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/issue-114994-fail.rs:6:27
+ |
+LL | const fn use_mut_const_fn(_f: &mut fn(&mut String)) {
+ | ^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/issue-114994-fail.rs:10:33
+ |
+LL | const fn use_mut_const_tuple_fn(_f: (fn(), &mut u32)) {
+ | ^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/consts/const-eval/issue-114994.rs b/tests/ui/consts/const-eval/issue-114994.rs
new file mode 100644
index 000000000..a4cb2e61e
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994.rs
@@ -0,0 +1,18 @@
+// This checks that function pointer signatures containing &mut T types
+// work in a constant context: see issue #114994.
+//
+// check-pass
+
+const fn use_const_fn(_f: fn(&mut String)) {
+ ()
+}
+
+const fn get_some_fn() -> fn(&mut String) {
+ String::clear
+}
+
+const fn some_const_fn() {
+ let _f: fn(&mut String) = String::clear;
+}
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index c7aaee942..eea42c8ce 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -24,6 +24,7 @@ note: erroneous constant encountered
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= 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)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/issue-49296.stderr b/tests/ui/consts/const-eval/issue-49296.stderr
index 45ba0ea18..2022a16e7 100644
--- a/tests/ui/consts/const-eval/issue-49296.stderr
+++ b/tests/ui/consts/const-eval/issue-49296.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-49296.rs:9:16
|
LL | const X: u64 = *wat(42);
- | ^^^^^^^^ dereferencing pointer failed: alloc3 has been freed, so this pointer is dangling
+ | ^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
new file mode 100644
index 000000000..6454ce3d1
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
@@ -0,0 +1,21 @@
+error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
+ --> $DIR/issue-50814-2.rs:16:24
+ |
+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 encountered
+ --> $DIR/issue-50814-2.rs:20:6
+ |
+LL | &<A<T> as Foo<T>>::BAR
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+note: erroneous constant encountered
+ --> $DIR/issue-50814-2.rs:20:5
+ |
+LL | &<A<T> as Foo<T>>::BAR
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
index 450fb0023..c6b1df6c8 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
@@ -1,17 +1,17 @@
error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
- --> $DIR/issue-50814-2.rs:14:24
+ --> $DIR/issue-50814-2.rs:16:24
|
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 encountered
- --> $DIR/issue-50814-2.rs:18:6
+ --> $DIR/issue-50814-2.rs:20:6
|
LL | &<A<T> as Foo<T>>::BAR
| ^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn foo::<()>`
- --> $DIR/issue-50814-2.rs:30:22
+ --> $DIR/issue-50814-2.rs:32:22
|
LL | println!("{:x}", foo::<()>() as *const usize as usize);
| ^^^^^^^^^^^
diff --git a/tests/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs
index 53eb7b149..2eab93beb 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.rs
+++ b/tests/ui/consts/const-eval/issue-50814-2.rs
@@ -1,4 +1,6 @@
// build-fail
+// revisions: normal mir-opt
+// [mir-opt]compile-flags: -Zmir-opt-level=4
trait C {
const BOO: usize;
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
index 3b48e9729..19ab52399 100644
--- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
@@ -1,6 +1,6 @@
use std::ptr::NonNull;
const NON_NULL: NonNull<u8> = unsafe { NonNull::dangling() };
-const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
+const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() }); //~ERROR: evaluation of constant value failed
fn main() {}
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
index de93cb0c3..e34f3f43c 100644
--- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
@@ -1,15 +1,8 @@
error[E0080]: evaluation of constant value failed
- --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- |
- = note: dereferencing pointer failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
- |
-note: inside `NonNull::<u8>::as_ref::<'_>`
- --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
-note: inside `_`
- --> $DIR/nonnull_as_ref_ub.rs:4:39
+ --> $DIR/nonnull_as_ref_ub.rs:4:29
|
LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/nrvo.rs b/tests/ui/consts/const-eval/nrvo.rs
index 1d2c6acc0..22da96a3f 100644
--- a/tests/ui/consts/const-eval/nrvo.rs
+++ b/tests/ui/consts/const-eval/nrvo.rs
@@ -1,7 +1,8 @@
// run-pass
// When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example,
-// its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this.
+// its address may be taken and it may be written to indirectly. Ensure that the const-eval
+// interpreter can handle this.
#![feature(const_mut_refs)]
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 4706497db..50660664f 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -17,6 +17,8 @@ note: erroneous constant encountered
|
LL | let _ = PrintName::VOID;
| ^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
index 13ca4379b..b948e07b9 100644
--- a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
+++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/partial_ptr_overwrite.rs:8:9
|
LL | *(ptr as *mut u8) = 123;
- | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4
+ | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at ALLOC0
|
= 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
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index 042e7eeb3..689ebf752 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -211,7 +211,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:106:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
|
= 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: 4, align: 4) {
@@ -385,7 +385,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:175:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
|
= 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: 8, align: 4) {
@@ -396,7 +396,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:179:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
|
= 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: 8, align: 4) {
@@ -418,7 +418,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
|
= 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: 8, align: 4) {
@@ -451,7 +451,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:196:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
|
= 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: 8, align: 4) {
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 8426a9505..3447a8ab4 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -211,7 +211,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:106:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
|
= 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: 8, align: 8) {
@@ -385,7 +385,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:175:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
|
= 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: 16, align: 8) {
@@ -396,7 +396,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:179:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
|
= 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: 16, align: 8) {
@@ -418,7 +418,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
|
= 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: 16, align: 8) {
@@ -451,7 +451,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:196:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
|
= 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: 16, align: 8) {
diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs
index 6c1238c0a..e00592222 100644
--- a/tests/ui/consts/const-eval/raw-bytes.rs
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -1,8 +1,8 @@
// stderr-per-bitwidth
// ignore-endian-big
// ignore-tidy-linelength
-// normalize-stderr-test "╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$2╼"
-// normalize-stderr-test "alloc\d+" -> "allocN"
+// normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$1╼"
+
#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
#![allow(invalid_value)]
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs
new file mode 100644
index 000000000..3341f3c78
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs
@@ -0,0 +1,45 @@
+#![feature(const_mut_refs)]
+
+
+const MISALIGNED_LOAD: () = unsafe {
+ let mem = [0u32; 8];
+ let ptr = mem.as_ptr().byte_add(1);
+ let _val = *ptr; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+};
+
+const MISALIGNED_STORE: () = unsafe {
+ let mut mem = [0u32; 8];
+ let ptr = mem.as_mut_ptr().byte_add(1);
+ *ptr = 0; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+};
+
+const MISALIGNED_COPY: () = unsafe {
+ let x = &[0_u8; 4];
+ let y = x.as_ptr().cast::<u32>();
+ let mut z = 123;
+ y.copy_to_nonoverlapping(&mut z, 1);
+ //~^NOTE
+ // The actual error points into the implementation of `copy_to_nonoverlapping`.
+};
+
+const MISALIGNED_FIELD: () = unsafe {
+ #[repr(align(16))]
+ struct Aligned(f32);
+
+ let mem = [0f32; 8];
+ let ptr = mem.as_ptr().cast::<Aligned>();
+ // Accessing an f32 field but we still require the alignment of the pointer type.
+ let _val = (*ptr).0; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 4, but alignment 16 is required
+};
+
+const OOB: () = unsafe {
+ let mem = [0u32; 1];
+ let ptr = mem.as_ptr().cast::<u64>();
+ let _val = *ptr; //~ERROR: evaluation of constant value failed
+ //~^NOTE: size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+};
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
new file mode 100644
index 000000000..60fcd461c
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
@@ -0,0 +1,42 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:7:16
+ |
+LL | let _val = *ptr;
+ | ^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:14:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ |
+ = note: accessing memory with alignment 1, but alignment 4 is required
+ |
+note: inside `copy_nonoverlapping::<u32>`
+ --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
+note: inside `ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+note: inside `MISALIGNED_COPY`
+ --> $DIR/raw-pointer-ub.rs:22:5
+ |
+LL | y.copy_to_nonoverlapping(&mut z, 1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:34:16
+ |
+LL | let _val = (*ptr).0;
+ | ^^^^^^^^ accessing memory based on pointer with alignment 4, but alignment 16 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:41:16
+ |
+LL | let _val = *ptr;
+ | ^^^^ memory access failed: ALLOC0 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
index 40fc4a876..8eee392d1 100644
--- a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
+++ b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
@@ -40,6 +40,7 @@ help: the constant being evaluated
|
LL | const Y: u32 = simple_loop(35);
| ^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: constant evaluation is taking a long time
--> $DIR/ctfe-simple-loop.rs:9:5
diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs
index 078283fbd..72a0c9efe 100644
--- a/tests/ui/consts/const-eval/ub-enum.rs
+++ b/tests/ui/consts/const-eval/ub-enum.rs
@@ -2,7 +2,7 @@
// 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(never_type, const_discriminant)]
+#![feature(never_type)]
#![allow(invalid_value)]
use std::mem;
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
index 965256de2..7b30233c0 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
@@ -1,46 +1,56 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:19:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:18:1
+ |
+LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = 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: 8, align: 4) {
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:24:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:23:1
+ |
+LL | const INVALID_VTABLE_SIZE: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = 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: 8, align: 4) {
+ ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──╼╾──╼
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
|
= 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: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
|
= 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: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
|
= 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: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -51,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= 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: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──╼╾──╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
index bd542a7a5..9330ae3c9 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
@@ -1,46 +1,56 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:19:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:18:1
+ |
+LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = 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: 16, align: 8) {
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:24:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:23:1
+ |
+LL | const INVALID_VTABLE_SIZE: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = 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: 16, align: 8) {
+ ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──────╼╾──────╼
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
|
= 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: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
|
= 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: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
|
= 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: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -51,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= 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: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──────╼╾──────╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
index 4bb30b75b..7d1927253 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
@@ -11,19 +11,19 @@
// errors are emitted instead of ICEs.
// stderr-per-bitwidth
-// normalize-stderr-test "alloc\d+" -> "allocN"
+
trait Trait {}
const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^^ ERROR it is undefined behavior to use this value
+//~| expected a vtable pointer
const INVALID_VTABLE_SIZE: &dyn Trait =
unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^^ ERROR it is undefined behavior to use this value
+//~| expected a vtable pointer
#[repr(transparent)]
struct W<T>(T);
diff --git a/tests/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs
index a64b3a74c..fe4ec4d23 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.rs
+++ b/tests/ui/consts/const-eval/ub-nonnull.rs
@@ -1,6 +1,6 @@
// 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"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(rustc_attrs, ptr_metadata)]
#![allow(invalid_value)] // make sure we cannot allow away the errors tested here
diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr
index 961648708..7822306b6 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.stderr
+++ b/tests/ui/consts/const-eval/ub-nonnull.stderr
@@ -10,10 +10,10 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-nonnull.rs:20:30
+ --> $DIR/ub-nonnull.rs:20:29
|
LL | let out_of_bounds_ptr = &ptr[255];
- | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC1 has size 1, so pointer to 255 bytes starting at offset 0 is out-of-bounds
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-nonnull.rs:24:1
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs
index a5d2ea014..08d4dce4d 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs
@@ -1,7 +1,7 @@
// ignore-tidy-linelength
// 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"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![allow(invalid_value)]
use std::mem;
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 6d5c36cea..c608bad2a 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -141,7 +141,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:59:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc39, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC2, but expected a function pointer
|
= 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: $SIZE, align: $ALIGN) {
@@ -151,7 +151,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: accessing memory with alignment 1, but alignment 4 is required
+ = note: accessing memory based on pointer with alignment 1, but alignment 4 is required
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
index f7898e55e..353a9b782 100644
--- a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
@@ -6,7 +6,7 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= 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: 8, align: 4) {
- ╾─alloc3──╼ ╾─alloc4──╼ │ ╾──╼╾──╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
index 60432380e..097f6b049 100644
--- a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
@@ -6,7 +6,7 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= 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: 16, align: 8) {
- ╾───────alloc3────────╼ ╾───────alloc4────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs
index a765dc712..dc8d4c640 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs
@@ -5,11 +5,11 @@ use std::mem;
// 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"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
// normalize-stderr-test "offset \d+" -> "offset N"
-// normalize-stderr-test "alloc\d+" -> "allocN"
// normalize-stderr-test "size \d+" -> "size N"
+
/// A newtype wrapper to prevent MIR generation from inserting reborrows that would affect the error
/// message.
#[repr(transparent)]
@@ -122,14 +122,14 @@ const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4u
//~^ ERROR it is undefined behavior to use this value
//~| expected a vtable
const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
//~^ ERROR it is undefined behavior to use this value
//~| expected a vtable
@@ -148,12 +148,12 @@ const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute:
// Const eval fails for these, so they need to be statics to error.
static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe {
+//~^ ERROR it is undefined behavior to use this value
mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
- //~^ ERROR could not evaluate static initializer
};
static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
+//~^ ERROR it is undefined behavior to use this value
mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
- //~^ ERROR could not evaluate static initializer
};
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index d8add67fa..b20379485 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -189,7 +189,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:113:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC12, but expected a vtable pointer
|
= 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: $SIZE, align: $ALIGN) {
@@ -200,7 +200,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:117:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC14, but expected a vtable pointer
|
= 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: $SIZE, align: $ALIGN) {
@@ -218,29 +218,44 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
HEX_DUMP
}
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:124:57
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:124:1
|
LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC17, but expected a vtable pointer
+ |
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:127:57
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:127:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC19, but expected a vtable pointer
+ |
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:130:56
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:130:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC21, but expected a vtable pointer
+ |
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:133:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC23, but expected a vtable pointer
|
= 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: $SIZE, align: $ALIGN) {
@@ -273,24 +288,34 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:145:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC28, but expected a vtable pointer
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:151:5
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:150:1
+ |
+LL | static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
|
-LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:155:5
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:154:1
+ |
+LL | static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC31, but expected a vtable pointer
|
-LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = 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: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error: aborting due to 29 previous errors
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.rs b/tests/ui/consts/const-eval/union-const-eval-field.rs
index a94fcbbfa..c9799989e 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.rs
+++ b/tests/ui/consts/const-eval/union-const-eval-field.rs
@@ -1,5 +1,3 @@
-// only-x86_64
-
type Field1 = i32;
type Field2 = f32;
type Field3 = i64;
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 ce260300f..b299208ae 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
@@ -1,20 +1,22 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/union-const-eval-field.rs:28:37
+ --> $DIR/union-const-eval-field.rs:26:37
|
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
note: erroneous constant encountered
- --> $DIR/union-const-eval-field.rs:31:5
+ --> $DIR/union-const-eval-field.rs:29:5
|
LL | FIELD3
| ^^^^^^
note: erroneous constant encountered
- --> $DIR/union-const-eval-field.rs:31:5
+ --> $DIR/union-const-eval-field.rs:29:5
|
LL | FIELD3
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.rs b/tests/ui/consts/const-eval/unused-broken-const-late.rs
new file mode 100644
index 000000000..a6528ec5f
--- /dev/null
+++ b/tests/ui/consts/const-eval/unused-broken-const-late.rs
@@ -0,0 +1,20 @@
+// build-fail
+// compile-flags: -O
+//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
+//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+
+struct PrintName<T>(T);
+impl<T> PrintName<T> {
+ const VOID: () = panic!(); //~ERROR evaluation of `PrintName::<i32>::VOID` failed
+}
+
+fn no_codegen<T>() {
+ // Any function that is called is guaranteed to have all consts that syntactically
+ // appear in its body evaluated, even if they only appear in dead code.
+ if false {
+ let _ = PrintName::<T>::VOID;
+ }
+}
+pub fn main() {
+ no_codegen::<i32>();
+}
diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.stderr b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
new file mode 100644
index 000000000..cdb70a69d
--- /dev/null
+++ b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
+ --> $DIR/unused-broken-const-late.rs:8:22
+ |
+LL | const VOID: () = panic!();
+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unused-broken-const-late.rs:8:22
+ |
+ = 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-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
index afe645ae8..6c4f0a5ac 100644
--- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
+++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
@@ -11,4 +11,5 @@ fn main() {
//[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block
foo();
//[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block
+ //[thir]~^^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
}
diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
index b313f0653..e6b8173eb 100644
--- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
+++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
@@ -1,4 +1,12 @@
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:12:5
+ |
+LL | foo();
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
LL | let a: [u8; foo()];
@@ -6,6 +14,6 @@ LL | let a: [u8; foo()];
|
= note: consult the function's documentation for information on how to avoid undefined behavior
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/consts/const-fn-in-vec.rs b/tests/ui/consts/const-fn-in-vec.rs
index a40290eca..0483800ef 100644
--- a/tests/ui/consts/const-fn-in-vec.rs
+++ b/tests/ui/consts/const-fn-in-vec.rs
@@ -1,7 +1,11 @@
+static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
+//~^ ERROR the trait bound `String: Copy` is not satisfied
+
fn main() {
// should hint to create an inline `const` block
// or to create a new `const` item
- let strings: [String; 5] = [String::new(); 5];
+ let _strings: [String; 5] = [String::new(); 5];
+ //~^ ERROR the trait bound `String: Copy` is not satisfied
+ let _maybe_strings: [Option<String>; 5] = [None; 5];
//~^ ERROR the trait bound `String: Copy` is not satisfied
- println!("{:?}", strings);
}
diff --git a/tests/ui/consts/const-fn-in-vec.stderr b/tests/ui/consts/const-fn-in-vec.stderr
index 9eb7524b5..4593034bf 100644
--- a/tests/ui/consts/const-fn-in-vec.stderr
+++ b/tests/ui/consts/const-fn-in-vec.stderr
@@ -1,13 +1,47 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/const-fn-in-vec.rs:4:33
+ --> $DIR/const-fn-in-vec.rs:1:47
|
-LL | let strings: [String; 5] = [String::new(); 5];
- | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
+ | ^^^^ the trait `Copy` is not implemented for `String`
|
+ = note: required for `Option<String>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the constructor to be used in the repeat position
+ |
+LL + const ARRAY_REPEAT_VALUE: Option<String> = None;
+LL ~ static _MAYBE_STRINGS: [Option<String>; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
+
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/const-fn-in-vec.rs:7:34
+ |
+LL | let _strings: [String; 5] = [String::new(); 5];
+ | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+ = note: the `Copy` trait is required because this value will be copied for each element of the array
+ = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: String = String::new();
+LL ~ let _strings: [String; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
+
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/const-fn-in-vec.rs:9:48
+ |
+LL | let _maybe_strings: [Option<String>; 5] = [None; 5];
+ | ^^^^ the trait `Copy` is not implemented for `String`
+ |
+ = note: required for `Option<String>` to implement `Copy`
+ = note: the `Copy` trait is required because this value will be copied for each element of the array
+ = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the constructor to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Option<String> = None;
+LL ~ let _maybe_strings: [Option<String>; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
-error: aborting due to previous error
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
new file mode 100644
index 000000000..33d4fec70
--- /dev/null
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
@@ -0,0 +1,20 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:17:1
+ |
+LL | const A: Option<&mut i32> = helper();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const`
+ |
+ = 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: 4, align: 4) {
+ 2a 00 00 00 │ *...
+ }
+
+error: encountered dangling pointer in final constant
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:24:1
+ |
+LL | const B: Option<&mut i32> = helper2();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
new file mode 100644
index 000000000..9eb267585
--- /dev/null
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
@@ -0,0 +1,20 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:17:1
+ |
+LL | const A: Option<&mut i32> = helper();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const`
+ |
+ = 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: 8, align: 8) {
+ 2a 00 00 00 00 00 00 00 │ *.......
+ }
+
+error: encountered dangling pointer in final constant
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:24:1
+ |
+LL | const B: Option<&mut i32> = helper2();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
index 074beaab2..22e7a74e5 100644
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
@@ -1,3 +1,4 @@
+// stderr-per-bitwidth
#![feature(const_mut_refs)]
#![feature(raw_ref_op)]
@@ -9,17 +10,15 @@
const fn helper() -> Option<&'static mut i32> { unsafe {
// Undefined behaviour (integer as pointer), who doesn't love tests like this.
- // This code never gets executed, because the static checks fail before that.
- Some(&mut *(42 as *mut i32)) //~ ERROR evaluation of constant value failed
- //~| 0x2a[noalloc] is a dangling pointer
+ Some(&mut *(42 as *mut i32))
} }
// The error is an evaluation error and not a validation error, so the error is reported
// directly at the site where it occurs.
-const A: Option<&mut i32> = helper();
+const A: Option<&mut i32> = helper(); //~ ERROR it is undefined behavior to use this value
+//~^ encountered mutable reference in a `const`
const fn helper2() -> Option<&'static mut i32> { unsafe {
// Undefined behaviour (dangling pointer), who doesn't love tests like this.
- // This code never gets executed, because the static checks fail before that.
Some(&mut *(&mut 42 as *mut i32))
} }
const B: Option<&mut i32> = helper2(); //~ ERROR encountered dangling pointer in final constant
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
deleted file mode 100644
index 6e110dbdd..000000000
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
- |
-LL | Some(&mut *(42 as *mut i32))
- | ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
- |
-note: inside `helper`
- --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
- |
-LL | Some(&mut *(42 as *mut i32))
- | ^^^^^^^^^^^^^^^^^^^^^^
-note: inside `A`
- --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29
- |
-LL | const A: Option<&mut i32> = helper();
- | ^^^^^^^^
-
-error: encountered dangling pointer in final constant
- --> $DIR/mut_ref_in_final_dynamic_check.rs:25:1
- |
-LL | const B: Option<&mut i32> = helper2();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-points-to-static.32bit.stderr b/tests/ui/consts/const-points-to-static.32bit.stderr
index c7a435a1e..12cc7fbb1 100644
--- a/tests/ui/consts/const-points-to-static.32bit.stderr
+++ b/tests/ui/consts/const-points-to-static.32bit.stderr
@@ -6,7 +6,7 @@ LL | const TEST: &u8 = &MY_STATIC;
|
= 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: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/const-points-to-static.64bit.stderr b/tests/ui/consts/const-points-to-static.64bit.stderr
index 4d5b8eac5..86506e6ca 100644
--- a/tests/ui/consts/const-points-to-static.64bit.stderr
+++ b/tests/ui/consts/const-points-to-static.64bit.stderr
@@ -6,7 +6,7 @@ LL | const TEST: &u8 = &MY_STATIC;
|
= 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: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/const-unsized.rs b/tests/ui/consts/const-unsized.rs
index 319b8ef97..e0b06a271 100644
--- a/tests/ui/consts/const-unsized.rs
+++ b/tests/ui/consts/const-unsized.rs
@@ -2,15 +2,19 @@ use std::fmt::Debug;
const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
const CONST_FOO: str = *"foo";
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
static STATIC_BAR: str = *"bar";
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
fn main() {
println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR);
diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr
index 27b200648..674f0cb99 100644
--- a/tests/ui/consts/const-unsized.stderr
+++ b/tests/ui/consts/const-unsized.stderr
@@ -7,7 +7,7 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:6:18
+ --> $DIR/const-unsized.rs:7:18
|
LL | const CONST_FOO: str = *"foo";
| ^^^ doesn't have a size known at compile-time
@@ -15,7 +15,7 @@ LL | const CONST_FOO: str = *"foo";
= help: the trait `Sized` is not implemented for `str`
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
- --> $DIR/const-unsized.rs:9:18
+ --> $DIR/const-unsized.rs:11:18
|
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -23,13 +23,49 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:12:20
+ --> $DIR/const-unsized.rs:15:20
|
LL | static STATIC_BAR: str = *"bar";
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
-error: aborting due to 4 previous errors
+error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:3:35
+ |
+LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:7:24
+ |
+LL | const CONST_FOO: str = *"foo";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:11:37
+ |
+LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:15:26
+ |
+LL | static STATIC_BAR: str = *"bar";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: constant expressions must have a statically known size
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/consts/const_discriminant.rs b/tests/ui/consts/const_discriminant.rs
index b1180faa6..80deb0f78 100644
--- a/tests/ui/consts/const_discriminant.rs
+++ b/tests/ui/consts/const_discriminant.rs
@@ -1,5 +1,4 @@
// run-pass
-#![feature(const_discriminant)]
#![allow(dead_code)]
use std::mem::{discriminant, Discriminant};
diff --git a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs
new file mode 100644
index 000000000..2491071d1
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs
@@ -0,0 +1,32 @@
+#![deny(pointer_structural_match)]
+#![allow(dead_code)]
+
+const C: *const u8 = &0;
+// Make sure we also find pointers nested in other types.
+const C_INNER: (*const u8, u8) = (C, 0);
+
+fn foo(x: *const u8) {
+ match x {
+ C => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
+
+fn foo2(x: *const u8) {
+ match (x, 1) {
+ C_INNER => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
+
+const D: *const [u8; 4] = b"abcd";
+
+fn main() {
+ match D {
+ D => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
diff --git a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
new file mode 100644
index 000000000..ab53346b5
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
@@ -0,0 +1,34 @@
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:10: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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+note: the lint level is defined here
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
+ |
+LL | #![deny(pointer_structural_match)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:18:9
+ |
+LL | C_INNER => {}
+ | ^^^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:28:9
+ |
+LL | D => {}
+ | ^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/consts/const_in_pattern/issue-44333.rs b/tests/ui/consts/const_in_pattern/issue-44333.rs
index 96e8795e5..aaf1edb6f 100644
--- a/tests/ui/consts/const_in_pattern/issue-44333.rs
+++ b/tests/ui/consts/const_in_pattern/issue-44333.rs
@@ -16,9 +16,9 @@ const BAR: Func = bar;
fn main() {
match test(std::env::consts::ARCH.len()) {
- FOO => println!("foo"), //~ WARN pointers in patterns behave unpredictably
+ FOO => println!("foo"), //~ WARN behave unpredictably
//~^ WARN will become a hard error
- BAR => println!("bar"), //~ WARN pointers in patterns behave unpredictably
+ BAR => println!("bar"), //~ WARN behave unpredictably
//~^ WARN will become a hard error
_ => unreachable!(),
}
diff --git a/tests/ui/consts/const_in_pattern/issue-44333.stderr b/tests/ui/consts/const_in_pattern/issue-44333.stderr
index 731ef509c..441aeecbc 100644
--- a/tests/ui/consts/const_in_pattern/issue-44333.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-44333.stderr
@@ -1,4 +1,4 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
--> $DIR/issue-44333.rs:19:9
|
LL | FOO => println!("foo"),
@@ -12,7 +12,7 @@ note: the lint level is defined here
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
--> $DIR/issue-44333.rs:21:9
|
LL | BAR => println!("bar"),
diff --git a/tests/ui/consts/const_in_pattern/issue-78057.rs b/tests/ui/consts/const_in_pattern/issue-78057.rs
index 69cf8404d..88b5d68cb 100644
--- a/tests/ui/consts/const_in_pattern/issue-78057.rs
+++ b/tests/ui/consts/const_in_pattern/issue-78057.rs
@@ -12,6 +12,5 @@ fn main() {
FOO => {},
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
_ => {}
- //~^ ERROR unreachable pattern
}
}
diff --git a/tests/ui/consts/const_in_pattern/issue-78057.stderr b/tests/ui/consts/const_in_pattern/issue-78057.stderr
index df155bdb6..5ec68719a 100644
--- a/tests/ui/consts/const_in_pattern/issue-78057.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-78057.stderr
@@ -7,20 +7,5 @@ LL | FOO => {},
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-error: unreachable pattern
- --> $DIR/issue-78057.rs:14:9
- |
-LL | FOO => {},
- | --- matches any value
-LL |
-LL | _ => {}
- | ^ unreachable pattern
- |
-note: the lint level is defined here
- --> $DIR/issue-78057.rs:1:9
- |
-LL | #![deny(unreachable_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.rs b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
index dc6b9a331..df772740a 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.rs
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
// This test of structural match checking enumerates the different kinds of
// const definitions, collecting cases where the const pattern is rejected.
//
@@ -78,9 +80,6 @@ fn main() {
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
//~| NOTE the traits must be derived
//~| NOTE StructuralEq.html for details
- //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| NOTE the traits must be derived
- //~| NOTE StructuralEq.html for details
trait Trait: Sized { const ASSOC: Option<Self>; }
impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
index b6e439f21..72bb0aeaf 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
@@ -1,5 +1,5 @@
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:40:36
+ --> $DIR/reject_non_structural.rs:42:36
|
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
| ^^^^
@@ -8,7 +8,7 @@ LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:46:28
+ --> $DIR/reject_non_structural.rs:48:28
|
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
| ^^^^^
@@ -17,7 +17,7 @@ LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:53:27
+ --> $DIR/reject_non_structural.rs:55:27
|
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
| ^^^^^^^^
@@ -26,7 +26,7 @@ LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops")
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:59:36
+ --> $DIR/reject_non_structural.rs:61:36
|
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
| ^^^^^
@@ -35,7 +35,7 @@ LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoop
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:65:28
+ --> $DIR/reject_non_structural.rs:67:28
|
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => p
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:71:36
+ --> $DIR/reject_non_structural.rs:73:36
|
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
| ^^^^^
@@ -53,7 +53,7 @@ LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoop
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:77:33
+ --> $DIR/reject_non_structural.rs:79:33
|
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
| ^^^^^^
@@ -62,16 +62,7 @@ LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:77:33
- |
-LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
- | ^^^^^^
- |
- = note: the traits must be derived, manual `impl`s are not sufficient
- = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:87:28
+ --> $DIR/reject_non_structural.rs:86:28
|
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
@@ -80,7 +71,7 @@ LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => p
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:93:28
+ --> $DIR/reject_non_structural.rs:92:28
|
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
| ^^^^^
@@ -89,7 +80,7 @@ LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:99:29
+ --> $DIR/reject_non_structural.rs:98:29
|
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
| ^^^^^^^
@@ -99,10 +90,10 @@ LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops")
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
note: the lint level is defined here
- --> $DIR/reject_non_structural.rs:12:9
+ --> $DIR/reject_non_structural.rs:14:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 10 previous errors; 1 warning emitted
+error: aborting due to 9 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/copy-intrinsic.stderr b/tests/ui/consts/copy-intrinsic.stderr
index be41c2db3..0e4e6a6ad 100644
--- a/tests/ui/consts/copy-intrinsic.stderr
+++ b/tests/ui/consts/copy-intrinsic.stderr
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:27:5
|
LL | copy_nonoverlapping(0x100 as *const i32, dangle, 0);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc5 has size 4, so pointer at offset 40 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 4, so pointer at offset 40 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:34:5
|
LL | copy_nonoverlapping(dangle, 0x100 as *mut i32, 0);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc7 has size 4, so pointer at offset 40 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC1 has size 4, so pointer at offset 40 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:41:5
diff --git a/tests/ui/consts/enum-discr-type-err.stderr b/tests/ui/consts/enum-discr-type-err.stderr
index 2f97582be..9a09d6a96 100644
--- a/tests/ui/consts/enum-discr-type-err.stderr
+++ b/tests/ui/consts/enum-discr-type-err.stderr
@@ -24,6 +24,7 @@ LL | | B = T,
LL | | }
| |_- in this macro invocation
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
index 37b37e965..39f918379 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
@@ -1,7 +1,7 @@
// revisions: no_flag with_flag
// [no_flag] check-pass
// [with_flag] compile-flags: -Zextra-const-ub-checks
-#![feature(never_type, pointer_byte_offsets)]
+#![feature(never_type)]
use std::mem::transmute;
use std::ptr::addr_of;
@@ -88,4 +88,15 @@ const PARTIAL_POINTER: () = unsafe {
const VALID_ENUM1: E = { let e = E::A; e };
const VALID_ENUM2: Result<&'static [u8], ()> = { let e = Err(()); e };
+// Htting the (non-integer) array code in validation with an immediate local.
+const VALID_ARRAY: [Option<i32>; 0] = { let e = [None; 0]; e };
+
+// Detecting oversized references.
+const OVERSIZED_REF: () = { unsafe {
+ let slice: *const [u8] = transmute((1usize, usize::MAX));
+ let _val = &*slice;
+ //[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| slice is bigger than largest supported object
+} };
+
fn main() {}
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
index 4ee12d501..0100aafb6 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
@@ -52,6 +52,12 @@ LL | let _val = *(&mem as *const Align as *const [*const u8; 2]);
= 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
-error: aborting due to 7 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $DIR/detect-extra-ub.rs:97:16
+ |
+LL | let _val = &*slice;
+ | ^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index 658a0b7b2..3d82837d5 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -21,6 +21,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:15
@@ -33,6 +35,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:29:15
@@ -45,6 +49,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:15
@@ -57,6 +63,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:15
@@ -69,6 +77,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 12 previous errors
diff --git a/tests/ui/consts/invalid-union.32bit.stderr b/tests/ui/consts/invalid-union.32bit.stderr
index b6cf060e5..32b67a130 100644
--- a/tests/ui/consts/invalid-union.32bit.stderr
+++ b/tests/ui/consts/invalid-union.32bit.stderr
@@ -6,7 +6,7 @@ LL | fn main() {
|
= 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: 4, align: 4) {
- ╾─alloc7──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
note: erroneous constant encountered
@@ -20,6 +20,8 @@ note: erroneous constant encountered
|
LL | let _: &'static _ = &C;
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr
index e3a3ef62c..45f999eb2 100644
--- a/tests/ui/consts/invalid-union.64bit.stderr
+++ b/tests/ui/consts/invalid-union.64bit.stderr
@@ -6,7 +6,7 @@ LL | fn main() {
|
= 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: 8, align: 8) {
- ╾───────alloc7────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
note: erroneous constant encountered
@@ -20,6 +20,8 @@ note: erroneous constant encountered
|
LL | let _: &'static _ = &C;
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-102117.stderr b/tests/ui/consts/issue-102117.stderr
index f42bcf90f..da92db87f 100644
--- a/tests/ui/consts/issue-102117.stderr
+++ b/tests/ui/consts/issue-102117.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:19:26
|
LL | type_id: TypeId::of::<T>(),
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | pub fn new<T: 'static>() -> &'static Self {
| +++++++++
@@ -13,9 +16,13 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:19:26
|
LL | type_id: TypeId::of::<T>(),
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | pub fn new<T: 'static>() -> &'static Self {
| +++++++++
diff --git a/tests/ui/consts/issue-116186.rs b/tests/ui/consts/issue-116186.rs
new file mode 100644
index 000000000..a77c38c64
--- /dev/null
+++ b/tests/ui/consts/issue-116186.rs
@@ -0,0 +1,12 @@
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+fn something(path: [usize; N]) -> impl Clone {
+ //~^ ERROR cannot find value `N` in this scope
+ match path {
+ [] => 0, //~ ERROR cannot pattern-match on an array without a fixed length
+ _ => 1,
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/consts/issue-116186.stderr b/tests/ui/consts/issue-116186.stderr
new file mode 100644
index 000000000..e6eae2d9f
--- /dev/null
+++ b/tests/ui/consts/issue-116186.stderr
@@ -0,0 +1,21 @@
+error[E0425]: cannot find value `N` in this scope
+ --> $DIR/issue-116186.rs:4:28
+ |
+LL | fn something(path: [usize; N]) -> impl Clone {
+ | ^ not found in this scope
+ |
+help: you might be missing a const parameter
+ |
+LL | fn something<const N: /* Type */>(path: [usize; N]) -> impl Clone {
+ | +++++++++++++++++++++
+
+error[E0730]: cannot pattern-match on an array without a fixed length
+ --> $DIR/issue-116186.rs:7:9
+ |
+LL | [] => 0,
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0425, E0730.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/tests/ui/consts/issue-17718-const-bad-values.stderr b/tests/ui/consts/issue-17718-const-bad-values.stderr
index ce60aaa07..405c2195d 100644
--- a/tests/ui/consts/issue-17718-const-bad-values.stderr
+++ b/tests/ui/consts/issue-17718-const-bad-values.stderr
@@ -19,6 +19,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/issue-34784.rs b/tests/ui/consts/issue-34784.rs
deleted file mode 100644
index 98d943470..000000000
--- a/tests/ui/consts/issue-34784.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-
-#![warn(pointer_structural_match)]
-#![allow(dead_code)]
-const C: *const u8 = &0;
-
-fn foo(x: *const u8) {
- match x {
- C => {}
- _ => {}
- }
-}
-
-const D: *const [u8; 4] = b"abcd";
-
-fn main() {
- match D {
- D => {}
- _ => {}
- }
-}
diff --git a/tests/ui/consts/issue-39974.rs b/tests/ui/consts/issue-39974.rs
index 503647ef4..9cb180014 100644
--- a/tests/ui/consts/issue-39974.rs
+++ b/tests/ui/consts/issue-39974.rs
@@ -1,4 +1,5 @@
const LENGTH: f64 = 2;
+//~^ ERROR mismatched types
struct Thing {
f: [[f64; 2]; LENGTH],
diff --git a/tests/ui/consts/issue-39974.stderr b/tests/ui/consts/issue-39974.stderr
index 56365e51e..4bde59903 100644
--- a/tests/ui/consts/issue-39974.stderr
+++ b/tests/ui/consts/issue-39974.stderr
@@ -1,9 +1,18 @@
error[E0308]: mismatched types
- --> $DIR/issue-39974.rs:4:19
+ --> $DIR/issue-39974.rs:5:19
|
LL | f: [[f64; 2]; LENGTH],
| ^^^^^^ expected `usize`, found `f64`
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/issue-39974.rs:1:21
+ |
+LL | const LENGTH: f64 = 2;
+ | ^
+ | |
+ | expected `f64`, found integer
+ | help: use a float literal: `2.0`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/consts/issue-63952.32bit.stderr b/tests/ui/consts/issue-63952.32bit.stderr
index 755c7fb7d..5375ec118 100644
--- a/tests/ui/consts/issue-63952.32bit.stderr
+++ b/tests/ui/consts/issue-63952.32bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe {
|
= 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: 8, align: 4) {
- ╾─alloc4──╼ ff ff ff ff │ ╾──╼....
+ ╾ALLOC0╼ ff ff ff ff │ ╾──╼....
}
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-63952.64bit.stderr b/tests/ui/consts/issue-63952.64bit.stderr
index abdb9a4f7..a6edbf932 100644
--- a/tests/ui/consts/issue-63952.64bit.stderr
+++ b/tests/ui/consts/issue-63952.64bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe {
|
= 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: 16, align: 8) {
- ╾───────alloc4────────╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
+ ╾ALLOC0╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
}
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-67696-const-prop-ice.rs b/tests/ui/consts/issue-67696-const-prop-ice.rs
index ad52608b3..858035190 100644
--- a/tests/ui/consts/issue-67696-const-prop-ice.rs
+++ b/tests/ui/consts/issue-67696-const-prop-ice.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --emit=mir,link
+// compile-flags: --emit=mir,link -Zmir-opt-level=4
// Checks that we don't ICE due to attempting to run const prop
// on a function with unsatisifable 'where' clauses
diff --git a/tests/ui/consts/issue-79690.64bit.stderr b/tests/ui/consts/issue-79690.64bit.stderr
index b8798a975..af59729d4 100644
--- a/tests/ui/consts/issue-79690.64bit.stderr
+++ b/tests/ui/consts/issue-79690.64bit.stderr
@@ -6,7 +6,7 @@ LL | const G: Fat = unsafe { Transmute { t: FOO }.u };
|
= 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: 16, align: 8) {
- ╾───────alloc3────────╼ ╾───────alloc4────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr
index 274b1de7e..b129aef34 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr
@@ -24,6 +24,8 @@ note: erroneous constant encountered
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: skipping const checks
|
diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
index c8e4cab4e..46408f674 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -15,6 +15,8 @@ note: erroneous constant encountered
|
LL | let y = <String as Bar<String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
index a6f467b9e..4a3344a5b 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
@@ -24,7 +24,7 @@ LL | const REF_INTERIOR_MUT: &usize = {
|
= 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: 4, align: 4) {
- ╾─alloc4──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -35,7 +35,7 @@ LL | const READ_IMMUT: &usize = {
|
= 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: 4, align: 4) {
- ╾─alloc5──╼ │ ╾──╼
+ ╾ALLOC1╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
index cfaf31a6e..7573bfa39 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
@@ -24,7 +24,7 @@ LL | const REF_INTERIOR_MUT: &usize = {
|
= 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: 8, align: 8) {
- ╾───────alloc4────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -35,7 +35,7 @@ LL | const READ_IMMUT: &usize = {
|
= 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: 8, align: 8) {
- ╾───────alloc5────────╼ │ ╾──────╼
+ ╾ALLOC1╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
index e3a0d93f0..492d8718a 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_MUT: &[u8; 1] = {
|
= 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: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: could not evaluate constant pattern
@@ -23,7 +23,7 @@ LL | const U8_MUT: &u8 = {
|
= 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: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: could not evaluate constant pattern
@@ -108,6 +108,11 @@ help: skipping check that does not even have a feature gate
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+ --> $DIR/const_refers_to_static_cross_crate.rs:27:20
+ |
+LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
index a323e9a05..f6d82d6c0 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_MUT: &[u8; 1] = {
|
= 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: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: could not evaluate constant pattern
@@ -23,7 +23,7 @@ LL | const U8_MUT: &u8 = {
|
= 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: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: could not evaluate constant pattern
@@ -108,6 +108,11 @@ help: skipping check that does not even have a feature gate
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+ --> $DIR/const_refers_to_static_cross_crate.rs:27:20
+ |
+LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
index 0ea179240..c9da91a95 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
@@ -6,7 +6,7 @@ LL | const MUH: Meh = Meh {
|
= 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: 4, align: 4) {
- ╾─alloc3──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -17,7 +17,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
|
= 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: 8, align: 4) {
- ╾─alloc7──╼ ╾─alloc8──╼ │ ╾──╼╾──╼
+ ╾ALLOC1╼ ╾ALLOC2╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -28,7 +28,7 @@ LL | const BLUNT: &mut i32 = &mut 42;
|
= 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: 4, align: 4) {
- ╾─alloc10─╼ │ ╾──╼
+ ╾ALLOC3╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
index 67959d256..71be616b7 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
@@ -6,7 +6,7 @@ LL | const MUH: Meh = Meh {
|
= 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: 8, align: 8) {
- ╾───────alloc3────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -17,7 +17,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
|
= 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: 16, align: 8) {
- ╾───────alloc7────────╼ ╾───────alloc8────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC1╼ ╾ALLOC2╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -28,7 +28,7 @@ LL | const BLUNT: &mut i32 = &mut 42;
|
= 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: 8, align: 8) {
- ╾───────alloc10───────╼ │ ╾──────╼
+ ╾ALLOC3╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.rs b/tests/ui/consts/miri_unleashed/ptr_arith.rs
index 5cda3c411..e59c67252 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.rs
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.rs
@@ -1,5 +1,4 @@
// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(core_intrinsics, pointer_byte_offsets)]
// During CTFE, we prevent pointer-to-int casts.
// Pointer comparisons are prevented in the trait system.
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.stderr b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
index 25ca6bc4e..213966f90 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.stderr
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
@@ -1,11 +1,11 @@
error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:8:13
+ --> $DIR/ptr_arith.rs:7:13
|
LL | let x = &0 as *const _ as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^ exposing pointers is not possible at compile-time
error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:16:14
+ --> $DIR/ptr_arith.rs:15:14
|
LL | let _v = x + 0;
| ^ unable to turn pointer into integer
@@ -16,7 +16,7 @@ LL | let _v = x + 0;
warning: skipping const checks
|
help: skipping check that does not even have a feature gate
- --> $DIR/ptr_arith.rs:8:13
+ --> $DIR/ptr_arith.rs:7:13
|
LL | let x = &0 as *const _ as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs
index dd2b81c5a..1ac3777f5 100644
--- a/tests/ui/consts/missing_span_in_backtrace.rs
+++ b/tests/ui/consts/missing_span_in_backtrace.rs
@@ -1,5 +1,5 @@
// compile-flags: -Z ui-testing=no
-// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID"
+
#![feature(const_swap)]
#![feature(const_mut_refs)]
diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr
index fcfb9fbb3..6860cee41 100644
--- a/tests/ui/consts/missing_span_in_backtrace.stderr
+++ b/tests/ui/consts/missing_span_in_backtrace.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: unable to copy parts of a pointer from memory at ALLOC_ID
+ = note: unable to copy parts of a pointer from memory at ALLOC0
|
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr
index 97ff6efdd..1ef727e5b 100644
--- a/tests/ui/consts/offset_from_ub.stderr
+++ b/tests/ui/consts/offset_from_ub.stderr
@@ -39,19 +39,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:53:14
|
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc17 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC0 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:62:14
|
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC1 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:70:14
|
LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc23 has size 4, so pointer at offset 10 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC2 has size 4, so pointer at offset 10 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:79:14
diff --git a/tests/ui/consts/offset_ub.rs b/tests/ui/consts/offset_ub.rs
index 1b01e4fd1..db28a6c6a 100644
--- a/tests/ui/consts/offset_ub.rs
+++ b/tests/ui/consts/offset_ub.rs
@@ -1,6 +1,6 @@
use std::ptr;
-// normalize-stderr-test "alloc\d+" -> "allocN"
+
// normalize-stderr-test "0x7f+" -> "0x7f..f"
diff --git a/tests/ui/consts/offset_ub.stderr b/tests/ui/consts/offset_ub.stderr
index c0c851df5..8bc59d50e 100644
--- a/tests/ui/consts/offset_ub.stderr
+++ b/tests/ui/consts/offset_ub.stderr
@@ -14,7 +14,7 @@ LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1)
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC0 has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -27,7 +27,7 @@ LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC1 has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -92,7 +92,7 @@ LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).of
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC2 has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -105,7 +105,7 @@ LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC3 has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr
index f48e6c4ce..c92824a0d 100644
--- a/tests/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr
@@ -656,6 +656,8 @@ note: erroneous constant encountered
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/coroutine/addassign-yield.rs
index 66f22bf31..919a559f8 100644
--- a/tests/ui/generator/addassign-yield.rs
+++ b/tests/ui/coroutine/addassign-yield.rs
@@ -5,7 +5,7 @@
// is being used), we were failing to account for all types that might
// possibly be live across a yield point.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() {
let _x = static || {
diff --git a/tests/ui/coroutine/async-coroutine-issue-67158.rs b/tests/ui/coroutine/async-coroutine-issue-67158.rs
new file mode 100644
index 000000000..420454656
--- /dev/null
+++ b/tests/ui/coroutine/async-coroutine-issue-67158.rs
@@ -0,0 +1,6 @@
+#![feature(coroutines)]
+// edition:2018
+// Regression test for #67158.
+fn main() {
+ async { yield print!(":C") }; //~ ERROR `async` coroutines are not yet supported
+}
diff --git a/tests/ui/generator/async-generator-issue-67158.stderr b/tests/ui/coroutine/async-coroutine-issue-67158.stderr
index 7270d188e..d583d3d5e 100644
--- a/tests/ui/generator/async-generator-issue-67158.stderr
+++ b/tests/ui/coroutine/async-coroutine-issue-67158.stderr
@@ -1,5 +1,5 @@
-error[E0727]: `async` generators are not yet supported
- --> $DIR/async-generator-issue-67158.rs:5:13
+error[E0727]: `async` coroutines are not yet supported
+ --> $DIR/async-coroutine-issue-67158.rs:5:13
|
LL | async { yield print!(":C") };
| ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/coroutine/auto-trait-regions.rs
index aa4218e13..5fce70e8e 100644
--- a/tests/ui/generator/auto-trait-regions.rs
+++ b/tests/ui/coroutine/auto-trait-regions.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![feature(auto_traits)]
#![feature(negative_impls)]
@@ -21,7 +21,7 @@ impl<'a> Foo for &'a OnlyFooIfRef {}
fn assert_foo<T: Foo>(f: T) {}
fn main() {
- // Make sure 'static is erased for generator interiors so we can't match it in trait selection
+ // Make sure 'static is erased for coroutine interiors so we can't match it in trait selection
let x: &'static _ = &OnlyFooIfStaticRef(No);
let gen = move || {
let x = x;
@@ -40,7 +40,7 @@ fn main() {
};
assert_foo(gen); // ok
- // Disallow impls which relates lifetimes in the generator interior
+ // Disallow impls which relates lifetimes in the coroutine interior
let gen = move || {
let a = A(&mut true, &mut true, No);
//~^ temporary value dropped while borrowed
diff --git a/tests/ui/generator/auto-trait-regions.stderr b/tests/ui/coroutine/auto-trait-regions.stderr
index a9a0bde2b..a9a0bde2b 100644
--- a/tests/ui/generator/auto-trait-regions.stderr
+++ b/tests/ui/coroutine/auto-trait-regions.stderr
diff --git a/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs b/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs
new file mode 100644
index 000000000..dc0521853
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs
@@ -0,0 +1,11 @@
+// compile-flags: --emit metadata
+#![feature(coroutines, coroutine_trait)]
+
+use std::marker::Unpin;
+use std::ops::Coroutine;
+
+pub fn g() -> impl Coroutine<(), Yield = (), Return = ()> {
+ || {
+ yield;
+ }
+}
diff --git a/tests/ui/coroutine/auxiliary/unwind-aux.rs b/tests/ui/coroutine/auxiliary/unwind-aux.rs
new file mode 100644
index 000000000..215d67691
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/unwind-aux.rs
@@ -0,0 +1,11 @@
+// compile-flags: -Cpanic=unwind --crate-type=lib
+// no-prefer-dynamic
+// edition:2021
+
+#![feature(coroutines)]
+pub fn run<T>(a: T) {
+ let _ = move || {
+ drop(a);
+ yield;
+ };
+}
diff --git a/tests/ui/coroutine/auxiliary/xcrate-reachable.rs b/tests/ui/coroutine/auxiliary/xcrate-reachable.rs
new file mode 100644
index 000000000..673153f06
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/xcrate-reachable.rs
@@ -0,0 +1,14 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+fn msg() -> u32 {
+ 0
+}
+
+pub fn foo() -> impl Coroutine<(), Yield = (), Return = u32> {
+ || {
+ yield;
+ return msg();
+ }
+}
diff --git a/tests/ui/coroutine/auxiliary/xcrate.rs b/tests/ui/coroutine/auxiliary/xcrate.rs
new file mode 100644
index 000000000..f749a95ad
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/xcrate.rs
@@ -0,0 +1,18 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::marker::Unpin;
+use std::ops::Coroutine;
+
+pub fn foo() -> impl Coroutine<(), Yield = (), Return = ()> {
+ || {
+ if false {
+ yield;
+ }
+ }
+}
+
+pub fn bar<T: 'static>(t: T) -> Box<Coroutine<(), Yield = T, Return = ()> + Unpin> {
+ Box::new(|| {
+ yield t;
+ })
+}
diff --git a/tests/ui/generator/borrow-in-tail-expr.rs b/tests/ui/coroutine/borrow-in-tail-expr.rs
index 540f5e3e1..c1497ad29 100644
--- a/tests/ui/generator/borrow-in-tail-expr.rs
+++ b/tests/ui/coroutine/borrow-in-tail-expr.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _a = || {
diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/coroutine/borrowing.rs
index d36592583..778eed8bd 100644
--- a/tests/ui/generator/borrowing.rs
+++ b/tests/ui/coroutine/borrowing.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/coroutine/borrowing.stderr
index 38e1ace8c..acd4cdafd 100644
--- a/tests/ui/generator/borrowing.stderr
+++ b/tests/ui/coroutine/borrowing.stderr
@@ -7,7 +7,7 @@ LL | let a = 3;
LL | Pin::new(&mut || yield &a).resume(())
| -- ^ borrowed value does not live long enough
| |
- | value captured here by generator
+ | value captured here by coroutine
LL |
LL | };
| - `a` dropped here while still borrowed
@@ -19,7 +19,7 @@ LL | let _b = {
| -- borrow later stored here
LL | let a = 3;
LL | || {
- | -- value captured here by generator
+ | -- value captured here by coroutine
LL | yield &a
| ^ borrowed value does not live long enough
...
diff --git a/tests/ui/generator/clone-impl-async.rs b/tests/ui/coroutine/clone-impl-async.rs
index 9e9b59d36..e8e82f199 100644
--- a/tests/ui/generator/clone-impl-async.rs
+++ b/tests/ui/coroutine/clone-impl-async.rs
@@ -1,8 +1,8 @@
// edition:2021
-// gate-test-generator_clone
-// Verifies that feature(generator_clone) doesn't allow async blocks to be cloned/copied.
+// gate-test-coroutine_clone
+// Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
use std::future::ready;
diff --git a/tests/ui/generator/clone-impl-async.stderr b/tests/ui/coroutine/clone-impl-async.stderr
index d172dff3a..d172dff3a 100644
--- a/tests/ui/generator/clone-impl-async.stderr
+++ b/tests/ui/coroutine/clone-impl-async.stderr
diff --git a/tests/ui/generator/clone-impl-static.rs b/tests/ui/coroutine/clone-impl-static.rs
index 55ed0f281..9a165cf46 100644
--- a/tests/ui/generator/clone-impl-static.rs
+++ b/tests/ui/coroutine/clone-impl-static.rs
@@ -1,7 +1,7 @@
-// gate-test-generator_clone
-// Verifies that static generators cannot be cloned/copied.
+// gate-test-coroutine_clone
+// Verifies that static coroutines cannot be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
fn main() {
let gen = static move || {
diff --git a/tests/ui/generator/clone-impl-static.stderr b/tests/ui/coroutine/clone-impl-static.stderr
index 8b51824c7..8fa9fb12b 100644
--- a/tests/ui/generator/clone-impl-static.stderr
+++ b/tests/ui/coroutine/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 coroutine@$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 coroutine@$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 coroutine@$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 coroutine@$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.rs b/tests/ui/coroutine/clone-impl.rs
index cbfd65a53..eed6f851b 100644
--- a/tests/ui/generator/clone-impl.rs
+++ b/tests/ui/coroutine/clone-impl.rs
@@ -1,8 +1,8 @@
-// gate-test-generator_clone
-// Verifies that non-static generators can be cloned/copied if all their upvars and locals held
+// gate-test-coroutine_clone
+// Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held
// across awaits can be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
struct NonClone;
diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/coroutine/clone-impl.stderr
index 870216398..82a6d0495 100644
--- a/tests/ui/generator/clone-impl.stderr
+++ b/tests/ui/coroutine/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}`
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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,16 +18,16 @@ 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}`
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:38:9
|
LL | let v = vec!['a'];
@@ -40,14 +40,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<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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
@@ -60,16 +60,16 @@ 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}`
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:52:9
|
LL | let v = vec!['a'];
@@ -83,14 +83,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 `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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
@@ -108,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}`
+error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$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 `{coroutine@$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 `{coroutine@$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/conditional-drop.rs b/tests/ui/coroutine/conditional-drop.rs
index 0927df869..634095c7a 100644
--- a/tests/ui/generator/conditional-drop.rs
+++ b/tests/ui/coroutine/conditional-drop.rs
@@ -3,9 +3,9 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/control-flow.rs b/tests/ui/coroutine/control-flow.rs
index 4f69c7855..709b135b2 100644
--- a/tests/ui/generator/control-flow.rs
+++ b/tests/ui/coroutine/control-flow.rs
@@ -3,19 +3,19 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
fn finish<T>(mut amt: usize, mut t: T) -> T::Return
- where T: Generator<(), Yield = ()> + Unpin,
+ where T: Coroutine<(), Yield = ()> + Unpin,
{
loop {
match Pin::new(&mut t).resume(()) {
- GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(),
- GeneratorState::Complete(ret) => {
+ CoroutineState::Yielded(()) => amt = amt.checked_sub(1).unwrap(),
+ CoroutineState::Complete(ret) => {
assert_eq!(amt, 0);
return ret
}
diff --git a/tests/ui/generator/generator-region-requirements.migrate.stderr b/tests/ui/coroutine/coroutine-region-requirements.migrate.stderr
index 8a96d187f..8a96d187f 100644
--- a/tests/ui/generator/generator-region-requirements.migrate.stderr
+++ b/tests/ui/coroutine/coroutine-region-requirements.migrate.stderr
diff --git a/tests/ui/generator/generator-region-requirements.rs b/tests/ui/coroutine/coroutine-region-requirements.rs
index 7269a79ca..8bc34fdd2 100644
--- a/tests/ui/generator/generator-region-requirements.rs
+++ b/tests/ui/coroutine/coroutine-region-requirements.rs
@@ -1,5 +1,5 @@
-#![feature(generators, generator_trait)]
-use std::ops::{Generator, GeneratorState};
+#![feature(coroutines, coroutine_trait)]
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn dangle(x: &mut i32) -> &'static mut i32 {
@@ -9,9 +9,9 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
};
loop {
match Pin::new(&mut g).resume(()) {
- GeneratorState::Complete(c) => return c,
+ CoroutineState::Complete(c) => return c,
//~^ ERROR lifetime may not live long enough
- GeneratorState::Yielded(_) => (),
+ CoroutineState::Yielded(_) => (),
}
}
}
diff --git a/tests/ui/generator/generator-region-requirements.stderr b/tests/ui/coroutine/coroutine-region-requirements.stderr
index 87f604672..ad3183e76 100644
--- a/tests/ui/generator/generator-region-requirements.stderr
+++ b/tests/ui/coroutine/coroutine-region-requirements.stderr
@@ -1,10 +1,10 @@
error: lifetime may not live long enough
- --> $DIR/generator-region-requirements.rs:12:51
+ --> $DIR/coroutine-region-requirements.rs:12:51
|
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
| - let's call the lifetime of this reference `'1`
...
-LL | GeneratorState::Complete(c) => return c,
+LL | CoroutineState::Complete(c) => return c,
| ^ returning this value requires that `'1` must outlive `'static`
error: aborting due to previous error
diff --git a/tests/ui/generator/generator-resume-after-panic.rs b/tests/ui/coroutine/coroutine-resume-after-panic.rs
index f2e67f1f7..5915f5ad9 100644
--- a/tests/ui/generator/generator-resume-after-panic.rs
+++ b/tests/ui/coroutine/coroutine-resume-after-panic.rs
@@ -1,14 +1,14 @@
// run-fail
// needs-unwind
-// error-pattern:generator resumed after panicking
+// error-pattern:coroutine resumed after panicking
// ignore-emscripten no processes
-// Test that we get the correct message for resuming a panicked generator.
+// Test that we get the correct message for resuming a panicked coroutine.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
- ops::Generator,
+ ops::Coroutine,
pin::Pin,
panic,
};
diff --git a/tests/ui/generator/generator-with-nll.rs b/tests/ui/coroutine/coroutine-with-nll.rs
index cee3e6d22..28a3643fb 100644
--- a/tests/ui/generator/generator-with-nll.rs
+++ b/tests/ui/coroutine/coroutine-with-nll.rs
@@ -1,11 +1,11 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
|| {
// The reference in `_a` is a Legal with NLL since it ends before the yield
let _a = &mut true;
let b = &mut true;
- //~^ borrow may still be in use when generator yields
+ //~^ borrow may still be in use when coroutine yields
yield ();
println!("{}", b);
};
diff --git a/tests/ui/generator/generator-with-nll.stderr b/tests/ui/coroutine/coroutine-with-nll.stderr
index 14199aeb9..ed58debe2 100644
--- a/tests/ui/generator/generator-with-nll.stderr
+++ b/tests/ui/coroutine/coroutine-with-nll.stderr
@@ -1,5 +1,5 @@
-error[E0626]: borrow may still be in use when generator yields
- --> $DIR/generator-with-nll.rs:7:17
+error[E0626]: borrow may still be in use when coroutine yields
+ --> $DIR/coroutine-with-nll.rs:7:17
|
LL | let b = &mut true;
| ^^^^^^^^^
diff --git a/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs
new file mode 100644
index 000000000..3c91b3c93
--- /dev/null
+++ b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs
@@ -0,0 +1,35 @@
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
+
+// Test that we cannot create a coroutine that returns a value of its
+// own type.
+
+use std::ops::Coroutine;
+
+pub fn want_cyclic_coroutine_return<T>(_: T)
+ where T: Coroutine<Yield = (), Return = T>
+{
+}
+
+fn supply_cyclic_coroutine_return() {
+ want_cyclic_coroutine_return(|| {
+ //~^ ERROR type mismatch
+ if false { yield None.unwrap(); }
+ None.unwrap()
+ })
+}
+
+pub fn want_cyclic_coroutine_yield<T>(_: T)
+ where T: Coroutine<Yield = T, Return = ()>
+{
+}
+
+fn supply_cyclic_coroutine_yield() {
+ want_cyclic_coroutine_yield(|| {
+ //~^ ERROR type mismatch
+ if false { yield None.unwrap(); }
+ None.unwrap()
+ })
+}
+
+fn main() { }
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr
index 7841a0854..325030524 100644
--- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr
+++ b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr
@@ -1,7 +1,7 @@
-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
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:15:34: 15:36} as Coroutine>::Return == {coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:15:34: 15:36}`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:15:34
|
-LL | want_cyclic_generator_return(|| {
+LL | want_cyclic_coroutine_return(|| {
| _____----------------------------_^
| | |
| | required by a bound introduced by this call
@@ -15,18 +15,18 @@ LL | | })
this error may be the result of a recent compiler bug-fix,
see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
for more information
-note: required by a bound in `want_cyclic_generator_return`
- --> $DIR/generator-yielding-or-returning-itself.rs:10:36
+note: required by a bound in `want_cyclic_coroutine_return`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:10:36
|
-LL | pub fn want_cyclic_generator_return<T>(_: T)
+LL | pub fn want_cyclic_coroutine_return<T>(_: T)
| ---------------------------- required by a bound in this function
-LL | where T: Generator<Yield = (), Return = T>
- | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return`
+LL | where T: Coroutine<Yield = (), Return = T>
+ | ^^^^^^^^^^ required by this bound in `want_cyclic_coroutine_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}`
- --> $DIR/generator-yielding-or-returning-itself.rs:28:33
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:28:33: 28:35} as Coroutine>::Yield == {coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:28:33: 28:35}`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:28:33
|
-LL | want_cyclic_generator_yield(|| {
+LL | want_cyclic_coroutine_yield(|| {
| _____---------------------------_^
| | |
| | required by a bound introduced by this call
@@ -40,13 +40,13 @@ LL | | })
this error may be the result of a recent compiler bug-fix,
see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
for more information
-note: required by a bound in `want_cyclic_generator_yield`
- --> $DIR/generator-yielding-or-returning-itself.rs:23:24
+note: required by a bound in `want_cyclic_coroutine_yield`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:23:24
|
-LL | pub fn want_cyclic_generator_yield<T>(_: T)
+LL | pub fn want_cyclic_coroutine_yield<T>(_: T)
| --------------------------- required by a bound in this function
-LL | where T: Generator<Yield = T, Return = ()>
- | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield`
+LL | where T: Coroutine<Yield = T, Return = ()>
+ | ^^^^^^^^^ required by this bound in `want_cyclic_coroutine_yield`
error: aborting due to 2 previous errors
diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/coroutine/derived-drop-parent-expr.rs
index e38192451..59a3e8478 100644
--- a/tests/ui/generator/derived-drop-parent-expr.rs
+++ b/tests/ui/coroutine/derived-drop-parent-expr.rs
@@ -1,7 +1,7 @@
// build-pass
//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR
-#![feature(generators)]
+#![feature(coroutines)]
fn assert_send<T: Send>(_thing: T) {}
diff --git a/tests/ui/generator/discriminant.rs b/tests/ui/coroutine/discriminant.rs
index 195e77022..73bdd9c86 100644
--- a/tests/ui/generator/discriminant.rs
+++ b/tests/ui/coroutine/discriminant.rs
@@ -1,12 +1,12 @@
-//! Tests that generator discriminant sizes and ranges are chosen optimally and that they are
+//! Tests that coroutine discriminant sizes and ranges are chosen optimally and that they are
//! reflected in the output of `mem::discriminant`.
// run-pass
-#![feature(generators, generator_trait, core_intrinsics, discriminant_kind)]
+#![feature(coroutines, coroutine_trait, core_intrinsics, discriminant_kind)]
use std::intrinsics::discriminant_value;
-use std::marker::{Unpin, DiscriminantKind};
+use std::marker::{DiscriminantKind, Unpin};
use std::mem::size_of_val;
use std::{cmp, ops::*};
@@ -66,16 +66,16 @@ macro_rules! yield250 {
}
fn cycle(
- gen: impl Generator<()> + Unpin + DiscriminantKind<Discriminant = u32>,
- expected_max_discr: u32
+ gen: impl Coroutine<()> + Unpin + DiscriminantKind<Discriminant = u32>,
+ expected_max_discr: u32,
) {
let mut gen = Box::pin(gen);
let mut max_discr = 0;
loop {
max_discr = cmp::max(max_discr, discriminant_value(gen.as_mut().get_mut()));
match gen.as_mut().resume(()) {
- GeneratorState::Yielded(_) => {}
- GeneratorState::Complete(_) => {
+ CoroutineState::Yielded(_) => {}
+ CoroutineState::Complete(_) => {
assert_eq!(max_discr, expected_max_discr);
return;
}
diff --git a/tests/ui/generator/drop-and-replace.rs b/tests/ui/coroutine/drop-and-replace.rs
index a9a50a122..38b757fac 100644
--- a/tests/ui/generator/drop-and-replace.rs
+++ b/tests/ui/coroutine/drop-and-replace.rs
@@ -1,19 +1,19 @@
// run-pass
// Regression test for incorrect DropAndReplace behavior introduced in #60840
// and fixed in #61373. When combined with the optimization implemented in
-// #60187, this produced incorrect code for generators when a saved local was
+// #60187, this produced incorrect code for coroutines when a saved local was
// re-assigned.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
#[derive(Debug, PartialEq)]
struct Foo(i32);
impl Drop for Foo {
- fn drop(&mut self) { }
+ fn drop(&mut self) {}
}
fn main() {
@@ -38,7 +38,7 @@ fn main() {
loop {
match Pin::new(&mut a).resume(()) {
- GeneratorState::Complete(()) => break,
+ CoroutineState::Complete(()) => break,
_ => (),
}
}
diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/coroutine/drop-control-flow.rs
index 1c25c06ba..55d08b8d5 100644
--- a/tests/ui/generator/drop-control-flow.rs
+++ b/tests/ui/coroutine/drop-control-flow.rs
@@ -1,10 +1,10 @@
// build-pass
-// A test to ensure generators capture values that were conditionally dropped,
+// A test to ensure coroutines capture values that were conditionally dropped,
// and also that values that are dropped along all paths to a yield do not get
-// included in the generator type.
+// included in the coroutine type.
-#![feature(generators, negative_impls)]
+#![feature(coroutines, negative_impls)]
#![allow(unused_assignments, dead_code)]
struct Ptr;
diff --git a/tests/ui/generator/drop-env.rs b/tests/ui/coroutine/drop-env.rs
index 137a40793..404c04343 100644
--- a/tests/ui/generator/drop-env.rs
+++ b/tests/ui/coroutine/drop-env.rs
@@ -3,10 +3,10 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![allow(dropping_copy_types)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/coroutine/drop-track-addassign-yield.rs
index 1e64f1d2e..6c5897458 100644
--- a/tests/ui/generator/drop-track-addassign-yield.rs
+++ b/tests/ui/coroutine/drop-track-addassign-yield.rs
@@ -3,7 +3,7 @@
// 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.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() {
let _y = static || {
diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs
index 198b14528..4d40192c0 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.rs
+++ b/tests/ui/coroutine/drop-tracking-parent-expression.rs
@@ -1,4 +1,4 @@
-#![feature(generators, negative_impls, rustc_attrs)]
+#![feature(coroutines, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
(
diff --git a/tests/ui/generator/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr
index e85bb1347..6cd4ec833 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.stderr
+++ b/tests/ui/coroutine/drop-tracking-parent-expression.stderr
@@ -1,8 +1,8 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -13,8 +13,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -38,11 +38,11 @@ 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
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -53,8 +53,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -78,11 +78,11 @@ 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
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -93,8 +93,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs
index 92e0136d5..622765d82 100644
--- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
+++ b/tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs
@@ -1,7 +1,7 @@
// build-pass
// edition:2018
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _ = static |x: u8| match x {
diff --git a/tests/ui/generator/drop-yield-twice.rs b/tests/ui/coroutine/drop-yield-twice.rs
index f484cbb8d..015343a27 100644
--- a/tests/ui/generator/drop-yield-twice.rs
+++ b/tests/ui/coroutine/drop-yield-twice.rs
@@ -1,10 +1,10 @@
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo(i32);
impl !Send for Foo {}
fn main() {
- assert_send(|| { //~ ERROR generator cannot be sent between threads safely
+ assert_send(|| { //~ ERROR coroutine cannot be sent between threads safely
let guard = Foo(42);
yield;
drop(guard);
diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/coroutine/drop-yield-twice.stderr
index 39a906f0b..fbbedac57 100644
--- a/tests/ui/generator/drop-yield-twice.stderr
+++ b/tests/ui/coroutine/drop-yield-twice.stderr
@@ -1,11 +1,11 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-yield-twice.rs:7:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
- = 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
+ = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-yield-twice.rs:9:9
|
LL | let guard = Foo(42);
diff --git a/tests/ui/generator/dropck-resume.rs b/tests/ui/coroutine/dropck-resume.rs
index 4c18077f3..07ca4d37a 100644
--- a/tests/ui/generator/dropck-resume.rs
+++ b/tests/ui/coroutine/dropck-resume.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
struct SetToNone<'a: 'b, 'b>(&'b mut Option<&'a i32>);
@@ -11,7 +11,7 @@ impl<'a, 'b> Drop for SetToNone<'a, 'b> {
}
}
-fn drop_using_generator() -> i32 {
+fn drop_using_coroutine() -> i32 {
let mut y = Some(&0);
let z = &mut y;
let r;
@@ -29,5 +29,5 @@ fn drop_using_generator() -> i32 {
}
fn main() {
- println!("{}", drop_using_generator());
+ println!("{}", drop_using_coroutine());
}
diff --git a/tests/ui/generator/dropck-resume.stderr b/tests/ui/coroutine/dropck-resume.stderr
index ecf92e7e3..028523978 100644
--- a/tests/ui/generator/dropck-resume.stderr
+++ b/tests/ui/coroutine/dropck-resume.stderr
@@ -8,7 +8,7 @@ LL | r = y.as_ref().unwrap();
| ^ immutable borrow occurs here
LL |
LL | }
- | - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator
+ | - mutable borrow might be used here, when `g` is dropped and runs the destructor for coroutine
error: aborting due to previous error
diff --git a/tests/ui/generator/dropck.rs b/tests/ui/coroutine/dropck.rs
index f82111a76..450361c8d 100644
--- a/tests/ui/generator/dropck.rs
+++ b/tests/ui/coroutine/dropck.rs
@@ -1,7 +1,7 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::cell::RefCell;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
@@ -11,7 +11,7 @@ fn main() {
//~^ ERROR `*cell` does not live long enough [E0597]
// the upvar is the non-dropck `&mut Option<Ref<'a, i32>>`.
gen = || {
- // but the generator can use it to drop a `Ref<'a, i32>`.
+ // but the coroutine can use it to drop a `Ref<'a, i32>`.
let _d = ref_.take(); //~ ERROR `ref_` does not live long enough
yield;
};
diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/coroutine/dropck.stderr
index 246ac99f8..241d6dfe0 100644
--- a/tests/ui/generator/dropck.stderr
+++ b/tests/ui/coroutine/dropck.stderr
@@ -11,7 +11,7 @@ LL | }
| -
| |
| `*cell` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
+ | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine
|
= note: values in a scope are dropped in the opposite order they are defined
@@ -19,8 +19,8 @@ error[E0597]: `ref_` does not live long enough
--> $DIR/dropck.rs:15:18
|
LL | gen = || {
- | -- value captured here by generator
-LL | // but the generator can use it to drop a `Ref<'a, i32>`.
+ | -- value captured here by coroutine
+LL | // but the coroutine can use it to drop a `Ref<'a, i32>`.
LL | let _d = ref_.take();
| ^^^^ borrowed value does not live long enough
...
@@ -28,7 +28,7 @@ LL | }
| -
| |
| `ref_` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
+ | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine
|
= note: values in a scope are dropped in the opposite order they are defined
diff --git a/tests/ui/coroutine/gen_block.e2024.stderr b/tests/ui/coroutine/gen_block.e2024.stderr
new file mode 100644
index 000000000..f250e2f79
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.e2024.stderr
@@ -0,0 +1,19 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0282]: type annotations needed
+ --> $DIR/gen_block.rs:6:17
+ |
+LL | let x = gen {};
+ | ^^ cannot infer type
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0282, E0658.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/coroutine/gen_block.none.stderr b/tests/ui/coroutine/gen_block.none.stderr
new file mode 100644
index 000000000..012a8308c
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.none.stderr
@@ -0,0 +1,49 @@
+error: expected identifier, found reserved keyword `yield`
+ --> $DIR/gen_block.rs:9:19
+ |
+LL | let y = gen { yield 42 };
+ | --- ^^^^^ expected identifier, found reserved keyword
+ | |
+ | while parsing this struct
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:6:13
+ |
+LL | let x = gen {};
+ | ^^^ not found in this scope
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:9:13
+ |
+LL | let y = gen { yield 42 };
+ | ^^^ not found in this scope
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:12:5
+ |
+LL | gen {};
+ | ^^^ not found in this scope
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0422, E0658.
+For more information about an error, try `rustc --explain E0422`.
diff --git a/tests/ui/coroutine/gen_block.rs b/tests/ui/coroutine/gen_block.rs
new file mode 100644
index 000000000..852c7c455
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.rs
@@ -0,0 +1,17 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+#![cfg_attr(e2024, feature(gen_blocks))]
+
+fn main() {
+ let x = gen {};
+ //[none]~^ ERROR: cannot find
+ //[e2024]~^^ ERROR: type annotations needed
+ let y = gen { yield 42 };
+ //[none]~^ ERROR: found reserved keyword `yield`
+ //[none]~| ERROR: cannot find
+ gen {};
+ //[none]~^ ERROR: cannot find
+
+ let _ = || yield true; //[none]~ ERROR yield syntax is experimental
+ //~^ ERROR yield syntax is experimental
+}
diff --git a/tests/ui/coroutine/gen_block_is_coro.rs b/tests/ui/coroutine/gen_block_is_coro.rs
new file mode 100644
index 000000000..c66ccefba
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_coro.rs
@@ -0,0 +1,18 @@
+//compile-flags: --edition 2024 -Zunstable-options
+#![feature(coroutines, coroutine_trait, gen_blocks)]
+
+use std::ops::Coroutine;
+
+fn foo() -> impl Coroutine<Yield = u32, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn bar() -> impl Coroutine<Yield = i64, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn baz() -> impl Coroutine<Yield = i32, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_coro.stderr b/tests/ui/coroutine/gen_block_is_coro.stderr
new file mode 100644
index 000000000..83a674fa5
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_coro.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:6:13
+ |
+LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}`
+
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:10:13
+ |
+LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}`
+
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:14:13
+ |
+LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/coroutine/gen_block_is_iter.rs b/tests/ui/coroutine/gen_block_is_iter.rs
new file mode 100644
index 000000000..92625cf7c
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_iter.rs
@@ -0,0 +1,19 @@
+// revisions: next old
+//compile-flags: --edition 2024 -Zunstable-options
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+#![feature(gen_blocks)]
+
+fn foo() -> impl Iterator<Item = u32> {
+ gen { yield 42 }
+}
+
+fn bar() -> impl Iterator<Item = i64> {
+ gen { yield 42 }
+}
+
+fn baz() -> impl Iterator<Item = i32> {
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_no_future.rs b/tests/ui/coroutine/gen_block_is_no_future.rs
new file mode 100644
index 000000000..947665197
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_no_future.rs
@@ -0,0 +1,8 @@
+//compile-flags: --edition 2024 -Zunstable-options
+#![feature(gen_blocks)]
+
+fn foo() -> impl std::future::Future { //~ ERROR is not a future
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_no_future.stderr b/tests/ui/coroutine/gen_block_is_no_future.stderr
new file mode 100644
index 000000000..db0c3c19b
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_no_future.stderr
@@ -0,0 +1,12 @@
+error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
+ --> $DIR/gen_block_is_no_future.rs:4:13
+ |
+LL | fn foo() -> impl std::future::Future {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
+ |
+ = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}`
+ = note: {gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21} must be a future or must implement `IntoFuture` to be awaited
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/coroutine/gen_block_iterate.rs b/tests/ui/coroutine/gen_block_iterate.rs
new file mode 100644
index 000000000..18e1bb887
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_iterate.rs
@@ -0,0 +1,35 @@
+// revisions: next old
+//compile-flags: --edition 2024 -Zunstable-options
+//[next] compile-flags: -Ztrait-solver=next
+// run-pass
+#![feature(gen_blocks)]
+
+fn foo() -> impl Iterator<Item = u32> {
+ gen { yield 42; for x in 3..6 { yield x } }
+}
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen move {
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ let mut iter = foo();
+ assert_eq!(iter.next(), Some(42));
+ assert_eq!(iter.next(), Some(3));
+ assert_eq!(iter.next(), Some(4));
+ assert_eq!(iter.next(), Some(5));
+ assert_eq!(iter.next(), None);
+ // `gen` blocks are fused
+ assert_eq!(iter.next(), None);
+
+ let mut iter = moved();
+ assert_eq!(iter.next(), Some(42));
+ assert_eq!(iter.next(), None);
+
+}
diff --git a/tests/ui/coroutine/gen_block_move.fixed b/tests/ui/coroutine/gen_block_move.fixed
new file mode 100644
index 000000000..5c6c80623
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.fixed
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+// run-rustfix
+#![feature(gen_blocks)]
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen move { //~ ERROR: gen block may outlive the current function
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ for _ in moved() {}
+}
diff --git a/tests/ui/coroutine/gen_block_move.rs b/tests/ui/coroutine/gen_block_move.rs
new file mode 100644
index 000000000..abbf81324
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.rs
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+// run-rustfix
+#![feature(gen_blocks)]
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen { //~ ERROR: gen block may outlive the current function
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ for _ in moved() {}
+}
diff --git a/tests/ui/coroutine/gen_block_move.stderr b/tests/ui/coroutine/gen_block_move.stderr
new file mode 100644
index 000000000..b93ac65f5
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.stderr
@@ -0,0 +1,30 @@
+error[E0373]: gen block may outlive the current function, but it borrows `x`, which is owned by the current function
+ --> $DIR/gen_block_move.rs:7:5
+ |
+LL | / gen {
+LL | | yield 42;
+LL | | if x == "foo" { return }
+LL | | x.clear();
+ | | - `x` is borrowed here
+LL | | for x in 3..6 { yield x }
+LL | | }
+ | |_____^ may outlive borrowed value `x`
+ |
+note: gen block is returned here
+ --> $DIR/gen_block_move.rs:7:5
+ |
+LL | / gen {
+LL | | yield 42;
+LL | | if x == "foo" { return }
+LL | | x.clear();
+LL | | for x in 3..6 { yield x }
+LL | | }
+ | |_____^
+help: to force the gen block to take ownership of `x` (and any other referenced variables), use the `move` keyword
+ |
+LL | gen move {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0373`.
diff --git a/tests/ui/coroutine/gen_block_panic.rs b/tests/ui/coroutine/gen_block_panic.rs
new file mode 100644
index 000000000..2da0eb512
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_panic.rs
@@ -0,0 +1,26 @@
+//compile-flags: --edition 2024 -Zunstable-options
+// run-pass
+// needs-unwind
+#![feature(gen_blocks)]
+
+fn main() {
+ let mut iter = gen {
+ yield 42;
+ panic!("foo");
+ yield 69; //~ WARN: unreachable statement
+ };
+ assert_eq!(iter.next(), Some(42));
+ let mut tmp = std::panic::AssertUnwindSafe(&mut iter);
+ match std::panic::catch_unwind(move || tmp.next()) {
+ Ok(_) => unreachable!(),
+ Err(err) => assert_eq!(*err.downcast::<&'static str>().unwrap(), "foo"),
+ }
+
+ match std::panic::catch_unwind(move || iter.next()) {
+ Ok(_) => unreachable!(),
+ Err(err) => assert_eq!(
+ *err.downcast::<&'static str>().unwrap(),
+ "`gen fn` should just keep returning `None` after panicking",
+ ),
+ }
+}
diff --git a/tests/ui/coroutine/gen_block_panic.stderr b/tests/ui/coroutine/gen_block_panic.stderr
new file mode 100644
index 000000000..a0a6d1063
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_panic.stderr
@@ -0,0 +1,12 @@
+warning: unreachable statement
+ --> $DIR/gen_block_panic.rs:10:9
+ |
+LL | panic!("foo");
+ | ------------- any code following this expression is unreachable
+LL | yield 69;
+ | ^^^^^^^^^ unreachable statement
+ |
+ = note: `#[warn(unreachable_code)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/coroutine/gen_fn.e2024.stderr b/tests/ui/coroutine/gen_fn.e2024.stderr
new file mode 100644
index 000000000..388e10fd6
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.e2024.stderr
@@ -0,0 +1,10 @@
+error: `gen` functions are not yet implemented
+ --> $DIR/gen_fn.rs:4:1
+ |
+LL | gen fn foo() {}
+ | ^^^
+ |
+ = help: for now you can use `gen {}` blocks and return `impl Iterator` instead
+
+error: aborting due to previous error
+
diff --git a/tests/ui/coroutine/gen_fn.none.stderr b/tests/ui/coroutine/gen_fn.none.stderr
new file mode 100644
index 000000000..5e7bd9d8b
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.none.stderr
@@ -0,0 +1,8 @@
+error: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
+ --> $DIR/gen_fn.rs:4:1
+ |
+LL | gen fn foo() {}
+ | ^^^ expected one of 9 possible tokens
+
+error: aborting due to previous error
+
diff --git a/tests/ui/coroutine/gen_fn.rs b/tests/ui/coroutine/gen_fn.rs
new file mode 100644
index 000000000..da515f263
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.rs
@@ -0,0 +1,8 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+gen fn foo() {}
+//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
+//[e2024]~^^ ERROR: `gen` functions are not yet implemented
+
+fn main() {}
diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/coroutine/issue-102645.rs
index 677cc69d3..a0263510e 100644
--- a/tests/ui/generator/issue-102645.rs
+++ b/tests/ui/coroutine/issue-102645.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/coroutine/issue-102645.stderr
index 5d28dfc45..3db090346 100644
--- a/tests/ui/generator/issue-102645.stderr
+++ b/tests/ui/coroutine/issue-102645.stderr
@@ -5,7 +5,7 @@ LL | Pin::new(&mut b).resume();
| ^^^^^^-- an argument of type `()` is missing
|
note: method defined here
- --> $SRC_DIR/core/src/ops/generator.rs:LL:COL
+ --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL
help: provide the argument
|
LL | Pin::new(&mut b).resume(());
diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/coroutine/issue-105084.rs
index 50b5da6e6..7801f1bce 100644
--- a/tests/ui/generator/issue-105084.rs
+++ b/tests/ui/coroutine/issue-105084.rs
@@ -1,9 +1,9 @@
-#![feature(generators)]
-#![feature(generator_clone)]
-#![feature(generator_trait)]
+#![feature(coroutines)]
+#![feature(coroutine_clone)]
+#![feature(coroutine_trait)]
#![feature(rustc_attrs, stmt_expr_attributes)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn copy<T: Copy>(x: T) -> T {
@@ -25,9 +25,9 @@ fn main() {
// Allocate the temporary box.
Pin::new(&mut g).resume(());
- // The temporary box is in generator locals.
+ // The temporary box is in coroutine locals.
// As it is not taken into account for trait computation,
- // the generator is `Copy`.
+ // the coroutine is `Copy`.
let mut h = copy(g);
//~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
diff --git a/tests/ui/generator/issue-105084.stderr b/tests/ui/coroutine/issue-105084.stderr
index 573c31f11..38f114ff7 100644
--- a/tests/ui/generator/issue-105084.stderr
+++ b/tests/ui/coroutine/issue-105084.stderr
@@ -2,7 +2,7 @@ error[E0382]: borrow of moved value: `g`
--> $DIR/issue-105084.rs:37:14
|
LL | let mut g = || {
- | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
+ | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
...
LL | let mut h = copy(g);
| - value moved here
@@ -22,16 +22,16 @@ 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:14:17: 14:19}`
+error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$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:14:17: 14:19}`
+ | -- within this `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
...
LL | let mut h = copy(g);
- | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
+ | ^^^^ within `{coroutine@$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
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/issue-105084.rs:21:22
|
LL | Box::new((5, yield));
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs
index 845102464..ad39b71b0 100644
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
+++ b/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs
@@ -1,6 +1,6 @@
// edition:2021
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let x = &mut ();
diff --git a/tests/ui/generator/issue-113279.rs b/tests/ui/coroutine/issue-113279.rs
index f69f804b7..f251c924c 100644
--- a/tests/ui/generator/issue-113279.rs
+++ b/tests/ui/coroutine/issue-113279.rs
@@ -1,10 +1,10 @@
-#![feature(generators)]
+#![feature(coroutines)]
// `foo` attempts to dereference `""`, which results in an error being reported. Later, the
-// generator transform for `foo` then produces a union which contains a `str` type - unions should
+// coroutine transform for `foo` then produces a union which contains a `str` type - unions should
// not contain unsized types, but this is okay because an error has been reported already.
// When const propagation happens later in compilation, it attempts to compute the layout of the
-// generator (as part of checking whether something can be const propagated) and in turn attempts
+// coroutine (as part of checking whether something can be const propagated) and in turn attempts
// to compute the layout of `str` in the context of a union - where this caused an ICE. This test
// makes sure that doesn't happen again.
diff --git a/tests/ui/generator/issue-113279.stderr b/tests/ui/coroutine/issue-113279.stderr
index cc9b64ef9..cc9b64ef9 100644
--- a/tests/ui/generator/issue-113279.stderr
+++ b/tests/ui/coroutine/issue-113279.stderr
diff --git a/tests/ui/generator/issue-44197.rs b/tests/ui/coroutine/issue-44197.rs
index 389b9d139..c0326bdae 100644
--- a/tests/ui/generator/issue-44197.rs
+++ b/tests/ui/coroutine/issue-44197.rs
@@ -1,15 +1,15 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn foo(_: &str) -> String {
String::new()
}
-fn bar(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
+fn bar(baz: String) -> impl Coroutine<(), Yield = String, Return = ()> {
move || {
yield foo(&baz);
}
@@ -19,7 +19,7 @@ fn foo2(_: &str) -> Result<String, ()> {
Err(())
}
-fn bar2(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
+fn bar2(baz: String) -> impl Coroutine<(), Yield = String, Return = ()> {
move || {
if let Ok(quux) = foo2(&baz) {
yield quux;
@@ -30,7 +30,7 @@ fn bar2(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
fn main() {
assert_eq!(
Pin::new(&mut bar(String::new())).resume(()),
- GeneratorState::Yielded(String::new())
+ CoroutineState::Yielded(String::new())
);
- assert_eq!(Pin::new(&mut bar2(String::new())).resume(()), GeneratorState::Complete(()));
+ assert_eq!(Pin::new(&mut bar2(String::new())).resume(()), CoroutineState::Complete(()));
}
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr
index 3afbea079..a9a0d6296 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr
@@ -1,5 +1,5 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
- --> $DIR/issue-45729-unsafe-in-generator.rs:8:9
+ --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9
|
LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.rs b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs
index 379c36d2c..7961b5859 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.rs
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs
@@ -1,7 +1,7 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _ = || {
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr
index 10d768f19..22c83e9a3 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr
@@ -1,5 +1,5 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
- --> $DIR/issue-45729-unsafe-in-generator.rs:8:9
+ --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9
|
LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^ dereference of raw pointer
diff --git a/tests/ui/generator/issue-48048.rs b/tests/ui/coroutine/issue-48048.rs
index 992bbc97a..b61b7c770 100644
--- a/tests/ui/generator/issue-48048.rs
+++ b/tests/ui/coroutine/issue-48048.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let x = (|_| {},);
@@ -6,7 +6,7 @@ fn main() {
|| {
let x = x;
- x.0({ //~ ERROR borrow may still be in use when generator yields
+ x.0({ //~ ERROR borrow may still be in use when coroutine yields
yield;
});
};
diff --git a/tests/ui/generator/issue-48048.stderr b/tests/ui/coroutine/issue-48048.stderr
index 234235839..bb9f189fa 100644
--- a/tests/ui/generator/issue-48048.stderr
+++ b/tests/ui/coroutine/issue-48048.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/issue-48048.rs:9:9
|
LL | x.0({
diff --git a/tests/ui/coroutine/issue-52304.rs b/tests/ui/coroutine/issue-52304.rs
new file mode 100644
index 000000000..fed3a5f19
--- /dev/null
+++ b/tests/ui/coroutine/issue-52304.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+pub fn example() -> impl Coroutine {
+ || yield &1
+}
+
+fn main() {}
diff --git a/tests/ui/generator/issue-52398.rs b/tests/ui/coroutine/issue-52398.rs
index ada380d11..8d651d0e2 100644
--- a/tests/ui/generator/issue-52398.rs
+++ b/tests/ui/coroutine/issue-52398.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(unused_variables)]
-#![feature(generators)]
+#![feature(coroutines)]
use std::cell::RefCell;
@@ -14,14 +14,14 @@ impl A {
fn main() {
// Test that the MIR local with type &A created for the auto-borrow adjustment
// is caught by typeck
- move || { //~ WARN unused generator that must be used
+ move || { //~ WARN unused coroutine that must be used
A.test(yield);
};
// Test that the std::cell::Ref temporary returned from the `borrow` call
// is caught by typeck
let y = RefCell::new(true);
- static move || { //~ WARN unused generator that must be used
+ static move || { //~ WARN unused coroutine that must be used
yield *y.borrow();
return "Done";
};
diff --git a/tests/ui/generator/issue-52398.stderr b/tests/ui/coroutine/issue-52398.stderr
index 539343275..18d816da4 100644
--- a/tests/ui/generator/issue-52398.stderr
+++ b/tests/ui/coroutine/issue-52398.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-52398.rs:17:5
|
LL | / move || {
@@ -6,10 +6,10 @@ LL | | A.test(yield);
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-52398.rs:24:5
|
LL | / static move || {
@@ -18,7 +18,7 @@ LL | | return "Done";
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
warning: 2 warnings emitted
diff --git a/tests/ui/generator/issue-53548-1.rs b/tests/ui/coroutine/issue-53548-1.rs
index 173ae3c6f..4be8e95f3 100644
--- a/tests/ui/generator/issue-53548-1.rs
+++ b/tests/ui/coroutine/issue-53548-1.rs
@@ -1,4 +1,4 @@
-// A variant of #53548 that does not actually require generators,
+// A variant of #53548 that does not actually require coroutines,
// but which encountered the same ICE/error. See `issue-53548.rs`
// for details.
//
diff --git a/tests/ui/generator/issue-53548.rs b/tests/ui/coroutine/issue-53548.rs
index 3ebabb914..bb267f74a 100644
--- a/tests/ui/generator/issue-53548.rs
+++ b/tests/ui/coroutine/issue-53548.rs
@@ -1,5 +1,5 @@
// Regression test for #53548. The `Box<dyn Trait>` type below is
-// expanded to `Box<dyn Trait + 'static>`, but the generator "witness"
+// expanded to `Box<dyn Trait + 'static>`, but the coroutine "witness"
// that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was
// encountering an ICE (when debug-assertions were enabled) and an
// unexpected compilation error (without debug-asserions) when trying
@@ -17,7 +17,7 @@
//
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
use std::cell::RefCell;
use std::rc::Rc;
diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/coroutine/issue-57017.rs
index bb2d6679b..4f63abbdb 100644
--- a/tests/ui/generator/issue-57017.rs
+++ b/tests/ui/coroutine/issue-57017.rs
@@ -1,5 +1,5 @@
// build-pass
-#![feature(generators, negative_impls)]
+#![feature(coroutines, negative_impls)]
#![allow(dropping_references, dropping_copy_types)]
macro_rules! type_combinations {
diff --git a/tests/ui/generator/issue-57084.rs b/tests/ui/coroutine/issue-57084.rs
index fbed78ff2..95bed5b15 100644
--- a/tests/ui/generator/issue-57084.rs
+++ b/tests/ui/coroutine/issue-57084.rs
@@ -2,10 +2,10 @@
// "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '?1"
// run-pass
// edition:2018
-#![feature(generators,generator_trait)]
-use std::ops::Generator;
+#![feature(coroutines,coroutine_trait)]
+use std::ops::Coroutine;
-fn with<F>(f: F) -> impl Generator<Yield=(), Return=()>
+fn with<F>(f: F) -> impl Coroutine<Yield=(), Return=()>
where F: Fn() -> ()
{
move || {
@@ -19,7 +19,7 @@ where F: Fn() -> ()
fn main() {
let data = &vec![1];
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
let _to_pin = with(move || println!("{:p}", data));
loop {
yield
diff --git a/tests/ui/generator/issue-57084.stderr b/tests/ui/coroutine/issue-57084.stderr
index 8f1fc5e80..9f5b79a6a 100644
--- a/tests/ui/generator/issue-57084.stderr
+++ b/tests/ui/coroutine/issue-57084.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-57084.rs:22:5
|
LL | / || {
@@ -9,7 +9,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/coroutine/issue-57478.rs
index 39710febd..716e4c67b 100644
--- a/tests/ui/generator/issue-57478.rs
+++ b/tests/ui/coroutine/issue-57478.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo;
impl !Send for Foo {}
diff --git a/tests/ui/generator/issue-58888.rs b/tests/ui/coroutine/issue-58888.rs
index d42d09d40..af8e60ce4 100644
--- a/tests/ui/generator/issue-58888.rs
+++ b/tests/ui/coroutine/issue-58888.rs
@@ -2,9 +2,9 @@
// compile-flags: -g
// ignore-asmjs wasm2js does not support source maps yet
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
struct Database;
@@ -13,7 +13,7 @@ impl Database {
Some(()).into_iter()
}
- fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
+ fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ {
move || {
let iter = self.get_connection();
for i in iter {
diff --git a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs b/tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs
index 187c37402..cff6c24a8 100644
--- a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs
+++ b/tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs
@@ -4,9 +4,9 @@
// check-pass
// edition:2018
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
async fn drop_and_await() {
async {};
diff --git a/tests/ui/generator/issue-62506-two_awaits.rs b/tests/ui/coroutine/issue-62506-two_awaits.rs
index 672e16b78..b50e2a45c 100644
--- a/tests/ui/generator/issue-62506-two_awaits.rs
+++ b/tests/ui/coroutine/issue-62506-two_awaits.rs
@@ -1,5 +1,5 @@
// Output = String caused an ICE whereas Output = &'static str compiled successfully.
-// Broken MIR: generator contains type std::string::String in MIR,
+// Broken MIR: coroutine contains type std::string::String in MIR,
// but typeck only knows about {<S as T>::Future, ()}
// check-pass
// edition:2018
diff --git a/tests/ui/coroutine/issue-64620-yield-array-element.rs b/tests/ui/coroutine/issue-64620-yield-array-element.rs
new file mode 100644
index 000000000..a9307d306
--- /dev/null
+++ b/tests/ui/coroutine/issue-64620-yield-array-element.rs
@@ -0,0 +1,9 @@
+// Regression test for #64620
+
+#![feature(coroutines)]
+
+pub fn crash(arr: [usize; 1]) {
+ yield arr[0]; //~ ERROR: yield expression outside of coroutine literal
+}
+
+fn main() {}
diff --git a/tests/ui/generator/issue-64620-yield-array-element.stderr b/tests/ui/coroutine/issue-64620-yield-array-element.stderr
index 48383c2ed..47632d083 100644
--- a/tests/ui/generator/issue-64620-yield-array-element.stderr
+++ b/tests/ui/coroutine/issue-64620-yield-array-element.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/issue-64620-yield-array-element.rs:6:5
|
LL | yield arr[0];
diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/coroutine/issue-68112.rs
index 9dd68726f..e2be704da 100644
--- a/tests/ui/generator/issue-68112.rs
+++ b/tests/ui/coroutine/issue-68112.rs
@@ -1,18 +1,18 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
cell::RefCell,
sync::Arc,
pin::Pin,
- ops::{Generator, GeneratorState},
+ ops::{Coroutine, CoroutineState},
};
pub struct Ready<T>(Option<T>);
-impl<T: Unpin> Generator<()> for Ready<T> {
+impl<T: Unpin> Coroutine<()> for Ready<T> {
type Return = T;
type Yield = ();
- fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
- GeneratorState::Complete(self.0.take().unwrap())
+ fn resume(mut self: Pin<&mut Self>, _args: ()) -> CoroutineState<(), T> {
+ CoroutineState::Complete(self.0.take().unwrap())
}
}
pub fn make_gen1<T>(t: T) -> Ready<T> {
@@ -25,40 +25,40 @@ fn require_send(_: impl Send) {}
//~| NOTE required by this bound
//~| NOTE required by this bound
-fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen1(Arc::new(RefCell::new(0)))
}
fn test1() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator();
+ let _non_send_gen = make_non_send_coroutine();
//~^ NOTE not `Send`
yield;
//~^ NOTE yield occurs here
//~| NOTE value is used across a yield
};
require_send(send_gen);
- //~^ ERROR generator cannot be sent between threads
+ //~^ ERROR coroutine cannot be sent between threads
//~| NOTE not `Send`
//~| NOTE use `std::sync::RwLock` instead
}
-pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
//~^ NOTE appears within the type
//~| NOTE expansion of desugaring
- || { //~ NOTE used within this generator
+ || { //~ NOTE used within this coroutine
yield;
t
}
}
-fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type
+fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type
//~^ NOTE expansion of desugaring
make_gen2(Arc::new(RefCell::new(0)))
}
fn test2() {
- let send_gen = || { //~ NOTE used within this generator
- let _non_send_gen = make_non_send_generator2();
+ let send_gen = || { //~ NOTE used within this coroutine
+ let _non_send_gen = make_non_send_coroutine2();
yield;
};
require_send(send_gen);
diff --git a/tests/ui/generator/issue-68112.stderr b/tests/ui/coroutine/issue-68112.stderr
index 808004822..5efa72ad5 100644
--- a/tests/ui/generator/issue-68112.stderr
+++ b/tests/ui/coroutine/issue-68112.stderr
@@ -1,16 +1,16 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/issue-68112.rs:40:5
|
LL | require_send(send_gen);
- | ^^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^^ coroutine 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
+note: coroutine is not `Send` as this value is used across a yield
--> $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`
+LL | let _non_send_gen = make_non_send_coroutine();
+ | ------------- has type `impl Coroutine<Return = Arc<RefCell<i32>>>` which is not `Send`
LL |
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
@@ -29,23 +29,23 @@ 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: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
+note: required because it's used within this coroutine
--> $DIR/issue-68112.rs:49:5
|
LL | || {
| ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
+note: required because it appears within the type `impl Coroutine<Return = Arc<RefCell<i32>>>`
--> $DIR/issue-68112.rs:46:30
|
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
+note: required because it appears within the type `impl Coroutine<Return = Arc<RefCell<i32>>>`
--> $DIR/issue-68112.rs:54:34
|
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+LL | fn make_non_send_coroutine2() -> impl Coroutine<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
+ = note: required because it captures the following types: `impl Coroutine<Return = Arc<RefCell<i32>>>`
+note: required because it's used within this coroutine
--> $DIR/issue-68112.rs:60:20
|
LL | let send_gen = || {
diff --git a/tests/ui/generator/issue-69017.rs b/tests/ui/coroutine/issue-69017.rs
index 511deb60e..7aaa1ee03 100644
--- a/tests/ui/generator/issue-69017.rs
+++ b/tests/ui/coroutine/issue-69017.rs
@@ -4,12 +4,12 @@
//
// check-pass
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn gen() -> impl Generator<usize> {
+fn gen() -> impl Coroutine<usize> {
|_: usize| {
println!("-> {}", yield);
}
diff --git a/tests/ui/generator/issue-69039.rs b/tests/ui/coroutine/issue-69039.rs
index ccc141860..041985e15 100644
--- a/tests/ui/generator/issue-69039.rs
+++ b/tests/ui/coroutine/issue-69039.rs
@@ -1,14 +1,14 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
fn mkstr(my_name: String, my_mood: String) -> String {
format!("{} is {}", my_name.trim(), my_mood.trim())
}
-fn my_scenario() -> impl Generator<String, Yield = &'static str, Return = String> {
+fn my_scenario() -> impl Coroutine<String, Yield = &'static str, Return = String> {
|_arg: String| {
let my_name = yield "What is your name?";
let my_mood = yield "How are you feeling?";
@@ -21,14 +21,14 @@ fn main() {
assert_eq!(
my_session.as_mut().resume("_arg".to_string()),
- GeneratorState::Yielded("What is your name?")
+ CoroutineState::Yielded("What is your name?")
);
assert_eq!(
my_session.as_mut().resume("Your Name".to_string()),
- GeneratorState::Yielded("How are you feeling?")
+ CoroutineState::Yielded("How are you feeling?")
);
assert_eq!(
my_session.as_mut().resume("Sensory Organs".to_string()),
- GeneratorState::Complete("Your Name is Sensory Organs".to_string())
+ CoroutineState::Complete("Your Name is Sensory Organs".to_string())
);
}
diff --git a/tests/ui/coroutine/issue-87142.rs b/tests/ui/coroutine/issue-87142.rs
new file mode 100644
index 000000000..b5708c4b3
--- /dev/null
+++ b/tests/ui/coroutine/issue-87142.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Cdebuginfo=2
+// build-pass
+
+// Regression test for #87142
+// This test needs the above flags and the "lib" crate type.
+
+#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)]
+#![crate_type = "lib"]
+
+use std::ops::Coroutine;
+
+pub trait CoroutineProviderAlt: Sized {
+ type Coro: Coroutine<(), Return = (), Yield = ()>;
+
+ fn start(ctx: Context<Self>) -> Self::Coro;
+}
+
+pub struct Context<G: 'static + CoroutineProviderAlt> {
+ pub link: Box<G::Coro>,
+}
+
+impl CoroutineProviderAlt for () {
+ type Coro = impl Coroutine<(), Return = (), Yield = ()>;
+ fn start(ctx: Context<Self>) -> Self::Coro {
+ move || {
+ match ctx {
+ _ => (),
+ }
+ yield ();
+ }
+ }
+}
diff --git a/tests/ui/generator/issue-88653.rs b/tests/ui/coroutine/issue-88653.rs
index 1d9377bce..ec4c20547 100644
--- a/tests/ui/generator/issue-88653.rs
+++ b/tests/ui/coroutine/issue-88653.rs
@@ -1,14 +1,14 @@
// Regression test for #88653, where a confusing warning about a
-// type mismatch in generator arguments was issued.
+// type mismatch in coroutine arguments was issued.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn foo(bar: bool) -> impl Generator<(bool,)> {
- //~^ ERROR: type mismatch in generator arguments [E0631]
+fn foo(bar: bool) -> impl Coroutine<(bool,)> {
+ //~^ ERROR: type mismatch in coroutine arguments [E0631]
//~| NOTE: expected due to this
- //~| NOTE: expected generator signature `fn((bool,)) -> _`
+ //~| NOTE: expected coroutine signature `fn((bool,)) -> _`
//~| NOTE: in this expansion of desugaring of `impl Trait`
//~| NOTE: in this expansion of desugaring of `impl Trait`
|bar| {
diff --git a/tests/ui/generator/issue-88653.stderr b/tests/ui/coroutine/issue-88653.stderr
index b742c6e2f..3ae50b5af 100644
--- a/tests/ui/generator/issue-88653.stderr
+++ b/tests/ui/coroutine/issue-88653.stderr
@@ -1,14 +1,14 @@
-error[E0631]: type mismatch in generator arguments
+error[E0631]: type mismatch in coroutine arguments
--> $DIR/issue-88653.rs:8:22
|
-LL | fn foo(bar: bool) -> impl Generator<(bool,)> {
+LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> {
| ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
...
LL | |bar| {
| ----- found signature defined here
|
- = note: expected generator signature `fn((bool,)) -> _`
- found generator signature `fn(bool) -> _`
+ = note: expected coroutine signature `fn((bool,)) -> _`
+ found coroutine signature `fn(bool) -> _`
error: aborting due to previous error
diff --git a/tests/ui/generator/issue-91477.rs b/tests/ui/coroutine/issue-91477.rs
index 6c027feb4..c98546f79 100644
--- a/tests/ui/generator/issue-91477.rs
+++ b/tests/ui/coroutine/issue-91477.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() -> impl Sized {
yield 1; //~ ERROR E0627
diff --git a/tests/ui/generator/issue-91477.stderr b/tests/ui/coroutine/issue-91477.stderr
index 4597dc1bc..0ab3c1fba 100644
--- a/tests/ui/generator/issue-91477.stderr
+++ b/tests/ui/coroutine/issue-91477.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/issue-91477.rs:4:5
|
LL | yield 1;
diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/coroutine/issue-93161.rs
index ae8603b7c..ae8603b7c 100644
--- a/tests/ui/generator/issue-93161.rs
+++ b/tests/ui/coroutine/issue-93161.rs
diff --git a/tests/ui/generator/iterator-count.rs b/tests/ui/coroutine/iterator-count.rs
index 90eefe02f..322e56f8a 100644
--- a/tests/ui/generator/iterator-count.rs
+++ b/tests/ui/coroutine/iterator-count.rs
@@ -1,27 +1,27 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
struct W<T>(T);
-// This impl isn't safe in general, but the generator used in this test is movable
+// This impl isn't safe in general, but the coroutine used in this test is movable
// so it won't cause problems.
-impl<T: Generator<(), Return = ()> + Unpin> Iterator for W<T> {
+impl<T: Coroutine<(), Return = ()> + Unpin> Iterator for W<T> {
type Item = T::Yield;
fn next(&mut self) -> Option<Self::Item> {
match Pin::new(&mut self.0).resume(()) {
- GeneratorState::Complete(..) => None,
- GeneratorState::Yielded(v) => Some(v),
+ CoroutineState::Complete(..) => None,
+ CoroutineState::Yielded(v) => Some(v),
}
}
}
-fn test() -> impl Generator<(), Return=(), Yield=u8> + Unpin {
+fn test() -> impl Coroutine<(), Return = (), Yield = u8> + Unpin {
|| {
for i in 1..6 {
yield i
diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/coroutine/layout-error.rs
index 7c3d18740..87da60700 100644
--- a/tests/ui/generator/layout-error.rs
+++ b/tests/ui/coroutine/layout-error.rs
@@ -1,4 +1,4 @@
-// Verifies that computing a layout of a generator tainted by type errors
+// Verifies that computing a layout of a coroutine tainted by type errors
// doesn't ICE. Regression test for #80998.
//
// edition:2018
diff --git a/tests/ui/generator/layout-error.stderr b/tests/ui/coroutine/layout-error.stderr
index b1a258f4f..b1a258f4f 100644
--- a/tests/ui/generator/layout-error.stderr
+++ b/tests/ui/coroutine/layout-error.stderr
diff --git a/tests/ui/generator/live-upvar-across-yield.rs b/tests/ui/coroutine/live-upvar-across-yield.rs
index 6a2e42a55..740a446e7 100644
--- a/tests/ui/generator/live-upvar-across-yield.rs
+++ b/tests/ui/coroutine/live-upvar-across-yield.rs
@@ -1,8 +1,8 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/match-bindings.rs b/tests/ui/coroutine/match-bindings.rs
index 865904a57..1a5b3cdb0 100644
--- a/tests/ui/generator/match-bindings.rs
+++ b/tests/ui/coroutine/match-bindings.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(dead_code)]
-#![feature(generators)]
+#![feature(coroutines)]
enum Enum {
A(String),
@@ -9,7 +9,7 @@ enum Enum {
}
fn main() {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
loop {
if let true = true {
match Enum::A(String::new()) {
diff --git a/tests/ui/generator/match-bindings.stderr b/tests/ui/coroutine/match-bindings.stderr
index 3dd2d5954..a7aa6eadb 100644
--- a/tests/ui/generator/match-bindings.stderr
+++ b/tests/ui/coroutine/match-bindings.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/match-bindings.rs:12:5
|
LL | / || {
@@ -10,7 +10,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/metadata-sufficient-for-layout.rs b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
index d0e648ee7..434a28015 100644
--- a/tests/ui/generator/metadata-sufficient-for-layout.rs
+++ b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
@@ -1,4 +1,4 @@
-// Check that the layout of a generator is available when auxiliary crate
+// Check that the layout of a coroutine is available when auxiliary crate
// is compiled with --emit metadata.
//
// Regression test for #80998.
@@ -6,15 +6,15 @@
// aux-build:metadata-sufficient-for-layout.rs
#![feature(type_alias_impl_trait, rustc_attrs)]
-#![feature(generator_trait)]
+#![feature(coroutine_trait)]
extern crate metadata_sufficient_for_layout;
-use std::ops::Generator;
+use std::ops::Coroutine;
-type F = impl Generator<(), Yield = (), Return = ()>;
+type F = impl Coroutine<(), Yield = (), Return = ()>;
-// Static queries the layout of the generator.
+// Static queries the layout of the coroutine.
static A: Option<F> = None;
fn f() -> F {
diff --git a/tests/ui/generator/metadata-sufficient-for-layout.stderr b/tests/ui/coroutine/metadata-sufficient-for-layout.stderr
index 3488b04f2..3488b04f2 100644
--- a/tests/ui/generator/metadata-sufficient-for-layout.stderr
+++ b/tests/ui/coroutine/metadata-sufficient-for-layout.stderr
diff --git a/tests/ui/coroutine/nested_coroutine.rs b/tests/ui/coroutine/nested_coroutine.rs
new file mode 100644
index 000000000..04f4aa771
--- /dev/null
+++ b/tests/ui/coroutine/nested_coroutine.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::Pin;
+
+fn main() {
+ let _coroutine = || {
+ let mut sub_coroutine = || {
+ yield 2;
+ };
+
+ match Pin::new(&mut sub_coroutine).resume(()) {
+ CoroutineState::Yielded(x) => {
+ yield x;
+ }
+ _ => panic!(),
+ };
+ };
+}
diff --git a/tests/ui/generator/niche-in-generator.rs b/tests/ui/coroutine/niche-in-coroutine.rs
index 42bee81f5..7ad4c6bc9 100644
--- a/tests/ui/generator/niche-in-generator.rs
+++ b/tests/ui/coroutine/niche-in-coroutine.rs
@@ -1,8 +1,8 @@
-// Test that niche finding works with captured generator upvars.
+// Test that niche finding works with captured coroutine upvars.
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
use std::mem::size_of_val;
diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/coroutine/non-static-is-unpin.rs
index a5dde3912..d6ded53ae 100644
--- a/tests/ui/generator/non-static-is-unpin.rs
+++ b/tests/ui/coroutine/non-static-is-unpin.rs
@@ -2,7 +2,7 @@
//[next] compile-flags: -Ztrait-solver=next
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![allow(dropping_copy_types)]
use std::marker::{PhantomPinned, Unpin};
@@ -11,7 +11,7 @@ fn assert_unpin<G: Unpin>(_: G) {
}
fn main() {
- // Even though this generator holds a `PhantomPinned` in its environment, it
+ // Even though this coroutine holds a `PhantomPinned` in its environment, it
// remains `Unpin`.
assert_unpin(|| {
let pinned = PhantomPinned;
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/coroutine/not-send-sync.rs
index 16c8cd476..dd6182c10 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/coroutine/not-send-sync.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![feature(negative_impls)]
struct NotSend;
@@ -12,14 +12,14 @@ fn main() {
fn assert_send<T: Send>(_: T) {}
assert_sync(|| {
- //~^ ERROR: generator cannot be shared between threads safely
+ //~^ ERROR: coroutine cannot be shared between threads safely
let a = NotSync;
yield;
drop(a);
});
assert_send(|| {
- //~^ ERROR: generator cannot be sent between threads safely
+ //~^ ERROR: coroutine cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
diff --git a/tests/ui/generator/not-send-sync.stderr b/tests/ui/coroutine/not-send-sync.stderr
index 13ce687e0..b33a1e63a 100644
--- a/tests/ui/generator/not-send-sync.stderr
+++ b/tests/ui/coroutine/not-send-sync.stderr
@@ -1,11 +1,11 @@
-error: generator cannot be shared between threads safely
+error: coroutine cannot be shared between threads safely
--> $DIR/not-send-sync.rs:14:5
|
LL | assert_sync(|| {
- | ^^^^^^^^^^^ generator is not `Sync`
+ | ^^^^^^^^^^^ coroutine is not `Sync`
|
- = 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
+ = help: within `{coroutine@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
+note: coroutine is not `Sync` as this value is used across a yield
--> $DIR/not-send-sync.rs:17:9
|
LL | let a = NotSync;
@@ -18,14 +18,14 @@ note: required by a bound in `assert_sync`
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/not-send-sync.rs:21:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
- = 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
+ = help: within `{coroutine@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/not-send-sync.rs:24:9
|
LL | let a = NotSend;
diff --git a/tests/ui/generator/overlap-locals.rs b/tests/ui/coroutine/overlap-locals.rs
index 101c8714f..7c151270b 100644
--- a/tests/ui/generator/overlap-locals.rs
+++ b/tests/ui/coroutine/overlap-locals.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let a = || {
diff --git a/tests/ui/generator/panic-drops-resume.rs b/tests/ui/coroutine/panic-drops-resume.rs
index 4c3caeb14..e866f216a 100644
--- a/tests/ui/generator/panic-drops-resume.rs
+++ b/tests/ui/coroutine/panic-drops-resume.rs
@@ -1,11 +1,11 @@
-//! Tests that panics inside a generator will correctly drop the initial resume argument.
+//! Tests that panics inside a coroutine will correctly drop the initial resume argument.
// run-pass
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic::{catch_unwind, AssertUnwindSafe};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/panic-drops.rs b/tests/ui/coroutine/panic-drops.rs
index 65001fd87..7e37279b9 100644
--- a/tests/ui/generator/panic-drops.rs
+++ b/tests/ui/coroutine/panic-drops.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/panic-safe.rs b/tests/ui/coroutine/panic-safe.rs
index 3db80bb58..9aa427565 100644
--- a/tests/ui/generator/panic-safe.rs
+++ b/tests/ui/coroutine/panic-safe.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::panic;
diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/coroutine/parent-expression.rs
index 198b14528..4d40192c0 100644
--- a/tests/ui/generator/parent-expression.rs
+++ b/tests/ui/coroutine/parent-expression.rs
@@ -1,4 +1,4 @@
-#![feature(generators, negative_impls, rustc_attrs)]
+#![feature(coroutines, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
(
diff --git a/tests/ui/generator/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr
index 25a3b051b..6b611bc3f 100644
--- a/tests/ui/generator/parent-expression.stderr
+++ b/tests/ui/coroutine/parent-expression.stderr
@@ -1,8 +1,8 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -13,8 +13,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -38,11 +38,11 @@ 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
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -53,8 +53,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -78,11 +78,11 @@ 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
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -93,8 +93,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = 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
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/coroutine/partial-drop.rs
index 868f36adc..a4347f52a 100644
--- a/tests/ui/generator/partial-drop.rs
+++ b/tests/ui/coroutine/partial-drop.rs
@@ -1,5 +1,5 @@
// check-pass
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo;
impl !Send for Foo {}
diff --git a/tests/ui/generator/partial-initialization-across-yield.rs b/tests/ui/coroutine/partial-initialization-across-yield.rs
index 65d9e6d39..75ad5a228 100644
--- a/tests/ui/generator/partial-initialization-across-yield.rs
+++ b/tests/ui/coroutine/partial-initialization-across-yield.rs
@@ -1,7 +1,7 @@
-// Test that we don't allow yielding from a generator while a local is partially
+// Test that we don't allow yielding from a coroutine while a local is partially
// initialized.
-#![feature(generators)]
+#![feature(coroutines)]
struct S { x: i32, y: i32 }
struct T(i32, i32);
diff --git a/tests/ui/generator/partial-initialization-across-yield.stderr b/tests/ui/coroutine/partial-initialization-across-yield.stderr
index 3f9f1c046..3f9f1c046 100644
--- a/tests/ui/generator/partial-initialization-across-yield.stderr
+++ b/tests/ui/coroutine/partial-initialization-across-yield.stderr
diff --git a/tests/ui/generator/pattern-borrow.rs b/tests/ui/coroutine/pattern-borrow.rs
index d19363708..76084433d 100644
--- a/tests/ui/generator/pattern-borrow.rs
+++ b/tests/ui/coroutine/pattern-borrow.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
enum Test { A(i32), B, }
@@ -6,7 +6,7 @@ fn main() { }
fn fun(test: Test) {
move || {
- if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields
+ if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when coroutine yields
yield ();
_a.use_ref();
}
diff --git a/tests/ui/generator/pattern-borrow.stderr b/tests/ui/coroutine/pattern-borrow.stderr
index d78da5104..ddb3bf662 100644
--- a/tests/ui/generator/pattern-borrow.stderr
+++ b/tests/ui/coroutine/pattern-borrow.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/pattern-borrow.rs:9:24
|
LL | if let Test::A(ref _a) = test {
diff --git a/tests/ui/coroutine/pin-box-coroutine.rs b/tests/ui/coroutine/pin-box-coroutine.rs
new file mode 100644
index 000000000..e348551a6
--- /dev/null
+++ b/tests/ui/coroutine/pin-box-coroutine.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+fn assert_coroutine<G: Coroutine>(_: G) {
+}
+
+fn main() {
+ assert_coroutine(static || yield);
+ assert_coroutine(Box::pin(static || yield));
+}
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs
index e52234c08..c47d7572c 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs
@@ -1,22 +1,22 @@
// compile-flags: -Zverbose
-// Same as: tests/ui/generator/issue-68112.stderr
+// Same as: tests/ui/coroutine/issue-68112.stderr
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
cell::RefCell,
sync::Arc,
pin::Pin,
- ops::{Generator, GeneratorState},
+ ops::{Coroutine, CoroutineState},
};
pub struct Ready<T>(Option<T>);
-impl<T: Unpin> Generator<()> for Ready<T> {
+impl<T: Unpin> Coroutine<()> for Ready<T> {
type Return = T;
type Yield = ();
- fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
- GeneratorState::Complete(self.0.take().unwrap())
+ fn resume(mut self: Pin<&mut Self>, _args: ()) -> CoroutineState<(), T> {
+ CoroutineState::Complete(self.0.take().unwrap())
}
}
pub fn make_gen1<T>(t: T) -> Ready<T> {
@@ -25,32 +25,32 @@ pub fn make_gen1<T>(t: T) -> Ready<T> {
fn require_send(_: impl Send) {}
-fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen1(Arc::new(RefCell::new(0)))
}
fn test1() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator();
+ let _non_send_gen = make_non_send_coroutine();
yield;
};
require_send(send_gen);
- //~^ ERROR generator cannot be sent between threads
+ //~^ ERROR coroutine cannot be sent between threads
}
-pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
|| {
yield;
t
}
}
-fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen2(Arc::new(RefCell::new(0)))
}
fn test2() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator2();
+ let _non_send_gen = make_non_send_coroutine2();
yield;
};
require_send(send_gen);
diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr
index d949543de..bcdcbc154 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr
@@ -1,26 +1,26 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:37:5
+error: coroutine cannot be sent between threads safely
+ --> $DIR/coroutine-print-verbose-1.rs:37:5
|
LL | require_send(send_gen);
- | ^^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^^ coroutine 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:35:9
+note: coroutine is not `Send` as this value is used across a yield
+ --> $DIR/coroutine-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 | let _non_send_gen = make_non_send_coroutine();
+ | ------------- has type `Opaque(DefId(0:34 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine::{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:26:25
+ --> $DIR/coroutine-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:56:5
+ --> $DIR/coroutine-print-verbose-1.rs:56:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -28,29 +28,29 @@ 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: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:42:5
+note: required because it's used within this coroutine
+ --> $DIR/coroutine-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:41:30
+note: required because it appears within the type `Opaque(DefId(0:35 ~ coroutine_print_verbose_1[75fb]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
+ --> $DIR/coroutine-print-verbose-1.rs:41:30
|
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<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:47:34
+note: required because it appears within the type `Opaque(DefId(0:36 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])`
+ --> $DIR/coroutine-print-verbose-1.rs:47:34
|
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+LL | fn make_non_send_coroutine2() -> impl Coroutine<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:52:20
+ = note: required because it captures the following types: `Opaque(DefId(0:36 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])`
+note: required because it's used within this coroutine
+ --> $DIR/coroutine-print-verbose-1.rs:52:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:26:25
+ --> $DIR/coroutine-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.rs b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs
index e53a7ef8c..c65c33cb4 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs
@@ -1,7 +1,7 @@
// compile-flags: -Zverbose
-// Same as test/ui/generator/not-send-sync.rs
-#![feature(generators)]
+// Same as test/ui/coroutine/not-send-sync.rs
+#![feature(coroutines)]
#![feature(negative_impls)]
struct NotSend;
@@ -15,14 +15,14 @@ fn main() {
fn assert_send<T: Send>(_: T) {}
assert_sync(|| {
- //~^ ERROR: generator cannot be shared between threads safely
+ //~^ ERROR: coroutine cannot be shared between threads safely
let a = NotSync;
yield;
drop(a);
});
assert_send(|| {
- //~^ ERROR: generator cannot be sent between threads safely
+ //~^ ERROR: coroutine cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
diff --git a/tests/ui/generator/print/generator-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr
index 8ff755761..e9c7a8ffc 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr
@@ -1,39 +1,39 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:17:5
+error: coroutine cannot be shared between threads safely
+ --> $DIR/coroutine-print-verbose-2.rs:17:5
|
LL | assert_sync(|| {
- | ^^^^^^^^^^^ generator is not `Sync`
+ | ^^^^^^^^^^^ coroutine is not `Sync`
|
= 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:20:9
+note: coroutine is not `Sync` as this value is used across a yield
+ --> $DIR/coroutine-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:14:23
+ --> $DIR/coroutine-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:24:5
+error: coroutine cannot be sent between threads safely
+ --> $DIR/coroutine-print-verbose-2.rs:24:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
= 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:27:9
+note: coroutine is not `Send` as this value is used across a yield
+ --> $DIR/coroutine-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:15:23
+ --> $DIR/coroutine-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.rs b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs
index 8689539ec..3e4bb6281 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs
@@ -1,10 +1,10 @@
// compile-flags: -Zverbose
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
fn main() {
let x = "Type mismatch test";
- let generator :() = || {
+ let coroutine :() = || {
//~^ ERROR mismatched types
yield 1i32;
return x
diff --git a/tests/ui/generator/print/generator-print-verbose-3.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr
index 69358ed0a..fb80f29d1 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr
@@ -1,7 +1,7 @@
error[E0308]: mismatched types
- --> $DIR/generator-print-verbose-3.rs:7:25
+ --> $DIR/coroutine-print-verbose-3.rs:7:25
|
-LL | let generator :() = || {
+LL | let coroutine :() = || {
| ____________________--___^
| | |
| | expected due to this
@@ -9,10 +9,10 @@ LL | |
LL | | yield 1i32;
LL | | return x
LL | | };
- | |_____^ expected `()`, found generator
+ | |_____^ expected `()`, found coroutine
|
= note: expected unit type `()`
- found generator `{main::{closure#0} upvar_tys=(unavailable)}`
+ found coroutine `{main::{closure#0} upvar_tys=(unavailable)}`
error: aborting due to previous error
diff --git a/tests/ui/generator/reborrow-mut-upvar.rs b/tests/ui/coroutine/reborrow-mut-upvar.rs
index dbd9e24e2..e4f717be8 100644
--- a/tests/ui/generator/reborrow-mut-upvar.rs
+++ b/tests/ui/coroutine/reborrow-mut-upvar.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn _run(bar: &mut i32) {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
{
let _baz = &*bar;
yield;
diff --git a/tests/ui/generator/reborrow-mut-upvar.stderr b/tests/ui/coroutine/reborrow-mut-upvar.stderr
index 2e1fec35e..5b614ac4b 100644
--- a/tests/ui/generator/reborrow-mut-upvar.stderr
+++ b/tests/ui/coroutine/reborrow-mut-upvar.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/reborrow-mut-upvar.rs:6:5
|
LL | / || {
@@ -10,7 +10,7 @@ LL | | *bar = 2;
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.rs b/tests/ui/coroutine/ref-escapes-but-not-over-yield.rs
index 3856d8233..a9c13188f 100644
--- a/tests/ui/generator/ref-escapes-but-not-over-yield.rs
+++ b/tests/ui/coroutine/ref-escapes-but-not-over-yield.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(x: &i32) {
- // In this case, a reference to `b` escapes the generator, but not
+ // In this case, a reference to `b` escapes the coroutine, but not
// because of a yield. We see that there is no yield in the scope of
// `b` and give the more generic error message.
let mut a = &3;
@@ -9,7 +9,7 @@ fn foo(x: &i32) {
yield();
let b = 5;
a = &b;
- //~^ ERROR borrowed data escapes outside of generator
+ //~^ ERROR borrowed data escapes outside of coroutine
};
}
diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr b/tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr
index 5fc810040..4c8694e67 100644
--- a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr
+++ b/tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr
@@ -1,14 +1,14 @@
-error[E0521]: borrowed data escapes outside of generator
+error[E0521]: borrowed data escapes outside of coroutine
--> $DIR/ref-escapes-but-not-over-yield.rs:11:9
|
LL | let mut a = &3;
- | ----- `a` declared here, outside of the generator body
+ | ----- `a` declared here, outside of the coroutine body
...
LL | a = &b;
| ^^^^--
| | |
- | | borrow is only valid in the generator body
- | reference to `b` escapes the generator body here
+ | | borrow is only valid in the coroutine body
+ | reference to `b` escapes the coroutine body here
error: aborting due to previous error
diff --git a/tests/ui/generator/ref-upvar-not-send.rs b/tests/ui/coroutine/ref-upvar-not-send.rs
index eb9ef63ec..487fdeea2 100644
--- a/tests/ui/generator/ref-upvar-not-send.rs
+++ b/tests/ui/coroutine/ref-upvar-not-send.rs
@@ -1,7 +1,7 @@
-// For `Send` generators, suggest a `T: Sync` requirement for `&T` upvars,
+// For `Send` coroutines, suggest a `T: Sync` requirement for `&T` upvars,
// and suggest a `T: Send` requirement for `&mut T` upvars.
-#![feature(generators)]
+#![feature(coroutines)]
fn assert_send<T: Send>(_: T) {}
//~^ NOTE required by a bound in `assert_send`
@@ -13,16 +13,16 @@ fn main() {
let x: &*mut () = &std::ptr::null_mut();
let y: &mut *mut () = &mut std::ptr::null_mut();
assert_send(move || {
- //~^ ERROR generator cannot be sent between threads safely
- //~| NOTE generator is not `Send`
+ //~^ ERROR coroutine cannot be sent between threads safely
+ //~| NOTE coroutine is not `Send`
yield;
let _x = x;
});
//~^^ NOTE captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
//~| NOTE has type `&*mut ()` which is not `Send`, because `*mut ()` is not `Sync`
assert_send(move || {
- //~^ ERROR generator cannot be sent between threads safely
- //~| NOTE generator is not `Send`
+ //~^ ERROR coroutine cannot be sent between threads safely
+ //~| NOTE coroutine is not `Send`
yield;
let _y = y;
});
diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/coroutine/ref-upvar-not-send.stderr
index d6a2be977..7f18c6fba 100644
--- a/tests/ui/generator/ref-upvar-not-send.stderr
+++ b/tests/ui/coroutine/ref-upvar-not-send.stderr
@@ -1,4 +1,4 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/ref-upvar-not-send.rs:15:17
|
LL | assert_send(move || {
@@ -8,7 +8,7 @@ LL | |
LL | | yield;
LL | | let _x = x;
LL | | });
- | |_____^ generator is not `Send`
+ | |_____^ coroutine is not `Send`
|
= help: the trait `Sync` is not implemented for `*mut ()`
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
@@ -22,7 +22,7 @@ note: required by a bound in `assert_send`
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/ref-upvar-not-send.rs:23:17
|
LL | assert_send(move || {
@@ -32,9 +32,9 @@ LL | |
LL | | yield;
LL | | let _y = y;
LL | | });
- | |_____^ generator is not `Send`
+ | |_____^ coroutine 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 `{coroutine@$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/reinit-in-match-guard.rs b/tests/ui/coroutine/reinit-in-match-guard.rs
index 260b341a5..1895de1f1 100644
--- a/tests/ui/generator/reinit-in-match-guard.rs
+++ b/tests/ui/coroutine/reinit-in-match-guard.rs
@@ -1,6 +1,6 @@
// build-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(unused_assignments, dead_code)]
diff --git a/tests/ui/generator/resume-after-return.rs b/tests/ui/coroutine/resume-after-return.rs
index 01a059a16..acbd8740a 100644
--- a/tests/ui/generator/resume-after-return.rs
+++ b/tests/ui/coroutine/resume-after-return.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
use std::panic;
@@ -17,12 +17,12 @@ fn main() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
match panic::catch_unwind(move || Pin::new(&mut foo).resume(())) {
- Ok(_) => panic!("generator successfully resumed"),
+ Ok(_) => panic!("coroutine successfully resumed"),
Err(_) => {}
}
}
diff --git a/tests/ui/generator/resume-arg-late-bound.rs b/tests/ui/coroutine/resume-arg-late-bound.rs
index 1c35ba80d..dd6d318af 100644
--- a/tests/ui/generator/resume-arg-late-bound.rs
+++ b/tests/ui/coroutine/resume-arg-late-bound.rs
@@ -1,11 +1,11 @@
-//! Tests that we cannot produce a generator that accepts a resume argument
+//! Tests that we cannot produce a coroutine that accepts a resume argument
//! with any lifetime and then stores it across a `yield`.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
fn main() {
let gen = |arg: &mut bool| {
diff --git a/tests/ui/generator/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr
index 34ee4036c..f1a8a8ed7 100644
--- a/tests/ui/generator/resume-arg-late-bound.stderr
+++ b/tests/ui/coroutine/resume-arg-late-bound.stderr
@@ -4,12 +4,12 @@ error[E0308]: mismatched types
LL | test(gen);
| ^^^^^^^^^ one type is more general than the other
|
- = note: expected trait `for<'a> Generator<&'a mut bool>`
- found trait `Generator<&mut bool>`
+ = note: expected trait `for<'a> Coroutine<&'a mut bool>`
+ found trait `Coroutine<&mut bool>`
note: the lifetime requirement is introduced here
--> $DIR/resume-arg-late-bound.rs:8:17
|
-LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/generator/resume-arg-size.rs b/tests/ui/coroutine/resume-arg-size.rs
index 195166f97..22bb469f9 100644
--- a/tests/ui/generator/resume-arg-size.rs
+++ b/tests/ui/coroutine/resume-arg-size.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(dropping_copy_types)]
// run-pass
@@ -6,7 +6,7 @@
use std::mem::size_of_val;
fn main() {
- // Generator taking a `Copy`able resume arg.
+ // Coroutine taking a `Copy`able resume arg.
let gen_copy = |mut x: usize| {
loop {
drop(x);
@@ -14,7 +14,7 @@ fn main() {
}
};
- // Generator taking a non-`Copy` resume arg.
+ // Coroutine taking a non-`Copy` resume arg.
let gen_move = |mut x: Box<usize>| {
loop {
drop(x);
@@ -22,7 +22,7 @@ fn main() {
}
};
- // Neither of these generators have the resume arg live across the `yield`, so they should be
+ // Neither of these coroutines have the resume arg live across the `yield`, so they should be
// 1 Byte in size (only storing the discriminant)
assert_eq!(size_of_val(&gen_copy), 1);
assert_eq!(size_of_val(&gen_move), 1);
diff --git a/tests/ui/generator/resume-live-across-yield.rs b/tests/ui/coroutine/resume-live-across-yield.rs
index 4c4cf117a..935e7d326 100644
--- a/tests/ui/generator/resume-live-across-yield.rs
+++ b/tests/ui/coroutine/resume-live-across-yield.rs
@@ -1,8 +1,8 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -27,11 +27,11 @@ fn main() {
assert_eq!(
g.as_mut().resume(Dropper(String::from("Hello world!"))),
- GeneratorState::Yielded(())
+ CoroutineState::Yielded(())
);
assert_eq!(DROP.load(Ordering::Acquire), 0);
match g.as_mut().resume(Dropper(String::from("Number Two"))) {
- GeneratorState::Complete(dropper) => {
+ CoroutineState::Complete(dropper) => {
assert_eq!(DROP.load(Ordering::Acquire), 1);
assert_eq!(dropper.0, "Number Two");
drop(dropper);
diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/coroutine/retain-resume-ref.rs
index 0606ea71c..c9f995ab0 100644
--- a/tests/ui/generator/retain-resume-ref.rs
+++ b/tests/ui/coroutine/retain-resume-ref.rs
@@ -1,11 +1,11 @@
//! This test ensures that a mutable reference cannot be passed as a resume argument twice.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
use std::ops::{
- Generator,
- GeneratorState::{self, *},
+ Coroutine,
+ CoroutineState::{self, *},
};
use std::pin::Pin;
diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/coroutine/retain-resume-ref.stderr
index e33310d12..e33310d12 100644
--- a/tests/ui/generator/retain-resume-ref.stderr
+++ b/tests/ui/coroutine/retain-resume-ref.stderr
diff --git a/tests/ui/coroutine/self_referential_gen_block.rs b/tests/ui/coroutine/self_referential_gen_block.rs
new file mode 100644
index 000000000..14daa2e9c
--- /dev/null
+++ b/tests/ui/coroutine/self_referential_gen_block.rs
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+#![feature(gen_blocks)]
+//! This test checks that we don't allow self-referential generators
+
+fn main() {
+ let mut x = {
+ let mut x = gen {
+ let y = 42;
+ let z = &y; //~ ERROR: borrow may still be in use when `gen` block yields
+ yield 43;
+ panic!("{z}");
+ };
+ x.next();
+ Box::new(x)
+ };
+ x.next();
+}
diff --git a/tests/ui/coroutine/self_referential_gen_block.stderr b/tests/ui/coroutine/self_referential_gen_block.stderr
new file mode 100644
index 000000000..586f53df8
--- /dev/null
+++ b/tests/ui/coroutine/self_referential_gen_block.stderr
@@ -0,0 +1,11 @@
+error[E0626]: borrow may still be in use when `gen` block yields
+ --> $DIR/self_referential_gen_block.rs:9:21
+ |
+LL | let z = &y;
+ | ^^
+LL | yield 43;
+ | -------- possible yield occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0626`.
diff --git a/tests/ui/generator/size-moved-locals.rs b/tests/ui/coroutine/size-moved-locals.rs
index 601a31418..cfbbb9c1b 100644
--- a/tests/ui/generator/size-moved-locals.rs
+++ b/tests/ui/coroutine/size-moved-locals.rs
@@ -4,7 +4,7 @@
// `complex` below.)
//
// The exact sizes here can change (we'd like to know when they do). What we
-// don't want to see is the `complex` generator size being upwards of 2048 bytes
+// don't want to see is the `complex` coroutine size being upwards of 2048 bytes
// (which would indicate it is reserving space for two copies of Foo.)
//
// See issue #59123 for a full explanation.
@@ -14,9 +14,9 @@
// ignore-asmjs issue #62807
// needs-unwind Size of Closures change on panic=abort
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
const FOO_SIZE: usize = 1024;
struct Foo(#[allow(unused_tuple_struct_fields)] [u8; FOO_SIZE]);
@@ -25,7 +25,7 @@ impl Drop for Foo {
fn drop(&mut self) {}
}
-fn move_before_yield() -> impl Generator<Yield = (), Return = ()> {
+fn move_before_yield() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
let _second = first;
@@ -36,7 +36,7 @@ fn move_before_yield() -> impl Generator<Yield = (), Return = ()> {
fn noop() {}
-fn move_before_yield_with_noop() -> impl Generator<Yield = (), Return = ()> {
+fn move_before_yield_with_noop() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
noop();
@@ -48,7 +48,7 @@ fn move_before_yield_with_noop() -> impl Generator<Yield = (), Return = ()> {
// Today we don't have NRVO (we allocate space for both `first` and `second`,)
// but we can overlap `first` with `_third`.
-fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
+fn overlap_move_points() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
yield;
@@ -59,7 +59,7 @@ fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
}
}
-fn overlap_x_and_y() -> impl Generator<Yield = (), Return = ()> {
+fn overlap_x_and_y() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let x = Foo([0; FOO_SIZE]);
yield;
diff --git a/tests/ui/coroutine/sized-yield.rs b/tests/ui/coroutine/sized-yield.rs
new file mode 100644
index 000000000..1368c88b5
--- /dev/null
+++ b/tests/ui/coroutine/sized-yield.rs
@@ -0,0 +1,14 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+use std::pin::Pin;
+
+fn main() {
+ let s = String::from("foo");
+ let mut gen = move || {
+ //~^ ERROR the size for values of type
+ yield s[..];
+ };
+ Pin::new(&mut gen).resume(());
+ //~^ ERROR the size for values of type
+}
diff --git a/tests/ui/coroutine/sized-yield.stderr b/tests/ui/coroutine/sized-yield.stderr
new file mode 100644
index 000000000..40663ac12
--- /dev/null
+++ b/tests/ui/coroutine/sized-yield.stderr
@@ -0,0 +1,26 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/sized-yield.rs:8:27
+ |
+LL | let mut gen = move || {
+ | ___________________________^
+LL | |
+LL | | yield s[..];
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: the yield type of a coroutine must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/sized-yield.rs:12:24
+ |
+LL | Pin::new(&mut gen).resume(());
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+note: required by a bound in `CoroutineState`
+ --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/smoke-resume-args.rs b/tests/ui/coroutine/smoke-resume-args.rs
index fa9271c53..a80198985 100644
--- a/tests/ui/generator/smoke-resume-args.rs
+++ b/tests/ui/coroutine/smoke-resume-args.rs
@@ -3,20 +3,20 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::fmt::Debug;
use std::marker::Unpin;
use std::ops::{
- Generator,
- GeneratorState::{self, *},
+ Coroutine,
+ CoroutineState::{self, *},
};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
-fn drain<G: Generator<R, Yield = Y> + Unpin, R, Y>(
+fn drain<G: Coroutine<R, Yield = Y> + Unpin, R, Y>(
gen: &mut G,
- inout: Vec<(R, GeneratorState<Y, G::Return>)>,
+ inout: Vec<(R, CoroutineState<Y, G::Return>)>,
) where
Y: Debug + PartialEq,
G::Return: Debug + PartialEq,
diff --git a/tests/ui/generator/smoke.rs b/tests/ui/coroutine/smoke.rs
index 7a917a05d..b74ed2686 100644
--- a/tests/ui/generator/smoke.rs
+++ b/tests/ui/coroutine/smoke.rs
@@ -6,9 +6,9 @@
// ignore-emscripten no threads support
// compile-flags: --test
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
use std::thread;
@@ -21,7 +21,7 @@ fn simple() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -37,7 +37,7 @@ fn return_capture() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -49,11 +49,11 @@ fn simple_yield() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -66,11 +66,11 @@ fn yield_capture() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "foo" => {}
+ CoroutineState::Yielded(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -83,11 +83,11 @@ fn simple_yield_value() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "bar" => {}
+ CoroutineState::Yielded(ref s) if *s == "bar" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -101,11 +101,11 @@ fn return_after_yield() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -153,11 +153,11 @@ fn send_over_threads() {
let mut foo = || { yield };
thread::spawn(move || {
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}).join().unwrap();
@@ -166,11 +166,11 @@ fn send_over_threads() {
let mut foo = || { yield a };
thread::spawn(move || {
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "a" => {}
+ CoroutineState::Yielded(ref s) if *s == "a" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}).join().unwrap();
diff --git a/tests/ui/coroutine/static-coroutine.rs b/tests/ui/coroutine/static-coroutine.rs
new file mode 100644
index 000000000..f9fd65b97
--- /dev/null
+++ b/tests/ui/coroutine/static-coroutine.rs
@@ -0,0 +1,20 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::pin::Pin;
+use std::ops::{Coroutine, CoroutineState};
+
+fn main() {
+ let mut coroutine = static || {
+ let a = true;
+ let b = &a;
+ yield;
+ assert_eq!(b as *const _, &a as *const _);
+ };
+ // SAFETY: We shadow the original coroutine variable so have no safe API to
+ // move it after this point.
+ let mut coroutine = unsafe { Pin::new_unchecked(&mut coroutine) };
+ assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Yielded(()));
+ assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Complete(()));
+}
diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/coroutine/static-mut-reference-across-yield.rs
index 0fa6d9cdc..07f810856 100644
--- a/tests/ui/generator/static-mut-reference-across-yield.rs
+++ b/tests/ui/coroutine/static-mut-reference-across-yield.rs
@@ -2,7 +2,7 @@
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
-#![feature(generators)]
+#![feature(coroutines)]
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/coroutine/static-not-unpin.current.stderr
index 242489841..cd607904f 100644
--- a/tests/ui/generator/static-not-unpin.current.stderr
+++ b/tests/ui/coroutine/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 coroutine@$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}`
+LL | assert_unpin(coroutine);
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$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/coroutine/static-not-unpin.next.stderr
index 242489841..cd607904f 100644
--- a/tests/ui/generator/static-not-unpin.next.stderr
+++ b/tests/ui/coroutine/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 coroutine@$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}`
+LL | assert_unpin(coroutine);
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$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.rs b/tests/ui/coroutine/static-not-unpin.rs
index 30d3f2918..6ce78046d 100644
--- a/tests/ui/generator/static-not-unpin.rs
+++ b/tests/ui/coroutine/static-not-unpin.rs
@@ -1,7 +1,7 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
-#![feature(generators)]
+#![feature(coroutines)]
// normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin"
@@ -11,8 +11,8 @@ fn assert_unpin<T: Unpin>(_: T) {
}
fn main() {
- let mut generator = static || {
+ let mut coroutine = static || {
yield;
};
- assert_unpin(generator); //~ ERROR E0277
+ assert_unpin(coroutine); //~ ERROR E0277
}
diff --git a/tests/ui/generator/static-reference-across-yield.rs b/tests/ui/coroutine/static-reference-across-yield.rs
index 23b11593b..6496d8b86 100644
--- a/tests/ui/generator/static-reference-across-yield.rs
+++ b/tests/ui/coroutine/static-reference-across-yield.rs
@@ -1,5 +1,5 @@
// build-pass
-#![feature(generators)]
+#![feature(coroutines)]
static A: [i32; 5] = [1, 2, 3, 4, 5];
diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.rs b/tests/ui/coroutine/too-live-local-in-immovable-gen.rs
index e0b856db7..7eaa15522 100644
--- a/tests/ui/generator/too-live-local-in-immovable-gen.rs
+++ b/tests/ui/coroutine/too-live-local-in-immovable-gen.rs
@@ -1,15 +1,15 @@
// run-pass
#![allow(unused_unsafe)]
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
unsafe {
- static move || { //~ WARN unused generator that must be used
- // Tests that the generator transformation finds out that `a` is not live
+ static move || { //~ WARN unused coroutine that must be used
+ // Tests that the coroutine transformation finds out that `a` is not live
// during the yield expression. Type checking will also compute liveness
// and it should also find out that `a` is not live.
- // The compiler will panic if the generator transformation finds that
+ // The compiler will panic if the coroutine transformation finds that
// `a` is live and type checking finds it dead.
let a = {
yield ();
diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.stderr b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr
index e262f213f..4a67dbe71 100644
--- a/tests/ui/generator/too-live-local-in-immovable-gen.stderr
+++ b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr
@@ -1,8 +1,8 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/too-live-local-in-immovable-gen.rs:8:9
|
LL | / static move || {
-LL | | // Tests that the generator transformation finds out that `a` is not live
+LL | | // Tests that the coroutine transformation finds out that `a` is not live
LL | | // during the yield expression. Type checking will also compute liveness
LL | | // and it should also find out that `a` is not live.
... |
@@ -10,7 +10,7 @@ LL | | let _ = &a;
LL | | };
| |_________^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/coroutine/too-many-parameters.rs b/tests/ui/coroutine/too-many-parameters.rs
new file mode 100644
index 000000000..377d80c7b
--- /dev/null
+++ b/tests/ui/coroutine/too-many-parameters.rs
@@ -0,0 +1,8 @@
+#![feature(coroutines)]
+
+fn main() {
+ |(), ()| {
+ //~^ error: too many parameters for a coroutine
+ yield;
+ };
+}
diff --git a/tests/ui/generator/too-many-parameters.stderr b/tests/ui/coroutine/too-many-parameters.stderr
index 22d40db3f..54cf42e78 100644
--- a/tests/ui/generator/too-many-parameters.stderr
+++ b/tests/ui/coroutine/too-many-parameters.stderr
@@ -1,4 +1,4 @@
-error[E0628]: too many parameters for a generator (expected 0 or 1 parameters)
+error[E0628]: too many parameters for a coroutine (expected 0 or 1 parameters)
--> $DIR/too-many-parameters.rs:4:5
|
LL | |(), ()| {
diff --git a/tests/ui/generator/type-mismatch-error.rs b/tests/ui/coroutine/type-mismatch-error.rs
index d39c788a8..0d04c2148 100644
--- a/tests/ui/generator/type-mismatch-error.rs
+++ b/tests/ui/coroutine/type-mismatch-error.rs
@@ -1,11 +1,11 @@
//! Test that we get the expected type mismatch error instead of "closure is expected to take 0
//! arguments" (which got introduced after implementing resume arguments).
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn f<G: Generator>(_: G, _: G::Return) {}
+fn f<G: Coroutine>(_: G, _: G::Return) {}
fn main() {
f(
diff --git a/tests/ui/generator/type-mismatch-error.stderr b/tests/ui/coroutine/type-mismatch-error.stderr
index 8f5949533..8f5949533 100644
--- a/tests/ui/generator/type-mismatch-error.stderr
+++ b/tests/ui/coroutine/type-mismatch-error.stderr
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.rs b/tests/ui/coroutine/type-mismatch-signature-deduction.rs
index 8d1ce6c7a..d4ca622e8 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.rs
+++ b/tests/ui/coroutine/type-mismatch-signature-deduction.rs
@@ -1,8 +1,8 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn foo() -> impl Generator<Return = i32> {
+fn foo() -> impl Coroutine<Return = i32> {
//~^ ERROR type mismatch
|| {
if false {
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/coroutine/type-mismatch-signature-deduction.stderr
index fe1bade55..f26e30a8e 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.stderr
+++ b/tests/ui/coroutine/type-mismatch-signature-deduction.stderr
@@ -18,10 +18,10 @@ 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 `<{coroutine@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Coroutine>::Return == i32`
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
-LL | fn foo() -> impl Generator<Return = i32> {
+LL | fn foo() -> impl Coroutine<Return = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<{integer}, _>`, found `i32`
|
= note: expected enum `Result<{integer}, _>`
diff --git a/tests/ui/generator/unresolved-ct-var.rs b/tests/ui/coroutine/unresolved-ct-var.rs
index 0316385fb..0316385fb 100644
--- a/tests/ui/generator/unresolved-ct-var.rs
+++ b/tests/ui/coroutine/unresolved-ct-var.rs
diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/coroutine/unresolved-ct-var.stderr
index 9badc1dc2..9badc1dc2 100644
--- a/tests/ui/generator/unresolved-ct-var.stderr
+++ b/tests/ui/coroutine/unresolved-ct-var.stderr
diff --git a/tests/ui/generator/unsized-capture-across-yield.rs b/tests/ui/coroutine/unsized-capture-across-yield.rs
index 7bcb0800c..ef9cbc1d6 100644
--- a/tests/ui/generator/unsized-capture-across-yield.rs
+++ b/tests/ui/coroutine/unsized-capture-across-yield.rs
@@ -1,11 +1,11 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![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;
+use std::ops::Coroutine;
-fn capture() -> impl Generator {
+fn capture() -> impl Coroutine {
let b: [u8] = *(Box::new([]) as Box<[u8]>);
move || {
println!("{:?}", &b);
diff --git a/tests/ui/generator/unsized-capture-across-yield.stderr b/tests/ui/coroutine/unsized-capture-across-yield.stderr
index 8a5b968a5..8a5b968a5 100644
--- a/tests/ui/generator/unsized-capture-across-yield.stderr
+++ b/tests/ui/coroutine/unsized-capture-across-yield.stderr
diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/coroutine/unsized-local-across-yield.rs
index f761f45c2..7a8ed60e4 100644
--- a/tests/ui/generator/unsized-local-across-yield.rs
+++ b/tests/ui/coroutine/unsized-local-across-yield.rs
@@ -1,11 +1,11 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![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;
+use std::ops::Coroutine;
-fn across() -> impl Generator {
+fn across() -> impl Coroutine {
move || {
let b: [u8] = *(Box::new([]) as Box<[u8]>);
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
diff --git a/tests/ui/generator/unsized-local-across-yield.stderr b/tests/ui/coroutine/unsized-local-across-yield.stderr
index 1942f266e..1942f266e 100644
--- a/tests/ui/generator/unsized-local-across-yield.stderr
+++ b/tests/ui/coroutine/unsized-local-across-yield.stderr
diff --git a/tests/ui/coroutine/unwind-abort-mix.rs b/tests/ui/coroutine/unwind-abort-mix.rs
new file mode 100644
index 000000000..869b3e4f4
--- /dev/null
+++ b/tests/ui/coroutine/unwind-abort-mix.rs
@@ -0,0 +1,13 @@
+// Ensure that coroutine drop glue is valid when mixing different panic
+// strategies. Regression test for #116953.
+//
+// no-prefer-dynamic
+// build-pass
+// aux-build:unwind-aux.rs
+// compile-flags: -Cpanic=abort
+// needs-unwind
+extern crate unwind_aux;
+
+pub fn main() {
+ unwind_aux::run(String::new());
+}
diff --git a/tests/ui/generator/witness-ignore-fake-reads.rs b/tests/ui/coroutine/witness-ignore-fake-reads.rs
index ccf9ce8b4..ccf9ce8b4 100644
--- a/tests/ui/generator/witness-ignore-fake-reads.rs
+++ b/tests/ui/coroutine/witness-ignore-fake-reads.rs
diff --git a/tests/ui/generator/xcrate-reachable.rs b/tests/ui/coroutine/xcrate-reachable.rs
index 1b1cff338..c63284488 100644
--- a/tests/ui/generator/xcrate-reachable.rs
+++ b/tests/ui/coroutine/xcrate-reachable.rs
@@ -2,11 +2,11 @@
// aux-build:xcrate-reachable.rs
-#![feature(generator_trait)]
+#![feature(coroutine_trait)]
extern crate xcrate_reachable as foo;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/xcrate.rs b/tests/ui/coroutine/xcrate.rs
index 40986bbeb..4572d1cfd 100644
--- a/tests/ui/generator/xcrate.rs
+++ b/tests/ui/coroutine/xcrate.rs
@@ -2,29 +2,29 @@
// aux-build:xcrate.rs
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
extern crate xcrate;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn main() {
let mut foo = xcrate::foo();
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
let mut foo = xcrate::bar(3);
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(3) => {}
+ CoroutineState::Yielded(3) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
diff --git a/tests/ui/generator/yield-in-args-rev.rs b/tests/ui/coroutine/yield-in-args-rev.rs
index 4c99bb3ef..b22c32ccd 100644
--- a/tests/ui/generator/yield-in-args-rev.rs
+++ b/tests/ui/coroutine/yield-in-args-rev.rs
@@ -5,12 +5,12 @@
// argument list is not treated as live across the yield by
// type-checking.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(_a: (), _b: &bool) {}
fn bar() {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
let b = true;
foo(yield, &b);
};
diff --git a/tests/ui/generator/yield-in-args-rev.stderr b/tests/ui/coroutine/yield-in-args-rev.stderr
index a87248f66..dbf46739e 100644
--- a/tests/ui/generator/yield-in-args-rev.stderr
+++ b/tests/ui/coroutine/yield-in-args-rev.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-in-args-rev.rs:13:5
|
LL | / || {
@@ -7,7 +7,7 @@ LL | | foo(yield, &b);
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-in-args.rs b/tests/ui/coroutine/yield-in-args.rs
index 80110af55..b2827148d 100644
--- a/tests/ui/generator/yield-in-args.rs
+++ b/tests/ui/coroutine/yield-in-args.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(_b: &bool, _a: ()) {}
diff --git a/tests/ui/generator/yield-in-args.stderr b/tests/ui/coroutine/yield-in-args.stderr
index ee6d22c27..4ff97281d 100644
--- a/tests/ui/generator/yield-in-args.stderr
+++ b/tests/ui/coroutine/yield-in-args.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-in-args.rs:8:13
|
LL | foo(&b, yield);
diff --git a/tests/ui/generator/yield-in-const.rs b/tests/ui/coroutine/yield-in-const.rs
index fe5ca822c..22651f32c 100644
--- a/tests/ui/generator/yield-in-const.rs
+++ b/tests/ui/coroutine/yield-in-const.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
const A: u8 = { yield 3u8; 3u8};
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-const.stderr b/tests/ui/coroutine/yield-in-const.stderr
index dcf4fe63e..7afcd8340 100644
--- a/tests/ui/generator/yield-in-const.stderr
+++ b/tests/ui/coroutine/yield-in-const.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-const.rs:3:17
|
LL | const A: u8 = { yield 3u8; 3u8};
diff --git a/tests/ui/generator/yield-in-function.rs b/tests/ui/coroutine/yield-in-function.rs
index 29b811621..a99312043 100644
--- a/tests/ui/generator/yield-in-function.rs
+++ b/tests/ui/coroutine/yield-in-function.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() { yield; }
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-function.stderr b/tests/ui/coroutine/yield-in-function.stderr
index 51cce198c..b2f839a65 100644
--- a/tests/ui/generator/yield-in-function.stderr
+++ b/tests/ui/coroutine/yield-in-function.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-function.rs:3:13
|
LL | fn main() { yield; }
diff --git a/tests/ui/generator/yield-in-initializer.rs b/tests/ui/coroutine/yield-in-initializer.rs
index 0cab36e5f..5a7b3a4fe 100644
--- a/tests/ui/generator/yield-in-initializer.rs
+++ b/tests/ui/coroutine/yield-in-initializer.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
- static || { //~ WARN unused generator that must be used
+ static || { //~ WARN unused coroutine that must be used
loop {
// Test that `opt` is not live across the yield, even when borrowed in a loop
// See https://github.com/rust-lang/rust/issues/52792
diff --git a/tests/ui/generator/yield-in-initializer.stderr b/tests/ui/coroutine/yield-in-initializer.stderr
index ed14a2e32..614df43f2 100644
--- a/tests/ui/generator/yield-in-initializer.stderr
+++ b/tests/ui/coroutine/yield-in-initializer.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-in-initializer.rs:6:5
|
LL | / static || {
@@ -10,7 +10,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-in-static.rs b/tests/ui/coroutine/yield-in-static.rs
index d27fbb33b..45e0380d4 100644
--- a/tests/ui/generator/yield-in-static.rs
+++ b/tests/ui/coroutine/yield-in-static.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
static B: u8 = { yield 3u8; 3u8};
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-static.stderr b/tests/ui/coroutine/yield-in-static.stderr
index d867f3ad3..17d58325e 100644
--- a/tests/ui/generator/yield-in-static.stderr
+++ b/tests/ui/coroutine/yield-in-static.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-static.rs:3:18
|
LL | static B: u8 = { yield 3u8; 3u8};
diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.rs b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs
index 4e8050c81..31025c33b 100644
--- a/tests/ui/generator/yield-outside-generator-issue-78653.rs
+++ b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
yield || for i in 0 { }
- //~^ ERROR yield expression outside of generator literal
+ //~^ ERROR yield expression outside of coroutine literal
//~| ERROR `{integer}` is not an iterator
}
diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.stderr b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr
index dcfb21174..f28f89135 100644
--- a/tests/ui/generator/yield-outside-generator-issue-78653.stderr
+++ b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr
@@ -1,11 +1,11 @@
-error[E0627]: yield expression outside of generator literal
- --> $DIR/yield-outside-generator-issue-78653.rs:4:5
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/yield-outside-coroutine-issue-78653.rs:4:5
|
LL | yield || for i in 0 { }
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `{integer}` is not an iterator
- --> $DIR/yield-outside-generator-issue-78653.rs:4:23
+ --> $DIR/yield-outside-coroutine-issue-78653.rs:4:23
|
LL | yield || for i in 0 { }
| ^ `{integer}` is not an iterator
diff --git a/tests/ui/generator/yield-subtype.rs b/tests/ui/coroutine/yield-subtype.rs
index cb3fc9091..3595d4498 100644
--- a/tests/ui/generator/yield-subtype.rs
+++ b/tests/ui/coroutine/yield-subtype.rs
@@ -2,13 +2,13 @@
#![allow(dead_code)]
#![allow(dead_code)]
-#![feature(generators)]
+#![feature(coroutines)]
fn bar<'a>() {
let a: &'static str = "hi";
let b: &'a str = a;
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
yield a;
yield b;
};
diff --git a/tests/ui/generator/yield-subtype.stderr b/tests/ui/coroutine/yield-subtype.stderr
index 97862e91c..5e7ae9f58 100644
--- a/tests/ui/generator/yield-subtype.stderr
+++ b/tests/ui/coroutine/yield-subtype.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-subtype.rs:11:5
|
LL | / || {
@@ -7,7 +7,7 @@ LL | | yield b;
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-while-iterating.rs b/tests/ui/coroutine/yield-while-iterating.rs
index 985e5d8bd..66ac6d392 100644
--- a/tests/ui/generator/yield-while-iterating.rs
+++ b/tests/ui/coroutine/yield-while-iterating.rs
@@ -1,11 +1,11 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::cell::Cell;
use std::pin::Pin;
fn yield_during_iter_owned_data(x: Vec<i32>) {
- // The generator owns `x`, so we error out when yielding with a
+ // The coroutine owns `x`, so we error out when yielding with a
// reference to it. This winds up becoming a rather confusing
// regionck error -- in particular, we would freeze with the
// reference in scope, and it doesn't live long enough.
diff --git a/tests/ui/generator/yield-while-iterating.stderr b/tests/ui/coroutine/yield-while-iterating.stderr
index b65634752..5330121f3 100644
--- a/tests/ui/generator/yield-while-iterating.stderr
+++ b/tests/ui/coroutine/yield-while-iterating.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-iterating.rs:13:18
|
LL | for p in &x {
@@ -12,7 +12,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
LL | let mut b = || {
| -- mutable borrow occurs here
LL | for p in &mut x {
- | - first borrow occurs due to use of `x` in generator
+ | - first borrow occurs due to use of `x` in coroutine
...
LL | println!("{}", x[0]);
| ^ immutable borrow occurs here
diff --git a/tests/ui/generator/yield-while-local-borrowed.rs b/tests/ui/coroutine/yield-while-local-borrowed.rs
index 061a64dbc..7f8d1d454 100644
--- a/tests/ui/generator/yield-while-local-borrowed.rs
+++ b/tests/ui/coroutine/yield-while-local-borrowed.rs
@@ -1,7 +1,7 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
use std::cell::Cell;
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn borrow_local_inline() {
@@ -11,8 +11,8 @@ fn borrow_local_inline() {
// `b` and gets extended by region inference.)
let mut b = move || {
let a = &mut 3;
- //~^ ERROR borrow may still be in use when generator yields
- yield();
+ //~^ ERROR borrow may still be in use when coroutine yields
+ yield ();
println!("{}", a);
};
Pin::new(&mut b).resume(());
@@ -24,7 +24,7 @@ fn borrow_local_inline_done() {
{
let a = &mut 3;
}
- yield();
+ yield ();
};
Pin::new(&mut b).resume(());
}
@@ -38,12 +38,12 @@ fn borrow_local() {
let a = 3;
{
let b = &a;
- //~^ ERROR borrow may still be in use when generator yields
- yield();
+ //~^ ERROR borrow may still be in use when coroutine yields
+ yield ();
println!("{}", b);
}
};
Pin::new(&mut b).resume(());
}
-fn main() { }
+fn main() {}
diff --git a/tests/ui/generator/yield-while-local-borrowed.stderr b/tests/ui/coroutine/yield-while-local-borrowed.stderr
index c1513ef9b..8fe981de9 100644
--- a/tests/ui/generator/yield-while-local-borrowed.stderr
+++ b/tests/ui/coroutine/yield-while-local-borrowed.stderr
@@ -1,20 +1,20 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-local-borrowed.rs:13:17
|
LL | let a = &mut 3;
| ^^^^^^
LL |
-LL | yield();
- | ------- possible yield occurs here
+LL | yield ();
+ | -------- possible yield occurs here
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-local-borrowed.rs:40:21
|
LL | let b = &a;
| ^^
LL |
-LL | yield();
- | ------- possible yield occurs here
+LL | yield ();
+ | -------- possible yield occurs here
error: aborting due to 2 previous errors
diff --git a/tests/ui/generator/yield-while-ref-reborrowed.rs b/tests/ui/coroutine/yield-while-ref-reborrowed.rs
index a03ef945d..07c591758 100644
--- a/tests/ui/generator/yield-while-ref-reborrowed.rs
+++ b/tests/ui/coroutine/yield-while-ref-reborrowed.rs
@@ -1,12 +1,12 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::cell::Cell;
use std::pin::Pin;
fn reborrow_shared_ref(x: &i32) {
// This is OK -- we have a borrow live over the yield, but it's of
- // data that outlives the generator.
+ // data that outlives the coroutine.
let mut b = move || {
let a = &*x;
yield();
@@ -17,7 +17,7 @@ fn reborrow_shared_ref(x: &i32) {
fn reborrow_mutable_ref(x: &mut i32) {
// This is OK -- we have a borrow live over the yield, but it's of
- // data that outlives the generator.
+ // data that outlives the coroutine.
let mut b = move || {
let a = &mut *x;
yield();
diff --git a/tests/ui/generator/yield-while-ref-reborrowed.stderr b/tests/ui/coroutine/yield-while-ref-reborrowed.stderr
index 47147f9c0..e60a95316 100644
--- a/tests/ui/generator/yield-while-ref-reborrowed.stderr
+++ b/tests/ui/coroutine/yield-while-ref-reborrowed.stderr
@@ -2,9 +2,9 @@ error[E0501]: cannot borrow `x` as immutable because previous closure requires u
--> $DIR/yield-while-ref-reborrowed.rs:36:20
|
LL | let mut b = || {
- | -- generator construction occurs here
+ | -- coroutine construction occurs here
LL | let a = &mut *x;
- | -- first borrow occurs due to use of `x` in generator
+ | -- first borrow occurs due to use of `x` in coroutine
...
LL | println!("{}", x);
| ^ second borrow occurs here
diff --git a/tests/ui/generator/yielding-in-match-guards.rs b/tests/ui/coroutine/yielding-in-match-guards.rs
index 4e89fc975..a9575a9e7 100644
--- a/tests/ui/generator/yielding-in-match-guards.rs
+++ b/tests/ui/coroutine/yielding-in-match-guards.rs
@@ -8,7 +8,7 @@
// indeed a temporary borrow `y` from `x` is live
// while `f().await` is being evaluated.
// Thus, `&'_ u8` should be included in type signature
-// of the underlying generator.
+// of the underlying coroutine.
#![feature(if_let_guard)]
diff --git a/tests/ui/crate-loading/invalid-rlib.rs b/tests/ui/crate-loading/invalid-rlib.rs
index aea861e32..0997bee19 100644
--- a/tests/ui/crate-loading/invalid-rlib.rs
+++ b/tests/ui/crate-loading/invalid-rlib.rs
@@ -8,3 +8,4 @@ use ::foo; //~ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file
//~^^ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file
+//~| NOTE duplicate diagnostic
diff --git a/tests/ui/crate-loading/invalid-rlib.stderr b/tests/ui/crate-loading/invalid-rlib.stderr
index 3c0d23bf7..63bb1b95c 100644
--- a/tests/ui/crate-loading/invalid-rlib.stderr
+++ b/tests/ui/crate-loading/invalid-rlib.stderr
@@ -13,6 +13,7 @@ LL | use ::foo;
| ^^^
|
= note: failed to mmap file 'auxiliary/libfoo.rlib'
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/debuginfo/sroa-fragment-debuginfo.rs b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
index 9c3c359e3..fc3bbb88e 100644
--- a/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
+++ b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
@@ -1,4 +1,4 @@
-// Verify that we do not trigger a LLVM assertion by creating zero-sized DWARF fragments.
+// Verify that we do not trigger an LLVM assertion by creating zero-sized DWARF fragments.
//
// build-pass
// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
diff --git a/tests/ui/deduplicate-diagnostics.duplicate.stderr b/tests/ui/deduplicate-diagnostics.duplicate.stderr
index cd4700c7a..0544b9932 100644
--- a/tests/ui/deduplicate-diagnostics.duplicate.stderr
+++ b/tests/ui/deduplicate-diagnostics.duplicate.stderr
@@ -15,12 +15,16 @@ error: cannot find derive macro `Unresolved` in this scope
|
LL | #[derive(Unresolved)]
| ^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/deduplicate-diagnostics.rs:8:8
|
LL | #[deny("literal")]
| ^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr
index 8b2b480d1..383212ad9 100644
--- a/tests/ui/deprecation/deprecation-sanity.stderr
+++ b/tests/ui/deprecation/deprecation-sanity.stderr
@@ -16,25 +16,25 @@ error[E0541]: unknown meta item 'reason'
LL | #[deprecated(since = "a", note = "a", reason)]
| ^^^^^^ expected one of `since`, `note`
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:7:31
|
LL | #[deprecated(since = "a", note)]
| ^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:10:18
|
LL | #[deprecated(since, note = "a")]
| ^^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:13:31
|
LL | #[deprecated(since = "a", note(b))]
| ^^^^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:16:18
|
LL | #[deprecated(since(b), note = "a")]
@@ -70,5 +70,5 @@ LL | #[deprecated = "hello"]
error: aborting due to 10 previous errors
-Some errors have detailed explanations: E0538, E0541, E0551, E0565.
+Some errors have detailed explanations: E0538, E0539, E0541, E0565.
For more information about an error, try `rustc --explain E0538`.
diff --git a/tests/ui/deprecation/staged-deprecation-in-future.rs b/tests/ui/deprecation/staged-deprecation-in-future.rs
index 87b15ec30..49ee60b9b 100644
--- a/tests/ui/deprecation/staged-deprecation-in-future.rs
+++ b/tests/ui/deprecation/staged-deprecation-in-future.rs
@@ -2,14 +2,14 @@
#![feature(staged_api)]
-#![stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#![stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
#[deprecated(since = "99.99.99", note = "effectively never")]
-#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#[stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
pub struct S1;
#[deprecated(since = "TBD", note = "literally never")]
-#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#[stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
pub struct S2;
fn main() {
diff --git a/tests/ui/derives/deriving-bounds.stderr b/tests/ui/derives/deriving-bounds.stderr
index 74ca37287..4461652eb 100644
--- a/tests/ui/derives/deriving-bounds.stderr
+++ b/tests/ui/derives/deriving-bounds.stderr
@@ -21,6 +21,7 @@ note: unsafe traits like `Sync` should be implemented explicitly
|
LL | #[derive(Sync)]
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Send` in this scope
--> $DIR/deriving-bounds.rs:1:10
@@ -45,6 +46,7 @@ note: unsafe traits like `Send` should be implemented explicitly
|
LL | #[derive(Send)]
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr
index 053d34f68..28753b8f9 100644
--- a/tests/ui/derives/deriving-meta-unknown-trait.stderr
+++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr
@@ -15,6 +15,8 @@ LL | #[derive(Eqr)]
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
= note: similarly named derive macro `Eq` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/derives/deriving-primitive.stderr b/tests/ui/derives/deriving-primitive.stderr
index ca64c9ee7..b39637825 100644
--- a/tests/ui/derives/deriving-primitive.stderr
+++ b/tests/ui/derives/deriving-primitive.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `FromPrimitive` in this scope
|
LL | #[derive(FromPrimitive)]
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.rs b/tests/ui/derives/deriving-with-repr-packed-move-errors.rs
new file mode 100644
index 000000000..ffeb02d78
--- /dev/null
+++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.rs
@@ -0,0 +1,96 @@
+// Check that deriving builtin traits for a packed struct with
+// non-Copy fields emits move errors along with an additional
+// diagnostic note explaining the reason
+// See issue #117406
+
+use std::fmt::{Debug, Formatter, Result};
+use std::cmp::Ordering;
+
+// Packed + derives: additional diagnostic should be emitted
+// for each of Debug, PartialEq and PartialOrd
+#[repr(packed)]
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+struct StructA(String);
+//~^ ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+
+
+// Unrelated impl: additinal diagnostic should NOT be emitted
+impl StructA {
+ fn fmt(&self) -> String {
+ self.0 //~ ERROR: cannot move out of `self` which is behind a shared reference
+ }
+}
+
+// Packed + manual impls: additional diagnostic should NOT be emitted
+#[repr(packed)]
+struct StructB(String);
+
+impl Debug for StructB {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ let x = &{ self.0 }; //~ ERROR: cannot move out of `self` which is behind a shared reference
+ write!(f, "{}", x)
+ }
+}
+
+impl PartialEq for StructB {
+ fn eq(&self, other: &StructB) -> bool {
+ ({ self.0 }) == ({ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+impl PartialOrd for StructB {
+ fn partial_cmp(&self, other: &StructB) -> Option<Ordering> {
+ PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+// NOT packed + derives: additinal diagnostic should NOT be emitted
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+struct StructC(String);
+
+// NOT packed + manual impls: additinal dignostic should NOT be emitted
+struct StructD(String);
+
+impl Debug for StructD {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ let x = &{ self.0 }; //~ ERROR: cannot move out of `self` which is behind a shared reference
+ write!(f, "{}", x)
+ }
+}
+
+impl PartialEq for StructD {
+ fn eq(&self, other: &StructD) -> bool {
+ ({ self.0 }) == ({ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+impl PartialOrd for StructD {
+ fn partial_cmp(&self, other: &StructD) -> Option<Ordering> {
+ PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+// Packed + derives but the move is outside of a derive
+// expansion: additinal diagnostic should NOT be emitted
+fn func(arg: &StructA) -> String {
+ arg.0 //~ ERROR: cannot move out of `arg` which is behind a shared reference
+}
+
+fn main(){
+}
diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
new file mode 100644
index 000000000..c538061b3
--- /dev/null
+++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
@@ -0,0 +1,174 @@
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ----- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Hash)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ----- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Clone)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:28:9
+ |
+LL | self.0
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:38:20
+ |
+LL | let x = &{ self.0 };
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:45:12
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:45:28
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:53:36
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:53:49
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:68:20
+ |
+LL | let x = &{ self.0 };
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:75:12
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:75:28
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:83:36
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:83:49
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `arg` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:92:5
+ |
+LL | arg.0
+ | ^^^^^ move occurs because `arg.0` has type `String`, which does not implement the `Copy` trait
+
+error: aborting due to 21 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/derives/deriving-with-repr-packed.stderr b/tests/ui/derives/deriving-with-repr-packed.stderr
index 0cfe03869..bb1fab343 100644
--- a/tests/ui/derives/deriving-with-repr-packed.stderr
+++ b/tests/ui/derives/deriving-with-repr-packed.stderr
@@ -36,6 +36,7 @@ LL | #[repr(packed)]
LL | struct X(Y);
| ^ move occurs because `self.0` has type `Y`, which does not implement the `Copy` trait
|
+ = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error; 2 warnings emitted
diff --git a/tests/ui/derives/issue-36617.stderr b/tests/ui/derives/issue-36617.stderr
index 9cc0a29b0..98be7963e 100644
--- a/tests/ui/derives/issue-36617.stderr
+++ b/tests/ui/derives/issue-36617.stderr
@@ -43,55 +43,75 @@ error: `derive` attribute cannot be used at crate level
|
LL | #![derive(Copy)]
| ^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[derive(Copy)]
- | ~~~~~~~~~~~~~~~
+LL - #![derive(Copy)]
+LL + #[derive(Copy)]
+ |
error: `test` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:4:1
|
LL | #![test]
| ^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test]
- | ~~~~~~~
+LL - #![test]
+LL + #[test]
+ |
error: `test_case` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:7:1
|
LL | #![test_case]
| ^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test_case]
- | ~~~~~~~~~~~~
+LL - #![test_case]
+LL + #[test_case]
+ |
error: `bench` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:10:1
|
LL | #![bench]
| ^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[bench]
- | ~~~~~~~~
+LL - #![bench]
+LL + #[bench]
+ |
error: `global_allocator` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:13:1
|
LL | #![global_allocator]
| ^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[global_allocator]
- | ~~~~~~~~~~~~~~~~~~~
+LL - #![global_allocator]
+LL + #[global_allocator]
+ |
error: aborting due to 10 previous errors
diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout
index 3d9f8129d..42154c3c3 100644
--- a/tests/ui/deriving/deriving-all-codegen.stdout
+++ b/tests/ui/deriving/deriving-all-codegen.stdout
@@ -33,6 +33,7 @@ impl ::core::clone::Clone for Empty {
impl ::core::marker::Copy for Empty { }
#[automatically_derived]
impl ::core::fmt::Debug for Empty {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "Empty")
}
@@ -97,6 +98,7 @@ impl ::core::clone::Clone for Point {
impl ::core::marker::Copy for Point { }
#[automatically_derived]
impl ::core::fmt::Debug for Point {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Point", "x",
&self.x, "y", &&self.y)
@@ -183,6 +185,7 @@ impl ::core::clone::Clone for PackedPoint {
impl ::core::marker::Copy for PackedPoint { }
#[automatically_derived]
impl ::core::fmt::Debug for PackedPoint {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "PackedPoint",
"x", &{ self.x }, "y", &&{ self.y })
@@ -276,6 +279,7 @@ impl ::core::clone::Clone for Big {
impl ::core::marker::Copy for Big { }
#[automatically_derived]
impl ::core::fmt::Debug for Big {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"];
@@ -475,6 +479,7 @@ impl Copy for PackedManualCopy {}
struct Unsized([u32]);
#[automatically_derived]
impl ::core::fmt::Debug for Unsized {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Unsized",
&&self.0)
@@ -527,6 +532,7 @@ impl ::core::cmp::Ord for Unsized {
struct PackedUnsizedU8([u8]);
#[automatically_derived]
impl ::core::fmt::Debug for PackedUnsizedU8 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PackedUnsizedU8", &&self.0)
@@ -569,6 +575,7 @@ impl<T: ::core::marker::Copy + Trait, U: ::core::marker::Copy>
#[automatically_derived]
impl<T: ::core::fmt::Debug + Trait, U: ::core::fmt::Debug> ::core::fmt::Debug
for Generic<T, U> where T::A: ::core::fmt::Debug {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Generic", "t",
&self.t, "ta", &self.ta, "u", &&self.u)
@@ -687,6 +694,7 @@ impl<T: ::core::fmt::Debug + ::core::marker::Copy + Trait,
U: ::core::fmt::Debug + ::core::marker::Copy> ::core::fmt::Debug for
PackedGeneric<T, U> where T::A: ::core::fmt::Debug + ::core::marker::Copy
{
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field3_finish(f, "PackedGeneric",
&{ self.0 }, &{ self.1 }, &&{ self.2 })
@@ -797,6 +805,7 @@ impl ::core::clone::Clone for Enum0 {
impl ::core::marker::Copy for Enum0 { }
#[automatically_derived]
impl ::core::fmt::Debug for Enum0 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match *self {}
}
@@ -856,6 +865,7 @@ impl ::core::clone::Clone for Enum1 {
}
#[automatically_derived]
impl ::core::fmt::Debug for Enum1 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Enum1::Single { x: __self_0 } =>
@@ -932,6 +942,7 @@ impl ::core::clone::Clone for Fieldless1 {
}
#[automatically_derived]
impl ::core::fmt::Debug for Fieldless1 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "A")
}
@@ -995,6 +1006,7 @@ impl ::core::clone::Clone for Fieldless {
impl ::core::marker::Copy for Fieldless { }
#[automatically_derived]
impl ::core::fmt::Debug for Fieldless {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
@@ -1083,6 +1095,7 @@ impl ::core::clone::Clone for Mixed {
impl ::core::marker::Copy for Mixed { }
#[automatically_derived]
impl ::core::fmt::Debug for Mixed {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
@@ -1217,6 +1230,7 @@ impl ::core::clone::Clone for Fielded {
}
#[automatically_derived]
impl ::core::fmt::Debug for Fielded {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Fielded::X(__self_0) =>
@@ -1341,6 +1355,7 @@ impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy
#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
EnumGeneric<T, U> {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
EnumGeneric::One(__self_0) =>
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
index 00fb59d14..346d8373f 100644
--- 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
@@ -23,9 +23,15 @@ trait Boom {}
//~^WARN malformed `on_unimplemented` attribute
trait Doom {}
+#[diagnostic::on_unimplemented]
+//~^WARN missing options for `on_unimplemented` attribute
+//~|WARN missing options for `on_unimplemented` attribute
+trait Whatever {}
+
fn take_foo(_: impl Foo) {}
fn take_baz(_: impl Baz) {}
fn take_boom(_: impl Boom) {}
+fn take_whatever(_: impl Whatever) {}
fn main() {
take_foo(1_i32);
@@ -34,4 +40,6 @@ fn main() {
//~^ERROR Boom
take_boom(1_i32);
//~^ERROR Boom
+ take_whatever(1_i32);
+ //~^ERROR the trait bound `i32: Whatever` is not satisfied
}
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
index bb1b29ef2..162ddd79f 100644
--- 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
@@ -10,34 +10,53 @@ warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
|
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
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")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
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"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
warning: malformed `on_unimplemented` attribute
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:1
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:32
|
LL | #[diagnostic::on_unimplemented = "boom"]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
|
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:14
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:14
|
LL | take_foo(1_i32);
| -------- ^^^^^ the trait `Foo` is not implemented for `i32`
@@ -50,7 +69,7 @@ help: this trait has no implementations, consider adding one
LL | trait Foo {}
| ^^^^^^^^^
note: required by a bound in `take_foo`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:21
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:21
|
LL | fn take_foo(_: impl Foo) {}
| ^^^ required by this bound in `take_foo`
@@ -59,10 +78,13 @@ 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")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: Boom
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:14
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:39:14
|
LL | take_baz(1_i32);
| -------- ^^^^^ the trait `Baz` is not implemented for `i32`
@@ -75,7 +97,7 @@ help: this trait has no implementations, consider adding one
LL | trait Baz {}
| ^^^^^^^^^
note: required by a bound in `take_baz`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:27:21
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:32:21
|
LL | fn take_baz(_: impl Baz) {}
| ^^^ required by this bound in `take_baz`
@@ -84,10 +106,13 @@ 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"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: Boom
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:15
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:41:15
|
LL | take_boom(1_i32);
| --------- ^^^^^ the trait `Boom` is not implemented for `i32`
@@ -100,11 +125,39 @@ help: this trait has no implementations, consider adding one
LL | trait Boom {}
| ^^^^^^^^^^
note: required by a bound in `take_boom`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:28:22
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:22
|
LL | fn take_boom(_: impl Boom) {}
| ^^^^ required by this bound in `take_boom`
-error: aborting due to 3 previous errors; 8 warnings emitted
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: the trait bound `i32: Whatever` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:19
+ |
+LL | take_whatever(1_i32);
+ | ------------- ^^^^^ the trait `Whatever` 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:29:1
+ |
+LL | trait Whatever {}
+ | ^^^^^^^^^^^^^^
+note: required by a bound in `take_whatever`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:26
+ |
+LL | fn take_whatever(_: impl Whatever) {}
+ | ^^^^^^^^ required by this bound in `take_whatever`
+
+error: aborting due to 4 previous errors; 10 warnings emitted
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
new file mode 100644
index 000000000..8410b3eb1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
@@ -0,0 +1,20 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(
+ if(Self = "()"),
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+ message = "custom message",
+ note = "custom note"
+)]
+#[diagnostic::on_unimplemented(message = "fallback!!")]
+#[diagnostic::on_unimplemented(label = "fallback label")]
+#[diagnostic::on_unimplemented(note = "fallback note")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR custom message
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
new file mode 100644
index 000000000..906472beb
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
@@ -0,0 +1,43 @@
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: custom message
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:18:15
+ |
+LL | takes_foo(());
+ | --------- ^^ fallback label
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: custom note
+ = note: fallback note
+help: this trait has no implementations, consider adding one
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:13:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:15:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
new file mode 100644
index 000000000..34cdb99c7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
@@ -0,0 +1,18 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz", note = "Boom")]
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Bar", label = "Foo", note = "Baz")]
+#[diagnostic::on_unimplemented(note = "Baz2")]
+trait Bar {}
+
+fn takes_foo(_: impl Foo) {}
+fn takes_bar(_: impl Bar) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+ takes_bar(());
+ //~^ERROR Bar
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
new file mode 100644
index 000000000..c72321d46
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
@@ -0,0 +1,47 @@
+error[E0277]: Foo
+ --> $DIR/multiple_notes.rs:14:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+ = note: Boom
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/multiple_notes.rs:10:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error[E0277]: Bar
+ --> $DIR/multiple_notes.rs:16:15
+ |
+LL | takes_bar(());
+ | --------- ^^ Foo
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Bar` is not implemented for `()`
+ = note: Baz
+ = note: Baz2
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:8:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_bar`
+ --> $DIR/multiple_notes.rs:11:22
+ |
+LL | fn takes_bar(_: impl Bar) {}
+ | ^^^ required by this bound in `takes_bar`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs b/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs
new file mode 100644
index 000000000..4e2ee9740
--- /dev/null
+++ b/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs
@@ -0,0 +1,6 @@
+#[derive(Default)]
+pub struct B {
+ #[doc(hidden)]
+ pub hello: i32,
+ pub bye: i32,
+}
diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr
index efa6bb668..5c0c7a0b9 100644
--- a/tests/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr
@@ -191,7 +191,7 @@ error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:33:10
|
LL | type H = Fn(u8) -> (u8)::Output;
- | ^^^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:39:19
diff --git a/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
new file mode 100644
index 000000000..6040f3f30
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
@@ -0,0 +1,38 @@
+// Regression test for issue #93210.
+
+// aux-crate:doc_hidden_fields=doc-hidden-fields.rs
+// edition: 2021
+
+#[derive(Default)]
+pub struct A {
+ #[doc(hidden)]
+ pub hello: i32,
+ pub bye: i32,
+}
+
+#[derive(Default)]
+pub struct C {
+ pub hello: i32,
+ pub bye: i32,
+}
+
+fn main() {
+ // We want to list the field `hello` despite being marked
+ // `doc(hidden)` because it's defined in this crate.
+ A::default().hey;
+ //~^ ERROR no field `hey` on type `A`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+
+ // Here we want to hide the field `hello` since it's marked
+ // `doc(hidden)` and comes from an external crate.
+ doc_hidden_fields::B::default().hey;
+ //~^ ERROR no field `hey` on type `B`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `bye`
+
+ C::default().hey;
+ //~^ ERROR no field `hey` on type `C`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+}
diff --git a/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr
new file mode 100644
index 000000000..b7fe3b79b
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr
@@ -0,0 +1,27 @@
+error[E0609]: no field `hey` on type `A`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:22:18
+ |
+LL | A::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `hello`, `bye`
+
+error[E0609]: no field `hey` on type `B`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:29:37
+ |
+LL | doc_hidden_fields::B::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `bye`
+
+error[E0609]: no field `hey` on type `C`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:34:18
+ |
+LL | C::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `hello`, `bye`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs
new file mode 100644
index 000000000..fb7040b2d
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs
@@ -0,0 +1,47 @@
+// Regression test for issue #116334.
+// Don't include hygienic fields from different syntax contexts in
+// the list of available or similarly named fields.
+
+#![feature(decl_macro)]
+
+macro compound($Ty:ident) {
+ #[derive(Default)]
+ struct $Ty {
+ field: u32, // field `field` is hygienic
+ }
+}
+
+macro component($Ty:ident) {
+ struct $Ty(u64); // field `0` is hygienic (but still accessible via the constructor)
+}
+
+compound! { Compound }
+component! { Component }
+
+fn main() {
+ let ty = Compound::default();
+
+ let _ = ty.field; //~ ERROR no field `field` on type `Compound`
+ let _ = ty.fieeld; //~ ERROR no field `fieeld` on type `Compound`
+
+ let Compound { field } = ty;
+ //~^ ERROR struct `Compound` does not have a field named `field`
+ //~| ERROR pattern requires `..` due to inaccessible fields
+ //~| HELP ignore the inaccessible and unused fields
+
+ let ty = Component(90);
+
+ let _ = ty.0; //~ ERROR no field `0` on type `Component`
+}
+
+environment!();
+
+macro environment() {
+ struct Crate { field: () }
+
+ // Here, we do want to suggest `field` even though it's hygienic
+ // precisely because they come from the same syntax context.
+ const CRATE: Crate = Crate { fiel: () };
+ //~^ ERROR struct `Crate` has no field named `fiel`
+ //~| HELP a field with a similar name exists
+}
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
new file mode 100644
index 000000000..7066d2976
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
@@ -0,0 +1,50 @@
+error[E0560]: struct `Crate` has no field named `fiel`
+ --> $DIR/dont-suggest-hygienic-fields.rs:44:34
+ |
+LL | environment!();
+ | -------------- in this macro invocation
+...
+LL | const CRATE: Crate = Crate { fiel: () };
+ | ^^^^ help: a field with a similar name exists: `field`
+ |
+ = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0609]: no field `field` on type `Compound`
+ --> $DIR/dont-suggest-hygienic-fields.rs:24:16
+ |
+LL | let _ = ty.field;
+ | ^^^^^ unknown field
+
+error[E0609]: no field `fieeld` on type `Compound`
+ --> $DIR/dont-suggest-hygienic-fields.rs:25:16
+ |
+LL | let _ = ty.fieeld;
+ | ^^^^^^ unknown field
+
+error[E0026]: struct `Compound` does not have a field named `field`
+ --> $DIR/dont-suggest-hygienic-fields.rs:27:20
+ |
+LL | let Compound { field } = ty;
+ | ^^^^^ struct `Compound` does not have this field
+
+error: pattern requires `..` due to inaccessible fields
+ --> $DIR/dont-suggest-hygienic-fields.rs:27:9
+ |
+LL | let Compound { field } = ty;
+ | ^^^^^^^^^^^^^^^^^^
+ |
+help: ignore the inaccessible and unused fields
+ |
+LL | let Compound { field, .. } = ty;
+ | ++++
+
+error[E0609]: no field `0` on type `Component`
+ --> $DIR/dont-suggest-hygienic-fields.rs:34:16
+ |
+LL | let _ = ty.0;
+ | ^ unknown field
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0026, E0560, E0609.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/tests/ui/did_you_mean/issue-105225-named-args.rs b/tests/ui/did_you_mean/issue-105225-named-args.rs
new file mode 100644
index 000000000..38e817765
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225-named-args.rs
@@ -0,0 +1,10 @@
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", x, x = y);
+ //~^ ERROR: redundant argument
+
+ println!("{x}", x = y, x = y);
+ //~^ ERROR: duplicate argument named `x`
+}
diff --git a/tests/ui/did_you_mean/issue-105225-named-args.stderr b/tests/ui/did_you_mean/issue-105225-named-args.stderr
new file mode 100644
index 000000000..72204102e
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225-named-args.stderr
@@ -0,0 +1,22 @@
+error: redundant argument
+ --> $DIR/issue-105225-named-args.rs:5:21
+ |
+LL | println!("{x}", x, x = y);
+ | ^
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225-named-args.rs:5:16
+ |
+LL | println!("{x}", x, x = y);
+ | ^
+
+error: duplicate argument named `x`
+ --> $DIR/issue-105225-named-args.rs:8:28
+ |
+LL | println!("{x}", x = y, x = y);
+ | - ^ duplicate argument
+ | |
+ | previously here
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/did_you_mean/issue-105225.fixed b/tests/ui/did_you_mean/issue-105225.fixed
new file mode 100644
index 000000000..f756be615
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", );
+ //~^ ERROR: redundant argument
+
+ println!("{x} {}", x, );
+ //~^ ERROR: redundant argument
+
+ println!("{} {x}", x, );
+ //~^ ERROR: redundant argument
+
+ println!("{x} {y}", );
+ //~^ ERROR: redundant arguments
+
+ println!("{} {} {x} {y} {}", x, x, x, );
+ //~^ ERROR: redundant arguments
+}
diff --git a/tests/ui/did_you_mean/issue-105225.rs b/tests/ui/did_you_mean/issue-105225.rs
new file mode 100644
index 000000000..91cdf0eb2
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.rs
@@ -0,0 +1,21 @@
+// run-rustfix
+
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", x);
+ //~^ ERROR: redundant argument
+
+ println!("{x} {}", x, x);
+ //~^ ERROR: redundant argument
+
+ println!("{} {x}", x, x);
+ //~^ ERROR: redundant argument
+
+ println!("{x} {y}", x, y);
+ //~^ ERROR: redundant arguments
+
+ println!("{} {} {x} {y} {}", x, x, x, y, y);
+ //~^ ERROR: redundant arguments
+}
diff --git a/tests/ui/did_you_mean/issue-105225.stderr b/tests/ui/did_you_mean/issue-105225.stderr
new file mode 100644
index 000000000..5fb46222b
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.stderr
@@ -0,0 +1,72 @@
+error: redundant argument
+ --> $DIR/issue-105225.rs:7:21
+ |
+LL | println!("{x}", x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:7:16
+ |
+LL | println!("{x}", x);
+ | ^
+
+error: redundant argument
+ --> $DIR/issue-105225.rs:10:27
+ |
+LL | println!("{x} {}", x, x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:10:16
+ |
+LL | println!("{x} {}", x, x);
+ | ^
+
+error: redundant argument
+ --> $DIR/issue-105225.rs:13:27
+ |
+LL | println!("{} {x}", x, x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:13:19
+ |
+LL | println!("{} {x}", x, x);
+ | ^
+
+error: redundant arguments
+ --> $DIR/issue-105225.rs:16:25
+ |
+LL | println!("{x} {y}", x, y);
+ | ^ ^
+ |
+note: the formatting specifiers are referencing the bindings already
+ --> $DIR/issue-105225.rs:16:16
+ |
+LL | println!("{x} {y}", x, y);
+ | ^ ^
+help: this can be removed
+ |
+LL - println!("{x} {y}", x, y);
+LL + println!("{x} {y}", );
+ |
+
+error: redundant arguments
+ --> $DIR/issue-105225.rs:19:43
+ |
+LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
+ | ^ ^
+ |
+note: the formatting specifiers are referencing the bindings already
+ --> $DIR/issue-105225.rs:19:26
+ |
+LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
+ | ^
+help: this can be removed
+ |
+LL - println!("{} {} {x} {y} {}", x, x, x, y, y);
+LL + println!("{} {} {x} {y} {}", x, x, x, );
+ |
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs b/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
deleted file mode 100644
index 0efc7daa3..000000000
--- a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#[derive(Default)]
-pub struct A {
- #[doc(hidden)]
- pub hello: i32,
- pub bye: i32,
-}
-
-#[derive(Default)]
-pub struct B {
- pub hello: i32,
- pub bye: i32,
-}
-
-fn main() {
- A::default().hey;
- //~^ ERROR no field `hey` on type `A`
- //~| NOTE unknown field
- //~| NOTE available fields are: `bye`
-
- B::default().hey;
- //~^ ERROR no field `hey` on type `B`
- //~| NOTE unknown field
- //~| NOTE available fields are: `hello`, `bye`
-}
diff --git a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr b/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
deleted file mode 100644
index 784986d3b..000000000
--- a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0609]: no field `hey` on type `A`
- --> $DIR/issue-93210-ignore-doc-hidden.rs:15:18
- |
-LL | A::default().hey;
- | ^^^ unknown field
- |
- = note: available fields are: `bye`
-
-error[E0609]: no field `hey` on type `B`
- --> $DIR/issue-93210-ignore-doc-hidden.rs:20:18
- |
-LL | B::default().hey;
- | ^^^ unknown field
- |
- = note: available fields are: `hello`, `bye`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs
index caef6358e..5bf2cc30e 100644
--- a/tests/ui/drop/dynamic-drop.rs
+++ b/tests/ui/drop/dynamic-drop.rs
@@ -1,7 +1,7 @@
// run-pass
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![feature(if_let_guard)]
#![allow(unused_assignments)]
@@ -9,7 +9,7 @@
use std::cell::{Cell, RefCell};
use std::mem::ManuallyDrop;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic;
use std::pin::Pin;
@@ -173,7 +173,7 @@ fn vec_simple(a: &Allocator) {
let _x = vec![a.alloc(), a.alloc(), a.alloc(), a.alloc()];
}
-fn generator(a: &Allocator, run_count: usize) {
+fn coroutine(a: &Allocator, run_count: usize) {
assert!(run_count < 4);
let mut gen = || {
@@ -471,10 +471,10 @@ fn main() {
run_test(|a| field_assignment(a, false));
run_test(|a| field_assignment(a, true));
- run_test(|a| generator(a, 0));
- run_test(|a| generator(a, 1));
- run_test(|a| generator(a, 2));
- run_test(|a| generator(a, 3));
+ run_test(|a| coroutine(a, 0));
+ run_test(|a| coroutine(a, 1));
+ run_test(|a| coroutine(a, 2));
+ run_test(|a| coroutine(a, 3));
run_test(|a| mixed_drop_and_nondrop(a));
diff --git a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
index 6bafff919..931786672 100644
--- a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
+++ b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
@@ -50,6 +50,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
@@ -63,6 +64,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
@@ -76,6 +78,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
@@ -89,6 +92,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr
index 603bc5237..ced478d65 100644
--- a/tests/ui/error-codes/E0004.stderr
+++ b/tests/ui/error-codes/E0004.stderr
@@ -5,12 +5,12 @@ LL | match x {
| ^ pattern `Terminator::HastaLaVistaBaby` not covered
|
note: `Terminator` defined here
- --> $DIR/E0004.rs:2:5
+ --> $DIR/E0004.rs:1:6
|
LL | enum Terminator {
- | ----------
+ | ^^^^^^^^^^
LL | HastaLaVistaBaby,
- | ^^^^^^^^^^^^^^^^ not covered
+ | ---------------- not covered
= note: the matched value is of type `Terminator`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/error-codes/E0030-teach.stderr b/tests/ui/error-codes/E0030-teach.stderr
index 3f1ad4af3..9435cb204 100644
--- a/tests/ui/error-codes/E0030-teach.stderr
+++ b/tests/ui/error-codes/E0030-teach.stderr
@@ -2,7 +2,7 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030-teach.rs:5:9
|
LL | 1000 ..= 5 => {}
- | ^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^ lower bound larger than upper bound
|
= note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
diff --git a/tests/ui/error-codes/E0030.stderr b/tests/ui/error-codes/E0030.stderr
index db8161d8f..1aeca2916 100644
--- a/tests/ui/error-codes/E0030.stderr
+++ b/tests/ui/error-codes/E0030.stderr
@@ -2,7 +2,7 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030.rs:3:9
|
LL | 1000 ..= 5 => {}
- | ^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^ lower bound larger than upper bound
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0034.stderr b/tests/ui/error-codes/E0034.stderr
index e29621702..da6f22188 100644
--- a/tests/ui/error-codes/E0034.stderr
+++ b/tests/ui/error-codes/E0034.stderr
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Tes
|
LL | fn foo() {}
| ^^^^^^^^
-help: disambiguate the associated function for candidate #1
+help: use fully-qualified syntax to disambiguate
|
LL | <Test as Trait1>::foo()
| ~~~~~~~~~~~~~~~~~~
-help: disambiguate the associated function for candidate #2
- |
LL | <Test as Trait2>::foo()
| ~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/error-codes/E0191.stderr b/tests/ui/error-codes/E0191.stderr
index cf80c9c46..57eda4785 100644
--- a/tests/ui/error-codes/E0191.stderr
+++ b/tests/ui/error-codes/E0191.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Trait` must be specified
--> $DIR/E0191.rs:5:16
|
LL | type Bar;
diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr
index e03eadaca..0e0b5c708 100644
--- a/tests/ui/error-codes/E0220.stderr
+++ b/tests/ui/error-codes/E0220.stderr
@@ -4,7 +4,7 @@ error[E0220]: associated type `F` not found for `Trait`
LL | type Foo = dyn Trait<F=i32>;
| ^ help: `Trait` has the following associated type: `Bar`
-error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Trait` must be specified
--> $DIR/E0220.rs:5:16
|
LL | type Bar;
diff --git a/tests/ui/error-codes/E0221.stderr b/tests/ui/error-codes/E0221.stderr
index 5414d77ad..e600acf78 100644
--- a/tests/ui/error-codes/E0221.stderr
+++ b/tests/ui/error-codes/E0221.stderr
@@ -10,11 +10,11 @@ LL | fn do_something() {
LL | let _: Self::A;
| ^^^^^^^ ambiguous associated type `A`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as Foo>::A;
| ~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as Bar>::A;
| ~~~~~~~~~~~~~~~
@@ -29,7 +29,7 @@ LL | let _: Self::Err;
| ^^^^^^^^^ ambiguous associated type `Err`
|
= note: associated type `Self` could derive from `FromStr`
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as My>::Err;
| ~~~~~~~~~~~~~~
diff --git a/tests/ui/error-codes/E0223.stderr b/tests/ui/error-codes/E0223.stderr
index 42945e42f..1299ba5f5 100644
--- a/tests/ui/error-codes/E0223.stderr
+++ b/tests/ui/error-codes/E0223.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/E0223.rs:8:14
|
LL | let foo: MyTrait::X;
- | ^^^^^^^^^^ help: use the fully-qualified path: `<MyStruct as MyTrait>::X`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as MyTrait>::X`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0282.rs b/tests/ui/error-codes/E0282.rs
index f1f93b3ae..5bc29cda9 100644
--- a/tests/ui/error-codes/E0282.rs
+++ b/tests/ui/error-codes/E0282.rs
@@ -1,4 +1,4 @@
fn main() {
- let x = "hello".chars().rev().collect();
+ let x;
//~^ ERROR E0282
}
diff --git a/tests/ui/error-codes/E0282.stderr b/tests/ui/error-codes/E0282.stderr
index 892d3a81f..58332454a 100644
--- a/tests/ui/error-codes/E0282.stderr
+++ b/tests/ui/error-codes/E0282.stderr
@@ -1,13 +1,13 @@
error[E0282]: type annotations needed
--> $DIR/E0282.rs:2:9
|
-LL | let x = "hello".chars().rev().collect();
+LL | let x;
| ^
|
help: consider giving `x` an explicit type
|
-LL | let x: Vec<_> = "hello".chars().rev().collect();
- | ++++++++
+LL | let x: /* Type */;
+ | ++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0283.rs b/tests/ui/error-codes/E0283.rs
index 0643af4b7..5134660e3 100644
--- a/tests/ui/error-codes/E0283.rs
+++ b/tests/ui/error-codes/E0283.rs
@@ -1,10 +1,10 @@
-trait Generator {
+trait Coroutine {
fn create() -> u32;
}
struct Impl;
-impl Generator for Impl {
+impl Coroutine for Impl {
fn create() -> u32 { 1 }
}
@@ -22,12 +22,12 @@ fn foo(bar: u32) {}
struct AnotherImpl;
-impl Generator for AnotherImpl {
+impl Coroutine for AnotherImpl {
fn create() -> u32 { 2 }
}
fn main() {
- let cont: u32 = Generator::create(); //~ ERROR E0790
+ let cont: u32 = Coroutine::create(); //~ ERROR E0790
}
fn buzz() {
diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr
index fa8d4b6e0..6008809f0 100644
--- a/tests/ui/error-codes/E0283.stderr
+++ b/tests/ui/error-codes/E0283.stderr
@@ -2,14 +2,14 @@ error[E0790]: cannot call associated function on trait without specifying the co
--> $DIR/E0283.rs:30:21
|
LL | fn create() -> u32;
- | ------------------- `Generator::create` defined here
+ | ------------------- `Coroutine::create` defined here
...
-LL | let cont: u32 = Generator::create();
+LL | let cont: u32 = Coroutine::create();
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation
|
-LL | let cont: u32 = </* self type */ as Generator>::create();
+LL | let cont: u32 = </* self type */ as Coroutine>::create();
| +++++++++++++++++++ +
error[E0283]: type annotations needed
diff --git a/tests/ui/error-codes/E0311.fixed b/tests/ui/error-codes/E0311.fixed
index 4410a4d70..09ceecd06 100644
--- a/tests/ui/error-codes/E0311.fixed
+++ b/tests/ui/error-codes/E0311.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
with_restriction::<T>(x) //~ ERROR E0311
}
diff --git a/tests/ui/error-codes/E0311.stderr b/tests/ui/error-codes/E0311.stderr
index b0e6dd1e2..96546b83f 100644
--- a/tests/ui/error-codes/E0311.stderr
+++ b/tests/ui/error-codes/E0311.stderr
@@ -1,23 +1,15 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/E0311.rs:6:5
|
-LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/E0311.rs:5:25
- |
LL | fn no_restriction<T>(x: &()) -> &() {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/E0311.rs:6:5
- |
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
- | +++ ++++ ++
+LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
+ | +++ ++++ ++ ++
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr
index a77920430..49ec0bce4 100644
--- a/tests/ui/error-codes/E0374.stderr
+++ b/tests/ui/error-codes/E0374.stderr
@@ -1,8 +1,9 @@
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>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
+LL | | where T: CoerceUnsized<U> {}
+ | |_____________________________^
|
= note: expected a single field to be coerced, none found
diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr
index 664e499ec..9cb11e5a3 100644
--- a/tests/ui/error-codes/E0377.stderr
+++ b/tests/ui/error-codes/E0377.stderr
@@ -2,7 +2,7 @@ error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion b
--> $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`
diff --git a/tests/ui/error-codes/E0396-fixed.stderr b/tests/ui/error-codes/E0396-fixed.stderr
index 2efbd6989..e77b2ce9a 100644
--- a/tests/ui/error-codes/E0396-fixed.stderr
+++ b/tests/ui/error-codes/E0396-fixed.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/E0396-fixed.rs:5:28
|
LL | const VALUE: u8 = unsafe { *REG_ADDR };
- | ^^^^^^^^^ dereferencing pointer failed: 0x5f3759df[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^ memory access failed: 0x5f3759df[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0396.rs b/tests/ui/error-codes/E0396.rs
index 4415b70e7..383eda3d6 100644
--- a/tests/ui/error-codes/E0396.rs
+++ b/tests/ui/error-codes/E0396.rs
@@ -9,9 +9,11 @@ const unsafe fn unreachable() -> ! {
const INFALLIBLE: *mut Infallible = &[] as *const [Infallible] as *const _ as _;
match *INFALLIBLE {}
//~^ ERROR dereferencing raw mutable pointers in constant functions is unstable
+ //~| ERROR dereferencing raw mutable pointers in constant functions is unstable
const BAD: () = unsafe { match *INFALLIBLE {} };
//~^ ERROR dereferencing raw mutable pointers in constants is unstable
+ //~| ERROR dereferencing raw mutable pointers in constants is unstable
}
fn main() {
diff --git a/tests/ui/error-codes/E0396.stderr b/tests/ui/error-codes/E0396.stderr
index 8c87f4067..a84a1216e 100644
--- a/tests/ui/error-codes/E0396.stderr
+++ b/tests/ui/error-codes/E0396.stderr
@@ -16,15 +16,35 @@ LL | match *INFALLIBLE {}
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
+ --> $DIR/E0396.rs:10:11
+ |
+LL | match *INFALLIBLE {}
+ | ^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0658]: dereferencing raw mutable pointers in constants is unstable
+ --> $DIR/E0396.rs:14:36
+ |
+LL | const BAD: () = unsafe { match *INFALLIBLE {} };
+ | ^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
error[E0658]: dereferencing raw mutable pointers in constants is unstable
- --> $DIR/E0396.rs:13:36
+ --> $DIR/E0396.rs:14:36
|
LL | const BAD: () = unsafe { match *INFALLIBLE {} };
| ^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index 928c8d11d..0a069e8d3 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -32,12 +32,18 @@ LL | fn helper(sel: &Self) -> u8 {
| use of generic parameter from outer item
| refer to the type directly here instead
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/E0401.rs:11:5
|
LL | bfnr(x);
- | ^^^^ cannot infer type of the type parameter `U` declared on the function `bfnr`
+ | ^^^^ cannot infer type of the type parameter `V` declared on the function `bfnr`
+ |
+ = note: cannot satisfy `_: Baz<_>`
+note: required by a bound in `bfnr`
+ --> $DIR/E0401.rs:4:19
|
+LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
+ | ^^^^^^ required by this bound in `bfnr`
help: consider specifying the generic arguments
|
LL | bfnr::<U, V, W>(x);
@@ -66,5 +72,5 @@ LL | bfnr::<U, V, W>(x);
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0282, E0283, E0401.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0283, E0401.
+For more information about an error, try `rustc --explain E0283`.
diff --git a/tests/ui/error-codes/E0452.stderr b/tests/ui/error-codes/E0452.stderr
index f67b740ff..986c135ed 100644
--- a/tests/ui/error-codes/E0452.stderr
+++ b/tests/ui/error-codes/E0452.stderr
@@ -9,18 +9,24 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/error-codes/E0453.stderr b/tests/ui/error-codes/E0453.stderr
index f982ed26f..bb2c39298 100644
--- a/tests/ui/error-codes/E0453.stderr
+++ b/tests/ui/error-codes/E0453.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(non_snake_case)]
LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-codes/E0463.rs b/tests/ui/error-codes/E0463.rs
deleted file mode 100644
index 683565281..000000000
--- a/tests/ui/error-codes/E0463.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-#![feature(plugin)]
-#![plugin(cookie_monster)]
-//~^ ERROR E0463
-extern crate cake_is_a_lie;
-
-fn main() {
-}
diff --git a/tests/ui/error-codes/E0463.stderr b/tests/ui/error-codes/E0463.stderr
deleted file mode 100644
index 1aa66e1ec..000000000
--- a/tests/ui/error-codes/E0463.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0463]: can't find crate for `cookie_monster`
- --> $DIR/E0463.rs:2:11
- |
-LL | #![plugin(cookie_monster)]
- | ^^^^^^^^^^^^^^ can't find crate
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0463`.
diff --git a/tests/ui/error-codes/E0476.stderr b/tests/ui/error-codes/E0476.stderr
index a4bb26532..0378ac6e8 100644
--- a/tests/ui/error-codes/E0476.stderr
+++ b/tests/ui/error-codes/E0476.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>`
--> $DIR/E0476.rs:9:1
|
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T
@@ -12,7 +12,7 @@ error[E0476]: lifetime of the source pointer does not outlive lifetime bound of
--> $DIR/E0476.rs:9:1
|
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: object type is valid for the lifetime `'a` as defined here
--> $DIR/E0476.rs:9:6
diff --git a/tests/ui/error-codes/E0583.stderr b/tests/ui/error-codes/E0583.stderr
index c7bbbf114..6707f2864 100644
--- a/tests/ui/error-codes/E0583.stderr
+++ b/tests/ui/error-codes/E0583.stderr
@@ -5,6 +5,7 @@ LL | mod module_that_doesnt_exist;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs" or "$DIR/module_that_doesnt_exist/mod.rs"
+ = note: if there is a `mod module_that_doesnt_exist` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr
index 60ecec7cd..b6b5cd5c3 100644
--- a/tests/ui/error-codes/E0602.stderr
+++ b/tests/ui/error-codes/E0602.stderr
@@ -6,10 +6,12 @@ warning[E0602]: unknown lint: `bogus`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr
index e302f406d..00aea9713 100644
--- a/tests/ui/error-codes/E0719.stderr
+++ b/tests/ui/error-codes/E0719.stderr
@@ -1,4 +1,4 @@
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
@@ -6,15 +6,17 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:7:42
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
diff --git a/tests/ui/error-codes/E0789.stderr b/tests/ui/error-codes/E0789.stderr
index faab92bae..6df9daafe 100644
--- a/tests/ui/error-codes/E0789.stderr
+++ b/tests/ui/error-codes/E0789.stderr
@@ -9,6 +9,8 @@ error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired
|
LL | struct Foo;
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout b/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout
new file mode 100644
index 000000000..3bbdcbb86
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout
@@ -0,0 +1 @@
+remapped/errors/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix-macro.rs b/tests/ui/errors/remap-path-prefix-macro.rs
new file mode 100644
index 000000000..0ba706b0a
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.rs
@@ -0,0 +1,12 @@
+// run-pass
+// check-run-results
+
+// revisions: normal with-macro-scope without-macro-scope
+// compile-flags: --remap-path-prefix={{src-base}}=remapped
+// [with-macro-scope]compile-flags: -Zremap-path-scope=macro,diagnostics
+// [without-macro-scope]compile-flags: -Zremap-path-scope=diagnostics
+// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
+
+fn main() {
+ println!("{}", file!());
+}
diff --git a/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout b/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout
new file mode 100644
index 000000000..3bbdcbb86
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout
@@ -0,0 +1 @@
+remapped/errors/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout b/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout
new file mode 100644
index 000000000..642823fec
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout
@@ -0,0 +1 @@
+$DIR/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix.stderr b/tests/ui/errors/remap-path-prefix.normal.stderr
index 62dbd4b88..004f10b4e 100644
--- a/tests/ui/errors/remap-path-prefix.stderr
+++ b/tests/ui/errors/remap-path-prefix.normal.stderr
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `ferris` in this scope
- --> remapped/errors/remap-path-prefix.rs:16:5
+ --> remapped/errors/remap-path-prefix.rs:19:5
|
LL | ferris
| ^^^^^^ not found in this scope
diff --git a/tests/ui/errors/remap-path-prefix.rs b/tests/ui/errors/remap-path-prefix.rs
index 393b8e22f..e3338c10f 100644
--- a/tests/ui/errors/remap-path-prefix.rs
+++ b/tests/ui/errors/remap-path-prefix.rs
@@ -1,4 +1,7 @@
+// revisions: normal with-diagnostic-scope without-diagnostic-scope
// compile-flags: --remap-path-prefix={{src-base}}=remapped
+// [with-diagnostic-scope]compile-flags: -Zremap-path-scope=diagnostics
+// [without-diagnostic-scope]compile-flags: -Zremap-path-scope=object
// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
// The remapped paths are not normalized by compiletest.
diff --git a/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr b/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr
new file mode 100644
index 000000000..004f10b4e
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `ferris` in this scope
+ --> remapped/errors/remap-path-prefix.rs:19:5
+ |
+LL | ferris
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr b/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr
new file mode 100644
index 000000000..98fe32819
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `ferris` in this scope
+ --> $DIR/remap-path-prefix.rs:19:5
+ |
+LL | ferris
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs
new file mode 100644
index 000000000..5e64fd5d2
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs
@@ -0,0 +1,10 @@
+fn main() {
+ let number = 2;
+ Some(true).filter({ //~ ERROR expected a `FnOnce(&bool)` closure, found `bool`
+ if number % 2 == 0 {
+ number == 0
+ } else {
+ number != 0
+ }
+ });
+}
diff --git a/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr
new file mode 100644
index 000000000..f70b32117
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr
@@ -0,0 +1,27 @@
+error[E0277]: expected a `FnOnce(&bool)` closure, found `bool`
+ --> $DIR/block_instead_of_closure_in_arg.rs:3:23
+ |
+LL | Some(true).filter({
+ | _________________------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |/ if number % 2 == 0 {
+LL | || number == 0
+LL | || } else {
+LL | || number != 0
+LL | || }
+ | ||_________- this tail expression is of type `bool`
+LL | | });
+ | |______^ expected an `FnOnce(&bool)` closure, found `bool`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a bool,)>` is not implemented for `bool`
+note: required by a bound in `Option::<T>::filter`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+help: you might have meant to create the closure instead of a block
+ |
+LL | Some(true).filter(|_| {
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed
new file mode 100644
index 000000000..b81515cda
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x| {
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo(); //~ ERROR mismatched types
+}
+
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs
new file mode 100644
index 000000000..e47ad562f
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ );
+ let _: () = foo; //~ ERROR mismatched types
+}
+
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr
new file mode 100644
index 000000000..fbb7e0e4d
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr
@@ -0,0 +1,38 @@
+error: expected expression, found `let` statement
+ --> $DIR/missing_block_in_fn_call.rs:4:9
+ |
+LL | let _ = vec![1, 2, 3].into_iter().map(|x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure
+ |
+LL ~ let _ = vec![1, 2, 3].into_iter().map(|x| {
+LL | let y = x;
+LL | y
+LL ~ });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/missing_block_in_fn_call.rs:7:17
+ |
+LL | let _: () = foo;
+ | -- ^^^ expected `()`, found fn item
+ | |
+ | expected due to this
+...
+LL | fn foo() {}
+ | -------- function `foo` defined here
+ |
+ = note: expected unit type `()`
+ found fn item `fn() {foo}`
+help: use parentheses to call this function
+ |
+LL | let _: () = foo();
+ | ++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs
new file mode 100644
index 000000000..1ee215d15
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs
@@ -0,0 +1,6 @@
+fn main() {
+ let x = |x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ let _ = () + ();
+ y
+}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr
new file mode 100644
index 000000000..d4640fba9
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr
@@ -0,0 +1,16 @@
+error: expected expression, found `let` statement
+ --> $DIR/missing_block_in_let_binding.rs:3:9
+ |
+LL | let x = |x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure
+ |
+LL | let x = |x| {
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed
new file mode 100644
index 000000000..8014dc87c
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x| {
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo(); //~ ERROR mismatched types
+}
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs
new file mode 100644
index 000000000..9e4aca888
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map({|x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo; //~ ERROR mismatched types
+}
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr
new file mode 100644
index 000000000..5fc48d73b
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr
@@ -0,0 +1,36 @@
+error: expected expression, found `let` statement
+ --> $DIR/ruby_style_closure_parse_error.rs:4:9
+ |
+LL | let _ = vec![1, 2, 3].into_iter().map({|x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure, instead of enclosing the closure in a block
+ |
+LL - let _ = vec![1, 2, 3].into_iter().map({|x|
+LL + let _ = vec![1, 2, 3].into_iter().map(|x| {
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/ruby_style_closure_parse_error.rs:7:17
+ |
+LL | let _: () = foo;
+ | -- ^^^ expected `()`, found fn item
+ | |
+ | expected due to this
+LL | }
+LL | fn foo() {}
+ | -------- function `foo` defined here
+ |
+ = note: expected unit type `()`
+ found fn item `fn() {foo}`
+help: use parentheses to call this function
+ |
+LL | let _: () = foo();
+ | ++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs
new file mode 100644
index 000000000..bb2e9c0a6
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs
@@ -0,0 +1,7 @@
+const x: usize =42;
+fn main() {
+ let p = Some(45).and_then({|x| //~ ERROR expected a `FnOnce({integer})` closure, found `Option<usize>`
+ 1 + 1;
+ Some(x * 2)
+ });
+}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr
new file mode 100644
index 000000000..e44ec5ca9
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr
@@ -0,0 +1,25 @@
+error[E0277]: expected a `FnOnce({integer})` closure, found `Option<usize>`
+ --> $DIR/ruby_style_closure_successful_parse.rs:3:31
+ |
+LL | let p = Some(45).and_then({|x|
+ | ______________________--------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | | 1 + 1;
+LL | | Some(x * 2)
+ | | ----------- this tail expression is of type `Option<usize>`
+LL | | });
+ | |_____^ expected an `FnOnce({integer})` closure, found `Option<usize>`
+ |
+ = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<usize>`
+note: required by a bound in `Option::<T>::and_then`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+help: you might have meant to open the closure body instead of placing a closure within a block
+ |
+LL - let p = Some(45).and_then({|x|
+LL + let p = Some(45).and_then(|x| {
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/extern/extern-wrong-value-type.rs b/tests/ui/extern/extern-wrong-value-type.rs
index 337865ec1..56c6cf1df 100644
--- a/tests/ui/extern/extern-wrong-value-type.rs
+++ b/tests/ui/extern/extern-wrong-value-type.rs
@@ -7,5 +7,5 @@ fn main() {
// extern functions are extern "C" fn
let _x: extern "C" fn() = f; // OK
is_fn(f);
- //~^ ERROR expected a `Fn<()>` closure, found `extern "C" fn() {f}`
+ //~^ ERROR expected a `Fn()` closure, found `extern "C" fn() {f}`
}
diff --git a/tests/ui/extern/extern-wrong-value-type.stderr b/tests/ui/extern/extern-wrong-value-type.stderr
index ff2934a2b..463cee831 100644
--- a/tests/ui/extern/extern-wrong-value-type.stderr
+++ b/tests/ui/extern/extern-wrong-value-type.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() {f}`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() {f}`
--> $DIR/extern-wrong-value-type.rs:9:11
|
LL | is_fn(f);
- | ----- ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
+ | ----- ^ expected an `Fn()` closure, found `extern "C" fn() {f}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/feature-gates/doc-rust-logo.rs b/tests/ui/feature-gates/doc-rust-logo.rs
new file mode 100644
index 000000000..e6a585129
--- /dev/null
+++ b/tests/ui/feature-gates/doc-rust-logo.rs
@@ -0,0 +1,5 @@
+#![doc(rust_logo)]
+//~^ ERROR the `#[doc(rust_logo)]` attribute is used for Rust branding
+//! This is not an official rust crate
+
+fn main() {}
diff --git a/tests/ui/feature-gates/doc-rust-logo.stderr b/tests/ui/feature-gates/doc-rust-logo.stderr
new file mode 100644
index 000000000..ff5855290
--- /dev/null
+++ b/tests/ui/feature-gates/doc-rust-logo.stderr
@@ -0,0 +1,12 @@
+error[E0658]: the `#[doc(rust_logo)]` attribute is used for Rust branding
+ --> $DIR/doc-rust-logo.rs:1:8
+ |
+LL | #![doc(rust_logo)]
+ | ^^^^^^^^^
+ |
+ = note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information
+ = help: add `#![feature(rustdoc_internals)]` 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-associated_type_bounds.rs b/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
index 49fb10e60..152c7a8de 100644
--- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
+++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
@@ -54,20 +54,20 @@ fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
fn main() {
let _: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
- //~| ERROR `impl Trait` only allowed in function and inherent method return types
+ //~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// let _: &dyn Tr1<As1: Copy> = &S1;
}
diff --git a/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
index 4233a8af9..f2bceda9b 100644
--- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
+++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
@@ -115,19 +115,19 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/feature-gate-associated_type_bounds.rs:55:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/feature-gate-associated_type_bounds.rs:61:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/feature-gate-associated_type_bounds.rs:68:12
|
LL | let _: impl Tr1<As1: Copy> = S1;
diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
index a4c91f3bc..58a9c84be 100644
--- a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
+++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
@@ -1,9 +1,9 @@
// edition:2021
#![feature(stmt_expr_attributes)]
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _closure = #[track_caller] || {}; //~ `#[track_caller]` on closures
- let _generator = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures
+ let _coroutine = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures
let _future = #[track_caller] async {}; //~ `#[track_caller]` on closures
}
diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
index cf2ea5fe1..d5ef5d09e 100644
--- a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
+++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
@@ -10,7 +10,7 @@ LL | let _closure = #[track_caller] || {};
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/feature-gate-closure_track_caller.rs:7:22
|
-LL | let _generator = #[track_caller] || { yield; };
+LL | let _coroutine = #[track_caller] || { yield; };
| ^^^^^^^^^^^^^^^
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
new file mode 100644
index 000000000..2e529236a
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
@@ -0,0 +1,28 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0627, E0658.
+For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.none.stderr b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
new file mode 100644
index 000000000..ab24805e4
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
@@ -0,0 +1,66 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:16:5
+ |
+LL | yield;
+ | ^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:17:5
+ |
+LL | yield 0;
+ | ^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0627, E0658.
+For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.rs b/tests/ui/feature-gates/feature-gate-coroutines.rs
new file mode 100644
index 000000000..53b58d486
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.rs
@@ -0,0 +1,18 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+fn main() {
+ yield true; //~ ERROR yield syntax is experimental
+ //~^ ERROR yield expression outside of coroutine literal
+ //[none]~^^ ERROR yield syntax is experimental
+
+ let _ = || yield true; //~ ERROR yield syntax is experimental
+ //[none]~^ ERROR yield syntax is experimental
+}
+
+#[cfg(FALSE)]
+fn foo() {
+ // Ok in 2024 edition
+ yield; //[none]~ ERROR yield syntax is experimental
+ yield 0; //[none]~ ERROR yield syntax is experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
index 303700c7a..00b8c0eef 100644
--- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
+++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
@@ -14,6 +14,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | fn ptr(self: Ptr<Self>);
| ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
+ = help: only type `i32` implements the trait, consider using it directly instead
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5
@@ -31,6 +32,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | fn ptr(self: Ptr<Self>);
| ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
+ = help: only type `i32` implements the trait, consider using it directly instead
= note: required for the cast from `Ptr<{integer}>` to `Ptr<dyn Trait>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
new file mode 100644
index 000000000..1462c41e9
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
@@ -0,0 +1,28 @@
+error[E0658]: gen blocks are experimental
+ --> $DIR/feature-gate-gen_blocks.rs:5:5
+ |
+LL | gen {};
+ | ^^^^^
+ |
+ = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+ = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0658]: gen blocks are experimental
+ --> $DIR/feature-gate-gen_blocks.rs:13:5
+ |
+LL | gen {};
+ | ^^^^^
+ |
+ = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+ = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0282]: type annotations needed
+ --> $DIR/feature-gate-gen_blocks.rs:5:9
+ |
+LL | gen {};
+ | ^^ cannot infer type
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0282, E0658.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
new file mode 100644
index 000000000..b448c35e8
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
@@ -0,0 +1,9 @@
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/feature-gate-gen_blocks.rs:5:5
+ |
+LL | gen {};
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0422`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.rs b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
new file mode 100644
index 000000000..e2e1574a3
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
@@ -0,0 +1,15 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+fn main() {
+ gen {};
+ //[none]~^ ERROR: cannot find struct, variant or union type `gen`
+ //[e2024]~^^ ERROR: gen blocks are experimental
+ //[e2024]~| ERROR: type annotations needed
+}
+
+#[cfg(FALSE)]
+fn foo() {
+ gen {};
+ //[e2024]~^ ERROR: gen blocks are experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-generators.rs b/tests/ui/feature-gates/feature-gate-generators.rs
deleted file mode 100644
index 931fee134..000000000
--- a/tests/ui/feature-gates/feature-gate-generators.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() {
- yield true; //~ ERROR yield syntax is experimental
- //~^ ERROR yield expression outside of generator literal
-}
-
-#[cfg(FALSE)]
-fn foo() {
- yield; //~ ERROR yield syntax is experimental
- yield 0; //~ ERROR yield syntax is experimental
-}
diff --git a/tests/ui/feature-gates/feature-gate-generators.stderr b/tests/ui/feature-gates/feature-gate-generators.stderr
deleted file mode 100644
index dfea178a6..000000000
--- a/tests/ui/feature-gates/feature-gate-generators.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:2:5
- |
-LL | yield true;
- | ^^^^^^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:8:5
- |
-LL | yield;
- | ^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:9:5
- |
-LL | yield 0;
- | ^^^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0627]: yield expression outside of generator literal
- --> $DIR/feature-gate-generators.rs:2:5
- |
-LL | yield true;
- | ^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0627, E0658.
-For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
index 0db8088f7..1b9530fa8 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
@@ -1,6 +1,6 @@
fn f() -> impl Fn() -> impl Sized { || () }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
index c8c3e13d7..f0c0cd040 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:1:24
|
LL | fn f() -> impl Fn() -> impl Sized { || () }
@@ -7,7 +7,7 @@ LL | fn f() -> impl Fn() -> impl Sized { || () }
= note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information
= help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32
|
LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
diff --git a/tests/ui/feature-gates/feature-gate-lint-reasons.stderr b/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
index 12793c7a2..6d49b7ed2 100644
--- a/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
+++ b/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
@@ -15,6 +15,7 @@ LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
|
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
index 1f725f354..5e14bf639 100644
--- a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
+++ b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
@@ -25,6 +25,7 @@ LL | #![deny(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
@@ -34,6 +35,7 @@ LL | #![warn(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
@@ -43,6 +45,7 @@ LL | #![deny(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
@@ -52,6 +55,7 @@ LL | #![warn(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
index 9b646060a..1922bfb49 100644
--- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
+++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
@@ -3,13 +3,17 @@
#![deny(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
#![allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
fn main() {
enum Foo {
- A, B, C,
+ A,
+ B,
+ C,
}
#[allow(non_exhaustive_omitted_patterns)]
@@ -17,18 +21,22 @@ fn main() {
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
+ //~^ ERROR non-exhaustive patterns: `Foo::C` not covered
Foo::A => {}
Foo::B => {}
}
- //~^^^^ ERROR non-exhaustive patterns: `Foo::C` not covered
+ #[warn(non_exhaustive_omitted_patterns)]
+ //~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
Foo::A => {}
Foo::B => {}
- #[warn(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
- //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
}
diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
index fb39c404c..8af0eedc8 100644
--- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
+++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
@@ -10,7 +10,7 @@ LL | #![deny(non_exhaustive_omitted_patterns)]
= note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL | #![allow(non_exhaustive_omitted_patterns)]
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,18 +38,30 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
|
-LL | #[warn(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
|
LL | #![deny(non_exhaustive_omitted_patterns)]
@@ -58,9 +70,10 @@ LL | #![deny(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,9 +81,10 @@ LL | #![allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -78,9 +92,10 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,30 +103,44 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
|
-LL | #[warn(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0004]: non-exhaustive patterns: `Foo::C` not covered
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:25:11
|
LL | match Foo::A {
| ^^^^^^ pattern `Foo::C` not covered
|
note: `Foo` defined here
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:12:15
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:10
|
LL | enum Foo {
- | ---
-LL | A, B, C,
- | ^ not covered
+ | ^^^
+...
+LL | C,
+ | - not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -119,6 +148,50 @@ LL ~ Foo::B => {},
LL + Foo::C => todo!()
|
-error: aborting due to previous error; 10 warnings emitted
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
+ |
+LL | #![deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
+ |
+LL | #![allow(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
+ |
+LL | #[allow(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to previous error; 16 warnings emitted
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.rs b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs
new file mode 100644
index 000000000..e19dcf9f6
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs
@@ -0,0 +1,15 @@
+#![feature(offset_of)]
+
+use std::mem::offset_of;
+
+enum Alpha {
+ One(u8),
+ Two(u8),
+}
+
+fn main() {
+ offset_of!(Alpha::One, 0); //~ ERROR expected type, found variant `Alpha::One`
+ offset_of!(Alpha, One); //~ ERROR `One` is an enum variant; expected field at end of `offset_of`
+ //~| ERROR using enums in offset_of is experimental
+ offset_of!(Alpha, Two.0); //~ ERROR using enums in offset_of is experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr
new file mode 100644
index 000000000..893f78702
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr
@@ -0,0 +1,37 @@
+error[E0573]: expected type, found variant `Alpha::One`
+ --> $DIR/feature-gate-offset-of-enum.rs:11:16
+ |
+LL | offset_of!(Alpha::One, 0);
+ | ^^^^^^^^^^
+ | |
+ | not a type
+ | help: try using the variant's enum: `Alpha`
+
+error[E0658]: using enums in offset_of is experimental
+ --> $DIR/feature-gate-offset-of-enum.rs:12:23
+ |
+LL | offset_of!(Alpha, One);
+ | ^^^
+ |
+ = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
+ = help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
+
+error[E0795]: `One` is an enum variant; expected field at end of `offset_of`
+ --> $DIR/feature-gate-offset-of-enum.rs:12:23
+ |
+LL | offset_of!(Alpha, One);
+ | ^^^ enum variant
+
+error[E0658]: using enums in offset_of is experimental
+ --> $DIR/feature-gate-offset-of-enum.rs:14:23
+ |
+LL | offset_of!(Alpha, Two.0);
+ | ^^^
+ |
+ = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
+ = help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0573, E0658, E0795.
+For more information about an error, try `rustc --explain E0573`.
diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
index 4c77180b7..b4dc1fd45 100644
--- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
+++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
@@ -1,17 +1,17 @@
fn main() {
match 0usize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered
+ //~| NOTE pattern `usize::MAX..` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}
match 0isize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ //~| NOTE patterns `..isize::MIN` and `isize::MAX..` not covered
//~| NOTE the matched value is of type `isize`
- //~| NOTE `isize` does not have a fixed maximum value
+ //~| NOTE `isize` does not have fixed minimum and maximum values
isize::MIN..=isize::MAX => {}
}
}
diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
index 853b57052..8694924e5 100644
--- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
+++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
@@ -1,31 +1,31 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:2:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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 ~ 0..=usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN..=isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs b/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs
deleted file mode 100644
index 637765fff..000000000
--- a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// edition:2021
-
-// async_fn_in_trait is not enough to allow use of RPITIT
-#![allow(incomplete_features)]
-#![feature(async_fn_in_trait)]
-
-trait Foo {
- fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
- fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
-}
-
-// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
-// feature-gate-async_fn_in_trait.rs)
-trait AsyncFoo {
- async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
-}
-
-fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr b/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr
deleted file mode 100644
index 0082b6faf..000000000
--- a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
- |
-LL | fn bar() -> impl Sized;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
- |
-LL | fn baz() -> Box<impl std::fmt::Display>;
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
- |
-LL | async fn bar() -> impl Sized;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index ae12495b5..86e2c48e1 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -4,9 +4,9 @@
// [no] check-pass
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
-#![feature(async_fn_in_trait)]
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn m();
}
diff --git a/tests/ui/feature-gates/feature-gate-staged_api.rs b/tests/ui/feature-gates/feature-gate-staged_api.rs
index 2571ab5d1..ce6b218dd 100644
--- a/tests/ui/feature-gates/feature-gate-staged_api.rs
+++ b/tests/ui/feature-gates/feature-gate-staged_api.rs
@@ -1,11 +1,11 @@
-#![stable(feature = "a", since = "b")]
+#![stable(feature = "a", since = "3.3.3")]
//~^ ERROR stability attributes may not be used outside of the standard library
mod inner_private_module {
// UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here
pub type UnnameableTypeAlias = u8;
}
-#[stable(feature = "a", since = "b")]
+#[stable(feature = "a", since = "3.3.3")]
//~^ ERROR stability attributes may not be used outside of the standard library
pub fn f() -> inner_private_module::UnnameableTypeAlias {
0
diff --git a/tests/ui/feature-gates/feature-gate-staged_api.stderr b/tests/ui/feature-gates/feature-gate-staged_api.stderr
index 951bb5a17..1a9fcb02b 100644
--- a/tests/ui/feature-gates/feature-gate-staged_api.stderr
+++ b/tests/ui/feature-gates/feature-gate-staged_api.stderr
@@ -1,14 +1,14 @@
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:8:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(feature = "a", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:1:1
|
-LL | #![stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![stable(feature = "a", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr b/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
index 751da87cc..1e6d762a5 100644
--- a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
+++ b/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
@@ -28,6 +28,7 @@ LL | #![deny(fuzzy_provenance_casts)]
= note: the `fuzzy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `lossy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:7:1
@@ -38,6 +39,7 @@ LL | #![deny(lossy_provenance_casts)]
= note: the `lossy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `fuzzy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:3:1
@@ -48,6 +50,7 @@ LL | #![deny(fuzzy_provenance_casts)]
= note: the `fuzzy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `lossy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:7:1
@@ -58,6 +61,7 @@ LL | #![deny(lossy_provenance_casts)]
= note: the `lossy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
index b4d6aa658..562aa478a 100644
--- a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
+++ b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
@@ -16,6 +16,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
--> $DIR/feature-gate-test_unstable_lint.rs:4:1
@@ -25,6 +26,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
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 4349fea6f..2614f2b3c 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -18,6 +18,7 @@ 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `unnameable_types`
--> $DIR/feature-gate-type_privacy_lints.rs:3:1
@@ -28,6 +29,7 @@ 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
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr b/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
index 6b3322119..8270d46d4 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
@@ -11,10 +11,14 @@ error: `bench` attribute cannot be used at crate level
|
LL | #![bench = "4100"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[bench = "4100"]
+LL - #![bench = "4100"]
+LL + #[bench = "4100"]
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
index 1fe133ac2..0f833f793 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
@@ -32,6 +32,12 @@
//~^ ERROR attribute should be applied to function or closure
mod inline {
//~^ NOTE not a function or closure
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
mod inner { #![inline] }
//~^ ERROR attribute should be applied to function or closure
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
index 787670404..f01153dcb 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
@@ -7,7 +7,7 @@ LL | #![rustc_main]
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
|
LL | #[inline = "2100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^
@@ -17,31 +17,31 @@ LL | #[inline = "2100"] fn f() { }
= note: `#[deny(ill_formed_attribute_input)]` on by default
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:125:1
|
LL | #[start]
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:122:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:128:17
|
LL | mod inner { #![start] }
| ^^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:5
|
LL | #[start] struct S;
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:130:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:136:5
|
LL | #[start] type T = S;
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:139:5
|
LL | #[start] impl S { }
| ^^^^^^^^
@@ -55,14 +55,14 @@ LL |
LL | / mod inline {
LL | |
LL | |
-LL | | mod inner { #![inline] }
+LL | |
... |
LL | |
LL | | }
| |_- not a function or closure
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:1
|
LL | #[no_link]
| ^^^^^^^^^^
@@ -77,7 +77,7 @@ LL | | }
| |_- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:85:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:1
|
LL | #[export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -92,7 +92,7 @@ LL | | }
| |_- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:8
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:8
|
LL | #[repr(C)]
| ^
@@ -129,10 +129,14 @@ error: `macro_export` attribute cannot be used at crate level
|
LL | #![macro_export]
| ^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[macro_export]
+LL - #![macro_export]
+LL + #[macro_export]
|
error: `rustc_main` attribute cannot be used at crate level
@@ -140,21 +144,29 @@ error: `rustc_main` attribute cannot be used at crate level
|
LL | #![rustc_main]
| ^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[rustc_main]
- | ~~~~~~~~~~~~~
+LL - #![rustc_main]
+LL + #[rustc_main]
+ |
error: `start` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1
|
LL | #![start]
| ^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[start]
+LL - #![start]
+LL + #[start]
|
error: `repr` attribute cannot be used at crate level
@@ -162,10 +174,14 @@ error: `repr` attribute cannot be used at crate level
|
LL | #![repr()]
| ^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[repr()]
+LL - #![repr()]
+LL + #[repr()]
|
error: `path` attribute cannot be used at crate level
@@ -173,10 +189,14 @@ error: `path` attribute cannot be used at crate level
|
LL | #![path = "3800"]
| ^^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[path = "3800"]
+LL - #![path = "3800"]
+LL + #[path = "3800"]
|
error: `automatically_derived` attribute cannot be used at crate level
@@ -184,122 +204,126 @@ error: `automatically_derived` attribute cannot be used at crate level
|
LL | #![automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[automatically_derived]
+LL - #![automatically_derived]
+LL + #[automatically_derived]
|
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:42:17
|
LL | mod inner { #![inline] }
| ------------^^^^^^^^^^-- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5
|
LL | #[inline] struct S;
| ^^^^^^^^^ --------- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:5
|
LL | #[inline] type T = S;
| ^^^^^^^^^ ----------- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:60:5
|
LL | #[inline] impl S { }
| ^^^^^^^^^ ---------- not a function or closure
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:64:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:70:17
|
LL | mod inner { #![no_link] }
| ------------^^^^^^^^^^^-- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:68:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:74:5
|
LL | #[no_link] fn f() { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:72:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:5
|
LL | #[no_link] struct S;
| ^^^^^^^^^^ --------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:76:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:5
|
LL | #[no_link]type T = S;
| ^^^^^^^^^^----------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:80:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:86:5
|
LL | #[no_link] impl S { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:17
|
LL | mod inner { #![export_name="2200"] }
| ------------^^^^^^^^^^^^^^^^^^^^^^-- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:5
|
LL | #[export_name = "2200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:100:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5
|
LL | #[export_name = "2200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:104:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:110:5
|
LL | #[export_name = "2200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:9
|
LL | #[export_name = "2200"] fn foo();
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:113:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:9
|
LL | #[export_name = "2200"] fn bar() {}
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:25
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:25
|
LL | mod inner { #![repr(C)] }
| --------------------^---- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12
|
LL | #[repr(C)] fn f() { }
| ^ ---------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:157:12
|
LL | #[repr(C)] type T = S;
| ^ ----------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:161:12
|
LL | #[repr(C)] impl S { }
| ^ ---------- not a struct, enum, or union
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr b/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
index ab1659173..1e47259cb 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `x3300` in this scope
--> $DIR/issue-43106-gating-of-derive-2.rs:9:14
@@ -21,6 +23,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `x3300` in this scope
--> $DIR/issue-43106-gating-of-derive-2.rs:4:14
@@ -33,6 +37,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
index 300a9966d..922c9861a 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
@@ -11,10 +11,14 @@ error: `test` attribute cannot be used at crate level
|
LL | #![test = "4200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test = "4200"]
+LL - #![test = "4200"]
+LL + #[test = "4200"]
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/fn/fn-trait-formatting.rs b/tests/ui/fn/fn-trait-formatting.rs
index 636ac7107..61a8791ab 100644
--- a/tests/ui/fn/fn-trait-formatting.rs
+++ b/tests/ui/fn/fn-trait-formatting.rs
@@ -17,5 +17,5 @@ fn main() {
//~| found struct `Box<dyn FnMut() -> isize>`
needs_fn(1);
- //~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}`
+ //~^ ERROR expected a `Fn(isize)` closure, found `{integer}`
}
diff --git a/tests/ui/fn/fn-trait-formatting.stderr b/tests/ui/fn/fn-trait-formatting.stderr
index 45d543bda..c5e2f4169 100644
--- a/tests/ui/fn/fn-trait-formatting.stderr
+++ b/tests/ui/fn/fn-trait-formatting.stderr
@@ -39,11 +39,11 @@ LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut
= note: expected unit type `()`
found struct `Box<dyn FnMut() -> isize>`
-error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
+error[E0277]: expected a `Fn(isize)` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
|
LL | needs_fn(1);
- | -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
+ | -------- ^ expected an `Fn(isize)` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
index 458756a3d..3f6401b9f 100644
--- a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
@@ -2,14 +2,16 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13
|
LL | impl<'a, T> Trait<'a> for T {
- | ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | -- ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
note: ...that is required by this bound
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18
|
LL | trait Trait<'a>: 'a {
| ^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a> for T {
| ++++
diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr
index 0955efdbb..28dbdf4c3 100644
--- a/tests/ui/for/issue-20605.next.stderr
+++ b/tests/ui/for/issue-20605.next.stderr
@@ -44,12 +44,6 @@ LL | for item in *things { *item = 0 }
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
-error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
- --> $DIR/issue-20605.rs:5:17
- |
-LL | for item in *things { *item = 0 }
- | ^^^^^^^
-
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
--> $DIR/issue-20605.rs:5:5
|
@@ -60,6 +54,12 @@ LL | for item in *things { *item = 0 }
note: required by a bound in `None`
--> $SRC_DIR/core/src/option.rs:LL:COL
+error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
+ --> $DIR/issue-20605.rs:5:17
+ |
+LL | for item in *things { *item = 0 }
+ | ^^^^^^^
+
error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
--> $DIR/issue-20605.rs:5:27
|
diff --git a/tests/ui/generator/async-generator-issue-67158.rs b/tests/ui/generator/async-generator-issue-67158.rs
deleted file mode 100644
index 8125a7a9b..000000000
--- a/tests/ui/generator/async-generator-issue-67158.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#![feature(generators)]
-// edition:2018
-// Regression test for #67158.
-fn main() {
- async { yield print!(":C") }; //~ ERROR `async` generators are not yet supported
-}
diff --git a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs b/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs
deleted file mode 100644
index 207c2735f..000000000
--- a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: --emit metadata
-#![feature(generators, generator_trait)]
-
-use std::marker::Unpin;
-use std::ops::Generator;
-
-pub fn g() -> impl Generator<(), Yield = (), Return = ()> {
- || {
- yield;
- }
-}
diff --git a/tests/ui/generator/auxiliary/xcrate-reachable.rs b/tests/ui/generator/auxiliary/xcrate-reachable.rs
deleted file mode 100644
index 2dd5ea675..000000000
--- a/tests/ui/generator/auxiliary/xcrate-reachable.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-fn msg() -> u32 {
- 0
-}
-
-pub fn foo() -> impl Generator<(), Yield=(), Return=u32> {
- || {
- yield;
- return msg();
- }
-}
diff --git a/tests/ui/generator/auxiliary/xcrate.rs b/tests/ui/generator/auxiliary/xcrate.rs
deleted file mode 100644
index d07abd091..000000000
--- a/tests/ui/generator/auxiliary/xcrate.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::marker::Unpin;
-use std::ops::Generator;
-
-pub fn foo() -> impl Generator<(), Yield = (), Return = ()> {
- || {
- if false {
- yield;
- }
- }
-}
-
-pub fn bar<T: 'static>(t: T) -> Box<Generator<(), Yield = T, Return = ()> + Unpin> {
- Box::new(|| {
- yield t;
- })
-}
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.rs b/tests/ui/generator/generator-yielding-or-returning-itself.rs
deleted file mode 100644
index 30788e3c1..000000000
--- a/tests/ui/generator/generator-yielding-or-returning-itself.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![feature(generator_trait)]
-#![feature(generators)]
-
-// Test that we cannot create a generator that returns a value of its
-// own type.
-
-use std::ops::Generator;
-
-pub fn want_cyclic_generator_return<T>(_: T)
- where T: Generator<Yield = (), Return = T>
-{
-}
-
-fn supply_cyclic_generator_return() {
- want_cyclic_generator_return(|| {
- //~^ ERROR type mismatch
- if false { yield None.unwrap(); }
- None.unwrap()
- })
-}
-
-pub fn want_cyclic_generator_yield<T>(_: T)
- where T: Generator<Yield = T, Return = ()>
-{
-}
-
-fn supply_cyclic_generator_yield() {
- want_cyclic_generator_yield(|| {
- //~^ ERROR type mismatch
- if false { yield None.unwrap(); }
- None.unwrap()
- })
-}
-
-fn main() { }
diff --git a/tests/ui/generator/issue-52304.rs b/tests/ui/generator/issue-52304.rs
deleted file mode 100644
index 3e9de765b..000000000
--- a/tests/ui/generator/issue-52304.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// check-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-pub fn example() -> impl Generator {
- || yield &1
-}
-
-fn main() {}
diff --git a/tests/ui/generator/issue-64620-yield-array-element.rs b/tests/ui/generator/issue-64620-yield-array-element.rs
deleted file mode 100644
index 2cbe8f516..000000000
--- a/tests/ui/generator/issue-64620-yield-array-element.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Regression test for #64620
-
-#![feature(generators)]
-
-pub fn crash(arr: [usize; 1]) {
- yield arr[0]; //~ ERROR: yield expression outside of generator literal
-}
-
-fn main() {}
diff --git a/tests/ui/generator/issue-87142.rs b/tests/ui/generator/issue-87142.rs
deleted file mode 100644
index 7f670919e..000000000
--- a/tests/ui/generator/issue-87142.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// compile-flags: -Cdebuginfo=2
-// build-pass
-
-// Regression test for #87142
-// This test needs the above flags and the "lib" crate type.
-
-#![feature(impl_trait_in_assoc_type, generator_trait, generators)]
-#![crate_type = "lib"]
-
-use std::ops::Generator;
-
-pub trait GeneratorProviderAlt: Sized {
- type Gen: Generator<(), Return = (), Yield = ()>;
-
- fn start(ctx: Context<Self>) -> Self::Gen;
-}
-
-pub struct Context<G: 'static + GeneratorProviderAlt> {
- pub link: Box<G::Gen>,
-}
-
-impl GeneratorProviderAlt for () {
- type Gen = impl Generator<(), Return = (), Yield = ()>;
- fn start(ctx: Context<Self>) -> Self::Gen {
- move || {
- match ctx {
- _ => (),
- }
- yield ();
- }
- }
-}
diff --git a/tests/ui/generator/nested_generators.rs b/tests/ui/generator/nested_generators.rs
deleted file mode 100644
index 45519150e..000000000
--- a/tests/ui/generator/nested_generators.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-fn main() {
- let _generator = || {
- let mut sub_generator = || {
- yield 2;
- };
-
- match Pin::new(&mut sub_generator).resume(()) {
- GeneratorState::Yielded(x) => {
- yield x;
- }
- _ => panic!(),
- };
- };
-}
diff --git a/tests/ui/generator/pin-box-generator.rs b/tests/ui/generator/pin-box-generator.rs
deleted file mode 100644
index c3136f5c0..000000000
--- a/tests/ui/generator/pin-box-generator.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-fn assert_generator<G: Generator>(_: G) {
-}
-
-fn main() {
- assert_generator(static || yield);
- assert_generator(Box::pin(static || yield));
-}
diff --git a/tests/ui/generator/sized-yield.rs b/tests/ui/generator/sized-yield.rs
deleted file mode 100644
index c6dd738d6..000000000
--- a/tests/ui/generator/sized-yield.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-use std::pin::Pin;
-
-fn main() {
- let s = String::from("foo");
- let mut gen = move || {
- //~^ ERROR the size for values of type
- yield s[..];
- };
- Pin::new(&mut gen).resume(());
- //~^ ERROR the size for values of type
-}
diff --git a/tests/ui/generator/sized-yield.stderr b/tests/ui/generator/sized-yield.stderr
deleted file mode 100644
index fb34540d9..000000000
--- a/tests/ui/generator/sized-yield.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/sized-yield.rs:8:26
- |
-LL | let mut gen = move || {
- | __________________________^
-LL | |
-LL | | yield s[..];
-LL | | };
- | |____^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `str`
- = note: the yield type of a generator must have a statically known size
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/sized-yield.rs:12:23
- |
-LL | Pin::new(&mut gen).resume(());
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `str`
-note: required by a bound in `GeneratorState`
- --> $SRC_DIR/core/src/ops/generator.rs:LL:COL
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/static-generators.rs b/tests/ui/generator/static-generators.rs
deleted file mode 100644
index d098bf1e6..000000000
--- a/tests/ui/generator/static-generators.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::pin::Pin;
-use std::ops::{Generator, GeneratorState};
-
-fn main() {
- let mut generator = static || {
- let a = true;
- let b = &a;
- yield;
- assert_eq!(b as *const _, &a as *const _);
- };
- // SAFETY: We shadow the original generator variable so have no safe API to
- // move it after this point.
- let mut generator = unsafe { Pin::new_unchecked(&mut generator) };
- assert_eq!(generator.as_mut().resume(()), GeneratorState::Yielded(()));
- assert_eq!(generator.as_mut().resume(()), GeneratorState::Complete(()));
-}
diff --git a/tests/ui/generator/too-many-parameters.rs b/tests/ui/generator/too-many-parameters.rs
deleted file mode 100644
index 7a353ea29..000000000
--- a/tests/ui/generator/too-many-parameters.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(generators)]
-
-fn main() {
- |(), ()| {
- //~^ error: too many parameters for a generator
- yield;
- };
-}
diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs
new file mode 100644
index 000000000..e2d51c664
--- /dev/null
+++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs
@@ -0,0 +1,18 @@
+// known-bug: #117606
+
+#![feature(associated_type_defaults)]
+
+trait Foo {
+ type Bar<T>: Baz<Self> = i32;
+ // We should be able to prove that `i32: Baz<Self>` because of
+ // the impl below, which requires that `Self::Bar<()>: Eq<i32>`
+ // which is true, because we assume `for<T> Self::Bar<T> = i32`.
+}
+
+trait Baz<T: ?Sized> {}
+impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
+
+trait Eq<T> {}
+impl<T> Eq<T> for T {}
+
+fn main() {}
diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr
new file mode 100644
index 000000000..abad0f25c
--- /dev/null
+++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr
@@ -0,0 +1,24 @@
+error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:30
+ |
+LL | type Bar<T>: Baz<Self> = i32;
+ | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`
+ |
+note: required for `i32` to implement `Baz<Self>`
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:13:23
+ |
+LL | impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
+ | ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here
+note: required by a bound in `Foo::Bar`
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:18
+ |
+LL | type Bar<T>: Baz<Self> = i32;
+ | ^^^^^^^^^ required by this bound in `Foo::Bar`
+help: consider further restricting the associated type
+ |
+LL | trait Foo where <Self as Foo>::Bar<()>: Eq<i32> {
+ | +++++++++++++++++++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.rs b/tests/ui/generic-associated-types/bugs/issue-100013.rs
index 973c548d7..b13b730d5 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.rs
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.rs
@@ -3,7 +3,7 @@
// edition: 2021
// We really should accept this, but we need implied bounds between the regions
-// in a generator interior.
+// in a coroutine interior.
pub trait FutureIterator {
type Future<'s, 'cx>: Send
@@ -12,21 +12,21 @@ pub trait FutureIterator {
}
fn call<I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'_, '_>>; // a type referencing GAT
async {}.await; // a yield point
}
}
fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
async {}.await; // a yield point
}
}
fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
async {}.await; // a yield point
}
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
index 93c69422f..ff82aebfe 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
@@ -1,7 +1,7 @@
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:15:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
@@ -12,7 +12,7 @@ LL | | }
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:22:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
@@ -27,7 +27,7 @@ LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
-LL | async { // a generator checked for autotrait impl `Send`
+LL | async { // a coroutine checked for autotrait impl `Send`
LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
| ^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'b`
|
@@ -36,7 +36,7 @@ LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:29:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
diff --git a/tests/ui/generic-associated-types/bugs/issue-91762.stderr b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
index 1272c8b8a..1045e80f0 100644
--- a/tests/ui/generic-associated-types/bugs/issue-91762.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
@@ -1,9 +1,10 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
--> $DIR/issue-91762.rs:24:15
|
LL | ret = <Self::Base as Functor>::fmap(arg);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap`
|
+ = note: cannot satisfy `<<Self as FunctorExt<T>>::Base as Functor>::With<_> == Self`
help: consider specifying the generic arguments
|
LL | ret = <Self::Base as Functor>::fmap::<T, U>(arg);
@@ -11,4 +12,4 @@ LL | ret = <Self::Base as Functor>::fmap::<T, U>(arg);
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
index fd54faaf3..9013d4295 100644
--- a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
+++ b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
@@ -12,6 +12,9 @@ LL | trait Foo {
LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead:
+ Fooy
+ Fooer<T>
error: aborting due to previous error
diff --git a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
index 499221637..7f535ec43 100644
--- a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
+++ b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
@@ -25,6 +25,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
LL | type Y<'a>;
| ^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
diff --git a/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs b/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs
new file mode 100644
index 000000000..5ef9437c9
--- /dev/null
+++ b/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs
@@ -0,0 +1,20 @@
+// check-pass
+
+trait Database: for<'r> HasValueRef<'r, Database = Self> {}
+
+trait HasValueRef<'r> {
+ type Database: Database;
+}
+
+struct Any;
+
+impl Database for Any {}
+
+impl<'r> HasValueRef<'r> for Any {
+ // Make sure we don't have issues when the GAT assumption
+ // `<Any as HasValue<'r>>::Database = Any` isn't universally
+ // parameterized over `'r`.
+ type Database = Any;
+}
+
+fn main() {}
diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
index f5502adee..c444ee9e1 100644
--- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
+++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
index 07452137b..2376bda81 100644
--- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
+++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68642-broken-llvm-ir.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.rs b/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
index 6050a8bf5..39db51c0e 100644
--- a/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
+++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
pub fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
index 31ded5dab..2429531e4 100644
--- a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
+++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68643-broken-mir.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs b/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
index 898cfa1e7..e379bce07 100644
--- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
+++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
index e2f9930cc..11221353a 100644
--- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
+++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68644-codegen-selection.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
index 60b065bfc..e69a08b0a 100644
--- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
+++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
index 0065368ad..52300efc2 100644
--- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
+++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68645-codegen-fulfillment.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68648-2.stderr b/tests/ui/generic-associated-types/issue-68648-2.stderr
index b2bef19eb..0514e7bd6 100644
--- a/tests/ui/generic-associated-types/issue-68648-2.stderr
+++ b/tests/ui/generic-associated-types/issue-68648-2.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-68648-2.rs:12:17
|
LL | fn bug<'a, T: Fun<F<'a> = T>>(t: T) -> T::F<'a> {
- | - this type parameter
+ | - expected this type parameter
LL | T::identity(())
| ----------- ^^ expected type parameter `T`, found `()`
| |
diff --git a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
index f0212e985..20c07db4c 100644
--- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
+++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
@@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/issue-68656-unsized-values.rs:13:21
|
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T {
- | - this type parameter
+ | - expected this type parameter
LL | type Item<'a> = T;
| ^ expected type parameter `T`, found associated type
|
diff --git a/tests/ui/generic-associated-types/issue-76535.base.stderr b/tests/ui/generic-associated-types/issue-76535.base.stderr
index 370329b9f..bb14e2971 100644
--- a/tests/ui/generic-associated-types/issue-76535.base.stderr
+++ b/tests/ui/generic-associated-types/issue-76535.base.stderr
@@ -28,6 +28,8 @@ LL | pub trait SuperTrait {
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
+ = help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead
+ = note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
error[E0038]: the trait `SuperTrait` cannot be made into an object
--> $DIR/issue-76535.rs:39:57
@@ -43,6 +45,8 @@ LL | pub trait SuperTrait {
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
+ = help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead
+ = note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
= note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/generic-associated-types/issue-79422.base.stderr b/tests/ui/generic-associated-types/issue-79422.base.stderr
index ad704f5e9..bcc6382cf 100644
--- a/tests/ui/generic-associated-types/issue-79422.base.stderr
+++ b/tests/ui/generic-associated-types/issue-79422.base.stderr
@@ -28,6 +28,9 @@ LL | trait MapLike<K, V> {
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
+ std::collections::BTreeMap<K, V>
+ Source
error[E0038]: the trait `MapLike` cannot be made into an object
--> $DIR/issue-79422.rs:44:13
@@ -43,6 +46,9 @@ LL | trait MapLike<K, V> {
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
+ std::collections::BTreeMap<K, V>
+ Source
= note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/generic-associated-types/issue-84931.rs b/tests/ui/generic-associated-types/issue-84931.rs
index 4123ce9d4..2ef990a7a 100644
--- a/tests/ui/generic-associated-types/issue-84931.rs
+++ b/tests/ui/generic-associated-types/issue-84931.rs
@@ -12,7 +12,8 @@ struct StreamingSliceIter<'a, T> {
impl<'b, T: 'b> StreamingIter for StreamingSliceIter<'b, T> {
type Item<'a> = &'a mut T;
- //~^ the parameter type
+ //~^ ERROR: the parameter type
+ //~| ERROR: does not fulfill the required lifetime
fn next(&mut self) -> Option<&mut T> {
loop {}
}
diff --git a/tests/ui/generic-associated-types/issue-84931.stderr b/tests/ui/generic-associated-types/issue-84931.stderr
index fffea98a4..04e14b9c7 100644
--- a/tests/ui/generic-associated-types/issue-84931.stderr
+++ b/tests/ui/generic-associated-types/issue-84931.stderr
@@ -2,10 +2,35 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-84931.rs:14:21
|
LL | type Item<'a> = &'a mut T;
- | ^^^^^^^^^- help: consider adding a where clause: `where T: 'a`
- | |
- | ...so that the reference type `&'a mut T` does not outlive the data it points at
+ | -- ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | type Item<'a> = &'a mut T where T: 'a;
+ | +++++++++++
+
+error[E0477]: the type `StreamingSliceIter<'b, T>` does not fulfill the required lifetime
+ --> $DIR/issue-84931.rs:14:21
+ |
+LL | type Item<'a> where Self: 'a;
+ | ------------- definition of `Item` from trait
+...
+LL | type Item<'a> = &'a mut T;
+ | ^^^^^^^^^
+ |
+note: type must outlive the lifetime `'a` as defined here
+ --> $DIR/issue-84931.rs:14:15
+ |
+LL | type Item<'a> = &'a mut T;
+ | ^^
+help: copy the `where` clause predicates from the trait
+ |
+LL | type Item<'a> = &'a mut T where Self: 'a;
+ | ++++++++++++++
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0309`.
+Some errors have detailed explanations: E0309, E0477.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/tests/ui/generic-associated-types/issue-86787.rs b/tests/ui/generic-associated-types/issue-86787.rs
index 96075ca50..5edd0a9f0 100644
--- a/tests/ui/generic-associated-types/issue-86787.rs
+++ b/tests/ui/generic-associated-types/issue-86787.rs
@@ -22,8 +22,8 @@ where
type T = Either<Left::T, Right::T>;
type TRef<'a> = Either<&'a Left::T, &'a Right::T>
where
- <Left as HasChildrenOf>::T: 'a,
- <Right as HasChildrenOf>::T: 'a;
+ <Left as HasChildrenOf>::T: 'a, //~ ERROR impl has stricter requirements than trait
+ <Right as HasChildrenOf>::T: 'a; //~ ERROR impl has stricter requirements than trait
fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>> {
todo!()
diff --git a/tests/ui/generic-associated-types/issue-86787.stderr b/tests/ui/generic-associated-types/issue-86787.stderr
index f34c63cf7..00795abbd 100644
--- a/tests/ui/generic-associated-types/issue-86787.stderr
+++ b/tests/ui/generic-associated-types/issue-86787.stderr
@@ -9,5 +9,24 @@ LL | type TRef<'a>;
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
-error: aborting due to previous error
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-86787.rs:25:37
+ |
+LL | type TRef<'a>;
+ | ------------- definition of `TRef` from trait
+...
+LL | <Left as HasChildrenOf>::T: 'a,
+ | ^^ impl has extra requirement `<Left as HasChildrenOf>::T: 'a`
+
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-86787.rs:26:38
+ |
+LL | type TRef<'a>;
+ | ------------- definition of `TRef` from trait
+...
+LL | <Right as HasChildrenOf>::T: 'a;
+ | ^^ impl has extra requirement `<Right as HasChildrenOf>::T: 'a`
+
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0276`.
diff --git a/tests/ui/generic-associated-types/issue-88360.stderr b/tests/ui/generic-associated-types/issue-88360.stderr
index 520aeff18..ad40ee180 100644
--- a/tests/ui/generic-associated-types/issue-88360.stderr
+++ b/tests/ui/generic-associated-types/issue-88360.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-88360.rs:15:9
|
LL | trait SuperTrait<T>
- | - this type parameter
+ | - found this type parameter
...
LL | fn copy(&self) -> Self::Gat<'_> where T: Copy {
| ------------- expected `&T` because of return type
diff --git a/tests/ui/generic-associated-types/issue-91139.stderr b/tests/ui/generic-associated-types/issue-91139.stderr
index d9d76adfb..89a4ba77e 100644
--- a/tests/ui/generic-associated-types/issue-91139.stderr
+++ b/tests/ui/generic-associated-types/issue-91139.stderr
@@ -9,6 +9,8 @@ error: `T` does not live long enough
|
LL | let _: for<'a> fn(<() as Foo<T>>::Type<'a>, &'a T) = |_, _| ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr
index 535edec57..1d7d80d1b 100644
--- a/tests/ui/generic-associated-types/missing-bounds.stderr
+++ b/tests/ui/generic-associated-types/missing-bounds.stderr
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:11:11
|
LL | impl<B> Add for A<B> where B: Add {
- | - this type parameter
+ | - expected this type parameter
...
LL | A(self.0 + rhs.0)
| - ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
@@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:21:14
|
LL | impl<B: Add> Add for C<B> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(self.0 + rhs.0)
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
@@ -80,7 +80,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:42:14
|
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(self.0 + rhs.0)
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
index 060ee8821..a3f3b1a6d 100644
--- a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
+++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
@@ -7,6 +7,7 @@ pub trait X {
impl X for () {
type Y<'a> = &'a ();
+ //~^ ERROR lifetime bound not satisfied
}
struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> {
diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
index a69cd0028..f73ed5956 100644
--- a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
+++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
@@ -12,44 +12,64 @@ LL | #![warn(unused_lifetimes)]
| ^^^^^^^^^^^^^^^^
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:14:8
|
LL | f: <T as X>::Y<'a>,
| ^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:12:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:13:10
|
LL | struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:18:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:19:8
|
LL | f: <T as X>::Y<'a>,
| ^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:17:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:18:10
|
LL | struct C<'a, T: X> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:23:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:24:8
|
LL | f: <() as X>::Y<'a>,
| ^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:22:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:23:10
|
LL | struct D<'a> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
-error: aborting due to 3 previous errors; 1 warning emitted
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:9:18
+ |
+LL | type Y<'a: 'static>;
+ | ------------------- definition of `Y` from trait
+...
+LL | type Y<'a> = &'a ();
+ | ^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime `'a` as defined here
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:9:12
+ |
+LL | type Y<'a> = &'a ();
+ | ^^
+ = note: but lifetime parameter must outlive the static lifetime
+help: copy the `where` clause predicates from the trait
+ |
+LL | type Y<'a> = &'a () where 'a: 'static;
+ | +++++++++++++++++
+
+error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0478`.
diff --git a/tests/ui/generic-const-items/inference-failure.stderr b/tests/ui/generic-const-items/inference-failure.stderr
index 22ff1b9ba..10ecd83ec 100644
--- a/tests/ui/generic-const-items/inference-failure.stderr
+++ b/tests/ui/generic-const-items/inference-failure.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/inference-failure.rs:8:9
|
LL | let _ = NONE;
- | ^
+ | ^ ---- type must be known at this point
|
help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
index 2cee53431..14894cef7 100644
--- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -17,6 +17,7 @@ LL | let () = K::<()>;
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
= help: the trait `From<!>` is implemented for `Infallible`
+ = help: for that trait implementation, expected `!`, found `()`
note: required by a bound in `K`
--> $DIR/unsatisfied-bounds.rs:12:17
|
@@ -48,6 +49,7 @@ LL | let _ = <() as Trait<&'static str>>::B::<()>;
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
= help: the trait `From<!>` is implemented for `Infallible`
+ = help: for that trait implementation, expected `!`, found `()`
note: required by a bound in `Trait::B`
--> $DIR/unsatisfied-bounds.rs:21:21
|
diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
index a73c03feb..48703186c 100644
--- a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
+++ b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -24,6 +24,7 @@ LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
|
= note: expected enum `Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
found enum `Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr b/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
index 9af6bc45c..8ab88c580 100644
--- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())`
--> $DIR/fn-ptr.rs:12:5
|
LL | ice();
- | ^^^ expected an `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+ | ^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())`
|
= help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())`
note: required by a bound in `ice`
diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
index 853160f96..adb19c035 100644
--- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
+++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
@@ -10,5 +10,5 @@ where
fn main() {
ice();
- //[classic]~^ ERROR expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+ //[classic]~^ ERROR expected a `Fn(&'w ())` closure, found `fn(&'w ())`
}
diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
index 46f5308dd..69c58c591 100644
--- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
@@ -15,6 +15,7 @@ LL | fn b() { want_foo2::<SomeStruct>(); }
|
= note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
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 2cc2bb2bb..7b0743cc7 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
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
+error[E0277]: expected a `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
--> $DIR/issue-62529-3.rs:25:14
|
LL | call(f, ());
- | ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
+ | ---- ^ expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index 5ed0d9fcf..e0dc13c0c 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,3 +1,3 @@
-thread 'main' panicked at library/alloc/src/raw_vec.rs:534:5:
+thread 'main' panicked at library/alloc/src/raw_vec.rs:545:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..6863a3c73
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
@@ -0,0 +1,25 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ step1::<'a, 'b>()
+ //~^ ERROR hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..168a5aa18
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hidden-erased-unsoundness.rs:16:5
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ | -- --------------- opaque type defined here
+ | |
+ | hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl Sized + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
new file mode 100644
index 000000000..4de2ffbb8
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
@@ -0,0 +1,32 @@
+// This test should never pass!
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+trait Swap: Sized {
+ fn swap(self, other: Self);
+}
+
+impl<T> Swap for Rc<RefCell<T>> {
+ fn swap(self, other: Self) {
+ <RefCell<T>>::swap(&self, &other);
+ }
+}
+
+fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ x
+ //~^ ERROR hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+}
+
+fn dangle() -> &'static [i32; 3] {
+ let long = Rc::new(RefCell::new(&[4, 5, 6]));
+ let x = [1, 2, 3];
+ let short = Rc::new(RefCell::new(&x));
+ hide(long.clone()).swap(hide(short));
+ let res: &'static [i32; 3] = *long.borrow();
+ res
+}
+
+fn main() {
+ println!("{:?}", dangle());
+}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
new file mode 100644
index 000000000..cabba4baf
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hide-lifetime-for-swap.rs:17:5
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ | -- -------------- opaque type defined here
+ | |
+ | hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
+LL | x
+ | ^
+ |
+help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..40efd941e
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
@@ -0,0 +1,28 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+mod tait {
+ type Tait<'a> = impl Sized + 'a;
+ pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ super::step1::<'a, 'b>()
+ //~^ ERROR hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ }
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ tait::step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..baeec6d58
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
@@ -0,0 +1,13 @@
+error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ --> $DIR/tait-hidden-erased-unsoundness.rs:18:9
+ |
+LL | type Tait<'a> = impl Sized + 'a;
+ | --------------- opaque type defined here
+LL | pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ | -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | super::step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
index 40446a3d3..d5086c7bc 100644
--- a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
+++ b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
@@ -7,7 +7,7 @@ LL | | &mut Header,
LL | | &mut [EntryMetadata],
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>]
LL | | ) -> R,
- | |__________- this type parameter
+ | |__________- expected this type parameter
LL | ) {
LL | let () = y;
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`
diff --git a/tests/ui/impl-trait/async_scope_creep.rs b/tests/ui/impl-trait/async_scope_creep.rs
index 7a9d64d33..60975439a 100644
--- a/tests/ui/impl-trait/async_scope_creep.rs
+++ b/tests/ui/impl-trait/async_scope_creep.rs
@@ -1,6 +1,7 @@
#![feature(type_alias_impl_trait)]
// edition:2021
// check-pass
+// revisions: tait rpit
struct Pending {}
@@ -12,17 +13,25 @@ impl AsyncRead for i32 {}
type PendingReader<'a> = impl AsyncRead + 'a;
-type OpeningReadFuture<'a> =
- impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
+#[cfg(tait)]
+type OpeningReadFuture<'a> = impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
impl Pending {
async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
Ok(42)
}
+ #[cfg(tait)]
fn read_fut(&mut self) -> OpeningReadFuture<'_> {
self.read()
}
+
+ #[cfg(rpit)]
+ fn read_fut(
+ &mut self,
+ ) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
+ self.read()
+ }
}
fn main() {}
diff --git a/tests/ui/impl-trait/auto-trait.stderr b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
index 81009413c..7833ac688 100644
--- a/tests/ui/impl-trait/auto-trait.stderr
+++ b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
- --> $DIR/auto-trait.rs:21:1
+ --> $DIR/auto-trait-coherence.rs:24:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
diff --git a/tests/ui/impl-trait/auto-trait-coherence.old.stderr b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
new file mode 100644
index 000000000..7833ac688
--- /dev/null
+++ b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
+ --> $DIR/auto-trait-coherence.rs:24:1
+ |
+LL | impl<T: Send> AnotherTrait for T {}
+ | -------------------------------- first implementation here
+...
+LL | impl AnotherTrait for D<OpaqueType> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/impl-trait/auto-trait.rs b/tests/ui/impl-trait/auto-trait-coherence.rs
index 35994e4a5..a5cd01a87 100644
--- a/tests/ui/impl-trait/auto-trait.rs
+++ b/tests/ui/impl-trait/auto-trait-coherence.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that type alias impls traits do not leak auto-traits for
// the purposes of coherence checking
#![feature(type_alias_impl_trait)]
diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs
index 1f90292f4..de4f523c2 100644
--- a/tests/ui/impl-trait/auto-trait-leak.rs
+++ b/tests/ui/impl-trait/auto-trait-leak.rs
@@ -9,8 +9,6 @@ fn main() {}
// independently resolved and only require the concrete
// return type, which can't depend on the obligation.
fn cycle1() -> impl Clone {
- //~^ ERROR cycle detected
- //~| ERROR cycle detected
send(cycle2().clone());
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 62341f6de..28643ec03 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -1,66 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-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: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 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 opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-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:19:1
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- = 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:20:10
+ --> $DIR/auto-trait-leak.rs:18:10
|
LL | send(cycle1().clone());
| ---- ^^^^^^^^^^^^^^^^
@@ -73,7 +12,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:19:4
+ --> $DIR/auto-trait-leak.rs:17:4
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^
@@ -83,6 +22,5 @@ note: required by a bound in `send`
LL | fn send<T: Send>(_: T) {}
| ^^^^ required by this bound in `send`
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/bivariant-lifetime-liveness.rs b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
new file mode 100644
index 000000000..fe99fe3f3
--- /dev/null
+++ b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
@@ -0,0 +1,15 @@
+// check-pass
+// issue: 116794
+
+// Uncaptured lifetimes should not be required to be live.
+
+struct Invariant<T>(*mut T);
+
+fn opaque<'a: 'a>(_: &'a str) -> Invariant<impl Sized> {
+ Invariant(&mut ())
+}
+
+fn main() {
+ let x = opaque(&String::new());
+ drop(x);
+}
diff --git a/tests/ui/impl-trait/bounds_regression.rs b/tests/ui/impl-trait/bounds_regression.rs
index 31fc46203..f32d83c0c 100644
--- a/tests/ui/impl-trait/bounds_regression.rs
+++ b/tests/ui/impl-trait/bounds_regression.rs
@@ -1,6 +1,6 @@
// run-pass
-pub trait FakeGenerator {
+pub trait FakeCoroutine {
type Yield;
type Return;
}
@@ -9,15 +9,15 @@ pub trait FakeFuture {
type Output;
}
-pub fn future_from_generator<
- T: FakeGenerator<Yield = ()>
+pub fn future_from_coroutine<
+ T: FakeCoroutine<Yield = ()>
>(x: T) -> impl FakeFuture<Output = T::Return> {
GenFuture(x)
}
-struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
+struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
-impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
+impl<T: FakeCoroutine<Yield = ()>> FakeFuture for GenFuture<T> {
type Output = T::Return;
}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.rs b/tests/ui/impl-trait/cross-return-site-inference.rs
index 00aed2ad9..e1071b08c 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.rs
+++ b/tests/ui/impl-trait/cross-return-site-inference.rs
@@ -36,13 +36,13 @@ fn muh() -> Result<(), impl std::fmt::Debug> {
fn muh2() -> Result<(), impl std::fmt::Debug> {
return Err(From::from("foo"));
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
Ok(())
}
fn muh3() -> Result<(), impl std::fmt::Debug> {
Err(From::from("foo"))
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
}
fn main() {}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.stderr b/tests/ui/impl-trait/cross-return-site-inference.stderr
index 766614e9e..8ee3e9abf 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.stderr
+++ b/tests/ui/impl-trait/cross-return-site-inference.stderr
@@ -9,28 +9,29 @@ help: consider specifying the generic arguments
LL | Ok::<(), E>(())
| +++++++++
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:38:12
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:38:16
|
LL | return Err(From::from("foo"));
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | return Err::<(), E>(From::from("foo"));
- | +++++++++
+LL | return Err(</* self type */ as From>::from("foo"));
+ | +++++++++++++++++++ +
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:44:5
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:44:9
|
LL | Err(From::from("foo"))
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | Err::<(), E>(From::from("foo"))
- | +++++++++
+LL | Err(</* self type */ as From>::from("foo"))
+ | +++++++++++++++++++ +
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0282, E0790.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
new file mode 100644
index 000000000..698123a93
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
@@ -0,0 +1,23 @@
+// revisions: current next
+// compile-flags: -Zverbose
+//[next] compile-flags: -Ztrait-solver=next
+// normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)"
+
+#![feature(rustc_attrs)]
+#![rustc_hidden_type_of_opaques]
+
+// Make sure that the compiler can handle `ReErased` in the hidden type of an opaque.
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+//~^ ERROR 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+// Can't write whole type because of lack of path sanitization
+ || ()
+}
+
+fn bar() -> impl Fn() + 'static {
+//~^ ERROR , [ReErased])
+// Can't write whole type because of lack of path sanitization
+ foo(&vec![])
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
index fad0b812d..d3c2d5d5b 100644
--- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
+++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
@@ -20,6 +20,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
@@ -33,6 +34,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
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
index e62662f2f..09fbef2ec 100644
--- a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
+++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
@@ -1,7 +1,6 @@
// compile-flags: --crate-type=lib
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![deny(refining_impl_trait)]
pub trait Tr<T> {
diff --git a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
index 2a61c5cc8..afb9992de 100644
--- a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
@@ -2,13 +2,13 @@
// edition: 2021
// issue: 113796
-#![feature(async_fn_in_trait)]
trait AsyncLendingIterator {
type Item<'a>
where
Self: 'a;
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item<'_>>;
}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
new file mode 100644
index 000000000..af6ffe833
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
@@ -0,0 +1,11 @@
+// edition:2021
+// https://github.com/rust-lang/rust/issues/117547
+
+trait T {}
+
+trait MyTrait {
+ async fn foo() -> &'static impl T;
+ //~^ ERROR the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
new file mode 100644
index 000000000..7c9028a8c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
@@ -0,0 +1,14 @@
+error[E0310]: the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+ --> $DIR/async-and-ret-ref.rs:7:5
+ |
+LL | async fn foo() -> &'static impl T;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<Self as MyTrait>::{opaque#0}` must be valid for the static lifetime...
+ | ...so that the reference type `&'static impl T` does not outlive the data it points at
+ |
+ = help: consider adding an explicit lifetime bound `<Self as MyTrait>::{opaque#0}: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index 6e9940211..a213994ff 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, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
index 3a93dfee5..41d5f0f64 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
@@ -1,6 +1,5 @@
// issue: 114146
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar<'other: 'a>() -> impl Sized + 'a {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
index 3a1f8f908..b0832eb33 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:20
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
@@ -14,7 +14,7 @@ LL | trait Foo<'a> {
| ++++
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:42
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
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 fbbbb8585..5ddc97f1a 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
@@ -1,6 +1,5 @@
// issue: 114145
-#![feature(return_position_impl_trait_in_trait)]
pub trait Iterable {
type Item<'a>
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 a5fb338ea..324eaa37a 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
@@ -1,5 +1,5 @@
error[E0276]: impl has stricter requirements than trait
- --> $DIR/bad-item-bound-within-rpitit.rs:16:13
+ --> $DIR/bad-item-bound-within-rpitit.rs:15:13
|
LL | type Item<'a>
| ------------- definition of `Item` from trait
@@ -13,7 +13,7 @@ LL | where Self: 'b;
| ~~~~~~~~~~~~~~
warning: impl trait in impl method signature does not match trait method signature
- --> $DIR/bad-item-bound-within-rpitit.rs:19:28
+ --> $DIR/bad-item-bound-within-rpitit.rs:18:28
|
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
| ----------------------------------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
index f5ee4690f..87eb7beb1 100644
--- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
+++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
struct TestA {}
struct TestB {}
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
index 742537ffc..2845b401b 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
struct Wrapper<G: Send>(G);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
index dee87d082..1570b2ecd 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
@@ -1,12 +1,12 @@
error[E0277]: `impl Sized` cannot be sent between threads safely
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:6:17
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:4:17
|
LL | fn bar() -> Wrapper<impl Sized>;
| ^^^^^^^^^^^^^^^^^^^ `impl Sized` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `impl Sized`
note: required by a bound in `Wrapper`
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:3:19
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:1:19
|
LL | struct Wrapper<G: Send>(G);
| ^^^^ required by this bound in `Wrapper`
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 fc290f11f..8c9927438 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub struct Wrapper<T>(T);
diff --git a/tests/ui/impl-trait/in-trait/deep-match.rs b/tests/ui/impl-trait/in-trait/deep-match.rs
index 0cae88f34..82eac7760 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct Wrapper<T>(T);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/deep-match.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr
index f0ad3c16e..a658d8fa0 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.stderr
+++ b/tests/ui/impl-trait/in-trait/deep-match.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible return type for trait
- --> $DIR/deep-match.rs:11:17
+ --> $DIR/deep-match.rs:8:17
|
LL | fn bar() -> i32 {
| ^^^
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
index 45ae2b8ad..29bcbe16d 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
@@ -1,7 +1,6 @@
// edition:2021
#![allow(incomplete_features)]
-#![feature(async_fn_in_trait)]
pub trait Foo {
async fn woopsie_async(&self) -> String {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index cc3bdf0e5..fcace10cd 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/default-body-type-err-2.rs:8:9
+ --> $DIR/default-body-type-err-2.rs:7:9
|
LL | 42
| ^^- help: try using a conversion method: `.to_string()`
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
index ac9baf91c..ac7a50a36 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
@@ -1,6 +1,3 @@
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
use std::ops::Deref;
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
index 4742eb37d..596ff1011 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
@@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String`
- --> $DIR/default-body-type-err.rs:7:22
+ --> $DIR/default-body-type-err.rs:4:22
|
LL | fn lol(&self) -> impl Deref<Target = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
index 25133214d..1d1f55508 100644
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
@@ -1,12 +1,12 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> impl Debug {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-body.rs b/tests/ui/impl-trait/in-trait/default-body.rs
index b0baf5bb1..ff70f1e23 100644
--- a/tests/ui/impl-trait/in-trait/default-body.rs
+++ b/tests/ui/impl-trait/in-trait/default-body.rs
@@ -1,12 +1,12 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &str {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
index 817a4d7db..ca41eb8bc 100644
--- a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
index 28d76241f..8ab2e2797 100644
--- a/tests/ui/impl-trait/in-trait/default-method-constraint.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
@@ -2,7 +2,6 @@
// This didn't work in the previous default RPITIT method hack attempt
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar(x: bool) -> impl Sized {
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
index bb4e0d44f..0ac60918b 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Foo {
fn bar() -> impl std::fmt::Display;
}
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
index 7c56ffa10..cd45c6a9c 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/doesnt-satisfy.rs:9:17
+ --> $DIR/doesnt-satisfy.rs:6:17
|
LL | fn bar() -> () {}
| ^^ `()` cannot be formatted with the default formatter
@@ -7,7 +7,7 @@ LL | fn bar() -> () {}
= 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
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/doesnt-satisfy.rs:5:22
+ --> $DIR/doesnt-satisfy.rs:2:22
|
LL | fn bar() -> impl std::fmt::Display;
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
index 4719d5d3c..fe0f011b6 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait MyTrait {
fn foo(&self) -> impl Sized;
fn bar(&self) -> impl Sized;
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
index 66ee142cc..830e663da 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/dont-project-to-rpitit-with-no-value.rs:8:1
+ --> $DIR/dont-project-to-rpitit-with-no-value.rs:6:1
|
LL | fn foo(&self) -> impl Sized;
| ---------------------------- `foo` from trait
diff --git a/tests/ui/impl-trait/in-trait/early.rs b/tests/ui/impl-trait/in-trait/early.rs
index 9c1c2b503..c4996674d 100644
--- a/tests/ui/impl-trait/in-trait/early.rs
+++ b/tests/ui/impl-trait/in-trait/early.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn bar<'a: 'a>(&'a mut self);
}
diff --git a/tests/ui/impl-trait/in-trait/encode.rs b/tests/ui/impl-trait/in-trait/encode.rs
index efb9f6498..4df26b0f2 100644
--- a/tests/ui/impl-trait/in-trait/encode.rs
+++ b/tests/ui/impl-trait/in-trait/encode.rs
@@ -1,7 +1,6 @@
// build-pass
// compile-flags: --crate-type=lib
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
index bfb2be8cb..f29ec95d5 100644
--- a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
+++ b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
@@ -9,6 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
LL | fn bar(self) -> impl Deref<Target = impl Sized>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type
+ = help: only type `rpitit::Foreign` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.rs b/tests/ui/impl-trait/in-trait/gat-outlives.rs
new file mode 100644
index 000000000..83dd6cfce
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+use std::future::Future;
+
+trait Trait {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> Self::Gat<'_>;
+}
+
+trait Trait2 {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> impl Future<Output = Self::Gat<'_>>;
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.stderr b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
new file mode 100644
index 000000000..8ec4b0ab2
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
@@ -0,0 +1,24 @@
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:6:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:12:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.rs b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
index cc0fc720e..3ea31cc93 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct U;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
index cd42683e0..043dbc8db 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/generics-mismatch.rs:11:12
+ --> $DIR/generics-mismatch.rs:8:12
|
LL | fn bar(&self) -> impl Sized;
| - expected 0 type parameters
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.rs b/tests/ui/impl-trait/in-trait/issue-102140.rs
index be1e012ac..796001848 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102140.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Marker {}
impl Marker for u32 {}
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 18bb63745..9cd2cdfd1 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:22
+ --> $DIR/issue-102140.rs:20:22
|
LL | MyTrait::foo(&self)
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -13,7 +13,7 @@ LL + MyTrait::foo(self)
|
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -21,7 +21,7 @@ LL | MyTrait::foo(&self)
= help: the trait `MyTrait` is implemented for `Outer`
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
diff --git a/tests/ui/impl-trait/in-trait/issue-102301.rs b/tests/ui/impl-trait/in-trait/issue-102301.rs
index a93714a65..600a21b07 100644
--- a/tests/ui/impl-trait/in-trait/issue-102301.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102301.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo<T> {
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index ccb53031c..4fa3fdd31 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index 594b9ae9c..872988faf 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:12:9
+ --> $DIR/issue-102571.rs:9: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
index 49d36d6c9..4073ef8ac 100644
--- 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
@@ -1,6 +1,6 @@
// check-pass
-#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
+#![feature(associated_type_bounds)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
index 239c4b35c..874a1b95a 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
@@ -1,15 +1,15 @@
error[E0053]: method `early` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:58:27
+ --> $DIR/method-signature-matches.rs:57:27
|
LL | fn early<'late, T>(_: &'late ()) {}
| - ^^^^^^^^^
| | |
| | expected type parameter `T`, found `()`
| | help: change the parameter type to match the trait: `&T`
- | this type parameter
+ | expected this type parameter
|
note: type in trait
- --> $DIR/method-signature-matches.rs:53:28
+ --> $DIR/method-signature-matches.rs:52:28
|
LL | fn early<'early, T>(x: &'early T) -> impl Sized;
| ^^^^^^^^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
index d3183b92e..e0bd1cc4f 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:14:15
+ --> $DIR/method-signature-matches.rs:13:15
|
LL | fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:9:15
+ --> $DIR/method-signature-matches.rs:8:15
|
LL | fn owo(x: ()) -> impl Sized;
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
index 80fda1c9f..096e96c85 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:25:21
+ --> $DIR/method-signature-matches.rs:24:21
|
LL | async fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | async fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:20:21
+ --> $DIR/method-signature-matches.rs:19:21
|
LL | async fn owo(x: ()) {}
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.rs b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
index 294f93b30..99ace66fa 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.rs
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
@@ -1,7 +1,6 @@
// edition: 2021
// revisions: mismatch mismatch_async too_many too_few lt
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![allow(incomplete_features)]
#[cfg(mismatch)]
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
index 24bcfeb74..96eff1a58 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
- --> $DIR/method-signature-matches.rs:47:5
+ --> $DIR/method-signature-matches.rs:46:5
|
LL | fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
| ---------------- trait requires 3 parameters
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
index 616cbd290..0fc847051 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
- --> $DIR/method-signature-matches.rs:36:28
+ --> $DIR/method-signature-matches.rs:35:28
|
LL | fn calm_down_please() -> impl Sized;
| ------------------------------------ trait requires 0 parameters
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
index abc845d3a..6088dcc61 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Iterable {
type Item<'a>
where
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
index 0d74c0b69..1fd678a1f 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'missing`
- --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55
+ --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:55
|
LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
| ^^^^^^^^ undeclared lifetime
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
new file mode 100644
index 000000000..b97fd7d1f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+use std::ops::Deref;
+
+trait Foo {
+ fn foo() -> impl Deref<Target = impl Deref<Target = impl Sized>> {
+ &&()
+ }
+}
+
+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 58ba1acaf..58b79c991 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
index f221cfbb1..35afe80c9 100644
--- a/tests/ui/impl-trait/in-trait/object-safety-sized.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
@@ -2,7 +2,6 @@
// 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();
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index d1c9fba4e..5cca4ad83 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 0170dc5d0..a7be0516c 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -1,62 +1,66 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:33
+ --> $DIR/object-safety.rs:14:33
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^ `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
+ --> $DIR/object-safety.rs:4: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
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:15
+ --> $DIR/object-safety.rs:17: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
+ --> $DIR/object-safety.rs:4: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
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:13
+ --> $DIR/object-safety.rs:17:13
|
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
+ --> $DIR/object-safety.rs:4: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
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:13
+ --> $DIR/object-safety.rs:14:13
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^^^^^ `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
+ --> $DIR/object-safety.rs:4: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
+ = help: only type `u32` implements the trait, consider using it directly instead
= note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
error: aborting due to 4 previous errors
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
index 3ac264e8e..1f18bb3b7 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
index 15edda483..e260762d8 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/opaque-in-impl-is-opaque.rs:17:19
+ --> $DIR/opaque-in-impl-is-opaque.rs:14:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
index 2e0662969..3edd588a1 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/in-trait/opaque-variances.rs b/tests/ui/impl-trait/in-trait/opaque-variances.rs
new file mode 100644
index 000000000..60bfab0de
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/opaque-variances.rs
@@ -0,0 +1,14 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Sized {
+ ()
+}
+
+fn main() {
+ // in NLL, we want to make sure that the `'a` subst of `foo` does not get
+ // related between `x` and the RHS of the assignment. That would require
+ // that the temp is live for the lifetime of the variable `x`, which of
+ // course is not necessary since `'a` is not captured by the RPIT.
+ let x = foo(&Vec::new());
+}
diff --git a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
index 6330242ce..317ff7fe8 100644
--- a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn early<'a, T: 'a>(x: &'a T) -> impl Iterator<Item = impl Into<&'a T>>;
diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs
index a91f9b3e7..100e6da06 100644
--- a/tests/ui/impl-trait/in-trait/refine.rs
+++ b/tests/ui/impl-trait/in-trait/refine.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![deny(refining_impl_trait)]
pub trait Foo {
@@ -45,4 +44,15 @@ impl Late for D {
//~^ ERROR impl method signature does not match trait method signature
}
+mod unreachable {
+ pub trait UnreachablePub {
+ fn bar() -> impl Sized;
+ }
+
+ struct E;
+ impl UnreachablePub for E {
+ fn bar() {}
+ }
+}
+
fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
index 29aa08e25..96a9bc059 100644
--- a/tests/ui/impl-trait/in-trait/refine.stderr
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -1,5 +1,5 @@
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:10:22
+ --> $DIR/refine.rs:9:22
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -9,7 +9,7 @@ LL | fn bar() -> impl Copy {}
|
= 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
+ --> $DIR/refine.rs:1:9
|
LL | #![deny(refining_impl_trait)]
| ^^^^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:16:5
+ --> $DIR/refine.rs:15:5
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -30,11 +30,11 @@ 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 {}
- | +++++++++++++
+LL | fn bar()-> impl Sized {}
+ | +++++++++++++
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:22:17
+ --> $DIR/refine.rs:21:17
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -49,7 +49,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:44:27
+ --> $DIR/refine.rs:43:27
|
LL | fn bar<'a>(&'a self) -> impl Sized + 'a;
| --------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
index 5d9a224cc..ad73b12fe 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo<T> {
fn foo<F2>(self) -> impl Foo<T>;
}
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
index 668fc6cbe..181d6a284 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
@@ -1,12 +1,12 @@
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
- --> $DIR/return-dont-satisfy-bounds.rs:10:34
+ --> $DIR/return-dont-satisfy-bounds.rs:8:34
|
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
|
= help: the trait `Foo<char>` is implemented for `Bar`
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/return-dont-satisfy-bounds.rs:4:30
+ --> $DIR/return-dont-satisfy-bounds.rs:2:30
|
LL | fn foo<F2>(self) -> impl Foo<T>;
| ^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index b1b46d75b..cc78ce8fe 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
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
index 5e14a7f8e..37b0b2297 100644
--- 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
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str);
}
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
index 1d947310e..afc59cc5b 100644
--- 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
@@ -1,12 +1,12 @@
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
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6: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
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:15
|
LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
| ^^
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
index c1885af4e..bacd50077 100644
--- 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
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend(_: &str) -> (impl Sized + '_, &'static str);
}
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
index 7b63e72ac..7e1a8f083 100644
--- 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
@@ -1,12 +1,12 @@
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
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6: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
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:18
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
| ^^^^
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 44a2b4303..b9fe8d8bf 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, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
new file mode 100644
index 000000000..fe162e6cf
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
@@ -0,0 +1,21 @@
+// Checks that a sibling function (i.e. `foo`) cannot constrain
+// an RPITIT from another function (`bar`).
+
+trait Trait {
+ fn foo();
+
+ fn bar() -> impl Sized;
+}
+
+impl Trait for () {
+ fn foo() {
+ let _: String = Self::bar();
+ //~^ ERROR mismatched types
+ }
+
+ fn bar() -> impl Sized {
+ loop {}
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
new file mode 100644
index 000000000..729963a81
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+ --> $DIR/sibling-function-constraint.rs:12:25
+ |
+LL | let _: String = Self::bar();
+ | ------ ^^^^^^^^^^^ expected `String`, found opaque type
+ | |
+ | expected due to this
+...
+LL | fn bar() -> impl Sized {
+ | ---------- the found opaque type
+ |
+ = note: expected struct `String`
+ found opaque type `impl Sized`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 685c0f06e..d85ee5fc7 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -2,7 +2,7 @@
// revisions: success failure
//[success] check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::future::Future;
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs
index 2fcffdf3f..a06cd814f 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs
@@ -2,7 +2,6 @@
// But we fixed an ICE anyways.
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
index dc621d6b8..25c0adedd 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
@@ -1,8 +1,8 @@
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/specialization-broken.rs:16:22
+ --> $DIR/specialization-broken.rs:15:22
|
LL | default impl<U> Foo for U
- | - this type parameter
+ | - found this type parameter
...
LL | fn bar(&self) -> U {
| ^
@@ -11,7 +11,7 @@ LL | fn bar(&self) -> U {
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
- --> $DIR/specialization-broken.rs:9:22
+ --> $DIR/specialization-broken.rs:8:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
@@ -19,12 +19,12 @@ LL | fn bar(&self) -> impl Sized;
found signature `fn(&U) -> U`
error: method with return-position `impl Trait` in trait cannot be specialized
- --> $DIR/specialization-broken.rs:16:5
+ --> $DIR/specialization-broken.rs:15:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
|
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed
+ = note: specialization behaves in inconsistent and surprising ways with return position `impl Trait` in traits, and for now is disallowed
error: aborting due to 2 previous errors
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 41fc28588..053866327 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,7 +1,7 @@
// check-pass
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 7d415ea17..eb2349feb 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
index d9f775a6c..8dc8e045d 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
index 26979b514..30b04d87b 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
index 44f98896e..cec94e39a 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
@@ -1,15 +1,15 @@
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz`
- --> $DIR/suggest-missing-item.rs:18:1
+ --> $DIR/suggest-missing-item.rs:19:1
|
LL | async fn foo();
| --------------- `foo` from trait
-LL |
+...
LL | async fn bar() -> i32;
| ---------------------- `bar` from trait
LL |
LL | fn test(&self) -> impl Sized + '_;
| ---------------------------------- `test` from trait
-LL |
+...
LL | async fn baz(&self) -> &i32;
| ---------------------------- `baz` from trait
...
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
index 0bbe50ea6..d9fac0238 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct S;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
index 8ff54cad9..2836e9c78 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/trait-more-generics-than-impl.rs:11:11
+ --> $DIR/trait-more-generics-than-impl.rs:8:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
index 07c8606f9..ff3753de5 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo {
fn test() -> impl Sized;
}
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
index cfce35567..61a0f8454 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
@@ -1,5 +1,5 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- --> $DIR/unconstrained-lt.rs:7:6
+ --> $DIR/unconstrained-lt.rs:5:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
index f8e4ab88c..65565dcc2 100644
--- a/tests/ui/impl-trait/in-trait/variance.rs
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, return_position_impl_trait_in_trait)]
+#![feature(rustc_attrs)]
#![allow(internal_features)]
#![rustc_variance_of_opaques]
diff --git a/tests/ui/impl-trait/in-trait/variances-of-gat.rs b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
index 0d19e1ff4..aabb6f830 100644
--- a/tests/ui/impl-trait/in-trait/variances-of-gat.rs
+++ b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {}
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs
index ee873f94b..f1e372b19 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs
@@ -1,6 +1,5 @@
// issue #101663
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
index 4d60b1330..c20df9b40 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:15:22
+ --> $DIR/wf-bounds.rs:14:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -9,14 +9,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:18:23
+ --> $DIR/wf-bounds.rs:17:23
|
LL | fn nya2() -> impl Wf<[u8]>;
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Wf`
- --> $DIR/wf-bounds.rs:8:10
+ --> $DIR/wf-bounds.rs:7:10
|
LL | trait Wf<T> {
| ^ required by this bound in `Wf`
@@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> {
| ++++++++
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:21:44
+ --> $DIR/wf-bounds.rs:20:44
|
LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -36,14 +36,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: `T` doesn't implement `std::fmt::Display`
- --> $DIR/wf-bounds.rs:24:26
+ --> $DIR/wf-bounds.rs:23:26
|
LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
| ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `NeedsDisplay`
- --> $DIR/wf-bounds.rs:12:24
+ --> $DIR/wf-bounds.rs:11:24
|
LL | struct NeedsDisplay<T: Display>(T);
| ^^^^^^^ required by this bound in `NeedsDisplay`
diff --git a/tests/ui/impl-trait/in-trait/where-clause.rs b/tests/ui/impl-trait/in-trait/where-clause.rs
index 87bac519c..f7f4980b7 100644
--- a/tests/ui/impl-trait/in-trait/where-clause.rs
+++ b/tests/ui/impl-trait/in-trait/where-clause.rs
@@ -1,7 +1,6 @@
// check-pass
// edition: 2021
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr
index 3e70f1cf8..b5b7f293a 100644
--- a/tests/ui/impl-trait/issue-55872-2.stderr
+++ b/tests/ui/impl-trait/issue-55872-2.stderr
@@ -9,6 +9,8 @@ error: type parameter `T` is part of concrete type but not used in parameter lis
|
LL | async {}
| ^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/issues/issue-54600.rs b/tests/ui/impl-trait/issues/issue-54600.rs
index 3024fedf7..ccf276701 100644
--- a/tests/ui/impl-trait/issues/issue-54600.rs
+++ b/tests/ui/impl-trait/issues/issue-54600.rs
@@ -2,6 +2,6 @@ use std::fmt::Debug;
fn main() {
let x: Option<impl Debug> = Some(44_u32);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
println!("{:?}", x);
}
diff --git a/tests/ui/impl-trait/issues/issue-54600.stderr b/tests/ui/impl-trait/issues/issue-54600.stderr
index 7ef063af9..9a8e3675b 100644
--- a/tests/ui/impl-trait/issues/issue-54600.stderr
+++ b/tests/ui/impl-trait/issues/issue-54600.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54600.rs:4:19
|
LL | let x: Option<impl Debug> = Some(44_u32);
diff --git a/tests/ui/impl-trait/issues/issue-54840.rs b/tests/ui/impl-trait/issues/issue-54840.rs
index 8f1e0ece0..910d23f1d 100644
--- a/tests/ui/impl-trait/issues/issue-54840.rs
+++ b/tests/ui/impl-trait/issues/issue-54840.rs
@@ -3,5 +3,5 @@ use std::ops::Add;
fn main() {
let i: i32 = 0;
let j: &impl Add = &i;
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-54840.stderr b/tests/ui/impl-trait/issues/issue-54840.stderr
index 1d1316f0e..67cabf449 100644
--- a/tests/ui/impl-trait/issues/issue-54840.stderr
+++ b/tests/ui/impl-trait/issues/issue-54840.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54840.rs:5:13
|
LL | let j: &impl Add = &i;
diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs
index e5865d0df..03b51ae92 100644
--- a/tests/ui/impl-trait/issues/issue-58504.rs
+++ b/tests/ui/impl-trait/issues/issue-58504.rs
@@ -1,12 +1,12 @@
-#![feature(generators, generator_trait, never_type)]
+#![feature(coroutines, coroutine_trait, never_type)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn mk_gen() -> impl Generator<Return=!, Yield=()> {
+fn mk_gen() -> impl Coroutine<Return=!, Yield=()> {
|| { loop { yield; } }
}
fn main() {
- let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
- //~^ `impl Trait` only allowed in function and inherent method return types
+ let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-58504.stderr b/tests/ui/impl-trait/issues/issue-58504.stderr
index 26ec2a4f9..49376f559 100644
--- a/tests/ui/impl-trait/issues/issue-58504.stderr
+++ b/tests/ui/impl-trait/issues/issue-58504.stderr
@@ -1,7 +1,7 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58504.rs:10:16
|
-LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+LL | let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/issues/issue-58956.rs b/tests/ui/impl-trait/issues/issue-58956.rs
index 68cfcd9ba..5d5566860 100644
--- a/tests/ui/impl-trait/issues/issue-58956.rs
+++ b/tests/ui/impl-trait/issues/issue-58956.rs
@@ -5,9 +5,9 @@ impl Lam for B {}
pub struct Wrap<T>(T);
const _A: impl Lam = {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let x: Wrap<impl Lam> = Wrap(B);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
x.0
};
diff --git a/tests/ui/impl-trait/issues/issue-58956.stderr b/tests/ui/impl-trait/issues/issue-58956.stderr
index 2b4d0abdf..5ee33352a 100644
--- a/tests/ui/impl-trait/issues/issue-58956.stderr
+++ b/tests/ui/impl-trait/issues/issue-58956.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-58956.rs:7:11
|
LL | const _A: impl Lam = {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58956.rs:9:17
|
LL | let x: Wrap<impl Lam> = Wrap(B);
diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr
index d872291c8..8d969e8e0 100644
--- a/tests/ui/impl-trait/issues/issue-62742.stderr
+++ b/tests/ui/impl-trait/issues/issue-62742.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
LL | WrongImpl::foo(0i32);
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
@@ -42,7 +42,8 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
LL | WrongImpl::<()>::foo(0i32);
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[()]>` is implemented for `RawImpl<()>`
+ = help: for that trait implementation, expected `[()]`, found `()`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
diff --git a/tests/ui/impl-trait/issues/issue-70971.rs b/tests/ui/impl-trait/issues/issue-70971.rs
index f8ae18bac..c24259a71 100644
--- a/tests/ui/impl-trait/issues/issue-70971.rs
+++ b/tests/ui/impl-trait/issues/issue-70971.rs
@@ -1,4 +1,4 @@
fn main() {
let x : (impl Copy,) = (true,);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-70971.stderr b/tests/ui/impl-trait/issues/issue-70971.stderr
index d066256bf..5609f8b9b 100644
--- a/tests/ui/impl-trait/issues/issue-70971.stderr
+++ b/tests/ui/impl-trait/issues/issue-70971.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-70971.rs:2:14
|
LL | let x : (impl Copy,) = (true,);
diff --git a/tests/ui/impl-trait/issues/issue-79099.rs b/tests/ui/impl-trait/issues/issue-79099.rs
index da53594f3..22c66491c 100644
--- a/tests/ui/impl-trait/issues/issue-79099.rs
+++ b/tests/ui/impl-trait/issues/issue-79099.rs
@@ -1,7 +1,7 @@
struct Bug {
V1: [(); {
let f: impl core::future::Future<Output = u8> = async { 1 };
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
//~| expected identifier
1
}],
diff --git a/tests/ui/impl-trait/issues/issue-79099.stderr b/tests/ui/impl-trait/issues/issue-79099.stderr
index 580250a62..82fc03c61 100644
--- a/tests/ui/impl-trait/issues/issue-79099.stderr
+++ b/tests/ui/impl-trait/issues/issue-79099.stderr
@@ -9,7 +9,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-79099.rs:3:16
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
index 344f35952..3224145bf 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
@@ -1,8 +1,8 @@
struct Foo<T = impl Copy>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// should not cause ICE
fn x() -> Foo {
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
index 656bd0470..56be4577d 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16
|
LL | struct Foo<T = impl Copy>(T);
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20
|
LL | type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr
index 3c39aa6ce..b4be16ff0 100644
--- a/tests/ui/impl-trait/issues/issue-84073.stderr
+++ b/tests/ui/impl-trait/issues/issue-84073.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
--> $DIR/issue-84073.rs:32:16
|
LL | Race::new(|race| race.when());
- | ^^^^
+ | ^^^^ ---- type must be known at this point
|
help: consider giving this closure parameter an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/impl-trait/issues/issue-84919.rs b/tests/ui/impl-trait/issues/issue-84919.rs
index a0b73743a..77d27d7c0 100644
--- a/tests/ui/impl-trait/issues/issue-84919.rs
+++ b/tests/ui/impl-trait/issues/issue-84919.rs
@@ -3,7 +3,7 @@ impl Trait for () {}
fn foo<'a: 'a>() {
let _x: impl Trait = ();
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
fn main() {}
diff --git a/tests/ui/impl-trait/issues/issue-84919.stderr b/tests/ui/impl-trait/issues/issue-84919.stderr
index 36010fdef..20b131b8b 100644
--- a/tests/ui/impl-trait/issues/issue-84919.stderr
+++ b/tests/ui/impl-trait/issues/issue-84919.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-84919.rs:5:13
|
LL | let _x: impl Trait = ();
diff --git a/tests/ui/impl-trait/issues/issue-86642.rs b/tests/ui/impl-trait/issues/issue-86642.rs
index e6e957714..49f8944ac 100644
--- a/tests/ui/impl-trait/issues/issue-86642.rs
+++ b/tests/ui/impl-trait/issues/issue-86642.rs
@@ -1,5 +1,5 @@
static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let res = (move |source| Ok(source))(source);
let res = res.or((move |source| Ok(source))(source));
res
diff --git a/tests/ui/impl-trait/issues/issue-86642.stderr b/tests/ui/impl-trait/issues/issue-86642.stderr
index b6f8a54f3..6d3be3fff 100644
--- a/tests/ui/impl-trait/issues/issue-86642.stderr
+++ b/tests/ui/impl-trait/issues/issue-86642.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-86642.rs:1:11
|
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
diff --git a/tests/ui/impl-trait/issues/issue-87295.rs b/tests/ui/impl-trait/issues/issue-87295.rs
index aeb8f8332..eb44020ac 100644
--- a/tests/ui/impl-trait/issues/issue-87295.rs
+++ b/tests/ui/impl-trait/issues/issue-87295.rs
@@ -14,5 +14,5 @@ impl<F> Struct<F> {
fn main() {
let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-87295.stderr b/tests/ui/impl-trait/issues/issue-87295.stderr
index ec59b719c..3fe4ee73c 100644
--- a/tests/ui/impl-trait/issues/issue-87295.stderr
+++ b/tests/ui/impl-trait/issues/issue-87295.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-87295.rs:16:31
|
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
diff --git a/tests/ui/impl-trait/lifetimes.rs b/tests/ui/impl-trait/lifetimes.rs
index 9a9843375..f853117a9 100644
--- a/tests/ui/impl-trait/lifetimes.rs
+++ b/tests/ui/impl-trait/lifetimes.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(warnings)]
-#![feature(generators)]
+#![feature(coroutines)]
use std::fmt::Debug;
@@ -114,7 +114,7 @@ impl<'unnecessary_lifetime> MyVec {
self.0.iter().flat_map(|inner_vec| inner_vec.iter())
}
- fn generator_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
+ fn coroutine_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
|| yield
}
}
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 33b48b1e9..c60fe08c5 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
@@ -117,9 +117,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:43:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn ty_param_wont_outlive_static<T:Debug + 'static>(x: T) -> impl Debug + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/negative-reasoning.stderr b/tests/ui/impl-trait/negative-reasoning.stderr
index 6b8cc9e73..ddce5e7ec 100644
--- a/tests/ui/impl-trait/negative-reasoning.stderr
+++ b/tests/ui/impl-trait/negative-reasoning.stderr
@@ -7,7 +7,7 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
- = note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
+ = note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `OpaqueType` in future versions
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.rs b/tests/ui/impl-trait/nested-return-type2-tait2.rs
index af8e06630..b7fee1d91 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -17,6 +19,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
type Sendable = impl Send;
type Traitable = impl Trait<Assoc = Sendable>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -25,7 +28,6 @@ type Traitable = impl Trait<Assoc = Sendable>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `Sendable: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index 125262b96..790e339c8 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -1,18 +1,13 @@
-error[E0277]: the trait bound `Sendable: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait2.rs:27:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait2.rs:21:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `Sendable`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `Sendable`
+...
+LL | type Traitable = impl Trait<Assoc = 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`
- --> $DIR/nested-return-type2-tait2.rs:14:31
- |
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.rs b/tests/ui/impl-trait/nested-return-type2-tait3.rs
index 74fd8a9dd..eed5c271f 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -16,6 +18,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
}
type Traitable = impl Trait<Assoc = impl Send>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -24,7 +27,6 @@ type Traitable = impl Trait<Assoc = impl Send>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `impl Send: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index c2332b6e4..72aa51a23 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -1,18 +1,17 @@
-error[E0277]: the trait bound `impl Send: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait3.rs:26:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait3.rs:20:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `impl Send`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `impl Send`
+...
+LL | type Traitable = impl Trait<Assoc = 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`
- --> $DIR/nested-return-type2-tait3.rs:14:31
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
+help: add this bound
|
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+LL | type Traitable = impl Trait<Assoc = impl Send + Duh>;
+ | +++++
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested_impl_trait.rs b/tests/ui/impl-trait/nested_impl_trait.rs
index e95fab3b6..c036b9e36 100644
--- a/tests/ui/impl-trait/nested_impl_trait.rs
+++ b/tests/ui/impl-trait/nested_impl_trait.rs
@@ -9,7 +9,7 @@ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
//~^ ERROR nested `impl Trait` is not allowed
-//~| `impl Trait` only allowed in function and inherent method return types
+//~| `impl Trait` only allowed in function and inherent method argument and return types
fn bad_in_arg_position(_: impl Into<impl Debug>) { }
//~^ ERROR nested `impl Trait` is not allowed
diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr
index ffe84b8e8..f1cafd958 100644
--- a/tests/ui/impl-trait/nested_impl_trait.stderr
+++ b/tests/ui/impl-trait/nested_impl_trait.stderr
@@ -34,7 +34,7 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| | nested `impl Trait` here
| outer `impl Trait`
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/nested_impl_trait.rs:10:32
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
index 687dbe65e..37c96d9bc 100644
--- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
+++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
@@ -11,6 +11,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
@@ -33,6 +36,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
index ee4343b11..234780534 100644
--- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/opaque-cast-field-access-in-future.rs:22:17
|
LL | fn run() -> Foo<impl Future<Output = ()>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Future`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-coroutine.rs
index 000af70c4..6351cef95 100644
--- a/tests/ui/impl-trait/recursive-generator.rs
+++ b/tests/ui/impl-trait/recursive-coroutine.rs
@@ -1,16 +1,16 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
-fn foo() -> impl Generator<Yield = (), Return = ()> {
+fn foo() -> impl Coroutine<Yield = (), Return = ()> {
//~^ ERROR cannot resolve opaque type
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
let mut gen = Box::pin(foo());
- //~^ NOTE generator captures itself here
+ //~^ NOTE coroutine captures itself here
let mut r = gen.as_mut().resume(());
- while let GeneratorState::Yielded(v) = r {
+ while let CoroutineState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-coroutine.stderr
index 86e193d95..d36a58a86 100644
--- a/tests/ui/impl-trait/recursive-generator.stderr
+++ b/tests/ui/impl-trait/recursive-coroutine.stderr
@@ -1,11 +1,11 @@
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-generator.rs:5:13
+ --> $DIR/recursive-coroutine.rs:5:13
|
-LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
+LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
...
LL | let mut gen = Box::pin(foo());
- | ------- generator captures itself here
+ | ------- coroutine captures itself here
error: aborting due to previous error
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 ffc0cd9d1..8331eec90 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,7 @@
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(unconditional_recursion)]
fn option(i: i32) -> impl Sized {
@@ -50,14 +50,14 @@ fn closure_sig() -> impl Sized {
|| closure_sig()
}
-fn generator_sig() -> impl Sized {
+fn coroutine_sig() -> impl Sized {
//~^ ERROR
- || generator_sig()
+ || coroutine_sig()
}
-fn generator_capture() -> impl Sized {
+fn coroutine_capture() -> impl Sized {
//~^ ERROR
- let x = generator_capture();
+ let x = coroutine_capture();
move || {
yield;
x;
@@ -69,10 +69,10 @@ fn substs_change<T: 'static>() -> impl Sized {
(substs_change::<&T>(),)
}
-fn generator_hold() -> impl Sized {
+fn coroutine_hold() -> impl Sized {
//~^ ERROR
move || {
- let x = generator_hold();
+ let x = coroutine_hold();
yield;
x;
}
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
index 1d919fb52..8e9aa8ad0 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
@@ -81,24 +81,24 @@ LL | || closure_sig()
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
-LL | fn generator_sig() -> impl Sized {
+LL | fn coroutine_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
-LL | || generator_sig()
+LL | || coroutine_sig()
| ------------------ 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:58:27
|
-LL | fn generator_capture() -> impl Sized {
+LL | fn coroutine_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
LL | / move || {
LL | | yield;
LL | | x;
- | | - generator captures itself here
+ | | - coroutine captures itself here
LL | | }
- | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
+ | |_____- returning here with type `{coroutine@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35
@@ -112,11 +112,11 @@ LL | (substs_change::<&T>(),)
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
-LL | fn generator_hold() -> impl Sized {
+LL | fn coroutine_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
-LL | let x = generator_hold();
- | - generator captures itself here
+LL | let x = coroutine_hold();
+ | - coroutine captures itself here
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:86:26
diff --git a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
index 98dbaf036..91a0e0d48 100644
--- a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
+++ b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
@@ -1,7 +1,7 @@
// check-pass
#![allow(incomplete_features)]
-#![feature(adt_const_params, return_position_impl_trait_in_trait)]
+#![feature(adt_const_params)]
pub struct Element;
diff --git a/tests/ui/impl-trait/type_parameters_captured.stderr b/tests/ui/impl-trait/type_parameters_captured.stderr
index fb502cfdd..46859296f 100644
--- a/tests/ui/impl-trait/type_parameters_captured.stderr
+++ b/tests/ui/impl-trait/type_parameters_captured.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:8:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo<T: 'static>(x: T) -> impl Any + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.fixed b/tests/ui/impl-trait/unactionable_diagnostic.fixed
index 6c2505177..d446512ff 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.fixed
+++ b/tests/ui/impl-trait/unactionable_diagnostic.fixed
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T: 't>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.rs b/tests/ui/impl-trait/unactionable_diagnostic.rs
index bce35cbdd..76b9a62ca 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.rs
+++ b/tests/ui/impl-trait/unactionable_diagnostic.rs
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.stderr b/tests/ui/impl-trait/unactionable_diagnostic.stderr
index a32004cda..4df7f45c3 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.stderr
+++ b/tests/ui/impl-trait/unactionable_diagnostic.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/unactionable_diagnostic.rs:21:5
|
+LL | pub fn bar<'t, T>(
+ | -- the parameter type `T` must be valid for the lifetime `'t` as defined here...
+...
LL | foo(post, x)
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | pub fn bar<'t, T: 't>(
| ++++
diff --git a/tests/ui/impl-trait/universal-mismatched-type.stderr b/tests/ui/impl-trait/universal-mismatched-type.stderr
index a56e542d8..82e0f2396 100644
--- a/tests/ui/impl-trait/universal-mismatched-type.stderr
+++ b/tests/ui/impl-trait/universal-mismatched-type.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(x: impl Debug) -> String {
| ---------- ------ expected `String` because of return type
| |
- | this type parameter
+ | found this type parameter
LL | x
| ^ expected `String`, found type parameter `impl Debug`
|
diff --git a/tests/ui/impl-trait/where-allowed-2.stderr b/tests/ui/impl-trait/where-allowed-2.stderr
index 2b328c01c..b3765ac1a 100644
--- a/tests/ui/impl-trait/where-allowed-2.stderr
+++ b/tests/ui/impl-trait/where-allowed-2.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/where-allowed-2.rs:3:30
|
LL | fn in_adt_in_return() -> Vec<impl Debug> { panic!() }
| ^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Debug`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 509d27166..158dc5ab9 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -16,47 +16,47 @@ fn in_adt_in_parameters(_: Vec<impl Debug>) { panic!() }
// Disallowed
fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
// Disallowed
fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~^^ ERROR nested `impl Trait` is not allowed
// Disallowed
fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR nested `impl Trait` is not allowed
// Allowed
@@ -64,11 +64,11 @@ fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!()
// Disallowed
fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
@@ -81,22 +81,22 @@ fn in_impl_Trait_in_return() -> impl IntoIterator<Item = impl IntoIterator> {
// Disallowed
struct InBraceStructField { x: impl Debug }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InAdtInBraceStructField { x: Vec<impl Debug> }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InTupleStructField(impl Debug);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnum {
InBraceVariant { x: impl Debug },
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
InTupleVariant(impl Debug),
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -104,10 +104,9 @@ trait InTraitDefnParameters {
fn in_parameters(_: impl Debug);
}
-// Disallowed
+// Allowed
trait InTraitDefnReturn {
fn in_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
}
// Allowed and disallowed in trait impls
@@ -124,7 +123,7 @@ impl DummyTrait for () {
// Allowed
fn in_trait_impl_return() -> impl Debug { () }
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ // Allowed
}
// Allowed
@@ -137,10 +136,10 @@ impl DummyType {
// Disallowed
extern "C" {
fn in_foreign_parameters(_: impl Debug);
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn in_foreign_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -156,97 +155,97 @@ type InTypeAlias<R> = impl Debug;
//~^ ERROR `impl Trait` in type aliases is unstable
type InReturnInTypeAlias<R> = fn() -> impl Debug;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR `impl Trait` in type aliases is unstable
// Disallowed in impl headers
impl PartialEq<impl Debug> for () {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in impl headers
impl PartialEq<()> for impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
impl impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
struct InInherentImplAdt<T> { t: T }
impl InInherentImplAdt<impl Debug> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in where clauses
fn in_fn_where_clause()
where impl Debug: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed in where clauses
fn in_adt_in_fn_where_clause()
where Vec<impl Debug>: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_trait_parameter_in_fn_where_clause<T>()
where T: PartialEq<impl Debug>
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_parameter_in_fn_where_clause<T>()
where T: Fn(impl Debug)
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_return_in_fn_where_clause<T>()
where T: Fn() -> impl Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
struct InStructGenericParamDefault<T = impl Debug>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
trait InTraitGenericParamDefault<T = impl Debug> {}
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
impl <T = impl Debug> T {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR no nominal type found
// Disallowed
fn in_method_generic_param_default<T = impl Debug>(_: T) {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn main() {
let _in_local_variable: impl Fn() = || {};
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
let _in_return_in_local_variable = || -> impl Fn() { || {} };
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 3e2934379..2d8895030 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -17,7 +17,7 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
| outer `impl Trait`
error[E0658]: `impl Trait` in associated types is unstable
- --> $DIR/where-allowed.rs:120:16
+ --> $DIR/where-allowed.rs:119:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | type Out = impl Debug;
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:155:23
+ --> $DIR/where-allowed.rs:154:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
@@ -35,7 +35,7 @@ LL | type InTypeAlias<R> = impl Debug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:158:39
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
@@ -43,248 +43,230 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:18:40
|
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:22:42
|
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:26:38
|
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:30:40
|
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:34:49
|
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:38:51
|
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:42:55
|
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:49:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:54:53
|
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:58:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:66:38
|
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:70:40
|
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:83:32
|
LL | struct InBraceStructField { x: impl Debug }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:87:41
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:91:27
|
LL | struct InTupleStructField(impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:96:25
|
LL | InBraceVariant { x: impl Debug },
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:98:20
|
LL | InTupleVariant(impl Debug),
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/where-allowed.rs:109:23
- |
-LL | fn in_return() -> impl Debug;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/where-allowed.rs:126:34
- |
-LL | fn in_trait_impl_return() -> impl Debug { () }
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params
- --> $DIR/where-allowed.rs:139:33
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` params
+ --> $DIR/where-allowed.rs:138:33
|
LL | fn in_foreign_parameters(_: impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types
- --> $DIR/where-allowed.rs:142:31
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` return types
+ --> $DIR/where-allowed.rs:141:31
|
LL | fn in_foreign_return() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
- --> $DIR/where-allowed.rs:158:39
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits
- --> $DIR/where-allowed.rs:163:16
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in traits
+ --> $DIR/where-allowed.rs:162:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:168:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:167:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:173:6
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:172:6
|
LL | impl impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:179:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:178:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:185:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:184:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:192:15
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:191:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:199:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:198:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
- --> $DIR/where-allowed.rs:206:17
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
+ --> $DIR/where-allowed.rs:205:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
- --> $DIR/where-allowed.rs:213:22
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
+ --> $DIR/where-allowed.rs:212:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:219:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:218:40
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:223:36
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:222:36
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:227:38
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:226:38
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:231:41
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:230:41
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:235:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:234:11
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:242:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:241:40
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
- --> $DIR/where-allowed.rs:248:29
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
+ --> $DIR/where-allowed.rs:247:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types
- --> $DIR/where-allowed.rs:250:46
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in closure return types
+ --> $DIR/where-allowed.rs:249:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:235:7
+ --> $DIR/where-allowed.rs:234:7
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^
@@ -294,7 +276,7 @@ LL | impl <T = impl Debug> T {}
= note: `#[deny(invalid_type_param_default)]` on by default
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:242:36
+ --> $DIR/where-allowed.rs:241:36
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^^^^^
@@ -303,14 +285,14 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
error[E0118]: no nominal type found for inherent implementation
- --> $DIR/where-allowed.rs:235:1
+ --> $DIR/where-allowed.rs:234:1
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead
-error: aborting due to 47 previous errors
+error: aborting due to 45 previous errors
Some errors have detailed explanations: E0118, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0118`.
diff --git a/tests/ui/impl-unused-tps.rs b/tests/ui/impl-unused-tps.rs
index 7cc1ae613..3eb9daedf 100644
--- a/tests/ui/impl-unused-tps.rs
+++ b/tests/ui/impl-unused-tps.rs
@@ -1,3 +1,5 @@
+//~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized
+
trait Foo<A> {
fn get(&self, A: &A) { }
}
@@ -23,8 +25,7 @@ impl<T:Bar<Out=U>,U> Foo<T> for [isize;3] {
}
impl<T,U> Foo<T> for U {
- // OK, T, U are used everywhere. Note that the coherence check
- // hasn't executed yet, so no errors about overlap.
+ //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
}
impl<T,U> Bar for T {
diff --git a/tests/ui/impl-unused-tps.stderr b/tests/ui/impl-unused-tps.stderr
index 053ab91c8..93215326c 100644
--- a/tests/ui/impl-unused-tps.stderr
+++ b/tests/ui/impl-unused-tps.stderr
@@ -1,33 +1,56 @@
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:13:8
+ --> $DIR/impl-unused-tps.rs:15:8
|
LL | impl<T,U> Foo<T> for [isize;1] {
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:30:8
+ --> $DIR/impl-unused-tps.rs:31:8
|
LL | impl<T,U> Bar for T {
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:38:8
+ --> $DIR/impl-unused-tps.rs:39:8
|
LL | impl<T,U> Bar for T
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:46:8
+ --> $DIR/impl-unused-tps.rs:47:8
|
LL | impl<T,U,V> Foo<T> for T
| ^ unconstrained type parameter
error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:46:10
+ --> $DIR/impl-unused-tps.rs:47:10
|
LL | impl<T,U,V> Foo<T> for T
| ^ unconstrained type parameter
-error: aborting due to 5 previous errors
+error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
+ --> $DIR/impl-unused-tps.rs:27:1
+ |
+LL | impl<T> Foo<T> for [isize;0] {
+ | ---------------------------- first implementation here
+...
+LL | impl<T,U> Foo<T> for U {
+ | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]`
+
+error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`)
+note: required for `([isize; 0], _)` to implement `Bar`
+ --> $DIR/impl-unused-tps.rs:31:11
+ |
+LL | impl<T,U> Bar for T {
+ | - ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
+ = note: 126 redundant requirements hidden
+ = note: required for `([isize; 0], _)` to implement `Bar`
+
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0119, E0207, E0275.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/implied-bounds/issue-100690.rs b/tests/ui/implied-bounds/issue-100690.rs
index 5599cd410..ea33c9f42 100644
--- a/tests/ui/implied-bounds/issue-100690.rs
+++ b/tests/ui/implied-bounds/issue-100690.rs
@@ -35,8 +35,8 @@ impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandl
F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
{
real_dispatch(f)
- //~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
- //~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+ //~^ ERROR expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
+ //~| NOTE expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
//~| NOTE expected a closure with arguments
//~| NOTE required by a bound introduced by this call
}
diff --git a/tests/ui/implied-bounds/issue-100690.stderr b/tests/ui/implied-bounds/issue-100690.stderr
index dba035337..ac9f7ab25 100644
--- a/tests/ui/implied-bounds/issue-100690.stderr
+++ b/tests/ui/implied-bounds/issue-100690.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+error[E0277]: expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
--> $DIR/issue-100690.rs:37:23
|
LL | real_dispatch(f)
- | ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+ | ------------- ^ expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr
index 6c7d79174..2731ed2ba 100644
--- a/tests/ui/imports/ambiguous-9.stderr
+++ b/tests/ui/imports/ambiguous-9.stderr
@@ -60,6 +60,7 @@ note: `date_range` could also refer to the function imported here
LL | use prelude::*;
| ^^^^^^^^^^
= help: consider adding an explicit import of `date_range` to disambiguate
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 4 warnings emitted
diff --git a/tests/ui/imports/issue-28134.stderr b/tests/ui/imports/issue-28134.stderr
index 33cb53f20..5315c2e9f 100644
--- a/tests/ui/imports/issue-28134.stderr
+++ b/tests/ui/imports/issue-28134.stderr
@@ -14,8 +14,9 @@ LL | #![test]
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test]
- | ~~~~~~~
+LL - #![test]
+LL + #[test]
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr
index 788fcc830..30d237365 100644
--- a/tests/ui/imports/issue-55457.stderr
+++ b/tests/ui/imports/issue-55457.stderr
@@ -38,6 +38,7 @@ LL | #[derive(NonExistent)]
| ^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot determine resolution for the derive macro `NonExistent`
--> $DIR/issue-55457.rs:5:10
@@ -46,6 +47,7 @@ LL | #[derive(NonExistent)]
| ^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr
index 15477fb6f..d2a0f436c 100644
--- a/tests/ui/imports/issue-56125.stderr
+++ b/tests/ui/imports/issue-56125.stderr
@@ -6,14 +6,14 @@ LL | use empty::issue_56125;
|
help: consider importing one of these items instead
|
+LL | use ::issue_56125::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL | use ::issue_56125::last_segment::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL | use ::issue_56125::non_last_segment::non_last_segment::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | use crate::m3::last_segment::issue_56125;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use crate::m3::non_last_segment::non_last_segment::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use issue_56125::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use issue_56125::last_segment::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and 1 other candidate
error[E0659]: `issue_56125` is ambiguous
diff --git a/tests/ui/imports/pub-reexport-empty.rs b/tests/ui/imports/pub-reexport-empty.rs
new file mode 100644
index 000000000..2a46f4c8d
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.rs
@@ -0,0 +1,25 @@
+#![deny(unused_imports)]
+
+mod a {}
+
+pub use a::*;
+//~^ ERROR: unused import: `a::*`
+
+mod b {
+ mod c {
+ #[derive(Clone)]
+ pub struct D;
+ }
+ pub use self::c::*; // don't show unused import lint
+}
+
+pub use b::*; // don't show unused import lint
+
+mod d {
+ const D: i32 = 1;
+}
+
+pub use d::*;
+//~^ ERROR: unused import: `d::*`
+
+fn main() {}
diff --git a/tests/ui/imports/pub-reexport-empty.stderr b/tests/ui/imports/pub-reexport-empty.stderr
new file mode 100644
index 000000000..813b2ef71
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.stderr
@@ -0,0 +1,20 @@
+error: unused import: `a::*`
+ --> $DIR/pub-reexport-empty.rs:5:9
+ |
+LL | pub use a::*;
+ | ^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/pub-reexport-empty.rs:1:9
+ |
+LL | #![deny(unused_imports)]
+ | ^^^^^^^^^^^^^^
+
+error: unused import: `d::*`
+ --> $DIR/pub-reexport-empty.rs:22:9
+ |
+LL | pub use d::*;
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/imports/reexports.rs b/tests/ui/imports/reexports.rs
index d76cc41be..cb1a3ebe1 100644
--- a/tests/ui/imports/reexports.rs
+++ b/tests/ui/imports/reexports.rs
@@ -5,9 +5,12 @@ mod a {
mod foo {}
mod a {
- pub use super::foo; //~ ERROR cannot be re-exported
+ pub use super::foo;
+ //~^ ERROR cannot be re-exported
+ //~| WARNING unused import: `super::foo`
pub use super::*;
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
+ //~| WARNING unused import: `super::*`
}
}
diff --git a/tests/ui/imports/reexports.stderr b/tests/ui/imports/reexports.stderr
index 8cbff0ac7..401e422af 100644
--- a/tests/ui/imports/reexports.stderr
+++ b/tests/ui/imports/reexports.stderr
@@ -11,44 +11,44 @@ LL | pub use super::foo;
| ^^^^^^^^^^
error[E0603]: module import `foo` is private
- --> $DIR/reexports.rs:33:15
+ --> $DIR/reexports.rs:36:15
|
LL | use b::a::foo::S;
| ^^^ private module import
|
note: the module import `foo` is defined here...
- --> $DIR/reexports.rs:21:17
+ --> $DIR/reexports.rs:24:17
|
LL | pub use super::foo; // This is OK since the value `foo` is visible enough.
| ^^^^^^^^^^
note: ...and refers to the module `foo` which is defined here
- --> $DIR/reexports.rs:16:5
+ --> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module import `foo` is private
- --> $DIR/reexports.rs:34:15
+ --> $DIR/reexports.rs:37:15
|
LL | use b::b::foo::S as T;
| ^^^ private module import
|
note: the module import `foo` is defined here...
- --> $DIR/reexports.rs:26:17
+ --> $DIR/reexports.rs:29:17
|
LL | pub use super::*; // This is also OK since the value `foo` is visible enough.
| ^^^^^^^^
note: ...and refers to the module `foo` which is defined here
- --> $DIR/reexports.rs:16:5
+ --> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^
-warning: glob import doesn't reexport anything because no candidate is public enough
- --> $DIR/reexports.rs:9:17
+warning: unused import: `super::foo`
+ --> $DIR/reexports.rs:8:17
|
-LL | pub use super::*;
- | ^^^^^^^^
+LL | pub use super::foo;
+ | ^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/reexports.rs:1:9
@@ -56,7 +56,19 @@ note: the lint level is defined here
LL | #![warn(unused_imports)]
| ^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 1 warning emitted
+warning: glob import doesn't reexport anything because no candidate is public enough
+ --> $DIR/reexports.rs:11:17
+ |
+LL | pub use super::*;
+ | ^^^^^^^^
+
+warning: unused import: `super::*`
+ --> $DIR/reexports.rs:11:17
+ |
+LL | pub use super::*;
+ | ^^^^^^^^
+
+error: aborting due to 3 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0364, E0603.
For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/indexing/index-help.stderr b/tests/ui/indexing/index-help.stderr
index e020d0298..2cb212a01 100644
--- a/tests/ui/indexing/index-help.stderr
+++ b/tests/ui/indexing/index-help.stderr
@@ -5,7 +5,8 @@ LL | x[0i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `Vec<{integer}>` to implement `Index<i32>`
error: aborting due to previous error
diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr
index 7a741cfc7..6ea6bb600 100644
--- a/tests/ui/indexing/indexing-requires-a-uint.stderr
+++ b/tests/ui/indexing/indexing-requires-a-uint.stderr
@@ -5,7 +5,8 @@ LL | [0][0u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `[{integer}]` to implement `Index<u8>`
error[E0308]: mismatched types
diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr
index b706cd2bc..98639f307 100644
--- a/tests/ui/inference/cannot-infer-closure-circular.stderr
+++ b/tests/ui/inference/cannot-infer-closure-circular.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), E>`
|
LL | let x = |r| {
| ^
+LL | let v = r?;
+LL | Ok(v)
+ | ----- type must be known at this point
|
help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified
|
diff --git a/tests/ui/inference/issue-104649.stderr b/tests/ui/inference/issue-104649.stderr
index 4962b21f9..281932927 100644
--- a/tests/ui/inference/issue-104649.stderr
+++ b/tests/ui/inference/issue-104649.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `A<std::result::Result<std::result::Re
--> $DIR/issue-104649.rs:24:9
|
LL | let a = A(Result::Ok(Result::Ok(())));
- | ^
+ | ^ -------------- type must be known at this point
|
help: consider giving `a` an explicit type, where the type for type parameter `E` is specified
|
diff --git a/tests/ui/inference/issue-107090.rs b/tests/ui/inference/issue-107090.rs
index a22e12c6d..799c36418 100644
--- a/tests/ui/inference/issue-107090.rs
+++ b/tests/ui/inference/issue-107090.rs
@@ -2,8 +2,8 @@ use std::marker::PhantomData;
struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
where
Foo<'short, 'out, T>: Convert<'a, 'b>;
- //~^ ERROR use of undeclared lifetime name
- //~| ERROR use of undeclared lifetime name `'out`
+//~^ ERROR use of undeclared lifetime name
+//~| ERROR use of undeclared lifetime name `'out`
trait Convert<'a, 'b>: Sized {
fn cast(&'a self) -> &'b Self;
@@ -19,7 +19,7 @@ impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
//~^ ERROR use of undeclared lifetime name
- sadness.cast() //~ ERROR mismatched types
+ sadness.cast()
}
fn main() {}
diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr
index 6233b629a..e509e262f 100644
--- a/tests/ui/inference/issue-107090.stderr
+++ b/tests/ui/inference/issue-107090.stderr
@@ -66,19 +66,6 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short,
| |
| help: consider introducing lifetime `'short` here: `'short,`
-error[E0308]: mismatched types
- --> $DIR/issue-107090.rs:22:5
- |
-LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
- | - this type parameter ------- expected `&'out T` because of return type
-LL |
-LL | sadness.cast()
- | ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>`
- |
- = note: expected reference `&'out T`
- found reference `&Foo<'_, '_, T>`
-
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0261, E0308.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/inference/issue-71584.rs b/tests/ui/inference/issue-71584.rs
index 7bf3ed60e..c96c32d5c 100644
--- a/tests/ui/inference/issue-71584.rs
+++ b/tests/ui/inference/issue-71584.rs
@@ -1,3 +1,4 @@
+// ignore-windows different list of satisfying impls
fn main() {
let n: u32 = 1;
let mut d: u64 = 2;
diff --git a/tests/ui/inference/issue-71584.stderr b/tests/ui/inference/issue-71584.stderr
index 6ddb76573..22c0f113d 100644
--- a/tests/ui/inference/issue-71584.stderr
+++ b/tests/ui/inference/issue-71584.stderr
@@ -1,5 +1,5 @@
error[E0284]: type annotations needed
- --> $DIR/issue-71584.rs:4:15
+ --> $DIR/issue-71584.rs:5:15
|
LL | d = d % n.into();
| - ^^^^
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 225558805..6c93241ea 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -24,16 +24,15 @@ help: try using a fully qualified path to specify the expected types
LL | String::from(<str as AsRef<T>>::as_ref("x"));
| ++++++++++++++++++++++++++ ~
-error[E0282]: type annotations needed
- --> $DIR/issue-72690.rs:12:6
+error[E0283]: type annotations needed
+ --> $DIR/issue-72690.rs:12:9
|
LL | |x| String::from("x".as_ref());
- | ^
- |
-help: consider giving this closure parameter an explicit type
+ | ^^^^^^ cannot infer type for reference `&_`
|
-LL | |x: /* Type */| String::from("x".as_ref());
- | ++++++++++++
+ = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:12:26
@@ -225,5 +224,4 @@ LL | String::from(<str as AsRef<T>>::as_ref("x"));
error: aborting due to 17 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs
new file mode 100644
index 000000000..4544c898a
--- /dev/null
+++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs
@@ -0,0 +1,61 @@
+struct MyError;
+
+fn foo(x: bool) -> Result<(), MyError> {
+ if x {
+ Err(MyError);
+ //~^ ERROR type annotations needed
+ }
+
+ Ok(())
+}
+
+fn bar(x: bool) -> Result<(), MyError> {
+ if x {
+ Ok(());
+ //~^ ERROR type annotations needed
+ }
+
+ Ok(())
+}
+
+fn baz(x: bool) -> Result<(), MyError> {
+ //~^ ERROR mismatched types
+ if x {
+ 1;
+ }
+
+ Err(MyError);
+}
+
+fn error() -> Result<(), MyError> {
+ Err(MyError)
+}
+
+fn bak(x: bool) -> Result<(), MyError> {
+ if x {
+ //~^ ERROR mismatched types
+ error();
+ } else {
+ //~^ ERROR mismatched types
+ error();
+ }
+}
+
+fn bad(x: bool) -> Result<(), MyError> {
+ Err(MyError); //~ ERROR type annotations needed
+ Ok(())
+}
+
+fn with_closure<F, A, B>(_: F) -> i32
+where
+ F: FnOnce(A, B),
+{
+ 0
+}
+
+fn a() -> i32 {
+ with_closure(|x: u32, y| {}); //~ ERROR type annotations needed
+ 0
+}
+
+fn main() {}
diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr
new file mode 100644
index 000000000..1fea73529
--- /dev/null
+++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr
@@ -0,0 +1,98 @@
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:5:9
+ |
+LL | Err(MyError);
+ | ^^^ cannot infer type of the type parameter `T` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Err::<T, MyError>(MyError);
+ | ++++++++++++++
+help: you might have meant to return this to infer its type parameters
+ |
+LL | return Err(MyError);
+ | ++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:14:9
+ |
+LL | Ok(());
+ | ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Ok::<(), E>(());
+ | +++++++++
+help: you might have meant to return this to infer its type parameters
+ |
+LL | return Ok(());
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:21:20
+ |
+LL | fn baz(x: bool) -> Result<(), MyError> {
+ | --- ^^^^^^^^^^^^^^^^^^^ expected `Result<(), MyError>`, found `()`
+ | |
+ | implicitly returns `()` as its body has no tail or `return` expression
+...
+LL | Err(MyError);
+ | - help: remove this semicolon to return this value
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:35:10
+ |
+LL | if x {
+ | __________^
+LL | |
+LL | | error();
+ | | - help: remove this semicolon to return this value
+LL | | } else {
+ | |_____^ expected `Result<(), MyError>`, found `()`
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:38:12
+ |
+LL | } else {
+ | ____________^
+LL | |
+LL | | error();
+ | | - help: remove this semicolon to return this value
+LL | | }
+ | |_____^ expected `Result<(), MyError>`, found `()`
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:45:5
+ |
+LL | Err(MyError);
+ | ^^^ cannot infer type of the type parameter `T` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Err::<T, MyError>(MyError);
+ | ++++++++++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:57:27
+ |
+LL | with_closure(|x: u32, y| {});
+ | ^
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | with_closure(|x: u32, y: /* Type */| {});
+ | ++++++++++++
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0282, E0308.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/inference/multiple-impl-apply.rs b/tests/ui/inference/multiple-impl-apply.rs
new file mode 100644
index 000000000..314fe0f2a
--- /dev/null
+++ b/tests/ui/inference/multiple-impl-apply.rs
@@ -0,0 +1,48 @@
+struct Foo {
+ inner: u32,
+}
+
+struct Bar {
+ inner: u32,
+}
+
+#[derive(Clone, Copy)]
+struct Baz {
+ inner: u32,
+}
+
+impl From<Baz> for Bar {
+ fn from(other: Baz) -> Self {
+ Self {
+ inner: other.inner,
+ }
+ }
+}
+
+impl From<Baz> for Foo {
+ fn from(other: Baz) -> Self {
+ Self {
+ inner: other.inner,
+ }
+ }
+}
+
+fn main() {
+ let x: Baz = Baz { inner: 42 };
+
+ // DOESN'T Compile: Multiple options!
+ let y = x.into(); //~ ERROR E0283
+
+ let y_1: Foo = x.into();
+ let y_2: Bar = x.into();
+
+ let z_1 = Foo::from(y_1);
+ let z_2 = Bar::from(y_2);
+
+ // No type annotations needed, the compiler KNOWS the type must be `Foo`!
+ let m = magic_foo(x);
+}
+
+fn magic_foo(arg: Baz) -> Foo {
+ arg.into()
+}
diff --git a/tests/ui/inference/multiple-impl-apply.stderr b/tests/ui/inference/multiple-impl-apply.stderr
new file mode 100644
index 000000000..ec49e1520
--- /dev/null
+++ b/tests/ui/inference/multiple-impl-apply.stderr
@@ -0,0 +1,23 @@
+error[E0283]: type annotations needed
+ --> $DIR/multiple-impl-apply.rs:34:9
+ |
+LL | let y = x.into();
+ | ^ ---- type must be known at this point
+ |
+note: multiple `impl`s satisfying `_: From<Baz>` found
+ --> $DIR/multiple-impl-apply.rs:14:1
+ |
+LL | impl From<Baz> for Bar {
+ | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | impl From<Baz> for Foo {
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ = note: required for `Baz` to implement `Into<_>`
+help: consider giving `y` an explicit type
+ |
+LL | let y: /* Type */ = x.into();
+ | ++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/concrete-impl.rs b/tests/ui/inference/need_type_info/concrete-impl.rs
index fc79e6201..8960f870c 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.rs
+++ b/tests/ui/inference/need_type_info/concrete-impl.rs
@@ -14,6 +14,4 @@ fn main() {
<Struct as Ambiguous<_>>::method();
//~^ ERROR type annotations needed
//~| NOTE cannot infer type of the type parameter `A`
- //~| ERROR type annotations needed
- //~| NOTE infer type of the type parameter `A`
}
diff --git a/tests/ui/inference/need_type_info/concrete-impl.stderr b/tests/ui/inference/need_type_info/concrete-impl.stderr
index 74c3f6cd5..6b86753ca 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.stderr
+++ b/tests/ui/inference/need_type_info/concrete-impl.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/concrete-impl.rs:14:5
- |
-LL | <Struct as Ambiguous<_>>::method();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous`
-
error[E0283]: type annotations needed
--> $DIR/concrete-impl.rs:14:5
|
@@ -19,7 +13,6 @@ LL |
LL | impl Ambiguous<Two> for Struct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
index 0ec219415..9ca94cd58 100644
--- a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
+++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:10:16
|
LL | (S {}).owo(None)
- | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+ | --- ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+ | |
+ | required by a bound introduced by this call
|
+ = note: cannot satisfy `_: T`
+note: required by a bound in `S::owo`
+ --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:6:35
+ |
+LL | fn owo(&self, _: Option<&impl T>) {}
+ | ^ required by this bound in `S::owo`
help: consider specifying the generic argument
|
LL | (S {}).owo(None::<&_>)
@@ -11,4 +19,4 @@ LL | (S {}).owo(None::<&_>)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/question-mark-type-infer.stderr b/tests/ui/inference/question-mark-type-infer.stderr
index 7a1e850d1..52baa2133 100644
--- a/tests/ui/inference/question-mark-type-infer.stderr
+++ b/tests/ui/inference/question-mark-type-infer.stderr
@@ -1,9 +1,12 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/question-mark-type-infer.rs:10:21
|
LL | l.iter().map(f).collect()?
| ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
|
+ = note: cannot satisfy `_: FromIterator<Result<i32, ()>>`
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider specifying the generic argument
|
LL | l.iter().map(f).collect::<Vec<_>>()?
@@ -11,4 +14,4 @@ LL | l.iter().map(f).collect::<Vec<_>>()?
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/infinite/infinite-struct.stderr b/tests/ui/infinite/infinite-struct.stderr
index b6c72b1de..82d147b63 100644
--- a/tests/ui/infinite/infinite-struct.stderr
+++ b/tests/ui/infinite/infinite-struct.stderr
@@ -22,6 +22,10 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
LL | x: Bar<Box<Foo>>,
| ++++ +
-error: aborting due to 2 previous errors
+error: reached the recursion limit finding the struct tail for `Take`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]`
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/inline-const/expr-unsafe.thir.stderr b/tests/ui/inline-const/expr-unsafe.thir.stderr
index 4737444fb..1ab6e42fb 100644
--- a/tests/ui/inline-const/expr-unsafe.thir.stderr
+++ b/tests/ui/inline-const/expr-unsafe.thir.stderr
@@ -1,9 +1,6 @@
warning: unnecessary `unsafe` block
--> $DIR/expr-unsafe.rs:12:13
|
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-...
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
|
diff --git a/tests/ui/inline-const/pat-unsafe-err.rs b/tests/ui/inline-const/pat-unsafe-err.rs
index e290b438c..6df281c6d 100644
--- a/tests/ui/inline-const/pat-unsafe-err.rs
+++ b/tests/ui/inline-const/pat-unsafe-err.rs
@@ -1,11 +1,13 @@
-// ignore-test This is currently broken
// revisions: mir thir
+// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)]
#![feature(inline_const_pat)]
-const unsafe fn require_unsafe() -> usize { 1 }
+const unsafe fn require_unsafe() -> usize {
+ 1
+}
fn main() {
match () {
@@ -14,4 +16,12 @@ fn main() {
//~^ ERROR [E0133]
} => (),
}
+
+ match 1 {
+ const {
+ require_unsafe()
+ //~^ ERROR [E0133]
+ }..=4 => (),
+ _ => (),
+ }
}
diff --git a/tests/ui/inline-const/pat-unsafe-err.thir.stderr b/tests/ui/inline-const/pat-unsafe-err.thir.stderr
new file mode 100644
index 000000000..48a2cb4c7
--- /dev/null
+++ b/tests/ui/inline-const/pat-unsafe-err.thir.stderr
@@ -0,0 +1,19 @@
+error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
+ --> $DIR/pat-unsafe-err.rs:15:13
+ |
+LL | require_unsafe();
+ | ^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
+ --> $DIR/pat-unsafe-err.rs:22:13
+ |
+LL | require_unsafe()
+ | ^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/inline-const/pat-unsafe.rs b/tests/ui/inline-const/pat-unsafe.rs
index bcf7f6e01..36f8632af 100644
--- a/tests/ui/inline-const/pat-unsafe.rs
+++ b/tests/ui/inline-const/pat-unsafe.rs
@@ -1,13 +1,15 @@
-// ignore-test This is currently broken
// check-pass
// revisions: mir thir
+// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)]
#![warn(unused_unsafe)]
#![feature(inline_const_pat)]
-const unsafe fn require_unsafe() -> usize { 1 }
+const unsafe fn require_unsafe() -> usize {
+ 1
+}
fn main() {
unsafe {
@@ -18,5 +20,14 @@ fn main() {
//~^ WARNING unnecessary `unsafe` block
} => (),
}
+
+ match 1 {
+ const {
+ unsafe {}
+ //~^ WARNING unnecessary `unsafe` block
+ require_unsafe()
+ }..=4 => (),
+ _ => (),
+ }
}
}
diff --git a/tests/ui/inline-const/pat-unsafe.thir.stderr b/tests/ui/inline-const/pat-unsafe.thir.stderr
new file mode 100644
index 000000000..0318b3ff2
--- /dev/null
+++ b/tests/ui/inline-const/pat-unsafe.thir.stderr
@@ -0,0 +1,20 @@
+warning: unnecessary `unsafe` block
+ --> $DIR/pat-unsafe.rs:19:17
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/pat-unsafe.rs:7:9
+ |
+LL | #![warn(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+warning: unnecessary `unsafe` block
+ --> $DIR/pat-unsafe.rs:26:17
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/instrument-coverage/bad-value.bad.stderr b/tests/ui/instrument-coverage/bad-value.bad.stderr
new file mode 100644
index 000000000..b867d169d
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.bad.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `bad-value` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
+
diff --git a/tests/ui/instrument-coverage/bad-value.blank.stderr b/tests/ui/instrument-coverage/bad-value.blank.stderr
new file mode 100644
index 000000000..e7122fb61
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.blank.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
+
diff --git a/tests/ui/instrument-coverage/bad-value.rs b/tests/ui/instrument-coverage/bad-value.rs
new file mode 100644
index 000000000..1925c36aa
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.rs
@@ -0,0 +1,5 @@
+// revisions: blank bad
+// [blank] compile-flags: -Cinstrument-coverage=
+// [bad] compile-flags: -Cinstrument-coverage=bad-value
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/off-values.rs b/tests/ui/instrument-coverage/off-values.rs
new file mode 100644
index 000000000..0f9a0c474
--- /dev/null
+++ b/tests/ui/instrument-coverage/off-values.rs
@@ -0,0 +1,9 @@
+// check-pass
+// revisions: n no off false zero
+// [n] compile-flags: -Cinstrument-coverage=n
+// [no] compile-flags: -Cinstrument-coverage=no
+// [off] compile-flags: -Cinstrument-coverage=off
+// [false] compile-flags: -Cinstrument-coverage=false
+// [zero] compile-flags: -Cinstrument-coverage=0
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/on-values.rs b/tests/ui/instrument-coverage/on-values.rs
new file mode 100644
index 000000000..cc54c71c6
--- /dev/null
+++ b/tests/ui/instrument-coverage/on-values.rs
@@ -0,0 +1,11 @@
+// check-pass
+// needs-profiler-support
+// revisions: default y yes on true all
+// [default] compile-flags: -Cinstrument-coverage
+// [y] compile-flags: -Cinstrument-coverage=y
+// [yes] compile-flags: -Cinstrument-coverage=yes
+// [on] compile-flags: -Cinstrument-coverage=on
+// [true] compile-flags: -Cinstrument-coverage=true
+// [all] compile-flags: -Cinstrument-coverage=all
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/unstable.branch.stderr b/tests/ui/instrument-coverage/unstable.branch.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.branch.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr b/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr b/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.rs b/tests/ui/instrument-coverage/unstable.rs
new file mode 100644
index 000000000..c16bcd0bf
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.rs
@@ -0,0 +1,6 @@
+// revisions: branch except-unused-functions except-unused-generics
+// [branch] compile-flags: -Cinstrument-coverage=branch
+// [except-unused-functions] compile-flags: -Cinstrument-coverage=except-unused-functions
+// [except-unused-generics] compile-flags: -Cinstrument-coverage=except-unused-generics
+
+fn main() {}
diff --git a/tests/ui/integral-indexing.stderr b/tests/ui/integral-indexing.stderr
index bbbb2a86a..97e658617 100644
--- a/tests/ui/integral-indexing.stderr
+++ b/tests/ui/integral-indexing.stderr
@@ -5,7 +5,8 @@ LL | v[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `Vec<isize>` to implement `Index<u8>`
error[E0277]: the type `[isize]` cannot be indexed by `i8`
@@ -15,7 +16,8 @@ LL | v[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i8`
= note: required for `Vec<isize>` to implement `Index<i8>`
error[E0277]: the type `[isize]` cannot be indexed by `u32`
@@ -25,7 +27,8 @@ LL | v[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u32`
= note: required for `Vec<isize>` to implement `Index<u32>`
error[E0277]: the type `[isize]` cannot be indexed by `i32`
@@ -35,7 +38,8 @@ LL | v[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `Vec<isize>` to implement `Index<i32>`
error[E0277]: the type `[u8]` cannot be indexed by `u8`
@@ -45,7 +49,8 @@ LL | s.as_bytes()[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `[u8]` to implement `Index<u8>`
error[E0277]: the type `[u8]` cannot be indexed by `i8`
@@ -55,7 +60,8 @@ LL | s.as_bytes()[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i8`
= note: required for `[u8]` to implement `Index<i8>`
error[E0277]: the type `[u8]` cannot be indexed by `u32`
@@ -65,7 +71,8 @@ LL | s.as_bytes()[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u32`
= note: required for `[u8]` to implement `Index<u32>`
error[E0277]: the type `[u8]` cannot be indexed by `i32`
@@ -75,7 +82,8 @@ LL | s.as_bytes()[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `[u8]` to implement `Index<i32>`
error: aborting due to 8 previous errors
diff --git a/tests/ui/intrinsics/const-eval-select-bad.rs b/tests/ui/intrinsics/const-eval-select-bad.rs
index 991d1450a..7e75de88d 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.rs
+++ b/tests/ui/intrinsics/const-eval-select-bad.rs
@@ -8,8 +8,8 @@ const fn not_fn_items() {
//~^ ERROR this argument must be a function item
//~| ERROR this argument must be a function item
const_eval_select((), 42, 0xDEADBEEF);
- //~^ ERROR expected a `FnOnce<()>` closure
- //~| ERROR expected a `FnOnce<()>` closure
+ //~^ ERROR expected a `FnOnce()` closure
+ //~| ERROR expected a `FnOnce()` closure
//~| ERROR this argument must be a function item
//~| ERROR this argument must be a function item
}
diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr
index ecd08e3cd..e6ff9d5a0 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.stderr
+++ b/tests/ui/intrinsics/const-eval-select-bad.stderr
@@ -25,11 +25,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
= note: expected a function item, found {integer}
= help: consult the documentation on `const_eval_select` for more information
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:10:27
|
LL | const_eval_select((), 42, 0xDEADBEEF);
- | ----------------- ^^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ----------------- ^^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
@@ -47,11 +47,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
= note: expected a function item, found {integer}
= help: consult the documentation on `const_eval_select` for more information
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:10:31
|
LL | const_eval_select((), 42, 0xDEADBEEF);
- | ----------------- ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ----------------- ^^^^^^^^^^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
index 4fc304cda..317466eb3 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/intrinsic-raw_eq-const-bad.rs:5:5
|
LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc3[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/intrinsic-raw_eq-const-bad.rs:11:5
diff --git a/tests/ui/invalid/invalid-llvm-passes.rs b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
index ee28f5eb6..ee28f5eb6 100644
--- a/tests/ui/invalid/invalid-llvm-passes.rs
+++ b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
diff --git a/tests/ui/invalid/invalid-llvm-passes.stderr b/tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr
index ae1f85e41..ae1f85e41 100644
--- a/tests/ui/invalid/invalid-llvm-passes.stderr
+++ b/tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr
diff --git a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr b/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
index 7bc8efd7e..08aec2592 100644
--- a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
+++ b/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
@@ -5,6 +5,7 @@ LL | pub mod baz;
| ^^^^^^^^^^^^
|
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs" or "$DIR/auxiliary/foo/bar/baz/mod.rs"
+ = note: if there is a `mod baz` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/invalid/invalid-plugin-attr.rs b/tests/ui/invalid/invalid-plugin-attr.rs
deleted file mode 100644
index 3080af245..000000000
--- a/tests/ui/invalid/invalid-plugin-attr.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-#![deny(unused_attributes)]
-#![feature(plugin)]
-
-#[plugin(bla)] //~ ERROR should be an inner attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/invalid/invalid-plugin-attr.stderr b/tests/ui/invalid/invalid-plugin-attr.stderr
deleted file mode 100644
index d3882d33f..000000000
--- a/tests/ui/invalid/invalid-plugin-attr.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/invalid-plugin-attr.rs:4:1
- |
-LL | #[plugin(bla)]
- | ^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/invalid-plugin-attr.rs:4:1
- |
-LL | #[plugin(bla)]
- | ^^^^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/invalid-plugin-attr.rs:1:9
- |
-LL | #![deny(unused_attributes)]
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
index 172ee7ade..168ed37d0 100644
--- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr
+++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
@@ -1,16 +1,20 @@
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
--> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1
|
-LL | impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
+LL | | where
+LL | | T: DispatchFromDyn<U>,
+ | |__________________________^
|
= note: extra field `1` of type `i32` is not allowed
error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions
--> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_________________^
|
= 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`)
@@ -26,14 +30,18 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingT
error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
--> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_________________^
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
--> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_____________________^
|
= note: extra field `1` of type `OverAlignedZst` is not allowed
diff --git a/tests/ui/issues/issue-12187-1.stderr b/tests/ui/issues/issue-12187-1.stderr
index 806b7f0ac..d2a6a9608 100644
--- a/tests/ui/issues/issue-12187-1.stderr
+++ b/tests/ui/issues/issue-12187-1.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
--> $DIR/issue-12187-1.rs:6:9
|
LL | let &v = new();
- | ^^
+ | ^^ ----- type must be known at this point
|
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
LL | let &v: &T = new();
| ++++
diff --git a/tests/ui/issues/issue-12187-2.stderr b/tests/ui/issues/issue-12187-2.stderr
index a1fa0a2b0..ac75ebb42 100644
--- a/tests/ui/issues/issue-12187-2.stderr
+++ b/tests/ui/issues/issue-12187-2.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
--> $DIR/issue-12187-2.rs:6:9
|
LL | let &v = new();
- | ^^
+ | ^^ ----- type must be known at this point
|
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
LL | let &v: &T = new();
| ++++
diff --git a/tests/ui/issues/issue-12567.stderr b/tests/ui/issues/issue-12567.stderr
index 7fa06825f..3f95f18a9 100644
--- a/tests/ui/issues/issue-12567.stderr
+++ b/tests/ui/issues/issue-12567.stderr
@@ -8,7 +8,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| -- data moved here
LL | => println!("one empty"),
LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
+ | --- ...and here
|
= note: move occurs because these variables have types that don't implement the `Copy` trait
help: consider borrowing the pattern binding
@@ -17,8 +17,8 @@ LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
| +++
help: consider borrowing the pattern binding
|
-LL | (&[ref hd1, ..], &[hd2, ..])
- | +++
+LL | (&[hd1, ..], &[ref hd2, ..])
+ | +++
error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
@@ -30,7 +30,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| -- data moved here
LL | => println!("one empty"),
LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
+ | --- ...and here
|
= note: move occurs because these variables have types that don't implement the `Copy` trait
help: consider borrowing the pattern binding
@@ -39,8 +39,8 @@ LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
| +++
help: consider borrowing the pattern binding
|
-LL | (&[hd1, ..], &[ref hd2, ..])
- | +++
+LL | (&[ref hd1, ..], &[hd2, ..])
+ | +++
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/issues/issue-16966.stderr
index 8c92505b5..c53707c5d 100644
--- a/tests/ui/issues/issue-16966.stderr
+++ b/tests/ui/issues/issue-16966.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-16966.rs:2:12
|
LL | panic!(std::default::Default::default());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+ | -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+ | | |
+ | | cannot infer type
+ | required by a bound introduced by this call
+ |
+ = note: cannot satisfy `_: Any`
+note: required by a bound in `begin_panic`
+ --> $SRC_DIR/std/src/panicking.rs:LL:COL
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/issues/issue-17551.stderr b/tests/ui/issues/issue-17551.stderr
index 5f45a2f84..3a8f569a3 100644
--- a/tests/ui/issues/issue-17551.stderr
+++ b/tests/ui/issues/issue-17551.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `B<T>`
--> $DIR/issue-17551.rs:6:9
|
LL | let foo = B(marker::PhantomData);
- | ^^^
+ | ^^^ ------------------- type must be known at this point
|
help: consider giving `foo` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/issues/issue-19380.rs b/tests/ui/issues/issue-19380.rs
index 5c10e2067..fce737cba 100644
--- a/tests/ui/issues/issue-19380.rs
+++ b/tests/ui/issues/issue-19380.rs
@@ -14,5 +14,6 @@ struct Bar {
const FOO : Foo = Foo;
const BAR : Bar = Bar { foos: &[&FOO]};
+//~^ ERROR E0038
fn main() { }
diff --git a/tests/ui/issues/issue-19380.stderr b/tests/ui/issues/issue-19380.stderr
index b2aeb5edf..f6244d9d4 100644
--- a/tests/ui/issues/issue-19380.stderr
+++ b/tests/ui/issues/issue-19380.stderr
@@ -11,6 +11,7 @@ LL | trait Qiz {
| --- this trait cannot be made into an object...
LL | fn qiz();
| ^^^ ...because associated function `qiz` has no `self` parameter
+ = help: only type `Foo` implements the trait, consider using it directly instead
help: consider turning `qiz` into a method by giving it a `&self` argument
|
LL | fn qiz(&self);
@@ -20,6 +21,30 @@ help: alternatively, consider constraining `qiz` so it does not apply to trait o
LL | fn qiz() where Self: Sized;
| +++++++++++++++++
-error: aborting due to previous error
+error[E0038]: the trait `Qiz` cannot be made into an object
+ --> $DIR/issue-19380.rs:16:33
+ |
+LL | const BAR : Bar = Bar { foos: &[&FOO]};
+ | ^^^^ `Qiz` 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/issue-19380.rs:2:6
+ |
+LL | trait Qiz {
+ | --- this trait cannot be made into an object...
+LL | fn qiz();
+ | ^^^ ...because associated function `qiz` has no `self` parameter
+ = help: only type `Foo` implements the trait, consider using it directly instead
+ = note: required for the cast from `&Foo` to `&'static (dyn Qiz + 'static)`
+help: consider turning `qiz` into a method by giving it a `&self` argument
+ |
+LL | fn qiz(&self);
+ | +++++
+help: alternatively, consider constraining `qiz` so it does not apply to trait objects
+ |
+LL | fn qiz() where Self: Sized;
+ | +++++++++++++++++
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/issues/issue-19482.rs b/tests/ui/issues/issue-19482.rs
index 3f3c5de9b..9d0c8d96d 100644
--- a/tests/ui/issues/issue-19482.rs
+++ b/tests/ui/issues/issue-19482.rs
@@ -8,6 +8,6 @@ trait Foo {
}
fn bar(x: &dyn Foo) {}
-//~^ ERROR the associated type `A` (from trait `Foo`) must be specified
+//~^ ERROR the associated type `A` in `Foo` must be specified
pub fn main() {}
diff --git a/tests/ui/issues/issue-19482.stderr b/tests/ui/issues/issue-19482.stderr
index d51cc1f08..90e6f7995 100644
--- a/tests/ui/issues/issue-19482.stderr
+++ b/tests/ui/issues/issue-19482.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/issue-19482.rs:10:16
|
LL | type A;
diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr
index b1c156720..b34aa8e1f 100644
--- a/tests/ui/issues/issue-20225.stderr
+++ b/tests/ui/issues/issue-20225.stderr
@@ -2,7 +2,7 @@ error[E0053]: method `call` has an incompatible type for trait
--> $DIR/issue-20225.rs:6:43
|
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
| ^^^^
| |
@@ -16,7 +16,7 @@ error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/issue-20225.rs:11:51
|
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
| ^^^^
| |
@@ -30,7 +30,7 @@ error[E0053]: method `call_once` has an incompatible type for trait
--> $DIR/issue-20225.rs:18:47
|
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
...
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
| ^^^^
diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/issues/issue-21950.stderr
index 731615a6b..e498565d4 100644
--- a/tests/ui/issues/issue-21950.stderr
+++ b/tests/ui/issues/issue-21950.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified
+error[E0191]: the value of the associated type `Output` in `Add` must be specified
--> $DIR/issue-21950.rs:10:25
|
LL | type Output;
diff --git a/tests/ui/issues/issue-22034.rs b/tests/ui/issues/issue-22034.rs
index 405ffd089..ed741779f 100644
--- a/tests/ui/issues/issue-22034.rs
+++ b/tests/ui/issues/issue-22034.rs
@@ -6,6 +6,6 @@ fn main() {
let ptr: *mut () = core::ptr::null_mut();
let _: &mut dyn Fn() = unsafe {
&mut *(ptr as *mut dyn Fn())
- //~^ ERROR expected a `Fn<()>` closure, found `()`
+ //~^ ERROR expected a `Fn()` closure, found `()`
};
}
diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/issues/issue-22034.stderr
index 9833e559c..d64b02409 100644
--- a/tests/ui/issues/issue-22034.stderr
+++ b/tests/ui/issues/issue-22034.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `()`
+error[E0277]: expected a `Fn()` closure, found `()`
--> $DIR/issue-22034.rs:8:16
|
LL | &mut *(ptr as *mut dyn Fn())
- | ^^^ expected an `Fn<()>` closure, found `()`
+ | ^^^ expected an `Fn()` closure, found `()`
|
= help: the trait `Fn<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
diff --git a/tests/ui/issues/issue-22434.rs b/tests/ui/issues/issue-22434.rs
index 34057b46e..d9f7b987c 100644
--- a/tests/ui/issues/issue-22434.rs
+++ b/tests/ui/issues/issue-22434.rs
@@ -3,6 +3,6 @@ pub trait Foo {
}
type I<'a> = &'a (dyn Foo + 'a);
-//~^ ERROR the value of the associated type `A` (from trait `Foo`) must be specified
+//~^ ERROR the value of the associated type `A` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/issues/issue-22434.stderr
index b97fa2503..dab62bcbb 100644
--- a/tests/ui/issues/issue-22434.stderr
+++ b/tests/ui/issues/issue-22434.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/issue-22434.rs:5:23
|
LL | type A;
diff --git a/tests/ui/issues/issue-23024.rs b/tests/ui/issues/issue-23024.rs
index 010281ee3..25220dc3e 100644
--- a/tests/ui/issues/issue-23024.rs
+++ b/tests/ui/issues/issue-23024.rs
@@ -8,5 +8,5 @@ fn main()
println!("{:?}",(vfnfer[0] as dyn Fn)(3));
//~^ ERROR the precise format of `Fn`-family traits'
//~| ERROR missing generics for trait `Fn`
- //~| ERROR the value of the associated type `Output` (from trait `FnOnce`)
+ //~| ERROR the value of the associated type `Output` in `FnOnce`
}
diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr
index 2c325ffcc..7d187de1b 100644
--- a/tests/ui/issues/issue-23024.stderr
+++ b/tests/ui/issues/issue-23024.stderr
@@ -18,7 +18,7 @@ help: add missing generic argument
LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3));
| ++++++
-error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified
+error[E0191]: the value of the associated type `Output` in `FnOnce` must be specified
--> $DIR/issue-23024.rs:8:39
|
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
diff --git a/tests/ui/issues/issue-23966.stderr b/tests/ui/issues/issue-23966.stderr
index 8f934481d..542aed0eb 100644
--- a/tests/ui/issues/issue-23966.stderr
+++ b/tests/ui/issues/issue-23966.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(_, char)>` closure, found `()`
+error[E0277]: expected a `FnMut(_, char)` closure, found `()`
--> $DIR/issue-23966.rs:2:32
|
LL | "".chars().fold(|_, _| (), ());
- | ---- ^^ expected an `FnMut<(_, char)>` closure, found `()`
+ | ---- ^^ expected an `FnMut(_, char)` closure, found `()`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr
index a425816cd..184383b73 100644
--- a/tests/ui/issues/issue-24036.stderr
+++ b/tests/ui/issues/issue-24036.stderr
@@ -11,12 +11,13 @@ LL | x = |c| c + 1;
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
--> $DIR/issue-24036.rs:9:15
|
LL | 1 => |c| c + 1,
- | ^
+ | ^ - type must be known at this point
|
+ = note: cannot satisfy `<_ as Add<i32>>::Output == _`
help: consider giving this closure parameter an explicit type
|
LL | 1 => |c: /* Type */| c + 1,
@@ -24,5 +25,5 @@ LL | 1 => |c: /* Type */| c + 1,
error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0282, E0308.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0284, E0308.
+For more information about an error, try `rustc --explain E0284`.
diff --git a/tests/ui/issues/issue-24446.rs b/tests/ui/issues/issue-24446.rs
index 9ab952ade..6cf884650 100644
--- a/tests/ui/issues/issue-24446.rs
+++ b/tests/ui/issues/issue-24446.rs
@@ -2,6 +2,8 @@ fn main() {
static foo: dyn Fn() -> u32 = || -> u32 {
//~^ ERROR the size for values of type
//~| ERROR cannot be shared between threads safely
+ //~| ERROR the size for values of type
+ //~| ERROR mismatched types
0
};
}
diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/issues/issue-24446.stderr
index 4afb87c48..9c206e5ef 100644
--- a/tests/ui/issues/issue-24446.stderr
+++ b/tests/ui/issues/issue-24446.stderr
@@ -1,3 +1,12 @@
+error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+ --> $DIR/issue-24446.rs:2:17
+ |
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
+ = note: shared static variables must have a type that implements `Sync`
+
error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
--> $DIR/issue-24446.rs:2:17
|
@@ -6,15 +15,39 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 {
|
= help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
-error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
- --> $DIR/issue-24446.rs:2:17
+error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
+ --> $DIR/issue-24446.rs:2:35
|
-LL | static foo: dyn Fn() -> u32 = || -> u32 {
- | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ___________________________________^
+LL | |
+LL | |
+LL | |
+LL | |
+LL | | 0
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
|
- = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
- = note: shared static variables must have a type that implements `Sync`
+ = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0308]: mismatched types
+ --> $DIR/issue-24446.rs:2:35
+ |
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ___________________________________^
+LL | |
+LL | |
+LL | |
+LL | |
+LL | | 0
+LL | | };
+ | |_____^ expected `dyn Fn`, found closure
+ |
+ = note: expected trait object `(dyn Fn() -> u32 + 'static)`
+ found closure `{closure@$DIR/issue-24446.rs:2:35: 2:44}`
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr
index f398a5da3..71d642109 100644
--- a/tests/ui/issues/issue-28344.stderr
+++ b/tests/ui/issues/issue-28344.stderr
@@ -12,7 +12,7 @@ help: use `dyn`
LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8);
| ++++ +
-error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
+error[E0191]: the value of the associated type `Output` in `BitXor` must be specified
--> $DIR/issue-28344.rs:4:17
|
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
@@ -40,7 +40,7 @@ help: use `dyn`
LL | let g = <dyn BitXor>::bitor;
| ++++ +
-error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
+error[E0191]: the value of the associated type `Output` in `BitXor` must be specified
--> $DIR/issue-28344.rs:10:13
|
LL | let g = BitXor::bitor;
diff --git a/tests/ui/issues/issue-33571.stderr b/tests/ui/issues/issue-33571.stderr
index 2a9ba5ba7..819a533dd 100644
--- a/tests/ui/issues/issue-33571.stderr
+++ b/tests/ui/issues/issue-33571.stderr
@@ -21,6 +21,7 @@ note: unsafe traits like `Sync` should be implemented explicitly
|
LL | Sync,
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-34334.stderr b/tests/ui/issues/issue-34334.stderr
index 9d2c315e4..753942dd1 100644
--- a/tests/ui/issues/issue-34334.stderr
+++ b/tests/ui/issues/issue-34334.stderr
@@ -19,7 +19,8 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<(u32, _, _)>` is implemented for `Vec<(u32, _, _)>`
+ = help: for that trait implementation, expected `(u32, _, _)`, found `()`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-34334.rs:5:43
|
diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs
index 1e67e9a81..40f7186db 100644
--- a/tests/ui/issues/issue-37534.rs
+++ b/tests/ui/issues/issue-37534.rs
@@ -1,6 +1,6 @@
-struct Foo<T: ?Hash> { }
+struct Foo<T: ?Hash> {}
//~^ ERROR expected trait, found derive macro `Hash`
//~^^ ERROR parameter `T` is never used
-//~^^^ WARN default bound relaxed for a type parameter, but this does nothing
+//~^^^ WARN relaxing a default bound only does something for `?Sized`
-fn main() { }
+fn main() {}
diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr
index 7d3dd8800..03fea2c16 100644
--- a/tests/ui/issues/issue-37534.stderr
+++ b/tests/ui/issues/issue-37534.stderr
@@ -1,7 +1,7 @@
error[E0404]: expected trait, found derive macro `Hash`
--> $DIR/issue-37534.rs:1:16
|
-LL | struct Foo<T: ?Hash> { }
+LL | struct Foo<T: ?Hash> {}
| ^^^^ not a trait
|
help: consider importing this trait instead
@@ -9,16 +9,16 @@ help: consider importing this trait instead
LL + use std::hash::Hash;
|
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-37534.rs:1:12
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-37534.rs:1:15
|
-LL | struct Foo<T: ?Hash> { }
- | ^
+LL | struct Foo<T: ?Hash> {}
+ | ^^^^^
error[E0392]: parameter `T` is never used
--> $DIR/issue-37534.rs:1:12
|
-LL | struct Foo<T: ?Hash> { }
+LL | struct Foo<T: ?Hash> {}
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
diff --git a/tests/ui/issues/issue-40000.stderr b/tests/ui/issues/issue-40000.stderr
index c41fbb9d2..0737a9610 100644
--- a/tests/ui/issues/issue-40000.stderr
+++ b/tests/ui/issues/issue-40000.stderr
@@ -15,6 +15,7 @@ LL | foo(bar);
|
= note: expected trait object `dyn for<'a> Fn(&'a i32)`
found trait object `dyn Fn(&i32)`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-43355.stderr b/tests/ui/issues/issue-43355.stderr
index 57adc8ad5..9aeca8efe 100644
--- a/tests/ui/issues/issue-43355.stderr
+++ b/tests/ui/issues/issue-43355.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1<Box<_>>` for type `A`
--> $DIR/issue-43355.rs:13:1
|
LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
- | -------------------------- first implementation here
+ | --------------------------------------------- first implementation here
...
LL | impl<X> Trait1<Box<X>> for A {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
diff --git a/tests/ui/issues/issue-45801.stderr b/tests/ui/issues/issue-45801.stderr
index 8967f49df..e651e2a68 100644
--- a/tests/ui/issues/issue-45801.stderr
+++ b/tests/ui/issues/issue-45801.stderr
@@ -5,6 +5,7 @@ LL | req.get_ref::<Params>();
| ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params`
|
= help: the trait `Plugin<Foo>` is implemented for `Params`
+ = help: for that trait implementation, expected `Foo`, found `i32`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-46101.stderr b/tests/ui/issues/issue-46101.stderr
index 40295b8a1..a0cdd5d5f 100644
--- a/tests/ui/issues/issue-46101.stderr
+++ b/tests/ui/issues/issue-46101.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: partially resolved path in a derive macro
|
LL | #[derive(Foo::Anything)]
| ^^^^^^^^^^^^^ partially resolved path in a derive macro
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-47715.rs b/tests/ui/issues/issue-47715.rs
index b8088c18d..0a770593b 100644
--- a/tests/ui/issues/issue-47715.rs
+++ b/tests/ui/issues/issue-47715.rs
@@ -7,22 +7,22 @@ trait Iterable {
}
struct Container<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
field: T
}
enum Enum<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
A(T),
}
union Union<T: Iterable<Item = impl Foo> + Copy> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
x: T,
}
type Type<T: Iterable<Item = impl Foo>> = T;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn main() {
}
diff --git a/tests/ui/issues/issue-47715.stderr b/tests/ui/issues/issue-47715.stderr
index dadea34b6..2ded98781 100644
--- a/tests/ui/issues/issue-47715.stderr
+++ b/tests/ui/issues/issue-47715.stderr
@@ -1,22 +1,22 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:9:37
|
LL | struct Container<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:14:30
|
LL | enum Enum<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:19:32
|
LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:24:30
|
LL | type Type<T: Iterable<Item = impl Foo>> = T;
diff --git a/tests/ui/issues/issue-51154.stderr b/tests/ui/issues/issue-51154.stderr
index 002d5ccdc..5ae8e0678 100644
--- a/tests/ui/issues/issue-51154.stderr
+++ b/tests/ui/issues/issue-51154.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-51154.rs:2:30
|
LL | fn foo<F: FnMut()>() {
- | - this type parameter
+ | - expected this type parameter
LL | let _: Box<F> = Box::new(|| ());
| -------- ^^^^^ expected type parameter `F`, found closure
| |
diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr
index d5f14e8de..05ea63115 100644
--- a/tests/ui/issues/issue-53251.stderr
+++ b/tests/ui/issues/issue-53251.stderr
@@ -32,6 +32,7 @@ note: associated function defined here, with 0 generic parameters
|
LL | fn f() {}
| ^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-59494.rs b/tests/ui/issues/issue-59494.rs
index a53e28f72..8dcdd88c6 100644
--- a/tests/ui/issues/issue-59494.rs
+++ b/tests/ui/issues/issue-59494.rs
@@ -19,5 +19,5 @@ fn main() {
let g = |(a, _)| a;
let t7 = |env| |a| |b| t7p(f, g)(((env, a), b));
let t8 = t8n(t7, t7p(f, g));
- //~^ ERROR: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` [E0277]
+ //~^ ERROR: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))` [E0277]
}
diff --git a/tests/ui/issues/issue-59494.stderr b/tests/ui/issues/issue-59494.stderr
index a9284535e..e9a4bf967 100644
--- a/tests/ui/issues/issue-59494.stderr
+++ b/tests/ui/issues/issue-59494.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
+error[E0277]: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))`
--> $DIR/issue-59494.rs:21:22
|
LL | let t8 = t8n(t7, t7p(f, g));
- | --- ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
+ | --- ^^^^^^^^^ expected an `Fn(_)` closure, found `impl Fn(((_, _), _))`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
index d9a960ce1..cec811770 100644
--- a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
+++ b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
@@ -19,7 +19,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:2:5
|
LL | fn first() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | second == 1
| ^^^^^^^^^^^ expected `()`, found `bool`
@@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:8:5
|
LL | fn second() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | first == 1
| ^^^^^^^^^^ expected `()`, found `bool`
@@ -69,7 +69,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:14:5
|
LL | fn bar() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | bar == 1
| ^^^^^^^^ expected `()`, found `bool`
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 22b1da64c..128288e28 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
@@ -5,7 +5,8 @@ LL | let x2: Vec<f64> = x1.into_iter().collect();
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
+ = help: for that trait implementation, expected `f64`, found `&f64`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:27
|
@@ -25,7 +26,8 @@ LL | let x3 = x1.into_iter().collect::<Vec<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>`
+ = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
+ = help: for that trait implementation, expected `f64`, found `&f64`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:17
|
diff --git a/tests/ui/issues/issue-69306.stderr b/tests/ui/issues/issue-69306.stderr
index 570677298..6fc5c33af 100644
--- a/tests/ui/issues/issue-69306.stderr
+++ b/tests/ui/issues/issue-69306.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:5:28
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - expected this type parameter
LL | const C: S0<u8> = Self(0);
| ---- ^ expected type parameter `T`, found integer
| |
@@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:5:23
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - found this type parameter
LL | const C: S0<u8> = Self(0);
| ^^^^^^^ expected `S0<u8>`, found `S0<T>`
|
@@ -31,7 +31,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:10:14
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(0);
| ---- ^ expected type parameter `T`, found integer
@@ -50,7 +50,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:27:14
|
LL | impl<T> Foo<T> for <S0<T> as Fun>::Out {
- | - this type parameter
+ | - expected this type parameter
LL | fn foo() {
LL | Self(0);
| ---- ^ expected type parameter `T`, found integer
@@ -69,7 +69,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:33:32
|
LL | impl<T> S1<T, u8> {
- | - this type parameter
+ | - expected this type parameter
LL | const C: S1<u8, u8> = Self(0, 1);
| ---- ^ expected type parameter `T`, found integer
| |
@@ -87,7 +87,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:33:27
|
LL | impl<T> S1<T, u8> {
- | - this type parameter
+ | - found this type parameter
LL | const C: S1<u8, u8> = Self(0, 1);
| ^^^^^^^^^^ expected `S1<u8, u8>`, found `S1<T, u8>`
|
diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/issues/issue-77919.rs
index 966d76d14..bf6033149 100644
--- a/tests/ui/issues/issue-77919.rs
+++ b/tests/ui/issues/issue-77919.rs
@@ -10,4 +10,4 @@ struct Multiply<N, M> {
}
impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
//~^ ERROR cannot find type `VAL` in this scope
-//~| ERROR not all trait items implemented, missing: `VAL`
+//~| ERROR not all trait items implemented
diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr
index d6dcc8997..dbbe70ff0 100644
--- a/tests/ui/issues/issue-77919.stderr
+++ b/tests/ui/issues/issue-77919.stderr
@@ -27,7 +27,7 @@ LL | const VAL: T;
| ------------ `VAL` from trait
...
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
error: aborting due to 3 previous errors
diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs
index a80a64a2f..d16d40676 100644
--- a/tests/ui/issues/issue-87199.rs
+++ b/tests/ui/issues/issue-87199.rs
@@ -6,11 +6,11 @@
// Check that these function definitions only emit warnings, not errors
fn arg<T: ?Send>(_: T) {}
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
fn ref_arg<T: ?Send>(_: &T) {}
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
// Check that there's no `?Sized` relaxation!
fn main() {
diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr
index 67949b37d..e02cd7fcf 100644
--- a/tests/ui/issues/issue-87199.stderr
+++ b/tests/ui/issues/issue-87199.stderr
@@ -1,20 +1,20 @@
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:8:8
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:8:11
|
LL | fn arg<T: ?Send>(_: T) {}
- | ^
+ | ^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:10:12
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:10:15
|
LL | fn ref_arg<T: ?Send>(_: &T) {}
- | ^
+ | ^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:12:13
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:12:40
|
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:15
diff --git a/tests/ui/iterators/collect-into-slice.stderr b/tests/ui/iterators/collect-into-slice.stderr
index 07dc561f0..45685ef0c 100644
--- a/tests/ui/iterators/collect-into-slice.stderr
+++ b/tests/ui/iterators/collect-into-slice.stderr
@@ -1,3 +1,13 @@
+error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
+ --> $DIR/collect-into-slice.rs:6:38
+ |
+LL | let some_generated_vec = (0..10).collect();
+ | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
+ |
+ = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/collect-into-slice.rs:6:9
|
@@ -18,16 +28,6 @@ LL | let some_generated_vec = (0..10).collect();
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
- --> $DIR/collect-into-slice.rs:6:38
- |
-LL | let some_generated_vec = (0..10).collect();
- | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
- |
- = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
-note: required by a bound in `collect`
- --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-
error[E0277]: a slice of type `&[i32]` cannot be built since we need to store the elements somewhere
--> $DIR/collect-into-slice.rs:18:38
|
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.fixed b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed
new file mode 100644
index 000000000..513b5bd13
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed
@@ -0,0 +1,42 @@
+// run-rustfix
+use std::collections::hash_set::Iter;
+use std::collections::HashSet;
+
+fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ let i = i.map(|x| x.clone());
+ i.collect() //~ ERROR E0277
+}
+
+fn main() {
+ let v = vec![(0, 0)];
+ let scores = v
+ .iter()
+ .map(|(a, b)| {
+ a + b
+ });
+ println!("{}", scores.sum::<i32>()); //~ ERROR E0277
+ println!(
+ "{}",
+ vec![0, 1]
+ .iter()
+ .map(|x| x * 2)
+ .map(|x| { x })
+ .map(|x| { x })
+ .sum::<i32>(), //~ ERROR E0277
+ );
+ println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>()); //~ ERROR E0277
+ let a = vec![0];
+ let b = a.into_iter();
+ let c = b.map(|x| x + 1);
+ let d = c.filter(|x| *x > 10 );
+ let e = d.map(|x| {
+ x + 1
+ });
+ let f = e.filter(|_| false);
+ let g: Vec<i32> = f.collect(); //~ ERROR E0277
+ println!("{g:?}");
+
+ let mut s = HashSet::new();
+ s.insert(1u8);
+ println!("{:?}", iter_to_vec(s.iter()));
+}
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.rs b/tests/ui/iterators/invalid-iterator-chain-fixable.rs
new file mode 100644
index 000000000..79b861702
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.rs
@@ -0,0 +1,42 @@
+// run-rustfix
+use std::collections::hash_set::Iter;
+use std::collections::HashSet;
+
+fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> {
+ let i = i.map(|x| x.clone());
+ i.collect() //~ ERROR E0277
+}
+
+fn main() {
+ let v = vec![(0, 0)];
+ let scores = v
+ .iter()
+ .map(|(a, b)| {
+ a + b;
+ });
+ println!("{}", scores.sum::<i32>()); //~ ERROR E0277
+ println!(
+ "{}",
+ vec![0, 1]
+ .iter()
+ .map(|x| x * 2)
+ .map(|x| { x; })
+ .map(|x| { x })
+ .sum::<i32>(), //~ ERROR E0277
+ );
+ println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); //~ ERROR E0277
+ let a = vec![0];
+ let b = a.into_iter();
+ let c = b.map(|x| x + 1);
+ let d = c.filter(|x| *x > 10 );
+ let e = d.map(|x| {
+ x + 1;
+ });
+ let f = e.filter(|_| false);
+ let g: Vec<i32> = f.collect(); //~ ERROR E0277
+ println!("{g:?}");
+
+ let mut s = HashSet::new();
+ s.insert(1u8);
+ println!("{:?}", iter_to_vec(s.iter()));
+}
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr
new file mode 100644
index 000000000..1bfe765e7
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr
@@ -0,0 +1,157 @@
+error[E0277]: a value of type `Vec<X>` cannot be built from an iterator over elements of type `&X`
+ --> $DIR/invalid-iterator-chain-fixable.rs:7:7
+ |
+LL | let i = i.map(|x| x.clone());
+ | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone`
+LL | i.collect()
+ | ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
+ |
+ = help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
+ = help: the trait `FromIterator<X>` is implemented for `Vec<X>`
+ = help: for that trait implementation, expected `X`, found `&X`
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:5:26
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> {
+ | ^^^^^^^^^^^ `Iterator::Item` is `&X` here
+LL | let i = i.map(|x| x.clone());
+ | ------------------ `Iterator::Item` remains `&X` here
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider further restricting type parameter `X`
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ | ++++++++++++++
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:17:33
+ |
+LL | println!("{}", scores.sum::<i32>());
+ | --- ^^^ 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>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:14:10
+ |
+LL | let v = vec![(0, 0)];
+ | ------------ this expression has type `Vec<({integer}, {integer})>`
+LL | let scores = v
+LL | .iter()
+ | ------ `Iterator::Item` is `&({integer}, {integer})` here
+LL | .map(|(a, b)| {
+ | __________^
+LL | | a + b;
+LL | | });
+ | |__________^ `Iterator::Item` changed to `()` here
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - a + b;
+LL + a + b
+ |
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:25:20
+ |
+LL | .sum::<i32>(),
+ | --- ^^^ 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>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:23:14
+ |
+LL | vec![0, 1]
+ | ---------- this expression has type `Vec<{integer}>`
+LL | .iter()
+ | ------ `Iterator::Item` is `&{integer}` here
+LL | .map(|x| x * 2)
+ | -------------- `Iterator::Item` changed to `{integer}` here
+LL | .map(|x| { x; })
+ | ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
+LL | .map(|x| { x })
+ | -------------- `Iterator::Item` remains `()` here
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - .map(|x| { x; })
+LL + .map(|x| { x })
+ |
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:27: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=()>`
+ | |
+ | 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>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:27:38
+ |
+LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+ | ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
+ | | |
+ | | `Iterator::Item` is `&{integer}` here
+ | this expression has type `Vec<{integer}>`
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>());
+ |
+
+error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:36:25
+ |
+LL | let g: Vec<i32> = f.collect();
+ | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
+ |
+ = help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
+ = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
+ = help: for that trait implementation, expected `i32`, found `()`
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:32:15
+ |
+LL | let a = vec![0];
+ | ------- this expression has type `Vec<{integer}>`
+LL | let b = a.into_iter();
+ | ----------- `Iterator::Item` is `{integer}` here
+LL | let c = b.map(|x| x + 1);
+ | -------------- `Iterator::Item` remains `{integer}` here
+LL | let d = c.filter(|x| *x > 10 );
+ | -------------------- `Iterator::Item` remains `{integer}` here
+LL | let e = d.map(|x| {
+ | _______________^
+LL | | x + 1;
+LL | | });
+ | |______^ `Iterator::Item` changed to `()` here
+LL | let f = e.filter(|_| false);
+ | ----------------- `Iterator::Item` remains `()` here
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - x + 1;
+LL + x + 1
+ |
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr
index b355da5cb..4dc130869 100644
--- a/tests/ui/iterators/invalid-iterator-chain.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain.stderr
@@ -1,11 +1,14 @@
error[E0277]: a value of type `Vec<X>` cannot be built from an iterator over elements of type `&X`
--> $DIR/invalid-iterator-chain.rs:6:7
|
+LL | let i = i.map(|x| x.clone());
+ | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone`
LL | i.collect()
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
= help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<X>` is implemented for `Vec<X>`
+ = help: for that trait implementation, expected `X`, found `&X`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:4:26
|
@@ -15,6 +18,10 @@ LL | let i = i.map(|x| x.clone());
| ------------------ `Iterator::Item` remains `&X` here
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider further restricting type parameter `X`
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ | ++++++++++++++
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
--> $DIR/invalid-iterator-chain.rs:15:33
@@ -42,6 +49,11 @@ LL | | });
| |__________^ `Iterator::Item` changed to `()` here
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - a + b;
+LL + a + b
+ |
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
--> $DIR/invalid-iterator-chain.rs:26:20
@@ -76,6 +88,11 @@ LL | .map(|x| { x; })
| ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - .map(|x| { x; })
+LL + .map(|x| { x })
+ |
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:20
@@ -129,6 +146,11 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
| this expression has type `Vec<{integer}>`
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>());
+ |
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
--> $DIR/invalid-iterator-chain.rs:39:46
@@ -159,7 +181,8 @@ LL | let g: Vec<i32> = f.collect();
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
+ = help: for that trait implementation, expected `i32`, found `()`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:44:15
|
@@ -180,6 +203,11 @@ LL | let f = e.filter(|_| false);
| ----------------- `Iterator::Item` remains `()` here
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - x + 1;
+LL + x + 1
+ |
error: aborting due to 7 previous errors
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 4582b6985..25570f960 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
@@ -4,7 +4,7 @@ error[E0308]: lang item `start` function has wrong type
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
+ | expected this type parameter
|
= note: expected signature `fn(fn() -> T, _, _, _) -> _`
found signature `fn(fn() -> u16, _, _, _) -> _`
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 2bb29f911..14bfcc3d0 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,8 @@
error[E0308]: lang item `start` function has wrong type
- --> $DIR/start_lang_item_args.rs:29:84
+ --> $DIR/start_lang_item_args.rs:29:83
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
- | ^ expected `isize`, found `()`
+ | ^ expected `isize`, found `()`
|
= note: expected signature `fn(fn() -> _, _, _, _) -> isize`
found signature `fn(fn() -> _, _, _, _)`
diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
index d2b6e1d8e..1a2ff8c47 100644
--- a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
+++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
@@ -16,7 +16,8 @@ struct Other {
fn main() {
unsafe {
+ // FIXME(oli-obk): make this report a transmute error again.
std::mem::transmute::<Option<()>, Option<&Other>>(None);
- //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
+ //^ ERROR cannot transmute between types of different sizes, or dependently-sized types
}
}
diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
index dd5119318..ee2c5ab7e 100644
--- a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
+++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
@@ -4,16 +4,6 @@ error[E0412]: cannot find type `Missing` in this scope
LL | Missing: Trait,
| ^^^^^^^ not found in this scope
-error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
- --> $DIR/cannot-transmute-unnormalizable-type.rs:19:9
- |
-LL | std::mem::transmute::<Option<()>, Option<&Other>>(None);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: source type: `Option<()>` (8 bits)
- = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized)
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0412, E0512.
-For more information about an error, try `rustc --explain E0412`.
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/layout/issue-84108.rs b/tests/ui/layout/issue-84108.rs
index dd025c9b4..af21d1d62 100644
--- a/tests/ui/layout/issue-84108.rs
+++ b/tests/ui/layout/issue-84108.rs
@@ -9,6 +9,8 @@ static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
const BAR: (&Path, [u8], usize) = ("hello", [], 42);
//~^ ERROR cannot find type `Path` in this scope
//~| ERROR the size for values of type `[u8]` cannot be known at compilation time
+//~| ERROR mismatched types
static BAZ: ([u8], usize) = ([], 0);
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+//~| ERROR mismatched types
diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr
index 5ad450bed..3a02e73f9 100644
--- a/tests/ui/layout/issue-84108.stderr
+++ b/tests/ui/layout/issue-84108.stderr
@@ -30,7 +30,7 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
= note: only the last element of a tuple may have a dynamically sized type
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/issue-84108.rs:13:13
+ --> $DIR/issue-84108.rs:14:13
|
LL | static BAZ: ([u8], usize) = ([], 0);
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -38,7 +38,25 @@ LL | static BAZ: ([u8], usize) = ([], 0);
= help: the trait `Sized` is not implemented for `[u8]`
= note: only the last element of a tuple may have a dynamically sized type
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+ --> $DIR/issue-84108.rs:9:45
+ |
+LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
+ | ^^ expected `[u8]`, found `[_; 0]`
+ |
+ = note: expected slice `[u8]`
+ found array `[_; 0]`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-84108.rs:14:30
+ |
+LL | static BAZ: ([u8], usize) = ([], 0);
+ | ^^ expected `[u8]`, found `[_; 0]`
+ |
+ = note: expected slice `[u8]`
+ found array `[_; 0]`
+
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0277, E0412.
+Some errors have detailed explanations: E0277, E0308, E0412.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs
new file mode 100644
index 000000000..cf41ac872
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.rs
@@ -0,0 +1,18 @@
+// build-fail
+// compile-flags: --target i686-unknown-linux-gnu --crate-type lib
+// needs-llvm-components: x86
+#![feature(no_core, lang_items)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// 0x7fffffff is fine, but after rounding up it becomes too big
+#[repr(C, align(2))]
+pub struct Example([u8; 0x7fffffff]);
+
+pub fn lib(_x: Example) {} //~ERROR: too big for the current architecture
+
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy: Sized {}
diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr
new file mode 100644
index 000000000..5cc854adc
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.stderr
@@ -0,0 +1,8 @@
+error: values of the type `Example` are too big for the current architecture
+ --> $DIR/too-big-with-padding.rs:13:1
+ |
+LL | pub fn lib(_x: Example) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
index f02a93ed4..80aba0ba0 100644
--- a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
@@ -1,8 +1,8 @@
// check-pass
-#![feature(generator_trait, negative_impls)]
+#![feature(coroutine_trait, negative_impls)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::task::{Poll, Context};
use std::future::{Future};
use std::ptr::NonNull;
@@ -17,27 +17,27 @@ unsafe impl Send for ResumeTy {}
unsafe impl Sync for ResumeTy {}
-pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+pub const fn from_coroutine<T>(gen: T) -> impl Future<Output = T::Return>
where
- T: Generator<ResumeTy, Yield = ()>,
+ T: Coroutine<ResumeTy, Yield = ()>,
{
- struct GenFuture<T: Generator<ResumeTy, Yield = ()>>(T);
+ struct GenFuture<T: Coroutine<ResumeTy, Yield = ()>>(T);
// We rely on the fact that async/await futures are immovable in order to create
- // self-referential borrows in the underlying generator.
- impl<T: Generator<ResumeTy, Yield = ()>> !Unpin for GenFuture<T> {}
+ // self-referential borrows in the underlying coroutine.
+ impl<T: Coroutine<ResumeTy, Yield = ()>> !Unpin for GenFuture<T> {}
- impl<T: Generator<ResumeTy, Yield = ()>> Future for GenFuture<T> {
+ impl<T: Coroutine<ResumeTy, Yield = ()>> Future for GenFuture<T> {
type Output = T::Return;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// SAFETY: Safe because we're !Unpin + !Drop, and this is just a field projection.
let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };
- // Resume the generator, turning the `&mut Context` into a `NonNull` raw pointer. The
+ // Resume the coroutine, turning the `&mut Context` into a `NonNull` raw pointer. The
// `.await` lowering will safely cast that back to a `&mut Context`.
match gen.resume(ResumeTy(NonNull::from(cx).cast::<Context<'static>>())) {
- GeneratorState::Yielded(()) => Poll::Pending,
- GeneratorState::Complete(x) => Poll::Ready(x),
+ CoroutineState::Yielded(()) => Poll::Pending,
+ CoroutineState::Complete(x) => Poll::Ready(x),
}
}
}
diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
index da0078698..621196647 100644
--- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -10,6 +10,10 @@ LL | x.use_mut();
| - borrow later used here
|
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider consuming the `Vec<i32>` when turning it into an `Iterator`
+ |
+LL | let mut x = vec![1].into_iter();
+ | ~~~~~~~~~
help: consider using a `let` binding to create a longer lived value
|
LL ~ let binding = vec![1];
diff --git a/tests/ui/lifetimes/issue-105675.stderr b/tests/ui/lifetimes/issue-105675.stderr
index 66415f72b..54ecd35ed 100644
--- a/tests/ui/lifetimes/issue-105675.stderr
+++ b/tests/ui/lifetimes/issue-105675.stderr
@@ -81,6 +81,7 @@ note: the lifetime requirement is introduced here
|
LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider specifying the type of the closure parameters
|
LL | let f = |x: &_, y: &_, z: u32| ();
diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr
index 30afcecf8..e61158a5d 100644
--- a/tests/ui/lifetimes/issue-26638.stderr
+++ b/tests/ui/lifetimes/issue-26638.stderr
@@ -44,6 +44,10 @@ LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.ne
|
= note: expected reference `&str`
found enum `Option<&str>`
+help: consider using `Option::expect` to unwrap the `Option<&str>` value, panicking if the value is an `Option::None`
+ |
+LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next().expect("REASON") }
+ | +++++++++++++++++
error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/issue-26638.rs:5:47
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
new file mode 100644
index 000000000..b0b6b318d
--- /dev/null
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
@@ -0,0 +1,19 @@
+// edition:2018
+
+#![feature(unboxed_closures)]
+use std::future::Future;
+
+async fn wrapper<F>(f: F)
+//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+where
+ F:,
+ for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+{
+ //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ let mut i = 41;
+ &mut i;
+}
+
+fn main() {}
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
new file mode 100644
index 000000000..5b77051dc
--- /dev/null
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
@@ -0,0 +1,51 @@
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:1
+ |
+LL | / async fn wrapper<F>(f: F)
+LL | |
+LL | |
+LL | |
+LL | | where
+LL | | F:,
+LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+ | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:10
+ |
+LL | async fn wrapper<F>(f: F)
+ | ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:13:1
+ |
+LL | / {
+LL | |
+LL | | let mut i = 41;
+LL | | &mut i;
+LL | | }
+ | |_^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:1
+ |
+LL | / async fn wrapper<F>(f: F)
+LL | |
+LL | |
+LL | |
+LL | | where
+LL | | F:,
+LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+ | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lifetimes/issue-77175.rs b/tests/ui/lifetimes/issue-77175.rs
index 2282752b6..8072691ae 100644
--- a/tests/ui/lifetimes/issue-77175.rs
+++ b/tests/ui/lifetimes/issue-77175.rs
@@ -5,7 +5,7 @@
// Prior to the fix, the compiler complained that the 'a lifetime was only used
// once. This was obviously wrong since the lifetime is used twice: For the s3
// parameter and the return type. The issue was caused by the compiler
-// desugaring the async function into a generator that uses only a single
+// desugaring the async function into a coroutine that uses only a single
// lifetime, which then the validator complained about becauase of the
// single_use_lifetimes constraints.
async fn bar<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str {
diff --git a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
index affb4e8d0..235092e24 100644
--- a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
+++ b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:19:10
|
LL | foo: &'static T
- | ^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
@@ -13,20 +16,24 @@ error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:33
|
LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | |
+ | the parameter type `K` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | impl<K: 'a> Nested<K> {
- | ++++
+LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() where K: 'a {
+ | +++++++++++
error[E0309]: the parameter type `M` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:36
|
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
+ | |
+ | the parameter type `M` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b + 'a>() {
| ++++
@@ -35,29 +42,37 @@ error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:19
|
LL | fn foo<'a, L: X<&'a Nested<K>>>();
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | |
+ | the parameter type `K` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | trait X<K: 'a>: Sized {
- | ++++
+LL | fn foo<'a, L: X<&'a Nested<K>>>() where K: 'a;
+ | +++++++++++
error[E0309]: the parameter type `Self` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:19
|
LL | fn bar<'a, L: X<&'a Nested<Self>>>();
- | ^^^^^^^^^^^^^^^^^^^
+ | -- ^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
+ | |
+ | the parameter type `Self` must be valid for the lifetime `'a` as defined here...
|
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bar<'a, L: X<&'a Nested<Self>>>() where Self: 'a;
+ | ++++++++++++++
error[E0309]: the parameter type `L` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:22
|
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
+ | |
+ | the parameter type `L` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn baz<'a, L: 'a, M: X<&'a Nested<L>>>() {
| ++++
diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
index 7049f28e2..dbc587dd0 100644
--- a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue_74400.rs:12:5
|
LL | f(data, identity)
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn g<T: 'static>(data: &[T]) {
| +++++++++
diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
index f977f0bd3..7c4154904 100644
--- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
+++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
with_restriction::<T>(x) //~ ERROR the parameter type `T` may not live long enough
}
diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
index 2d58d3a02..79df2c8df 100644
--- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
+++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
@@ -1,23 +1,15 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
|
-LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:5:25
- |
LL | fn no_restriction<T>(x: &()) -> &() {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
- |
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
- | +++ ++++ ++
+LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
+ | +++ ++++ ++ ++
error: aborting due to previous error
diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr
index 93716c0b3..6b463930b 100644
--- a/tests/ui/limits/issue-55878.stderr
+++ b/tests/ui/limits/issue-55878.stderr
@@ -25,6 +25,7 @@ note: erroneous constant encountered
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= 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)
error: aborting due to previous error
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr b/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr
new file mode 100644
index 000000000..a5fc96b4e
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr
@@ -0,0 +1,2 @@
+error: some `-C link-self-contained` components were both enabled and disabled: crto, linker
+
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr b/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr
new file mode 100644
index 000000000..5982b7a61
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr
@@ -0,0 +1,2 @@
+error: some `-C link-self-contained` components were both enabled and disabled: linker
+
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.rs b/tests/ui/linkage-attr/link-self-contained-consistency.rs
new file mode 100644
index 000000000..9be72f559
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.rs
@@ -0,0 +1,10 @@
+// Checks that self-contained linking components cannot be both enabled and disabled at the same
+// time on the CLI.
+
+// check-fail
+// revisions: one many
+// [one] compile-flags: -Clink-self-contained=-linker -Clink-self-contained=+linker -Zunstable-options
+// [many] compile-flags: -Clink-self-contained=+linker,+crto -Clink-self-contained=-linker,-crto -Zunstable-options
+// ignore-tidy-linelength
+
+fn main() {}
diff --git a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
index 594a46176..819da2fb0 100644
--- a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
+++ b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
@@ -1,2 +1,2 @@
-error: the linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
+error: the linker flavor `bpf` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
diff --git a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
index 714c09df5..2ebdc1a90 100644
--- a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
+++ b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
@@ -1,2 +1,2 @@
-error: the linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
+error: the linker flavor `ptx` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
diff --git a/tests/ui/linkage-attr/unstable-flavor.rs b/tests/ui/linkage-attr/unstable-flavor.rs
index b58fd055f..c2c16b28b 100644
--- a/tests/ui/linkage-attr/unstable-flavor.rs
+++ b/tests/ui/linkage-attr/unstable-flavor.rs
@@ -3,11 +3,11 @@
// caller). If it passes, all the other unstable options are rejected as well.
//
// revisions: bpf ptx
-// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib
-// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag
+// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib
+// [bpf] error-pattern: linker flavor `bpf` is unstable, the `-Z unstable-options` flag
// [bpf] needs-llvm-components:
-// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib
-// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag
+// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib
+// [ptx] error-pattern: linker flavor `ptx` is unstable, the `-Z unstable-options` flag
// [ptx] needs-llvm-components:
#![feature(no_core)]
diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr
index a19f4963c..01ca08a6f 100644
--- a/tests/ui/lint/bare-trait-objects-path.stderr
+++ b/tests/ui/lint/bare-trait-objects-path.stderr
@@ -16,7 +16,7 @@ error[E0223]: ambiguous associated type
--> $DIR/bare-trait-objects-path.rs:23:12
|
LL | let _: Dyn::Ty;
- | ^^^^^^^ help: use the fully-qualified path: `<dyn Dyn as Assoc>::Ty`
+ | ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Assoc>::Ty`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:14:5
diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr
index 2ee718a8c..5084b4a40 100644
--- a/tests/ui/lint/cli-unknown-force-warn.stderr
+++ b/tests/ui/lint/cli-unknown-force-warn.stderr
@@ -6,10 +6,12 @@ warning[E0602]: unknown lint: `foo_qux`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
index c9a2aff21..65aa19628 100644
--- a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
+++ b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
@@ -5,6 +5,7 @@ error[E0602]: unknown lint tool: `unknown_tool`
error[E0602]: unknown lint tool: `unknown_tool`
|
= note: requested on the command line with `-A unknown_tool::foo`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/crate_level_only_lint.stderr b/tests/ui/lint/crate_level_only_lint.stderr
index 8fb06df2a..fbb1ec381 100644
--- a/tests/ui/lint/crate_level_only_lint.stderr
+++ b/tests/ui/lint/crate_level_only_lint.stderr
@@ -27,36 +27,48 @@ error: allow(uncommon_codepoints) is ignored unless specified at crate level
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:4:10
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-group-2.stderr b/tests/ui/lint/forbid-group-group-2.stderr
index b2e2bcea1..4a2c8fbd6 100644
--- a/tests/ui/lint/forbid-group-group-2.stderr
+++ b/tests/ui/lint/forbid-group-group-2.stderr
@@ -26,6 +26,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -38,6 +39,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -50,6 +52,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -62,6 +65,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -74,6 +78,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -86,6 +91,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -98,6 +104,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -110,6 +117,7 @@ LL | #[allow(nonstandard_style)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-member.stderr b/tests/ui/lint/forbid-group-member.stderr
index 47336d4d8..ddaaafa12 100644
--- a/tests/ui/lint/forbid-group-member.stderr
+++ b/tests/ui/lint/forbid-group-member.stderr
@@ -22,6 +22,7 @@ LL | #[allow(unused_variables)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: allow(unused_variables) incompatible with previous forbid
--> $DIR/forbid-group-member.rs:8:9
@@ -34,6 +35,7 @@ LL | #[allow(unused_variables)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/forbid-member-group.stderr b/tests/ui/lint/forbid-member-group.stderr
index e65301778..612dccd8d 100644
--- a/tests/ui/lint/forbid-member-group.stderr
+++ b/tests/ui/lint/forbid-member-group.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(unused_variables)]
LL |
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
index 0f58953a5..ecdc62501 100644
--- a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
@@ -20,6 +20,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/cap-lints-allow.stderr b/tests/ui/lint/force-warn/cap-lints-allow.stderr
index 03a32fa6f..5f5f2ff52 100644
--- a/tests/ui/lint/force-warn/cap-lints-allow.stderr
+++ b/tests/ui/lint/force-warn/cap-lints-allow.stderr
@@ -20,6 +20,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
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 b0cd3ddd2..3a0b1201b 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
@@ -21,6 +21,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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 8c841916c..92555eda2 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
@@ -21,6 +21,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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 c0144205d..c14c7957a 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
@@ -21,6 +21,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/warnings-lint-group.stderr b/tests/ui/lint/force-warn/warnings-lint-group.stderr
index 1faeed337..3e73269a2 100644
--- a/tests/ui/lint/force-warn/warnings-lint-group.stderr
+++ b/tests/ui/lint/force-warn/warnings-lint-group.stderr
@@ -1,6 +1,8 @@
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/issue-80988.stderr b/tests/ui/lint/issue-80988.stderr
index 73e27ffda..7a65881b5 100644
--- a/tests/ui/lint/issue-80988.stderr
+++ b/tests/ui/lint/issue-80988.stderr
@@ -22,6 +22,7 @@ LL | #[deny(warnings)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: deny(warnings) incompatible with previous forbid
--> $DIR/issue-80988.rs:7:8
@@ -34,6 +35,7 @@ LL | #[deny(warnings)]
|
= 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 #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/lint-forbid-attr.stderr b/tests/ui/lint/lint-forbid-attr.stderr
index 5977b9c94..bd476a0e3 100644
--- a/tests/ui/lint/lint-forbid-attr.stderr
+++ b/tests/ui/lint/lint-forbid-attr.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(deprecated)]
LL |
LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-forbid-cmdline.stderr b/tests/ui/lint/lint-forbid-cmdline.stderr
index 0a92e58c0..ed49a2cb4 100644
--- a/tests/ui/lint/lint-forbid-cmdline.stderr
+++ b/tests/ui/lint/lint-forbid-cmdline.stderr
@@ -13,6 +13,7 @@ LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
|
= note: `forbid` lint level was set on command line
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-malformed.stderr b/tests/ui/lint/lint-malformed.stderr
index 91b4e509b..2c9f045de 100644
--- a/tests/ui/lint/lint-malformed.stderr
+++ b/tests/ui/lint/lint-malformed.stderr
@@ -9,6 +9,8 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: malformed `deny` attribute input
--> $DIR/lint-malformed.rs:1:1
@@ -21,12 +23,16 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/lint-malformed.rs:2:10
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr
index 80c85d01e..3321afa7f 100644
--- a/tests/ui/lint/lint-removed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr
@@ -6,10 +6,12 @@ error: lint `raw_pointer_derive` has been removed: using derive with raw pointer
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline-deny.rs:13:17
diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr
index ebfae34ad..6b76ad3b5 100644
--- a/tests/ui/lint/lint-removed-cmdline.stderr
+++ b/tests/ui/lint/lint-removed-cmdline.stderr
@@ -6,10 +6,12 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:13:17
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
index df22ef60d..0e182a4e5 100644
--- a/tests/ui/lint/lint-renamed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
@@ -8,11 +8,13 @@ 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline-deny.rs:10:17
diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr
index a41284003..675443dde 100644
--- a/tests/ui/lint/lint-renamed-cmdline.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline.stderr
@@ -8,11 +8,13 @@ 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:9:17
diff --git a/tests/ui/lint/lint-stability-deprecated.stderr b/tests/ui/lint/lint-stability-deprecated.stderr
index 19a4649e1..609fc56a8 100644
--- a/tests/ui/lint/lint-stability-deprecated.stderr
+++ b/tests/ui/lint/lint-stability-deprecated.stderr
@@ -639,18 +639,24 @@ warning: use of deprecated associated type `lint_stability::TraitWithAssociatedT
|
LL | struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 108 warnings emitted
diff --git a/tests/ui/lint/lint-type-overflow.stderr b/tests/ui/lint/lint-type-overflow.stderr
index 48d8228b8..971c3eb9b 100644
--- a/tests/ui/lint/lint-type-overflow.stderr
+++ b/tests/ui/lint/lint-type-overflow.stderr
@@ -29,21 +29,21 @@ LL | let x1: i8 = 128;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:18:19
+ --> $DIR/lint-type-overflow.rs:18:18
|
LL | let x3: i8 = -129;
- | ^^^
+ | ^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:19:19
+ --> $DIR/lint-type-overflow.rs:19:18
|
LL | let x3: i8 = -(129);
- | ^^^^^
+ | ^^^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-(129)` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
@@ -74,12 +74,12 @@ LL | let x = 128_i8;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:28:14
+ --> $DIR/lint-type-overflow.rs:28:13
|
LL | let x = -129_i8;
- | ^^^^^^
+ | ^^^^^^^
|
- = note: the literal `129_i8` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129_i8` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i32`
@@ -101,21 +101,21 @@ LL | let x = 2147483648_i32;
= help: consider using the type `u32` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:36:19
+ --> $DIR/lint-type-overflow.rs:36:18
|
LL | let x: i32 = -2147483649;
- | ^^^^^^^^^^
+ | ^^^^^^^^^^^
|
- = note: the literal `2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:37:14
+ --> $DIR/lint-type-overflow.rs:37:13
|
LL | let x = -2147483649_i32;
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
|
- = note: the literal `2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
@@ -146,21 +146,21 @@ LL | let x = 18446744073709551615_i64;
= help: consider using the type `u64` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:43:19
+ --> $DIR/lint-type-overflow.rs:43:18
|
LL | let x: i64 = -9223372036854775809;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:44:14
+ --> $DIR/lint-type-overflow.rs:44:13
|
LL | let x = -9223372036854775809_i64;
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: aborting due to 18 previous errors
diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr
index 858527822..0efec51ab 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.stderr
+++ b/tests/ui/lint/lint-unexported-no-mangle.stderr
@@ -10,18 +10,22 @@ warning: lint `private_no_mangle_statics` has been removed: no longer a warning,
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: const items should never be `#[no_mangle]`
--> $DIR/lint-unexported-no-mangle.rs:9:1
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
index 677b5edc8..f12ce03dd 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
@@ -11,20 +11,24 @@ error[E0602]: unknown lint: `dead_cod`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
index 10db76ac4..f452fc9eb 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -11,20 +11,24 @@ warning[E0602]: unknown lint: `dead_cod`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/lint/lint-unnecessary-parens.fixed b/tests/ui/lint/lint-unnecessary-parens.fixed
index bafac05d8..b17914da6 100644
--- a/tests/ui/lint/lint-unnecessary-parens.fixed
+++ b/tests/ui/lint/lint-unnecessary-parens.fixed
@@ -84,6 +84,14 @@ fn main() {
_a = 0; //~ ERROR unnecessary parentheses around assigned value
_a += 1; //~ ERROR unnecessary parentheses around assigned value
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.rs b/tests/ui/lint/lint-unnecessary-parens.rs
index ce537a4dc..4cbd6562c 100644
--- a/tests/ui/lint/lint-unnecessary-parens.rs
+++ b/tests/ui/lint/lint-unnecessary-parens.rs
@@ -84,6 +84,14 @@ fn main() {
_a = (0); //~ ERROR unnecessary parentheses around assigned value
_a += (1); //~ ERROR unnecessary parentheses around assigned value
+ let(mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let(_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.stderr b/tests/ui/lint/lint-unnecessary-parens.stderr
index 2ad07530f..ba7a78b8d 100644
--- a/tests/ui/lint/lint-unnecessary-parens.stderr
+++ b/tests/ui/lint/lint-unnecessary-parens.stderr
@@ -267,5 +267,77 @@ LL - _a += (1);
LL + _a += 1;
|
-error: aborting due to 22 previous errors
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:87:8
+ |
+LL | let(mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:88:9
+ |
+LL | let (mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:89:8
+ |
+LL | let( mut _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:91:8
+ |
+LL | let(_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:92:9
+ |
+LL | let (_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:93:8
+ |
+LL | let( _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( _a) = 3;
+LL + let _a = 3;
+ |
+
+error: aborting due to 28 previous errors
diff --git a/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
new file mode 100644
index 000000000..2d5e90720
--- /dev/null
+++ b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
@@ -0,0 +1,25 @@
+// Test for issue #116766.
+// Ensure that we don't suggest impl'ing `Copy` for a type if it or at least one
+// of it's variants are marked as `non_exhaustive`.
+
+// check-pass
+
+#![deny(missing_copy_implementations)]
+
+#[non_exhaustive]
+pub enum MyEnum {
+ A,
+}
+
+#[non_exhaustive]
+pub struct MyStruct {
+ foo: usize,
+}
+
+pub enum MyEnum2 {
+ #[non_exhaustive]
+ A,
+ B,
+}
+
+fn main() {}
diff --git a/tests/ui/lint/must_not_suspend/gated.stderr b/tests/ui/lint/must_not_suspend/gated.stderr
index 64de1ebea..f0d2117d4 100644
--- a/tests/ui/lint/must_not_suspend/gated.stderr
+++ b/tests/ui/lint/must_not_suspend/gated.stderr
@@ -18,6 +18,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
@@ -28,6 +29,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
index c7e14e425..2f3c5d9ea 100644
--- a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
+++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
- let _generator = || {
+ let _coroutine = || {
yield ((), ((), ()));
yield ((), ());
//~^ ERROR mismatched types
diff --git a/tests/ui/lint/reasons-erroneous.rs b/tests/ui/lint/reasons-erroneous.rs
index cd693ae16..7b286eb1d 100644
--- a/tests/ui/lint/reasons-erroneous.rs
+++ b/tests/ui/lint/reasons-erroneous.rs
@@ -1,51 +1,27 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#![warn(absolute_paths_not_starting_with_crate, reason = 0)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(missing_copy_implementations, reason)]
//~^ WARN unknown lint
diff --git a/tests/ui/lint/reasons-erroneous.stderr b/tests/ui/lint/reasons-erroneous.stderr
index 5521af17c..003da5673 100644
--- a/tests/ui/lint/reasons-erroneous.stderr
+++ b/tests/ui/lint/reasons-erroneous.stderr
@@ -1,5 +1,5 @@
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
+ --> $DIR/reasons-erroneous.rs:5:58
|
LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
| ^ reason must be a string literal
@@ -11,121 +11,43 @@ LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condem
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
+ --> $DIR/reasons-erroneous.rs:11:29
|
LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
- |
-LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
- | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
- |
-LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
- |
-LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
- | ^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:8:40
- |
-LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
+ --> $DIR/reasons-erroneous.rs:14:23
|
LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
+ --> $DIR/reasons-erroneous.rs:17:36
|
LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
+ --> $DIR/reasons-erroneous.rs:20:44
|
LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
| ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
+ --> $DIR/reasons-erroneous.rs:23:25
|
LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
warning: unknown lint: `reason`
- --> $DIR/reasons-erroneous.rs:50:39
+ --> $DIR/reasons-erroneous.rs:26:39
|
LL | #![warn(missing_copy_implementations, reason)]
| ^^^^^^
|
= note: `#[warn(unknown_lints)]` on by default
-error: aborting due to 20 previous errors; 1 warning emitted
+error: aborting due to 7 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0452`.
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index fba8789e9..25e0c75f7 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -64,6 +64,10 @@ unsafe fn ref_to_mut() {
let _num = &mut *num;
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell as *const _ as *mut i32);
+ //~^ 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
@@ -106,6 +110,8 @@ unsafe fn assign_to_ref() {
std::mem::transmute::<*const i32, *mut i32>(num),
-1i32,
);
+ *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ //~^ ERROR assigning to `&T` is undefined behavior
let value = num as *const i32 as *mut i32;
*value = 1;
@@ -148,6 +154,8 @@ unsafe fn no_warn() {
*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.
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell.get() as *mut i32);
fn safe_as_mut<T>(x: &std::cell::UnsafeCell<T>) -> &mut T {
unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index 8f89cf980..8d5f8da68 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -158,7 +158,16 @@ 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
+ --> $DIR/reference_casting.rs:68:16
+ |
+LL | let _num = &mut *(cell as *const _ as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:72:9
|
LL | &mut *((this as *const _) as *mut _)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +175,7 @@ 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
+ --> $DIR/reference_casting.rs:77:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +183,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= 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
+ --> $DIR/reference_casting.rs:82:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -182,7 +191,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= 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:88:5
+ --> $DIR/reference_casting.rs:92:5
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -190,7 +199,7 @@ 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:90:5
+ --> $DIR/reference_casting.rs:94:5
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -198,7 +207,7 @@ 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:92:5
+ --> $DIR/reference_casting.rs:96:5
|
LL | *std::ptr::from_ref(num).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -206,7 +215,7 @@ 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:94:5
+ --> $DIR/reference_casting.rs:98:5
|
LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -214,7 +223,7 @@ 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:96:5
+ --> $DIR/reference_casting.rs:100:5
|
LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -222,7 +231,7 @@ 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:98:5
+ --> $DIR/reference_casting.rs:102:5
|
LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -230,7 +239,7 @@ 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:100:5
+ --> $DIR/reference_casting.rs:104:5
|
LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -238,7 +247,7 @@ 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
+ --> $DIR/reference_casting.rs:106:5
|
LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -246,7 +255,7 @@ 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:104:5
+ --> $DIR/reference_casting.rs:108:5
|
LL | / std::ptr::write(
LL | |
@@ -258,7 +267,16 @@ 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
+ --> $DIR/reference_casting.rs:113:5
+ |
+LL | *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:117:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -268,7 +286,7 @@ 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
+ --> $DIR/reference_casting.rs:120:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -279,7 +297,7 @@ 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:116:5
+ --> $DIR/reference_casting.rs:122:5
|
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +305,7 @@ 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:118:5
+ --> $DIR/reference_casting.rs:124:5
|
LL | *(num as *const _ as usize as *mut i32) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -295,7 +313,7 @@ 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:120:5
+ --> $DIR/reference_casting.rs:126:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -306,7 +324,7 @@ 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
+ --> $DIR/reference_casting.rs:128:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -317,7 +335,7 @@ 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
+ --> $DIR/reference_casting.rs:130:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -328,12 +346,12 @@ 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
+ --> $DIR/reference_casting.rs:134: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 38 previous errors
+error: aborting due to 40 previous errors
diff --git a/tests/ui/lint/register-tool-lint.stderr b/tests/ui/lint/register-tool-lint.stderr
index 842d845ff..7ebdbdec9 100644
--- a/tests/ui/lint/register-tool-lint.stderr
+++ b/tests/ui/lint/register-tool-lint.stderr
@@ -13,6 +13,7 @@ LL | #![warn(abc::my_lint)]
| ^^^
|
= help: add `#![register_tool(abc)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
new file mode 100644
index 000000000..1e2ff12a2
--- /dev/null
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
@@ -0,0 +1,30 @@
+// check-pass
+// incremental
+
+#![feature(lint_reasons)]
+#![warn(unused)]
+
+struct OneUnused;
+struct TwoUnused;
+
+impl OneUnused {
+ #[expect(unused)]
+ fn unused() {}
+}
+
+impl TwoUnused {
+ #[expect(unused)]
+ fn unused1(){}
+
+ // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning.
+ // This ui test was added after a regression in the compiler where it did not recognize multiple
+ // `#[expect(unused)]` annotations inside of impl blocks.
+ // issue 114416
+ #[expect(unused)]
+ fn unused2(){}
+}
+
+fn main() {
+ let _ = OneUnused;
+ let _ = TwoUnused;
+}
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
index 479ee198e..77cb5e88b 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
@@ -1,24 +1,20 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#[forbid(unused_variables)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
#[expect(unused_variables)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_1() {}
#[forbid(while_true)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
//~| NOTE the lint level is defined here
#[expect(while_true)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_2() {
// This while loop will produce a `while_true` lint as the lint level
// at this node is still `forbid` and the `while_true` check happens
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
index a8116e934..0f42ffbde 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
@@ -1,32 +1,14 @@
error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
+ --> $DIR/expect_with_forbid.rs:7:10
|
LL | #[forbid(unused_variables)]
| ---------------- `forbid` level set here
-...
-LL | #[expect(unused_variables)]
- | ^^^^^^^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
- |
-LL | #[forbid(while_true)]
- | ---------- `forbid` level set here
-...
-LL | #[expect(while_true)]
- | ^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
- |
-LL | #[forbid(unused_variables)]
- | ---------------- `forbid` level set here
-...
+LL |
LL | #[expect(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
+ --> $DIR/expect_with_forbid.rs:15:10
|
LL | #[forbid(while_true)]
| ---------- `forbid` level set here
@@ -35,17 +17,17 @@ LL | #[expect(while_true)]
| ^^^^^^^^^^ overruled by previous forbid
error: denote infinite loops with `loop { ... }`
- --> $DIR/expect_with_forbid.rs:26:5
+ --> $DIR/expect_with_forbid.rs:22:5
|
LL | while true {}
| ^^^^^^^^^^ help: use `loop`
|
note: the lint level is defined here
- --> $DIR/expect_with_forbid.rs:13:10
+ --> $DIR/expect_with_forbid.rs:12:10
|
LL | #[forbid(while_true)]
| ^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0453`.
diff --git a/tests/ui/lint/unaligned_references.rs b/tests/ui/lint/unaligned_references.rs
index 0c9c79c08..3f6dab354 100644
--- a/tests/ui/lint/unaligned_references.rs
+++ b/tests/ui/lint/unaligned_references.rs
@@ -1,3 +1,6 @@
+use std::mem::ManuallyDrop;
+use std::fmt::Debug;
+
#[repr(packed)]
pub struct Good {
data: u64,
@@ -27,6 +30,26 @@ impl Foo for Packed2 {
}
}
+// Test for #115396
+fn packed_dyn() {
+ #[repr(packed)]
+ struct Unaligned<T: ?Sized>(ManuallyDrop<T>);
+
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u64]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ let foo: &Unaligned<[u64]> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+
+ // Even if the actual alignment is 1, we cannot know that when looking at `dyn Debug.`
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u8]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ // However, we *can* know the alignment when looking at a slice.
+ let foo: &Unaligned<[u8]> = &*local;
+ println!("{:?}", &*foo.0); // no error!
+}
+
fn main() {
unsafe {
let good = Good { data: 0, ptr: &0, data2: [0, 0], aligned: [0; 32] };
diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr
index d3abc3766..328cafbd9 100644
--- a/tests/ui/lint/unaligned_references.stderr
+++ b/tests/ui/lint/unaligned_references.stderr
@@ -1,5 +1,5 @@
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:25:13
+ --> $DIR/unaligned_references.rs:28:13
|
LL | &self.x;
| ^^^^^^^
@@ -9,7 +9,37 @@ LL | &self.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:34:17
+ --> $DIR/unaligned_references.rs:40:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:42:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:47:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:57:17
|
LL | let _ = &good.ptr;
| ^^^^^^^^^
@@ -19,7 +49,7 @@ LL | let _ = &good.ptr;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:35:17
+ --> $DIR/unaligned_references.rs:58:17
|
LL | let _ = &good.data;
| ^^^^^^^^^^
@@ -29,7 +59,7 @@ LL | let _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:37:17
+ --> $DIR/unaligned_references.rs:60:17
|
LL | let _ = &good.data as *const _;
| ^^^^^^^^^^
@@ -39,7 +69,7 @@ LL | let _ = &good.data as *const _;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:38:27
+ --> $DIR/unaligned_references.rs:61:27
|
LL | let _: *const _ = &good.data;
| ^^^^^^^^^^
@@ -49,7 +79,7 @@ LL | let _: *const _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:40:17
+ --> $DIR/unaligned_references.rs:63:17
|
LL | let _ = good.data.clone();
| ^^^^^^^^^
@@ -59,7 +89,7 @@ LL | let _ = good.data.clone();
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:42:17
+ --> $DIR/unaligned_references.rs:65:17
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^
@@ -69,7 +99,7 @@ LL | let _ = &good.data2[0];
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:51:17
+ --> $DIR/unaligned_references.rs:74:17
|
LL | let _ = &packed2.x;
| ^^^^^^^^^^
@@ -79,7 +109,7 @@ LL | let _ = &packed2.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:90:20
+ --> $DIR/unaligned_references.rs:113:20
|
LL | let _ref = &m1.1.a;
| ^^^^^^^
@@ -89,7 +119,7 @@ LL | let _ref = &m1.1.a;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:93:20
+ --> $DIR/unaligned_references.rs:116:20
|
LL | let _ref = &m2.1.a;
| ^^^^^^^
@@ -98,6 +128,6 @@ LL | let _ref = &m2.1.a;
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
-error: aborting due to 10 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0793`.
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.rs b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
new file mode 100644
index 000000000..eea0f4c59
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
@@ -0,0 +1,17 @@
+#![deny(unused_variables)]
+macro_rules! make_var {
+ ($struct:ident, $var:ident) => {
+ let $var = $struct.$var;
+ };
+}
+
+#[allow(unused)]
+struct MyStruct {
+ var: i32,
+}
+
+fn main() {
+ let s = MyStruct { var: 42 };
+ make_var!(s, var); //~ ERROR unused variable: `var`
+ let a = 1; //~ ERROR unused variable: `a`
+}
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
new file mode 100644
index 000000000..84efaa4f3
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
@@ -0,0 +1,29 @@
+error: unused variable: `var`
+ --> $DIR/issue-117284-arg-in-macro.rs:15:18
+ |
+LL | make_var!(s, var);
+ | ^^^
+ |
+help: `var` is captured in macro and introduced a unused variable
+ --> $DIR/issue-117284-arg-in-macro.rs:4:13
+ |
+LL | let $var = $struct.$var;
+ | ^^^^
+...
+LL | make_var!(s, var);
+ | ----------------- in this macro invocation
+note: the lint level is defined here
+ --> $DIR/issue-117284-arg-in-macro.rs:1:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `make_var` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: unused variable: `a`
+ --> $DIR/issue-117284-arg-in-macro.rs:16:9
+ |
+LL | let a = 1;
+ | ^ help: if this is intentional, prefix it with an underscore: `_a`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
index 8064c3a88..c5dd281cb 100644
--- a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
+++ b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
@@ -1,8 +1,8 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![deny(unused_braces, unused_parens)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/lint/unused/lint-unused-imports.rs b/tests/ui/lint/unused/lint-unused-imports.rs
index 953992ecf..4fa6511c9 100644
--- a/tests/ui/lint/unused/lint-unused-imports.rs
+++ b/tests/ui/lint/unused/lint-unused-imports.rs
@@ -42,7 +42,7 @@ mod foo {
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
}
-mod bar {
+pub mod bar {
// Don't ignore on 'pub use' because we're not sure if it's used or not
pub use std::cmp::PartialEq;
pub struct Square;
diff --git a/tests/ui/lint/unused/unused-closure.rs b/tests/ui/lint/unused/unused-closure.rs
index c96c90731..12ee8b3a9 100644
--- a/tests/ui/lint/unused/unused-closure.rs
+++ b/tests/ui/lint/unused/unused-closure.rs
@@ -1,8 +1,8 @@
-// Test that closures and generators are "must use" types.
+// Test that closures and coroutines are "must use" types.
// edition:2018
#![feature(async_closure)]
-#![feature(generators)]
+#![feature(coroutines)]
#![deny(unused_must_use)]
fn unused() {
diff --git a/tests/ui/liveness/liveness-upvars.rs b/tests/ui/liveness/liveness-upvars.rs
index d446d57d3..17158dfbc 100644
--- a/tests/ui/liveness/liveness-upvars.rs
+++ b/tests/ui/liveness/liveness-upvars.rs
@@ -1,6 +1,6 @@
// edition:2018
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![warn(unused)]
#![allow(unreachable_code)]
@@ -60,7 +60,7 @@ pub fn f() {
};
let _ = async move {
println!("{}", c);
- // Never read because this is a generator.
+ // Never read because this is a coroutine.
c += 1; //~ WARN value assigned to `c` is never read
};
}
@@ -110,7 +110,7 @@ async fn yield_now() {
todo!();
}
-pub fn async_generator() {
+pub fn async_coroutine() {
let mut state: u32 = 0;
let _ = async {
@@ -129,7 +129,7 @@ pub fn async_generator() {
};
}
-pub fn generator() {
+pub fn coroutine() {
let mut s: u32 = 0;
let _ = |_| {
s = 0;
diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr
index 6c83bc757..a691960f9 100644
--- a/tests/ui/loops/loop-break-value.stderr
+++ b/tests/ui/loops/loop-break-value.stderr
@@ -319,7 +319,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:159:15
|
LL | fn main() {
- | - expected `()` because of this return type
+ | - expected `()` because of this return type
...
LL | loop { // point at the return type
| ---- this loop is expected to be of type `()`
diff --git a/tests/ui/lub-glb/old-lub-glb-object.stderr b/tests/ui/lub-glb/old-lub-glb-object.stderr
index 3d0c171e0..c476d6f69 100644
--- a/tests/ui/lub-glb/old-lub-glb-object.stderr
+++ b/tests/ui/lub-glb/old-lub-glb-object.stderr
@@ -15,6 +15,7 @@ LL | _ => y,
|
= note: expected trait object `dyn for<'a, 'b> Foo<&'a u8, &'b u8>`
found trait object `dyn for<'a> Foo<&'a u8, &'a u8>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/macros/assert-long-condition.rs b/tests/ui/macros/assert-long-condition.rs
new file mode 100644
index 000000000..1974ec9d6
--- /dev/null
+++ b/tests/ui/macros/assert-long-condition.rs
@@ -0,0 +1,9 @@
+// run-fail
+// check-run-results
+// exec-env:RUST_BACKTRACE=0
+// ignore-emscripten no processes
+// ignore-tidy-linelength
+
+fn main() {
+ assert!(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0);
+}
diff --git a/tests/ui/macros/assert-long-condition.run.stderr b/tests/ui/macros/assert-long-condition.run.stderr
new file mode 100644
index 000000000..16e56c927
--- /dev/null
+++ b/tests/ui/macros/assert-long-condition.run.stderr
@@ -0,0 +1,4 @@
+thread 'main' panicked at $DIR/assert-long-condition.rs:8:5:
+assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
+ + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/macros/builtin-std-paths-fail.stderr b/tests/ui/macros/builtin-std-paths-fail.stderr
index 004a39043..331943843 100644
--- a/tests/ui/macros/builtin-std-paths-fail.stderr
+++ b/tests/ui/macros/builtin-std-paths-fail.stderr
@@ -15,12 +15,16 @@ error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
|
LL | core::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
--> $DIR/builtin-std-paths-fail.rs:4:11
|
LL | core::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `bench` in `core`
--> $DIR/builtin-std-paths-fail.rs:7:9
@@ -63,12 +67,16 @@ error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
|
LL | std::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
--> $DIR/builtin-std-paths-fail.rs:16:10
|
LL | std::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `bench` in `std`
--> $DIR/builtin-std-paths-fail.rs:19:8
diff --git a/tests/ui/macros/meta-item-absolute-path.stderr b/tests/ui/macros/meta-item-absolute-path.stderr
index c53971e24..f0d763d7a 100644
--- a/tests/ui/macros/meta-item-absolute-path.stderr
+++ b/tests/ui/macros/meta-item-absolute-path.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: maybe a missing crate `Absolute`?
|
LL | #[derive(::Absolute)]
| ^^^^^^^^ maybe a missing crate `Absolute`?
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 816f99baa..70ca00285 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -2,495 +2,443 @@
// edition:2021
// compile-flags: --test
+#![allow(incomplete_features)]
#![feature(async_closure)]
+#![feature(auto_traits)]
#![feature(box_patterns)]
#![feature(const_trait_impl)]
+#![feature(coroutines)]
#![feature(decl_macro)]
-#![feature(generators)]
+#![feature(explicit_tail_calls)]
#![feature(more_qualified_paths)]
#![feature(raw_ref_op)]
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(type_ascription)]
+#![feature(yeet_expr)]
#![deny(unused_macros)]
-macro_rules! stringify_block {
- ($block:block) => {
- stringify!($block)
+// These macros force the use of AST pretty-printing by converting the input to
+// a particular fragment specifier.
+macro_rules! block { ($block:block) => { stringify!($block) }; }
+macro_rules! expr { ($expr:expr) => { stringify!($expr) }; }
+macro_rules! item { ($item:item) => { stringify!($item) }; }
+macro_rules! meta { ($meta:meta) => { stringify!($meta) }; }
+macro_rules! pat { ($pat:pat) => { stringify!($pat) }; }
+macro_rules! path { ($path:path) => { stringify!($path) }; }
+macro_rules! stmt { ($stmt:stmt) => { stringify!($stmt) }; }
+macro_rules! ty { ($ty:ty) => { stringify!($ty) }; }
+macro_rules! vis { ($vis:vis) => { stringify!($vis) }; }
+
+// Use this when AST pretty-printing and TokenStream pretty-printing give
+// the same result (which is preferable.)
+macro_rules! c1 {
+ ($frag:ident, [$($tt:tt)*], $s:literal) => {
+ assert_eq!($frag!($($tt)*), $s);
+ assert_eq!(stringify!($($tt)*), $s);
};
}
-macro_rules! stringify_expr {
- ($expr:expr) => {
- stringify!($expr)
- };
-}
-
-macro_rules! stringify_item {
- ($item:item) => {
- stringify!($item)
- };
-}
-
-macro_rules! stringify_meta {
- ($meta:meta) => {
- stringify!($meta)
- };
-}
-
-macro_rules! stringify_pat {
- ($pat:pat) => {
- stringify!($pat)
- };
-}
-
-macro_rules! stringify_path {
- ($path:path) => {
- stringify!($path)
- };
-}
-
-macro_rules! stringify_stmt {
- ($stmt:stmt) => {
- stringify!($stmt)
- };
-}
-
-macro_rules! stringify_ty {
- ($ty:ty) => {
- stringify!($ty)
- };
-}
-
-macro_rules! stringify_vis {
- ($vis:vis) => {
- stringify!($vis)
+// Use this when AST pretty-printing and TokenStream pretty-printing give
+// different results.
+//
+// `c1` and `c2` could be in a single macro, but having them separate makes it
+// easy to find the cases where the two pretty-printing approaches give
+// different results.
+macro_rules! c2 {
+ ($frag:ident, [$($tt:tt)*], $s1:literal, $s2:literal) => {
+ assert_ne!($s1, $s2, "should use `c1!` instead");
+ assert_eq!($frag!($($tt)*), $s1);
+ assert_eq!(stringify!($($tt)*), $s2);
};
}
#[test]
fn test_block() {
- assert_eq!(stringify_block!({}), "{}");
- assert_eq!(stringify_block!({ true }), "{ true }");
- assert_eq!(stringify_block!({ return }), "{ return }");
- assert_eq!(
- stringify_block!({
+ c1!(block, [ {} ], "{}");
+ c1!(block, [ { true } ], "{ true }");
+ c1!(block, [ { return } ], "{ return }");
+ c2!(block, [ {
return;
- }),
+ } ],
"{ return; }",
+ "{ return ; }"
);
- assert_eq!(
- stringify_block!({
+ c2!(block,
+ [ {
let _;
true
- }),
+ } ],
"{ let _; true }",
+ "{ let _ ; true }"
);
}
#[test]
fn test_expr() {
// ExprKind::Array
- assert_eq!(stringify_expr!([]), "[]");
- assert_eq!(stringify_expr!([true]), "[true]");
- assert_eq!(stringify_expr!([true,]), "[true]");
- assert_eq!(stringify_expr!([true, true]), "[true, true]");
+ c1!(expr, [ [] ], "[]");
+ c1!(expr, [ [true] ], "[true]");
+ c2!(expr, [ [true,] ], "[true]", "[true,]");
+ c1!(expr, [ [true, true] ], "[true, true]");
+
+ // ExprKind::ConstBlock
+ // FIXME: todo
// ExprKind::Call
- assert_eq!(stringify_expr!(f()), "f()");
- assert_eq!(stringify_expr!(f::<u8>()), "f::<u8>()");
- assert_eq!(stringify_expr!(f::<1>()), "f::<1>()");
- assert_eq!(stringify_expr!(f::<'a, u8, 1>()), "f::<'a, u8, 1>()");
- assert_eq!(stringify_expr!(f(true)), "f(true)");
- assert_eq!(stringify_expr!(f(true,)), "f(true)");
- assert_eq!(stringify_expr!(()()), "()()");
+ c1!(expr, [ f() ], "f()");
+ c2!(expr, [ f::<u8>() ], "f::<u8>()", "f :: < u8 > ()");
+ c2!(expr, [ f::<1>() ], "f::<1>()", "f :: < 1 > ()");
+ c2!(expr, [ f::<'a, u8, 1>() ], "f::<'a, u8, 1>()", "f :: < 'a, u8, 1 > ()");
+ c1!(expr, [ f(true) ], "f(true)");
+ c2!(expr, [ f(true,) ], "f(true)", "f(true,)");
+ c2!(expr, [ ()() ], "()()", "() ()");
// ExprKind::MethodCall
- assert_eq!(stringify_expr!(x.f()), "x.f()");
- assert_eq!(stringify_expr!(x.f::<u8>()), "x.f::<u8>()");
+ c1!(expr, [ x.f() ], "x.f()");
+ c2!(expr, [ x.f::<u8>() ], "x.f::<u8>()", "x.f :: < u8 > ()");
+ c2!(expr, [ x.collect::<Vec<_>>() ], "x.collect::<Vec<_>>()", "x.collect :: < Vec < _ >> ()");
// ExprKind::Tup
- assert_eq!(stringify_expr!(()), "()");
- assert_eq!(stringify_expr!((true,)), "(true,)");
- assert_eq!(stringify_expr!((true, false)), "(true, false)");
- assert_eq!(stringify_expr!((true, false,)), "(true, false)");
+ c1!(expr, [ () ], "()");
+ c1!(expr, [ (true,) ], "(true,)");
+ c1!(expr, [ (true, false) ], "(true, false)");
+ c2!(expr, [ (true, false,) ], "(true, false)", "(true, false,)");
// ExprKind::Binary
- assert_eq!(stringify_expr!(true || false), "true || false");
- assert_eq!(stringify_expr!(true || false && false), "true || false && false");
+ c1!(expr, [ true || false ], "true || false");
+ c1!(expr, [ true || false && false ], "true || false && false");
+ c1!(expr, [ a < 1 && 2 < b && c > 3 && 4 > d ], "a < 1 && 2 < b && c > 3 && 4 > d");
+ c2!(expr, [ a & b & !c ], "a & b & !c", "a & b &! c"); // FIXME
+ c2!(expr,
+ [ a + b * c - d + -1 * -2 - -3],
+ "a + b * c - d + -1 * -2 - -3",
+ "a + b * c - d + - 1 * - 2 - - 3"
+ );
+ c2!(expr, [ x = !y ], "x = !y", "x =! y"); // FIXME
// ExprKind::Unary
- assert_eq!(stringify_expr!(*expr), "*expr");
- assert_eq!(stringify_expr!(!expr), "!expr");
- assert_eq!(stringify_expr!(-expr), "-expr");
+ c2!(expr, [ *expr ], "*expr", "* expr");
+ c2!(expr, [ !expr ], "!expr", "! expr");
+ c2!(expr, [ -expr ], "-expr", "- expr");
// ExprKind::Lit
- assert_eq!(stringify_expr!('x'), "'x'");
- assert_eq!(stringify_expr!(1_000_i8), "1_000_i8");
- assert_eq!(stringify_expr!(1.00000000000000001), "1.00000000000000001");
+ c1!(expr, [ 'x' ], "'x'");
+ c1!(expr, [ 1_000_i8 ], "1_000_i8");
+ c1!(expr, [ 1.00000000000000001 ], "1.00000000000000001");
// ExprKind::Cast
- assert_eq!(stringify_expr!(expr as T), "expr as T");
- assert_eq!(stringify_expr!(expr as T<u8>), "expr as T<u8>");
+ c1!(expr, [ expr as T ], "expr as T");
+ c2!(expr, [ expr as T<u8> ], "expr as T<u8>", "expr as T < u8 >");
+
+ // ExprKind::Type: there is no syntax for type ascription.
- // ExprKind::Type
- // There is no syntax for type ascription.
+ // ExprKind::Let
+ c1!(expr, [ if let Some(a) = b { c } else { d } ], "if let Some(a) = b { c } else { d }");
// ExprKind::If
- assert_eq!(stringify_expr!(if true {}), "if true {}");
- assert_eq!(
- stringify_expr!(if true {
- } else {
- }),
- "if true {} else {}",
- );
- assert_eq!(
- stringify_expr!(if let true = true {
- } else {
- }),
- "if let true = true {} else {}",
- );
- assert_eq!(
- stringify_expr!(if true {
+ c1!(expr, [ if true {} ], "if true {}");
+ c2!(expr, [ if !true {} ], "if !true {}", "if! true {}"); // FIXME
+ c2!(expr,
+ [ if ::std::blah() { } else { } ],
+ "if ::std::blah() {} else {}",
+ "if :: std :: blah() {} else {}"
+ );
+ c1!(expr, [ if let true = true {} else {} ], "if let true = true {} else {}");
+ c1!(expr,
+ [ if true {
} else if false {
- }),
- "if true {} else if false {}",
+ } ],
+ "if true {} else if false {}"
);
- assert_eq!(
- stringify_expr!(if true {
+ c1!(expr,
+ [ if true {
} else if false {
} else {
- }),
- "if true {} else if false {} else {}",
+ } ],
+ "if true {} else if false {} else {}"
);
- assert_eq!(
- stringify_expr!(if true {
+ c2!(expr,
+ [ if true {
return;
} else if false {
0
} else {
0
- }),
+ } ],
"if true { return; } else if false { 0 } else { 0 }",
+ "if true { return ; } else if false { 0 } else { 0 }"
);
// ExprKind::While
- assert_eq!(stringify_expr!(while true {}), "while true {}");
- assert_eq!(stringify_expr!('a: while true {}), "'a: while true {}");
- assert_eq!(stringify_expr!(while let true = true {}), "while let true = true {}");
+ c1!(expr, [ while true {} ], "while true {}");
+ c2!(expr, [ 'a: while true {} ], "'a: while true {}", "'a : while true {}");
+ c1!(expr, [ while let true = true {} ], "while let true = true {}");
// ExprKind::ForLoop
- assert_eq!(stringify_expr!(for _ in x {}), "for _ in x {}");
- assert_eq!(stringify_expr!('a: for _ in x {}), "'a: for _ in x {}");
+ c1!(expr, [ for _ in x {} ], "for _ in x {}");
+ c2!(expr, [ 'a: for _ in x {} ], "'a: for _ in x {}", "'a : for _ in x {}");
// ExprKind::Loop
- assert_eq!(stringify_expr!(loop {}), "loop {}");
- assert_eq!(stringify_expr!('a: loop {}), "'a: loop {}");
+ c1!(expr, [ loop {} ], "loop {}");
+ c2!(expr, [ 'a: loop {} ], "'a: loop {}", "'a : loop {}");
// ExprKind::Match
- assert_eq!(stringify_expr!(match self {}), "match self {}");
- assert_eq!(
- stringify_expr!(match self {
+ c1!(expr, [ match self {} ], "match self {}");
+ c1!(expr,
+ [ match self {
Ok => 1,
- }),
- "match self { Ok => 1, }",
+ } ],
+ "match self { Ok => 1, }"
);
- assert_eq!(
- stringify_expr!(match self {
+ c1!(expr,
+ [ match self {
Ok => 1,
Err => 0,
- }),
- "match self { Ok => 1, Err => 0, }",
+ } ],
+ "match self { Ok => 1, Err => 0, }"
);
// ExprKind::Closure
- assert_eq!(stringify_expr!(|| {}), "|| {}");
- assert_eq!(stringify_expr!(|x| {}), "|x| {}");
- assert_eq!(stringify_expr!(|x: u8| {}), "|x: u8| {}");
- assert_eq!(stringify_expr!(|| ()), "|| ()");
- assert_eq!(stringify_expr!(move || self), "move || self");
- assert_eq!(stringify_expr!(async || self), "async || self");
- assert_eq!(stringify_expr!(async move || self), "async move || self");
- assert_eq!(stringify_expr!(static || self), "static || self");
- assert_eq!(stringify_expr!(static move || self), "static move || self");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5149
- assert_eq!(
- stringify_expr!(static async || self),
- "static async || self",
- );
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5149
- assert_eq!(
- stringify_expr!(static async move || self),
- "static async move || self",
- );
- assert_eq!(stringify_expr!(|| -> u8 { self }), "|| -> u8 { self }");
- assert_eq!(stringify_expr!(1 + || {}), "1 + (|| {})"); // ??
+ c1!(expr, [ || {} ], "|| {}");
+ c2!(expr, [ |x| {} ], "|x| {}", "| x | {}");
+ c2!(expr, [ |x: u8| {} ], "|x: u8| {}", "| x : u8 | {}");
+ c1!(expr, [ || () ], "|| ()");
+ c1!(expr, [ move || self ], "move || self");
+ c1!(expr, [ async || self ], "async || self");
+ c1!(expr, [ async move || self ], "async move || self");
+ c1!(expr, [ static || self ], "static || self");
+ c1!(expr, [ static move || self ], "static move || self");
+ c1!(expr, [ static async || self ], "static async || self");
+ c1!(expr, [ static async move || self ], "static async move || self");
+ c1!(expr, [ || -> u8 { self } ], "|| -> u8 { self }");
+ c2!(expr, [ 1 + || {} ], "1 + (|| {})", "1 + || {}"); // AST??
// ExprKind::Block
- assert_eq!(stringify_expr!({}), "{}");
- assert_eq!(stringify_expr!(unsafe {}), "unsafe {}");
- assert_eq!(stringify_expr!('a: {}), "'a: {}");
- assert_eq!(
- stringify_expr!(
- #[attr]
- {}
- ),
- "#[attr] {}",
- );
- assert_eq!(
- stringify_expr!(
+ c1!(expr, [ {} ], "{}");
+ c1!(expr, [ unsafe {} ], "unsafe {}");
+ c2!(expr, [ 'a: {} ], "'a: {}", "'a : {}");
+ c1!(expr, [ #[attr] {} ], "#[attr] {}");
+ c2!(expr,
+ [
{
#![attr]
}
- ),
+ ],
"{\n\
\x20 #![attr]\n\
}",
+ "{ #! [attr] }"
);
// ExprKind::Async
- assert_eq!(stringify_expr!(async {}), "async {}");
- assert_eq!(stringify_expr!(async move {}), "async move {}");
+ c1!(expr, [ async {} ], "async {}");
+ c1!(expr, [ async move {} ], "async move {}");
// ExprKind::Await
- assert_eq!(stringify_expr!(expr.await), "expr.await");
+ c1!(expr, [ expr.await ], "expr.await");
// ExprKind::TryBlock
- assert_eq!(stringify_expr!(try {}), "try {}");
+ c1!(expr, [ try {} ], "try {}");
// ExprKind::Assign
- assert_eq!(stringify_expr!(expr = true), "expr = true");
+ c1!(expr, [ expr = true ], "expr = true");
// ExprKind::AssignOp
- assert_eq!(stringify_expr!(expr += true), "expr += true");
+ c1!(expr, [ expr += true ], "expr += true");
// ExprKind::Field
- assert_eq!(stringify_expr!(expr.field), "expr.field");
- assert_eq!(stringify_expr!(expr.0), "expr.0");
+ c1!(expr, [ expr.field ], "expr.field");
+ c1!(expr, [ expr.0 ], "expr.0");
// ExprKind::Index
- assert_eq!(stringify_expr!(expr[true]), "expr[true]");
+ c2!(expr, [ expr[true] ], "expr[true]", "expr [true]");
// ExprKind::Range
- assert_eq!(stringify_expr!(..), "..");
- assert_eq!(stringify_expr!(..hi), "..hi");
- assert_eq!(stringify_expr!(lo..), "lo..");
- assert_eq!(stringify_expr!(lo..hi), "lo..hi");
- assert_eq!(stringify_expr!(..=hi), "..=hi");
- assert_eq!(stringify_expr!(lo..=hi), "lo..=hi");
- assert_eq!(stringify_expr!(-2..=-1), "-2..=-1");
+ c1!(expr, [ .. ], "..");
+ c2!(expr, [ ..hi ], "..hi", ".. hi");
+ c2!(expr, [ lo.. ], "lo..", "lo ..");
+ c2!(expr, [ lo..hi ], "lo..hi", "lo .. hi");
+ c2!(expr, [ ..=hi ], "..=hi", "..= hi");
+ c2!(expr, [ lo..=hi ], "lo..=hi", "lo ..= hi");
+ c2!(expr, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
+
+ // ExprKind::Underscore
+ // FIXME: todo
// ExprKind::Path
- assert_eq!(stringify_expr!(thing), "thing");
- assert_eq!(stringify_expr!(m::thing), "m::thing");
- assert_eq!(stringify_expr!(self::thing), "self::thing");
- assert_eq!(stringify_expr!(crate::thing), "crate::thing");
- assert_eq!(stringify_expr!(Self::thing), "Self::thing");
- assert_eq!(stringify_expr!(<Self as T>::thing), "<Self as T>::thing");
- assert_eq!(stringify_expr!(Self::<'static>), "Self::<'static>");
+ c1!(expr, [ thing ], "thing");
+ c2!(expr, [ m::thing ], "m::thing", "m :: thing");
+ c2!(expr, [ self::thing ], "self::thing", "self :: thing");
+ c2!(expr, [ crate::thing ], "crate::thing", "crate :: thing");
+ c2!(expr, [ Self::thing ], "Self::thing", "Self :: thing");
+ c2!(expr, [ <Self as T>::thing ], "<Self as T>::thing", "< Self as T > :: thing");
+ c2!(expr, [ Self::<'static> ], "Self::<'static>", "Self :: < 'static >");
// ExprKind::AddrOf
- assert_eq!(stringify_expr!(&expr), "&expr");
- assert_eq!(stringify_expr!(&mut expr), "&mut expr");
- assert_eq!(stringify_expr!(&raw const expr), "&raw const expr");
- assert_eq!(stringify_expr!(&raw mut expr), "&raw mut expr");
+ c2!(expr, [ &expr ], "&expr", "& expr");
+ c2!(expr, [ &mut expr ], "&mut expr", "& mut expr");
+ c2!(expr, [ &raw const expr ], "&raw const expr", "& raw const expr");
+ c2!(expr, [ &raw mut expr ], "&raw mut expr", "& raw mut expr");
// ExprKind::Break
- assert_eq!(stringify_expr!(break), "break");
- assert_eq!(stringify_expr!(break 'a), "break 'a");
- assert_eq!(stringify_expr!(break true), "break true");
- assert_eq!(stringify_expr!(break 'a true), "break 'a true");
+ c1!(expr, [ break ], "break");
+ c1!(expr, [ break 'a ], "break 'a");
+ c1!(expr, [ break true ], "break true");
+ c1!(expr, [ break 'a true ], "break 'a true");
// ExprKind::Continue
- assert_eq!(stringify_expr!(continue), "continue");
- assert_eq!(stringify_expr!(continue 'a), "continue 'a");
+ c1!(expr, [ continue ], "continue");
+ c1!(expr, [ continue 'a ], "continue 'a");
// ExprKind::Ret
- assert_eq!(stringify_expr!(return), "return");
- assert_eq!(stringify_expr!(return true), "return true");
+ c1!(expr, [ return ], "return");
+ c1!(expr, [ return true ], "return true");
+
+ // ExprKind::InlineAsm: untestable because this test works pre-expansion.
+
+ // ExprKind::OffsetOf: untestable because this test works pre-expansion.
// ExprKind::MacCall
- assert_eq!(stringify_expr!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_expr!(mac![...]), "mac![...]");
- assert_eq!(stringify_expr!(mac! { ... }), "mac! { ... }");
+ c2!(expr, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(expr, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(expr, [ mac! { ... } ], "mac! { ... }");
// ExprKind::Struct
- assert_eq!(stringify_expr!(Struct {}), "Struct {}");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5151
- assert_eq!(stringify_expr!(<Struct as Trait>::Type {}), "<Struct as Trait>::Type {}");
- assert_eq!(stringify_expr!(Struct { .. }), "Struct { .. }");
- assert_eq!(stringify_expr!(Struct { ..base }), "Struct { ..base }");
- assert_eq!(stringify_expr!(Struct { x }), "Struct { x }");
- assert_eq!(stringify_expr!(Struct { x, .. }), "Struct { x, .. }");
- assert_eq!(stringify_expr!(Struct { x, ..base }), "Struct { x, ..base }");
- assert_eq!(stringify_expr!(Struct { x: true }), "Struct { x: true }");
- assert_eq!(stringify_expr!(Struct { x: true, .. }), "Struct { x: true, .. }");
- assert_eq!(stringify_expr!(Struct { x: true, ..base }), "Struct { x: true, ..base }");
+ c1!(expr, [ Struct {} ], "Struct {}");
+ c2!(expr,
+ [ <Struct as Trait>::Type {} ],
+ "<Struct as Trait>::Type {}",
+ "< Struct as Trait > :: Type {}"
+ );
+ c1!(expr, [ Struct { .. } ], "Struct { .. }");
+ c2!(expr, [ Struct { ..base } ], "Struct { ..base }", "Struct { .. base }");
+ c1!(expr, [ Struct { x } ], "Struct { x }");
+ c1!(expr, [ Struct { x, .. } ], "Struct { x, .. }");
+ c2!(expr, [ Struct { x, ..base } ], "Struct { x, ..base }", "Struct { x, .. base }");
+ c2!(expr, [ Struct { x: true } ], "Struct { x: true }", "Struct { x : true }");
+ c2!(expr, [ Struct { x: true, .. } ], "Struct { x: true, .. }", "Struct { x : true, .. }");
+ c2!(expr,
+ [ Struct { x: true, ..base } ],
+ "Struct { x: true, ..base }",
+ "Struct { x : true, .. base }"
+ );
// ExprKind::Repeat
- assert_eq!(stringify_expr!([(); 0]), "[(); 0]");
+ c2!(expr, [ [(); 0] ], "[(); 0]", "[() ; 0]");
// ExprKind::Paren
- assert_eq!(stringify_expr!((expr)), "(expr)");
+ c1!(expr, [ (expr) ], "(expr)");
// ExprKind::Try
- assert_eq!(stringify_expr!(expr?), "expr?");
+ c2!(expr, [ expr? ], "expr?", "expr ?");
// ExprKind::Yield
- assert_eq!(stringify_expr!(yield), "yield");
- assert_eq!(stringify_expr!(yield true), "yield true");
+ c1!(expr, [ yield ], "yield");
+ c1!(expr, [ yield true ], "yield true");
+
+ // ExprKind::Yeet
+ c1!(expr, [ do yeet ], "do yeet");
+ c1!(expr, [ do yeet 0 ], "do yeet 0");
+
+ // ExprKind::Become
+ // FIXME: todo
+
+ // ExprKind::IncludedBytes
+ // FIXME: todo
+
+ // ExprKind::FormatArgs: untestable because this test works pre-expansion.
+
+ // ExprKind::Err: untestable.
}
#[test]
fn test_item() {
// ItemKind::ExternCrate
- assert_eq!(
- stringify_item!(
- extern crate std;
- ),
- "extern crate std;",
- );
- assert_eq!(
- stringify_item!(
- pub extern crate self as std;
- ),
+ c2!(item, [ extern crate std; ], "extern crate std;", "extern crate std ;");
+ c2!(item,
+ [ pub extern crate self as std; ],
"pub extern crate self as std;",
+ "pub extern crate self as std ;"
);
// ItemKind::Use
- assert_eq!(
- stringify_item!(
- pub use crate::{a, b::c};
- ),
+ c2!(item,
+ [ pub use crate::{a, b::c}; ],
"pub use crate::{a, b::c};",
+ "pub use crate :: { a, b :: c } ;"
);
+ c2!(item, [ pub use A::*; ], "pub use A::*;", "pub use A :: * ;");
// ItemKind::Static
- assert_eq!(
- stringify_item!(
- pub static S: () = {};
- ),
- "pub static S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- static mut S: () = {};
- ),
- "static mut S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- static S: ();
- ),
- "static S: ();",
- );
- assert_eq!(
- stringify_item!(
- static mut S: ();
- ),
- "static mut S: ();",
- );
+ c2!(item, [ pub static S: () = {}; ], "pub static S: () = {};", "pub static S : () = {} ;");
+ c2!(item, [ static mut S: () = {}; ], "static mut S: () = {};", "static mut S : () = {} ;");
+ c2!(item, [ static S: (); ], "static S: ();", "static S : () ;");
+ c2!(item, [ static mut S: (); ], "static mut S: ();", "static mut S : () ;");
// ItemKind::Const
- assert_eq!(
- stringify_item!(
- pub const S: () = {};
- ),
- "pub const S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- const S: ();
- ),
- "const S: ();",
- );
+ c2!(item, [ pub const S: () = {}; ], "pub const S: () = {};", "pub const S : () = {} ;");
+ c2!(item, [ const S: (); ], "const S: ();", "const S : () ;");
// ItemKind::Fn
- assert_eq!(
- stringify_item!(
- pub default const async unsafe extern "C" fn f() {}
- ),
- "pub default const async unsafe extern \"C\" fn f() {}",
+ c1!(item,
+ [ pub default const async unsafe extern "C" fn f() {} ],
+ "pub default const async unsafe extern \"C\" fn f() {}"
+ );
+ c2!(item,
+ [ fn g<T>(t: Vec<Vec<Vec<T>>>) {} ],
+ "fn g<T>(t: Vec<Vec<Vec<T>>>) {}",
+ "fn g < T > (t : Vec < Vec < Vec < T >> >) {}"
+ );
+ c2!(item,
+ [ fn h<'a>(t: &'a Vec<Cell<dyn D>>) {} ],
+ "fn h<'a>(t: &'a Vec<Cell<dyn D>>) {}",
+ "fn h < 'a > (t : & 'a Vec < Cell < dyn D >>) {}"
);
// ItemKind::Mod
- assert_eq!(
- stringify_item!(
- pub mod m;
- ),
- "pub mod m;",
- );
- assert_eq!(
- stringify_item!(
- mod m {}
- ),
- "mod m {}",
- );
- assert_eq!(
- stringify_item!(
- unsafe mod m;
- ),
- "unsafe mod m;",
- );
- assert_eq!(
- stringify_item!(
- unsafe mod m {}
- ),
- "unsafe mod m {}",
- );
+ c2!(item, [ pub mod m; ], "pub mod m;", "pub mod m ;");
+ c1!(item, [ mod m {} ], "mod m {}");
+ c2!(item, [ unsafe mod m; ], "unsafe mod m;", "unsafe mod m ;");
+ c1!(item, [ unsafe mod m {} ], "unsafe mod m {}");
// ItemKind::ForeignMod
- assert_eq!(
- stringify_item!(
- extern "C" {}
- ),
- "extern \"C\" {}",
- );
- #[rustfmt::skip]
- assert_eq!(
- stringify_item!(
- pub extern "C" {}
- ),
- "extern \"C\" {}",
- );
- assert_eq!(
- stringify_item!(
- unsafe extern "C++" {}
- ),
- "unsafe extern \"C++\" {}",
+ c1!(item, [ extern "C" {} ], "extern \"C\" {}");
+ c2!(item,
+ [ pub extern "C" {} ],
+ "extern \"C\" {}", // ??
+ "pub extern \"C\" {}"
);
+ c1!(item, [ unsafe extern "C++" {} ], "unsafe extern \"C++\" {}");
+
+ // ItemKind::GlobalAsm: untestable because this test works pre-expansion.
// ItemKind::TyAlias
- #[rustfmt::skip]
- assert_eq!(
- stringify_item!(
+ c2!(item,
+ [
pub default type Type<'a>: Bound
where
Self: 'a,
= T;
- ),
+ ],
"pub default type Type<'a>: Bound where Self: 'a = T;",
+ "pub default type Type < 'a > : Bound where Self : 'a, = T ;"
);
// ItemKind::Enum
- assert_eq!(
- stringify_item!(
- pub enum Void {}
- ),
- "pub enum Void {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub enum Void {} ], "pub enum Void {}");
+ c1!(item,
+ [
enum Empty {
Unit,
Tuple(),
Struct {},
}
- ),
- "enum Empty { Unit, Tuple(), Struct {}, }",
+ ],
+ "enum Empty { Unit, Tuple(), Struct {}, }"
);
- assert_eq!(
- stringify_item!(
+ c2!(item,
+ [
enum Enum<T>
where
T: 'a,
@@ -499,7 +447,7 @@ fn test_item() {
Tuple(T),
Struct { t: T },
}
- ),
+ ],
"enum Enum<T> where T: 'a {\n\
\x20 Unit,\n\
\x20 Tuple(T),\n\
@@ -507,378 +455,378 @@ fn test_item() {
\x20 t: T,\n\
\x20 },\n\
}",
+ "enum Enum < T > where T : 'a, { Unit, Tuple(T), Struct { t : T }, }"
);
// ItemKind::Struct
- assert_eq!(
- stringify_item!(
- pub struct Unit;
- ),
- "pub struct Unit;",
- );
- assert_eq!(
- stringify_item!(
- struct Tuple();
- ),
- "struct Tuple();",
- );
- assert_eq!(
- stringify_item!(
- struct Tuple(T);
- ),
- "struct Tuple(T);",
- );
- assert_eq!(
- stringify_item!(
- struct Struct {}
- ),
- "struct Struct {}",
- );
- assert_eq!(
- stringify_item!(
+ c2!(item, [ pub struct Unit; ], "pub struct Unit;", "pub struct Unit ;");
+ c2!(item, [ struct Tuple(); ], "struct Tuple();", "struct Tuple() ;");
+ c2!(item, [ struct Tuple(T); ], "struct Tuple(T);", "struct Tuple(T) ;");
+ c1!(item, [ struct Struct {} ], "struct Struct {}");
+ c2!(item,
+ [
struct Struct<T>
where
T: 'a,
{
t: T,
}
- ),
+ ],
"struct Struct<T> where T: 'a {\n\
\x20 t: T,\n\
}",
+ "struct Struct < T > where T : 'a, { t : T, }"
);
// ItemKind::Union
- assert_eq!(
- stringify_item!(
- pub union Union {}
- ),
- "pub union Union {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub union Union {} ], "pub union Union {}");
+ c2!(item,
+ [
union Union<T> where T: 'a {
t: T,
}
- ),
+ ],
"union Union<T> where T: 'a {\n\
\x20 t: T,\n\
}",
+ "union Union < T > where T : 'a { t : T, }"
);
// ItemKind::Trait
- assert_eq!(
- stringify_item!(
- pub unsafe auto trait Send {}
- ),
- "pub unsafe auto trait Send {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub unsafe auto trait Send {} ], "pub unsafe auto trait Send {}");
+ c2!(item,
+ [
trait Trait<'a>: Sized
where
Self: 'a,
{
}
- ),
+ ],
"trait Trait<'a>: Sized where Self: 'a {}",
+ "trait Trait < 'a > : Sized where Self : 'a, {}"
);
// ItemKind::TraitAlias
- assert_eq!(
- stringify_item!(
- pub trait Trait<T> = Sized where T: 'a;
- ),
+ c2!(item,
+ [ pub trait Trait<T> = Sized where T: 'a; ],
"pub trait Trait<T> = Sized where T: 'a;",
+ "pub trait Trait < T > = Sized where T : 'a ;"
);
// ItemKind::Impl
- assert_eq!(
- stringify_item!(
- pub impl Struct {}
- ),
- "pub impl Struct {}",
- );
- assert_eq!(
- stringify_item!(
- impl<T> Struct<T> {}
- ),
- "impl<T> Struct<T> {}",
- );
- assert_eq!(
- stringify_item!(
- pub impl Trait for Struct {}
- ),
- "pub impl Trait for Struct {}",
- );
- assert_eq!(
- stringify_item!(
- impl<T> const Trait for T {}
- ),
+ c1!(item, [ pub impl Struct {} ], "pub impl Struct {}");
+ c2!(item, [ impl<T> Struct<T> {} ], "impl<T> Struct<T> {}", "impl < T > Struct < T > {}");
+ c1!(item, [ pub impl Trait for Struct {} ], "pub impl Trait for Struct {}");
+ c2!(item,
+ [ impl<T> const Trait for T {} ],
"impl<T> const Trait for T {}",
+ "impl < T > const Trait for T {}"
);
- assert_eq!(
- stringify_item!(
- impl ~const Struct {}
- ),
- "impl ~const Struct {}",
- );
+ c2!(item, [ impl ~const Struct {} ], "impl ~const Struct {}", "impl ~ const Struct {}");
// ItemKind::MacCall
- assert_eq!(stringify_item!(mac!(...);), "mac!(...);");
- assert_eq!(stringify_item!(mac![...];), "mac![...];");
- assert_eq!(stringify_item!(mac! { ... }), "mac! { ... }");
+ c2!(item, [ mac!(...); ], "mac!(...);", "mac! (...) ;");
+ c2!(item, [ mac![...]; ], "mac![...];", "mac! [...] ;");
+ c1!(item, [ mac! { ... } ], "mac! { ... }");
// ItemKind::MacroDef
- assert_eq!(
- stringify_item!(
+ c1!(item,
+ [
macro_rules! stringify {
() => {};
}
- ),
- "macro_rules! stringify { () => {} ; }", // FIXME
+ ],
+ "macro_rules! stringify { () => {} ; }"
);
- assert_eq!(
- stringify_item!(
- pub macro stringify() {}
- ),
- "pub macro stringify { () => {} }",
+ c2!(item,
+ [ pub macro stringify() {} ],
+ "pub macro stringify { () => {} }", // ??
+ "pub macro stringify() {}"
);
}
#[test]
fn test_meta() {
- assert_eq!(stringify_meta!(k), "k");
- assert_eq!(stringify_meta!(k = "v"), "k = \"v\"");
- assert_eq!(stringify_meta!(list(k1, k2 = "v")), "list(k1, k2 = \"v\")");
- assert_eq!(stringify_meta!(serde::k), "serde::k");
+ c1!(meta, [ k ], "k");
+ c1!(meta, [ k = "v" ], "k = \"v\"");
+ c1!(meta, [ list(k1, k2 = "v") ], "list(k1, k2 = \"v\")");
+ c2!(meta, [ serde::k ], "serde::k", "serde :: k");
}
#[test]
fn test_pat() {
// PatKind::Wild
- assert_eq!(stringify_pat!(_), "_");
+ c1!(pat, [ _ ], "_");
// PatKind::Ident
- assert_eq!(stringify_pat!(_x), "_x");
- assert_eq!(stringify_pat!(ref _x), "ref _x");
- assert_eq!(stringify_pat!(mut _x), "mut _x");
- assert_eq!(stringify_pat!(ref mut _x), "ref mut _x");
- assert_eq!(stringify_pat!(ref mut _x @ _), "ref mut _x @ _");
+ c1!(pat, [ _x ], "_x");
+ c1!(pat, [ ref _x ], "ref _x");
+ c1!(pat, [ mut _x ], "mut _x");
+ c1!(pat, [ ref mut _x ], "ref mut _x");
+ c1!(pat, [ ref mut _x @ _ ], "ref mut _x @ _");
// PatKind::Struct
- assert_eq!(stringify_pat!(Struct {}), "Struct {}");
- assert_eq!(stringify_pat!(Struct::<u8> {}), "Struct::<u8> {}");
- assert_eq!(stringify_pat!(Struct::<'static> {}), "Struct::<'static> {}");
- assert_eq!(stringify_pat!(Struct { x }), "Struct { x }");
- assert_eq!(stringify_pat!(Struct { x: _x }), "Struct { x: _x }");
- assert_eq!(stringify_pat!(Struct { .. }), "Struct { .. }");
- assert_eq!(stringify_pat!(Struct { x, .. }), "Struct { x, .. }");
- assert_eq!(stringify_pat!(Struct { x: _x, .. }), "Struct { x: _x, .. }");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5151
- assert_eq!(
- stringify_pat!(<Struct as Trait>::Type {}),
+ c1!(pat, [ Struct {} ], "Struct {}");
+ c2!(pat, [ Struct::<u8> {} ], "Struct::<u8> {}", "Struct :: < u8 > {}");
+ c2!(pat, [ Struct::<'static> {} ], "Struct::<'static> {}", "Struct :: < 'static > {}");
+ c1!(pat, [ Struct { x } ], "Struct { x }");
+ c2!(pat, [ Struct { x: _x } ], "Struct { x: _x }", "Struct { x : _x }");
+ c1!(pat, [ Struct { .. } ], "Struct { .. }");
+ c1!(pat, [ Struct { x, .. } ], "Struct { x, .. }");
+ c2!(pat, [ Struct { x: _x, .. } ], "Struct { x: _x, .. }", "Struct { x : _x, .. }");
+ c2!(pat,
+ [ <Struct as Trait>::Type {} ],
"<Struct as Trait>::Type {}",
+ "< Struct as Trait > :: Type {}"
);
// PatKind::TupleStruct
- assert_eq!(stringify_pat!(Tuple()), "Tuple()");
- assert_eq!(stringify_pat!(Tuple::<u8>()), "Tuple::<u8>()");
- assert_eq!(stringify_pat!(Tuple::<'static>()), "Tuple::<'static>()");
- assert_eq!(stringify_pat!(Tuple(x)), "Tuple(x)");
- assert_eq!(stringify_pat!(Tuple(..)), "Tuple(..)");
- assert_eq!(stringify_pat!(Tuple(x, ..)), "Tuple(x, ..)");
- assert_eq!(stringify_pat!(<Struct as Trait>::Type()), "<Struct as Trait>::Type()");
+ c1!(pat, [ Tuple() ], "Tuple()");
+ c2!(pat, [ Tuple::<u8>() ], "Tuple::<u8>()", "Tuple :: < u8 > ()");
+ c2!(pat, [ Tuple::<'static>() ], "Tuple::<'static>()", "Tuple :: < 'static > ()");
+ c1!(pat, [ Tuple(x) ], "Tuple(x)");
+ c1!(pat, [ Tuple(..) ], "Tuple(..)");
+ c1!(pat, [ Tuple(x, ..) ], "Tuple(x, ..)");
+ c2!(pat,
+ [ <Struct as Trait>::Type() ],
+ "<Struct as Trait>::Type()",
+ "< Struct as Trait > :: Type()"
+ );
// PatKind::Or
- assert_eq!(stringify_pat!(true | false), "true | false");
- assert_eq!(stringify_pat!(| true), "true");
- assert_eq!(stringify_pat!(|true| false), "true | false");
+ c1!(pat, [ true | false ], "true | false");
+ c2!(pat, [ | true ], "true", "| true");
+ c2!(pat, [ |true| false ], "true | false", "| true | false");
// PatKind::Path
- assert_eq!(stringify_pat!(crate::Path), "crate::Path");
- assert_eq!(stringify_pat!(Path::<u8>), "Path::<u8>");
- assert_eq!(stringify_pat!(Path::<'static>), "Path::<'static>");
- assert_eq!(stringify_pat!(<Struct as Trait>::Type), "<Struct as Trait>::Type");
+ c2!(pat, [ crate::Path ], "crate::Path", "crate :: Path");
+ c2!(pat, [ Path::<u8> ], "Path::<u8>", "Path :: < u8 >");
+ c2!(pat, [ Path::<'static> ], "Path::<'static>", "Path :: < 'static >");
+ c2!(pat, [ <Struct as Trait>::Type ], "<Struct as Trait>::Type", "< Struct as Trait > :: Type");
// PatKind::Tuple
- assert_eq!(stringify_pat!(()), "()");
- assert_eq!(stringify_pat!((true,)), "(true,)");
- assert_eq!(stringify_pat!((true, false)), "(true, false)");
+ c1!(pat, [ () ], "()");
+ c1!(pat, [ (true,) ], "(true,)");
+ c1!(pat, [ (true, false) ], "(true, false)");
// PatKind::Box
- assert_eq!(stringify_pat!(box pat), "box pat");
+ c1!(pat, [ box pat ], "box pat");
// PatKind::Ref
- assert_eq!(stringify_pat!(&pat), "&pat");
- assert_eq!(stringify_pat!(&mut pat), "&mut pat");
+ c2!(pat, [ &pat ], "&pat", "& pat");
+ c2!(pat, [ &mut pat ], "&mut pat", "& mut pat");
// PatKind::Lit
- assert_eq!(stringify_pat!(1_000_i8), "1_000_i8");
+ c1!(pat, [ 1_000_i8 ], "1_000_i8");
// PatKind::Range
- assert_eq!(stringify_pat!(..1), "..1");
- assert_eq!(stringify_pat!(0..), "0..");
- assert_eq!(stringify_pat!(0..1), "0..1");
- assert_eq!(stringify_pat!(0..=1), "0..=1");
- assert_eq!(stringify_pat!(-2..=-1), "-2..=-1");
+ c2!(pat, [ ..1 ], "..1", ".. 1");
+ c2!(pat, [ 0.. ], "0..", "0 ..");
+ c2!(pat, [ 0..1 ], "0..1", "0 .. 1");
+ c2!(pat, [ 0..=1 ], "0..=1", "0 ..= 1");
+ c2!(pat, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
// PatKind::Slice
- assert_eq!(stringify_pat!([]), "[]");
- assert_eq!(stringify_pat!([true]), "[true]");
- assert_eq!(stringify_pat!([true,]), "[true]");
- assert_eq!(stringify_pat!([true, false]), "[true, false]");
+ c1!(pat, [ [] ], "[]");
+ c1!(pat, [ [true] ], "[true]");
+ c2!(pat, [ [true,] ], "[true]", "[true,]");
+ c1!(pat, [ [true, false] ], "[true, false]");
// PatKind::Rest
- assert_eq!(stringify_pat!(..), "..");
+ c1!(pat, [ .. ], "..");
// PatKind::Paren
- assert_eq!(stringify_pat!((pat)), "(pat)");
+ c1!(pat, [ (pat) ], "(pat)");
// PatKind::MacCall
- assert_eq!(stringify_pat!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_pat!(mac![...]), "mac![...]");
- assert_eq!(stringify_pat!(mac! { ... }), "mac! { ... }");
+ c2!(pat, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(pat, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(pat, [ mac! { ... } ], "mac! { ... }");
}
#[test]
fn test_path() {
- assert_eq!(stringify_path!(thing), "thing");
- assert_eq!(stringify_path!(m::thing), "m::thing");
- assert_eq!(stringify_path!(self::thing), "self::thing");
- assert_eq!(stringify_path!(crate::thing), "crate::thing");
- assert_eq!(stringify_path!(Self::thing), "Self::thing");
- assert_eq!(stringify_path!(Self<'static>), "Self<'static>");
- assert_eq!(stringify_path!(Self::<'static>), "Self<'static>");
- assert_eq!(stringify_path!(Self()), "Self()");
- assert_eq!(stringify_path!(Self() -> ()), "Self() -> ()");
+ c1!(path, [ thing ], "thing");
+ c2!(path, [ m::thing ], "m::thing", "m :: thing");
+ c2!(path, [ self::thing ], "self::thing", "self :: thing");
+ c2!(path, [ crate::thing ], "crate::thing", "crate :: thing");
+ c2!(path, [ Self::thing ], "Self::thing", "Self :: thing");
+ c2!(path, [ Self<'static> ], "Self<'static>", "Self < 'static >");
+ c2!(path, [ Self::<'static> ], "Self<'static>", "Self :: < 'static >");
+ c1!(path, [ Self() ], "Self()");
+ c1!(path, [ Self() -> () ], "Self() -> ()");
}
#[test]
fn test_stmt() {
// StmtKind::Local
- assert_eq!(stringify_stmt!(let _), "let _;");
- assert_eq!(stringify_stmt!(let x = true), "let x = true;");
- assert_eq!(stringify_stmt!(let x: bool = true), "let x: bool = true;");
+ c2!(stmt, [ let _ ], "let _;", "let _");
+ c2!(stmt, [ let x = true ], "let x = true;", "let x = true");
+ c2!(stmt, [ let x: bool = true ], "let x: bool = true;", "let x : bool = true");
+ c2!(stmt, [ let (a, b) = (1, 2) ], "let (a, b) = (1, 2);", "let(a, b) = (1, 2)"); // FIXME
+ c2!(stmt,
+ [ let (a, b): (u32, u32) = (1, 2) ],
+ "let (a, b): (u32, u32) = (1, 2);",
+ "let(a, b) : (u32, u32) = (1, 2)"
+ );
// StmtKind::Item
- assert_eq!(
- stringify_stmt!(
- struct S;
- ),
- "struct S;",
- );
+ c2!(stmt, [ struct S; ], "struct S;", "struct S ;");
+ c1!(stmt, [ struct S {} ], "struct S {}");
// StmtKind::Expr
- assert_eq!(stringify_stmt!(loop {}), "loop {}");
+ c1!(stmt, [ loop {} ], "loop {}");
// StmtKind::Semi
- assert_eq!(stringify_stmt!(1 + 1), "1 + 1;");
+ c2!(stmt, [ 1 + 1 ], "1 + 1;", "1 + 1");
// StmtKind::Empty
- assert_eq!(stringify_stmt!(;), ";");
+ c1!(stmt, [ ; ], ";");
// StmtKind::MacCall
- assert_eq!(stringify_stmt!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_stmt!(mac![...]), "mac![...]");
- assert_eq!(stringify_stmt!(mac! { ... }), "mac! { ... }");
+ c2!(stmt, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(stmt, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(stmt, [ mac! { ... } ], "mac! { ... }");
}
#[test]
fn test_ty() {
// TyKind::Slice
- assert_eq!(stringify_ty!([T]), "[T]");
+ c1!(ty, [ [T] ], "[T]");
// TyKind::Array
- assert_eq!(stringify_ty!([T; 0]), "[T; 0]");
+ c2!(ty, [ [T; 0] ], "[T; 0]", "[T ; 0]");
// TyKind::Ptr
- assert_eq!(stringify_ty!(*const T), "*const T");
- assert_eq!(stringify_ty!(*mut T), "*mut T");
+ c2!(ty, [ *const T ], "*const T", "* const T");
+ c2!(ty, [ *mut T ], "*mut T", "* mut T");
// TyKind::Ref
- assert_eq!(stringify_ty!(&T), "&T");
- assert_eq!(stringify_ty!(&mut T), "&mut T");
- assert_eq!(stringify_ty!(&'a T), "&'a T");
- assert_eq!(stringify_ty!(&'a mut T), "&'a mut T");
+ c2!(ty, [ &T ], "&T", "& T");
+ c2!(ty, [ &mut T ], "&mut T", "& mut T");
+ c2!(ty, [ &'a T ], "&'a T", "& 'a T");
+ c2!(ty, [ &'a mut [T] ], "&'a mut [T]", "& 'a mut [T]");
+ c2!(ty, [ &A<B<C<D<E>>>> ], "&A<B<C<D<E>>>>", "& A < B < C < D < E >> >>");
// TyKind::BareFn
- assert_eq!(stringify_ty!(fn()), "fn()");
- assert_eq!(stringify_ty!(fn() -> ()), "fn() -> ()");
- assert_eq!(stringify_ty!(fn(u8)), "fn(u8)");
- assert_eq!(stringify_ty!(fn(x: u8)), "fn(x: u8)");
- #[rustfmt::skip]
- assert_eq!(stringify_ty!(for<> fn()), "fn()");
- assert_eq!(stringify_ty!(for<'a> fn()), "for<'a> fn()");
+ c1!(ty, [ fn() ], "fn()");
+ c1!(ty, [ fn() -> () ], "fn() -> ()");
+ c1!(ty, [ fn(u8) ], "fn(u8)");
+ c2!(ty, [ fn(x: u8) ], "fn(x: u8)", "fn(x : u8)");
+ c2!(ty, [ for<> fn() ], "fn()", "for < > fn()");
+ c2!(ty, [ for<'a> fn() ], "for<'a> fn()", "for < 'a > fn()");
// TyKind::Never
- assert_eq!(stringify_ty!(!), "!");
+ c1!(ty, [ ! ], "!");
// TyKind::Tup
- assert_eq!(stringify_ty!(()), "()");
- assert_eq!(stringify_ty!((T,)), "(T,)");
- assert_eq!(stringify_ty!((T, U)), "(T, U)");
+ c1!(ty, [ () ], "()");
+ c1!(ty, [ (T,) ], "(T,)");
+ c1!(ty, [ (T, U) ], "(T, U)");
+
+ // TyKind::AnonStruct: untestable in isolation.
+
+ // TyKind::AnonUnion: untestable in isolation.
// TyKind::Path
- assert_eq!(stringify_ty!(T), "T");
- assert_eq!(stringify_ty!(Ref<'a>), "Ref<'a>");
- assert_eq!(stringify_ty!(PhantomData<T>), "PhantomData<T>");
- assert_eq!(stringify_ty!(PhantomData::<T>), "PhantomData<T>");
- assert_eq!(stringify_ty!(Fn() -> !), "Fn() -> !");
- assert_eq!(stringify_ty!(Fn(u8) -> !), "Fn(u8) -> !");
- assert_eq!(stringify_ty!(<Struct as Trait>::Type), "<Struct as Trait>::Type");
+ c1!(ty, [ T ], "T");
+ c2!(ty, [ Ref<'a> ], "Ref<'a>", "Ref < 'a >");
+ c2!(ty, [ PhantomData<T> ], "PhantomData<T>", "PhantomData < T >");
+ c2!(ty, [ PhantomData::<T> ], "PhantomData<T>", "PhantomData :: < T >");
+ c2!(ty, [ Fn() -> ! ], "Fn() -> !", "Fn() ->!");
+ c2!(ty, [ Fn(u8) -> ! ], "Fn(u8) -> !", "Fn(u8) ->!"); // FIXME
+ c2!(ty, [ <Struct as Trait>::Type ], "<Struct as Trait>::Type", "< Struct as Trait > :: Type");
// TyKind::TraitObject
- assert_eq!(stringify_ty!(dyn Send), "dyn Send");
- assert_eq!(stringify_ty!(dyn Send + 'a), "dyn Send + 'a");
- assert_eq!(stringify_ty!(dyn 'a + Send), "dyn 'a + Send");
- assert_eq!(stringify_ty!(dyn ?Sized), "dyn ?Sized");
- assert_eq!(stringify_ty!(dyn ~const Clone), "dyn ~const Clone");
- assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send");
+ c1!(ty, [ dyn Send ], "dyn Send");
+ c1!(ty, [ dyn Send + 'a ], "dyn Send + 'a");
+ c1!(ty, [ dyn 'a + Send ], "dyn 'a + Send");
+ c2!(ty, [ dyn ?Sized ], "dyn ?Sized", "dyn ? Sized");
+ c2!(ty, [ dyn ~const Clone ], "dyn ~const Clone", "dyn ~ const Clone");
+ c2!(ty, [ dyn for<'a> Send ], "dyn for<'a> Send", "dyn for < 'a > Send");
// TyKind::ImplTrait
- assert_eq!(stringify_ty!(impl Send), "impl Send");
- assert_eq!(stringify_ty!(impl Send + 'a), "impl Send + 'a");
- assert_eq!(stringify_ty!(impl 'a + Send), "impl 'a + Send");
- assert_eq!(stringify_ty!(impl ?Sized), "impl ?Sized");
- assert_eq!(stringify_ty!(impl ~const Clone), "impl ~const Clone");
- assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send");
+ c1!(ty, [ impl Send ], "impl Send");
+ c1!(ty, [ impl Send + 'a ], "impl Send + 'a");
+ c1!(ty, [ impl 'a + Send ], "impl 'a + Send");
+ c2!(ty, [ impl ?Sized ], "impl ?Sized", "impl ? Sized");
+ c2!(ty, [ impl ~const Clone ], "impl ~const Clone", "impl ~ const Clone");
+ c2!(ty, [ impl for<'a> Send ], "impl for<'a> Send", "impl for < 'a > Send");
// TyKind::Paren
- assert_eq!(stringify_ty!((T)), "(T)");
+ c1!(ty, [ (T) ], "(T)");
+
+ // TyKind::Typeof: unused for now.
// TyKind::Infer
- assert_eq!(stringify_ty!(_), "_");
+ c1!(ty, [ _ ], "_");
+
+ // TyKind::ImplicitSelf: there is no syntax for this.
// TyKind::MacCall
- assert_eq!(stringify_ty!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_ty!(mac![...]), "mac![...]");
- assert_eq!(stringify_ty!(mac! { ... }), "mac! { ... }");
+ c2!(ty, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(ty, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(ty, [ mac! { ... } ], "mac! { ... }");
+
+ // TyKind::Err: untestable.
+
+ // TyKind::CVarArgs
+ // FIXME: todo
}
#[test]
fn test_vis() {
// VisibilityKind::Public
- assert_eq!(stringify_vis!(pub), "pub ");
+ c2!(vis, [ pub ], "pub ", "pub");
// VisibilityKind::Restricted
- assert_eq!(stringify_vis!(pub(crate)), "pub(crate) ");
- assert_eq!(stringify_vis!(pub(self)), "pub(self) ");
- assert_eq!(stringify_vis!(pub(super)), "pub(super) ");
- assert_eq!(stringify_vis!(pub(in crate)), "pub(in crate) ");
- assert_eq!(stringify_vis!(pub(in self)), "pub(in self) ");
- assert_eq!(stringify_vis!(pub(in super)), "pub(in super) ");
- assert_eq!(stringify_vis!(pub(in path::to)), "pub(in path::to) ");
- assert_eq!(stringify_vis!(pub(in ::path::to)), "pub(in ::path::to) ");
- assert_eq!(stringify_vis!(pub(in self::path::to)), "pub(in self::path::to) ");
- assert_eq!(stringify_vis!(pub(in super::path::to)), "pub(in super::path::to) ");
+ c2!(vis, [ pub(crate) ], "pub(crate) ", "pub(crate)");
+ c2!(vis, [ pub(self) ], "pub(self) ", "pub(self)");
+ c2!(vis, [ pub(super) ], "pub(super) ", "pub(super)");
+ c2!(vis, [ pub(in crate) ], "pub(in crate) ", "pub(in crate)");
+ c2!(vis, [ pub(in self) ], "pub(in self) ", "pub(in self)");
+ c2!(vis, [ pub(in super) ], "pub(in super) ", "pub(in super)");
+ c2!(vis, [ pub(in path::to) ], "pub(in path::to) ", "pub(in path :: to)");
+ c2!(vis, [ pub(in ::path::to) ], "pub(in ::path::to) ", "pub(in :: path :: to)");
+ c2!(vis, [ pub(in self::path::to) ], "pub(in self::path::to) ", "pub(in self :: path :: to)");
+ c2!(vis,
+ [ pub(in super::path::to) ],
+ "pub(in super::path::to) ",
+ "pub(in super :: path :: to)"
+ );
// VisibilityKind::Inherited
- // Directly calling `stringify_vis!()` does not work.
- macro_rules! stringify_inherited_vis {
- ($vis:vis struct) => {
- stringify_vis!($vis)
- };
- }
- assert_eq!(stringify_inherited_vis!(struct), "");
+ // This one is different because directly calling `vis!` does not work.
+ macro_rules! inherited_vis { ($vis:vis struct) => { vis!($vis) }; }
+ assert_eq!(inherited_vis!(struct), "");
+ assert_eq!(stringify!(), "");
+}
+
+macro_rules! p {
+ ([$($tt:tt)*], $s:literal) => {
+ assert_eq!(stringify!($($tt)*), $s);
+ };
+}
+
+#[test]
+fn test_punct() {
+ // For all these cases, we must preserve spaces between the tokens.
+ // Otherwise, any old proc macro that parses pretty-printed code might glue
+ // together tokens that shouldn't be glued.
+ p!([ = = < < <= <= == == != != >= >= > > ], "= = < < <= <= == == != != >= >= > >");
+ p!([ && && & & || || | | ! ! ], "&& && & & || || | |!!"); // FIXME
+ p!([ ~ ~ @ @ # # ], "~ ~ @ @ # #");
+ p!([ . . .. .. ... ... ..= ..=], ".... .. ... ... ..= ..="); // FIXME
+ p!([ , , ; ; : : :: :: ], ",, ; ; : : :: ::"); // FIXME
+ p!([ -> -> <- <- => =>], "-> -> <- <- => =>");
+ p!([ $ $ ? ? ' ' ], "$$? ? ' '"); // FIXME
+ p!([ + + += += - - -= -= * * *= *= / / /= /= ], "+ + += += - - -= -= * * *= *= / / /= /=");
+ p!([ % % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>= ],
+ "% % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>=");
+
+ // For these one we must insert spaces between adjacent tokens, again due
+ // to proc macros.
+ p!([ +! ?= |> >>@ --> <-- $$ =====> ], "+! ? = | > >> @ - -> <- - $$== == =>"); // FIXME
+ p!([ ,; ;, ** @@ $+$ >< <> ?? +== ], ", ; ;, * * @ @ $+ $> < < > ? ? += ="); // FIXME
+ p!([ :#!@|$=&*,+;*~? ], ": #! @ | $= & *, + ; * ~ ?"); // FIXME
}
diff --git a/tests/ui/malformed/do-not-ice-on-note_and_explain.rs b/tests/ui/malformed/do-not-ice-on-note_and_explain.rs
new file mode 100644
index 000000000..e65276fb7
--- /dev/null
+++ b/tests/ui/malformed/do-not-ice-on-note_and_explain.rs
@@ -0,0 +1,7 @@
+struct A<B>(B);
+impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+//~^ ERROR the size for values of type `B` cannot be known at compilation time
+//~| ERROR the size for values of type `B` cannot be known at compilation time
+//~| ERROR mismatched types
+//~| ERROR mismatched types
+//~| ERROR `main` function not found in crate
diff --git a/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr
new file mode 100644
index 000000000..27b86145e
--- /dev/null
+++ b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr
@@ -0,0 +1,79 @@
+error[E0601]: `main` function not found in crate `do_not_ice_on_note_and_explain`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:37
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ^ consider adding a `main` function to `$DIR/do-not-ice-on-note_and_explain.rs`
+
+error[E0277]: the size for values of type `B` cannot be known at compilation time
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:32
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | - ---- ^ doesn't have a size known at compile-time
+ | | |
+ | | required by a bound introduced by this call
+ | this type parameter needs to be `Sized`
+ |
+note: required by a bound in `A`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ required by this bound in `A`
+
+error[E0308]: mismatched types
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:32
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ---- ^ expected type parameter `B`, found integer
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected type parameter `B`
+ found type `{integer}`
+note: tuple struct defined here
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:8
+ |
+LL | struct A<B>(B);
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:27
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ^^^^^^^ expected `()`, found `A<B>`
+ |
+ = note: expected unit type `()`
+ found struct `A<B>`
+help: consider using a semicolon here
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1);}}}
+ | +
+help: try adding a return type
+ |
+LL | impl<B>A<B>{fn d(){fn d() -> A<B>{Self(1)}}}
+ | +++++++
+
+error[E0277]: the size for values of type `B` cannot be known at compilation time
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:27
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | - ^^^^^^^ doesn't have a size known at compile-time
+ | |
+ | this type parameter needs to be `Sized`
+ |
+note: required by a bound in `A`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ required by this bound in `A`
+help: you could relax the implicit `Sized` bound on `B` if it were used through indirection like `&B` or `Box<B>`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ - ...if indirection were used here: `Box<B>`
+ | |
+ | this could be changed to `B: ?Sized`...
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0277, E0308, E0601.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/malformed/malformed-plugin-1.rs b/tests/ui/malformed/malformed-plugin-1.rs
deleted file mode 100644
index d4c1a2a16..000000000
--- a/tests/ui/malformed/malformed-plugin-1.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-1.stderr b/tests/ui/malformed/malformed-plugin-1.stderr
deleted file mode 100644
index 505f6b6f1..000000000
--- a/tests/ui/malformed/malformed-plugin-1.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: malformed `plugin` attribute input
- --> $DIR/malformed-plugin-1.rs:2:1
- |
-LL | #![plugin]
- | ^^^^^^^^^^ help: must be of the form: `#![plugin(name)]`
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-1.rs:2:1
- |
-LL | #![plugin]
- | ^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/malformed/malformed-plugin-2.rs b/tests/ui/malformed/malformed-plugin-2.rs
deleted file mode 100644
index ba80d97a3..000000000
--- a/tests/ui/malformed/malformed-plugin-2.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin="bleh"] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-2.stderr b/tests/ui/malformed/malformed-plugin-2.stderr
deleted file mode 100644
index 52bbd82a3..000000000
--- a/tests/ui/malformed/malformed-plugin-2.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: malformed `plugin` attribute input
- --> $DIR/malformed-plugin-2.rs:2:1
- |
-LL | #![plugin="bleh"]
- | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#![plugin(name)]`
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-2.rs:2:1
- |
-LL | #![plugin="bleh"]
- | ^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/malformed/malformed-plugin-3.rs b/tests/ui/malformed/malformed-plugin-3.rs
deleted file mode 100644
index d2bd8f9f8..000000000
--- a/tests/ui/malformed/malformed-plugin-3.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-3.stderr b/tests/ui/malformed/malformed-plugin-3.stderr
deleted file mode 100644
index 64cb429ea..000000000
--- a/tests/ui/malformed/malformed-plugin-3.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0498]: malformed `plugin` attribute
- --> $DIR/malformed-plugin-3.rs:2:11
- |
-LL | #![plugin(foo="bleh")]
- | ^^^^^^^^^^ malformed attribute
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-3.rs:2:1
- |
-LL | #![plugin(foo="bleh")]
- | ^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0498`.
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
index e713d1451..64bccda56 100644
--- a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
+++ b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/overlapping-impl-1-modulo-regions.rs:14:21
|
LL | impl<T: Copy> F for T {}
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<T: Copy + 'static> F for T {}
| +++++++++
diff --git a/tests/ui/match/match-range-fail-2.stderr b/tests/ui/match/match-range-fail-2.stderr
index 52a2bf2b3..089fa851f 100644
--- a/tests/ui/match/match-range-fail-2.stderr
+++ b/tests/ui/match/match-range-fail-2.stderr
@@ -2,19 +2,19 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:5:9
|
LL | 6 ..= 1 => { }
- | ^ lower bound larger than upper bound
+ | ^^^^^^^ lower bound larger than upper bound
error[E0579]: lower range bound must be less than upper
--> $DIR/match-range-fail-2.rs:11:9
|
LL | 0 .. 0 => { }
- | ^
+ | ^^^^^^
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:17:9
|
LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
- | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
error: aborting due to 3 previous errors
diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr
index 7b8bdfe00..40be39ec0 100644
--- a/tests/ui/match/match_non_exhaustive.stderr
+++ b/tests/ui/match/match_non_exhaustive.stderr
@@ -5,10 +5,10 @@ LL | match l { L::A => () };
| ^ pattern `L::B` not covered
|
note: `L` defined here
- --> $DIR/match_non_exhaustive.rs:10:13
+ --> $DIR/match_non_exhaustive.rs:10:6
|
LL | enum L { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `L`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/match/validate-range-endpoints.rs b/tests/ui/match/validate-range-endpoints.rs
new file mode 100644
index 000000000..1d1737f8b
--- /dev/null
+++ b/tests/ui/match/validate-range-endpoints.rs
@@ -0,0 +1,59 @@
+#![feature(exclusive_range_pattern)]
+#![feature(inline_const_pat)]
+#![allow(incomplete_features)]
+#![allow(overlapping_range_endpoints)]
+
+fn main() {
+ const TOO_BIG: u8 = 256;
+ match 0u8 {
+ 1..257 => {}
+ //~^ ERROR literal out of range
+ 1..=256 => {}
+ //~^ ERROR literal out of range
+
+ // overflow is detected in a later pass for these
+ 0..257 => {}
+ 0..=256 => {}
+ 256..=100 => {}
+
+ // There isn't really a way to detect these
+ 1..=TOO_BIG => {}
+ //~^ ERROR lower range bound must be less than or equal to upper
+ 1..=const { 256 } => {}
+ //~^ ERROR lower range bound must be less than or equal to upper
+ _ => {}
+ }
+
+ match 0u64 {
+ 10000000000000000000..=99999999999999999999 => {}
+ //~^ ERROR literal out of range
+ _ => {}
+ }
+
+ match 0i8 {
+ 0..129 => {}
+ //~^ ERROR literal out of range
+ 0..=128 => {}
+ //~^ ERROR literal out of range
+ -129..0 => {}
+ //~^ ERROR literal out of range
+ -10000..=-20 => {}
+ //~^ ERROR literal out of range
+
+ // overflow is detected in a later pass for these
+ 128..=0 => {}
+ 0..-129 => {}
+ -10000..=0 => {}
+ _ => {}
+ }
+
+ // FIXME: error message is confusing
+ match 0i8 {
+ //~^ ERROR `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ -10000..=0 => {}
+ }
+ match 0i8 {
+ //~^ ERROR `i8::MIN..=-17_i8` not covered
+ -10000.. => {}
+ }
+}
diff --git a/tests/ui/match/validate-range-endpoints.stderr b/tests/ui/match/validate-range-endpoints.stderr
new file mode 100644
index 000000000..0813fccff
--- /dev/null
+++ b/tests/ui/match/validate-range-endpoints.stderr
@@ -0,0 +1,84 @@
+error: literal out of range for `u8`
+ --> $DIR/validate-range-endpoints.rs:9:12
+ |
+LL | 1..257 => {}
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
+
+error: literal out of range for `u8`
+ --> $DIR/validate-range-endpoints.rs:11:13
+ |
+LL | 1..=256 => {}
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
+
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/validate-range-endpoints.rs:20:9
+ |
+LL | 1..=TOO_BIG => {}
+ | ^^^^^^^^^^^ lower bound larger than upper bound
+
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/validate-range-endpoints.rs:22:9
+ |
+LL | 1..=const { 256 } => {}
+ | ^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
+
+error: literal out of range for `u64`
+ --> $DIR/validate-range-endpoints.rs:28:32
+ |
+LL | 10000000000000000000..=99999999999999999999 => {}
+ | ^^^^^^^^^^^^^^^^^^^^ this value does not fit into the type `u64` whose range is `0..=18446744073709551615`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:34:12
+ |
+LL | 0..129 => {}
+ | ^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:36:13
+ |
+LL | 0..=128 => {}
+ | ^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:38:9
+ |
+LL | -129..0 => {}
+ | ^^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:40:9
+ |
+LL | -10000..=-20 => {}
+ | ^^^^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ --> $DIR/validate-range-endpoints.rs:51:11
+ |
+LL | match 0i8 {
+ | ^^^ patterns `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ |
+ = note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
+ |
+LL ~ -10000..=0 => {},
+LL + i8::MIN..=-17_i8 | 1_i8..=i8::MAX => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` not covered
+ --> $DIR/validate-range-endpoints.rs:55:11
+ |
+LL | match 0i8 {
+ | ^^^ pattern `i8::MIN..=-17_i8` not covered
+ |
+ = note: the matched value is of type `i8`
+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 ~ -10000.. => {},
+LL + i8::MIN..=-17_i8 => todo!()
+ |
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0004, E0030.
+For more information about an error, try `rustc --explain E0004`.
diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.rs b/tests/ui/methods/disambiguate-multiple-blanket-impl.rs
new file mode 100644
index 000000000..6a17f6a21
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.rs
@@ -0,0 +1,38 @@
+trait A {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+trait B {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl<T: std::fmt::Debug> B for T {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax to disambiguate
+ S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax to disambiguate
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr
new file mode 100644
index 000000000..ccdd9a954
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:36:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:30:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:19:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:25:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:33:8
+ |
+LL | S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:18:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:24:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-impl.rs b/tests/ui/methods/disambiguate-multiple-impl.rs
new file mode 100644
index 000000000..9a82ff015
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-impl.rs
@@ -0,0 +1,37 @@
+trait A {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+trait B {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+struct S;
+
+impl A for S {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl B for S {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type = (); //~ ERROR ambiguous associated type
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-impl.stderr b/tests/ui/methods/disambiguate-multiple-impl.stderr
new file mode 100644
index 000000000..417212077
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-impl.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-impl.rs:32:12
+ |
+LL | let _: S::Type = ();
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type = ();
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type = ();
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-impl.rs:29:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:18:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:24:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-impl.rs:34:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:17:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:23:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.rs b/tests/ui/methods/disambiguate-multiple-trait-2.rs
new file mode 100644
index 000000000..829491d82
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait-2.rs
@@ -0,0 +1,54 @@
+trait A {
+ type Type; //~ NOTE ambiguous `Type` from `A`
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self); //~ NOTE candidate #1
+}
+
+trait B {
+ type Type; //~ NOTE ambiguous `Type` from `B`
+ const CONST: usize; //~ NOTE candidate #2
+ fn foo(&self); //~ NOTE candidate #2
+}
+
+trait C: A + B {}
+
+fn a<T: C>(t: T) {
+ t.foo(); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP disambiguate the method
+ //~| HELP disambiguate the method
+ let _ = T::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: T::Type; //~ ERROR ambiguous associated type
+ //~^ NOTE ambiguous associated type `Type`
+ //~| HELP use fully-qualified syntax
+ //~| HELP use fully-qualified syntax
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl<T: std::fmt::Debug> B for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.stderr b/tests/ui/methods/disambiguate-multiple-trait-2.stderr
new file mode 100644
index 000000000..2778f254a
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait-2.stderr
@@ -0,0 +1,132 @@
+error[E0221]: ambiguous associated type `Type` in bounds of `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:23:12
+ |
+LL | type Type;
+ | --------- ambiguous `Type` from `A`
+...
+LL | type Type;
+ | --------- ambiguous `Type` from `B`
+...
+LL | let _: T::Type;
+ | ^^^^^^^ ambiguous associated type `Type`
+ |
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _: <T as A>::Type;
+ | ~~~~~~~~~~
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _: <T as B>::Type;
+ | ~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:16:7
+ |
+LL | t.foo();
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in the trait `A`
+ --> $DIR/disambiguate-multiple-trait-2.rs:4:5
+ |
+LL | fn foo(&self);
+ | ^^^^^^^^^^^^^^
+note: candidate #2 is defined in the trait `B`
+ --> $DIR/disambiguate-multiple-trait-2.rs:10:5
+ |
+LL | fn foo(&self);
+ | ^^^^^^^^^^^^^^
+help: disambiguate the method for candidate #1
+ |
+LL | A::foo(&t);
+ | ~~~~~~~~~~
+help: disambiguate the method for candidate #2
+ |
+LL | B::foo(&t);
+ | ~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:20:16
+ |
+LL | let _ = T::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in the trait `A`
+ --> $DIR/disambiguate-multiple-trait-2.rs:3:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in the trait `B`
+ --> $DIR/disambiguate-multiple-trait-2.rs:9:5
+ |
+LL | const CONST: usize;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <T as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <T as B>::CONST;
+ | ~~~~~~~~~~
+
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-trait-2.rs:52:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:46:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:35:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:41:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:49:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:34:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:40:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0034, E0221, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-trait.rs b/tests/ui/methods/disambiguate-multiple-trait.rs
new file mode 100644
index 000000000..c990d0475
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait.rs
@@ -0,0 +1,32 @@
+#![feature(associated_type_defaults)]
+
+trait A {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+trait B {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {}
+
+impl<T: std::fmt::Debug> B for T {}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-trait.stderr b/tests/ui/methods/disambiguate-multiple-trait.stderr
new file mode 100644
index 000000000..e00498ca6
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-trait.rs:30:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait.rs:24:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:6:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:12:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait.rs:27:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:5:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:11:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
index e0f8a5447..0a022dc39 100644
--- a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
+++ b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
--> $DIR/method-ambig-one-trait-unknown-int-type.rs:24:9
|
LL | let mut x = Vec::new();
- | ^^^^^
+ | ^^^^^ ---------- type must be known at this point
|
help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
index 601e6bbb0..9a84768a9 100644
--- a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
+++ b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
@@ -16,12 +16,12 @@ LL | trait B { fn foo(&self); }
| ^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
-LL | A::foo(t);
- | ~~~~~~~~~
+LL | A::foo(&t);
+ | ~~~~~~~~~~
help: disambiguate the method for candidate #2
|
-LL | B::foo(t);
- | ~~~~~~~~~
+LL | B::foo(&t);
+ | ~~~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
index 4ba778e0e..5bb887b45 100644
--- a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
+++ b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
|
LL | fn foo() {}
| ^^^^^^^^
-help: disambiguate the associated function for candidate #1
+help: use fully-qualified syntax to disambiguate
|
LL | <AB as A>::foo();
| ~~~~~~~~~~~
-help: disambiguate the associated function for candidate #2
- |
LL | <AB as B>::foo();
| ~~~~~~~~~~~
diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
index 4e83e4b77..755179650 100644
--- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
+++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
@@ -54,8 +54,8 @@ LL | let z = NuisanceFoo::foo(x);
| ~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #3
|
-LL | let z = FinalFoo::foo(x);
- | ~~~~~~~~~~~~~~~~
+LL | let z = FinalFoo::foo(&x);
+ | ~~~~~~~~~~~~~~~~~
error[E0308]: mismatched types
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:139:24
diff --git a/tests/ui/mir/addrof_alignment.rs b/tests/ui/mir/alignment/addrof_alignment.rs
index 892638bfb..f3423e97a 100644
--- a/tests/ui/mir/addrof_alignment.rs
+++ b/tests/ui/mir/alignment/addrof_alignment.rs
@@ -1,5 +1,4 @@
// run-pass
-// ignore-wasm32-bare: No panic messages
// compile-flags: -C debug-assertions
struct Misalignment {
@@ -9,7 +8,7 @@ struct Misalignment {
fn main() {
let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
unsafe {
- let ptr: *const Misalignment = items.as_ptr().cast::<u8>().add(1).cast::<Misalignment>();
+ let ptr: *const Misalignment = items.as_ptr().byte_add(1);
let _ptr = core::ptr::addr_of!((*ptr).a);
}
}
diff --git a/tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs
index 56388c104..74ba1fde6 100644
--- a/tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs
+++ b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs
@@ -11,9 +11,9 @@
fn main() {
let mut x = [0u64; 2];
- let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>();
+ let ptr = x.as_mut_ptr();
unsafe {
- let misaligned = ptr.add(4).cast::<u64>();
+ let misaligned = ptr.byte_add(4);
assert!(misaligned.addr() % 8 != 0);
assert!(misaligned.addr() % 4 == 0);
*misaligned = 42;
diff --git a/tests/ui/mir/mir_alignment_check.rs b/tests/ui/mir/alignment/misaligned_lhs.rs
index d1bf3d46a..97644ba8e 100644
--- a/tests/ui/mir/mir_alignment_check.rs
+++ b/tests/ui/mir/alignment/misaligned_lhs.rs
@@ -6,8 +6,8 @@
fn main() {
let mut x = [0u32; 2];
- let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>();
+ let ptr = x.as_mut_ptr();
unsafe {
- *(ptr.add(1).cast::<u32>()) = 42;
+ *(ptr.byte_add(1)) = 42;
}
}
diff --git a/tests/ui/mir/alignment/misaligned_rhs.rs b/tests/ui/mir/alignment/misaligned_rhs.rs
new file mode 100644
index 000000000..8534bc71a
--- /dev/null
+++ b/tests/ui/mir/alignment/misaligned_rhs.rs
@@ -0,0 +1,13 @@
+// run-fail
+// ignore-wasm32-bare: No panic messages
+// ignore-i686-pc-windows-msvc: #112480
+// compile-flags: -C debug-assertions
+// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
+
+fn main() {
+ let mut x = [0u32; 2];
+ let ptr = x.as_mut_ptr();
+ unsafe {
+ let _v = *(ptr.byte_add(1));
+ }
+}
diff --git a/tests/ui/mir/alignment/packed.rs b/tests/ui/mir/alignment/packed.rs
new file mode 100644
index 000000000..754698591
--- /dev/null
+++ b/tests/ui/mir/alignment/packed.rs
@@ -0,0 +1,29 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+#![feature(strict_provenance, pointer_is_aligned)]
+
+#[repr(packed)]
+struct Misaligner {
+ _head: u8,
+ tail: u64,
+}
+
+fn main() {
+ let memory = [Misaligner { _head: 0, tail: 0}, Misaligner { _head: 0, tail: 0}];
+ // Test that we can use addr_of! to get the address of a packed member which according to its
+ // type is not aligned, but because it is a projection from a packed type is a valid place.
+ let ptr0 = std::ptr::addr_of!(memory[0].tail);
+ let ptr1 = std::ptr::addr_of!(memory[0].tail);
+ // Even if ptr0 happens to be aligned by chance, ptr1 is not.
+ assert!(!ptr0.is_aligned() || !ptr1.is_aligned());
+
+ // And also test that we can get the addr of a packed struct then do a member read from it.
+ unsafe {
+ let ptr = std::ptr::addr_of!(memory[0]);
+ let _tail = (*ptr).tail;
+
+ let ptr = std::ptr::addr_of!(memory[1]);
+ let _tail = (*ptr).tail;
+ }
+}
diff --git a/tests/ui/mir/alignment/place_computation.rs b/tests/ui/mir/alignment/place_computation.rs
new file mode 100644
index 000000000..fdd486425
--- /dev/null
+++ b/tests/ui/mir/alignment/place_computation.rs
@@ -0,0 +1,16 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+#[repr(align(8))]
+struct Misalignment {
+ a: u8,
+}
+
+fn main() {
+ let mem = 0u64;
+ let ptr = &mem as *const u64 as *const Misalignment;
+ unsafe {
+ let ptr = ptr.byte_add(1);
+ let _ref: &u8 = &(*ptr).a;
+ }
+}
diff --git a/tests/ui/mir/alignment/place_without_read.rs b/tests/ui/mir/alignment/place_without_read.rs
new file mode 100644
index 000000000..b4be7a50f
--- /dev/null
+++ b/tests/ui/mir/alignment/place_without_read.rs
@@ -0,0 +1,9 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+fn main() {
+ let ptr = 1 as *const u16;
+ unsafe {
+ let _ = *ptr;
+ }
+}
diff --git a/tests/ui/mir/alignment/two_pointers.rs b/tests/ui/mir/alignment/two_pointers.rs
new file mode 100644
index 000000000..29af21dff
--- /dev/null
+++ b/tests/ui/mir/alignment/two_pointers.rs
@@ -0,0 +1,15 @@
+// run-fail
+// ignore-wasm32-bare: No panic messages
+// ignore-i686-pc-windows-msvc: #112480
+// compile-flags: -C debug-assertions
+// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
+
+fn main() {
+ let x = [0u32; 2];
+ let ptr = x.as_ptr();
+ let mut dest = 0u32;
+ let dest_ptr = &mut dest as *mut u32;
+ unsafe {
+ *dest_ptr = *(ptr.byte_add(1));
+ }
+}
diff --git a/tests/ui/mir/build-async-error-body-correctly.rs b/tests/ui/mir/build-async-error-body-correctly.rs
new file mode 100644
index 000000000..1787f80c0
--- /dev/null
+++ b/tests/ui/mir/build-async-error-body-correctly.rs
@@ -0,0 +1,8 @@
+// edition: 2021
+
+async fn asyncfn() {
+ let binding = match true {};
+ //~^ ERROR non-exhaustive patterns: type `bool` is non-empty
+}
+
+fn main() {}
diff --git a/tests/ui/mir/build-async-error-body-correctly.stderr b/tests/ui/mir/build-async-error-body-correctly.stderr
new file mode 100644
index 000000000..3d18c249a
--- /dev/null
+++ b/tests/ui/mir/build-async-error-body-correctly.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: type `bool` is non-empty
+ --> $DIR/build-async-error-body-correctly.rs:4:25
+ |
+LL | let binding = 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 ~ let binding = 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/mir/issue-71793-inline-args-storage.rs b/tests/ui/mir/issue-71793-inline-args-storage.rs
index 18f2e38d1..3749d5ebf 100644
--- a/tests/ui/mir/issue-71793-inline-args-storage.rs
+++ b/tests/ui/mir/issue-71793-inline-args-storage.rs
@@ -1,5 +1,5 @@
// Verifies that inliner emits StorageLive & StorageDead when introducing
-// temporaries for arguments, so that they don't become part of the generator.
+// temporaries for arguments, so that they don't become part of the coroutine.
// Regression test for #71793.
//
// check-pass
diff --git a/tests/ui/mir/mir_match_test.rs b/tests/ui/mir/mir_match_test.rs
index 1f96d6737..d41a7f4a1 100644
--- a/tests/ui/mir/mir_match_test.rs
+++ b/tests/ui/mir/mir_match_test.rs
@@ -1,4 +1,5 @@
#![feature(exclusive_range_pattern)]
+#![allow(overlapping_range_endpoints)]
// run-pass
diff --git a/tests/ui/mir/remove-zsts-query-cycle.rs b/tests/ui/mir/remove-zsts-query-cycle.rs
index be4d68f2d..bcaf84688 100644
--- a/tests/ui/mir/remove-zsts-query-cycle.rs
+++ b/tests/ui/mir/remove-zsts-query-cycle.rs
@@ -1,5 +1,5 @@
// Regression test for #88972. Used to cause a query cycle:
-// optimized mir -> remove zsts -> layout of a generator -> optimized mir.
+// optimized mir -> remove zsts -> layout of a coroutine -> optimized mir.
//
// edition:2018
// compile-flags: --crate-type=lib -Zinline-mir=yes
diff --git a/tests/ui/mismatched_types/async-unwrap-suggestion.rs b/tests/ui/mismatched_types/async-unwrap-suggestion.rs
new file mode 100644
index 000000000..9698cc29f
--- /dev/null
+++ b/tests/ui/mismatched_types/async-unwrap-suggestion.rs
@@ -0,0 +1,22 @@
+// edition: 2021
+
+async fn dont_suggest() -> i32 {
+ if false {
+ return Ok(6);
+ //~^ ERROR mismatched types
+ }
+
+ 5
+}
+
+async fn do_suggest() -> i32 {
+ if false {
+ let s = Ok(6);
+ return s;
+ //~^ ERROR mismatched types
+ }
+
+ 5
+}
+
+fn main() {}
diff --git a/tests/ui/mismatched_types/async-unwrap-suggestion.stderr b/tests/ui/mismatched_types/async-unwrap-suggestion.stderr
new file mode 100644
index 000000000..80ca76a4b
--- /dev/null
+++ b/tests/ui/mismatched_types/async-unwrap-suggestion.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+ --> $DIR/async-unwrap-suggestion.rs:5:16
+ |
+LL | return Ok(6);
+ | ^^^^^ expected `i32`, found `Result<{integer}, _>`
+ |
+ = note: expected type `i32`
+ found enum `Result<{integer}, _>`
+
+error[E0308]: mismatched types
+ --> $DIR/async-unwrap-suggestion.rs:15:16
+ |
+LL | return s;
+ | ^ expected `i32`, found `Result<{integer}, _>`
+ |
+ = note: expected type `i32`
+ found enum `Result<{integer}, _>`
+help: consider using `Result::expect` to unwrap the `Result<{integer}, _>` value, panicking if the value is a `Result::Err`
+ |
+LL | return s.expect("REASON");
+ | +++++++++++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/issue-19109.stderr b/tests/ui/mismatched_types/issue-19109.stderr
index 5cef64bb1..ca819d93a 100644
--- a/tests/ui/mismatched_types/issue-19109.stderr
+++ b/tests/ui/mismatched_types/issue-19109.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-19109.rs:4:5
|
LL | fn function(t: &mut dyn Trait) {
- | - help: try adding a return type: `-> *mut dyn Trait`
+ | - help: try adding a return type: `-> *mut dyn Trait`
LL | t as *mut dyn Trait
| ^^^^^^^^^^^^^^^^^^^ expected `()`, found `*mut dyn Trait`
|
diff --git a/tests/ui/mismatched_types/issue-35030.stderr b/tests/ui/mismatched_types/issue-35030.stderr
index de4e067fe..881ff9097 100644
--- a/tests/ui/mismatched_types/issue-35030.stderr
+++ b/tests/ui/mismatched_types/issue-35030.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-35030.rs:9:14
|
LL | impl<bool> Parser<bool> for bool {
- | ---- this type parameter
+ | ---- expected this type parameter
LL | fn parse(text: &str) -> Option<bool> {
LL | Some(true)
| ---- ^^^^ expected type parameter `bool`, found `bool`
diff --git a/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs
new file mode 100644
index 000000000..b288a9b05
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs
@@ -0,0 +1,23 @@
+#![allow(unused, dead_code)]
+
+fn test_unwrap() -> Option<i32> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; // return type is not `Result`, we don't suggest ? here
+ //~^ ERROR mismatched types
+ Some(v)
+}
+
+fn test_unwrap_option() -> Result<i32, ()> {
+ let b = Some(1);
+ let v: i32 = b; // return type is not `Option`, we don't suggest ? here
+ //~^ ERROR mismatched types
+ Ok(v)
+}
+
+fn main() {
+ let v: i32 = Some(0); //~ ERROR mismatched types
+
+ let c = Ok(false);
+ let v: i32 = c; //~ ERROR mismatched types
+
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr
new file mode 100644
index 000000000..4f8f9b1a8
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr
@@ -0,0 +1,55 @@
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:5:18
+ |
+LL | let v: i32 = b; // return type is not `Result`, we don't suggest ? here
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: consider using `Result::expect` to unwrap the `Result<i32, ()>` value, panicking if the value is a `Result::Err`
+ |
+LL | let v: i32 = b.expect("REASON"); // return type is not `Result`, we don't suggest ? here
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:12:18
+ |
+LL | let v: i32 = b; // return type is not `Option`, we don't suggest ? here
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = b.expect("REASON"); // return type is not `Option`, we don't suggest ? here
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:18:18
+ |
+LL | let v: i32 = Some(0);
+ | --- ^^^^^^^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:21:18
+ |
+LL | let v: i32 = c;
+ | --- ^ expected `i32`, found `Result<bool, _>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<bool, _>`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed
new file mode 100644
index 000000000..f3f560fe5
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed
@@ -0,0 +1,31 @@
+// run-rustfix
+#![allow(unused, dead_code)]
+
+fn func() -> Option<i32> {
+ Some(1)
+}
+
+fn test_unwrap() -> Result<i32, ()> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b?; //~ ERROR mismatched types
+ Ok(v)
+}
+
+fn test_unwrap_option() -> Option<i32> {
+ let b = Some(1);
+ let v: i32 = b?; //~ ERROR mismatched types
+ Some(v)
+}
+
+fn main() {
+ let a = Some(1);
+ let v: i32 = a.expect("REASON"); //~ ERROR mismatched types
+
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b.expect("REASON"); //~ ERROR mismatched types
+
+ let v: i32 = func().expect("REASON"); //~ ERROR mismatched types
+
+ let a = None;
+ let v: i32 = a.expect("REASON"); //~ ERROR mismatched types
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs
new file mode 100644
index 000000000..14020e872
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs
@@ -0,0 +1,31 @@
+// run-rustfix
+#![allow(unused, dead_code)]
+
+fn func() -> Option<i32> {
+ Some(1)
+}
+
+fn test_unwrap() -> Result<i32, ()> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; //~ ERROR mismatched types
+ Ok(v)
+}
+
+fn test_unwrap_option() -> Option<i32> {
+ let b = Some(1);
+ let v: i32 = b; //~ ERROR mismatched types
+ Some(v)
+}
+
+fn main() {
+ let a = Some(1);
+ let v: i32 = a; //~ ERROR mismatched types
+
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; //~ ERROR mismatched types
+
+ let v: i32 = func(); //~ ERROR mismatched types
+
+ let a = None;
+ let v: i32 = a; //~ ERROR mismatched types
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr
new file mode 100644
index 000000000..9de23447f
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr
@@ -0,0 +1,93 @@
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:10:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: use the `?` operator to extract the `Result<i32, ()>` value, propagating a `Result::Err` value to the caller
+ |
+LL | let v: i32 = b?;
+ | +
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:16:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: use the `?` operator to extract the `Option<{integer}>` value, propagating an `Option::None` value to the caller
+ |
+LL | let v: i32 = b?;
+ | +
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:22:18
+ |
+LL | let v: i32 = a;
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = a.expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:25:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: consider using `Result::expect` to unwrap the `Result<i32, ()>` value, panicking if the value is a `Result::Err`
+ |
+LL | let v: i32 = b.expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:27:18
+ |
+LL | let v: i32 = func();
+ | --- ^^^^^^ expected `i32`, found `Option<i32>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<i32>`
+help: consider using `Option::expect` to unwrap the `Option<i32>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = func().expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:30:18
+ |
+LL | let v: i32 = a;
+ | --- ^ expected `i32`, found `Option<_>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<_>`
+help: consider using `Option::expect` to unwrap the `Option<_>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = a.expect("REASON");
+ | +++++++++++++++++
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/recovered-block.rs b/tests/ui/mismatched_types/recovered-block.rs
index b230b47d3..a91bbe708 100644
--- a/tests/ui/mismatched_types/recovered-block.rs
+++ b/tests/ui/mismatched_types/recovered-block.rs
@@ -12,10 +12,4 @@ pub fn foo() -> Foo {
}
//~^^ ERROR missing `struct` for struct definition
-pub fn bar() -> Foo {
- fn
- Foo { text: "".to_string() }
-}
-//~^^ ERROR expected one of `(` or `<`, found `{`
-
fn main() {}
diff --git a/tests/ui/mismatched_types/recovered-block.stderr b/tests/ui/mismatched_types/recovered-block.stderr
index f275321ab..88d625456 100644
--- a/tests/ui/mismatched_types/recovered-block.stderr
+++ b/tests/ui/mismatched_types/recovered-block.stderr
@@ -9,11 +9,5 @@ help: add `struct` here to parse `Foo` as a public struct
LL | pub struct Foo { text }
| ++++++
-error: expected one of `(` or `<`, found `{`
- --> $DIR/recovered-block.rs:17:9
- |
-LL | Foo { text: "".to_string() }
- | ^ expected one of `(` or `<`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
index ac0831ce6..42adff43a 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
+++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
@@ -24,9 +24,9 @@ fn main() {
let _ = produces_string().and_then(takes_str_but_too_many_refs);
//~^ ERROR type mismatch in function arguments
let _ = produces_string().and_then(takes_str_but_wrong_abi);
- //~^ ERROR expected a `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+ //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
let _ = produces_string().and_then(takes_str_but_unsafe);
- //~^ ERROR expected a `FnOnce<(String,)>` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
+ //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
let _ = produces_string().and_then(no_args);
//~^ ERROR function is expected to take 1 argument, but it takes 0 arguments
let _ = Some(TypeWithoutDeref).and_then(takes_str_but_too_many_refs);
diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
index ecfbd27b1..3175a2589 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
+++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
@@ -14,11 +14,11 @@ LL | let _ = produces_string().and_then(takes_str_but_too_many_refs);
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
-error[E0277]: expected a `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
--> $DIR/suggest-option-asderef-unfixable.rs:26:40
|
LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
- | -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+ | -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
| |
| required by a bound introduced by this call
|
@@ -26,7 +26,7 @@ LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
-error[E0277]: expected a `FnOnce<(String,)>` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
+error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
--> $DIR/suggest-option-asderef-unfixable.rs:28:40
|
LL | let _ = produces_string().and_then(takes_str_but_unsafe);
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
index 31e4206a5..5f4d19439 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo/missing.rs" or "$DIR/foo/missing/mod.rs"
+ = note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
index 9d252398b..d5f5ea870 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs" or "$DIR/foo_inline/inline/missing/mod.rs"
+ = note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/modules/special_module_name.stderr b/tests/ui/modules/special_module_name.stderr
index bc4b4f1b3..84473bf8c 100644
--- a/tests/ui/modules/special_module_name.stderr
+++ b/tests/ui/modules/special_module_name.stderr
@@ -5,6 +5,7 @@ LL | mod lib;
| ^^^^^^^^
|
= help: to create the module `lib`, create file "$DIR/lib.rs" or "$DIR/lib/mod.rs"
+ = note: if there is a `mod lib` elsewhere in the crate already, import it with `use crate::...` instead
error[E0583]: file not found for module `main`
--> $DIR/special_module_name.rs:4:1
@@ -13,6 +14,7 @@ LL | mod main;
| ^^^^^^^^^
|
= help: to create the module `main`, create file "$DIR/main.rs" or "$DIR/main/mod.rs"
+ = note: if there is a `mod main` elsewhere in the crate already, import it with `use crate::...` instead
warning: found module declaration for lib.rs
--> $DIR/special_module_name.rs:1:1
diff --git a/tests/ui/native-library-link-flags/modifiers-override.stderr b/tests/ui/native-library-link-flags/modifiers-override.stderr
index eb3ab55c3..64427651e 100644
--- a/tests/ui/native-library-link-flags/modifiers-override.stderr
+++ b/tests/ui/native-library-link-flags/modifiers-override.stderr
@@ -21,6 +21,8 @@ error: overriding linking modifiers from command line is not supported
|
LL | extern "C" {}
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/never_type/never-from-impl-is-reserved.stderr b/tests/ui/never_type/never-from-impl-is-reserved.stderr
index f9f7c787e..871c51205 100644
--- a/tests/ui/never_type/never-from-impl-is-reserved.stderr
+++ b/tests/ui/never_type/never-from-impl-is-reserved.stderr
@@ -5,7 +5,7 @@ LL | impl MyTrait for MyFoo {}
| ---------------------- first implementation here
LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`.
LL | impl<T> MyTrait for T where T: From<!> {}
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
|
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details
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 54c16230f..cb3786305 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
@@ -5,6 +5,7 @@ LL | <E as From<_>>::from(never);
| ^ the trait `From<()>` is not implemented for `E`
|
= help: the trait `From<!>` is implemented for `E`
+ = help: for that trait implementation, expected `!`, found `()`
error: aborting due to previous error
diff --git a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
index 46dba0064..aeb0a1394 100644
--- a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
+++ b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
@@ -15,6 +15,7 @@ LL | let _: for<'a> fn(<&'a () as Trait>::Ty) = |_| {};
|
= note: `&'0 ()` must implement `Trait`, for any lifetime `'0`...
= note: ...but `Trait` is actually implemented for the type `&'static ()`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
index 1aa7de1e1..a20f885fe 100644
--- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
@@ -25,10 +25,13 @@ LL | | T: Trait<'a>,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/propagate-from-trait-match.rs:43:9
|
+LL | fn supply<'a, T>(value: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(value);
| ^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Trait<'a> + 'a,
| ++++
diff --git a/tests/ui/nll/generator-distinct-lifetime.rs b/tests/ui/nll/coroutine-distinct-lifetime.rs
index 90fe6b569..0483b8858 100644
--- a/tests/ui/nll/generator-distinct-lifetime.rs
+++ b/tests/ui/nll/coroutine-distinct-lifetime.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
// Test for issue #47189. Here, both `s` and `t` are live for the
-// generator's lifetime, but within the generator they have distinct
+// coroutine's lifetime, but within the coroutine they have distinct
// lifetimes. We accept this code -- even though the borrow extends
// over a yield -- because the data that is borrowed (`*x`) is not
// stored on the stack.
diff --git a/tests/ui/nll/generator-upvar-mutability.rs b/tests/ui/nll/coroutine-upvar-mutability.rs
index c49ea15b8..12853b16b 100644
--- a/tests/ui/nll/generator-upvar-mutability.rs
+++ b/tests/ui/nll/coroutine-upvar-mutability.rs
@@ -1,6 +1,6 @@
-// Check that generators respect the muatability of their upvars.
+// Check that coroutines respect the muatability of their upvars.
-#![feature(generators)]
+#![feature(coroutines)]
fn mutate_upvar() {
let x = 0;
diff --git a/tests/ui/nll/generator-upvar-mutability.stderr b/tests/ui/nll/coroutine-upvar-mutability.stderr
index 31b061b61..464bbc769 100644
--- a/tests/ui/nll/generator-upvar-mutability.stderr
+++ b/tests/ui/nll/coroutine-upvar-mutability.stderr
@@ -1,5 +1,5 @@
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/generator-upvar-mutability.rs:8:9
+ --> $DIR/coroutine-upvar-mutability.rs:8:9
|
LL | let x = 0;
| - help: consider changing this to be mutable: `mut x`
diff --git a/tests/ui/nll/extra-unused-mut.rs b/tests/ui/nll/extra-unused-mut.rs
index 340f2952a..b04e39542 100644
--- a/tests/ui/nll/extra-unused-mut.rs
+++ b/tests/ui/nll/extra-unused-mut.rs
@@ -2,7 +2,7 @@
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![deny(unused_mut)]
fn ref_argument(ref _y: i32) {}
@@ -16,7 +16,7 @@ fn mutable_upvar() {
}
// #50897
-fn generator_mutable_upvar() {
+fn coroutine_mutable_upvar() {
let mut x = 0;
move || {
x = 1;
diff --git a/tests/ui/nll/issue-48623-generator.rs b/tests/ui/nll/issue-48623-coroutine.rs
index 08d2584ee..bd11aaf14 100644
--- a/tests/ui/nll/issue-48623-generator.rs
+++ b/tests/ui/nll/issue-48623-coroutine.rs
@@ -2,7 +2,7 @@
#![allow(path_statements)]
#![allow(dead_code)]
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct WithDrop;
@@ -10,9 +10,9 @@ impl Drop for WithDrop {
fn drop(&mut self) {}
}
-fn reborrow_from_generator(r: &mut ()) {
+fn reborrow_from_coroutine(r: &mut ()) {
let d = WithDrop;
- move || { d; yield; &mut *r }; //~ WARN unused generator that must be used
+ move || { d; yield; &mut *r }; //~ WARN unused coroutine that must be used
}
fn main() {}
diff --git a/tests/ui/nll/issue-48623-generator.stderr b/tests/ui/nll/issue-48623-coroutine.stderr
index bfdfca210..1b7b1735a 100644
--- a/tests/ui/nll/issue-48623-generator.stderr
+++ b/tests/ui/nll/issue-48623-coroutine.stderr
@@ -1,10 +1,10 @@
-warning: unused generator that must be used
- --> $DIR/issue-48623-generator.rs:15:5
+warning: unused coroutine that must be used
+ --> $DIR/issue-48623-coroutine.rs:15:5
|
LL | move || { d; yield; &mut *r };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/nll/issue-55850.rs b/tests/ui/nll/issue-55850.rs
index e6279bd02..fc873af94 100644
--- a/tests/ui/nll/issue-55850.rs
+++ b/tests/ui/nll/issue-55850.rs
@@ -1,16 +1,16 @@
#![allow(unused_mut)]
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::Generator;
-use std::ops::GeneratorState::Yielded;
+use std::ops::Coroutine;
+use std::ops::CoroutineState::Yielded;
use std::pin::Pin;
pub struct GenIter<G>(G);
impl <G> Iterator for GenIter<G>
where
- G: Generator + Unpin,
+ G: Coroutine + Unpin,
{
type Item = G::Yield;
@@ -26,7 +26,7 @@ fn bug<'a>() -> impl Iterator<Item = &'a str> {
GenIter(move || {
let mut s = String::new();
yield &s[..] //~ ERROR cannot yield value referencing local variable `s` [E0515]
- //~| ERROR borrow may still be in use when generator yields
+ //~| ERROR borrow may still be in use when coroutine yields
})
}
diff --git a/tests/ui/nll/issue-55850.stderr b/tests/ui/nll/issue-55850.stderr
index 86a8cdc42..3d43817f4 100644
--- a/tests/ui/nll/issue-55850.stderr
+++ b/tests/ui/nll/issue-55850.stderr
@@ -7,7 +7,7 @@ LL | yield &s[..]
| | `s` is borrowed here
| yields a value referencing data owned by the current function
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/issue-55850.rs:28:16
|
LL | yield &s[..]
diff --git a/tests/ui/nll/issue-97997.stderr b/tests/ui/nll/issue-97997.stderr
index 46440c021..89eaf77ad 100644
--- a/tests/ui/nll/issue-97997.stderr
+++ b/tests/ui/nll/issue-97997.stderr
@@ -15,6 +15,7 @@ LL | <fn(&u8) as Foo>::ASSOC;
|
= note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)`
= note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
index d8b26f0b0..4e741abc2 100644
--- a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
+++ b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
@@ -37,10 +37,12 @@ LL | || { None::<&'a &'b ()>; };
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-98589-closures-relate-named-regions.rs:26:10
|
+LL | fn test_early_type<'a: 'a, T>() {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | || { None::<&'a T>; };
| ^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test_early_type<'a: 'a, T: 'a>() {
| ++++
@@ -48,10 +50,12 @@ LL | fn test_early_type<'a: 'a, T: 'a>() {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-98589-closures-relate-named-regions.rs:32:10
|
+LL | fn test_late_type<'a, T>() {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | || { None::<&'a T>; };
| ^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test_late_type<'a, T: 'a>() {
| ++++
diff --git a/tests/ui/nll/issue-98693.stderr b/tests/ui/nll/issue-98693.stderr
index 15ca38aa2..a3d87d74a 100644
--- a/tests/ui/nll/issue-98693.stderr
+++ b/tests/ui/nll/issue-98693.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-98693.rs:16:9
|
LL | assert_static::<T>();
- | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<T: 'static>() {
| +++++++++
diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
index e0d476a33..cab75e630 100644
--- a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
+++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/min-choice-reject-ambiguous.rs:17:5
|
+LL | fn test_b<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | type_test::<'_, T>() // This should pass if we pick 'b.
| ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: 'b + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/min-choice-reject-ambiguous.rs:28:5
|
+LL | fn test_c<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | type_test::<'_, T>() // This should pass if we pick 'c.
| ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'c + 'a,
| ++++
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
index c3dd4257a..988eee610 100644
--- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
@@ -38,6 +38,7 @@ LL | accept(callback);
|
= 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`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0308]: mismatched types
--> $DIR/missing-universe-cause-issue-114907.rs:33:5
@@ -73,6 +74,8 @@ error: higher-ranked subtype error
|
LL | accept(callback);
| ^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/nll/move-errors.stderr b/tests/ui/nll/move-errors.stderr
index 58b8aa31d..0d994ef29 100644
--- a/tests/ui/nll/move-errors.stderr
+++ b/tests/ui/nll/move-errors.stderr
@@ -186,7 +186,7 @@ help: consider borrowing the pattern binding
LL | F(s, ref mut t) => (),
| +++
-error[E0507]: cannot move out of `x` as enum variant `Err` which is behind a shared reference
+error[E0507]: cannot move out of `x` as enum variant `Ok` which is behind a shared reference
--> $DIR/move-errors.rs:110:11
|
LL | match *x {
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr
new file mode 100644
index 000000000..6f9b33031
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr
@@ -0,0 +1,36 @@
+error[E0046]: not all trait items implemented, missing: `call`
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1
+ |
+LL | fn call(x: Self) -> Self::Output;
+ | --------------------------------- `call` from trait
+...
+LL | impl<T: PlusOne> Callable for T {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+
+error: unconstrained opaque type
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19
+ |
+LL | type Output = impl PlusOne;
+ | ^^^^^^^^^^^^
+ |
+ = note: `Output` must be used in combination with a concrete type within the same impl
+
+error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ | -- ------------ opaque type defined here
+ | |
+ | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here
+LL | <&mut i32 as Callable>::call(y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a {
+ | ++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0046, E0700.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr
new file mode 100644
index 000000000..6f9b33031
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr
@@ -0,0 +1,36 @@
+error[E0046]: not all trait items implemented, missing: `call`
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1
+ |
+LL | fn call(x: Self) -> Self::Output;
+ | --------------------------------- `call` from trait
+...
+LL | impl<T: PlusOne> Callable for T {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+
+error: unconstrained opaque type
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19
+ |
+LL | type Output = impl PlusOne;
+ | ^^^^^^^^^^^^
+ |
+ = note: `Output` must be used in combination with a concrete type within the same impl
+
+error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ | -- ------------ opaque type defined here
+ | |
+ | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here
+LL | <&mut i32 as Callable>::call(y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a {
+ | ++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0046, E0700.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs
new file mode 100644
index 000000000..ec17e0b09
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs
@@ -0,0 +1,33 @@
+// This is a non-regression test for issue #116657, where NLL and `-Zpolonius=next` computed
+// different loan scopes when a member constraint was not ultimately applied.
+
+// revisions: nll polonius
+// [polonius] compile-flags: -Zpolonius=next
+
+#![feature(impl_trait_in_assoc_type)]
+
+trait Callable {
+ type Output;
+ fn call(x: Self) -> Self::Output;
+}
+
+trait PlusOne {}
+
+impl<'a> PlusOne for &'a mut i32 {}
+
+impl<T: PlusOne> Callable for T {
+ //[nll]~^ ERROR not all trait items implemented
+ //[polonius]~^^ ERROR not all trait items implemented
+
+ type Output = impl PlusOne;
+ //[nll]~^ ERROR unconstrained opaque type
+ //[polonius]~^^ ERROR unconstrained opaque type
+}
+
+fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ <&mut i32 as Callable>::call(y)
+ //[nll]~^ ERROR hidden type for `impl PlusOne` captures lifetime
+ //[polonius]~^^ ERROR hidden type for `impl PlusOne` captures lifetime
+}
+
+fn main() {}
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr
new file mode 100644
index 000000000..5227ca8ec
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr
@@ -0,0 +1,40 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18
+ |
+LL | let b = |_| &a;
+ | --- -^
+ | | ||
+ | | |borrowed value does not live long enough
+ | | returning this value requires that `a` is borrowed for `'static`
+ | value captured here
+...
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22
+ |
+LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
+ | ^^^
+
+error: implementation of `Fn` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `Fn` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ 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: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr
new file mode 100644
index 000000000..5227ca8ec
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr
@@ -0,0 +1,40 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18
+ |
+LL | let b = |_| &a;
+ | --- -^
+ | | ||
+ | | |borrowed value does not live long enough
+ | | returning this value requires that `a` is borrowed for `'static`
+ | value captured here
+...
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22
+ |
+LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
+ | ^^^
+
+error: implementation of `Fn` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `Fn` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ 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: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs
new file mode 100644
index 000000000..c165e7a1d
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs
@@ -0,0 +1,20 @@
+// This is a non-regression test for issue #117146, where NLL and `-Zpolonius=next` computed
+// different loan scopes when a region flowed into an SCC whose representative was an existential
+// region.
+
+// revisions: nll polonius
+// [polonius] compile-flags: -Zpolonius=next
+
+fn main() {
+ let a = ();
+ let b = |_| &a;
+ //[nll]~^ ERROR `a` does not live long enough
+ //[polonius]~^^ ERROR `a` does not live long enough
+ bad(&b);
+ //[nll]~^ ERROR implementation of `Fn`
+ //[nll]~| ERROR implementation of `FnOnce`
+ //[polonius]~^^^ ERROR implementation of `Fn`
+ //[polonius]~| ERROR implementation of `FnOnce`
+}
+
+fn bad<F: Fn(&()) -> &()>(_: F) {}
diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
index b945ffedd..804071a3e 100644
--- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
+++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
@@ -15,6 +15,7 @@ LL | let _x = <fn(&())>::make_f();
|
= note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())`
= note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `Y` is not general enough
--> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14
@@ -24,6 +25,7 @@ LL | let _x = <fn(&())>::make_f();
|
= note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())`
= note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
index 64b08a9b3..ff9d75057 100644
--- a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
+++ b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:11:5
|
+LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:26:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
index d949e29b2..6de023ffd 100644
--- a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
+++ b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/projection-implied-bounds.rs:30:36
|
LL | twice(value, |value_ref, item| invoke2(value_ref, item));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic2<T: Iterator + 'static>(value: T) {
| +++++++++
diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
index 433024c30..4f93fb4ea 100644
--- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
@@ -25,11 +25,16 @@ LL | | T: Iterator,
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:25:31
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | T: Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:34:23
@@ -82,11 +87,16 @@ LL | | T: 'b + Iterator,
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:42:31
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:52:23
diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
index e0ff544fe..da76ac1c4 100644
--- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
+++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
@@ -1,20 +1,30 @@
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:13:5
|
+LL | fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(x.next())
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | T: Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:28:5
|
+LL | fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(x.next())
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
index ebdce7bc1..dda603981 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -27,10 +27,13 @@ LL | | T: Anything<'b>,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:45:39
|
+LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Anything<'b> + 'a,
| ++++
@@ -77,10 +80,13 @@ LL | | 'a: 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:56:39
|
+LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Anything<'b> + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index dbad8e478..c157e89ff 100644
--- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -26,11 +26,13 @@ LL | | T: Anything<'b, 'c>,
error[E0309]: the associated type `<T as Anything<'?5, '?6>>::AssocType` may not live long enough
--> $DIR/projection-two-region-trait-bound-closure.rs:38:39
|
+LL | fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
+ | -- the associated type `<T as Anything<'?5, '?6>>::AssocType` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?5, '?6>>::AssocType` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as Anything<'?5, '?6>>::AssocType: 'a`...
- = note: ...so that the type `<T as Anything<'?5, '?6>>::AssocType` will meet its required lifetime bounds
note: external requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29
@@ -60,11 +62,13 @@ LL | | 'a: 'a,
error[E0309]: the associated type `<T as Anything<'?6, '?7>>::AssocType` may not live long enough
--> $DIR/projection-two-region-trait-bound-closure.rs:48:39
|
+LL | fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
+ | -- the associated type `<T as Anything<'?6, '?7>>::AssocType` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?6, '?7>>::AssocType` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as Anything<'?6, '?7>>::AssocType: 'a`...
- = note: ...so that the type `<T as Anything<'?6, '?7>>::AssocType` will meet its required lifetime bounds
note: external requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:61:29
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
index b4435fe06..1fa74f67c 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
@@ -1,11 +1,13 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
|
+LL | fn foo1<'a, 'b, T>() -> &'a ()
+ | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<T::Output>()
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
- = note: ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
error: aborting due to previous error
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
index ddeaf3c1f..c8dbe4ebc 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
@@ -1,11 +1,13 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5
|
+LL | fn foo1<'a, 'b, T>() -> &'a ()
+ | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<<T as MyTrait<'a>>::Output>()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
- = note: ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
error: aborting due to previous error
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
index 0df44644d..f78708dc4 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-where-clause-none.rs:14:5
|
+LL | fn foo<'a, T>() -> &'a ()
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<T::Output>()
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: MyTrait<'a> + 'a,
| ++++
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 f58d49d84..59e29e9a4 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
@@ -46,10 +46,12 @@ LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-approximate-lower-bound.rs:29:31
|
+LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic_fail<'a, T: 'a>(cell: Cell<&'a ()>, value: T) {
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
index ddad1d205..3468c5ad3 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
@@ -25,10 +25,13 @@ LL | | T: Debug,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-return-type.rs:26:27
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |y| y)
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -36,10 +39,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-return-type.rs:41:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
index bb455e9ae..cef4a0f1e 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
@@ -24,10 +24,13 @@ LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:32:9
|
+LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(&x, &y)
| ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn no_region<'a, T: 'a>(a: Cell<&'a ()>, b: T) {
| ++++
@@ -84,10 +87,13 @@ LL | | T: 'b,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:65:9
|
+LL | fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(&x, &y)
| ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr b/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
index 5fb69255d..73f01ff15 100644
--- a/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn-body.rs:17:5
|
+LL | fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | outlives(cell, t)
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn region_static<'a, T: 'a>(cell: Cell<&'a usize>, t: T) {
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-fn.stderr b/tests/ui/nll/ty-outlives/ty-param-fn.stderr
index 825b26d2f..56bd41051 100644
--- a/tests/ui/nll/ty-outlives/ty-param-fn.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-fn.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn.rs:9:5
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn.rs:24:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/type-check-pointer-comparisons.stderr b/tests/ui/nll/type-check-pointer-comparisons.stderr
index 0d8480a42..37098b585 100644
--- a/tests/ui/nll/type-check-pointer-comparisons.stderr
+++ b/tests/ui/nll/type-check-pointer-comparisons.stderr
@@ -61,6 +61,8 @@ LL | x == y;
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: `'a` and `'b` must be the same: replace one with the other
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/type-check-pointer-comparisons.rs:16:5
@@ -93,6 +95,8 @@ LL | f == g;
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: `'a` and `'b` must be the same: replace one with the other
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/nll/user-annotations/normalization-2.stderr b/tests/ui/nll/user-annotations/normalization-2.stderr
index 6b0dcb414..dcf049a7a 100644
--- a/tests/ui/nll/user-annotations/normalization-2.stderr
+++ b/tests/ui/nll/user-annotations/normalization-2.stderr
@@ -131,6 +131,7 @@ help: the following changes may resolve your lifetime errors
|
= help: replace `'a` with `'static`
= help: replace `'b` with `'static`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/normalization-2.rs:89:5
@@ -185,6 +186,7 @@ help: the following changes may resolve your lifetime errors
|
= help: replace `'a` with `'static`
= help: replace `'b` with `'static`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/normalization-2.rs:117:5
diff --git a/tests/ui/nll/user-annotations/normalization-infer.stderr b/tests/ui/nll/user-annotations/normalization-infer.stderr
index 12854ab68..41d563a55 100644
--- a/tests/ui/nll/user-annotations/normalization-infer.stderr
+++ b/tests/ui/nll/user-annotations/normalization-infer.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/normalization-infer.rs:11:12
|
LL | let _: <(_,) as Tr>::Ty = a;
- | ^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A: 'static, B, C, D>(a: A, b: B, c: C) {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `B` may not live long enough
--> $DIR/normalization-infer.rs:12:5
|
LL | Some::<<(_,) as Tr>::Ty>(b);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `B` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `B` must be valid for the static lifetime...
+ | ...so that the type `B` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B: 'static, C, D>(a: A, b: B, c: C) {
| +++++++++
@@ -24,9 +30,12 @@ error[E0310]: the parameter type `C` may not live long enough
--> $DIR/normalization-infer.rs:13:11
|
LL | || -> <(_,) as Tr>::Ty { c };
- | ^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `C` must be valid for the static lifetime...
+ | ...so that the type `C` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B, C: 'static, D>(a: A, b: B, c: C) {
| +++++++++
@@ -35,9 +44,12 @@ error[E0310]: the parameter type `D` may not live long enough
--> $DIR/normalization-infer.rs:14:6
|
LL | |d: <(_,) as Tr>::Ty| -> D { d };
- | ^ ...so that the type `D` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `D` must be valid for the static lifetime...
+ | ...so that the type `D` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B, C, D: 'static>(a: A, b: B, c: C) {
| +++++++++
@@ -46,9 +58,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/normalization-infer.rs:28:12
|
LL | let _: Alias<_, _> = (a, 0u8);
- | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A: 'static, B, C>(a: A, b: B, c: C) {
| +++++++++
@@ -57,9 +72,12 @@ error[E0310]: the parameter type `B` may not live long enough
--> $DIR/normalization-infer.rs:29:5
|
LL | Some::<Alias<_, _>>((b, 0u8));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `B` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `B` must be valid for the static lifetime...
+ | ...so that the type `B` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A, B: 'static, C>(a: A, b: B, c: C) {
| +++++++++
@@ -68,9 +86,12 @@ error[E0310]: the parameter type `C` may not live long enough
--> $DIR/normalization-infer.rs:30:11
|
LL | || -> Alias<_, _> { (c, 0u8) };
- | ^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `C` must be valid for the static lifetime...
+ | ...so that the type `C` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A, B, C: 'static>(a: A, b: B, c: C) {
| +++++++++
diff --git a/tests/ui/noexporttypeexe.stderr b/tests/ui/noexporttypeexe.stderr
index 26bafd31d..bf88ceaa5 100644
--- a/tests/ui/noexporttypeexe.stderr
+++ b/tests/ui/noexporttypeexe.stderr
@@ -8,6 +8,10 @@ LL | let x: isize = noexporttypelib::foo();
|
= note: expected type `isize`
found enum `Option<isize>`
+help: consider using `Option::expect` to unwrap the `Option<isize>` value, panicking if the value is an `Option::None`
+ |
+LL | let x: isize = noexporttypelib::foo().expect("REASON");
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr b/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr
new file mode 100644
index 000000000..475b41388
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr
@@ -0,0 +1,6 @@
+warning: unstable feature specified for `-Ctarget-feature`: `nontrapping-fptoint`
+ |
+ = note: this feature is not stably supported; its behavior can change in the future
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/object-safety/assoc_type_bounds.rs b/tests/ui/object-safety/assoc_type_bounds.rs
index 9abf7939c..8634ba626 100644
--- a/tests/ui/object-safety/assoc_type_bounds.rs
+++ b/tests/ui/object-safety/assoc_type_bounds.rs
@@ -7,7 +7,7 @@ trait Foo<T> {
trait Cake {}
impl Cake for () {}
-fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
-fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
+fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
+fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds.stderr b/tests/ui/object-safety/assoc_type_bounds.stderr
index a1396dc3a..3d5482625 100644
--- a/tests/ui/object-safety/assoc_type_bounds.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds.rs:10:16
|
LL | type Bar
@@ -7,7 +7,7 @@ LL | type Bar
LL | fn foo(_: &dyn Foo<()>) {}
| ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>`
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds.rs:11:16
|
LL | type Bar
diff --git a/tests/ui/object-safety/assoc_type_bounds2.rs b/tests/ui/object-safety/assoc_type_bounds2.rs
index 0112123fd..f7dc2fb88 100644
--- a/tests/ui/object-safety/assoc_type_bounds2.rs
+++ b/tests/ui/object-safety/assoc_type_bounds2.rs
@@ -7,7 +7,7 @@ trait Foo<T> {
trait Cake {}
impl Cake for () {}
-fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
-fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
+fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
+fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds2.stderr b/tests/ui/object-safety/assoc_type_bounds2.stderr
index 7a3c0e02d..815747436 100644
--- a/tests/ui/object-safety/assoc_type_bounds2.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds2.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds2.rs:10:16
|
LL | type Bar
@@ -7,7 +7,7 @@ LL | type Bar
LL | fn foo(_: &dyn Foo<()>) {}
| ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>`
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds2.rs:11:16
|
LL | type Bar
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed
new file mode 100644
index 000000000..45c7e07a2
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+trait TraitWithAType {
+ type Item: ?Sized;
+}
+trait Trait {}
+struct A {}
+impl TraitWithAType for A {
+ type Item = dyn Trait; //~ ERROR E0277
+}
+fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs
new file mode 100644
index 000000000..c3e958f49
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+trait TraitWithAType {
+ type Item;
+}
+trait Trait {}
+struct A {}
+impl TraitWithAType for A {
+ type Item = dyn Trait; //~ ERROR E0277
+}
+fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr
new file mode 100644
index 000000000..110e71507
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
+ --> $DIR/assoc_type_bounds_implicit_sized.rs:8:17
+ |
+LL | type Item = dyn Trait;
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Trait + 'static)`
+note: required by a bound in `TraitWithAType::Item`
+ --> $DIR/assoc_type_bounds_implicit_sized.rs:3:5
+ |
+LL | type Item;
+ | ^^^^^^^^^^ required by this bound in `TraitWithAType::Item`
+help: consider relaxing the implicit `Sized` restriction
+ |
+LL | type Item: ?Sized;
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.rs b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
index 647b72a75..5b07bc92f 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
@@ -10,7 +10,7 @@ trait Foo {
}
fn foo(_: &dyn Foo) {}
-//~^ ERROR the value of the associated type `Bop` (from trait `Foo`) must be specified
+//~^ ERROR the value of the associated type `Bop` in `Foo` must be specified
trait Bar {
type Bop;
@@ -20,6 +20,6 @@ trait Bar {
}
fn bar(_: &dyn Bar) {}
-//~^ ERROR the value of the associated type `Bop` (from trait `Bar`) must be specified
+//~^ ERROR the value of the associated type `Bop` in `Bar` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
index e4c44334b..5438faaaf 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bop` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bop` in `Foo` must be specified
--> $DIR/assoc_type_bounds_sized_others.rs:12:16
|
LL | type Bop;
@@ -7,7 +7,7 @@ LL | type Bop;
LL | fn foo(_: &dyn Foo) {}
| ^^^ help: specify the associated type: `Foo<Bop = Type>`
-error[E0191]: the value of the associated type `Bop` (from trait `Bar`) must be specified
+error[E0191]: the value of the associated type `Bop` in `Bar` must be specified
--> $DIR/assoc_type_bounds_sized_others.rs:22:16
|
LL | type Bop;
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
index d0a4179fe..659679e44 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
@@ -14,6 +14,7 @@ LL | fn foo(_: &dyn Foo<Bar = ()>) {}
| ^^^^^^^^ help: remove this bound
|
= note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unnecessary associated type bound for not object safe associated type
--> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20
@@ -22,6 +23,7 @@ LL | fn foo(_: &dyn Foo<Bar = ()>) {}
| ^^^^^^^^ help: remove this bound
|
= note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
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 224d33fb2..b67a1244e 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
@@ -33,6 +33,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn bop<T: Bop + ?Sized>() {
LL + fn bop<T: Bop>() {
|
+help: consider relaxing the implicit `Sized` restriction
+ |
+LL | type Bar: Default + ?Sized
+ | ++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/object-safety/issue-19538.stderr b/tests/ui/object-safety/issue-19538.stderr
index 183245b23..31657501e 100644
--- a/tests/ui/object-safety/issue-19538.stderr
+++ b/tests/ui/object-safety/issue-19538.stderr
@@ -13,6 +13,7 @@ LL | fn foo<T>(&self, val: T);
LL | trait Bar: Foo { }
| --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
+ = help: only type `Thing` implements the trait, consider using it directly instead
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-19538.rs:17:30
@@ -29,6 +30,7 @@ LL | fn foo<T>(&self, val: T);
LL | trait Bar: Foo { }
| --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
+ = help: only type `Thing` implements the trait, consider using it directly instead
= note: required for the cast from `&mut Thing` to `&mut dyn Bar`
error: aborting due to 2 previous errors
diff --git a/tests/ui/object-safety/object-safety-issue-22040.stderr b/tests/ui/object-safety/object-safety-issue-22040.stderr
index 0262d5362..2e59d88bd 100644
--- a/tests/ui/object-safety/object-safety-issue-22040.stderr
+++ b/tests/ui/object-safety/object-safety-issue-22040.stderr
@@ -11,6 +11,7 @@ LL | trait Expr: Debug + PartialEq {
| ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `SExpr<'x>` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/object-safety/object-safety-no-static.curr.stderr b/tests/ui/object-safety/object-safety-no-static.curr.stderr
index 1b025229e..b40470b45 100644
--- a/tests/ui/object-safety/object-safety-no-static.curr.stderr
+++ b/tests/ui/object-safety/object-safety-no-static.curr.stderr
@@ -11,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo() {}
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `Bar` implements the trait, consider using it directly instead
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) {}
diff --git a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
index befcef952..1eae9a9b9 100644
--- a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
@@ -11,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo() {}
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `Bar` implements the trait, consider using it directly instead
= note: required for the cast from `Box<Bar>` to `Box<dyn Foo>`
help: consider turning `foo` into a method by giving it a `&self` argument
|
diff --git a/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr b/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
index 40429fe75..2d2bb27b8 100644
--- a/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
+++ b/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
@@ -1,17 +1,11 @@
error[E0311]: the parameter type `Self` may not live long enough
|
-note: the parameter type `Self` must be valid for the lifetime `'a` as defined here...
- --> $DIR/object-safety-supertrait-mentions-GAT.rs:9:26
- |
-LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
- | ^^
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the type `Self` will meet its required lifetime bounds...
note: ...that is required by this bound
--> $DIR/object-safety-supertrait-mentions-GAT.rs:6:15
|
LL | Self: 'a;
| ^^
+ = help: consider adding an explicit lifetime bound `Self: 'a`...
error: associated item referring to unboxed trait object for its own trait
--> $DIR/object-safety-supertrait-mentions-GAT.rs:10:20
diff --git a/tests/ui/offset-of/offset-of-enum.rs b/tests/ui/offset-of/offset-of-enum.rs
index d73505821..a2d6aace4 100644
--- a/tests/ui/offset-of/offset-of-enum.rs
+++ b/tests/ui/offset-of/offset-of-enum.rs
@@ -1,4 +1,4 @@
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::mem::offset_of;
@@ -9,5 +9,10 @@ enum Alpha {
fn main() {
offset_of!(Alpha::One, 0); //~ ERROR expected type, found variant `Alpha::One`
- offset_of!(Alpha, Two.0); //~ ERROR no field `Two` on type `Alpha`
+ offset_of!(Alpha, One); //~ ERROR `One` is an enum variant; expected field at end of `offset_of`
+ offset_of!(Alpha, Two.0);
+ offset_of!(Alpha, Two.1); //~ ERROR no field named `1` on enum variant `Alpha::Two`
+ offset_of!(Alpha, Two.foo); //~ ERROR no field named `foo` on enum variant `Alpha::Two`
+ offset_of!(Alpha, NonExistent); //~ ERROR no variant named `NonExistent` found for enum `Alpha`
+ offset_of!(Beta, One); //~ ERROR cannot find type `Beta` in this scope
}
diff --git a/tests/ui/offset-of/offset-of-enum.stderr b/tests/ui/offset-of/offset-of-enum.stderr
index 6958d199f..7e7ad41f5 100644
--- a/tests/ui/offset-of/offset-of-enum.stderr
+++ b/tests/ui/offset-of/offset-of-enum.stderr
@@ -7,13 +7,41 @@ LL | offset_of!(Alpha::One, 0);
| not a type
| help: try using the variant's enum: `Alpha`
-error[E0609]: no field `Two` on type `Alpha`
+error[E0412]: cannot find type `Beta` in this scope
+ --> $DIR/offset-of-enum.rs:17:16
+ |
+LL | offset_of!(Beta, One);
+ | ^^^^ not found in this scope
+
+error[E0795]: `One` is an enum variant; expected field at end of `offset_of`
--> $DIR/offset-of-enum.rs:12:23
|
-LL | offset_of!(Alpha, Two.0);
- | ^^^
+LL | offset_of!(Alpha, One);
+ | ^^^ enum variant
+
+error[E0609]: no field named `1` on enum variant `Alpha::Two`
+ --> $DIR/offset-of-enum.rs:14:23
+ |
+LL | offset_of!(Alpha, Two.1);
+ | ^^^ - ...does not have this field
+ | |
+ | this enum variant...
+
+error[E0609]: no field named `foo` on enum variant `Alpha::Two`
+ --> $DIR/offset-of-enum.rs:15:23
+ |
+LL | offset_of!(Alpha, Two.foo);
+ | ^^^ --- ...does not have this field
+ | |
+ | this enum variant...
+
+error[E0599]: no variant named `NonExistent` found for enum `Alpha`
+ --> $DIR/offset-of-enum.rs:16:23
+ |
+LL | offset_of!(Alpha, NonExistent);
+ | ^^^^^^^^^^^ variant not found
-error: aborting due to 2 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0573, E0609.
-For more information about an error, try `rustc --explain E0573`.
+Some errors have detailed explanations: E0412, E0573, E0599, E0609, E0795.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/tests/ui/offset-of/offset-of-output-type.stderr b/tests/ui/offset-of/offset-of-output-type.stderr
index 6133f3263..233d49876 100644
--- a/tests/ui/offset-of/offset-of-output-type.stderr
+++ b/tests/ui/offset-of/offset-of-output-type.stderr
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
--> $DIR/offset-of-output-type.rs:19:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
...
LL | offset_of!(S, v)
| ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
diff --git a/tests/ui/offset-of/offset-of-private.rs b/tests/ui/offset-of/offset-of-private.rs
index 6b1a16ba6..b7affdb79 100644
--- a/tests/ui/offset-of/offset-of-private.rs
+++ b/tests/ui/offset-of/offset-of-private.rs
@@ -1,4 +1,4 @@
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::mem::offset_of;
@@ -8,13 +8,20 @@ mod m {
pub public: u8,
private: u8,
}
+
#[repr(C)]
pub struct FooTuple(pub u8, u8);
+
#[repr(C)]
struct Bar {
pub public: u8,
private: u8,
}
+
+ pub enum Baz {
+ Var1(Foo),
+ Var2(u64),
+ }
}
fn main() {
@@ -25,4 +32,8 @@ fn main() {
offset_of!(m::Bar, public); //~ ERROR struct `Bar` is private
offset_of!(m::Bar, private); //~ ERROR struct `Bar` is private
//~| ERROR field `private` of struct `Bar` is private
+
+ offset_of!(m::Baz, Var1.0.public);
+ offset_of!(m::Baz, Var1.0.private); //~ ERROR field `private` of struct `Foo` is private
+ offset_of!(m::Baz, Var2.0);
}
diff --git a/tests/ui/offset-of/offset-of-private.stderr b/tests/ui/offset-of/offset-of-private.stderr
index 0674b58f8..930e30e63 100644
--- a/tests/ui/offset-of/offset-of-private.stderr
+++ b/tests/ui/offset-of/offset-of-private.stderr
@@ -1,46 +1,52 @@
error[E0603]: struct `Bar` is private
- --> $DIR/offset-of-private.rs:25:19
+ --> $DIR/offset-of-private.rs:32:19
|
LL | offset_of!(m::Bar, public);
| ^^^ private struct
|
note: the struct `Bar` is defined here
- --> $DIR/offset-of-private.rs:14:5
+ --> $DIR/offset-of-private.rs:16:5
|
LL | struct Bar {
| ^^^^^^^^^^
error[E0603]: struct `Bar` is private
- --> $DIR/offset-of-private.rs:26:19
+ --> $DIR/offset-of-private.rs:33:19
|
LL | offset_of!(m::Bar, private);
| ^^^ private struct
|
note: the struct `Bar` is defined here
- --> $DIR/offset-of-private.rs:14:5
+ --> $DIR/offset-of-private.rs:16:5
|
LL | struct Bar {
| ^^^^^^^^^^
error[E0616]: field `private` of struct `Foo` is private
- --> $DIR/offset-of-private.rs:22:24
+ --> $DIR/offset-of-private.rs:29:24
|
LL | offset_of!(m::Foo, private);
| ^^^^^^^ private field
error[E0616]: field `1` of struct `FooTuple` is private
- --> $DIR/offset-of-private.rs:24:29
+ --> $DIR/offset-of-private.rs:31:29
|
LL | offset_of!(m::FooTuple, 1);
| ^ private field
error[E0616]: field `private` of struct `Bar` is private
- --> $DIR/offset-of-private.rs:26:24
+ --> $DIR/offset-of-private.rs:33:24
|
LL | offset_of!(m::Bar, private);
| ^^^^^^^ private field
-error: aborting due to 5 previous errors
+error[E0616]: field `private` of struct `Foo` is private
+ --> $DIR/offset-of-private.rs:37:31
+ |
+LL | offset_of!(m::Baz, Var1.0.private);
+ | ^^^^^^^ private field
+
+error: aborting due to 6 previous errors
Some errors have detailed explanations: E0603, E0616.
For more information about an error, try `rustc --explain E0603`.
diff --git a/tests/ui/on-unimplemented/impl-substs.stderr b/tests/ui/on-unimplemented/impl-substs.stderr
index a0fad0acd..36d80f3e6 100644
--- a/tests/ui/on-unimplemented/impl-substs.stderr
+++ b/tests/ui/on-unimplemented/impl-substs.stderr
@@ -7,7 +7,8 @@ LL | Foo::<usize>::foo((1i32, 1i32, 1i32));
| required by a bound introduced by this call
|
= help: the trait `Foo<usize>` is not implemented for `(i32, i32, i32)`
- = help: the trait `Foo<A>` is implemented for `(A, B, C)`
+ = help: the trait `Foo<i32>` is implemented for `(i32, i32, i32)`
+ = help: for that trait implementation, expected `i32`, found `usize`
error: aborting due to previous error
diff --git a/tests/ui/on-unimplemented/on-impl.stderr b/tests/ui/on-unimplemented/on-impl.stderr
index 2253c5992..3a0b8353f 100644
--- a/tests/ui/on-unimplemented/on-impl.stderr
+++ b/tests/ui/on-unimplemented/on-impl.stderr
@@ -8,6 +8,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
@@ -17,6 +18,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
@@ -26,6 +28,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error: aborting due to 3 previous errors
diff --git a/tests/ui/on-unimplemented/slice-index.stderr b/tests/ui/on-unimplemented/slice-index.stderr
index b9bca211f..5e0117be5 100644
--- a/tests/ui/on-unimplemented/slice-index.stderr
+++ b/tests/ui/on-unimplemented/slice-index.stderr
@@ -5,7 +5,8 @@ LL | x[1i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[i32]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `[i32]` to implement `Index<i32>`
error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>`
diff --git a/tests/ui/or-patterns/exhaustiveness-pass.rs b/tests/ui/or-patterns/exhaustiveness-pass.rs
index e8c8a0e7b..428b9a19f 100644
--- a/tests/ui/or-patterns/exhaustiveness-pass.rs
+++ b/tests/ui/or-patterns/exhaustiveness-pass.rs
@@ -35,4 +35,10 @@ fn main() {
((0, 0) | (1, 0),) => {}
_ => {}
}
+
+ // This one caused ICE https://github.com/rust-lang/rust/issues/117378
+ match (0u8, 0) {
+ (x @ 0 | x @ (1 | 2), _) => {}
+ (3.., _) => {}
+ }
}
diff --git a/tests/ui/or-patterns/missing-bindings.stderr b/tests/ui/or-patterns/missing-bindings.stderr
index 4457b7893..7f182a857 100644
--- a/tests/ui/or-patterns/missing-bindings.stderr
+++ b/tests/ui/or-patterns/missing-bindings.stderr
@@ -103,22 +103,6 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `c`
- | |
- | variable not in all patterns
-
-error[E0408]: variable `d` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `d`
- | |
- | variable not in all patterns
-
error[E0408]: variable `e` is not bound in all patterns
--> $DIR/missing-bindings.rs:45:10
|
@@ -143,6 +127,22 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `c`
+ | |
+ | variable not in all patterns
+
+error[E0408]: variable `d` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `d`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:61:29
|
@@ -151,14 +151,6 @@ LL | Ok(a) | Err(_),
| |
| variable not in all patterns
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/missing-bindings.rs:69:21
- |
-LL | A(_, a) |
- | - variable not in all patterns
-LL | B(b),
- | ^^^^ pattern doesn't bind `a`
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:68:21
|
@@ -168,6 +160,14 @@ LL | B(b),
| - variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:69:21
+ |
+LL | A(_, a) |
+ | - variable not in all patterns
+LL | B(b),
+ | ^^^^ pattern doesn't bind `a`
+
+error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:72:17
|
LL | A(_, a) |
@@ -185,6 +185,24 @@ LL | B(b),
LL | B(_)
| ^^^^ pattern doesn't bind `b`
+error[E0408]: variable `b` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:57:13
+ |
+LL | / V1(
+LL | |
+LL | |
+LL | | A(
+... |
+LL | | B(Ok(a) | Err(a))
+LL | | ) |
+ | |_____________^ pattern doesn't bind `b`
+...
+LL | B(b),
+ | - variable not in all patterns
+...
+LL | V3(c),
+ | ^^^^^ pattern doesn't bind `b`
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:57:13
|
@@ -219,24 +237,6 @@ LL | A(_, a) |
LL | V3(c),
| ^^^^^ pattern doesn't bind `a`
-error[E0408]: variable `b` is not bound in all patterns
- --> $DIR/missing-bindings.rs:57:13
- |
-LL | / V1(
-LL | |
-LL | |
-LL | | A(
-... |
-LL | | B(Ok(a) | Err(a))
-LL | | ) |
- | |_____________^ pattern doesn't bind `b`
-...
-LL | B(b),
- | - variable not in all patterns
-...
-LL | V3(c),
- | ^^^^^ pattern doesn't bind `b`
-
error: aborting due to 26 previous errors
For more information about this error, try `rustc --explain E0408`.
diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
index c16a90368..e09194d5d 100644
--- a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
+++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
@@ -2,9 +2,15 @@ error: expected identifier, found `:`
--> $DIR/or-patterns-syntactic-fail.rs:11:19
|
LL | let _ = |A | B: E| ();
- | ^ expected identifier
+ | ---- ^ expected identifier
+ | |
+ | while parsing the body of this closure
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+help: you might have meant to open the body of the closure
+ |
+LL | let _ = |A | { B: E| ();
+ | +
error: top-level or-patterns are not allowed in function parameters
--> $DIR/or-patterns-syntactic-fail.rs:18:13
diff --git a/tests/ui/packed/packed-struct-drop-aligned.rs b/tests/ui/packed/packed-struct-drop-aligned.rs
index 9f9f41e25..4fec72763 100644
--- a/tests/ui/packed/packed-struct-drop-aligned.rs
+++ b/tests/ui/packed/packed-struct-drop-aligned.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
-#![feature(generator_trait)]
+#![feature(coroutines)]
+#![feature(coroutine_trait)]
use std::cell::Cell;
use std::mem;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
struct Aligned<'a> {
@@ -44,7 +44,7 @@ fn main() {
let _ = &p;
p.1 = Aligned { drop_count };
assert_eq!(drop_count.get(), 1);
- // Test that a generator drop function moves a value from a packed
+ // Test that a coroutine drop function moves a value from a packed
// struct to a separate local before dropping it. We move out the
// first field to generate and open drop for the second field.
drop(p.0);
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs
index d37ce06c5..d37ce06c5 100644
--- a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr
index 538bf0ec1..538bf0ec1 100644
--- a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr
diff --git a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs
index 60da408c8..60da408c8 100644
--- a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs
+++ b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs
diff --git a/tests/ui/parser/assoc-oddities-1.rs b/tests/ui/parser/assoc/assoc-oddities-1.rs
index 5914805e5..5914805e5 100644
--- a/tests/ui/parser/assoc-oddities-1.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-1.rs
diff --git a/tests/ui/parser/assoc-oddities-1.stderr b/tests/ui/parser/assoc/assoc-oddities-1.stderr
index acf71b489..acf71b489 100644
--- a/tests/ui/parser/assoc-oddities-1.stderr
+++ b/tests/ui/parser/assoc/assoc-oddities-1.stderr
diff --git a/tests/ui/parser/assoc-oddities-2.rs b/tests/ui/parser/assoc/assoc-oddities-2.rs
index 3d35aad74..3d35aad74 100644
--- a/tests/ui/parser/assoc-oddities-2.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-2.rs
diff --git a/tests/ui/parser/assoc-oddities-2.stderr b/tests/ui/parser/assoc/assoc-oddities-2.stderr
index d3b90c34c..d3b90c34c 100644
--- a/tests/ui/parser/assoc-oddities-2.stderr
+++ b/tests/ui/parser/assoc/assoc-oddities-2.stderr
diff --git a/tests/ui/parser/assoc-static-semantic-fail.rs b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs
index 403160f12..403160f12 100644
--- a/tests/ui/parser/assoc-static-semantic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs
diff --git a/tests/ui/parser/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr
index 8178bd223..8178bd223 100644
--- a/tests/ui/parser/assoc-static-semantic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr
diff --git a/tests/ui/parser/assoc-static-syntactic-fail.rs b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs
index 492f2ea16..492f2ea16 100644
--- a/tests/ui/parser/assoc-static-syntactic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs
diff --git a/tests/ui/parser/assoc-static-syntactic-fail.stderr b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr
index e97236145..e97236145 100644
--- a/tests/ui/parser/assoc-static-syntactic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr
diff --git a/tests/ui/parser/assoc-type-in-type-arg.rs b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs
index 000956ea2..000956ea2 100644
--- a/tests/ui/parser/assoc-type-in-type-arg.rs
+++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs
diff --git a/tests/ui/parser/assoc-type-in-type-arg.stderr b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr
index b637702f2..b637702f2 100644
--- a/tests/ui/parser/assoc-type-in-type-arg.stderr
+++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr
diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs
index b238a9ca2..b238a9ca2 100644
--- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs
+++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs
diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr
index aa0fa0e3c..aa0fa0e3c 100644
--- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr
+++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr
diff --git a/tests/ui/parser/attr-bad-meta-2.rs b/tests/ui/parser/attribute/attr-bad-meta-2.rs
index db612ed88..db612ed88 100644
--- a/tests/ui/parser/attr-bad-meta-2.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta-2.rs
diff --git a/tests/ui/parser/attr-bad-meta-2.stderr b/tests/ui/parser/attribute/attr-bad-meta-2.stderr
index 6fc6fb665..6fc6fb665 100644
--- a/tests/ui/parser/attr-bad-meta-2.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta-2.stderr
diff --git a/tests/ui/parser/attr-bad-meta-3.rs b/tests/ui/parser/attribute/attr-bad-meta-3.rs
index b51e9f221..b51e9f221 100644
--- a/tests/ui/parser/attr-bad-meta-3.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta-3.rs
diff --git a/tests/ui/parser/attr-bad-meta-3.stderr b/tests/ui/parser/attribute/attr-bad-meta-3.stderr
index 4fa420c79..4fa420c79 100644
--- a/tests/ui/parser/attr-bad-meta-3.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta-3.stderr
diff --git a/tests/ui/parser/attr-bad-meta.rs b/tests/ui/parser/attribute/attr-bad-meta.rs
index 8001977f5..8001977f5 100644
--- a/tests/ui/parser/attr-bad-meta.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta.rs
diff --git a/tests/ui/parser/attr-bad-meta.stderr b/tests/ui/parser/attribute/attr-bad-meta.stderr
index 8d65c423c..8d65c423c 100644
--- a/tests/ui/parser/attr-bad-meta.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta.stderr
diff --git a/tests/ui/parser/attr-before-eof.rs b/tests/ui/parser/attribute/attr-before-eof.rs
index 6af1783e6..6af1783e6 100644
--- a/tests/ui/parser/attr-before-eof.rs
+++ b/tests/ui/parser/attribute/attr-before-eof.rs
diff --git a/tests/ui/parser/attr-before-eof.stderr b/tests/ui/parser/attribute/attr-before-eof.stderr
index a2acb9437..a2acb9437 100644
--- a/tests/ui/parser/attr-before-eof.stderr
+++ b/tests/ui/parser/attribute/attr-before-eof.stderr
diff --git a/tests/ui/parser/attr-dangling-in-fn.rs b/tests/ui/parser/attribute/attr-dangling-in-fn.rs
index c7c45bafb..c7c45bafb 100644
--- a/tests/ui/parser/attr-dangling-in-fn.rs
+++ b/tests/ui/parser/attribute/attr-dangling-in-fn.rs
diff --git a/tests/ui/parser/attr-dangling-in-fn.stderr b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr
index b1bb3ab3b..b1bb3ab3b 100644
--- a/tests/ui/parser/attr-dangling-in-fn.stderr
+++ b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr
diff --git a/tests/ui/parser/attr-dangling-in-mod.rs b/tests/ui/parser/attribute/attr-dangling-in-mod.rs
index 261ed3913..261ed3913 100644
--- a/tests/ui/parser/attr-dangling-in-mod.rs
+++ b/tests/ui/parser/attribute/attr-dangling-in-mod.rs
diff --git a/tests/ui/parser/attr-dangling-in-mod.stderr b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr
index 1c892eac0..1c892eac0 100644
--- a/tests/ui/parser/attr-dangling-in-mod.stderr
+++ b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr
diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs
index d1950087c..d1950087c 100644
--- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs
+++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs
diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr
index 96899fd3f..e46c59108 100644
--- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr
+++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr
@@ -27,6 +27,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
= note: outer attributes, like `#[test]`, annotate the item following them
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: expected expression, found `)`
--> $DIR/attr-stmt-expr-attr-bad.rs:7:44
diff --git a/tests/ui/parser/attr-with-a-semicolon.rs b/tests/ui/parser/attribute/attr-with-a-semicolon.rs
index 56fe40b91..56fe40b91 100644
--- a/tests/ui/parser/attr-with-a-semicolon.rs
+++ b/tests/ui/parser/attribute/attr-with-a-semicolon.rs
diff --git a/tests/ui/parser/attr-with-a-semicolon.stderr b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr
index 0de3490b8..0de3490b8 100644
--- a/tests/ui/parser/attr-with-a-semicolon.stderr
+++ b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr
diff --git a/tests/ui/parser/attr.rs b/tests/ui/parser/attribute/attr.rs
index 42b2dfde8..42b2dfde8 100644
--- a/tests/ui/parser/attr.rs
+++ b/tests/ui/parser/attribute/attr.rs
diff --git a/tests/ui/parser/attr.stderr b/tests/ui/parser/attribute/attr.stderr
index 7cd0ac224..7cd0ac224 100644
--- a/tests/ui/parser/attr.stderr
+++ b/tests/ui/parser/attribute/attr.stderr
diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs
index c2cc91d8f..c2cc91d8f 100644
--- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs
+++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs
diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr
index 4c5964715..4c5964715 100644
--- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr
+++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr
diff --git a/tests/ui/parser/attrs-after-extern-mod.rs b/tests/ui/parser/attribute/attrs-after-extern-mod.rs
index e3f0fa0fc..e3f0fa0fc 100644
--- a/tests/ui/parser/attrs-after-extern-mod.rs
+++ b/tests/ui/parser/attribute/attrs-after-extern-mod.rs
diff --git a/tests/ui/parser/attrs-after-extern-mod.stderr b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr
index 135d98457..135d98457 100644
--- a/tests/ui/parser/attrs-after-extern-mod.stderr
+++ b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr
diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.rs b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs
new file mode 100644
index 000000000..eecc0026b
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs
@@ -0,0 +1,43 @@
+macro_rules! foo {
+ () => {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ };
+ ($e: expr) => {
+ break $e; //~ ERROR `break` outside of a loop or labeled block
+ };
+ (stmt $s: stmt) => {
+ $s
+ };
+ (@ $e: expr) => {
+ { break $e; } //~ ERROR `break` outside of a loop or labeled block
+ };
+ (=> $s: stmt) => {
+ { $s }
+ };
+}
+
+fn main() {
+ {
+ foo!();
+ }
+ {
+ foo!(());
+ }
+ {
+ foo!(stmt break ()); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ foo!(@ ());
+ }
+ {
+ foo!(=> break ()); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ macro_rules! bar {
+ () => {
+ break () //~ ERROR `break` outside of a loop or labeled block
+ };
+ }
+ bar!()
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr
new file mode 100644
index 000000000..9407e8ac0
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr
@@ -0,0 +1,69 @@
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:3:9
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!();
+ | ------ in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:6:9
+ |
+LL | break $e;
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!(());
+ | -------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:27:19
+ |
+LL | foo!(stmt break ());
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ foo!(stmt break 'block ());
+ |
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:12:11
+ |
+LL | { break $e; }
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!(@ ());
+ | ---------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider labeling this block to be able to break within it
+ |
+LL | 'block: { break 'block $e; }
+ | +++++++ ++++++
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:33:17
+ |
+LL | foo!(=> break ());
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:38:17
+ |
+LL | break ()
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | bar!()
+ | ------ in this macro invocation
+ |
+ = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/tests/ui/parser/break-in-unlabeled-block.fixed b/tests/ui/parser/break-in-unlabeled-block.fixed
new file mode 100644
index 000000000..088562325
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+fn main() {
+ 'block: {
+ break 'block (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ 'block: {
+ break 'block (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block.rs b/tests/ui/parser/break-in-unlabeled-block.rs
new file mode 100644
index 000000000..3e5587e9f
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+fn main() {
+ {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block.stderr b/tests/ui/parser/break-in-unlabeled-block.stderr
new file mode 100644
index 000000000..632cca80d
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.stderr
@@ -0,0 +1,27 @@
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block.rs:4:9
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ break 'block ();
+ |
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block.rs:8:13
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ break 'block ();
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.rs b/tests/ui/parser/deep-unmatched-angle-brackets.rs
new file mode 100644
index 000000000..f8d490e1c
--- /dev/null
+++ b/tests/ui/parser/deep-unmatched-angle-brackets.rs
@@ -0,0 +1,17 @@
+trait Mul<T> {
+ type Output;
+}
+trait Matrix: Mul<<Self as Matrix>::Row, Output = ()> {
+ type Row;
+ type Transpose: Matrix<Row = Self::Row>;
+}
+fn is_mul<S, T: Mul<S, Output = ()>>() {}
+fn f<T: Matrix>() {
+ is_mul::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::
+ <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>();
+ //~^ ERROR expected one of `!`, `+`, `,`, `::`, or `>`, found `(`
+}
+fn main() {}
diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.stderr b/tests/ui/parser/deep-unmatched-angle-brackets.stderr
new file mode 100644
index 000000000..1f2850374
--- /dev/null
+++ b/tests/ui/parser/deep-unmatched-angle-brackets.stderr
@@ -0,0 +1,13 @@
+error: expected one of `!`, `+`, `,`, `::`, or `>`, found `(`
+ --> $DIR/deep-unmatched-angle-brackets.rs:14:63
+ |
+LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>();
+ | ^ expected one of `!`, `+`, `,`, `::`, or `>`
+ |
+help: you might have meant to end the type parameters here
+ |
+LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>>();
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs
new file mode 100644
index 000000000..da1774ace
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs
@@ -0,0 +1,9 @@
+macro_rules! foo {
+<<<<<<< HEAD
+ //~^ ERROR encountered diff marker
+ () {
+=======
+ () { //
+>>>>>>> 7a4f13c blah blah blah
+ }
+}
diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr
new file mode 100644
index 000000000..e0b6f1b5e
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr
@@ -0,0 +1,18 @@
+error: encountered diff marker
+ --> $DIR/unclosed-delims-in-macro.rs:2:1
+ |
+LL | <<<<<<< HEAD
+ | ^^^^^^^ after this is the code before the merge
+...
+LL | =======
+ | -------
+LL | () { //
+LL | >>>>>>> 7a4f13c blah blah blah
+ | ^^^^^^^ above this are the incoming code changes
+ |
+ = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
+ = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
+ = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/diff-markers/unclosed-delims.rs b/tests/ui/parser/diff-markers/unclosed-delims.rs
new file mode 100644
index 000000000..653a605c2
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims.rs
@@ -0,0 +1,14 @@
+mod tests {
+ #[test]
+<<<<<<< HEAD
+//~^ ERROR encountered diff marker
+//~| NOTE after this is the code before the merge
+//~| NOTE for an explanation on these markers
+ fn test1() {
+=======
+//~^ NOTE
+ fn test2() {
+>>>>>>> 7a4f13c blah blah blah
+//~^ NOTE above this are the incoming code changes
+ }
+}
diff --git a/tests/ui/parser/diff-markers/unclosed-delims.stderr b/tests/ui/parser/diff-markers/unclosed-delims.stderr
new file mode 100644
index 000000000..67199179b
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims.stderr
@@ -0,0 +1,18 @@
+error: encountered diff marker
+ --> $DIR/unclosed-delims.rs:3:1
+ |
+LL | <<<<<<< HEAD
+ | ^^^^^^^ after this is the code before the merge
+...
+LL | =======
+ | -------
+...
+LL | >>>>>>> 7a4f13c blah blah blah
+ | ^^^^^^^ above this are the incoming code changes
+ |
+ = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
+ = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
+ = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/doc-comment-in-stmt.fixed b/tests/ui/parser/doc-comment-in-stmt.fixed
new file mode 100644
index 000000000..4b3ecccf6
--- /dev/null
+++ b/tests/ui/parser/doc-comment-in-stmt.fixed
@@ -0,0 +1,27 @@
+// run-rustfix
+#![allow(unused)]
+fn foo() -> bool {
+ false
+ // !self.allow_ty_infer()
+ //~^ ERROR found doc comment
+}
+
+fn bar() -> bool {
+ false
+ /* ! bar */ //~ ERROR found doc comment
+}
+
+fn baz() -> i32 {
+ 1 /* * baz */ //~ ERROR found doc comment
+}
+
+fn quux() -> i32 {
+ 2 // / quux
+ //~^ ERROR found doc comment
+}
+
+fn main() {
+ let x = 0;
+ let y = x.max(1) // !foo //~ ERROR found doc comment
+ .min(2);
+}
diff --git a/tests/ui/parser/doc-comment-in-stmt.rs b/tests/ui/parser/doc-comment-in-stmt.rs
index b02df1321..73d08f51c 100644
--- a/tests/ui/parser/doc-comment-in-stmt.rs
+++ b/tests/ui/parser/doc-comment-in-stmt.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+#![allow(unused)]
fn foo() -> bool {
false
//!self.allow_ty_infer()
@@ -14,7 +16,12 @@ fn baz() -> i32 {
}
fn quux() -> i32 {
- 2 /*! quux */ //~ ERROR found doc comment
+ 2 /// quux
+ //~^ ERROR found doc comment
}
-fn main() {}
+fn main() {
+ let x = 0;
+ let y = x.max(1) //!foo //~ ERROR found doc comment
+ .min(2);
+}
diff --git a/tests/ui/parser/doc-comment-in-stmt.stderr b/tests/ui/parser/doc-comment-in-stmt.stderr
index febfb600c..7aefd5c99 100644
--- a/tests/ui/parser/doc-comment-in-stmt.stderr
+++ b/tests/ui/parser/doc-comment-in-stmt.stderr
@@ -1,50 +1,61 @@
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `//!self.allow_ty_infer()`
- --> $DIR/doc-comment-in-stmt.rs:3:5
+ --> $DIR/doc-comment-in-stmt.rs:5:5
|
LL | false
| - expected one of `.`, `;`, `?`, `}`, or an operator
LL | //!self.allow_ty_infer()
| ^^^^^^^^^^^^^^^^^^^^^^^^ unexpected token
|
-help: add a space before `!` to use a regular comment
+help: add a space before `!` to write a regular comment
|
LL | // !self.allow_ty_infer()
- | ~~~~
+ | +
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! bar */`
- --> $DIR/doc-comment-in-stmt.rs:9:5
+ --> $DIR/doc-comment-in-stmt.rs:11:5
|
LL | false
| - expected one of `.`, `;`, `?`, `}`, or an operator
LL | /*! bar */
| ^^^^^^^^^^ unexpected token
|
-help: add a space before `!` to use a regular comment
+help: add a space before `!` to write a regular comment
|
LL | /* ! bar */
- | ~~~~
+ | +
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/** baz */`
- --> $DIR/doc-comment-in-stmt.rs:13:7
+ --> $DIR/doc-comment-in-stmt.rs:15:7
|
LL | 1 /** baz */
| ^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
|
-help: add a space before `*` to use a regular comment
+help: add a space before the last `*` to write a regular comment
|
LL | 1 /* * baz */
- | ~~~~
+ | +
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! quux */`
- --> $DIR/doc-comment-in-stmt.rs:17:7
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/// quux`
+ --> $DIR/doc-comment-in-stmt.rs:19:7
|
-LL | 2 /*! quux */
- | ^^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+LL | 2 /// quux
+ | ^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
|
-help: add a space before `!` to use a regular comment
+help: add a space before the last `/` to write a regular comment
|
-LL | 2 /* ! quux */
- | ~~~~
+LL | 2 // / quux
+ | +
-error: aborting due to 4 previous errors
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found doc comment `//!foo
+ --> $DIR/doc-comment-in-stmt.rs:25:22
+ |
+LL | let y = x.max(1) //!foo
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `.`, `;`, `?`, `else`, or an operator
+ |
+help: add a space before `!` to write a regular comment
+ |
+LL | let y = x.max(1) // !foo
+ | +
+
+error: aborting due to 5 previous errors
diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr
index e645b68ba..8250dd1ea 100644
--- a/tests/ui/parser/emoji-identifiers.stderr
+++ b/tests/ui/parser/emoji-identifiers.stderr
@@ -75,6 +75,12 @@ LL | 👀::full_of✨()
| |
| function or associated item not found in `👀`
| help: there is an associated function with a similar name: `full_of_✨`
+ |
+note: if you're trying to build a new `👀`, consider using `👀::full_of_✨` which returns `👀`
+ --> $DIR/emoji-identifiers.rs:4:5
+ |
+LL | fn full_of_✨() -> 👀 {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope
--> $DIR/emoji-identifiers.rs:13:13
diff --git a/tests/ui/parser/fn-header-semantic-fail.rs b/tests/ui/parser/fn-header-semantic-fail.rs
index 71f18a27e..f8b58cad7 100644
--- a/tests/ui/parser/fn-header-semantic-fail.rs
+++ b/tests/ui/parser/fn-header-semantic-fail.rs
@@ -13,25 +13,23 @@ fn main() {
//~^ ERROR functions cannot be both `const` and `async`
trait X {
- async fn ft1(); //~ ERROR functions in traits cannot be declared `async`
+ async fn ft1(); // OK.
unsafe fn ft2(); // OK.
const fn ft3(); //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4(); // OK.
const async unsafe extern "C" fn ft5();
- //~^ ERROR functions in traits cannot be declared `async`
- //~| ERROR functions in traits cannot be declared const
+ //~^ ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
}
struct Y;
impl X for Y {
- async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
+ async fn ft1() {} // OK.
unsafe fn ft2() {} // OK.
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4() {}
const async unsafe extern "C" fn ft5() {}
- //~^ ERROR functions in traits cannot be declared `async`
- //~| ERROR functions in traits cannot be declared const
+ //~^ ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
}
diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr
index 7f7b7e835..cdf01e0c5 100644
--- a/tests/ui/parser/fn-header-semantic-fail.stderr
+++ b/tests/ui/parser/fn-header-semantic-fail.stderr
@@ -29,19 +29,19 @@ LL | const async unsafe extern "C" fn ft5();
| `const` because of this
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:30:9
+ --> $DIR/fn-header-semantic-fail.rs:29:9
|
LL | const fn ft3() {}
| ^^^^^ functions in traits cannot be const
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:32:9
+ --> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^ functions in traits cannot be const
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:32:9
+ --> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^-^^^^^------------------------------
@@ -50,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {}
| `const` because of this
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:43:9
+ --> $DIR/fn-header-semantic-fail.rs:41:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^-^^^^^------------------------------
@@ -59,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {}
| `const` because of this
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:48:18
+ --> $DIR/fn-header-semantic-fail.rs:46:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -72,7 +72,7 @@ LL | fn fe1();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:49:19
+ --> $DIR/fn-header-semantic-fail.rs:47:19
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -86,7 +86,7 @@ LL | fn fe2();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:50:18
+ --> $DIR/fn-header-semantic-fail.rs:48:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -100,7 +100,7 @@ LL | fn fe3();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:51:23
+ --> $DIR/fn-header-semantic-fail.rs:49:23
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -114,7 +114,7 @@ LL | fn fe4();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:52:42
+ --> $DIR/fn-header-semantic-fail.rs:50:42
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -128,7 +128,7 @@ LL | fn fe5();
| ~~
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:52:9
+ --> $DIR/fn-header-semantic-fail.rs:50:9
|
LL | const async unsafe extern "C" fn fe5();
| ^^^^^-^^^^^----------------------------
@@ -136,59 +136,6 @@ LL | const async unsafe extern "C" fn fe5();
| | `async` because of this
| `const` because of this
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:16:9
- |
-LL | async fn ft1();
- | -----^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:20:9
- |
-LL | const async unsafe extern "C" fn ft5();
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:28:9
- |
-LL | async fn ft1() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:32:9
- |
-LL | const async unsafe extern "C" fn ft5() {}
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 18 previous errors
+error: aborting due to 14 previous errors
-Some errors have detailed explanations: E0379, E0706.
-For more information about an error, try `rustc --explain E0379`.
+For more information about this error, try `rustc --explain E0379`.
diff --git a/tests/ui/parser/issue-116781.rs b/tests/ui/parser/issue-116781.rs
new file mode 100644
index 000000000..0e951d2ea
--- /dev/null
+++ b/tests/ui/parser/issue-116781.rs
@@ -0,0 +1,8 @@
+#[derive(Debug)]
+struct Foo {
+ #[cfg(all())]
+ field: fn(($),), //~ ERROR expected pattern, found `$`
+ //~^ ERROR expected pattern, found `$`
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issue-116781.stderr b/tests/ui/parser/issue-116781.stderr
new file mode 100644
index 000000000..1a77b60a5
--- /dev/null
+++ b/tests/ui/parser/issue-116781.stderr
@@ -0,0 +1,16 @@
+error: expected pattern, found `$`
+ --> $DIR/issue-116781.rs:4:16
+ |
+LL | field: fn(($),),
+ | ^ expected pattern
+
+error: expected pattern, found `$`
+ --> $DIR/issue-116781.rs:4:16
+ |
+LL | field: fn(($),),
+ | ^ expected pattern
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issue-100197-mut-let.fixed b/tests/ui/parser/issues/issue-100197-mut-let.fixed
index 5a8956222..5a8956222 100644
--- a/tests/ui/parser/issue-100197-mut-let.fixed
+++ b/tests/ui/parser/issues/issue-100197-mut-let.fixed
diff --git a/tests/ui/parser/issue-100197-mut-let.rs b/tests/ui/parser/issues/issue-100197-mut-let.rs
index 71103813a..71103813a 100644
--- a/tests/ui/parser/issue-100197-mut-let.rs
+++ b/tests/ui/parser/issues/issue-100197-mut-let.rs
diff --git a/tests/ui/parser/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr
index 86658e4f3..86658e4f3 100644
--- a/tests/ui/parser/issue-100197-mut-let.stderr
+++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr
diff --git a/tests/ui/parser/issue-101477-enum.fixed b/tests/ui/parser/issues/issue-101477-enum.fixed
index 1dfeae22a..1dfeae22a 100644
--- a/tests/ui/parser/issue-101477-enum.fixed
+++ b/tests/ui/parser/issues/issue-101477-enum.fixed
diff --git a/tests/ui/parser/issue-101477-enum.rs b/tests/ui/parser/issues/issue-101477-enum.rs
index ea7051d69..ea7051d69 100644
--- a/tests/ui/parser/issue-101477-enum.rs
+++ b/tests/ui/parser/issues/issue-101477-enum.rs
diff --git a/tests/ui/parser/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr
index 94130671f..94130671f 100644
--- a/tests/ui/parser/issue-101477-enum.stderr
+++ b/tests/ui/parser/issues/issue-101477-enum.stderr
diff --git a/tests/ui/parser/issue-101477-let.fixed b/tests/ui/parser/issues/issue-101477-let.fixed
index 9989ad815..9989ad815 100644
--- a/tests/ui/parser/issue-101477-let.fixed
+++ b/tests/ui/parser/issues/issue-101477-let.fixed
diff --git a/tests/ui/parser/issue-101477-let.rs b/tests/ui/parser/issues/issue-101477-let.rs
index 8b0e8bee1..8b0e8bee1 100644
--- a/tests/ui/parser/issue-101477-let.rs
+++ b/tests/ui/parser/issues/issue-101477-let.rs
diff --git a/tests/ui/parser/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr
index 1b30d4b17..1b30d4b17 100644
--- a/tests/ui/parser/issue-101477-let.stderr
+++ b/tests/ui/parser/issues/issue-101477-let.stderr
diff --git a/tests/ui/parser/issue-102806.rs b/tests/ui/parser/issues/issue-102806.rs
index ba297bdc9..ba297bdc9 100644
--- a/tests/ui/parser/issue-102806.rs
+++ b/tests/ui/parser/issues/issue-102806.rs
diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr
index ba8174a82..ba8174a82 100644
--- a/tests/ui/parser/issue-102806.stderr
+++ b/tests/ui/parser/issues/issue-102806.stderr
diff --git a/tests/ui/parser/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs
index a584274c4..a584274c4 100644
--- a/tests/ui/parser/issue-103143.rs
+++ b/tests/ui/parser/issues/issue-103143.rs
diff --git a/tests/ui/parser/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr
index 4035c69af..4035c69af 100644
--- a/tests/ui/parser/issue-103143.stderr
+++ b/tests/ui/parser/issues/issue-103143.stderr
diff --git a/tests/ui/parser/issue-103381.fixed b/tests/ui/parser/issues/issue-103381.fixed
index 6a9fb9910..6a9fb9910 100644
--- a/tests/ui/parser/issue-103381.fixed
+++ b/tests/ui/parser/issues/issue-103381.fixed
diff --git a/tests/ui/parser/issue-103381.rs b/tests/ui/parser/issues/issue-103381.rs
index bf79e1010..bf79e1010 100644
--- a/tests/ui/parser/issue-103381.rs
+++ b/tests/ui/parser/issues/issue-103381.rs
diff --git a/tests/ui/parser/issue-103381.stderr b/tests/ui/parser/issues/issue-103381.stderr
index 85fcc18e7..85fcc18e7 100644
--- a/tests/ui/parser/issue-103381.stderr
+++ b/tests/ui/parser/issues/issue-103381.stderr
diff --git a/tests/ui/parser/issue-103425.rs b/tests/ui/parser/issues/issue-103425.rs
index c2f8123ca..c2f8123ca 100644
--- a/tests/ui/parser/issue-103425.rs
+++ b/tests/ui/parser/issues/issue-103425.rs
diff --git a/tests/ui/parser/issue-103425.stderr b/tests/ui/parser/issues/issue-103425.stderr
index 0efe3e3ca..0efe3e3ca 100644
--- a/tests/ui/parser/issue-103425.stderr
+++ b/tests/ui/parser/issues/issue-103425.stderr
diff --git a/tests/ui/parser/issue-103451.rs b/tests/ui/parser/issues/issue-103451.rs
index be33213f3..be33213f3 100644
--- a/tests/ui/parser/issue-103451.rs
+++ b/tests/ui/parser/issues/issue-103451.rs
diff --git a/tests/ui/parser/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr
index 6aacd5012..6aacd5012 100644
--- a/tests/ui/parser/issue-103451.stderr
+++ b/tests/ui/parser/issues/issue-103451.stderr
diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
index 8012cb652..8012cb652 100644
--- a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
index b0d8b03ae..b0d8b03ae 100644
--- a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
diff --git a/tests/ui/parser/issue-104620.rs b/tests/ui/parser/issues/issue-104620.rs
index f49476c44..f49476c44 100644
--- a/tests/ui/parser/issue-104620.rs
+++ b/tests/ui/parser/issues/issue-104620.rs
diff --git a/tests/ui/parser/issue-104620.stderr b/tests/ui/parser/issues/issue-104620.stderr
index d06a6b255..d06a6b255 100644
--- a/tests/ui/parser/issue-104620.stderr
+++ b/tests/ui/parser/issues/issue-104620.stderr
diff --git a/tests/ui/parser/issue-104867-inc-dec-2.rs b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
index a006421a9..a006421a9 100644
--- a/tests/ui/parser/issue-104867-inc-dec-2.rs
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
diff --git a/tests/ui/parser/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
index 4e2d05468..4e2d05468 100644
--- a/tests/ui/parser/issue-104867-inc-dec-2.stderr
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
diff --git a/tests/ui/parser/issue-104867-inc-dec.rs b/tests/ui/parser/issues/issue-104867-inc-dec.rs
index 760c67b4b..760c67b4b 100644
--- a/tests/ui/parser/issue-104867-inc-dec.rs
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.rs
diff --git a/tests/ui/parser/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
index 78bfd3e82..78bfd3e82 100644
--- a/tests/ui/parser/issue-104867-inc-dec.stderr
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
diff --git a/tests/ui/parser/issue-105366.fixed b/tests/ui/parser/issues/issue-105366.fixed
index ad26643c3..ad26643c3 100644
--- a/tests/ui/parser/issue-105366.fixed
+++ b/tests/ui/parser/issues/issue-105366.fixed
diff --git a/tests/ui/parser/issue-105366.rs b/tests/ui/parser/issues/issue-105366.rs
index 311b6a60f..311b6a60f 100644
--- a/tests/ui/parser/issue-105366.rs
+++ b/tests/ui/parser/issues/issue-105366.rs
diff --git a/tests/ui/parser/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr
index 0a7408e2c..0a7408e2c 100644
--- a/tests/ui/parser/issue-105366.stderr
+++ b/tests/ui/parser/issues/issue-105366.stderr
diff --git a/tests/ui/parser/issue-105634.rs b/tests/ui/parser/issues/issue-105634.rs
index 579aa6e5b..579aa6e5b 100644
--- a/tests/ui/parser/issue-105634.rs
+++ b/tests/ui/parser/issues/issue-105634.rs
diff --git a/tests/ui/parser/issue-107705.rs b/tests/ui/parser/issues/issue-107705.rs
index b80984fcd..b80984fcd 100644
--- a/tests/ui/parser/issue-107705.rs
+++ b/tests/ui/parser/issues/issue-107705.rs
diff --git a/tests/ui/parser/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr
index d2d613461..d2d613461 100644
--- a/tests/ui/parser/issue-107705.stderr
+++ b/tests/ui/parser/issues/issue-107705.stderr
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
new file mode 100644
index 000000000..b819aa810
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing() -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2() {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.rs b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
new file mode 100644
index 000000000..01efe7280
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2 {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
new file mode 100644
index 000000000..86d3449cc
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
@@ -0,0 +1,14 @@
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:3:15
+ |
+LL | pub fn missing -> () {}
+ | ^ help: add a parameter list
+
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:6:16
+ |
+LL | pub fn missing2 {}
+ | ^ help: add a parameter list
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
new file mode 100644
index 000000000..eaae28886
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce() -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
new file mode 100644
index 000000000..ea5c71150
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
new file mode 100644
index 000000000..7cda66757
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
@@ -0,0 +1,11 @@
+error: expected one of `(`, `+`, `,`, `::`, `<`, or `{`, found `->`
+ --> $DIR/issue-108109-fn-trait-missing-paren.rs:3:34
+ |
+LL | pub fn func<F>() where F: FnOnce -> () {}
+ | -------^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{`
+ | | |
+ | | help: try adding parentheses
+ | `Fn` bounds require arguments in parentheses
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issue-108495-dec.rs b/tests/ui/parser/issues/issue-108495-dec.rs
index e0816f84e..e0816f84e 100644
--- a/tests/ui/parser/issue-108495-dec.rs
+++ b/tests/ui/parser/issues/issue-108495-dec.rs
diff --git a/tests/ui/parser/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr
index 85b29038f..85b29038f 100644
--- a/tests/ui/parser/issue-108495-dec.stderr
+++ b/tests/ui/parser/issues/issue-108495-dec.stderr
diff --git a/tests/ui/parser/issue-112188.fixed b/tests/ui/parser/issues/issue-112188.fixed
index 5e73d8e38..5e73d8e38 100644
--- a/tests/ui/parser/issue-112188.fixed
+++ b/tests/ui/parser/issues/issue-112188.fixed
diff --git a/tests/ui/parser/issue-112188.rs b/tests/ui/parser/issues/issue-112188.rs
index 27ca192e5..27ca192e5 100644
--- a/tests/ui/parser/issue-112188.rs
+++ b/tests/ui/parser/issues/issue-112188.rs
diff --git a/tests/ui/parser/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr
index 6d2d8e6a3..6d2d8e6a3 100644
--- a/tests/ui/parser/issue-112188.stderr
+++ b/tests/ui/parser/issues/issue-112188.stderr
diff --git a/tests/ui/parser/issue-113342.rs b/tests/ui/parser/issues/issue-113342.rs
index 18b502736..18b502736 100644
--- a/tests/ui/parser/issue-113342.rs
+++ b/tests/ui/parser/issues/issue-113342.rs
diff --git a/tests/ui/parser/issue-113342.stderr b/tests/ui/parser/issues/issue-113342.stderr
index a0c5e665f..a0c5e665f 100644
--- a/tests/ui/parser/issue-113342.stderr
+++ b/tests/ui/parser/issues/issue-113342.stderr
diff --git a/tests/ui/parser/issues/issue-15980.rs b/tests/ui/parser/issues/issue-15980.rs
index 87faa7d5f..eb7b6ca82 100644
--- a/tests/ui/parser/issues/issue-15980.rs
+++ b/tests/ui/parser/issues/issue-15980.rs
@@ -9,9 +9,6 @@ fn main(){
//~^ ERROR expected identifier, found keyword `return`
//~| NOTE expected identifier, found keyword
}
- //~^ NOTE expected one of `.`, `=>`, `?`, or an operator
_ => {}
- //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- //~| NOTE unexpected token
}
}
diff --git a/tests/ui/parser/issues/issue-15980.stderr b/tests/ui/parser/issues/issue-15980.stderr
index c59c81119..cf8d01147 100644
--- a/tests/ui/parser/issues/issue-15980.stderr
+++ b/tests/ui/parser/issues/issue-15980.stderr
@@ -11,15 +11,10 @@ help: escape `return` to use it as an identifier
|
LL | r#return
| ++
-
-error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- --> $DIR/issue-15980.rs:13:9
+help: you might have meant to start a match arm after the match guard
|
-LL | }
- | - expected one of `.`, `=>`, `?`, or an operator
-LL |
-LL | _ => {}
- | ^ unexpected token
+LL | Err(ref e) if e.kind == io::EndOfFile => {
+ | ++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/parser/issue-17718-parse-const.rs b/tests/ui/parser/issues/issue-17718-parse-const.rs
index d5a5f445d..d5a5f445d 100644
--- a/tests/ui/parser/issue-17718-parse-const.rs
+++ b/tests/ui/parser/issues/issue-17718-parse-const.rs
diff --git a/tests/ui/parser/issues/issue-32505.rs b/tests/ui/parser/issues/issue-32505.rs
index f31c00e5c..d95e7dc7d 100644
--- a/tests/ui/parser/issues/issue-32505.rs
+++ b/tests/ui/parser/issues/issue-32505.rs
@@ -1,5 +1,6 @@
pub fn test() {
foo(|_|) //~ ERROR expected expression, found `)`
+ //~^ ERROR cannot find function `foo` in this scope
}
fn main() { }
diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr
index cdd779a93..27ad2c3e5 100644
--- a/tests/ui/parser/issues/issue-32505.stderr
+++ b/tests/ui/parser/issues/issue-32505.stderr
@@ -2,7 +2,21 @@ error: expected expression, found `)`
--> $DIR/issue-32505.rs:2:12
|
LL | foo(|_|)
- | ^ expected expression
+ | ---^ expected expression
+ | |
+ | while parsing the body of this closure
+ |
+help: you might have meant to open the body of the closure
+ |
+LL | foo(|_| {})
+ | ++
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/issue-32505.rs:2:5
+ |
+LL | foo(|_|)
+ | ^^^ not found in this scope
-error: aborting due to previous error
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/parser/issue-39616.rs b/tests/ui/parser/issues/issue-39616.rs
index 46b5aa334..46b5aa334 100644
--- a/tests/ui/parser/issue-39616.rs
+++ b/tests/ui/parser/issues/issue-39616.rs
diff --git a/tests/ui/parser/issue-39616.stderr b/tests/ui/parser/issues/issue-39616.stderr
index 393d1f2e2..393d1f2e2 100644
--- a/tests/ui/parser/issue-39616.stderr
+++ b/tests/ui/parser/issues/issue-39616.stderr
diff --git a/tests/ui/parser/issue-49257.rs b/tests/ui/parser/issues/issue-49257.rs
index a7fa19d52..a7fa19d52 100644
--- a/tests/ui/parser/issue-49257.rs
+++ b/tests/ui/parser/issues/issue-49257.rs
diff --git a/tests/ui/parser/issue-49257.stderr b/tests/ui/parser/issues/issue-49257.stderr
index 97e16f88b..97e16f88b 100644
--- a/tests/ui/parser/issue-49257.stderr
+++ b/tests/ui/parser/issues/issue-49257.stderr
diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr
index 77335c64c..78c81bf5b 100644
--- a/tests/ui/parser/issues/issue-52496.stderr
+++ b/tests/ui/parser/issues/issue-52496.stderr
@@ -8,10 +8,15 @@ error: expected one of `,`, `:`, or `}`, found `.`
--> $DIR/issue-52496.rs:8:22
|
LL | let _ = Foo { bar.into(), bat: -1, . };
- | --- - ^ expected one of `,`, `:`, or `}`
+ | --- ---^ expected one of `,`, `:`, or `}`
| | |
- | | help: try naming a field: `bar:`
+ | | while parsing this struct field
| while parsing this struct
+ |
+help: try naming a field
+ |
+LL | let _ = Foo { bar: bar.into(), bat: -1, . };
+ | ++++
error: expected identifier, found `.`
--> $DIR/issue-52496.rs:8:40
diff --git a/tests/ui/parser/issue-61858.rs b/tests/ui/parser/issues/issue-61858.rs
index 6c3b56586..6c3b56586 100644
--- a/tests/ui/parser/issue-61858.rs
+++ b/tests/ui/parser/issues/issue-61858.rs
diff --git a/tests/ui/parser/issue-61858.stderr b/tests/ui/parser/issues/issue-61858.stderr
index 03f51c6e3..03f51c6e3 100644
--- a/tests/ui/parser/issue-61858.stderr
+++ b/tests/ui/parser/issues/issue-61858.stderr
diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
index 57d36feb3..57d36feb3 100644
--- a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
index 6674b924e..6674b924e 100644
--- a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
index 1a90b4724..1a90b4724 100644
--- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
index 0b9c364f1..0b9c364f1 100644
--- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
index 30e7ef467..30e7ef467 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-1.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
index 2d873b461..2d873b461 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
index 89aaa68ba..89aaa68ba 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-2.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
index 0ecb748a0..0ecb748a0 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
index e98df8d7c..e98df8d7c 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-3.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
index dfc4407ed..dfc4407ed 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
index 5a3620bf2..5a3620bf2 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
index cabd13324..cabd13324 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
diff --git a/tests/ui/parser/issue-81804.rs b/tests/ui/parser/issues/issue-81804.rs
index ebc4752a1..ebc4752a1 100644
--- a/tests/ui/parser/issue-81804.rs
+++ b/tests/ui/parser/issues/issue-81804.rs
diff --git a/tests/ui/parser/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr
index de3b33ecd..de3b33ecd 100644
--- a/tests/ui/parser/issue-81804.stderr
+++ b/tests/ui/parser/issues/issue-81804.stderr
diff --git a/tests/ui/parser/issue-81827.rs b/tests/ui/parser/issues/issue-81827.rs
index 91defd12a..91defd12a 100644
--- a/tests/ui/parser/issue-81827.rs
+++ b/tests/ui/parser/issues/issue-81827.rs
diff --git a/tests/ui/parser/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr
index 63d135f73..63d135f73 100644
--- a/tests/ui/parser/issue-81827.stderr
+++ b/tests/ui/parser/issues/issue-81827.stderr
diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr
index 237bc11bd..958f3b40b 100644
--- a/tests/ui/parser/issues/issue-84117.stderr
+++ b/tests/ui/parser/issues/issue-84117.stderr
@@ -47,6 +47,7 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| |
| while parsing the type for `inner_local`
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: you might have meant to end the type parameters here
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, }
@@ -61,6 +62,8 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| ^ expected one of 8 possible tokens
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
--> $DIR/issue-84117.rs:2:33
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
index df0cd5439..099178a7d 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
@@ -7,3 +7,8 @@ const async const fn test() {}
//~| NOTE expected one of `extern`, `fn`, or `unsafe`
//~| HELP `const` already used earlier, remove this one
//~| NOTE `const` first seen here
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
index 977c6ebfe..4c55179ce 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
@@ -13,5 +13,14 @@ note: `const` first seen here
LL | const async const fn test() {}
| ^^^^^
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/const-async-const.rs:5:1
+ |
+LL | const async const fn test() {}
+ | ^^^^^-^^^^^-------------------
+ | | |
+ | | `async` because of this
+ | `const` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
new file mode 100644
index 000000000..9d7fe4389
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
@@ -0,0 +1,22 @@
+// test for #115714
+
+struct Misplaced;
+
+impl Misplaced {
+ unsafe const fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+struct Duplicated;
+
+impl Duplicated {
+ unsafe unsafe fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+fn main() {
+ Misplaced.oof();
+ Duplicated.oof();
+}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
new file mode 100644
index 000000000..3f504a9eb
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
@@ -0,0 +1,28 @@
+error: expected one of `extern` or `fn`, found keyword `const`
+ --> $DIR/recovery.rs:6:12
+ |
+LL | unsafe const fn from_u32(val: u32) {}
+ | -------^^^^^
+ | | |
+ | | expected one of `extern` or `fn`
+ | help: `const` must come before `unsafe`: `const unsafe`
+ |
+ = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+error: expected one of `extern` or `fn`, found keyword `unsafe`
+ --> $DIR/recovery.rs:14:12
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+ | |
+ | expected one of `extern` or `fn`
+ | help: `unsafe` already used earlier, remove this one
+ |
+note: `unsafe` first seen here
+ --> $DIR/recovery.rs:14:5
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
index bbebc99e9..479426626 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
@@ -12,3 +12,8 @@ async unsafe const fn test() {}
//~| HELP `const` must come before `async unsafe`
//~| SUGGESTION const async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
index f455caba1..489e8eefb 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
@@ -9,5 +9,14 @@ LL | async unsafe const fn test() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/several-kw-jump.rs:9:1
+ |
+LL | async unsafe const fn test() {}
+ | ^^^^^--------^^^^^-------------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
index 4ff4cf5c8..867f71c12 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
@@ -12,3 +12,5 @@ unsafe async fn test() {}
//~| HELP `async` must come before `unsafe`
//~| SUGGESTION async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
index 2f5fbc513..9a7f28210 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
@@ -12,3 +12,5 @@ unsafe const fn test() {}
//~| HELP `const` must come before `unsafe`
//~| SUGGESTION const unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
index df2412e3e..8305ff4f6 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
@@ -12,3 +12,5 @@ extern unsafe fn test() {}
//~| HELP `unsafe` must come before `extern`
//~| SUGGESTION unsafe extern
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issue-87694-duplicated-pub.rs b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
index e3ea61dc4..e3ea61dc4 100644
--- a/tests/ui/parser/issue-87694-duplicated-pub.rs
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
diff --git a/tests/ui/parser/issue-87694-duplicated-pub.stderr b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
index 8d242bc9d..8d242bc9d 100644
--- a/tests/ui/parser/issue-87694-duplicated-pub.stderr
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
diff --git a/tests/ui/parser/issue-87694-misplaced-pub.rs b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
index 3f824617c..3f824617c 100644
--- a/tests/ui/parser/issue-87694-misplaced-pub.rs
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
diff --git a/tests/ui/parser/issue-87694-misplaced-pub.stderr b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
index 94c6a29ef..94c6a29ef 100644
--- a/tests/ui/parser/issue-87694-misplaced-pub.stderr
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
diff --git a/tests/ui/parser/issues/issue-89396.fixed b/tests/ui/parser/issues/issue-89396.fixed
index 823ad8cd1..0c040ddea 100644
--- a/tests/ui/parser/issues/issue-89396.fixed
+++ b/tests/ui/parser/issues/issue-89396.fixed
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) => true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None => false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.rs b/tests/ui/parser/issues/issue-89396.rs
index f1d9efa52..d95f666d7 100644
--- a/tests/ui/parser/issues/issue-89396.rs
+++ b/tests/ui/parser/issues/issue-89396.rs
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) = true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None -> false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr
index 504420574..41ce07050 100644
--- a/tests/ui/parser/issues/issue-89396.stderr
+++ b/tests/ui/parser/issues/issue-89396.stderr
@@ -5,7 +5,7 @@ LL | Some(_) = true,
| ^
| |
| expected one of `=>`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: expected one of `=>`, `@`, `if`, or `|`, found `->`
--> $DIR/issue-89396.rs:12:14
@@ -14,7 +14,7 @@ LL | None -> false,
| ^^
| |
| expected one of `=>`, `@`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issue-90728.rs b/tests/ui/parser/issues/issue-90728.rs
index d6a898361..d6a898361 100644
--- a/tests/ui/parser/issue-90728.rs
+++ b/tests/ui/parser/issues/issue-90728.rs
diff --git a/tests/ui/parser/issue-90728.stderr b/tests/ui/parser/issues/issue-90728.stderr
index b55c46030..b55c46030 100644
--- a/tests/ui/parser/issue-90728.stderr
+++ b/tests/ui/parser/issues/issue-90728.stderr
diff --git a/tests/ui/parser/issue-91421.rs b/tests/ui/parser/issues/issue-91421.rs
index 8bba27f37..8bba27f37 100644
--- a/tests/ui/parser/issue-91421.rs
+++ b/tests/ui/parser/issues/issue-91421.rs
diff --git a/tests/ui/parser/issue-91421.stderr b/tests/ui/parser/issues/issue-91421.stderr
index 2d9652051..2d9652051 100644
--- a/tests/ui/parser/issue-91421.stderr
+++ b/tests/ui/parser/issues/issue-91421.stderr
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
index 4b4a416b1..4b4a416b1 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
index 9cc886641..9cc886641 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
index edc640bf5..edc640bf5 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed
index 64ab6f62b..64ab6f62b 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs
index 50520971f..50520971f 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr
index 72377fc37..72377fc37 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr
diff --git a/tests/ui/parser/macro/macro-repeat.stderr b/tests/ui/parser/macro/macro-repeat.stderr
index 63554b197..ade2bbf9b 100644
--- a/tests/ui/parser/macro/macro-repeat.stderr
+++ b/tests/ui/parser/macro/macro-repeat.stderr
@@ -9,6 +9,8 @@ error: variable 'v' is still repeating at this depth
|
LL | $v
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs
new file mode 100644
index 000000000..325f1ccf2
--- /dev/null
+++ b/tests/ui/parser/missing-fat-arrow.rs
@@ -0,0 +1,38 @@
+fn main() {
+ let x = 1;
+ let y = 2;
+ let value = 3;
+
+ match value {
+ Some(x) if x == y {
+ self.next_token()?; //~ ERROR expected identifier, found keyword `self`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+struct Foo {
+ value: usize
+}
+
+fn foo(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+fn bar(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ } => {
+ }
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
diff --git a/tests/ui/parser/missing-fat-arrow.stderr b/tests/ui/parser/missing-fat-arrow.stderr
new file mode 100644
index 000000000..a6c786905
--- /dev/null
+++ b/tests/ui/parser/missing-fat-arrow.stderr
@@ -0,0 +1,78 @@
+error: expected identifier, found keyword `self`
+ --> $DIR/missing-fat-arrow.rs:8:13
+ |
+LL | Some(x) if x == y {
+ | - while parsing this struct
+LL | self.next_token()?;
+ | ^^^^ expected identifier, found keyword
+ |
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(x) if x == y => {
+ | ++
+
+error: expected one of `,`, `:`, or `}`, found `.`
+ --> $DIR/missing-fat-arrow.rs:22:14
+ |
+LL | Some(a) if a.value == b {
+ | - while parsing this struct
+LL | a.value = 1;
+ | -^ expected one of `,`, `:`, or `}`
+ | |
+ | while parsing this struct field
+ |
+help: try naming a field
+ |
+LL | a: a.value = 1;
+ | ++
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(a) if a.value == b => {
+ | ++
+
+error: expected one of `,`, `:`, or `}`, found `.`
+ --> $DIR/missing-fat-arrow.rs:32:14
+ |
+LL | Some(a) if a.value == b {
+ | - while parsing this struct
+LL | a.value,
+ | -^ expected one of `,`, `:`, or `}`
+ | |
+ | while parsing this struct field
+ |
+help: try naming a field
+ |
+LL | a: a.value,
+ | ++
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(a) if a.value == b => {
+ | ++
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:12:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:26:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:37:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/parser/mod_file_not_exist.stderr b/tests/ui/parser/mod_file_not_exist.stderr
index 62456d518..c2f9d30d9 100644
--- a/tests/ui/parser/mod_file_not_exist.stderr
+++ b/tests/ui/parser/mod_file_not_exist.stderr
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
+ = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist.rs:7:16
diff --git a/tests/ui/parser/mod_file_not_exist_windows.stderr b/tests/ui/parser/mod_file_not_exist_windows.stderr
index d5143dbe9..53b09d8ca 100644
--- a/tests/ui/parser/mod_file_not_exist_windows.stderr
+++ b/tests/ui/parser/mod_file_not_exist_windows.stderr
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
+ = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist_windows.rs:7:16
diff --git a/tests/ui/parser/recover-missing-semi-before-item.fixed b/tests/ui/parser/recover-missing-semi-before-item.fixed
index 0be17e69e..acb846373 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.fixed
+++ b/tests/ui/parser/recover-missing-semi-before-item.fixed
@@ -1,6 +1,6 @@
// run-rustfix
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
fn for_struct() {
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/parser/recover-missing-semi-before-item.rs b/tests/ui/parser/recover-missing-semi-before-item.rs
index 867b7b749..ef6cfe3c4 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.rs
+++ b/tests/ui/parser/recover-missing-semi-before-item.rs
@@ -1,6 +1,6 @@
// run-rustfix
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
fn for_struct() {
let foo = 3 //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/parser/recover-quantified-closure.stderr b/tests/ui/parser/recover-quantified-closure.stderr
index 39eec80f6..37e93cbee 100644
--- a/tests/ui/parser/recover-quantified-closure.stderr
+++ b/tests/ui/parser/recover-quantified-closure.stderr
@@ -25,10 +25,10 @@ LL | for <Foo>::Bar in x {}
= help: consider removing `for<...>`
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/recover-quantified-closure.rs:2:25
+ --> $DIR/recover-quantified-closure.rs:2:24
|
LL | for<'a> |x: &'a u8| *x + 1;
- | ------- ^
+ | ------- ^
| |
| `for<...>` is here
diff --git a/tests/ui/parser/removed-syntax-fn-sigil.rs b/tests/ui/parser/removed-syntax-fn-sigil.rs
index 725843429..d55a032d1 100644
--- a/tests/ui/parser/removed-syntax-fn-sigil.rs
+++ b/tests/ui/parser/removed-syntax-fn-sigil.rs
@@ -1,3 +1,4 @@
fn main() {
- let x: fn~() = || (); //~ ERROR expected `(`, found `~`
+ let x: fn~() = || (); //~ ERROR missing parameters for function definition
+ //~| ERROR expected one of `->`, `;`, or `=`, found `~`
}
diff --git a/tests/ui/parser/removed-syntax-fn-sigil.stderr b/tests/ui/parser/removed-syntax-fn-sigil.stderr
index 196a5af47..0d3774167 100644
--- a/tests/ui/parser/removed-syntax-fn-sigil.stderr
+++ b/tests/ui/parser/removed-syntax-fn-sigil.stderr
@@ -1,10 +1,14 @@
-error: expected `(`, found `~`
+error: missing parameters for function definition
--> $DIR/removed-syntax-fn-sigil.rs:2:14
|
LL | let x: fn~() = || ();
- | - ^ expected `(`
- | |
- | while parsing the type for `x`
+ | ^ help: add a parameter list
-error: aborting due to previous error
+error: expected one of `->`, `;`, or `=`, found `~`
+ --> $DIR/removed-syntax-fn-sigil.rs:2:14
+ |
+LL | let x: fn~() = || ();
+ | ^ expected one of `->`, `;`, or `=`
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/removed-syntax-with-2.stderr b/tests/ui/parser/removed-syntax-with-2.stderr
index c6ae1ce67..e75c5bcd6 100644
--- a/tests/ui/parser/removed-syntax-with-2.stderr
+++ b/tests/ui/parser/removed-syntax-with-2.stderr
@@ -2,8 +2,9 @@ error: expected one of `,`, `:`, or `}`, found `a`
--> $DIR/removed-syntax-with-2.rs:8:31
|
LL | let b = S { foo: (), with a };
- | - ^ expected one of `,`, `:`, or `}`
- | |
+ | - ---- ^ expected one of `,`, `:`, or `}`
+ | | |
+ | | while parsing this struct field
| while parsing this struct
error[E0063]: missing field `bar` in initializer of `S`
diff --git a/tests/ui/parser/semi-in-let-chain.rs b/tests/ui/parser/semi-in-let-chain.rs
new file mode 100644
index 000000000..9c21af037
--- /dev/null
+++ b/tests/ui/parser/semi-in-let-chain.rs
@@ -0,0 +1,27 @@
+// Issue #117720
+
+#![feature(let_chains)]
+
+fn main() {
+ if let () = ()
+ && let () = (); //~ERROR
+ && let () = ()
+ {
+ }
+}
+
+fn foo() {
+ if let () = ()
+ && () == (); //~ERROR
+ && 1 < 0
+ {
+ }
+}
+
+fn bar() {
+ if let () = ()
+ && () == (); //~ERROR
+ && let () = ()
+ {
+ }
+}
diff --git a/tests/ui/parser/semi-in-let-chain.stderr b/tests/ui/parser/semi-in-let-chain.stderr
new file mode 100644
index 000000000..c1a8f9296
--- /dev/null
+++ b/tests/ui/parser/semi-in-let-chain.stderr
@@ -0,0 +1,50 @@
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:7:23
+ |
+LL | && let () = ();
+ | ^ expected `{`
+ |
+note: you likely meant to continue parsing the let-chain starting here
+ --> $DIR/semi-in-let-chain.rs:8:9
+ |
+LL | && let () = ()
+ | ^^^^^^
+help: consider removing this semicolon to parse the `let` as part of the same chain
+ |
+LL - && let () = ();
+LL + && let () = ()
+ |
+
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:15:20
+ |
+LL | && () == ();
+ | ^ expected `{`
+ |
+note: the `if` expression is missing a block after this condition
+ --> $DIR/semi-in-let-chain.rs:14:8
+ |
+LL | if let () = ()
+ | ________^
+LL | | && () == ();
+ | |___________________^
+
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:23:20
+ |
+LL | && () == ();
+ | ^ expected `{`
+ |
+note: you likely meant to continue parsing the let-chain starting here
+ --> $DIR/semi-in-let-chain.rs:24:9
+ |
+LL | && let () = ()
+ | ^^^^^^
+help: consider removing this semicolon to parse the `let` as part of the same chain
+ |
+LL - && () == ();
+LL + && () == ()
+ |
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/ternary_operator.rs b/tests/ui/parser/ternary_operator.rs
index 23d537e77..c8810781b 100644
--- a/tests/ui/parser/ternary_operator.rs
+++ b/tests/ui/parser/ternary_operator.rs
@@ -1,69 +1,30 @@
-// A good chunk of these errors aren't shown to the user, but are still
-// required in the test for it to pass.
-
-fn a() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn a() {
let x = 5 > 2 ? true : false;
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn b() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn b() {
let x = 5 > 2 ? { true } : { false };
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn c() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn c() {
let x = 5 > 2 ? f32::MAX : f32::MIN;
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn main() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn bad() {
+ // regression test for #117208
+ v ? return;
+ //~^ ERROR expected one of
+}
+
+fn main() {
let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
//~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
- //~| NOTE expected one of `.`, `;`, `?`, `else`, or an operator
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
diff --git a/tests/ui/parser/ternary_operator.stderr b/tests/ui/parser/ternary_operator.stderr
index af9565bbe..6635e1672 100644
--- a/tests/ui/parser/ternary_operator.stderr
+++ b/tests/ui/parser/ternary_operator.stderr
@@ -1,5 +1,5 @@
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:5:19
+ --> $DIR/ternary_operator.rs:2:19
|
LL | let x = 5 > 2 ? true : false;
| ^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | let x = 5 > 2 ? true : false;
= help: use an `if-else` expression instead
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:21:19
+ --> $DIR/ternary_operator.rs:8:19
|
LL | let x = 5 > 2 ? { true } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,15 +15,21 @@ LL | let x = 5 > 2 ? { true } : { false };
= help: use an `if-else` expression instead
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:37:19
+ --> $DIR/ternary_operator.rs:14:19
|
LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found keyword `return`
+ --> $DIR/ternary_operator.rs:21:9
+ |
+LL | v ? return;
+ | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
- --> $DIR/ternary_operator.rs:53:37
+ --> $DIR/ternary_operator.rs:26:37
|
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
@@ -31,85 +37,12 @@ LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:53:19
+ --> $DIR/ternary_operator.rs:26:19
|
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:5:17
- |
-LL | let x = 5 > 2 ? true : false;
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:5:19
- |
-LL | fn a() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? true : false;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:21:17
- |
-LL | let x = 5 > 2 ? { true } : { false };
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:21:19
- |
-LL | fn b() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? { true } : { false };
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:37:17
- |
-LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:37:19
- |
-LL | fn c() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:53:17
- |
-LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:53:19
- |
-LL | fn main() {
- | --------- this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error: aborting due to 13 previous errors
+error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/parser/unsafe-mod.stderr b/tests/ui/parser/unsafe-mod.stderr
index dac6e7a35..fbe24aa10 100644
--- a/tests/ui/parser/unsafe-mod.stderr
+++ b/tests/ui/parser/unsafe-mod.stderr
@@ -5,6 +5,7 @@ LL | unsafe mod n;
| ^^^^^^^^^^^^^
|
= help: to create the module `n`, create file "$DIR/n.rs" or "$DIR/n/mod.rs"
+ = note: if there is a `mod n` elsewhere in the crate already, import it with `use crate::...` instead
error: module cannot be declared unsafe
--> $DIR/unsafe-mod.rs:1:1
diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
index 9eeee195e..f1238ec24 100644
--- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
+++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
@@ -5,5 +5,9 @@ fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
//~^ ERROR C-variadic type `...` may not be nested inside another type
fn main() {
- let _recovery_witness: () = 0; //~ ERROR mismatched types
+ // While this is an error, wf-checks happen before typeck, and if any wf-checks
+ // encountered errors, we do not continue to typeck, even if the items are
+ // unrelated.
+ // FIXME(oli-obk): make this report a type mismatch again.
+ let _recovery_witness: () = 0;
}
diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
index 8b9d676a4..7ca6a6d1b 100644
--- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
+++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
@@ -10,15 +10,6 @@ error[E0743]: C-variadic type `...` may not be nested inside another type
LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
| ^^^
-error[E0308]: mismatched types
- --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33
- |
-LL | let _recovery_witness: () = 0;
- | -- ^ expected `()`, found integer
- | |
- | expected due to this
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0308, E0743.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0743`.
diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
index 0b61e267d..b173e23e7 100644
--- a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
+++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
@@ -32,6 +32,18 @@ extern "C" fn f3_3(..., x: isize) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
+const unsafe extern "C" fn f4_1(x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+
+const extern "C" fn f4_2(x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+
+const extern "C" fn f4_3(..., x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+//~| ERROR `...` must be the last argument of a C-variadic function
+
extern "C" {
fn e_f1(...);
//~^ ERROR C-variadic function must be declared with at least one named argument
@@ -49,12 +61,13 @@ impl X {
//~| ERROR C-variadic function must be declared with at least one named argument
fn i_f3(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
- //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
fn i_f4(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
- //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
+ const fn i_f5(x: isize, ...) {}
+ //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+ //~| ERROR functions cannot be both `const` and C-variadic
}
trait T {
diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
index f1cbbb279..18526080e 100644
--- a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
+++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
@@ -76,131 +76,172 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic
LL | extern "C" fn f3_3(..., x: isize) {}
| ^^^
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:35:1
+ |
+LL | const unsafe extern "C" fn f4_1(x: isize, ...) {}
+ | ^^^^^ `const` because of this ^^^ C-variadic because of this
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:38:1
+ |
+LL | const extern "C" fn f4_2(x: isize, ...) {}
+ | ^^^^^ `const` because of this ^^^ C-variadic because of this
+
+error: only foreign or `unsafe extern "C"` functions may be C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:38:36
+ |
+LL | const extern "C" fn f4_2(x: isize, ...) {}
+ | ^^^
+
+error: `...` must be the last argument of a C-variadic function
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:1
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^^^ ^^^ ^^^ C-variadic because of this
+ | | |
+ | | C-variadic because of this
+ | `const` because of this
+
+error: only foreign or `unsafe extern "C"` functions may be C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^ ^^^
+
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:36:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:48:13
|
LL | fn e_f1(...);
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:38:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
|
LL | fn e_f2(..., x: isize);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:45:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:57:23
|
LL | fn i_f1(x: isize, ...) {}
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13
|
LL | fn i_f2(...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13
|
LL | fn i_f2(...) {}
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
- |
-LL | fn i_f3(..., x: isize, ...) {}
- | ^^^
-
-error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13
|
LL | fn i_f3(..., x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:28
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13
|
LL | fn i_f3(..., x: isize, ...) {}
- | ^^^
+ | ^^^ ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
LL | fn i_f4(..., x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
LL | fn i_f4(..., x: isize, ...) {}
- | ^^^
+ | ^^^ ^^^
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:68:5
+ |
+LL | const fn i_f5(x: isize, ...) {}
+ | ^^^^^ ^^^ C-variadic because of this
+ | |
+ | `const` because of this
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:28
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:68:29
|
-LL | fn i_f4(..., x: isize, ...) {}
- | ^^^
+LL | const fn i_f5(x: isize, ...) {}
+ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:61:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:74:23
|
LL | fn t_f1(x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:63:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:76:23
|
LL | fn t_f2(x: isize, ...);
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13
|
LL | fn t_f3(...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13
|
LL | fn t_f3(...) {}
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
|
LL | fn t_f4(...);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
|
LL | fn t_f4(...);
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
|
LL | fn t_f5(..., x: isize) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
|
LL | fn t_f5(..., x: isize) {}
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
|
LL | fn t_f6(..., x: isize);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
|
LL | fn t_f6(..., x: isize);
| ^^^
-error: aborting due to 34 previous errors
+error: aborting due to 40 previous errors
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
index c0a6558a1..0b4324876 100644
--- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
@@ -307,6 +307,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0507]: cannot move out of `a` in pattern guard
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:66
@@ -323,6 +324,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false
| ^ move occurs because `a` has type `&mut Result<U, U>`, which does not implement the `Copy` trait
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed
new file mode 100644
index 000000000..cf6c2a24f
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+struct S {
+ field_name: (),
+}
+
+fn main() {
+ match (S {field_name: ()}) {
+ S {field_name: ref _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {field_name: mut _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {field_name: ref mut _foo} => {} //~ ERROR expected `,`
+ }
+ // Verify that we recover enough to run typeck.
+ let _: usize = 3usize; //~ ERROR mismatched types
+}
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs
new file mode 100644
index 000000000..98772c118
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs
@@ -0,0 +1,18 @@
+// run-rustfix
+struct S {
+ field_name: (),
+}
+
+fn main() {
+ match (S {field_name: ()}) {
+ S {ref field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {mut field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {ref mut field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ // Verify that we recover enough to run typeck.
+ let _: usize = 3u8; //~ ERROR mismatched types
+}
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr
new file mode 100644
index 000000000..e80789253
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr
@@ -0,0 +1,58 @@
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:8:26
+ |
+LL | S {ref field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {ref field_name: _foo} => {}
+LL + S {field_name: ref _foo} => {}
+ |
+
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:11:26
+ |
+LL | S {mut field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {mut field_name: _foo} => {}
+LL + S {field_name: mut _foo} => {}
+ |
+
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:14:30
+ |
+LL | S {ref mut field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {ref mut field_name: _foo} => {}
+LL + S {field_name: ref mut _foo} => {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:17:20
+ |
+LL | let _: usize = 3u8;
+ | ----- ^^^ expected `usize`, found `u8`
+ | |
+ | expected due to this
+ |
+help: change the type of the numeric literal from `u8` to `usize`
+ |
+LL | let _: usize = 3usize;
+ | ~~~~~
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/pattern/issue-115599.rs b/tests/ui/pattern/issue-115599.rs
new file mode 100644
index 000000000..7a222b90a
--- /dev/null
+++ b/tests/ui/pattern/issue-115599.rs
@@ -0,0 +1,7 @@
+const CONST_STRING: String = String::new();
+
+fn main() {
+ let empty_str = String::from("");
+ if let CONST_STRING = empty_str {}
+ //~^ ERROR to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
+}
diff --git a/tests/ui/pattern/issue-115599.stderr b/tests/ui/pattern/issue-115599.stderr
new file mode 100644
index 000000000..e6cb6c1dd
--- /dev/null
+++ b/tests/ui/pattern/issue-115599.stderr
@@ -0,0 +1,11 @@
+error: to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
+ --> $DIR/issue-115599.rs:5:12
+ |
+LL | if let CONST_STRING = empty_str {}
+ | ^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
+
+error: aborting due to previous error
+
diff --git a/tests/ui/pattern/issue-94866.stderr b/tests/ui/pattern/issue-94866.stderr
index b3c17ce89..dee4b3f55 100644
--- a/tests/ui/pattern/issue-94866.stderr
+++ b/tests/ui/pattern/issue-94866.stderr
@@ -5,10 +5,10 @@ LL | match Enum::A {
| ^^^^^^^ pattern `Enum::B` not covered
|
note: `Enum` defined here
- --> $DIR/issue-94866.rs:7:16
+ --> $DIR/issue-94866.rs:7:6
|
LL | enum Enum { A, B }
- | ---- ^ not covered
+ | ^^^^ - not covered
= note: the matched value is of type `Enum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/non-structural-match-types.mir.stderr b/tests/ui/pattern/non-structural-match-types.mir.stderr
new file mode 100644
index 000000000..7a9e5b7e0
--- /dev/null
+++ b/tests/ui/pattern/non-structural-match-types.mir.stderr
@@ -0,0 +1,14 @@
+error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:12:9
+ |
+LL | const { || {} } => {}
+ | ^^^^^^^^^^^^^^^
+
+error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:15:9
+ |
+LL | const { async {} } => {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/pattern/non-structural-match-types.rs b/tests/ui/pattern/non-structural-match-types.rs
index 5c3315473..fb7779fa8 100644
--- a/tests/ui/pattern/non-structural-match-types.rs
+++ b/tests/ui/pattern/non-structural-match-types.rs
@@ -1,4 +1,7 @@
// edition:2021
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![allow(incomplete_features)]
#![allow(unreachable_code)]
#![feature(const_async_blocks)]
@@ -6,9 +9,9 @@
fn main() {
match loop {} {
- const { || {} } => {}, //~ ERROR cannot be used in patterns
+ const { || {} } => {} //~ ERROR cannot be used in patterns
}
match loop {} {
- const { async {} } => {}, //~ ERROR cannot be used in patterns
+ const { async {} } => {} //~ ERROR cannot be used in patterns
}
}
diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr
deleted file mode 100644
index 43d92775e..000000000
--- a/tests/ui/pattern/non-structural-match-types.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-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
- --> $DIR/non-structural-match-types.rs:12:9
- |
-LL | const { async {} } => {},
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/pattern/non-structural-match-types.thir.stderr b/tests/ui/pattern/non-structural-match-types.thir.stderr
new file mode 100644
index 000000000..7a9e5b7e0
--- /dev/null
+++ b/tests/ui/pattern/non-structural-match-types.thir.stderr
@@ -0,0 +1,14 @@
+error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:12:9
+ |
+LL | const { || {} } => {}
+ | ^^^^^^^^^^^^^^^
+
+error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:15:9
+ |
+LL | const { async {} } => {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/pattern/patkind-litrange-no-expr.stderr b/tests/ui/pattern/patkind-litrange-no-expr.stderr
index eb1ee7e45..45a261489 100644
--- a/tests/ui/pattern/patkind-litrange-no-expr.stderr
+++ b/tests/ui/pattern/patkind-litrange-no-expr.stderr
@@ -9,6 +9,8 @@ error: arbitrary expressions aren't allowed in patterns
|
LL | Arith = 1 + 1,
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/pattern/slice-patterns-irrefutable.stderr b/tests/ui/pattern/slice-patterns-irrefutable.stderr
index fac99534f..e98ee28d6 100644
--- a/tests/ui/pattern/slice-patterns-irrefutable.stderr
+++ b/tests/ui/pattern/slice-patterns-irrefutable.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `[_; 3]`
|
LL | let b;
| ^
+LL |
+LL | [a, b] = Default::default();
+ | - type must be known at this point
|
help: consider giving `b` an explicit type, where the placeholders `_` are specified
|
diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.rs b/tests/ui/pattern/usefulness/conflicting_bindings.rs
new file mode 100644
index 000000000..0b3e7ce9e
--- /dev/null
+++ b/tests/ui/pattern/usefulness/conflicting_bindings.rs
@@ -0,0 +1,24 @@
+#![feature(if_let_guard, let_chains)]
+
+fn main() {
+ let mut x = Some(String::new());
+ let ref mut y @ ref mut z = x;
+ //~^ ERROR: mutable more than once
+ let Some(ref mut y @ ref mut z) = x else { return };
+ //~^ ERROR: mutable more than once
+ if let Some(ref mut y @ ref mut z) = x {}
+ //~^ ERROR: mutable more than once
+ if let Some(ref mut y @ ref mut z) = x && true {}
+ //~^ ERROR: mutable more than once
+ while let Some(ref mut y @ ref mut z) = x {}
+ //~^ ERROR: mutable more than once
+ while let Some(ref mut y @ ref mut z) = x && true {}
+ //~^ ERROR: mutable more than once
+ match x {
+ ref mut y @ ref mut z => {} //~ ERROR: mutable more than once
+ }
+ match () {
+ () if let Some(ref mut y @ ref mut z) = x => {} //~ ERROR: mutable more than once
+ _ => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.stderr b/tests/ui/pattern/usefulness/conflicting_bindings.stderr
new file mode 100644
index 000000000..679fc83e7
--- /dev/null
+++ b/tests/ui/pattern/usefulness/conflicting_bindings.stderr
@@ -0,0 +1,66 @@
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:5:9
+ |
+LL | let ref mut y @ ref mut z = x;
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:7:14
+ |
+LL | let Some(ref mut y @ ref mut z) = x else { return };
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:9:17
+ |
+LL | if let Some(ref mut y @ ref mut z) = x {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:11:17
+ |
+LL | if let Some(ref mut y @ ref mut z) = x && true {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:13:20
+ |
+LL | while let Some(ref mut y @ ref mut z) = x {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:15:20
+ |
+LL | while let Some(ref mut y @ ref mut z) = x && true {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:18:9
+ |
+LL | ref mut y @ ref mut z => {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:21:24
+ |
+LL | () if let Some(ref mut y @ ref mut z) = x => {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/pattern/usefulness/consts-opaque.rs b/tests/ui/pattern/usefulness/consts-opaque.rs
index c10c6205a..27e305a39 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.rs
+++ b/tests/ui/pattern/usefulness/consts-opaque.rs
@@ -30,15 +30,13 @@ fn main() {
match FOO {
FOO => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ _ => {}
}
match FOO_REF {
FOO_REF => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Foo(_) => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Foo(_) => {}
}
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
@@ -51,39 +49,31 @@ fn main() {
match BAR {
Bar => {}
- BAR => {} // should not be emitting unreachable warning
+ BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| ERROR unreachable pattern
_ => {}
- //~^ ERROR unreachable pattern
}
match BAR {
BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Bar => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Bar => {}
_ => {}
- //~^ ERROR unreachable pattern
}
match BAR {
BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- BAR => {} // should not be emitting unreachable warning
+ BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| ERROR unreachable pattern
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ _ => {}
}
match BAZ {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Baz::Baz1 => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Baz::Baz1 => {}
_ => {}
- //~^ ERROR unreachable pattern
}
match BAZ {
@@ -91,16 +81,13 @@ fn main() {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
_ => {}
- //~^ ERROR unreachable pattern
}
match BAZ {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Baz::Baz2 => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Baz::Baz2 => {}
+ _ => {}
}
type Quux = fn(usize, usize) -> usize;
@@ -108,8 +95,10 @@ fn main() {
const QUUX: Quux = quux;
match QUUX {
- QUUX => {}
- QUUX => {}
+ QUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
+ QUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
_ => {}
}
@@ -118,14 +107,17 @@ fn main() {
const WRAPQUUX: Wrap<Quux> = Wrap(quux);
match WRAPQUUX {
- WRAPQUUX => {}
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
}
match WRAPQUUX {
Wrap(_) => {}
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
}
match WRAPQUUX {
@@ -134,7 +126,8 @@ fn main() {
match WRAPQUUX {
//~^ ERROR: non-exhaustive patterns: `Wrap(_)` not covered
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
}
#[derive(PartialEq, Eq)]
@@ -145,9 +138,11 @@ fn main() {
const WHOKNOWSQUUX: WhoKnows<Quux> = WhoKnows::Yay(quux);
match WHOKNOWSQUUX {
- WHOKNOWSQUUX => {}
+ WHOKNOWSQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
WhoKnows::Yay(_) => {}
- WHOKNOWSQUUX => {}
+ WHOKNOWSQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
WhoKnows::Nope => {}
}
}
diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr
index e01b06ccc..09f72ba92 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.stderr
+++ b/tests/ui/pattern/usefulness/consts-opaque.stderr
@@ -8,7 +8,7 @@ LL | FOO => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:38:9
+ --> $DIR/consts-opaque.rs:37:9
|
LL | FOO_REF => {}
| ^^^^^^^
@@ -17,7 +17,7 @@ LL | FOO_REF => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:46:9
+ --> $DIR/consts-opaque.rs:44:9
|
LL | FOO_REF_REF => {}
| ^^^^^^^^^^^
@@ -29,16 +29,16 @@ LL | FOO_REF_REF => {}
= note: `#[warn(indirect_structural_match)]` on by default
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:54:9
+ --> $DIR/consts-opaque.rs:52:9
|
-LL | BAR => {} // should not be emitting unreachable warning
+LL | BAR => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:62:9
+ --> $DIR/consts-opaque.rs:58:9
|
LL | BAR => {}
| ^^^
@@ -47,7 +47,7 @@ LL | BAR => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:71:9
+ --> $DIR/consts-opaque.rs:65:9
|
LL | BAR => {}
| ^^^
@@ -56,16 +56,16 @@ LL | BAR => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:73:9
+ --> $DIR/consts-opaque.rs:67:9
|
-LL | BAR => {} // should not be emitting unreachable warning
+LL | BAR => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:81:9
+ --> $DIR/consts-opaque.rs:73:9
|
LL | BAZ => {}
| ^^^
@@ -74,7 +74,7 @@ LL | BAZ => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:91:9
+ --> $DIR/consts-opaque.rs:81:9
|
LL | BAZ => {}
| ^^^
@@ -83,7 +83,7 @@ LL | BAZ => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:98:9
+ --> $DIR/consts-opaque.rs:87:9
|
LL | BAZ => {}
| ^^^
@@ -91,146 +91,96 @@ LL | BAZ => {}
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:33:9
- |
-LL | FOO => {}
- | --- matches any value
-LL |
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:98:9
|
-note: the lint level is defined here
- --> $DIR/consts-opaque.rs:6:9
+LL | QUUX => {}
+ | ^^^^
|
-LL | #![deny(unreachable_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:40:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:100:9
|
-LL | FOO_REF => {}
- | ------- matches any value
-LL |
-LL | Foo(_) => {} // should not be emitting unreachable warning
- | ^^^^^^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:54:9
+LL | QUUX => {}
+ | ^^^^
|
-LL | Bar => {}
- | --- matches any value
-LL | BAR => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:57:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:110:9
|
-LL | Bar => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:64:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAR => {}
- | --- matches any value
-LL |
-LL | Bar => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:66:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:112:9
|
-LL | BAR => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:73:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAR => {}
- | --- matches any value
-LL |
-LL | BAR => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:76:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:119:9
|
-LL | BAR => {}
- | --- matches any value
-...
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:83:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | Baz::Baz1 => {} // should not be emitting unreachable warning
- | ^^^^^^^^^ unreachable pattern
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:85:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:129:9
|
-LL | BAZ => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:93:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | _ => {}
- | ^ unreachable pattern
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:100:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:141:9
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | Baz::Baz2 => {} // should not be emitting unreachable warning
- | ^^^^^^^^^ unreachable pattern
+LL | WHOKNOWSQUUX => {}
+ | ^^^^^^^^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:102:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:144:9
|
-LL | BAZ => {}
- | --- matches any value
-...
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
+LL | WHOKNOWSQUUX => {}
+ | ^^^^^^^^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
error[E0004]: non-exhaustive patterns: `Wrap(_)` not covered
- --> $DIR/consts-opaque.rs:135:11
+ --> $DIR/consts-opaque.rs:127:11
|
LL | match WRAPQUUX {
| ^^^^^^^^ pattern `Wrap(_)` not covered
|
note: `Wrap<fn(usize, usize) -> usize>` defined here
- --> $DIR/consts-opaque.rs:117:12
+ --> $DIR/consts-opaque.rs:106:12
|
LL | struct Wrap<T>(T);
| ^^^^
= note: the matched value is of type `Wrap<fn(usize, usize) -> 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 ~ WRAPQUUX => {},
-LL + Wrap(_) => todo!()
- |
+LL | WRAPQUUX => {}, Wrap(_) => todo!()
+ | ++++++++++++++++++++
-error: aborting due to 23 previous errors; 1 warning emitted
+error: aborting due to 10 previous errors; 9 warnings emitted
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
index ff29de03d..24f3eaa52 100644
--- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -23,13 +23,13 @@ LL | match HiddenEnum::A {
| ^^^^^^^^^^^^^ pattern `HiddenEnum::B` not covered
|
note: `HiddenEnum` defined here
- --> $DIR/auxiliary/hidden.rs:3:5
+ --> $DIR/auxiliary/hidden.rs:1:1
|
LL | pub enum HiddenEnum {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | A,
LL | B,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -44,13 +44,13 @@ LL | match HiddenEnum::A {
| ^^^^^^^^^^^^^ patterns `HiddenEnum::B` and `_` not covered
|
note: `HiddenEnum` defined here
- --> $DIR/auxiliary/hidden.rs:3:5
+ --> $DIR/auxiliary/hidden.rs:1:1
|
LL | pub enum HiddenEnum {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | A,
LL | B,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -83,13 +83,13 @@ LL | match InCrate::A {
| ^^^^^^^^^^ pattern `InCrate::C` not covered
|
note: `InCrate` defined here
- --> $DIR/doc-hidden-non-exhaustive.rs:11:5
+ --> $DIR/doc-hidden-non-exhaustive.rs:7:6
|
LL | enum InCrate {
- | -------
+ | ^^^^^^^
...
LL | C,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `InCrate`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
index 5b81a8c3d..8f9bd5bde 100644
--- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
@@ -1,5 +1,5 @@
error: unreachable pattern
- --> $DIR/empty-match.rs:58:9
+ --> $DIR/empty-match.rs:68:9
|
LL | _ => {},
| ^
@@ -11,25 +11,25 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
- --> $DIR/empty-match.rs:61:9
+ --> $DIR/empty-match.rs:71:9
|
LL | _ if false => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:68:9
+ --> $DIR/empty-match.rs:78:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:71:9
+ --> $DIR/empty-match.rs:81:9
|
LL | _ if false => {},
| ^
error[E0005]: refutable pattern in local binding
- --> $DIR/empty-match.rs:76:9
+ --> $DIR/empty-match.rs:86:9
|
LL | let None = x;
| ^^^^ pattern `Some(_)` not covered
@@ -44,19 +44,19 @@ LL | if let None = x { todo!() };
| ++ +++++++++++
error: unreachable pattern
- --> $DIR/empty-match.rs:88:9
+ --> $DIR/empty-match.rs:98:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:91:9
+ --> $DIR/empty-match.rs:101:9
|
LL | _ if false => {},
| ^
error[E0004]: non-exhaustive patterns: type `u8` is non-empty
- --> $DIR/empty-match.rs:109:20
+ --> $DIR/empty-match.rs:119:20
|
LL | match_no_arms!(0u8);
| ^^^
@@ -65,7 +65,7 @@ LL | match_no_arms!(0u8);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
- --> $DIR/empty-match.rs:111:20
+ --> $DIR/empty-match.rs:121:20
|
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
@@ -79,7 +79,7 @@ LL | struct NonEmptyStruct1;
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
- --> $DIR/empty-match.rs:113:20
+ --> $DIR/empty-match.rs:123:20
|
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
@@ -93,7 +93,7 @@ LL | struct NonEmptyStruct2(bool);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
- --> $DIR/empty-match.rs:115:20
+ --> $DIR/empty-match.rs:125:20
|
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -107,7 +107,7 @@ LL | union NonEmptyUnion1 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
- --> $DIR/empty-match.rs:117:20
+ --> $DIR/empty-match.rs:127:20
|
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,42 +121,44 @@ LL | union NonEmptyUnion2 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:119:20
+ --> $DIR/empty-match.rs:129:20
|
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:122:20
+ --> $DIR/empty-match.rs:132:20
|
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:125:20
+ --> $DIR/empty-match.rs:135:20
|
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -166,11 +168,19 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/empty-match.rs:129:24
+ --> $DIR/empty-match.rs:139:24
|
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
@@ -184,7 +194,7 @@ LL + _ => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
- --> $DIR/empty-match.rs:134:24
+ --> $DIR/empty-match.rs:144:24
|
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
@@ -203,7 +213,7 @@ LL + NonEmptyStruct1 => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
- --> $DIR/empty-match.rs:139:24
+ --> $DIR/empty-match.rs:149:24
|
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
@@ -222,7 +232,7 @@ LL + NonEmptyStruct2(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
- --> $DIR/empty-match.rs:144:24
+ --> $DIR/empty-match.rs:154:24
|
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
@@ -241,7 +251,7 @@ LL + NonEmptyUnion1 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
- --> $DIR/empty-match.rs:149:24
+ --> $DIR/empty-match.rs:159:24
|
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
@@ -260,18 +270,19 @@ LL + NonEmptyUnion2 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:154:24
+ --> $DIR/empty-match.rs:164:24
|
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= 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
@@ -281,21 +292,22 @@ LL + NonEmptyEnum1::Foo(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:159:24
+ --> $DIR/empty-match.rs:169:24
|
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= 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, a match arm with multiple or-patterns as shown, or multiple match arms
@@ -305,7 +317,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:164:24
+ --> $DIR/empty-match.rs:174:24
|
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -315,6 +327,14 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= 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 as shown, or multiple match arms
diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr
index 6d1745508..7f0389f40 100644
--- a/tests/ui/pattern/usefulness/empty-match.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr
@@ -1,5 +1,5 @@
error: unreachable pattern
- --> $DIR/empty-match.rs:58:9
+ --> $DIR/empty-match.rs:68:9
|
LL | _ => {},
| ^
@@ -11,25 +11,25 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
- --> $DIR/empty-match.rs:61:9
+ --> $DIR/empty-match.rs:71:9
|
LL | _ if false => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:68:9
+ --> $DIR/empty-match.rs:78:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:71:9
+ --> $DIR/empty-match.rs:81:9
|
LL | _ if false => {},
| ^
error[E0005]: refutable pattern in local binding
- --> $DIR/empty-match.rs:76:9
+ --> $DIR/empty-match.rs:86:9
|
LL | let None = x;
| ^^^^ pattern `Some(_)` not covered
@@ -43,19 +43,19 @@ LL | if let None = x { todo!() };
| ++ +++++++++++
error: unreachable pattern
- --> $DIR/empty-match.rs:88:9
+ --> $DIR/empty-match.rs:98:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:91:9
+ --> $DIR/empty-match.rs:101:9
|
LL | _ if false => {},
| ^
error[E0004]: non-exhaustive patterns: type `u8` is non-empty
- --> $DIR/empty-match.rs:109:20
+ --> $DIR/empty-match.rs:119:20
|
LL | match_no_arms!(0u8);
| ^^^
@@ -64,7 +64,7 @@ LL | match_no_arms!(0u8);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
- --> $DIR/empty-match.rs:111:20
+ --> $DIR/empty-match.rs:121:20
|
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | struct NonEmptyStruct1;
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
- --> $DIR/empty-match.rs:113:20
+ --> $DIR/empty-match.rs:123:20
|
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
@@ -92,7 +92,7 @@ LL | struct NonEmptyStruct2(bool);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
- --> $DIR/empty-match.rs:115:20
+ --> $DIR/empty-match.rs:125:20
|
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -106,7 +106,7 @@ LL | union NonEmptyUnion1 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
- --> $DIR/empty-match.rs:117:20
+ --> $DIR/empty-match.rs:127:20
|
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -120,42 +120,44 @@ LL | union NonEmptyUnion2 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:119:20
+ --> $DIR/empty-match.rs:129:20
|
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:122:20
+ --> $DIR/empty-match.rs:132:20
|
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:125:20
+ --> $DIR/empty-match.rs:135:20
|
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -165,11 +167,19 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/empty-match.rs:129:24
+ --> $DIR/empty-match.rs:139:24
|
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
@@ -183,7 +193,7 @@ LL + _ => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
- --> $DIR/empty-match.rs:134:24
+ --> $DIR/empty-match.rs:144:24
|
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
@@ -202,7 +212,7 @@ LL + NonEmptyStruct1 => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
- --> $DIR/empty-match.rs:139:24
+ --> $DIR/empty-match.rs:149:24
|
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
@@ -221,7 +231,7 @@ LL + NonEmptyStruct2(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
- --> $DIR/empty-match.rs:144:24
+ --> $DIR/empty-match.rs:154:24
|
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
@@ -240,7 +250,7 @@ LL + NonEmptyUnion1 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
- --> $DIR/empty-match.rs:149:24
+ --> $DIR/empty-match.rs:159:24
|
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
@@ -259,18 +269,19 @@ LL + NonEmptyUnion2 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:154:24
+ --> $DIR/empty-match.rs:164:24
|
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= 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
@@ -280,21 +291,22 @@ LL + NonEmptyEnum1::Foo(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:159:24
+ --> $DIR/empty-match.rs:169:24
|
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= 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, a match arm with multiple or-patterns as shown, or multiple match arms
@@ -304,7 +316,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:164:24
+ --> $DIR/empty-match.rs:174:24
|
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -314,6 +326,14 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= 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 as shown, or multiple match arms
diff --git a/tests/ui/pattern/usefulness/empty-match.rs b/tests/ui/pattern/usefulness/empty-match.rs
index d56d2e3c8..fe5d0bce1 100644
--- a/tests/ui/pattern/usefulness/empty-match.rs
+++ b/tests/ui/pattern/usefulness/empty-match.rs
@@ -30,17 +30,17 @@ union NonEmptyUnion2 {
bar: (),
}
enum NonEmptyEnum1 {
- Foo(bool),
//~^ NOTE `NonEmptyEnum1` defined here
//~| NOTE `NonEmptyEnum1` defined here
- //~| NOTE not covered
+ Foo(bool),
+ //~^ NOTE not covered
//~| NOTE not covered
}
enum NonEmptyEnum2 {
- Foo(bool),
//~^ NOTE `NonEmptyEnum2` defined here
//~| NOTE `NonEmptyEnum2` defined here
- //~| NOTE not covered
+ Foo(bool),
+ //~^ NOTE not covered
//~| NOTE not covered
Bar,
//~^ NOTE not covered
@@ -50,6 +50,16 @@ enum NonEmptyEnum5 {
//~^ NOTE `NonEmptyEnum5` defined here
//~| NOTE `NonEmptyEnum5` defined here
V1, V2, V3, V4, V5,
+ //~^ NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
}
fn empty_enum(x: EmptyEnum) {
diff --git a/tests/ui/pattern/usefulness/floats.rs b/tests/ui/pattern/usefulness/floats.rs
index 095f5ac9a..2616dfadb 100644
--- a/tests/ui/pattern/usefulness/floats.rs
+++ b/tests/ui/pattern/usefulness/floats.rs
@@ -1,19 +1,45 @@
+#![feature(exclusive_range_pattern)]
#![allow(illegal_floating_point_literal_pattern)]
#![deny(unreachable_patterns)]
fn main() {
match 0.0 {
- 0.0..=1.0 => {}
- _ => {} // ok
+ 0.0..=1.0 => {}
+ _ => {} // ok
}
- match 0.0 { //~ ERROR non-exhaustive patterns
- 0.0..=1.0 => {}
+ match 0.0 {
+ //~^ ERROR non-exhaustive patterns
+ 0.0..=1.0 => {}
}
match 1.0f64 {
- 0.01f64 ..= 6.5f64 => {}
- 0.02f64 => {} //~ ERROR unreachable pattern
- _ => {}
+ 0.01f64..=6.5f64 => {}
+ 0.005f64 => {}
+ 0.01f64 => {} //~ ERROR unreachable pattern
+ 0.02f64 => {} //~ ERROR unreachable pattern
+ 6.5f64 => {} //~ ERROR unreachable pattern
+ 6.6f64 => {}
+ 1.0f64..=4.0f64 => {} //~ ERROR unreachable pattern
+ 5.0f64..=7.0f64 => {}
+ _ => {}
+ };
+ match 1.0f64 {
+ 0.01f64..6.5f64 => {}
+ 6.5f64 => {} // this is reachable
+ _ => {}
+ };
+
+ match 1.0f32 {
+ 0.01f32..=6.5f32 => {}
+ 0.01f32 => {} //~ ERROR unreachable pattern
+ 0.02f32 => {} //~ ERROR unreachable pattern
+ 6.5f32 => {} //~ ERROR unreachable pattern
+ _ => {}
+ };
+ match 1.0f32 {
+ 0.01f32..6.5f32 => {}
+ 6.5f32 => {} // this is reachable
+ _ => {}
};
}
diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr
index d66d4ba29..f50419118 100644
--- a/tests/ui/pattern/usefulness/floats.stderr
+++ b/tests/ui/pattern/usefulness/floats.stderr
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/floats.rs:10:11
+ --> $DIR/floats.rs:11:11
|
LL | match 0.0 {
| ^^^ pattern `_` not covered
@@ -7,22 +7,58 @@ LL | match 0.0 {
= note: the matched value is of type `f64`
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 ~ 0.0..=1.0 => {},
-LL + _ => todo!()
+LL ~ 0.0..=1.0 => {},
+LL + _ => todo!()
|
error: unreachable pattern
- --> $DIR/floats.rs:16:7
+ --> $DIR/floats.rs:19:9
|
-LL | 0.02f64 => {}
- | ^^^^^^^
+LL | 0.01f64 => {}
+ | ^^^^^^^
|
note: the lint level is defined here
- --> $DIR/floats.rs:2:9
+ --> $DIR/floats.rs:3:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: unreachable pattern
+ --> $DIR/floats.rs:20:9
+ |
+LL | 0.02f64 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:21:9
+ |
+LL | 6.5f64 => {}
+ | ^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:23:9
+ |
+LL | 1.0f64..=4.0f64 => {}
+ | ^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:35:9
+ |
+LL | 0.01f32 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:36:9
+ |
+LL | 0.02f32 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:37:9
+ |
+LL | 6.5f32 => {}
+ | ^^^^^^
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
index 5ea92b070..33c1dfd39 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
@@ -8,7 +8,7 @@ macro_rules! m {
$t2 => {}
_ => {}
}
- }
+ };
}
fn main() {
@@ -16,9 +16,9 @@ fn main() {
m!(0u8, 30..=40, 20..=30); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 20..=30, 31..=40);
m!(0u8, 20..=30, 29..=40);
- m!(0u8, 20.. 30, 29..=40); //~ ERROR multiple patterns overlap on their endpoints
- m!(0u8, 20.. 30, 28..=40);
- m!(0u8, 20.. 30, 30..=40);
+ m!(0u8, 20..30, 29..=40); //~ ERROR multiple patterns overlap on their endpoints
+ m!(0u8, 20..30, 28..=40);
+ m!(0u8, 20..30, 30..=40);
m!(0u8, 20..=30, 30..=30);
m!(0u8, 20..=30, 30..=31); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 20..=30, 29..=30);
@@ -28,7 +28,7 @@ fn main() {
m!(0u8, 20..=30, 20);
m!(0u8, 20..=30, 25);
m!(0u8, 20..=30, 30);
- m!(0u8, 20.. 30, 29);
+ m!(0u8, 20..30, 29);
m!(0u8, 20, 20..=30);
m!(0u8, 25, 20..=30);
m!(0u8, 30, 20..=30);
@@ -36,19 +36,21 @@ fn main() {
match 0u8 {
0..=10 => {}
20..=30 => {}
- 10..=20 => {} //~ ERROR multiple patterns overlap on their endpoints
+ 10..=20 => {}
+ //~^ ERROR multiple patterns overlap on their endpoints
+ //~| ERROR multiple patterns overlap on their endpoints
_ => {}
}
match (0u8, true) {
(0..=10, true) => {}
- (10..20, true) => {} // not detected
- (10..20, false) => {}
+ (10..20, true) => {} //~ ERROR multiple patterns overlap on their endpoints
+ (10..20, false) => {} //~ ERROR multiple patterns overlap on their endpoints
_ => {}
}
match (true, 0u8) {
(true, 0..=10) => {}
(true, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
- (false, 10..20) => {}
+ (false, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
_ => {}
}
match Some(0u8) {
diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
index ea0e8f6e4..a87205d76 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
@@ -24,10 +24,10 @@ LL | m!(0u8, 30..=40, 20..=30);
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:19:22
+ --> $DIR/overlapping_range_endpoints.rs:19:21
|
-LL | m!(0u8, 20.. 30, 29..=40);
- | ------- ^^^^^^^ ... with this range
+LL | m!(0u8, 20..30, 29..=40);
+ | ------ ^^^^^^^ ... with this range
| |
| this range overlaps on `29_u8`...
|
@@ -59,6 +59,15 @@ error: multiple patterns overlap on their endpoints
LL | 0..=10 => {}
| ------ this range overlaps on `10_u8`...
LL | 20..=30 => {}
+LL | 10..=20 => {}
+ | ^^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:39:9
+ |
+LL | 20..=30 => {}
| ------- this range overlaps on `20_u8`...
LL | 10..=20 => {}
| ^^^^^^^ ... with this range
@@ -66,7 +75,28 @@ LL | 10..=20 => {}
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:50:16
+ --> $DIR/overlapping_range_endpoints.rs:46:10
+ |
+LL | (0..=10, true) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (10..20, true) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:47:10
+ |
+LL | (0..=10, true) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (10..20, true) => {}
+LL | (10..20, false) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:52:16
|
LL | (true, 0..=10) => {}
| ------ this range overlaps on `10_u8`...
@@ -76,7 +106,18 @@ LL | (true, 10..20) => {}
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:56:14
+ --> $DIR/overlapping_range_endpoints.rs:53:17
+ |
+LL | (true, 0..=10) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (true, 10..20) => {}
+LL | (false, 10..20) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:58:14
|
LL | Some(0..=10) => {}
| ------ this range overlaps on `10_u8`...
@@ -85,5 +126,5 @@ LL | Some(10..20) => {}
|
= note: you likely meant to write mutually exclusive ranges
-error: aborting due to 8 previous errors
+error: aborting due to 12 previous errors
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
index 9f277fa1e..7f26c93aa 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
- --> $DIR/pointer-sized-int.rs:48:11
+ --> $DIR/pointer-sized-int.rs:54:11
|
LL | match 7usize {}
| ^^^^^^
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 df330c60b..d16ec5412 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
@@ -1,162 +1,162 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:12:11
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:14:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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 ~ 0 ..= usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:17:11
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:19:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN ..= isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:22:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:25:8
|
LL | m!(0usize, 0..=usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:24:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:27:8
|
LL | m!(0usize, 0..5 | 5..=usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:26:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:29:8
|
LL | m!(0usize, 0..usize::MAX | usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
- --> $DIR/pointer-sized-int.rs:28:8
+error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered
+ --> $DIR/pointer-sized-int.rs:31:8
|
LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
- | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^ pattern `(usize::MAX.., _)` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!() }
- | +++++++++++++++++++
+LL | match $s { $($t)+ => {}, (usize::MAX.., _) => todo!() }
+ | ++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:31:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:36:8
|
LL | m!(0isize, isize::MIN..=isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:33:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:38:8
|
LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:35:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:40:8
|
LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
- --> $DIR/pointer-sized-int.rs:37:8
+error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
+ --> $DIR/pointer-sized-int.rs:42:8
|
LL | m!((0isize, true), (isize::MIN..5, true)
- | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^ patterns `(..isize::MIN, _)` and `(isize::MAX.., _)` 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
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, (_, _) => todo!() }
- | +++++++++++++++++++
+LL | match $s { $($t)+ => {}, (..isize::MIN, _) | (isize::MAX.., _) => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:41:11
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:47:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ 1 ..= isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
- --> $DIR/pointer-sized-int.rs:48:11
+ --> $DIR/pointer-sized-int.rs:54:11
|
LL | match 7usize {}
| ^^^^^^
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
index 1ed18c267..20a3cbe12 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
@@ -1,6 +1,7 @@
// revisions: allow deny
#![feature(exclusive_range_pattern)]
#![cfg_attr(allow, feature(precise_pointer_size_matching))]
+#![allow(overlapping_range_endpoints)]
macro_rules! m {
($s:expr, $($t:tt)+) => {
@@ -8,6 +9,7 @@ macro_rules! m {
}
}
+#[rustfmt::skip]
fn main() {
match 0usize {
//[deny]~^ ERROR non-exhaustive patterns
@@ -19,6 +21,7 @@ fn main() {
isize::MIN ..= isize::MAX => {}
}
+ m!(0usize, 0..);
m!(0usize, 0..=usize::MAX);
//[deny]~^ ERROR non-exhaustive patterns
m!(0usize, 0..5 | 5..=usize::MAX);
@@ -27,7 +30,9 @@ fn main() {
//[deny]~^ ERROR non-exhaustive patterns
m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
//[deny]~^ ERROR non-exhaustive patterns
+ m!(0usize, 0..=usize::MAX | usize::MAX..);
+ m!(0isize, ..0 | 0..);
m!(0isize, isize::MIN..=isize::MAX);
//[deny]~^ ERROR non-exhaustive patterns
m!(0isize, isize::MIN..5 | 5..=isize::MAX);
@@ -37,6 +42,7 @@ fn main() {
m!((0isize, true), (isize::MIN..5, true)
| (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false));
//[deny]~^^ ERROR non-exhaustive patterns
+ m!(0isize, ..=isize::MIN | isize::MIN..=isize::MAX | isize::MAX..);
match 0isize {
//[deny]~^ ERROR non-exhaustive patterns
diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
index a2aa655ca..d60f479c0 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
@@ -1,18 +1,18 @@
// This tests that the lint message explains the reason for the error.
fn main() {
match 0usize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered
+ //~| NOTE pattern `usize::MAX..` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}
match 0isize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ //~| NOTE patterns `..isize::MIN` and `isize::MAX..` not covered
//~| NOTE the matched value is of type `isize`
- //~| NOTE `isize` does not have a fixed maximum value
+ //~| NOTE `isize` does not have fixed minimum and maximum values
isize::MIN..=isize::MAX => {}
}
}
diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
index b80411b26..a7f93648e 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
@@ -1,31 +1,31 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/precise_pointer_matching-message.rs:3:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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 ~ 0..=usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
--> $DIR/precise_pointer_matching-message.rs:11:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN..=isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr
index 6d5e2f410..9feedfde4 100644
--- a/tests/ui/pattern/usefulness/issue-35609.stderr
+++ b/tests/ui/pattern/usefulness/issue-35609.stderr
@@ -107,6 +107,9 @@ LL | match Some(A) {
|
note: `Option<Enum>` 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<Enum>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr
index b8b17918a..8dc534916 100644
--- a/tests/ui/pattern/usefulness/issue-39362.stderr
+++ b/tests/ui/pattern/usefulness/issue-39362.stderr
@@ -5,12 +5,12 @@ LL | match f {
| ^ patterns `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered
|
note: `Foo` defined here
- --> $DIR/issue-39362.rs:2:5
+ --> $DIR/issue-39362.rs:1:6
|
LL | enum Foo {
- | ---
+ | ^^^
LL | Bar { bar: Bar, id: usize }
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr
index 4973e42b0..40b42af26 100644
--- a/tests/ui/pattern/usefulness/issue-40221.stderr
+++ b/tests/ui/pattern/usefulness/issue-40221.stderr
@@ -5,12 +5,12 @@ LL | match proto {
| ^^^^^ pattern `P::C(PC::QA)` not covered
|
note: `P` defined here
- --> $DIR/issue-40221.rs:2:5
+ --> $DIR/issue-40221.rs:1:6
|
LL | enum P {
- | -
+ | ^
LL | C(PC),
- | ^ not covered
+ | - not covered
= note: the matched value is of type `P`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr
index b3e40b992..50e13bdfd 100644
--- a/tests/ui/pattern/usefulness/issue-56379.stderr
+++ b/tests/ui/pattern/usefulness/issue-56379.stderr
@@ -5,16 +5,16 @@ LL | match Foo::A(true) {
| ^^^^^^^^^^^^ patterns `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered
|
note: `Foo` defined here
- --> $DIR/issue-56379.rs:2:5
+ --> $DIR/issue-56379.rs:1:6
|
LL | enum Foo {
- | ---
+ | ^^^
LL | A(bool),
- | ^ not covered
+ | - not covered
LL | B(bool),
- | ^ not covered
+ | - not covered
LL | C(bool),
- | ^ not covered
+ | - not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
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
index 8f58227ee..6cbcfed70 100644
--- 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
@@ -6,19 +6,19 @@ struct B<T, U>(T, U);
fn main() {
match 0 {
- //~^ ERROR non-exhaustive patterns: `_` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered [E0004]
0 => (),
1..=usize::MAX => (),
}
match (0usize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `(usize::MAX.., _)` not covered [E0004]
(0, 0) => (),
(1..=usize::MAX, 1..=usize::MAX) => (),
}
match (0isize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered [E0004]
(isize::MIN..=isize::MAX, 0) => (),
(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
}
@@ -30,14 +30,14 @@ fn main() {
}
match Some(4) {
- //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ //~^ ERROR non-exhaustive patterns: `Some(usize::MAX..)` not covered
Some(0) => (),
Some(1..=usize::MAX) => (),
None => (),
}
match Some(Some(Some(0))) {
- //~^ ERROR non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ //~^ ERROR non-exhaustive patterns: `Some(Some(Some(usize::MAX..)))` not covered
Some(Some(Some(0))) => (),
Some(Some(Some(1..=usize::MAX))) => (),
Some(Some(None)) => (),
@@ -46,13 +46,13 @@ fn main() {
}
match (A { a: 0usize }) {
- //~^ ERROR non-exhaustive patterns: `A { .. }` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `A { a: usize::MAX.. }` not covered [E0004]
A { a: 0 } => (),
A { a: 1..=usize::MAX } => (),
}
match B(0isize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered [E0004]
B(isize::MIN..=isize::MAX, 0) => (),
B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
}
@@ -60,7 +60,7 @@ fn main() {
// 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]
+ //~^ ERROR non-exhaustive patterns: `B(_, usize::MAX..)` 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
index ea1d99e20..556efcda5 100644
--- 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
@@ -1,46 +1,46 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:8:11
|
LL | match 0 {
- | ^ pattern `_` not covered
+ | ^ pattern `usize::MAX..` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ usize::MAX.. => todo!(),
|
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:14:11
|
LL | match (0usize, 0usize) {
- | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^ pattern `(usize::MAX.., _)` 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ (usize::MAX.., _) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:20:11
|
LL | match (0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^ patterns `(..isize::MIN, _)` and `(isize::MAX.., _)` 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
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ (isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
-LL ~ (_, _) => todo!(),
+LL ~ (..isize::MIN, _) | (isize::MAX.., _) => todo!(),
|
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
@@ -61,11 +61,11 @@ LL ~ None => {},
LL + Some(_) => todo!()
|
-error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+error[E0004]: non-exhaustive patterns: `Some(usize::MAX..)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:32:11
|
LL | match Some(4) {
- | ^^^^^^^ pattern `Some(_)` not covered
+ | ^^^^^^^ pattern `Some(usize::MAX..)` not covered
|
note: `Option<usize>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -73,19 +73,19 @@ note: `Option<usize>` defined here
|
= 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ Some(usize::MAX..) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+error[E0004]: non-exhaustive patterns: `Some(Some(Some(usize::MAX..)))` 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
+ | ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(usize::MAX..)))` not covered
|
note: `Option<Option<Option<usize>>>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -97,19 +97,19 @@ note: `Option<Option<Option<usize>>>` defined here
|
= 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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ Some(Some(Some(usize::MAX..))) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `A { .. }` not covered
+error[E0004]: non-exhaustive patterns: `A { a: usize::MAX.. }` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:48:11
|
LL | match (A { a: 0usize }) {
- | ^^^^^^^^^^^^^^^^^ pattern `A { .. }` not covered
+ | ^^^^^^^^^^^^^^^^^ pattern `A { a: usize::MAX.. }` not covered
|
note: `A<usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:1:8
@@ -117,19 +117,19 @@ note: `A<usize>` defined here
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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ A { a: usize::MAX.. } => todo!(),
|
-error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:54:11
|
LL | match B(0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^^ patterns `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered
|
note: `B<isize, usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
@@ -137,19 +137,19 @@ note: `B<isize, usize>` defined here
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
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
-LL ~ B(_, _) => todo!(),
+LL ~ B(..isize::MIN, _) | B(isize::MAX.., _) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `B(_, usize::MAX..)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:62:11
|
LL | match B(0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, usize::MAX..)` not covered
|
note: `B<isize, usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
@@ -157,12 +157,12 @@ note: `B<isize, usize>` defined here
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
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are 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!(),
+LL ~ B(_, usize::MAX..) => todo!(),
|
error: aborting due to 9 previous errors
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
index 5145f7690..1d1ea8e49 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
+++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
@@ -1,10 +1,15 @@
+#![feature(custom_inner_attributes)]
+#![rustfmt::skip]
// Test the "defined here" and "not covered" diagnostic hints.
// We also make sure that references are peeled off from the scrutinee type
// so that the diagnostics work better with default binding modes.
#[derive(Clone)]
enum E {
- //~^ NOTE
+ //~^ NOTE `E` defined here
+ //~| NOTE `E` defined here
+ //~| NOTE `E` defined here
+ //~| NOTE
//~| NOTE
//~| NOTE
//~| NOTE
@@ -12,10 +17,7 @@ enum E {
//~| NOTE
A,
B,
- //~^ NOTE `E` defined here
- //~| NOTE `E` defined here
- //~| NOTE `E` defined here
- //~| NOTE not covered
+ //~^ NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
@@ -79,12 +81,12 @@ fn by_ref_thrice(e: & &mut &E) {
}
enum Opt {
- //~^ NOTE
+ //~^ NOTE `Opt` defined here
+ //~| NOTE
//~| NOTE
Some(u8),
None,
- //~^ NOTE `Opt` defined here
- //~| NOTE not covered
+ //~^ NOTE not covered
//~| NOTE not covered
}
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
index 8489e2f14..a9e55fa53 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
@@ -1,20 +1,20 @@
error[E0004]: non-exhaustive patterns: `E::B` and `E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:35:11
+ --> $DIR/non-exhaustive-defined-here.rs:37:11
|
LL | match e1 {
| ^^ patterns `E::B` and `E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -23,7 +23,7 @@ LL + E::B | E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:41:9
+ --> $DIR/non-exhaustive-defined-here.rs:43:9
|
LL | let E::A = e;
| ^^^^ patterns `E::B` and `E::C` not covered
@@ -31,7 +31,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -48,22 +48,22 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:50:11
+ --> $DIR/non-exhaustive-defined-here.rs:52:11
|
LL | match e {
| ^ patterns `&E::B` and `&E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `&E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -72,7 +72,7 @@ LL + &E::B | &E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:57:9
+ --> $DIR/non-exhaustive-defined-here.rs:59:9
|
LL | let E::A = e;
| ^^^^ patterns `&E::B` and `&E::C` not covered
@@ -80,7 +80,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -97,22 +97,22 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:66:11
+ --> $DIR/non-exhaustive-defined-here.rs:68:11
|
LL | match e {
| ^ patterns `&&mut &E::B` and `&&mut &E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `&&mut &E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -121,7 +121,7 @@ LL + &&mut &E::B | &&mut &E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:73:9
+ --> $DIR/non-exhaustive-defined-here.rs:75:9
|
LL | let E::A = e;
| ^^^^ patterns `&&mut &E::B` and `&&mut &E::C` not covered
@@ -129,7 +129,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -146,19 +146,19 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `Opt::None` not covered
- --> $DIR/non-exhaustive-defined-here.rs:92:11
+ --> $DIR/non-exhaustive-defined-here.rs:94:11
|
LL | match e {
| ^ pattern `Opt::None` not covered
|
note: `Opt` defined here
- --> $DIR/non-exhaustive-defined-here.rs:85:5
+ --> $DIR/non-exhaustive-defined-here.rs:83:6
|
LL | enum Opt {
- | ---
+ | ^^^
...
LL | None,
- | ^^^^ not covered
+ | ---- not covered
= note: the matched value is of type `Opt`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -167,7 +167,7 @@ LL + Opt::None => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:99:9
+ --> $DIR/non-exhaustive-defined-here.rs:101:9
|
LL | let Opt::Some(ref _x) = e;
| ^^^^^^^^^^^^^^^^^ pattern `Opt::None` not covered
@@ -175,7 +175,7 @@ LL | let Opt::Some(ref _x) = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Opt` defined here
- --> $DIR/non-exhaustive-defined-here.rs:81:6
+ --> $DIR/non-exhaustive-defined-here.rs:83:6
|
LL | enum Opt {
| ^^^
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
index 98e417a17..310049fe1 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
@@ -18,10 +18,10 @@ LL | match x {
| ^ pattern `T::A(U::C)` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match-nested.rs:1:10
+ --> $DIR/non-exhaustive-match-nested.rs:1:6
|
LL | enum T { A(U), B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
index e59e8885e..4bebd3cbb 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
@@ -5,10 +5,10 @@ LL | match x { T::B => { } }
| ^ pattern `T::A` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match.rs:3:10
+ --> $DIR/non-exhaustive-match.rs:3:6
|
LL | enum T { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -79,10 +79,10 @@ LL | match T::A {
| ^^^^ pattern `T::B` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match.rs:3:13
+ --> $DIR/non-exhaustive-match.rs:3:6
|
LL | enum T { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
index 4bd344219..9e60d4f41 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
@@ -1,88 +1,101 @@
struct Foo {
first: bool,
- second: Option<[usize; 4]>
+ second: Option<[usize; 4]>,
}
fn struct_with_a_nested_enum_and_vector() {
match (Foo { first: true, second: None }) {
-//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+ //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
Foo { first: true, second: None } => (),
Foo { first: true, second: Some(_) } => (),
Foo { first: false, second: None } => (),
- Foo { first: false, second: Some([1, 2, 3, 4]) } => ()
+ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
}
}
enum Color {
Red,
Green,
- CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
+ CustomRGBA { a: bool, r: u8, g: u8, b: u8 },
}
fn enum_with_single_missing_variant() {
match Color::Red {
- //~^ ERROR non-exhaustive patterns: `Color::Red` not covered
+ //~^ ERROR non-exhaustive patterns: `Color::Red` not covered
Color::CustomRGBA { .. } => (),
- Color::Green => ()
+ Color::Green => (),
}
}
enum Direction {
- North, East, South, West
+ North,
+ East,
+ South,
+ West,
}
fn enum_with_multiple_missing_variants() {
match Direction::North {
- //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
- Direction::North => ()
+ //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
+ Direction::North => (),
}
}
enum ExcessiveEnum {
- First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth
+ First,
+ Second,
+ Third,
+ Fourth,
+ Fifth,
+ Sixth,
+ Seventh,
+ Eighth,
+ Ninth,
+ Tenth,
+ Eleventh,
+ Twelfth,
}
fn enum_with_excessive_missing_variants() {
match ExcessiveEnum::First {
- //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
-
- ExcessiveEnum::First => ()
+ //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
+ ExcessiveEnum::First => (),
}
}
fn enum_struct_variant() {
match Color::Red {
- //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
+ //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
Color::Red => (),
Color::Green => (),
Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (),
- Color::CustomRGBA { a: false, r: _, g: _, b: _ } => ()
+ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (),
}
}
enum Enum {
First,
- Second(bool)
+ Second(bool),
}
fn vectors_with_nested_enums() {
let x: &'static [Enum] = &[Enum::First, Enum::Second(false)];
match *x {
- //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
+ //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
[] => (),
[_] => (),
[Enum::First, _] => (),
[Enum::Second(true), Enum::First] => (),
[Enum::Second(true), Enum::Second(true)] => (),
[Enum::Second(false), _] => (),
- [_, _, ref tail @ .., _] => ()
+ [_, _, ref tail @ .., _] => (),
}
}
fn missing_nil() {
match ((), false) {
- //~^ ERROR non-exhaustive patterns: `((), false)` not covered
- ((), true) => ()
+ //~^ ERROR non-exhaustive patterns: `((), false)` not covered
+ ((), true) => (),
}
}
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
index d798ec722..cceb1d8f6 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
@@ -1,8 +1,8 @@
-error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:7:11
|
LL | match (Foo { first: true, second: None }) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
|
note: `Foo` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:1:8
@@ -10,12 +10,10 @@ 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
-LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!()
+LL ~ Foo { first: false, second: Some([0_usize, _, _, _]) } | Foo { first: false, second: Some([2_usize.., _, _, _]) } => todo!(),
|
error[E0004]: non-exhaustive patterns: `Color::Red` not covered
@@ -25,83 +23,96 @@ LL | match Color::Red {
| ^^^^^^^^^^ pattern `Color::Red` not covered
|
note: `Color` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:17:5
+ --> $DIR/non-exhaustive-pattern-witness.rs:16:6
|
LL | enum Color {
- | -----
+ | ^^^^^
LL | Red,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `Color`
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 ~ Color::Green => (),
-LL + Color::Red => todo!()
+LL ~ Color::Red => todo!(),
|
error[E0004]: non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:35:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:38:11
|
LL | match Direction::North {
| ^^^^^^^^^^^^^^^^ patterns `Direction::East`, `Direction::South` and `Direction::West` not covered
|
note: `Direction` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:31:12
+ --> $DIR/non-exhaustive-pattern-witness.rs:30:6
|
LL | enum Direction {
- | ---------
-LL | North, East, South, West
- | ^^^^ ^^^^^ ^^^^ not covered
- | | |
- | | not covered
- | not covered
+ | ^^^^^^^^^
+LL | North,
+LL | East,
+ | ---- not covered
+LL | South,
+ | ----- not covered
+LL | West,
+ | ---- not covered
= note: the matched value is of type `Direction`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Direction::North => (),
-LL + Direction::East | Direction::South | Direction::West => todo!()
+LL ~ Direction::East | Direction::South | Direction::West => todo!(),
|
error[E0004]: non-exhaustive patterns: `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:46:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:60:11
|
LL | match ExcessiveEnum::First {
| ^^^^^^^^^^^^^^^^^^^^ patterns `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
|
note: `ExcessiveEnum` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:41:6
+ --> $DIR/non-exhaustive-pattern-witness.rs:44:6
|
LL | enum ExcessiveEnum {
| ^^^^^^^^^^^^^
+LL | First,
+LL | Second,
+ | ------ not covered
+LL | Third,
+ | ----- not covered
+LL | Fourth,
+ | ------ not covered
+LL | Fifth,
+ | ----- not covered
+LL | Sixth,
+ | ----- not covered
= note: the matched value is of type `ExcessiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ ExcessiveEnum::First => (),
-LL + _ => todo!()
+LL ~ _ => todo!(),
|
error[E0004]: non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:54:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:67:11
|
LL | match Color::Red {
| ^^^^^^^^^^ pattern `Color::CustomRGBA { a: true, .. }` not covered
|
note: `Color` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:19:5
+ --> $DIR/non-exhaustive-pattern-witness.rs:16:6
|
LL | enum Color {
- | -----
+ | ^^^^^
...
-LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
- | ^^^^^^^^^^ not covered
+LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 },
+ | ---------- not covered
= note: the matched value is of type `Color`
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 ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (),
-LL + Color::CustomRGBA { a: true, .. } => todo!()
+LL ~ Color::CustomRGBA { a: true, .. } => todo!(),
|
error[E0004]: non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:70:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:83:11
|
LL | match *x {
| ^^ pattern `[Enum::Second(true), Enum::Second(false)]` not covered
@@ -110,11 +121,11 @@ LL | match *x {
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 ~ [_, _, ref tail @ .., _] => (),
-LL + [Enum::Second(true), Enum::Second(false)] => todo!()
+LL ~ [Enum::Second(true), Enum::Second(false)] => todo!(),
|
error[E0004]: non-exhaustive patterns: `((), false)` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:83:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:96:11
|
LL | match ((), false) {
| ^^^^^^^^^^^ pattern `((), false)` not covered
@@ -123,7 +134,7 @@ LL | match ((), false) {
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 ~ ((), true) => (),
-LL + ((), false) => todo!()
+LL ~ ((), false) => todo!(),
|
error: aborting due to 7 previous errors
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
index 7a3e991d5..7603da1bb 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
+++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
@@ -1,6 +1,6 @@
-fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
+fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) {}
//~^ ERROR refutable pattern in function argument
-//~| `(_, _)` not covered
+//~| `(..=0_isize, _)` and `(2_isize.., _)` not covered
fn main() {
let (1, (Some(1), 2..=3)) = (1, (None, 2));
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
index beb51a4d4..e66cd1130 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
+++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
@@ -1,8 +1,8 @@
error[E0005]: refutable pattern in function argument
--> $DIR/refutable-pattern-errors.rs:1:9
|
-LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
- | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) {}
+ | ^^^^^^^^^^^^^^^^^^^^^ patterns `(..=0_isize, _)` and `(2_isize.., _)` not covered
|
= note: the matched value is of type `(isize, (Option<isize>, isize))`
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
index 17dc38ab2..4203dd94d 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
+++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
@@ -1,6 +1,6 @@
fn main() {
let f = |3: isize| println!("hello");
//~^ ERROR refutable pattern in function argument
- //~| `_` not covered
+ //~| `..=2_isize` and `4_isize..` not covered
f(4);
}
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
index ab3f6f69f..01f077909 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
+++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
@@ -2,7 +2,7 @@ error[E0005]: refutable pattern in function argument
--> $DIR/refutable-pattern-in-fn-arg.rs:2:14
|
LL | let f = |3: isize| println!("hello");
- | ^ pattern `_` not covered
+ | ^ patterns `..=2_isize` and `4_isize..` not covered
|
= note: the matched value is of type `isize`
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
diff --git a/tests/ui/pattern/usefulness/slice_of_empty.rs b/tests/ui/pattern/usefulness/slice_of_empty.rs
new file mode 100644
index 000000000..fe0688711
--- /dev/null
+++ b/tests/ui/pattern/usefulness/slice_of_empty.rs
@@ -0,0 +1,22 @@
+#![feature(never_type)]
+#![feature(exhaustive_patterns)]
+#![deny(unreachable_patterns)]
+
+fn main() {}
+
+fn foo(nevers: &[!]) {
+ match nevers {
+ &[] => (),
+ };
+
+ match nevers {
+ &[] => (),
+ &[_] => (), //~ ERROR unreachable pattern
+ &[_, _, ..] => (), //~ ERROR unreachable pattern
+ };
+
+ match nevers {
+ //~^ ERROR non-exhaustive patterns: `&[]` not covered
+ &[_] => (), //~ ERROR unreachable pattern
+ };
+}
diff --git a/tests/ui/pattern/usefulness/slice_of_empty.stderr b/tests/ui/pattern/usefulness/slice_of_empty.stderr
new file mode 100644
index 000000000..07bb6b3a6
--- /dev/null
+++ b/tests/ui/pattern/usefulness/slice_of_empty.stderr
@@ -0,0 +1,39 @@
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:14:9
+ |
+LL | &[_] => (),
+ | ^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/slice_of_empty.rs:3:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:15:9
+ |
+LL | &[_, _, ..] => (),
+ | ^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:20:9
+ |
+LL | &[_] => (),
+ | ^^^^
+
+error[E0004]: non-exhaustive patterns: `&[]` not covered
+ --> $DIR/slice_of_empty.rs:18:11
+ |
+LL | match nevers {
+ | ^^^^^^ pattern `&[]` not covered
+ |
+ = note: the matched value is of type `&[!]`
+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 | &[_] => (), &[] => todo!(),
+ | ++++++++++++++++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
index f944c25a9..f75517fb7 100644
--- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
+++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
@@ -5,13 +5,13 @@ LL | match UnstableEnum::Stable {
| ^^^^^^^^^^^^^^^^^^^^ patterns `UnstableEnum::Stable2` and `_` not covered
|
note: `UnstableEnum` defined here
- --> $DIR/auxiliary/unstable.rs:9:5
+ --> $DIR/auxiliary/unstable.rs:5:1
|
LL | pub enum UnstableEnum {
- | ---------------------
+ | ^^^^^^^^^^^^^^^^^^^^^
...
LL | Stable2,
- | ^^^^^^^ not covered
+ | ------- not covered
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
index 22425aa0d..3d2b540a9 100644
--- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
@@ -5,12 +5,12 @@ LL | match x {
| ^ pattern `A::B { x: Some(_) }` not covered
|
note: `A` defined here
- --> $DIR/struct-like-enum-nonexhaustive.rs:2:5
+ --> $DIR/struct-like-enum-nonexhaustive.rs:1:6
|
LL | enum A {
- | -
+ | ^
LL | B { x: Option<isize> },
- | ^ not covered
+ | - not covered
= note: the matched value is of type `A`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
index 50c7fc889..ef707ed4a 100644
--- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
@@ -1,8 +1,8 @@
-error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `Foo(..=0_isize, _)` and `Foo(3_isize.., _)` not covered
--> $DIR/tuple-struct-nonexhaustive.rs:5:11
|
LL | match x {
- | ^ pattern `Foo(_, _)` not covered
+ | ^ patterns `Foo(..=0_isize, _)` and `Foo(3_isize.., _)` not covered
|
note: `Foo` defined here
--> $DIR/tuple-struct-nonexhaustive.rs:1:8
@@ -10,12 +10,10 @@ 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
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Foo(2, b) => println!("{}", b),
-LL + Foo(_, _) => todo!()
+LL + Foo(..=0_isize, _) | Foo(3_isize.., _) => todo!()
|
error: aborting due to previous error
diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
index d776249b2..4a4945156 100644
--- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
+++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
@@ -5,13 +5,13 @@ LL | match UnstableEnum::Stable {
| ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered
|
note: `UnstableEnum` defined here
- --> $DIR/auxiliary/unstable.rs:11:5
+ --> $DIR/auxiliary/unstable.rs:5:1
|
LL | pub enum UnstableEnum {
- | ---------------------
+ | ^^^^^^^^^^^^^^^^^^^^^
...
LL | Unstable,
- | ^^^^^^^^ not covered
+ | -------- not covered
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/coroutine.rs
index 779bac0ac..3f28e89e3 100644
--- a/tests/ui/polymorphization/generators.rs
+++ b/tests/ui/polymorphization/coroutine.rs
@@ -1,10 +1,10 @@
// build-fail
// compile-flags:-Zpolymorphize=on -Zinline-mir=off
-#![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
+#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)]
//~^ WARN the feature `generic_const_exprs` is incomplete
use std::marker::Unpin;
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
enum YieldOrReturn<Y, R> {
@@ -14,13 +14,13 @@ enum YieldOrReturn<Y, R> {
fn finish<T, Y, R>(mut t: T) -> Vec<YieldOrReturn<Y, R>>
where
- T: Generator<(), Yield = Y, Return = R> + Unpin,
+ T: Coroutine<(), Yield = Y, Return = R> + Unpin,
{
let mut results = Vec::new();
loop {
match Pin::new(&mut t).resume(()) {
- GeneratorState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)),
- GeneratorState::Complete(returned) => {
+ CoroutineState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)),
+ CoroutineState::Complete(returned) => {
results.push(YieldOrReturn::Return(returned));
return results;
}
@@ -28,10 +28,10 @@ where
}
}
-// This test checks that the polymorphization analysis functions on generators.
+// This test checks that the polymorphization analysis functions on coroutines.
#[rustc_polymorphize_error]
-pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
|| {
//~^ ERROR item has unused generic parameters
yield 1;
@@ -40,7 +40,7 @@ pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
}
#[rustc_polymorphize_error]
-pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return = u32> + Unpin {
+pub fn used_type_in_yield<Y: Default>() -> impl Coroutine<(), Yield = Y, Return = u32> + Unpin {
|| {
yield Y::default();
2
@@ -48,7 +48,7 @@ pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return
}
#[rustc_polymorphize_error]
-pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Return = R> + Unpin {
+pub fn used_type_in_return<R: Default>() -> impl Coroutine<(), Yield = u32, Return = R> + Unpin {
|| {
yield 3;
R::default()
@@ -56,7 +56,7 @@ pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Retu
}
#[rustc_polymorphize_error]
-pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
|| {
//~^ ERROR item has unused generic parameters
yield 1;
@@ -65,7 +65,7 @@ pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return =
}
#[rustc_polymorphize_error]
-pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
+pub fn used_const_in_yield<const Y: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin
{
|| {
yield Y;
@@ -74,7 +74,7 @@ pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Re
}
#[rustc_polymorphize_error]
-pub fn used_const_in_return<const R: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
+pub fn used_const_in_return<const R: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin
{
|| {
yield 4;
diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/coroutine.stderr
index 32d49d25f..67b55a598 100644
--- a/tests/ui/polymorphization/generators.stderr
+++ b/tests/ui/polymorphization/coroutine.stderr
@@ -1,24 +1,24 @@
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/generators.rs:3:12
+ --> $DIR/coroutine.rs:3:12
|
-LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
+LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error: item has unused generic parameters
- --> $DIR/generators.rs:35:5
+ --> $DIR/coroutine.rs:35:5
|
-LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+LL | pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
| - generic parameter `T` is unused
LL | || {
| ^^
error: item has unused generic parameters
- --> $DIR/generators.rs:60:5
+ --> $DIR/coroutine.rs:60:5
|
-LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+LL | pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
| ------------ generic parameter `T` is unused
LL | || {
| ^^
diff --git a/tests/ui/print_type_sizes/generator.rs b/tests/ui/print_type_sizes/coroutine.rs
index d1cd36274..aae72e0f3 100644
--- a/tests/ui/print_type_sizes/generator.rs
+++ b/tests/ui/print_type_sizes/coroutine.rs
@@ -2,11 +2,11 @@
// build-pass
// ignore-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Return = ()> {
+fn coroutine<const C: usize>(array: [u8; C]) -> impl Coroutine<Yield = (), Return = ()> {
move |()| {
yield ();
let _ = array;
@@ -14,5 +14,5 @@ fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Retur
}
pub fn foo() {
- let _ = generator([0; 8192]);
+ let _ = coroutine([0; 8192]);
}
diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/coroutine.stdout
index f8c52a595..5d5133955 100644
--- a/tests/ui/print_type_sizes/generator.stdout
+++ b/tests/ui/print_type_sizes/coroutine.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: `{coroutine@$DIR/coroutine.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.rs b/tests/ui/print_type_sizes/coroutine_discr_placement.rs
index 6adc14f9b..78fe75cde 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.rs
+++ b/tests/ui/print_type_sizes/coroutine_discr_placement.rs
@@ -2,10 +2,10 @@
// build-pass
// ignore-pass
-// Tests a generator that has its discriminant as the *final* field.
+// Tests a coroutine that has its discriminant as the *final* field.
// Avoid emitting panic handlers, like the rest of these tests...
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(dropping_copy_types)]
pub fn foo() {
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/coroutine_discr_placement.stdout
index f7bdee111..f34a8e9a7 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.stdout
+++ b/tests/ui/print_type_sizes/coroutine_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: `{coroutine@$DIR/coroutine_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/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index db77a6a72..f038ae9e2 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -23,7 +23,7 @@ mod priv_trait {
let _: <Pub as PrivTr>::AssocTy;
//~^ ERROR associated type `PrivTr::AssocTy` is private
pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- //~^ ERROR trait `PrivTr` is private
+ //~^ ERROR associated type `PrivTr::AssocTy` is private
pub trait InSignatureTr: PrivTr {}
//~^ ERROR trait `PrivTr` is private
impl PrivTr for u8 {}
diff --git a/tests/ui/privacy/associated-item-privacy-trait.stderr b/tests/ui/privacy/associated-item-privacy-trait.stderr
index eb905bf7e..4e9dfa4a8 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.stderr
+++ b/tests/ui/privacy/associated-item-privacy-trait.stderr
@@ -53,11 +53,11 @@ LL | priv_trait::mac!();
|
= note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: trait `PrivTr` is private
+error: associated type `PrivTr::AssocTy` is private
--> $DIR/associated-item-privacy-trait.rs:25:34
|
LL | pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- | ^^^^^^^^^^^^^^^^^^^^^^^^ private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ private associated type
...
LL | priv_trait::mac!();
| ------------------ in this macro invocation
diff --git a/tests/ui/privacy/effective_visibilities.stderr b/tests/ui/privacy/effective_visibilities.stderr
index f74f812e1..41d63532d 100644
--- a/tests/ui/privacy/effective_visibilities.stderr
+++ b/tests/ui/privacy/effective_visibilities.stderr
@@ -45,6 +45,8 @@ error: not in the table
|
LL | struct PrivStruct;
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:25:9
@@ -81,6 +83,8 @@ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImpl
|
LL | A(
| ^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:38:17
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.stderr b/tests/ui/privacy/effective_visibilities_full_priv.stderr
index 29d82e2ee..0577be147 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.stderr
+++ b/tests/ui/privacy/effective_visibilities_full_priv.stderr
@@ -9,6 +9,8 @@ error: not in the table
|
LL | struct Priv;
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
--> $DIR/effective_visibilities_full_priv.rs:13:5
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
index 6f115e78e..653dcab57 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
@@ -2,13 +2,17 @@
mod rank {
pub use self::Professor::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Professor::*`
pub use self::Lieutenant::{JuniorGrade, Full};
//~^ ERROR `JuniorGrade` is private, and cannot be re-exported
//~| ERROR `Full` is private, and cannot be re-exported
+ //~| ERROR unused imports: `Full`, `JuniorGrade`
pub use self::PettyOfficer::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::PettyOfficer::*`
pub use self::Crewman::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Crewman::*`
enum Professor {
Adjunct,
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
index 59b181fab..df5968ba3 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
@@ -1,23 +1,23 @@
error[E0364]: `JuniorGrade` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
|
note: consider marking `JuniorGrade` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
error[E0364]: `Full` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
|
note: consider marking `Full` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
@@ -34,18 +34,42 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
+error: unused import: `self::Professor::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:3:13
+ |
+LL | pub use self::Professor::*;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: unused imports: `Full`, `JuniorGrade`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
+ |
+LL | pub use self::Lieutenant::{JuniorGrade, Full};
+ | ^^^^^^^^^^^ ^^^^
+
error: glob import doesn't reexport anything because no candidate is public enough
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:8:13
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
LL | pub use self::PettyOfficer::*;
| ^^^^^^^^^^^^^^^^^^^^^
-error: glob import doesn't reexport anything because no candidate is public enough
+error: unused import: `self::PettyOfficer::*`
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
+LL | pub use self::PettyOfficer::*;
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: glob import doesn't reexport anything because no candidate is public enough
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
+LL | pub use self::Crewman::*;
+ | ^^^^^^^^^^^^^^^^
+
+error: unused import: `self::Crewman::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
LL | pub use self::Crewman::*;
| ^^^^^^^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr
index ca8f242e0..a3552e146 100644
--- a/tests/ui/privacy/privacy1.stderr
+++ b/tests/ui/privacy/privacy1.stderr
@@ -21,6 +21,7 @@ note: the module `baz` is defined here
|
LL | mod baz {
| ^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:141:18
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 6497b7ff5..ac7e5547d 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -246,7 +246,7 @@ error: trait `traits_where::PrivTr` is more private than the item `traits_where:
--> $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)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index f54f9e38f..3fff2d517 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -104,8 +104,8 @@ mod aliases_pub {
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ 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`
+ //~^ WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ //~| WARNING associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
impl PrivUseAlias {
pub fn f(arg: Priv) {}
@@ -133,8 +133,8 @@ mod aliases_priv {
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) {}
- //~^ 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`
+ //~^ WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ //~| WARNING associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
}
mod aliases_params {
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index d8f9fd007..49cc2e19b 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -208,7 +208,7 @@ warning: trait `traits_where::PrivTr` is more private than the item `traits_wher
--> $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)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
@@ -276,17 +276,17 @@ note: but type `impls::Priv` is only usable at visibility `pub(self)`
LL | struct Priv;
| ^^^^^^^^^^^
-warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+warning: associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+note: but associated type `aliases_pub::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:101:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = m::Pub3;
+ | ^^^^^^^^^^
warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
@@ -324,17 +324,17 @@ note: but type `Priv2` is only usable at visibility `pub(self)`
LL | struct Priv2;
| ^^^^^^^^^^^^
-warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+warning: associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
+note: but associated type `aliases_priv::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:129:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = Priv3;
+ | ^^^^^^^^^^
warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
diff --git a/tests/ui/privacy/private-variant-reexport.rs b/tests/ui/privacy/private-variant-reexport.rs
index 688284460..b59243af6 100644
--- a/tests/ui/privacy/private-variant-reexport.rs
+++ b/tests/ui/privacy/private-variant-reexport.rs
@@ -12,7 +12,9 @@ mod m3 {
#[deny(unused_imports)]
mod m4 {
- pub use ::E::*; //~ ERROR glob import doesn't reexport anything
+ pub use ::E::*;
+ //~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `::E::*`
}
enum E { V }
diff --git a/tests/ui/privacy/private-variant-reexport.stderr b/tests/ui/privacy/private-variant-reexport.stderr
index 78771ee30..2f041934a 100644
--- a/tests/ui/privacy/private-variant-reexport.stderr
+++ b/tests/ui/privacy/private-variant-reexport.stderr
@@ -42,7 +42,13 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
-error: aborting due to 4 previous errors
+error: unused import: `::E::*`
+ --> $DIR/private-variant-reexport.rs:15:13
+ |
+LL | pub use ::E::*;
+ | ^^^^^^
+
+error: aborting due to 5 previous errors
Some errors have detailed explanations: E0364, E0365.
For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
index 778ddf0f8..9ae01259a 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
@@ -13,7 +13,43 @@ pub mod a {
}
}
-struct S;
-impl a::Sealed for S {} //~ ERROR the trait bound `S: Hidden` is not satisfied
+pub mod c {
+ pub trait Sealed: self::d::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl Sealed for X {}
+ impl self::d::Hidden for X {}
+
+ struct Y;
+ impl Sealed for Y {}
+ impl self::d::Hidden for Y {}
+
+ mod d {
+ pub trait Hidden {}
+ }
+}
+pub mod e {
+ pub trait Sealed: self::f::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl self::f::Hidden for X {}
+
+ struct Y;
+ impl self::f::Hidden for Y {}
+ impl<T: self::f::Hidden> Sealed for T {}
+
+ mod f {
+ pub trait Hidden {}
+ }
+}
+
+struct S;
+impl a::Sealed for S {} //~ ERROR the trait bound
+impl c::Sealed for S {} //~ ERROR the trait bound
+impl e::Sealed for S {} //~ ERROR the trait bound
fn main() {}
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
index 5f8076fc8..a7f77a1c0 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
@@ -1,16 +1,50 @@
-error[E0277]: the trait bound `S: Hidden` is not satisfied
- --> $DIR/sealed-trait-local.rs:17:20
+error[E0277]: the trait bound `S: b::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:52:20
|
LL | impl a::Sealed for S {}
- | ^ the trait `Hidden` is not implemented for `S`
+ | ^ the trait `b::Hidden` is not implemented for `S`
|
-note: required by a bound in `Sealed`
+note: required by a bound in `a::Sealed`
--> $DIR/sealed-trait-local.rs:3:23
|
LL | pub trait Sealed: self::b::Hidden {
| ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
= note: `Sealed` is a "sealed trait", because to implement it you also need to implement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following type implements the trait:
+ a::X
-error: aborting due to previous error
+error[E0277]: the trait bound `S: d::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:53:20
+ |
+LL | impl c::Sealed for S {}
+ | ^ the trait `d::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `c::Sealed`
+ --> $DIR/sealed-trait-local.rs:17:23
+ |
+LL | pub trait Sealed: self::d::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `c::d::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ c::X
+ c::Y
+
+error[E0277]: the trait bound `S: f::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:54:20
+ |
+LL | impl e::Sealed for S {}
+ | ^ the trait `f::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `e::Sealed`
+ --> $DIR/sealed-trait-local.rs:35:23
+ |
+LL | pub trait Sealed: self::f::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `e::f::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ e::X
+ e::Y
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/privacy/suggest-box-new.fixed b/tests/ui/privacy/suggest-box-new.fixed
new file mode 100644
index 000000000..f5ae5c2ab
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.fixed
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box::new(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.rs b/tests/ui/privacy/suggest-box-new.rs
new file mode 100644
index 000000000..2e18dba8b
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr
new file mode 100644
index 000000000..ed7fa0364
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.stderr
@@ -0,0 +1,20 @@
+error[E0423]: cannot initialize a tuple struct which contains private fields
+ --> $DIR/suggest-box-new.rs:9:19
+ |
+LL | wtf: Some(Box(U {
+ | ^^^
+ |
+note: constructor is not visible here due to private fields
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ |
+ = note: private field
+ |
+ = note: private field
+help: you might have meant to use the `new` associated function
+ |
+LL | wtf: Some(Box::new(U {
+ | +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index dcc249c63..650766458 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -41,8 +41,11 @@ LL | struct PrivTy;
warning: type `PrivTy` is more private than the item `S`
--> $DIR/where-priv-type.rs:39:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PrivTy:
+ | |___________^ implementation `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
--> $DIR/where-priv-type.rs:8:1
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 c47687433..ee79ce3f5 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -41,8 +41,11 @@ LL | trait PrivTr {}
warning: trait `PrivTr` is more private than the item `S`
--> $DIR/where-pub-type-impls-priv-trait.rs:41:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PubTy: PrivTr
+ | |_________________^ 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:10:1
diff --git a/tests/ui/proc-macro/bad-projection.rs b/tests/ui/proc-macro/bad-projection.rs
index d214c7ac8..c7cffdc9b 100644
--- a/tests/ui/proc-macro/bad-projection.rs
+++ b/tests/ui/proc-macro/bad-projection.rs
@@ -13,3 +13,5 @@ trait Project {
#[proc_macro]
pub fn uwu() -> <() as Project>::Assoc {}
//~^ ERROR the trait bound `(): Project` is not satisfied
+//~| ERROR the trait bound `(): Project` is not satisfied
+//~| ERROR function is expected to take 1 argument, but it takes 0 arguments
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8716defa1..aea5d6d7c 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -10,6 +10,32 @@ help: this trait has no implementations, consider adding one
LL | trait Project {
| ^^^^^^^^^^^^^
-error: aborting due to previous error
+error[E0593]: function is expected to take 1 argument, but it takes 0 arguments
+ --> $DIR/bad-projection.rs:14:1
+ |
+LL | pub fn uwu() -> <() as Project>::Assoc {}
+ | --------------------------------------^^^
+ | |
+ | expected function that takes 1 argument
+ | takes 0 arguments
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `ProcMacro::bang`
+ --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
+
+error[E0277]: the trait bound `(): Project` is not satisfied
+ --> $DIR/bad-projection.rs:14:1
+ |
+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 3 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0593.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/proc-macro/issue-37788.stderr b/tests/ui/proc-macro/issue-37788.stderr
index e437bb90b..0a116d6f8 100644
--- a/tests/ui/proc-macro/issue-37788.stderr
+++ b/tests/ui/proc-macro/issue-37788.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-37788.rs:8:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
LL | std::cell::Cell::new(0)
| ^^^^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;`
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.rs b/tests/ui/proc-macro/issue-75930-derive-cfg.rs
index ef56e8e02..e0213527c 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.rs
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.rs
@@ -16,6 +16,36 @@ extern crate std;
#[macro_use]
extern crate test_macros;
+// Note: the expected output contains this sequence:
+// ```
+// Punct {
+// ch: '<',
+// spacing: Joint,
+// span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+// },
+// Ident {
+// ident: "B",
+// span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+// },
+// ```
+// It's surprising to see a `Joint` token tree followed by an `Ident` token
+// tree, because `Joint` is supposed to only be used if the following token is
+// `Punct`.
+//
+// It is because of this code from below:
+// ```
+// struct Foo<#[cfg(FALSE)] A, B>
+// ```
+// When the token stream is formed during parsing, `<` is followed immediately
+// by `#`, which is punctuation, so it is marked `Joint`. But before being
+// passed to the proc macro it is rewritten to this:
+// ```
+// struct Foo<B>
+// ```
+// But the `Joint` marker on the `<` is not updated. Perhaps it should be
+// corrected before being passed to the proc macro? But a prior attempt to do
+// that kind of correction caused the problem seen in #76399, so maybe not.
+
#[print_helper(a)] //~ WARN derive helper attribute is used before it is introduced
//~| WARN this was previously accepted
#[cfg_attr(not(FALSE), allow(dead_code))]
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
index 6d1efb0dc..1017745de 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
@@ -1,5 +1,5 @@
warning: derive helper attribute is used before it is introduced
- --> $DIR/issue-75930-derive-cfg.rs:19:3
+ --> $DIR/issue-75930-derive-cfg.rs:49:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | #[derive(Print)]
= note: `#[warn(legacy_derive_helpers)]` on by default
warning: derive helper attribute is used before it is introduced
- --> $DIR/issue-75930-derive-cfg.rs:19:3
+ --> $DIR/issue-75930-derive-cfg.rs:49:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
@@ -22,6 +22,7 @@ LL | #[derive(Print)]
|
= 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 #79202 <https://github.com/rust-lang/rust/issues/79202>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 2 warnings emitted
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
index 83afd0d3e..31a1c44b6 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
@@ -26,158 +26,158 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:19:1: 19:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:19:3: 19:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:19:16: 19:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:15: 19:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:2: 19:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:21:24: 21:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:21:30: 21:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:29: 21:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:23:1: 23:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:1: 53:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "derive",
- span: $DIR/issue-75930-derive-cfg.rs:23:3: 23:9 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:3: 53:9 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "Print",
- span: $DIR/issue-75930-derive-cfg.rs:23:10: 23:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:10: 53:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:9: 23:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:9: 53:16 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:2: 23:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:2: 53:17 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:1: 24:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:24:3: 24:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:2: 24:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:25:1: 25:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:25:8: 25:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0),
},
Punct {
ch: '<',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:12: 25:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:12: 55:13 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:25:14: 25:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:14: 55:17 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:25:18: 25:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:18: 55:23 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:17: 25:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:17: 55:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:13: 25:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:13: 55:25 (#0),
},
Ident {
ident: "A",
- span: $DIR/issue-75930-derive-cfg.rs:25:26: 25:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:26: 55:27 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:27: 25:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:27: 55:28 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:30: 25:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0),
},
Group {
delimiter: Brace,
@@ -185,128 +185,128 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:5: 26:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:5: 56:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:26:7: 26:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:7: 56:10 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:26:11: 26:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:11: 56:16 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:10: 26:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:10: 56:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:6: 26:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:6: 56:18 (#0),
},
Ident {
ident: "first",
- span: $DIR/issue-75930-derive-cfg.rs:26:19: 26:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:19: 56:24 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:24: 26:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:24: 56:25 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:26:26: 26:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:26: 56:32 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:32: 26:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:32: 56:33 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:5: 27:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:5: 57:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:27:7: 27:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:7: 57:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:27:16: 27:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:21 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:21: 27:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:21: 57:22 (#0),
},
Ident {
ident: "deny",
- span: $DIR/issue-75930-derive-cfg.rs:27:23: 27:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:23: 57:27 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:27:28: 27:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:28: 57:36 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:27: 27:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:27: 57:37 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:15: 27:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:38 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:6: 27:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:6: 57:39 (#0),
},
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:46: 27:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:27:48: 27:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:52: 27:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:28:5: 28:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:28:13: 28:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0),
},
Group {
delimiter: Brace,
@@ -314,145 +314,145 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:29:9: 29:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:9: 59:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:29:11: 29:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:11: 59:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:29:15: 29:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:29:14: 29:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:29:10: 29:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:22 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:29:23: 29:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:29 (#0),
},
Ident {
ident: "Bar",
- span: $DIR/issue-75930-derive-cfg.rs:29:30: 29:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:30: 59:33 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:29:33: 29:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:33: 59:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:9: 30:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:30:11: 30:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:30:15: 30:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:30:19: 30:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:18: 30:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:14: 30:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:10: 30:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:30:28: 30:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0),
},
Ident {
ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:40: 30:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:9: 31:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:31:11: 31:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:11: 61:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:31:15: 31:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:15: 61:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:31:14: 31:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:14: 61:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:31:10: 31:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:10: 61:22 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:31:23: 31:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:23: 61:26 (#0),
},
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:31:27: 31:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:27: 61:28 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:29: 31:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:29: 61:30 (#0),
},
Literal {
kind: Integer,
symbol: "25",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:31:31: 31:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:31: 61:33 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:33: 31:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:33: 61:34 (#0),
},
Ident {
ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:32:9: 32:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0),
},
Group {
delimiter: Brace,
@@ -460,194 +460,194 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:13: 33:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:33:15: 33:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:15: 63:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:33:19: 33:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:19: 63:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:33:18: 33:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:18: 63:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:33:14: 33:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:26 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:33:27: 33:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:27: 63:31 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:32: 63:33 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:33: 33:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:33: 63:34 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:33:35: 33:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:35: 63:37 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:37: 33:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:37: 63:38 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:34:15: 34:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:15: 64:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:34:24: 34:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:24: 64:27 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:34:28: 34:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:27: 34:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:27: 64:34 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:34: 34:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:34: 64:35 (#0),
},
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:34:36: 34:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:34:42: 34:50 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:41: 34:51 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:23: 34:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:23: 64:52 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:14: 34:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:14: 64:53 (#0),
},
Ident {
ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:34:54: 34:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:34:63: 34:65 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:65: 34:66 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0),
},
Ident {
ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:35:13: 35:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:35:18: 35:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:32:20: 36:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:36:10: 36:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:38:9: 38:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:38:11: 38:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:11: 68:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "should_be_removed",
- span: $DIR/issue-75930-derive-cfg.rs:38:24: 38:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:24: 68:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:38:23: 38:42 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:23: 68:42 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:38:10: 38:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:10: 68:43 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:39:9: 39:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:9: 69:11 (#0),
},
Ident {
ident: "removed_fn",
- span: $DIR/issue-75930-derive-cfg.rs:39:12: 39:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:12: 69:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:39:22: 39:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:22: 69:24 (#0),
},
Group {
delimiter: Brace,
@@ -655,108 +655,108 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:40:13: 40:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:13: 70:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:40:14: 40:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:14: 70:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:40:16: 40:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:16: 70:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:40:20: 40:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:19: 40:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:15: 40:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:15: 70:27 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:39:25: 41:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:25: 71:10 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:9: 43:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:43:11: 43:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:43:24: 43:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:23: 43:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:10: 43:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:28: 43:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:43:30: 43:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:43:34: 43:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:43:38: 43:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:37: 43:44 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:33: 43:45 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:29: 43:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:47: 43:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0),
},
Ident {
ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:50: 43:57 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:43:57: 43:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0),
},
Group {
delimiter: Brace,
@@ -764,82 +764,82 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:44:13: 44:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:44:14: 44:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:44:16: 44:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:44:20: 44:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:44:24: 44:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:23: 44:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:19: 44:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:15: 44:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:45:13: 45:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:45:17: 45:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:24: 45:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:45:26: 45:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:30: 45:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:60: 46:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:48:9: 48:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:48:14: 48:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:49:13: 49:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0),
},
Group {
delimiter: Parenthesis,
@@ -847,166 +847,166 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:50:17: 50:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:17: 80:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:50:19: 50:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:19: 80:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:50:23: 50:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:50:22: 50:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:22: 80:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:50:18: 50:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:18: 80:30 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:50:31: 50:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:31: 80:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:50:33: 50:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:33: 80:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:51:17: 51:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:17: 81:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:51:19: 51:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:19: 81:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:51:23: 51:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:23: 81:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:51:22: 51:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:22: 81:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:51:18: 51:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:18: 81:30 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:51:31: 51:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:31: 81:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:51:35: 51:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:35: 81:36 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:17: 52:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:52:19: 52:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:52:23: 52:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:52:27: 52:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:26: 52:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:22: 52:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:18: 52:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:52:36: 52:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:39: 52:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:53:17: 53:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:17: 83:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:53:19: 53:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:19: 83:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:53:23: 53:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:23: 83:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:53:22: 53:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:22: 83:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:53:18: 53:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:18: 83:30 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:53:31: 53:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:31: 83:37 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:53:37: 53:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:37: 83:38 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:53:39: 53:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:49:16: 54:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:48:24: 55:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:57:9: 57:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1014,139 +1014,139 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:13: 88:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:15: 88:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:58:19: 58:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:19: 88:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:58:18: 58:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:18: 88:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:58:14: 58:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:14: 88:26 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:58:27: 58:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:27: 88:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:58:33: 58:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:33: 88:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:13: 59:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:22: 59:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:59:32: 59:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:60:13: 60:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:13: 90:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:15: 90:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:19: 90:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:18: 90:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:14: 90:26 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:60:27: 60:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:27: 90:31 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:60:31: 60:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:31: 90:32 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:61:13: 61:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:27: 62:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:62:10: 62:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:64:9: 64:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:9: 94:11 (#0),
},
Ident {
ident: "plain_removed_fn",
- span: $DIR/issue-75930-derive-cfg.rs:64:12: 64:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:12: 94:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:28: 94:30 (#0),
},
Group {
delimiter: Brace,
@@ -1154,122 +1154,122 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:13: 95:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:65:14: 65:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:14: 95:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:16: 95:24 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:65:25: 65:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:25: 95:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:65:29: 65:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:29: 95:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:28: 65:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:28: 95:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:65:35: 65:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:35: 95:36 (#0),
},
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:65:37: 65:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:37: 95:40 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:65:41: 65:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:41: 95:46 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:40: 65:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:40: 95:47 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:24: 65:48 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:24: 95:48 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:15: 95:49 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:64:31: 66:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:31: 96:10 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:17: 69:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:12: 69:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:69:7: 69:8 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:70:5: 70:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:70:7: 70:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:6: 70:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:71:5: 71:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:71:11: 71:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:71:13: 71:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:32: 72:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0),
},
]
PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_helper(b)] struct Foo < B >
@@ -1289,141 +1289,141 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:19:1: 19:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:19:3: 19:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:19:16: 19:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:15: 19:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:2: 19:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:21:24: 21:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:21:30: 21:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:29: 21:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:1: 24:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:24:3: 24:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:2: 24:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:25:1: 25:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:25:8: 25:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0),
},
Punct {
ch: '<',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:30: 25:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:46: 27:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:27:48: 27:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:52: 27:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:28:5: 28:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:28:13: 28:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0),
},
Group {
delimiter: Brace,
@@ -1431,58 +1431,58 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:9: 30:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:30:11: 30:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:30:15: 30:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:30:19: 30:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:18: 30:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:14: 30:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:10: 30:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:30:28: 30:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0),
},
Ident {
ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:40: 30:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0),
},
Ident {
ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:32:9: 32:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0),
},
Group {
delimiter: Brace,
@@ -1490,151 +1490,151 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:34:36: 34:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:34:42: 34:50 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:41: 34:51 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Ident {
ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:34:54: 34:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:34:63: 34:65 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:65: 34:66 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0),
},
Ident {
ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:35:13: 35:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:35:18: 35:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:32:20: 36:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:36:10: 36:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:9: 43:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:43:11: 43:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:43:24: 43:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:23: 43:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:10: 43:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:28: 43:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:43:30: 43:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:43:34: 43:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:43:38: 43:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:37: 43:44 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:33: 43:45 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:29: 43:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:47: 43:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0),
},
Ident {
ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:50: 43:57 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:43:57: 43:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0),
},
Group {
delimiter: Brace,
@@ -1642,82 +1642,82 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:44:13: 44:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:44:14: 44:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:44:16: 44:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:44:20: 44:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:44:24: 44:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:23: 44:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:19: 44:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:15: 44:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:45:13: 45:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:45:17: 45:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:24: 45:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:45:26: 45:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:30: 45:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:60: 46:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:48:9: 48:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:48:14: 48:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:49:13: 49:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1725,64 +1725,64 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:17: 52:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:52:19: 52:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:52:23: 52:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:52:27: 52:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:26: 52:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:22: 52:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:18: 52:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:52:36: 52:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:39: 52:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:53:39: 53:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:49:16: 54:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:48:24: 55:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:57:9: 57:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1790,115 +1790,115 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:13: 59:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:22: 59:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:59:32: 59:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:61:13: 61:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:27: 62:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:62:10: 62:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:17: 69:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:12: 69:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:69:7: 69:8 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:70:5: 70:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:70:7: 70:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:6: 70:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:71:5: 71:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:71:11: 71:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:71:13: 71:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:32: 72:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0),
},
]
diff --git a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
index b9effe7cf..047112406 100644
--- a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
+++ b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
@@ -143,6 +143,7 @@ LL | #[derive(my_macro)]
| ^^^^^^^^
|
= note: `my_macro` is in scope, but it is a function-like macro
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 20 previous errors
diff --git a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr b/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
index 873054927..118882f73 100644
--- a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
+++ b/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
@@ -18,6 +18,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -28,6 +29,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -38,6 +40,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -58,6 +61,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -68,6 +72,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -78,6 +83,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 8 previous errors
diff --git a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr b/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
index 873054927..118882f73 100644
--- a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
+++ b/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
@@ -18,6 +18,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -28,6 +29,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -38,6 +40,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -58,6 +61,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -68,6 +72,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -78,6 +83,7 @@ LL | enum ProceduralMasqueradeDummyType {
= 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 #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 8 previous errors
diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr
index 3c3f24d0f..e7639f474 100644
--- a/tests/ui/proc-macro/resolve-error.stderr
+++ b/tests/ui/proc-macro/resolve-error.stderr
@@ -44,6 +44,8 @@ error: cannot find derive macro `attr_proc_macra` in this scope
|
LL | #[derive(attr_proc_macra)]
| ^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Dlona` in this scope
--> $DIR/resolve-error.rs:40:10
@@ -66,6 +68,8 @@ LL | #[derive(Dlona)]
|
LL | pub fn derive_clonea(input: TokenStream) -> TokenStream {
| ------------------------------------------------------- similarly named derive macro `Clona` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Dlone` in this scope
--> $DIR/resolve-error.rs:35:10
@@ -84,6 +88,8 @@ LL | #[derive(Dlone)]
--> $SRC_DIR/core/src/clone.rs:LL:COL
|
= note: similarly named derive macro `Clone` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find attribute `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:32:3
@@ -123,6 +129,8 @@ LL | #[derive(FooWithLongNan)]
|
LL | pub fn derive_foo(input: TokenStream) -> TokenStream {
| ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 14 previous errors
diff --git a/tests/ui/proc-macro/resolved-located-at.stderr b/tests/ui/proc-macro/resolved-located-at.stderr
index 0b4dbcba6..a4f838521 100644
--- a/tests/ui/proc-macro/resolved-located-at.stderr
+++ b/tests/ui/proc-macro/resolved-located-at.stderr
@@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/resolved-located-at.rs:7:27
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | resolve_located_at!(a b)
| ^ expected `()`, found `S`
|
diff --git a/tests/ui/proc-macro/span-preservation.stderr b/tests/ui/proc-macro/span-preservation.stderr
index 8c15cb9de..3ad9c539f 100644
--- a/tests/ui/proc-macro/span-preservation.stderr
+++ b/tests/ui/proc-macro/span-preservation.stderr
@@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:39:5
|
LL | extern "C" fn bar() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -46,7 +46,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:44:5
|
LL | extern "C" fn baz() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -54,7 +54,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:49:5
|
LL | extern "Rust" fn rust_abi() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -62,7 +62,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:54:5
|
LL | extern "\x43" fn c_abi_escaped() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
index 4f3f9d1eb..21f1fdba8 100644
--- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
+++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
@@ -2,13 +2,13 @@ error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14
|
LL | 251..257 => {}
- | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:7:15
|
LL | 251..=256 => {}
- | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
error: aborting due to 2 previous errors
diff --git a/tests/ui/reachable/reachable-unnameable-type-alias.rs b/tests/ui/reachable/reachable-unnameable-type-alias.rs
index 461355f87..ce830d2d4 100644
--- a/tests/ui/reachable/reachable-unnameable-type-alias.rs
+++ b/tests/ui/reachable/reachable-unnameable-type-alias.rs
@@ -1,14 +1,14 @@
// run-pass
#![feature(staged_api)]
-#![stable(feature = "a", since = "b")]
+#![stable(feature = "a", since = "3.3.3")]
mod inner_private_module {
// UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here
pub type UnnameableTypeAlias = u8;
}
-#[stable(feature = "a", since = "b")]
+#[stable(feature = "a", since = "3.3.3")]
pub fn f() -> inner_private_module::UnnameableTypeAlias {
0
}
diff --git a/tests/ui/recursion_limit/empty.stderr b/tests/ui/recursion_limit/empty.stderr
index cb5c0c35a..2f7306775 100644
--- a/tests/ui/recursion_limit/empty.stderr
+++ b/tests/ui/recursion_limit/empty.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = ""]
| ^^^^^^^^^^^^^^^^^^^^^--^
| |
| `limit` must be a non-negative integer
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/recursion_limit/invalid_digit.stderr b/tests/ui/recursion_limit/invalid_digit.stderr
index 4dc93ad5f..4fda30390 100644
--- a/tests/ui/recursion_limit/invalid_digit.stderr
+++ b/tests/ui/recursion_limit/invalid_digit.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = "-100"]
| ^^^^^^^^^^^^^^^^^^^^^------^
| |
| not a valid integer
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/recursion_limit/overflow.stderr b/tests/ui/recursion_limit/overflow.stderr
index 2f622d28b..6057177de 100644
--- a/tests/ui/recursion_limit/overflow.stderr
+++ b/tests/ui/recursion_limit/overflow.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = "999999999999999999999999"]
| ^^^^^^^^^^^^^^^^^^^^^--------------------------^
| |
| `limit` is too large
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/regions/closure-in-projection-issue-97405.rs b/tests/ui/regions/closure-in-projection-issue-97405.rs
index e567d5c27..548953397 100644
--- a/tests/ui/regions/closure-in-projection-issue-97405.rs
+++ b/tests/ui/regions/closure-in-projection-issue-97405.rs
@@ -1,5 +1,5 @@
// Regression test for #97405.
-// In `good_generic_fn` the param `T` ends up in the substs of closures/generators,
+// In `good_generic_fn` the param `T` ends up in the substs of closures/coroutines,
// but we should be able to prove `<Gen<T> as Iterator>::Item: 'static` without
// requiring `T: 'static`
diff --git a/tests/ui/regions/closure-in-projection-issue-97405.stderr b/tests/ui/regions/closure-in-projection-issue-97405.stderr
index c08f1059e..7070dfef1 100644
--- a/tests/ui/regions/closure-in-projection-issue-97405.stderr
+++ b/tests/ui/regions/closure-in-projection-issue-97405.stderr
@@ -3,27 +3,33 @@ error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not li
|
LL | assert_static(opaque(async move { t; }).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough
--> $DIR/closure-in-projection-issue-97405.rs:26:5
|
LL | assert_static(opaque(move || { t; }).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough
--> $DIR/closure-in-projection-issue-97405.rs:28:5
|
LL | assert_static(opaque(opaque(async move { t; }).next()).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error: aborting due to 3 previous errors
diff --git a/tests/ui/regions/regions-close-associated-type-into-object.stderr b/tests/ui/regions/regions-close-associated-type-into-object.stderr
index f7dcaa9d9..6fb514377 100644
--- a/tests/ui/regions/regions-close-associated-type-into-object.stderr
+++ b/tests/ui/regions/regions-close-associated-type-into-object.stderr
@@ -3,36 +3,56 @@ error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
+ | |
+ | the associated type `<T as Iter>::Item` must be valid for the static lifetime...
+ | ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bad1<T: Iter>(v: T) -> Box<dyn X + 'static> where <T as Iter>::Item: 'static
+ | ++++++++++++++++++++++++++++++++
error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:22:5
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
+ | |
+ | the associated type `<T as Iter>::Item` must be valid for the static lifetime...
+ | ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+LL | where Box<T::Item> : X, <T as Iter>::Item: 'static
+ | ++++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:28:5
|
+LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
+ | -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(item)
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a> where <T as Iter>::Item: 'a
+ | +++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:35:5
|
+LL | fn bad4<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
+ | -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(item)
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+LL | where Box<T::Item> : X, <T as Iter>::Item: 'a
+ | +++++++++++++++++++++++
error: aborting due to 4 previous errors
diff --git a/tests/ui/regions/regions-close-object-into-object-4.stderr b/tests/ui/regions/regions-close-object-into-object-4.stderr
index 7a9f1ab00..b8b414b7e 100644
--- a/tests/ui/regions/regions-close-object-into-object-4.stderr
+++ b/tests/ui/regions/regions-close-object-into-object-4.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -24,9 +30,13 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -61,9 +71,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:14
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
diff --git a/tests/ui/regions/regions-close-object-into-object-5.stderr b/tests/ui/regions/regions-close-object-into-object-5.stderr
index 311e8868c..4a2f4f847 100644
--- a/tests/ui/regions/regions-close-object-into-object-5.stderr
+++ b/tests/ui/regions/regions-close-object-into-object-5.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -24,9 +30,13 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -44,9 +54,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:14
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
diff --git a/tests/ui/regions/regions-close-over-type-parameter-1.stderr b/tests/ui/regions/regions-close-over-type-parameter-1.stderr
index b7b557d7a..1cd5b7f22 100644
--- a/tests/ui/regions/regions-close-over-type-parameter-1.stderr
+++ b/tests/ui/regions/regions-close-over-type-parameter-1.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/regions-close-over-type-parameter-1.rs:11:5
|
LL | Box::new(v) as Box<dyn SomeTrait + 'static>
- | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'static> {
| +++++++++
@@ -12,10 +15,12 @@ LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'stati
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-close-over-type-parameter-1.rs:20:5
|
+LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'b> {
+ | -- the parameter type `A` must be valid for the lifetime `'b` as defined here...
LL | Box::new(v) as Box<dyn SomeTrait + 'b>
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a + 'b>(v: A) -> Box<dyn SomeTrait + 'b> {
| ++++
diff --git a/tests/ui/regions/regions-close-param-into-object.stderr b/tests/ui/regions/regions-close-param-into-object.stderr
index 9162be5b9..385441d32 100644
--- a/tests/ui/regions/regions-close-param-into-object.stderr
+++ b/tests/ui/regions/regions-close-param-into-object.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:6:5
|
LL | Box::new(v)
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | where T : X + 'static
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:12:5
|
LL | Box::new(v)
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
| +++++++++
@@ -23,10 +29,13 @@ LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:18:5
|
+LL | fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(v)
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | where T : X + 'a
| ++++
@@ -34,10 +43,13 @@ LL | where T : X + 'a
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:24:5
|
+LL | fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(v)
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn p4<'a,T: 'a>(v: Box<T>) -> Box<dyn X + 'a>
| ++++
diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
index 7c9f40556..8c1791fc1 100644
--- a/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
+++ b/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5
|
+LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
+ | -- the parameter type `T` must be valid for the lifetime `'x` as defined here...
+LL | {
LL | wf::<&'x T>();
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn func<'x, T:Trait1<'x> + 'x>(t: &'x T::Foo)
| ++++
diff --git a/tests/ui/regions/regions-infer-bound-from-trait-self.stderr b/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
index e88f79a3a..d0c4b9a57 100644
--- a/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
+++ b/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
@@ -1,11 +1,16 @@
error[E0309]: the parameter type `Self` may not live long enough
--> $DIR/regions-infer-bound-from-trait-self.rs:46:9
|
+LL | trait InheritsFromNothing<'a> : Sized {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, x: Inv<'a>) {
LL | check_bound(x, self)
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the type `Self` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | trait InheritsFromNothing<'a> : Sized where Self: 'a {
+ | ++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/regions/regions-infer-bound-from-trait.stderr b/tests/ui/regions/regions-infer-bound-from-trait.stderr
index 3ee71543d..b9be11a46 100644
--- a/tests/ui/regions/regions-infer-bound-from-trait.stderr
+++ b/tests/ui/regions/regions-infer-bound-from-trait.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-infer-bound-from-trait.rs:33:5
|
+LL | fn bar1<'a,A>(x: Inv<'a>, a: A) {
+ | -- the parameter type `A` must be valid for the lifetime `'a` as defined here...
LL | check_bound(x, a)
| ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar1<'a,A: 'a>(x: Inv<'a>, a: A) {
| ++++
@@ -12,10 +14,12 @@ LL | fn bar1<'a,A: 'a>(x: Inv<'a>, a: A) {
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-infer-bound-from-trait.rs:37:5
|
+LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) {
+ | -- the parameter type `A` must be valid for the lifetime `'a` as defined here...
LL | check_bound(x, a)
| ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar2<'a,'b,A:Is<'b> + 'a>(x: Inv<'a>, y: Inv<'b>, a: A) {
| ++++
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index d4fea2b19..987fd455f 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -8,7 +8,7 @@
#![feature(no_core, lang_items, intrinsics, staged_api, rustc_attrs)]
#![no_core]
#![crate_type = "lib"]
-#![stable(feature = "", since = "")]
+#![stable(feature = "intrinsics_for_test", since = "3.3.3")]
#![allow(dead_code)]
// Test that the repr(C) attribute doesn't break compilation
@@ -22,8 +22,8 @@ enum Foo {
}
extern "rust-intrinsic" {
- #[stable(feature = "", since = "")]
- #[rustc_const_stable(feature = "", since = "")]
+ #[stable(feature = "intrinsics_for_test", since = "3.3.3")]
+ #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")]
#[rustc_safe_intrinsic]
fn size_of<T>() -> usize;
}
diff --git a/tests/ui/repr/repr-align-assign.stderr b/tests/ui/repr/repr-align-assign.stderr
index b878ae0d1..3606d0221 100644
--- a/tests/ui/repr/repr-align-assign.stderr
+++ b/tests/ui/repr/repr-align-assign.stderr
@@ -15,12 +15,16 @@ error[E0693]: incorrect `repr(align)` attribute format
|
LL | #[repr(align=8)]
| ^^^^^^^ help: use parentheses instead: `align(8)`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0693]: incorrect `repr(align)` attribute format
--> $DIR/repr-align-assign.rs:9:8
|
LL | #[repr(align="8")]
| ^^^^^^^^^ help: use parentheses instead: `align(8)`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/repr/repr-align.stderr b/tests/ui/repr/repr-align.stderr
index 900a811bb..84d33a08a 100644
--- a/tests/ui/repr/repr-align.stderr
+++ b/tests/ui/repr/repr-align.stderr
@@ -39,36 +39,48 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
LL | #[repr(align(16.0))]
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:7:8
|
LL | #[repr(align(15))]
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
--> $DIR/repr-align.rs:11:8
|
LL | #[repr(align(4294967296))]
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
--> $DIR/repr-align.rs:18:8
|
LL | #[repr(align(16.0))]
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:22:8
|
LL | #[repr(align(15))]
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
--> $DIR/repr-align.rs:26:8
|
LL | #[repr(align(4294967296))]
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 12 previous errors
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.rs b/tests/ui/resolve/fn-new-doesnt-exist.rs
new file mode 100644
index 000000000..4f6290808
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.rs
@@ -0,0 +1,5 @@
+use std::net::TcpStream;
+
+fn main() {
+ let stream = TcpStream::new(); //~ ERROR no function or associated item named `new` found
+}
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.stderr b/tests/ui/resolve/fn-new-doesnt-exist.stderr
new file mode 100644
index 000000000..39adc0fde
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.stderr
@@ -0,0 +1,14 @@
+error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope
+ --> $DIR/fn-new-doesnt-exist.rs:4:28
+ |
+LL | let stream = TcpStream::new();
+ | ^^^ function or associated item not found in `TcpStream`
+ |
+note: if you're trying to build a new `TcpStream` consider using one of the following associated functions:
+ TcpStream::connect
+ TcpStream::connect_timeout
+ --> $SRC_DIR/std/src/net/tcp.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/resolve/issue-116164.rs b/tests/ui/resolve/issue-116164.rs
new file mode 100644
index 000000000..d30c8f514
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.rs
@@ -0,0 +1,19 @@
+#![allow(unused_imports)]
+
+mod inner {
+ pub enum Example {
+ ExOne,
+ }
+}
+
+mod reexports {
+ pub use crate::inner::Example as _;
+}
+
+use crate::reexports::*;
+//~^ SUGGESTION: use inner::Example::ExOne
+
+fn main() {
+ ExOne;
+ //~^ ERROR: cannot find value `ExOne` in this scope
+}
diff --git a/tests/ui/resolve/issue-116164.stderr b/tests/ui/resolve/issue-116164.stderr
new file mode 100644
index 000000000..5820a189f
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find value `ExOne` in this scope
+ --> $DIR/issue-116164.rs:17:5
+ |
+LL | ExOne;
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this unit variant
+ |
+LL + use inner::Example::ExOne;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/issue-55673.fixed b/tests/ui/resolve/issue-55673.fixed
new file mode 100644
index 000000000..261742a26
--- /dev/null
+++ b/tests/ui/resolve/issue-55673.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+#![allow(dead_code)]
+trait Foo {
+ type Bar;
+}
+
+fn foo<T: Foo>()
+where
+ T::Bar: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn bar<T>()
+where
+ T::Bar: std::fmt::Debug, T: Foo
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-55673.rs b/tests/ui/resolve/issue-55673.rs
index 0436bd397..6ac49be14 100644
--- a/tests/ui/resolve/issue-55673.rs
+++ b/tests/ui/resolve/issue-55673.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+#![allow(dead_code)]
trait Foo {
type Bar;
}
@@ -9,4 +11,11 @@ where
{
}
+fn bar<T>()
+where
+ T::Baa: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
fn main() {}
diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr
index 39318f959..ffc325223 100644
--- a/tests/ui/resolve/issue-55673.stderr
+++ b/tests/ui/resolve/issue-55673.stderr
@@ -1,9 +1,29 @@
error[E0220]: associated type `Baa` not found for `T`
- --> $DIR/issue-55673.rs:7:8
+ --> $DIR/issue-55673.rs:9:8
|
LL | T::Baa: std::fmt::Debug,
| ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: change the associated type name to use `Bar` from `Foo`
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
+
+error[E0220]: associated type `Baa` not found for `T`
+ --> $DIR/issue-55673.rs:16:8
+ |
+LL | T::Baa: std::fmt::Debug,
+ | ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: consider further restricting type parameter `T`
+ |
+LL | T::Baa: std::fmt::Debug, T: Foo
+ | ~~~~~~~~
+help: and also change the associated type name
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
index 49462f52f..927ecd9ae 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
@@ -9,11 +9,9 @@ impl A {
trait B {
async fn associated();
- //~^ ERROR cannot be declared `async`
}
impl B for A {
async fn associated(); //~ ERROR without body
- //~^ ERROR cannot be declared `async`
}
fn main() {}
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
index 1354abb4f..da9eeea95 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
@@ -15,39 +15,12 @@ LL | async fn inherent();
| help: provide a definition for the function: `{ <body> }`
error: associated function in `impl` without body
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
+ --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:14:5
|
LL | async fn associated();
| ^^^^^^^^^^^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr
index 730fd6d60..9d0439d9d 100644
--- a/tests/ui/resolve/issue-82865.stderr
+++ b/tests/ui/resolve/issue-82865.stderr
@@ -15,6 +15,13 @@ LL | Box::z
LL | mac!();
| ------ in this macro invocation
|
+note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions:
+ Box::<T>::new
+ Box::<T>::new_uninit
+ Box::<T>::new_zeroed
+ Box::<T>::try_new
+ and 18 others
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr
index 42b7281d7..d6240fb8f 100644
--- a/tests/ui/resolve/resolve-inconsistent-names.stderr
+++ b/tests/ui/resolve/resolve-inconsistent-names.stderr
@@ -1,11 +1,3 @@
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:13:12
- |
-LL | a | b => {}
- | - ^ pattern doesn't bind `a`
- | |
- | variable not in all patterns
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:13:8
|
@@ -14,6 +6,14 @@ LL | a | b => {}
| |
| pattern doesn't bind `b`
+error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:13:12
+ |
+LL | a | b => {}
+ | - ^ pattern doesn't bind `a`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:19:9
|
@@ -54,6 +54,19 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| |
| first binding
+error[E0408]: variable `Const2` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:31:9
+ |
+LL | (CONST1, _) | (_, Const2) => ()
+ | ^^^^^^^^^^^ ------ variable not in all patterns
+ | |
+ | pattern doesn't bind `Const2`
+ |
+help: if you meant to match on constant `m::Const2`, use the full path in the pattern
+ |
+LL | (CONST1, _) | (_, m::Const2) => ()
+ | ~~~~~~~~~
+
error[E0408]: variable `CONST1` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:31:23
|
@@ -68,19 +81,6 @@ note: you might have meant to match on constant `m::CONST1`, which exists but is
LL | const CONST1: usize = 10;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible
-error[E0408]: variable `Const2` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:31:9
- |
-LL | (CONST1, _) | (_, Const2) => ()
- | ^^^^^^^^^^^ ------ variable not in all patterns
- | |
- | pattern doesn't bind `Const2`
- |
-help: if you meant to match on constant `m::Const2`, use the full path in the pattern
- |
-LL | (CONST1, _) | (_, m::Const2) => ()
- | ~~~~~~~~~
-
error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-names.rs:19:19
|
diff --git a/tests/ui/return/return-impl-trait-bad.stderr b/tests/ui/return/return-impl-trait-bad.stderr
index 237b85ee6..a015b9f53 100644
--- a/tests/ui/return/return-impl-trait-bad.stderr
+++ b/tests/ui/return/return-impl-trait-bad.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn bad_echo<T>(_t: T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | "this should not suggest impl Trait"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
LL | fn bad_echo_2<T: Trait>(_t: T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | "this will not suggest it, because that would probably be wrong"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
LL | fn other_bounds_bad<T>() -> T
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
...
LL | "don't suggest this, because Option<T> places additional constraints"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
@@ -46,7 +46,7 @@ LL | fn used_in_trait<T>() -> T
| | |
| | expected `T` because of return type
| | help: consider using an impl return type: `impl Send`
- | this type parameter
+ | expected this type parameter
...
LL | "don't suggest this, because the generic param is used in the bound."
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
diff --git a/tests/ui/return/return-impl-trait.stderr b/tests/ui/return/return-impl-trait.stderr
index 43d40972f..707f014a1 100644
--- a/tests/ui/return/return-impl-trait.stderr
+++ b/tests/ui/return/return-impl-trait.stderr
@@ -5,7 +5,7 @@ LL | fn bar<T: Trait + std::marker::Sync>() -> T
| - -
| | |
| | expected `T` because of return type
- | this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
+ | expected this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
...
LL | ()
| ^^ expected type parameter `T`, found `()`
@@ -21,7 +21,7 @@ LL | fn other_bounds<T>() -> T
| | |
| | expected `T` because of return type
| | help: consider using an impl return type: `impl Trait`
- | this type parameter
+ | expected this type parameter
...
LL | ()
| ^^ expected type parameter `T`, found `()`
diff --git a/tests/ui/return/return-struct.stderr b/tests/ui/return/return-struct.stderr
index e6c0363e3..282e6498e 100644
--- a/tests/ui/return/return-struct.stderr
+++ b/tests/ui/return/return-struct.stderr
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
--> $DIR/return-struct.rs:15:5
|
LL | fn bar() {
- | - help: try adding a return type: `-> Age`
+ | - help: try adding a return type: `-> Age`
LL | let mut age = 29;
LL | Age::Years(age, 55)
| ^^^^^^^^^^^^^^^^^^^ expected `()`, found `Age`
@@ -26,7 +26,7 @@ error[E0308]: mismatched types
--> $DIR/return-struct.rs:20:5
|
LL | fn baz() {
- | - help: try adding a return type: `-> S`
+ | - help: try adding a return type: `-> S`
LL | S
| ^ expected `()`, found `S`
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
index 2b3fbd2a4..e591b2a93 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
@@ -40,7 +40,8 @@ fn main() {
const CFN1: Wrap<fn()> = Wrap(trivial);
let input: Wrap<fn()> = Wrap(trivial);
match Wrap(input) {
- Wrap(CFN1) => count += 1,
+ Wrap(CFN1) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -48,7 +49,8 @@ fn main() {
const CFN2: Wrap<fn(SM)> = Wrap(sm_to);
let input: Wrap<fn(SM)> = Wrap(sm_to);
match Wrap(input) {
- Wrap(CFN2) => count += 1,
+ Wrap(CFN2) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -56,7 +58,8 @@ fn main() {
const CFN3: Wrap<fn() -> SM> = Wrap(to_sm);
let input: Wrap<fn() -> SM> = Wrap(to_sm);
match Wrap(input) {
- Wrap(CFN3) => count += 1,
+ Wrap(CFN3) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -64,7 +67,8 @@ fn main() {
const CFN4: Wrap<fn(NotSM)> = Wrap(not_sm_to);
let input: Wrap<fn(NotSM)> = Wrap(not_sm_to);
match Wrap(input) {
- Wrap(CFN4) => count += 1,
+ Wrap(CFN4) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -72,7 +76,8 @@ fn main() {
const CFN5: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
let input: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
match Wrap(input) {
- Wrap(CFN5) => count += 1,
+ Wrap(CFN5) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -80,7 +85,8 @@ fn main() {
const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
let input: Wrap<fn(&SM)> = Wrap(r_sm_to);
match Wrap(input) {
- Wrap(CFN6) => count += 1,
+ Wrap(CFN6) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -88,7 +94,8 @@ fn main() {
const CFN7: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
let input: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
match Wrap(input) {
- Wrap(CFN7) => count += 1,
+ Wrap(CFN7) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -96,7 +103,8 @@ fn main() {
const CFN8: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
let input: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
match Wrap(input) {
- Wrap(CFN8) => count += 1,
+ Wrap(CFN8) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -104,7 +112,8 @@ fn main() {
const CFN9: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
let input: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
match Wrap(input) {
- Wrap(CFN9) => count += 1,
+ Wrap(CFN9) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -126,7 +135,8 @@ fn main() {
let input = Foo { alpha: not_sm_to, beta: to_not_sm, gamma: sm_to, delta: to_sm };
match input {
- CFOO => count += 1,
+ CFOO => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Foo { .. } => {}
};
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
new file mode 100644
index 000000000..080bf5885
--- /dev/null
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
@@ -0,0 +1,93 @@
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:43:14
+ |
+LL | Wrap(CFN1) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:52:14
+ |
+LL | Wrap(CFN2) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:61:14
+ |
+LL | Wrap(CFN3) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:70:14
+ |
+LL | Wrap(CFN4) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:79:14
+ |
+LL | Wrap(CFN5) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:88:14
+ |
+LL | Wrap(CFN6) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:97:14
+ |
+LL | Wrap(CFN7) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:106:14
+ |
+LL | Wrap(CFN8) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:115:14
+ |
+LL | Wrap(CFN9) => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:138:9
+ |
+LL | CFOO => count += 1,
+ | ^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
index 567685950..b05b8c8da 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
@@ -26,6 +26,7 @@ fn my_fn(_args: &[A]) {
}
const TEST: Fn = my_fn;
+const TEST2: (Fn, u8) = (TEST, 0);
struct B(Fn);
@@ -33,8 +34,14 @@ fn main() {
let s = B(my_fn);
match s {
B(TEST) => println!("matched"),
- //~^ WARN pointers in patterns behave unpredictably
+ //~^ WARN behave unpredictably
//~| WARN this was previously accepted by the compiler but is being phased out
_ => panic!("didn't match")
};
+ match (s.0, 0) {
+ TEST2 => println!("matched"),
+ //~^ WARN behave unpredictably
+ //~| WARN this was previously accepted by the compiler but is being phased out
+ _ => panic!("didn't match")
+ }
}
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
index d6afc0255..4fdfce60b 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
@@ -1,5 +1,5 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
- --> $DIR/issue-63479-match-fnptr.rs:35:7
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:36:7
|
LL | B(TEST) => println!("matched"),
| ^^^^
@@ -12,5 +12,14 @@ note: the lint level is defined here
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-warning: 1 warning emitted
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:42:5
+ |
+LL | TEST2 => println!("matched"),
+ | ^^^^^
+ |
+ = 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 #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 2 warnings emitted
diff --git a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
index d183eaaa6..5f8c5dbe6 100644
--- a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
+++ b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
@@ -15,6 +15,7 @@ LL | f: &id,
|
= note: expected trait `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
found trait `Fn<(&Foo<'_>,)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623-2.rs:28:8
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
index 77227ebd8..1933a68c2 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
mod child {
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
index c4371a002..40f736c21 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
@@ -1,11 +1,11 @@
error[E0277]: the trait bound `Something: Termination` is not satisfied
- --> $DIR/issue-103052-2.rs:12:22
+ --> $DIR/issue-103052-2.rs:11:22
|
LL | fn main() -> Something {
| ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
|
note: required by a bound in `Main::{opaque#0}`
- --> $DIR/issue-103052-2.rs:6:27
+ --> $DIR/issue-103052-2.rs:5:27
|
LL | fn main() -> impl std::process::Termination;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}`
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
index de1bf8be8..7386f10a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
@@ -17,18 +17,18 @@ LL | match NonExhaustiveEnum::Unit {}
| ^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
|
note: `NonExhaustiveEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:5:5
+ --> $DIR/enum_same_crate_empty_match.rs:4:10
|
LL | pub enum NonExhaustiveEnum {
- | -----------------
+ | ^^^^^^^^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= 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, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -44,18 +44,18 @@ LL | match NormalEnum::Unit {}
| ^^^^^^^^^^^^^^^^ patterns `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered
|
note: `NormalEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:14:5
+ --> $DIR/enum_same_crate_empty_match.rs:13:10
|
LL | pub enum NormalEnum {
- | ----------
+ | ^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `NormalEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
new file mode 100644
index 000000000..9192c6614
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
@@ -0,0 +1,75 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:23:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:22:27
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:42:9
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:50:9
+ |
+LL | #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[warn(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to 2 previous errors; 3 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
new file mode 100644
index 000000000..46093eb9f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
@@ -0,0 +1,31 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
new file mode 100644
index 000000000..33f9f56a5
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
@@ -0,0 +1,53 @@
+// revisions: normal lint
+// Test that putting the lint level on a match arm emits a warning, as this was previously
+// meaningful and is no longer.
+#![feature(non_exhaustive_omitted_patterns_lint)]
+
+// aux-build:enums.rs
+extern crate enums;
+
+use enums::NonExhaustiveEnum;
+
+fn main() {
+ let val = NonExhaustiveEnum::Unit;
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match val {
+ //~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ match val {
+ //[lint]~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[deny(non_exhaustive_omitted_patterns)]
+ _ => {}
+ }
+ //~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
index 3482af747..e0a6051a8 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
@@ -13,8 +13,8 @@ use enums::{
EmptyNonExhaustiveEnum, NestedNonExhaustive, NonExhaustiveEnum, NonExhaustiveSingleVariant,
VariantNonExhaustive,
};
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
use structs::{FunctionalRecord, MixedVisFields, NestedStruct, NormalStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
#[non_exhaustive]
#[derive(Default)]
@@ -35,10 +35,10 @@ fn main() {
let enumeration = Bar::A;
// Ok: this is a crate local non_exhaustive enum
+ #[deny(non_exhaustive_omitted_patterns)]
match enumeration {
Bar::A => {}
Bar::B => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
@@ -51,50 +51,87 @@ fn main() {
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit | NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
let x = 5;
+ // We ignore the guard.
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit if x > 10 => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ (NonExhaustiveEnum::Struct { .. }, false) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ //~^ some variants are not matched explicitly
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ (false, NonExhaustiveEnum::Struct { .. }) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ //~^ some variants are not matched explicitly
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match Some(non_enum) {
+ //~^ some variants are not matched explicitly
+ Some(NonExhaustiveEnum::Unit) => {}
+ Some(NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
// Ok: all covered and not `unreachable-patterns`
#[deny(unreachable_patterns)]
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
#[deny(non_exhaustive_omitted_patterns)]
match NestedNonExhaustive::B {
+ //~^ some variants are not matched explicitly
NestedNonExhaustive::A(NonExhaustiveEnum::Unit) => {}
NestedNonExhaustive::A(_) => {}
NestedNonExhaustive::B => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
- //~^^^^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
match VariantNonExhaustive::Baz(1, 2) {
@@ -120,30 +157,36 @@ fn main() {
#[warn(non_exhaustive_omitted_patterns)]
let MixedVisFields { a, b, .. } = MixedVisFields::default();
- // Ok: because this only has 1 variant
+ // Ok: this only has 1 variant
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
NonExhaustiveSingleVariant::A(true) => {}
_ => {}
}
+ // We can't catch the case below, so for consistency we don't catch this one either.
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
_ => {}
}
- //~^^ some variants are not matched explicitly
+ // We can't catch this case, because this would require digging fully through all the values of
+ // any type we encounter. We need to be able to only consider present constructors.
+ #[deny(non_exhaustive_omitted_patterns)]
+ match &NonExhaustiveSingleVariant::A(true) {
+ _ => {}
+ }
// Ok: we don't lint on `if let` expressions
#[deny(non_exhaustive_omitted_patterns)]
if let NonExhaustiveEnum::Tuple(_) = non_enum {}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: the feature is on and all variants are matched
#[deny(non_exhaustive_omitted_patterns)]
@@ -164,10 +207,10 @@ fn main() {
#[deny(non_exhaustive_omitted_patterns)]
match OnlyUnstableEnum::Unstable {
+ //~^ some variants are not matched explicitly
OnlyUnstableEnum::Unstable => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
@@ -194,14 +237,13 @@ fn main() {
let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
//~^ refutable pattern in local binding
- // Check that matching on a reference results in a correctly spanned diagnostic
#[deny(non_exhaustive_omitted_patterns)]
match &non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
}
#[deny(non_exhaustive_omitted_patterns)]
@@ -209,3 +251,10 @@ fn main() {
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
let _closure = |_: NonExhaustiveEnum| {};
}
+
+// ICE #117033
+enum Void {}
+#[deny(non_exhaustive_omitted_patterns)]
+pub fn void(v: Void) -> ! {
+ match v {}
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
index 923394474..7db61f124 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
@@ -1,5 +1,5 @@
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:102:9
+ --> $DIR/omitted-patterns.rs:139:9
|
LL | VariantNonExhaustive::Bar { x, .. } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `y` not listed
@@ -7,13 +7,13 @@ LL | VariantNonExhaustive::Bar { x, .. } => {}
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `VariantNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:99:12
+ --> $DIR/omitted-patterns.rs:136:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:107:9
+ --> $DIR/omitted-patterns.rs:144:9
|
LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalRecord::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `third_field` not listed
@@ -21,13 +21,13 @@ LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalReco
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `FunctionalRecord` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:106:12
+ --> $DIR/omitted-patterns.rs:143:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:29
+ --> $DIR/omitted-patterns.rs:152:29
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `second_field` not listed
@@ -35,13 +35,13 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `NormalStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:114:12
+ --> $DIR/omitted-patterns.rs:151:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:9
+ --> $DIR/omitted-patterns.rs:152:9
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `foo` not listed
@@ -50,7 +50,7 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= note: the pattern is of type `NestedStruct` and the `non_exhaustive_omitted_patterns` attribute was found
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:173:9
+ --> $DIR/omitted-patterns.rs:216:9
|
LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable2` not listed
@@ -58,13 +58,13 @@ LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `OnlyUnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:172:12
+ --> $DIR/omitted-patterns.rs:215:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:181:9
+ --> $DIR/omitted-patterns.rs:224:9
|
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable` not listed
@@ -72,120 +72,125 @@ LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `UnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:180:12
+ --> $DIR/omitted-patterns.rs:223:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:58:9
+ --> $DIR/omitted-patterns.rs:55:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:57:16
+ --> $DIR/omitted-patterns.rs:54:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:65:9
+ --> $DIR/omitted-patterns.rs:63:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:64:16
+ --> $DIR/omitted-patterns.rs:62:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:75:9
+ --> $DIR/omitted-patterns.rs:87:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Unit` not covered
+LL | match (non_enum, true) {
+ | ^^^^^^^^^^^^^^^^ pattern `(NonExhaustiveEnum::Struct { .. }, _)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(NonExhaustiveEnum, bool)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:74:16
+ --> $DIR/omitted-patterns.rs:86:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:92:32
+ --> $DIR/omitted-patterns.rs:102:11
|
-LL | NestedNonExhaustive::A(_) => {}
- | ^ patterns `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match (true, non_enum) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(bool, NonExhaustiveEnum)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:89:12
+ --> $DIR/omitted-patterns.rs:101:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:94:9
+ --> $DIR/omitted-patterns.rs:110:11
|
-LL | _ => {}
- | ^ pattern `NestedNonExhaustive::C` not covered
+LL | match Some(non_enum) {
+ | ^^^^^^^^^^^^^^ pattern `Some(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `Option<NonExhaustiveEnum>` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns.rs:109:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:132:9
+ --> $DIR/omitted-patterns.rs:128:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveSingleVariant::A(_)` not covered
+LL | match NestedNonExhaustive::B {
+ | ^^^^^^^^^^^^^^^^^^^^^^ patterns `NestedNonExhaustive::C`, `NestedNonExhaustive::A(NonExhaustiveEnum::Tuple(_))` and `NestedNonExhaustive::A(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveSingleVariant` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:130:12
+ --> $DIR/omitted-patterns.rs:127:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:144:9
+ --> $DIR/omitted-patterns.rs:184:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Unstable` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:143:16
+ --> $DIR/omitted-patterns.rs:183:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:168:9
+ --> $DIR/omitted-patterns.rs:209:11
|
-LL | _ => {}
- | ^ pattern `OnlyUnstableEnum::Unstable2` not covered
+LL | match OnlyUnstableEnum::Unstable {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `OnlyUnstableEnum::Unstable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `OnlyUnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:165:12
+ --> $DIR/omitted-patterns.rs:208:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding
- --> $DIR/omitted-patterns.rs:194:9
+ --> $DIR/omitted-patterns.rs:237:9
|
LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
| ^^^^^^^^^^^^^^^ pattern `_` not covered
@@ -199,15 +204,15 @@ LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit
| ++++++++++++++++
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:202:9
+ --> $DIR/omitted-patterns.rs:241:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match &non_enum {
+ | ^^^^^^^^^ pattern `&NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `&NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:198:12
+ --> $DIR/omitted-patterns.rs:240:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
index 82ee68687..1828fdef9 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
@@ -6,23 +6,23 @@
// aux-build:unstable.rs
extern crate unstable;
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
fn main() {
// OK: this matches all the stable variants
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: although this is a bit odd, we don't have anything to report
// since there is no stable variants and the feature is off
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
index f38368590..27939176f 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
@@ -13,18 +13,18 @@ LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/stable-omitted-patterns.rs:23:9
+ --> $DIR/stable-omitted-patterns.rs:21:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Stable2` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Stable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/stable-omitted-patterns.rs:22:16
+ --> $DIR/stable-omitted-patterns.rs:20:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
index a9c54af04..c125756a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
index ec2a2f6f0..7a12aca85 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
@@ -43,14 +43,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/match_same_crate.rs:16:23
+ --> $DIR/match_same_crate.rs:15:10
|
LL | pub enum UninhabitedVariants {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
index b6b777ec5..19e2546b0 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
index 670c423a7..86bcf1f6f 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
@@ -2,10 +2,10 @@
#![feature(stmt_expr_attributes)]
#![feature(closure_track_caller)]
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
use std::panic::Location;
@@ -93,53 +93,53 @@ fn test_closure() {
#[track_caller]
-fn mono_generator<F: Generator<String, Yield = (&'static str, String, Loc), Return = ()>>(
+fn mono_coroutine<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>(
val: Pin<&mut F>
) -> (&'static str, String, Loc) {
match val.resume("Mono".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
#[track_caller]
-fn dyn_generator(
- val: Pin<&mut dyn Generator<String, Yield = (&'static str, String, Loc), Return = ()>>
+fn dyn_coroutine(
+ val: Pin<&mut dyn Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>
) -> (&'static str, String, Loc) {
match val.resume("Dyn".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
-fn test_generator() {
- let generator = #[track_caller] |arg: String| {
+fn test_coroutine() {
+ let coroutine = #[track_caller] |arg: String| {
yield ("first", arg.clone(), Location::caller());
yield ("second", arg.clone(), Location::caller());
};
- let mut pinned = Box::pin(generator);
- let (dyn_ret, dyn_arg, dyn_loc) = dyn_generator(pinned.as_mut());
+ let mut pinned = Box::pin(coroutine);
+ let (dyn_ret, dyn_arg, dyn_loc) = dyn_coroutine(pinned.as_mut());
assert_eq!(dyn_ret, "first");
assert_eq!(dyn_arg, "Dyn".to_string());
- // The `Generator` trait does not have `#[track_caller]` on `resume`, so
+ // The `Coroutine` trait does not have `#[track_caller]` on `resume`, so
// this will not match.
assert_ne!(dyn_loc.file(), file!());
- let (mono_ret, mono_arg, mono_loc) = mono_generator(pinned.as_mut());
+ let (mono_ret, mono_arg, mono_loc) = mono_coroutine(pinned.as_mut());
let mono_line = line!() - 1;
assert_eq!(mono_ret, "second");
- // The generator ignores the argument to the second `resume` call
+ // The coroutine ignores the argument to the second `resume` call
assert_eq!(mono_arg, "Dyn".to_string());
assert_eq!(mono_loc.file(), file!());
assert_eq!(mono_loc.line(), mono_line);
assert_eq!(mono_loc.column(), 42);
- let non_tracked_generator = || { yield Location::caller(); };
- let non_tracked_line = line!() - 1; // This is the line of the generator, not its caller
- let non_tracked_loc = match Box::pin(non_tracked_generator).as_mut().resume(()) {
- GeneratorState::Yielded(val) => val,
+ let non_tracked_coroutine = || { yield Location::caller(); };
+ let non_tracked_line = line!() - 1; // This is the line of the coroutine, not its caller
+ let non_tracked_loc = match Box::pin(non_tracked_coroutine).as_mut().resume(()) {
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
};
assert_eq!(non_tracked_loc.file(), file!());
@@ -150,5 +150,5 @@ fn test_generator() {
fn main() {
test_closure();
- test_generator();
+ test_coroutine();
}
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
index 0c388f5fe..041f7ebc0 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/dont-infer-static.rs:6:10
|
LL | bar: Bar<U>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
+ | ^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/dont-infer-static.rs:8:15
|
LL | struct Bar<T: 'static> {
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<U: 'static> {
| +++++++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
index 2c660b285..5b605f3ee 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:17:18
|
+LL | enum Ref1<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | Ref1Variant1(RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref1<'a, T: 'a> {
| ++++
@@ -12,10 +14,13 @@ LL | enum Ref1<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:22:25
|
+LL | enum Ref2<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | Ref2Variant1,
LL | Ref2Variant2(isize, RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref2<'a, T: 'a> {
| ++++
@@ -23,10 +28,12 @@ LL | enum Ref2<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:35:23
|
+LL | enum RefDouble<'a, 'b, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'b` as defined here...
LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum RefDouble<'a, 'b, T: 'b> {
| ++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
index 34ff1362c..eb17ce736 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:13:16
|
+LL | impl<'a, T> Trait<'a, T> for usize {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
@@ -12,6 +14,8 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:21:16
|
+LL | impl<'a, T> Trait<'a, T> for u32 {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
@@ -20,7 +24,7 @@ note: ...that is required by this bound
|
LL | struct RefOk<'a, T:'a> {
| ^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
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
index d27fde582..087e54244 100644
--- 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
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:12:27
+ --> $DIR/move-guard-if-let-chain.rs:12:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -7,7 +7,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, 2) if let y = x && c => (),
| - value moved here
LL | (1, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -15,7 +15,7 @@ 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
+ --> $DIR/move-guard-if-let-chain.rs:36:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, _) if let y = x && c => (),
| - value moved here
LL | (_, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -31,15 +31,13 @@ LL | (1, _) if let ref y = x && c => (),
| +++
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:59:36
+ --> $DIR/move-guard-if-let-chain.rs:59:32
|
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
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
index e97fdcce1..9dc339abc 100644
--- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
+++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
@@ -1,13 +1,14 @@
error[E0382]: use of moved value: `a`
- --> $DIR/dbg-macro-move-semantics.rs:9:18
+ --> $DIR/dbg-macro-move-semantics.rs:9:13
|
LL | let a = NoCopy(0);
| - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
LL | let _ = dbg!(a);
| ------- value moved here
LL | let _ = dbg!(a);
- | ^ value used here after move
+ | ^^^^^^^ value used here after move
|
+ = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
index 43bda4962..1374ad935 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
@@ -21,14 +21,14 @@ fn call_once(f: impl FnOnce()) {
}
fn main() {
- call(foo); //~ ERROR expected a `Fn<()>` closure, found `fn() {foo}`
- call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `fn() {foo}`
- call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `fn() {foo}`
+ call(foo); //~ ERROR expected a `Fn()` closure, found `fn() {foo}`
+ call_mut(foo); //~ ERROR expected a `FnMut()` closure, found `fn() {foo}`
+ call_once(foo); //~ ERROR expected a `FnOnce()` closure, found `fn() {foo}`
call(foo_unsafe);
- //~^ ERROR expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
call_mut(foo_unsafe);
- //~^ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
call_once(foo_unsafe);
- //~^ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
index fc7bf2277..100f20482 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `Fn()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:24:10
|
LL | call(foo);
- | ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
+ | ---- ^^^ expected an `Fn()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -15,11 +15,11 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnMut()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:25:14
|
LL | call_mut(foo);
- | -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
+ | -------- ^^^ expected an `FnMut()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -32,11 +32,11 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnOnce()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:26:15
|
LL | call_once(foo);
- | --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
+ | --------- ^^^ expected an `FnOnce()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -49,7 +49,7 @@ note: required by a bound in `call_once`
LL | fn call_once(f: impl FnOnce()) {
| ^^^^^^^^ required by this bound in `call_once`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:28:10
|
LL | call(foo_unsafe);
@@ -58,6 +58,7 @@ LL | call(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call`
@@ -66,7 +67,7 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
|
LL | call_mut(foo_unsafe);
@@ -75,6 +76,7 @@ LL | call_mut(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnMut<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_mut`
@@ -83,7 +85,7 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
|
LL | call_once(foo_unsafe);
@@ -92,6 +94,7 @@ LL | call_once(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_once`
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
index 7639ae9f6..8ca6a37c6 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
@@ -5,6 +5,7 @@ LL | mod řųśť;
| ^^^^^^^^^
|
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs"
+ = note: if there is a `mod řųśť` elsewhere in the crate already, import it with `use crate::...` instead
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
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 ad11c090f..6d436018b 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,14 +1,12 @@
-error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:6
+error[E0308]: mismatched types
+ --> $DIR/assoc-type-const-bound-usage.rs:12:5
|
LL | <T as Foo>::Assoc::foo();
- | ^ the trait `Foo` is not implemented for `T`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
-help: consider further restricting this bound
- |
-LL | const fn foo<T: ~const Foo + Foo>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
index f396deff4..8e4de57b0 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
@@ -4,7 +4,6 @@
associated_type_bounds,
const_trait_impl,
const_cmp,
- return_position_impl_trait_in_trait,
)]
use std::marker::Destruct;
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
index f9078e227..4a9090d0b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
@@ -5,31 +5,31 @@ LL | const_cmp,
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:12:30
+ --> $DIR/const-impl-trait.rs:11:30
|
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:16:30
+ --> $DIR/const-impl-trait.rs:15:30
|
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:17:20
+ --> $DIR/const-impl-trait.rs:16:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:24:29
+ --> $DIR/const-impl-trait.rs:23:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:28:29
+ --> $DIR/const-impl-trait.rs:27:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
index 1b45cd9aa..13881e042 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
@@ -7,7 +7,7 @@
#![feature(staged_api)]
#![feature(const_trait_impl)]
-#![stable(since = "1", feature = "foo")]
+#![stable(feature = "foo", since = "3.3.3")]
#[const_trait]
trait Tr {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
new file mode 100644
index 000000000..a74c50cc8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
@@ -0,0 +1,12 @@
+#![feature(const_trait_impl, effects)]
+
+pub const fn foo() {}
+
+#[const_trait]
+pub trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
new file mode 100644
index 000000000..1e22ddcea
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
@@ -0,0 +1,28 @@
+#![feature(const_trait_impl, effects)]
+
+#[const_trait]
+trait MyTrait {
+ fn do_something(&self);
+}
+
+trait OtherTrait {
+ fn do_something_else() where Self: ~const MyTrait;
+ //~^ ERROR `~const` is not allowed here
+}
+
+struct MyStruct<T>(T);
+
+impl const MyTrait for u32 {
+ fn do_something(&self) {}
+}
+
+impl<T> MyStruct<T> {
+ pub fn foo(&self) where T: ~const MyTrait {
+ //~^ ERROR `~const` is not allowed here
+ self.0.do_something();
+ }
+}
+
+fn main() {
+ MyStruct(0u32).foo();
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
new file mode 100644
index 000000000..9210f6427
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
@@ -0,0 +1,26 @@
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:40
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:8
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:32
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:12
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
new file mode 100644
index 000000000..6598d1da0
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
@@ -0,0 +1,15 @@
+#![feature(const_closures, const_trait_impl, effects)]
+#![allow(incomplete_features)]
+
+trait Foo {
+ fn foo(&self);
+}
+
+impl Foo for () {
+ fn foo(&self) {}
+}
+
+fn main() {
+ (const || { (()).foo() })();
+ //~^ ERROR: cannot call non-const fn
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
new file mode 100644
index 000000000..002d586ac
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
+ --> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22
+ |
+LL | (const || { (()).foo() })();
+ | ^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+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/effects/ice-113375-index-out-of-bounds-generics.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
new file mode 100644
index 000000000..1954d2942
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+// effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds
+
+#![allow(incomplete_features, unused)]
+#![feature(effects, adt_const_params)]
+
+struct Bar<T>(T);
+
+impl<T> Bar<T> {
+ const fn value() -> usize {
+ 42
+ }
+}
+
+struct Foo<const N: [u8; Bar::<u32>::value()]>;
+
+pub fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
new file mode 100644
index 000000000..c38b4b3f1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
@@ -0,0 +1,504 @@
+#![crate_type = "lib"]
+#![feature(no_core, lang_items, unboxed_closures, auto_traits, intrinsics, rustc_attrs)]
+#![feature(fundamental)]
+#![feature(const_trait_impl, effects, const_mut_refs)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// known-bug: #110395
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "add"]
+#[const_trait]
+trait Add<Rhs = Self> {
+ type Output;
+
+ fn add(self, rhs: Rhs) -> Self::Output;
+}
+
+// FIXME we shouldn't need to have to specify `Rhs`.
+impl const Add<i32> for i32 {
+ type Output = i32;
+ fn add(self, rhs: i32) -> i32 {
+ loop {}
+ }
+}
+
+fn foo() {
+ let x = 42_i32 + 43_i32;
+}
+
+const fn bar() {
+ let x = 42_i32 + 43_i32;
+}
+
+
+#[lang = "Try"]
+#[const_trait]
+trait Try: FromResidual {
+ type Output;
+ type Residual;
+
+ #[lang = "from_output"]
+ fn from_output(output: Self::Output) -> Self;
+
+ #[lang = "branch"]
+ fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
+}
+
+// FIXME
+// #[const_trait]
+trait FromResidual<R = <Self as Try>::Residual> {
+ #[lang = "from_residual"]
+ fn from_residual(residual: R) -> Self;
+}
+
+enum ControlFlow<B, C = ()> {
+ #[lang = "Continue"]
+ Continue(C),
+ #[lang = "Break"]
+ Break(B),
+}
+
+#[const_trait]
+#[lang = "fn"]
+#[rustc_paren_sugar]
+trait Fn<Args: Tuple>: ~const FnMut<Args> {
+ extern "rust-call" fn call(&self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_mut"]
+#[rustc_paren_sugar]
+trait FnMut<Args: Tuple>: ~const FnOnce<Args> {
+ extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_once"]
+#[rustc_paren_sugar]
+trait FnOnce<Args: Tuple> {
+ type Output;
+
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+struct ConstFnMutClosure<CapturedData, Function> {
+ data: CapturedData,
+ func: Function,
+}
+
+#[lang = "tuple_trait"]
+pub trait Tuple {}
+
+macro_rules! impl_fn_mut_tuple {
+ ($($var:ident)*) => {
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnOnce<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ type Output = ClosureReturnValue;
+
+ extern "rust-call" fn call_once(mut self, args: ClosureArguments) -> Self::Output {
+ self.call_mut(args)
+ }
+ }
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnMut<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
+ #[allow(non_snake_case)]
+ let ($($var),*) = &mut self.data;
+ (self.func)(($($var),*), args)
+ }
+ }
+ };
+}
+//impl_fn_mut_tuple!(A);
+//impl_fn_mut_tuple!(A B);
+//impl_fn_mut_tuple!(A B C);
+//impl_fn_mut_tuple!(A B C D);
+//impl_fn_mut_tuple!(A B C D E);
+
+#[lang = "receiver"]
+trait Receiver {}
+
+impl<T: ?Sized> Receiver for &T {}
+
+impl<T: ?Sized> Receiver for &mut T {}
+
+#[lang = "destruct"]
+#[const_trait]
+trait Destruct {}
+
+#[lang = "freeze"]
+unsafe auto trait Freeze {}
+
+#[lang = "drop"]
+#[const_trait]
+trait Drop {
+ fn drop(&mut self);
+}
+
+/*
+#[const_trait]
+trait Residual<O> {
+ type TryType: ~const Try<Output = O, Residual = Self> + Try<Output = O, Residual = Self>;
+}
+*/
+
+const fn size_of<T>() -> usize {
+ 42
+}
+
+impl Copy for u8 {}
+
+impl usize {
+ #[rustc_allow_incoherent_impl]
+ const fn repeat_u8(x: u8) -> usize {
+ usize::from_ne_bytes([x; size_of::<usize>()])
+ }
+ #[rustc_allow_incoherent_impl]
+ const fn from_ne_bytes(bytes: [u8; size_of::<Self>()]) -> Self {
+ loop {}
+ }
+}
+
+#[rustc_do_not_const_check] // hooked by const-eval
+const fn panic_display() {
+ panic_fmt();
+}
+
+fn panic_fmt() {}
+
+#[lang = "index"]
+#[const_trait]
+trait Index<Idx: ?Sized> {
+ type Output: ?Sized;
+
+ fn index(&self, index: Idx) -> &Self::Output;
+}
+
+
+#[const_trait]
+unsafe trait SliceIndex<T: ?Sized> {
+ type Output: ?Sized;
+ fn index(self, slice: &T) -> &Self::Output;
+}
+
+impl<T, I> const Index<I> for [T]
+where
+ I: ~const SliceIndex<[T]>,
+{
+ type Output = I::Output;
+
+ #[inline]
+ fn index(&self, index: I) -> &I::Output {
+ index.index(self)
+ }
+}
+/* FIXME
+impl<T, I, const N: usize> const Index<I> for [T; N]
+where
+ [T]: ~const Index<I>,
+{
+ type Output = <[T] as Index<I>>::Output;
+
+ #[inline]
+ // FIXME: make `Self::Output` act like `<Self as ~const Index<I>>::Output`
+ fn index(&self, index: I) -> &<[T] as Index<I>>::Output {
+ Index::index(self as &[T], index)
+ }
+}
+*/
+
+#[lang = "unsize"]
+trait Unsize<T: ?Sized> {
+}
+
+#[lang = "coerce_unsized"]
+trait CoerceUnsized<T: ?Sized> {
+}
+
+impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
+
+
+#[lang = "deref"]
+// #[const_trait] FIXME
+trait Deref {
+ #[lang = "deref_target"]
+ type Target: ?Sized;
+
+ fn deref(&self) -> &Self::Target;
+}
+
+
+impl<T: ?Sized> /* const */ Deref for &T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+impl<T: ?Sized> /* const */ Deref for &mut T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+enum Option<T> {
+ #[lang = "None"]
+ None,
+ #[lang = "Some"]
+ Some(T),
+}
+
+impl<T> Option<T> {
+ const fn as_ref(&self) -> Option<&T> {
+ match *self {
+ Some(ref x) => Some(x),
+ None => None,
+ }
+ }
+
+ const fn as_mut(&mut self) -> Option<&mut T> {
+ match *self {
+ Some(ref mut x) => Some(x),
+ None => None,
+ }
+ }
+}
+
+use Option::*;
+
+/*
+const fn as_deref<T>(opt: &Option<T>) -> Option<&T::Target>
+where
+ T: ~const Deref,
+{
+ match opt {
+ Option::Some(t) => Option::Some(t.deref()),
+ Option::None => Option::None,
+ }
+}
+*/
+
+#[const_trait]
+trait Into<T>: Sized {
+ fn into(self) -> T;
+}
+
+#[const_trait]
+trait From<T>: Sized {
+ fn from(value: T) -> Self;
+}
+
+impl<T, U> const Into<U> for T
+where
+ U: ~const From<T>,
+{
+ fn into(self) -> U {
+ U::from(self)
+ }
+}
+
+impl<T> const From<T> for T {
+ fn from(t: T) -> T {
+ t
+ }
+}
+
+enum Result<T, E> {
+ Ok(T),
+ Err(E),
+}
+use Result::*;
+
+fn from_str(s: &str) -> Result<bool, ()> {
+ match s {
+ "true" => Ok(true),
+ "false" => Ok(false),
+ _ => Err(()),
+ }
+}
+
+#[lang = "eq"]
+#[const_trait]
+trait PartialEq<Rhs: ?Sized = Self> {
+ fn eq(&self, other: &Rhs) -> bool;
+ fn ne(&self, other: &Rhs) -> bool {
+ !self.eq(other)
+ }
+}
+
+// FIXME(effects): again, this should not error without Rhs specified
+impl PartialEq<str> for str {
+ fn eq(&self, other: &str) -> bool {
+ loop {}
+ }
+}
+
+
+#[lang = "not"]
+#[const_trait]
+trait Not {
+ type Output;
+ fn not(self) -> Self::Output;
+}
+
+impl const Not for bool {
+ type Output = bool;
+ fn not(self) -> bool {
+ !self
+ }
+}
+
+impl Copy for bool {}
+impl<'a> Copy for &'a str {}
+
+#[lang = "pin"]
+#[fundamental]
+#[repr(transparent)]
+struct Pin<P> {
+ pointer: P,
+}
+
+impl<P> Pin<P> {
+ #[lang = "new_unchecked"]
+ const unsafe fn new_unchecked(pointer: P) -> Pin<P> {
+ Pin { pointer }
+ }
+}
+
+impl<'a, T: ?Sized> Pin<&'a T> {
+ const fn get_ref(self) -> &'a T {
+ self.pointer
+ }
+}
+
+
+impl<P: Deref> Pin<P> {
+ /* const */ fn as_ref(&self) -> Pin<&P::Target>
+ where
+ P: /* ~const */ Deref,
+ {
+ unsafe { Pin::new_unchecked(&*self.pointer) }
+ }
+}
+
+
+impl<'a, T: ?Sized> Pin<&'a mut T> {
+ const unsafe fn get_unchecked_mut(self) -> &'a mut T {
+ self.pointer
+ }
+}
+/* FIXME lol
+impl<T> Option<T> {
+ const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
+ match Pin::get_ref(self).as_ref() {
+ Some(x) => unsafe { Some(Pin::new_unchecked(x)) },
+ None => None,
+ }
+ }
+
+ const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
+ unsafe {
+ match Pin::get_unchecked_mut(self).as_mut() {
+ Some(x) => Some(Pin::new_unchecked(x)),
+ None => None,
+ }
+ }
+ }
+}
+*/
+
+impl<P: /* ~const */ Deref> /* const */ Deref for Pin<P> {
+ type Target = P::Target;
+ fn deref(&self) -> &P::Target {
+ Pin::get_ref(Pin::as_ref(self))
+ }
+}
+
+impl<T> /* const */ Deref for Option<T> {
+ type Target = T;
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+impl<P: Receiver> Receiver for Pin<P> {}
+
+impl<T: Clone> Clone for RefCell<T> {
+ fn clone(&self) -> RefCell<T> {
+ RefCell::new(self.borrow().clone())
+ }
+}
+
+struct RefCell<T: ?Sized> {
+ borrow: UnsafeCell<()>,
+ value: UnsafeCell<T>,
+}
+impl<T> RefCell<T> {
+ const fn new(value: T) -> RefCell<T> {
+ loop {}
+ }
+}
+impl<T: ?Sized> RefCell<T> {
+ fn borrow(&self) -> Ref<'_, T> {
+ loop {}
+ }
+}
+
+#[lang = "unsafe_cell"]
+#[repr(transparent)]
+struct UnsafeCell<T: ?Sized> {
+ value: T,
+}
+
+struct Ref<'b, T: ?Sized + 'b> {
+ value: *const T,
+ borrow: &'b UnsafeCell<()>,
+}
+
+impl<T: ?Sized> Deref for Ref<'_, T> {
+ type Target = T;
+
+ #[inline]
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+#[lang = "clone"]
+#[rustc_trivial_field_reads]
+#[const_trait]
+trait Clone: Sized {
+ fn clone(&self) -> Self;
+ fn clone_from(&mut self, source: &Self)
+ where
+ Self: ~const Destruct,
+ {
+ *self = source.clone()
+ }
+}
+
+#[lang = "structural_peq"]
+trait StructuralPartialEq {}
+
+#[lang = "structural_teq"]
+trait StructuralEq {}
+
+const fn drop<T: ~const Destruct>(_: T) {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
new file mode 100644
index 000000000..024293742
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
@@ -0,0 +1,32 @@
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:33:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:37:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:343:9
+ |
+LL | !self.eq(other)
+ | ^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:365:9
+ |
+LL | !self
+ | ^^^^^ cannot apply unary operator `!`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0369, E0600.
+For more information about an error, try `rustc --explain E0369`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
new file mode 100644
index 000000000..8e4850197
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
@@ -0,0 +1,18 @@
+// aux-build: cross-crate.rs
+extern crate cross_crate;
+
+use cross_crate::{Bar, foo};
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
new file mode 100644
index 000000000..cc870ad33
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
@@ -0,0 +1,59 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:14:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:16:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:7:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:9:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
new file mode 100644
index 000000000..929da1ca8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
@@ -0,0 +1,27 @@
+#![feature(const_trait_impl, effects)]
+
+const fn foo() {}
+
+#[const_trait]
+trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+ //~| ERROR: mismatched types
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
new file mode 100644
index 000000000..0745d0304
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
@@ -0,0 +1,69 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:22:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:24:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error[E0308]: mismatched types
+ --> $DIR/no-explicit-const-params.rs:24:5
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true`
+ |
+ = note: expected constant `false`
+ found constant `true`
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:15:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:17:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0107, E0308.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
new file mode 100644
index 000000000..b30d7743e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+pub trait Owo<X = <Self as Uwu>::T> {}
+
+#[const_trait]
+pub trait Uwu: Owo {
+ type T;
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
index 8bf00eaff..e8ae7e4e3 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
@@ -13,6 +13,7 @@ LL | use core::convert::{From, TryFrom};
| ^^^^ maybe a missing crate `core`?
|
= help: consider adding `extern crate core` to use the `core` crate
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index 2897eabb0..eb12a236d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:17:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
index 9839a4f24..cd0ee7327 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
index 89d74cecf..4b720b534 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
@@ -7,7 +7,8 @@ struct Foo<const N: usize>;
impl<const N: usize> Foo<N> {
fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
- //~^ ERROR mismatched types
+ //~^ ERROR `~const` is not allowed here
+ //~| ERROR mismatched types
Foo
}
}
@@ -30,7 +31,7 @@ fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
}
fn main() {
- let foo = Foo::<0>;
- let foo = bar::<(), _>(foo);
- let _foo = bar::<(), _>(foo);
+ let foo = Foo::<0>;
+ let foo = bar::<(), _>(foo);
+ let _foo = bar::<(), _>(foo);
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
index ec5d21d33..be7a83dc1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
@@ -1,17 +1,29 @@
error: `~const` is not allowed here
- --> $DIR/tilde-const-and-const-params.rs:26:11
+ --> $DIR/tilde-const-and-const-params.rs:9:15
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/tilde-const-and-const-params.rs:9:8
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^
+
+error: `~const` is not allowed here
+ --> $DIR/tilde-const-and-const-params.rs:27:11
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
- --> $DIR/tilde-const-and-const-params.rs:26:4
+ --> $DIR/tilde-const-and-const-params.rs:27:4
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^
error[E0308]: mismatched types
- --> $DIR/tilde-const-and-const-params.rs:26:61
+ --> $DIR/tilde-const-and-const-params.rs:27:61
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^ expected `false`, found `true`
@@ -28,6 +40,6 @@ LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
= note: expected constant `false`
found constant `true`
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.
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 c94563d35..2a9647da7 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
@@ -1,35 +1,21 @@
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
+error[E0308]: mismatched types
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^ the trait `Bar` is not implemented for `T`
+ | ^^^^^^ expected `host`, found `true`
|
-note: required by a bound in `Foo::b`
- --> $DIR/trait-where-clause-const.rs:15:24
- |
-LL | fn b() where Self: ~const Bar;
- | ^^^^^^^^^^ required by this bound in `Foo::b`
-help: consider further restricting this bound
- |
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
- --> $DIR/trait-where-clause-const.rs:23:12
+error[E0308]: mismatched types
+ --> $DIR/trait-where-clause-const.rs:23:5
|
LL | T::c::<T>();
- | ^ the trait `Bar` is not implemented for `T`
- |
-note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause-const.rs:16:13
- |
-LL | fn c<T: ~const Bar>();
- | ^^^^^^^^^^ required by this bound in `Foo::c`
-help: consider further restricting this bound
+ | ^^^^^^^^^^^ expected `host`, found `true`
|
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
index 85ca5fc90..11f353f3f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
@@ -6,7 +6,9 @@ trait Bar {}
trait Foo {
fn a();
fn b() where Self: ~const Bar;
+ //~^ ERROR `~const` is not allowed here
fn c<T: ~const Bar>();
+ //~^ ERROR `~const` is not allowed here
}
fn test1<T: Foo>() {
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 255878e17..3d6fedbab 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
@@ -1,5 +1,29 @@
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:8:24
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:8:8
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^
+
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:10:13
+ |
+LL | fn c<T: ~const Bar>();
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:10:8
+ |
+LL | fn c<T: ~const Bar>();
+ | ^
+
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:14:5
+ --> $DIR/trait-where-clause.rs:16:5
|
LL | T::b();
| ^ the trait `Bar` is not implemented for `T`
@@ -15,13 +39,13 @@ LL | fn test1<T: Foo + Bar>() {
| +++++
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:16:12
+ --> $DIR/trait-where-clause.rs:18:12
|
LL | T::c::<T>();
| ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause.rs:9:13
+ --> $DIR/trait-where-clause.rs:10:13
|
LL | fn c<T: ~const Bar>();
| ^^^^^^^^^^ required by this bound in `Foo::c`
@@ -30,6 +54,6 @@ help: consider further restricting this bound
LL | fn test1<T: Foo + Bar>() {
| +++++
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
index 497ee440d..c0a322edc 100644
--- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
@@ -20,6 +20,7 @@ LL | let _: <foo::Baz as ::foo::Foo>::Bar = ();
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-fully-qualified-paths.rs:25:13
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
index f5ec287d2..1f4190665 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
@@ -861,12 +861,7 @@ LL | $($name: 'a, $name: 'a, )+;
| ^^^^^^^^^ ^^^^^^^^^
...
LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15);
- | ---------------------------------------------------------
- | |
- | in this macro invocation
- | in this macro invocation
- | in this macro invocation
- | in this macro invocation
+ | --------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove these bounds
diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
index 8769cbb35..041572be8 100644
--- a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
@@ -29,6 +29,7 @@ LL | use foo::{bar::{XX, baz::{}}};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-nested-empty-paths.rs:27:5
@@ -47,6 +48,7 @@ LL | use foo::{bar::{baz::{}, baz1::{}}};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-paths.stderr
index 354a6fe32..4a70bb7e5 100644
--- a/tests/ui/rust-2018/edition-lint-nested-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-nested-paths.stderr
@@ -20,6 +20,7 @@ LL | use foo::{a, b};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-nested-paths.rs:23:13
@@ -38,6 +39,7 @@ LL | use foo::{self as x, c};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/rust-2018/edition-lint-paths.stderr b/tests/ui/rust-2018/edition-lint-paths.stderr
index 42652be94..fde17338d 100644
--- a/tests/ui/rust-2018/edition-lint-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-paths.stderr
@@ -38,6 +38,7 @@ LL | use {main, Bar as SomethingElse};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-paths.rs:25:9
@@ -47,6 +48,7 @@ LL | use {main, Bar as SomethingElse};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-paths.rs:40:5
diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
index 45f77a0c9..8682c56d2 100644
--- a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
+++ b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
@@ -33,6 +33,7 @@ note: the tool module imported here
|
LL | use cross_crate::*;
| ^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
index 908bb4985..3dacb7969 100644
--- a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
@@ -51,6 +51,7 @@ note: the tool module imported here
|
LL | use rustfmt as imported_rustfmt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot use a tool module through an import
--> $DIR/prelude-fail-2.rs:19:13
@@ -63,6 +64,7 @@ note: the tool module imported here
|
LL | pub use rustfmt as imported_rustfmt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/sanitize/issue-111184-generator-witness.rs b/tests/ui/sanitize/issue-111184-coroutine-witness.rs
index d36d8bce5..dffb739f2 100644
--- a/tests/ui/sanitize/issue-111184-generator-witness.rs
+++ b/tests/ui/sanitize/issue-111184-coroutine-witness.rs
@@ -1,4 +1,4 @@
-// Regression test for issue 111184, where ty::GeneratorWitness were not expected to occur in
+// Regression test for issue 111184, where ty::CoroutineWitness were not expected to occur in
// encode_ty and caused the compiler to ICE.
//
// needs-sanitizer-cfi
diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
index 8328178e8..1006c3bc1 100644
--- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
+++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
@@ -3,6 +3,8 @@ error: cfi sanitizer is not supported for this target
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
index 8328178e8..1006c3bc1 100644
--- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
+++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
@@ -3,6 +3,8 @@ error: cfi sanitizer is not supported for this target
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr
new file mode 100644
index 000000000..cbf5e6c54
--- /dev/null
+++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr
@@ -0,0 +1,13 @@
+error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature
+ --> $DIR/arbitrary-self-from-method-substs.rs:8:43
+ |
+LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 {
+ | ^
+ |
+ = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
+ = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
+ = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.stderr b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr
index 6c252fadf..7378d53c3 100644
--- a/tests/ui/self/arbitrary-self-from-method-substs.stderr
+++ b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/arbitrary-self-from-method-substs.rs:14:5
+ --> $DIR/arbitrary-self-from-method-substs.rs:16:5
|
LL | foo.get::<&Foo>();
| ^^^ expected `&Foo`, found `Foo`
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.rs b/tests/ui/self/arbitrary-self-from-method-substs.rs
index 0f911a208..004445dc3 100644
--- a/tests/ui/self/arbitrary-self-from-method-substs.rs
+++ b/tests/ui/self/arbitrary-self-from-method-substs.rs
@@ -1,10 +1,12 @@
-#![feature(arbitrary_self_types)]
+// revisions: default feature
+#![cfg_attr(feature, feature(arbitrary_self_types))]
use std::ops::Deref;
struct Foo(u32);
impl Foo {
- fn get<R: Deref<Target=Self>>(self: R) -> u32 {
+ fn get<R: Deref<Target = Self>>(self: R) -> u32 {
+ //[default]~^ ERROR: `R` cannot be used as the type of `self`
self.0
}
}
@@ -12,5 +14,5 @@ impl Foo {
fn main() {
let mut foo = Foo(1);
foo.get::<&Foo>();
- //~^ ERROR mismatched types
+ //[feature]~^ ERROR mismatched types
}
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
index 13591f5b6..fdd18c6b3 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
@@ -14,6 +14,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
@@ -31,6 +32,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
= note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
index 593f70535..0a567ddcc 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
@@ -14,6 +14,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
= note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
error: aborting due to previous error
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
index ccd65ff40..a400a1672 100644
--- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
@@ -8,5 +8,6 @@ impl S {
}
fn main() {
- Pin::new(&mut S).x(); //~ ERROR no method named `x` found
+ let mut pinned = std::pin::pin!(S);
+ pinned.as_mut().x(); //~ ERROR no method named `x` found
}
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
index f34ce4dce..5dcb58611 100644
--- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
@@ -4,16 +4,14 @@ error[E0599]: no method named `x` found for struct `S` in the current scope
LL | struct S;
| -------- method `x` not found for this struct
...
-LL | fn x(self: Pin<&mut Self>) {
- | - the method is available for `Pin<&mut S>` here
-...
LL | S.x();
| ^ method not found in `S`
|
-help: consider wrapping the receiver expression with the appropriate type
+help: consider pinning the expression
+ |
+LL ~ let mut pinned = std::pin::pin!(S);
+LL ~ pinned.as_mut().x();
|
-LL | Pin::new(&mut S).x();
- | +++++++++++++ +
error: aborting due to previous error
diff --git a/tests/ui/self/self-impl.stderr b/tests/ui/self/self-impl.stderr
index 36372b644..18ffd1542 100644
--- a/tests/ui/self/self-impl.stderr
+++ b/tests/ui/self/self-impl.stderr
@@ -2,13 +2,13 @@ error[E0223]: ambiguous associated type
--> $DIR/self-impl.rs:23:16
|
LL | let _: <Self>::Baz = true;
- | ^^^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
+ | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
error[E0223]: ambiguous associated type
--> $DIR/self-impl.rs:25:16
|
LL | let _: Self::Baz = true;
- | ^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
+ | ^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
error: aborting due to 2 previous errors
diff --git a/tests/ui/self/self_type_keyword.rs b/tests/ui/self/self_type_keyword.rs
index b42bf8eea..96d24715e 100644
--- a/tests/ui/self/self_type_keyword.rs
+++ b/tests/ui/self/self_type_keyword.rs
@@ -22,6 +22,8 @@ pub fn main() {
//~^ ERROR cannot find macro `Self` in this scope
Foo { Self } => (),
//~^ ERROR expected identifier, found keyword `Self`
+ //~| ERROR mismatched types
+ //~| ERROR `Foo` does not have a field named `Self`
}
}
diff --git a/tests/ui/self/self_type_keyword.stderr b/tests/ui/self/self_type_keyword.stderr
index aca08d811..6e65fae80 100644
--- a/tests/ui/self/self_type_keyword.stderr
+++ b/tests/ui/self/self_type_keyword.stderr
@@ -31,19 +31,19 @@ LL | Foo { Self } => (),
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:29:26
+ --> $DIR/self_type_keyword.rs:31:26
|
LL | extern crate core as Self;
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:34:32
+ --> $DIR/self_type_keyword.rs:36:32
|
LL | use std::option::Option as Self;
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:39:11
+ --> $DIR/self_type_keyword.rs:41:11
|
LL | trait Self {}
| ^^^^ expected identifier, found keyword
@@ -80,7 +80,22 @@ LL | struct Bar<'Self>;
|
= help: consider removing `'Self`, referring to it in a field, or using a marker such as `PhantomData`
-error: aborting due to 12 previous errors
+error[E0308]: mismatched types
+ --> $DIR/self_type_keyword.rs:23:9
+ |
+LL | match 15 {
+ | -- this expression has type `{integer}`
+...
+LL | Foo { Self } => (),
+ | ^^^^^^^^^^^^ expected integer, found `Foo`
+
+error[E0026]: struct `Foo` does not have a field named `Self`
+ --> $DIR/self_type_keyword.rs:23:15
+ |
+LL | Foo { Self } => (),
+ | ^^^^ struct `Foo` does not have this field
+
+error: aborting due to 14 previous errors
-Some errors have detailed explanations: E0392, E0531.
-For more information about an error, try `rustc --explain E0392`.
+Some errors have detailed explanations: E0026, E0308, E0392, E0531.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs
index 45c10b378..883d718c4 100644
--- a/tests/ui/simd/array-trait.rs
+++ b/tests/ui/simd/array-trait.rs
@@ -22,6 +22,7 @@ impl Simd for i32x4 {
#[derive(Copy, Clone)]
pub struct T<S: Simd>([S::Lane; S::SIZE]);
//~^ ERROR unconstrained generic constant
+//~| ERROR SIMD vector element type should be a primitive scalar
extern "platform-intrinsic" {
fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr
index 765215c39..cf6026912 100644
--- a/tests/ui/simd/array-trait.stderr
+++ b/tests/ui/simd/array-trait.stderr
@@ -6,5 +6,12 @@ LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
|
= help: try adding a `where` bound using this expression: `where [(); S::SIZE]:`
-error: aborting due to previous error
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+ --> $DIR/array-trait.rs:23:1
+ |
+LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0077`.
diff --git a/tests/ui/sized/unsized-binding.rs b/tests/ui/sized/unsized-binding.rs
new file mode 100644
index 000000000..3b99b0f6e
--- /dev/null
+++ b/tests/ui/sized/unsized-binding.rs
@@ -0,0 +1,5 @@
+fn main() {
+ let x = *""; //~ ERROR E0277
+ println!("{}", x);
+ println!("{}", x);
+}
diff --git a/tests/ui/sized/unsized-binding.stderr b/tests/ui/sized/unsized-binding.stderr
new file mode 100644
index 000000000..af3066850
--- /dev/null
+++ b/tests/ui/sized/unsized-binding.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/unsized-binding.rs:2:9
+ |
+LL | let x = *"";
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/span/issue-37767.stderr b/tests/ui/span/issue-37767.stderr
index b612fdf16..457870821 100644
--- a/tests/ui/span/issue-37767.stderr
+++ b/tests/ui/span/issue-37767.stderr
@@ -16,12 +16,12 @@ LL | fn foo(&mut self) {}
| ^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
-LL | A::foo(&a)
- | ~~~~~~~~~~
+LL | A::foo(&mut a)
+ | ~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
-LL | B::foo(&a)
- | ~~~~~~~~~~
+LL | B::foo(&mut a)
+ | ~~~~~~~~~~~~~~
error[E0034]: multiple applicable items in scope
--> $DIR/issue-37767.rs:22:7
diff --git a/tests/ui/span/issue-39698.stderr b/tests/ui/span/issue-39698.stderr
index 81211b20a..500080832 100644
--- a/tests/ui/span/issue-39698.stderr
+++ b/tests/ui/span/issue-39698.stderr
@@ -1,3 +1,13 @@
+error[E0408]: variable `b` is not bound in all patterns
+ --> $DIR/issue-39698.rs:10:9
+ |
+LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
+ | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b`
+ | | | |
+ | | | pattern doesn't bind `b`
+ | | variable not in all patterns
+ | pattern doesn't bind `b`
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/issue-39698.rs:10:9
|
@@ -8,16 +18,6 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
| | pattern doesn't bind `c`
| pattern doesn't bind `c`
-error[E0408]: variable `d` is not bound in all patterns
- --> $DIR/issue-39698.rs:10:37
- |
-LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
- | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
- | | | |
- | | | pattern doesn't bind `d`
- | | variable not in all patterns
- | variable not in all patterns
-
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/issue-39698.rs:10:23
|
@@ -28,15 +28,15 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
| | pattern doesn't bind `a`
| variable not in all patterns
-error[E0408]: variable `b` is not bound in all patterns
- --> $DIR/issue-39698.rs:10:9
+error[E0408]: variable `d` is not bound in all patterns
+ --> $DIR/issue-39698.rs:10:37
|
LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
- | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b`
- | | | |
- | | | pattern doesn't bind `b`
- | | variable not in all patterns
- | pattern doesn't bind `b`
+ | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
+ | | | |
+ | | | pattern doesn't bind `d`
+ | | variable not in all patterns
+ | variable not in all patterns
error: aborting due to 4 previous errors
diff --git a/tests/ui/span/issue-43927-non-ADT-derive.stderr b/tests/ui/span/issue-43927-non-ADT-derive.stderr
index e3ae37e36..a22a4d2b4 100644
--- a/tests/ui/span/issue-43927-non-ADT-derive.stderr
+++ b/tests/ui/span/issue-43927-non-ADT-derive.stderr
@@ -11,11 +11,15 @@ error: `derive` attribute cannot be used at crate level
|
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | struct DerivedOn;
+ | --------- the inner attribute doesn't annotate this struct
|
help: perhaps you meant to use an outer attribute
|
-LL | #[derive(Debug, PartialEq, Eq)] // should be an outer attribute!
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
+LL + #[derive(Debug, PartialEq, Eq)] // should be an outer attribute!
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/span/lint-unused-unsafe-thir.rs b/tests/ui/span/lint-unused-unsafe-thir.rs
deleted file mode 100644
index adb72c26b..000000000
--- a/tests/ui/span/lint-unused-unsafe-thir.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-// FIXME: This file is tracking old lint behavior that's still unchanged in the
-// unstable -Zthir-unsafeck implementation. See lint-unused-unsafe.rs for more details.
-//
-// Exercise the unused_unsafe attribute in some positive and negative cases
-
-// compile-flags: -Zthir-unsafeck
-
-#![allow(dead_code)]
-#![deny(unused_unsafe)]
-
-
-mod foo {
- extern "C" {
- pub fn bar();
- }
-}
-
-fn callback<T, F>(_f: F) -> T where F: FnOnce() -> T { panic!() }
-unsafe fn unsf() {}
-
-fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
-fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block
-unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
-fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block
-unsafe fn bad5() { unsafe { unsf() } }
-fn bad6() {
- unsafe { // don't put the warning here
- unsafe { //~ ERROR: unnecessary `unsafe` block
- unsf()
- }
- }
-}
-unsafe fn bad7() {
- unsafe {
- unsafe { //~ ERROR: unnecessary `unsafe` block
- unsf()
- }
- }
-}
-
-unsafe fn good0() { unsf() }
-fn good1() { unsafe { unsf() } }
-fn good2() {
- /* bug uncovered when implementing warning about unused unsafe blocks. Be
- sure that when purity is inherited that the source of the unsafe-ness
- is tracked correctly */
- unsafe {
- unsafe fn what() -> Vec<String> { panic!() }
-
- callback(|| {
- what();
- });
- }
-}
-
-unsafe fn good3() { foo::bar() }
-fn good4() { unsafe { foo::bar() } }
-
-#[allow(unused_unsafe)] fn allowed() { unsafe {} }
-
-fn main() {}
diff --git a/tests/ui/span/lint-unused-unsafe-thir.stderr b/tests/ui/span/lint-unused-unsafe-thir.stderr
deleted file mode 100644
index 3bcbb7597..000000000
--- a/tests/ui/span/lint-unused-unsafe-thir.stderr
+++ /dev/null
@@ -1,50 +0,0 @@
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:21:13
- |
-LL | fn bad1() { unsafe {} }
- | ^^^^^^ unnecessary `unsafe` block
- |
-note: the lint level is defined here
- --> $DIR/lint-unused-unsafe-thir.rs:9:9
- |
-LL | #![deny(unused_unsafe)]
- | ^^^^^^^^^^^^^
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:22:13
- |
-LL | fn bad2() { unsafe { bad1() } }
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:23:20
- |
-LL | unsafe fn bad3() { unsafe {} }
- | ---------------- ^^^^^^ unnecessary `unsafe` block
- | |
- | because it's nested under this `unsafe` fn
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:24:13
- |
-LL | fn bad4() { unsafe { callback(||{}) } }
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:28:9
- |
-LL | unsafe { // don't put the warning here
- | ------ because it's nested under this `unsafe` block
-LL | unsafe {
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:35:9
- |
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-LL | unsafe {
- | ^^^^^^ unnecessary `unsafe` block
-
-error: aborting due to 6 previous errors
-
diff --git a/tests/ui/span/lint-unused-unsafe.mir.stderr b/tests/ui/span/lint-unused-unsafe.mir.stderr
index d8412908c..9e8d33592 100644
--- a/tests/ui/span/lint-unused-unsafe.mir.stderr
+++ b/tests/ui/span/lint-unused-unsafe.mir.stderr
@@ -1,77 +1,77 @@
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:26:13
+ --> $DIR/lint-unused-unsafe.rs:22:13
|
LL | fn bad1() { unsafe {} }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:14:9
+ --> $DIR/lint-unused-unsafe.rs:10:9
|
LL | #![deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:27:13
+ --> $DIR/lint-unused-unsafe.rs:23:13
|
LL | fn bad2() { unsafe { bad1() } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:28:20
+ --> $DIR/lint-unused-unsafe.rs:24:20
|
LL | unsafe fn bad3() { unsafe {} }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:29:13
+ --> $DIR/lint-unused-unsafe.rs:25:13
|
LL | fn bad4() { unsafe { callback(||{}) } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:32:5
+ --> $DIR/lint-unused-unsafe.rs:28:5
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:39:5
+ --> $DIR/lint-unused-unsafe.rs:35:5
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:74:9
+ --> $DIR/lint-unused-unsafe.rs:70:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:83:9
+ --> $DIR/lint-unused-unsafe.rs:79:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:84:13
+ --> $DIR/lint-unused-unsafe.rs:80:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:85:13
+ --> $DIR/lint-unused-unsafe.rs:81:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:90:9
+ --> $DIR/lint-unused-unsafe.rs:86:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:100:13
+ --> $DIR/lint-unused-unsafe.rs:96:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -80,7 +80,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:101:13
+ --> $DIR/lint-unused-unsafe.rs:97:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -89,7 +89,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:102:13
+ --> $DIR/lint-unused-unsafe.rs:98:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -98,7 +98,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:112:17
+ --> $DIR/lint-unused-unsafe.rs:108:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -107,13 +107,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:110:20
+ --> $DIR/lint-unused-unsafe.rs:106:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:113:17
+ --> $DIR/lint-unused-unsafe.rs:109:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -122,7 +122,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:114:17
+ --> $DIR/lint-unused-unsafe.rs:110:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -131,37 +131,37 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:124:9
+ --> $DIR/lint-unused-unsafe.rs:120:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:134:9
+ --> $DIR/lint-unused-unsafe.rs:130:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:135:13
+ --> $DIR/lint-unused-unsafe.rs:131:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:136:13
+ --> $DIR/lint-unused-unsafe.rs:132:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:142:9
+ --> $DIR/lint-unused-unsafe.rs:138:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:153:13
+ --> $DIR/lint-unused-unsafe.rs:149:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -170,7 +170,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:154:13
+ --> $DIR/lint-unused-unsafe.rs:150:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -179,7 +179,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:155:13
+ --> $DIR/lint-unused-unsafe.rs:151:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -188,7 +188,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:166:17
+ --> $DIR/lint-unused-unsafe.rs:162:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -197,13 +197,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:164:20
+ --> $DIR/lint-unused-unsafe.rs:160:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:167:17
+ --> $DIR/lint-unused-unsafe.rs:163:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -212,7 +212,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:168:17
+ --> $DIR/lint-unused-unsafe.rs:164:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -221,37 +221,37 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:178:9
+ --> $DIR/lint-unused-unsafe.rs:174:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:188:9
+ --> $DIR/lint-unused-unsafe.rs:184:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:189:13
+ --> $DIR/lint-unused-unsafe.rs:185:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:190:13
+ --> $DIR/lint-unused-unsafe.rs:186:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:196:9
+ --> $DIR/lint-unused-unsafe.rs:192:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:207:13
+ --> $DIR/lint-unused-unsafe.rs:203:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -260,7 +260,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:208:13
+ --> $DIR/lint-unused-unsafe.rs:204:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -269,7 +269,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:209:13
+ --> $DIR/lint-unused-unsafe.rs:205:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -278,7 +278,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:220:17
+ --> $DIR/lint-unused-unsafe.rs:216:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -287,13 +287,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:218:20
+ --> $DIR/lint-unused-unsafe.rs:214:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:221:17
+ --> $DIR/lint-unused-unsafe.rs:217:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -302,7 +302,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:222:17
+ --> $DIR/lint-unused-unsafe.rs:218:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -311,13 +311,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:242:9
+ --> $DIR/lint-unused-unsafe.rs:238:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:255:13
+ --> $DIR/lint-unused-unsafe.rs:251:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -325,7 +325,7 @@ LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:268:13
+ --> $DIR/lint-unused-unsafe.rs:264:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -333,37 +333,37 @@ LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:286:20
+ --> $DIR/lint-unused-unsafe.rs:282:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:295:20
+ --> $DIR/lint-unused-unsafe.rs:291:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:296:24
+ --> $DIR/lint-unused-unsafe.rs:292:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:297:24
+ --> $DIR/lint-unused-unsafe.rs:293:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:302:20
+ --> $DIR/lint-unused-unsafe.rs:298:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:312:24
+ --> $DIR/lint-unused-unsafe.rs:308:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -372,7 +372,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:313:24
+ --> $DIR/lint-unused-unsafe.rs:309:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -381,7 +381,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:314:24
+ --> $DIR/lint-unused-unsafe.rs:310:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -390,7 +390,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:324:28
+ --> $DIR/lint-unused-unsafe.rs:320:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -399,13 +399,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:322:20
+ --> $DIR/lint-unused-unsafe.rs:318:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:325:28
+ --> $DIR/lint-unused-unsafe.rs:321:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -414,7 +414,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:326:28
+ --> $DIR/lint-unused-unsafe.rs:322:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -423,37 +423,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:336:20
+ --> $DIR/lint-unused-unsafe.rs:332:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:346:20
+ --> $DIR/lint-unused-unsafe.rs:342:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:347:24
+ --> $DIR/lint-unused-unsafe.rs:343:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:348:24
+ --> $DIR/lint-unused-unsafe.rs:344:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:354:20
+ --> $DIR/lint-unused-unsafe.rs:350:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:365:24
+ --> $DIR/lint-unused-unsafe.rs:361:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -462,7 +462,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:366:24
+ --> $DIR/lint-unused-unsafe.rs:362:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -471,7 +471,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:367:24
+ --> $DIR/lint-unused-unsafe.rs:363:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -480,7 +480,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:378:28
+ --> $DIR/lint-unused-unsafe.rs:374:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -489,13 +489,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:376:20
+ --> $DIR/lint-unused-unsafe.rs:372:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:379:28
+ --> $DIR/lint-unused-unsafe.rs:375:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -504,7 +504,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:380:28
+ --> $DIR/lint-unused-unsafe.rs:376:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -513,37 +513,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:390:20
+ --> $DIR/lint-unused-unsafe.rs:386:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:400:20
+ --> $DIR/lint-unused-unsafe.rs:396:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:401:24
+ --> $DIR/lint-unused-unsafe.rs:397:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:402:24
+ --> $DIR/lint-unused-unsafe.rs:398:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:408:20
+ --> $DIR/lint-unused-unsafe.rs:404:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:419:24
+ --> $DIR/lint-unused-unsafe.rs:415:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -552,7 +552,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:420:24
+ --> $DIR/lint-unused-unsafe.rs:416:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -561,7 +561,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:421:24
+ --> $DIR/lint-unused-unsafe.rs:417:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -570,7 +570,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:432:28
+ --> $DIR/lint-unused-unsafe.rs:428:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -579,13 +579,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:430:20
+ --> $DIR/lint-unused-unsafe.rs:426:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:433:28
+ --> $DIR/lint-unused-unsafe.rs:429:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -594,7 +594,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:434:28
+ --> $DIR/lint-unused-unsafe.rs:430:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -603,13 +603,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:454:20
+ --> $DIR/lint-unused-unsafe.rs:450:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:467:24
+ --> $DIR/lint-unused-unsafe.rs:463:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -617,7 +617,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:480:24
+ --> $DIR/lint-unused-unsafe.rs:476:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -625,37 +625,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:499:20
+ --> $DIR/lint-unused-unsafe.rs:495:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:508:20
+ --> $DIR/lint-unused-unsafe.rs:504:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:509:24
+ --> $DIR/lint-unused-unsafe.rs:505:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:510:24
+ --> $DIR/lint-unused-unsafe.rs:506:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:515:20
+ --> $DIR/lint-unused-unsafe.rs:511:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:525:24
+ --> $DIR/lint-unused-unsafe.rs:521:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -664,7 +664,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:526:24
+ --> $DIR/lint-unused-unsafe.rs:522:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -673,7 +673,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:527:24
+ --> $DIR/lint-unused-unsafe.rs:523:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -682,7 +682,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:537:28
+ --> $DIR/lint-unused-unsafe.rs:533:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -691,13 +691,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:535:20
+ --> $DIR/lint-unused-unsafe.rs:531:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:538:28
+ --> $DIR/lint-unused-unsafe.rs:534:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -706,7 +706,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:539:28
+ --> $DIR/lint-unused-unsafe.rs:535:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -715,37 +715,37 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:549:20
+ --> $DIR/lint-unused-unsafe.rs:545:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:559:20
+ --> $DIR/lint-unused-unsafe.rs:555:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:560:24
+ --> $DIR/lint-unused-unsafe.rs:556:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:561:24
+ --> $DIR/lint-unused-unsafe.rs:557:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:567:20
+ --> $DIR/lint-unused-unsafe.rs:563:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:578:24
+ --> $DIR/lint-unused-unsafe.rs:574:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -754,7 +754,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:579:24
+ --> $DIR/lint-unused-unsafe.rs:575:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -763,7 +763,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:580:24
+ --> $DIR/lint-unused-unsafe.rs:576:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -772,7 +772,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:591:28
+ --> $DIR/lint-unused-unsafe.rs:587:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -781,13 +781,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:589:20
+ --> $DIR/lint-unused-unsafe.rs:585:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:592:28
+ --> $DIR/lint-unused-unsafe.rs:588:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -796,7 +796,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:593:28
+ --> $DIR/lint-unused-unsafe.rs:589:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -805,37 +805,37 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:603:20
+ --> $DIR/lint-unused-unsafe.rs:599:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:613:20
+ --> $DIR/lint-unused-unsafe.rs:609:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:614:24
+ --> $DIR/lint-unused-unsafe.rs:610:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:615:24
+ --> $DIR/lint-unused-unsafe.rs:611:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:621:20
+ --> $DIR/lint-unused-unsafe.rs:617:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:632:24
+ --> $DIR/lint-unused-unsafe.rs:628:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -844,7 +844,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:633:24
+ --> $DIR/lint-unused-unsafe.rs:629:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -853,7 +853,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:634:24
+ --> $DIR/lint-unused-unsafe.rs:630:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -862,7 +862,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:645:28
+ --> $DIR/lint-unused-unsafe.rs:641:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -871,13 +871,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:643:20
+ --> $DIR/lint-unused-unsafe.rs:639:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:646:28
+ --> $DIR/lint-unused-unsafe.rs:642:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -886,7 +886,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:647:28
+ --> $DIR/lint-unused-unsafe.rs:643:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -895,13 +895,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:667:20
+ --> $DIR/lint-unused-unsafe.rs:663:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:680:24
+ --> $DIR/lint-unused-unsafe.rs:676:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -909,7 +909,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:693:24
+ --> $DIR/lint-unused-unsafe.rs:689:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -917,37 +917,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:711:24
+ --> $DIR/lint-unused-unsafe.rs:707:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:721:24
+ --> $DIR/lint-unused-unsafe.rs:717:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:722:28
+ --> $DIR/lint-unused-unsafe.rs:718:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:723:28
+ --> $DIR/lint-unused-unsafe.rs:719:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:729:24
+ --> $DIR/lint-unused-unsafe.rs:725:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:740:28
+ --> $DIR/lint-unused-unsafe.rs:736:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -956,7 +956,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:741:28
+ --> $DIR/lint-unused-unsafe.rs:737:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -965,7 +965,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:742:28
+ --> $DIR/lint-unused-unsafe.rs:738:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -974,7 +974,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:753:32
+ --> $DIR/lint-unused-unsafe.rs:749:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -983,13 +983,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:751:24
+ --> $DIR/lint-unused-unsafe.rs:747:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:754:32
+ --> $DIR/lint-unused-unsafe.rs:750:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -998,7 +998,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:755:32
+ --> $DIR/lint-unused-unsafe.rs:751:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1007,37 +1007,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:765:24
+ --> $DIR/lint-unused-unsafe.rs:761:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:775:24
+ --> $DIR/lint-unused-unsafe.rs:771:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:776:28
+ --> $DIR/lint-unused-unsafe.rs:772:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:777:28
+ --> $DIR/lint-unused-unsafe.rs:773:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:783:24
+ --> $DIR/lint-unused-unsafe.rs:779:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:794:28
+ --> $DIR/lint-unused-unsafe.rs:790:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1046,7 +1046,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:795:28
+ --> $DIR/lint-unused-unsafe.rs:791:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1055,7 +1055,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:796:28
+ --> $DIR/lint-unused-unsafe.rs:792:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1064,7 +1064,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:807:32
+ --> $DIR/lint-unused-unsafe.rs:803:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1073,13 +1073,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:805:24
+ --> $DIR/lint-unused-unsafe.rs:801:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:808:32
+ --> $DIR/lint-unused-unsafe.rs:804:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1088,7 +1088,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:809:32
+ --> $DIR/lint-unused-unsafe.rs:805:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1097,13 +1097,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:829:24
+ --> $DIR/lint-unused-unsafe.rs:825:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:842:28
+ --> $DIR/lint-unused-unsafe.rs:838:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1111,7 +1111,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:855:28
+ --> $DIR/lint-unused-unsafe.rs:851:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1119,37 +1119,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:869:24
+ --> $DIR/lint-unused-unsafe.rs:865:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:879:24
+ --> $DIR/lint-unused-unsafe.rs:875:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:880:28
+ --> $DIR/lint-unused-unsafe.rs:876:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:881:28
+ --> $DIR/lint-unused-unsafe.rs:877:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:887:24
+ --> $DIR/lint-unused-unsafe.rs:883:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:898:28
+ --> $DIR/lint-unused-unsafe.rs:894:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1158,7 +1158,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:899:28
+ --> $DIR/lint-unused-unsafe.rs:895:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1167,7 +1167,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:900:28
+ --> $DIR/lint-unused-unsafe.rs:896:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1176,7 +1176,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:911:32
+ --> $DIR/lint-unused-unsafe.rs:907:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1185,13 +1185,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:909:24
+ --> $DIR/lint-unused-unsafe.rs:905:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:912:32
+ --> $DIR/lint-unused-unsafe.rs:908:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1200,7 +1200,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:913:32
+ --> $DIR/lint-unused-unsafe.rs:909:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1209,37 +1209,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:923:24
+ --> $DIR/lint-unused-unsafe.rs:919:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:933:24
+ --> $DIR/lint-unused-unsafe.rs:929:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:934:28
+ --> $DIR/lint-unused-unsafe.rs:930:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:935:28
+ --> $DIR/lint-unused-unsafe.rs:931:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:941:24
+ --> $DIR/lint-unused-unsafe.rs:937:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:952:28
+ --> $DIR/lint-unused-unsafe.rs:948:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1248,7 +1248,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:953:28
+ --> $DIR/lint-unused-unsafe.rs:949:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1257,7 +1257,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:954:28
+ --> $DIR/lint-unused-unsafe.rs:950:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1266,7 +1266,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:965:32
+ --> $DIR/lint-unused-unsafe.rs:961:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1275,13 +1275,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:963:24
+ --> $DIR/lint-unused-unsafe.rs:959:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:966:32
+ --> $DIR/lint-unused-unsafe.rs:962:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1290,7 +1290,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:967:32
+ --> $DIR/lint-unused-unsafe.rs:963:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1299,13 +1299,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:987:24
+ --> $DIR/lint-unused-unsafe.rs:983:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1000:28
+ --> $DIR/lint-unused-unsafe.rs:996:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1313,7 +1313,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1013:28
+ --> $DIR/lint-unused-unsafe.rs:1009:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1321,13 +1321,13 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1059:29
+ --> $DIR/lint-unused-unsafe.rs:1055:29
|
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1066:33
+ --> $DIR/lint-unused-unsafe.rs:1062:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1336,7 +1336,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1067:33
+ --> $DIR/lint-unused-unsafe.rs:1063:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1345,7 +1345,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1068:33
+ --> $DIR/lint-unused-unsafe.rs:1064:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1354,13 +1354,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1073:29
+ --> $DIR/lint-unused-unsafe.rs:1069:29
|
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1080:33
+ --> $DIR/lint-unused-unsafe.rs:1076:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1369,7 +1369,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1081:33
+ --> $DIR/lint-unused-unsafe.rs:1077:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1378,7 +1378,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1082:33
+ --> $DIR/lint-unused-unsafe.rs:1078:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1387,13 +1387,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1092:22
+ --> $DIR/lint-unused-unsafe.rs:1088:22
|
LL | let _x: [(); unsafe { 0 }] = [];
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1096:22
+ --> $DIR/lint-unused-unsafe.rs:1092:22
|
LL | let _x: [(); unsafe { unsafe { size() } }] = [];
| ^^^^^^ unnecessary `unsafe` block
diff --git a/tests/ui/span/lint-unused-unsafe.rs b/tests/ui/span/lint-unused-unsafe.rs
index 5d042768b..ca615f64f 100644
--- a/tests/ui/span/lint-unused-unsafe.rs
+++ b/tests/ui/span/lint-unused-unsafe.rs
@@ -3,12 +3,8 @@
// edition:2018
-// revisions: mir
-
-// FIXME: Adapt -Zthir-unsafeck to behave the same as the mir version after #93678,
-// then delete lint-unused-unsafe-thir.rs, and go back to using the settings below
-// // revisions: mir thir
-// // [thir]compile-flags: -Zthir-unsafeck
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![allow(dead_code)]
#![deny(unused_unsafe)]
diff --git a/tests/ui/span/lint-unused-unsafe.thir.stderr b/tests/ui/span/lint-unused-unsafe.thir.stderr
new file mode 100644
index 000000000..9e8d33592
--- /dev/null
+++ b/tests/ui/span/lint-unused-unsafe.thir.stderr
@@ -0,0 +1,1402 @@
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:22:13
+ |
+LL | fn bad1() { unsafe {} }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:10:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:23:13
+ |
+LL | fn bad2() { unsafe { bad1() } }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:24:20
+ |
+LL | unsafe fn bad3() { unsafe {} }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:25:13
+ |
+LL | fn bad4() { unsafe { callback(||{}) } }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:28:5
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:35:5
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:70:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:79:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:80:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:81:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:86:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:96:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:97:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:98:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:108:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:106:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:109:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:110:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:120:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:130:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:131:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:132:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:138:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:149:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:150:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:151:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:162:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:160:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:163:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:164:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:174:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:184:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:185:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:186:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:192:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:203:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:204:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:205:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:216:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:214:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:217:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:218:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:238:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:251:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:264:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:282:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:291:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:292:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:293:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:298:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:308:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:309:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:310:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:320:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:318:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:321:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:322:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:332:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:342:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:343:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:344:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:350:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:361:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:362:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:363:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:374:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:372:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:375:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:376:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:386:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:396:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:397:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:398:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:404:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:415:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:416:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:417:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:428:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:426:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:429:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:430:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:450:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:463:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:476:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:495:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:504:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:505:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:506:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:511:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:521:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:522:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:523:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:533:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:531:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:534:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:535:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:545:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:555:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:556:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:557:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:563:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:574:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:575:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:576:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:587:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:585:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:588:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:589:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:599:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:609:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:610:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:611:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:617:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:628:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:629:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:630:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:641:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:639:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:642:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:643:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:663:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:676:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:689:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:707:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:717:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:718:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:719:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:725:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:736:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:737:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:738:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:749:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:747:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:750:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:751:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:761:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:771:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:772:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:773:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:779:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:790:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:791:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:792:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:803:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:801:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:804:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:805:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:825:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:838:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:851:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:865:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:875:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:876:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:877:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:883:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:894:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:895:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:896:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:907:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:905:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:908:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:909:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:919:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:929:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:930:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:931:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:937:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:948:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:949:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:950:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:961:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:959:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:962:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:963:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:983:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:996:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1009:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1055:29
+ |
+LL | let _ = async { unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1062:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = async { unsf() };
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1063:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1064:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1069:29
+ |
+LL | let _ = async { unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1076:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = async { unsf() };
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1077:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1078:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1088:22
+ |
+LL | let _x: [(); unsafe { 0 }] = [];
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1092:22
+ |
+LL | let _x: [(); unsafe { unsafe { size() } }] = [];
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 174 previous errors
+
diff --git a/tests/ui/specialization/issue-52050.stderr b/tests/ui/specialization/issue-52050.stderr
index c263fe467..85aac16f6 100644
--- a/tests/ui/specialization/issue-52050.stderr
+++ b/tests/ui/specialization/issue-52050.stderr
@@ -11,11 +11,13 @@ LL | #![feature(specialization)]
error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`
--> $DIR/issue-52050.rs:28:1
|
-LL | impl<I> IntoPyDictPointer for I
- | ------------------------------- first implementation here
+LL | / impl<I> IntoPyDictPointer for I
+LL | | where
+LL | | I: Iterator,
+ | |________________- first implementation here
...
-LL | impl IntoPyDictPointer for ()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+LL | impl IntoPyDictPointer for ()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/specialization/min_specialization/issue-79224.rs b/tests/ui/specialization/min_specialization/issue-79224.rs
index 104bddd07..a118cb28b 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.rs
+++ b/tests/ui/specialization/min_specialization/issue-79224.rs
@@ -19,6 +19,7 @@ impl<B: ?Sized> Display for Cow<'_, B> {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
+ //~| ERROR: the trait bound `B: Clone` is not satisfied [E0277]
write!(f, "foo")
}
}
diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr
index 9a4d557a1..754157949 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.stderr
+++ b/tests/ui/specialization/min_specialization/issue-79224.stderr
@@ -22,6 +22,18 @@ help: consider further restricting this bound
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: the trait bound `B: Clone` is not satisfied
+ --> $DIR/issue-79224.rs:20:5
+ |
+LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
+ |
+ = note: required for `B` to implement `ToOwned`
+help: consider further restricting this bound
+ |
+LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
+ | +++++++++++++++++++
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/stability-attribute/stability-attribute-issue-43027.rs b/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
index 3f4fdfd01..810fbef7b 100644
--- a/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
+++ b/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
@@ -1,12 +1,12 @@
// check-pass
#![feature(staged_api)]
-#![stable(feature = "test", since = "0")]
+#![stable(feature = "test", since = "3.3.3")]
-#[stable(feature = "test", since = "0")]
+#[stable(feature = "test", since = "3.3.3")]
pub struct A<T>(pub T);
-#[stable(feature = "test", since = "0")]
-pub struct B<T>(#[stable(feature = "test", since = "0")] pub T);
+#[stable(feature = "test", since = "3.3.3")]
+pub struct B<T>(#[stable(feature = "test", since = "3.3.3")] pub T);
fn main() {
// Make sure the field is used to fill the stability cache
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.rs b/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
index 64f996352..01a46d15c 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
+++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
@@ -17,11 +17,12 @@ mod bogus_attribute_types_2 {
#[stable = "a"] //~ ERROR malformed `stable` attribute
fn f4() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "3.3.3")]
#[deprecated] //~ ERROR missing 'since'
+ //~^ ERROR missing 'note'
fn f5() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "3.3.3")]
#[deprecated = "a"] //~ ERROR missing 'since'
fn f6() { }
}
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
index a76f5be1e..8ead943ff 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
@@ -28,12 +28,19 @@ error[E0542]: missing 'since'
LL | #[deprecated]
| ^^^^^^^^^^^^^
+error[E0543]: missing 'note'
+ --> $DIR/stability-attribute-sanity-4.rs:21:5
+ |
+LL | #[deprecated]
+ | ^^^^^^^^^^^^^
+
error[E0542]: missing 'since'
- --> $DIR/stability-attribute-sanity-4.rs:25:5
+ --> $DIR/stability-attribute-sanity-4.rs:26:5
|
LL | #[deprecated = "a"]
| ^^^^^^^^^^^^^^^^^^^
-error: aborting due to 6 previous errors
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0542`.
+Some errors have detailed explanations: E0542, E0543.
+For more information about an error, try `rustc --explain E0542`.
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.rs b/tests/ui/stability-attribute/stability-attribute-sanity.rs
index cc30e6ab9..7857a0603 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity.rs
+++ b/tests/ui/stability-attribute/stability-attribute-sanity.rs
@@ -5,19 +5,19 @@
#![stable(feature = "rust1", since = "1.0.0")]
mod bogus_attribute_types_1 {
- #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
+ #[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR unknown meta item 'reason' [E0541]
fn f1() { }
#[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
fn f2() { }
- #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
+ #[stable(feature, since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
fn f3() { }
#[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
fn f5() { }
- #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
+ #[stable(feature(b), since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
fn f6() { }
}
@@ -28,7 +28,7 @@ mod missing_feature_names {
#[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
fn f2() { }
- #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
+ #[stable(since = "3.3.3")] //~ ERROR missing 'feature' [E0546]
fn f3() { }
}
@@ -36,40 +36,39 @@ mod missing_version {
#[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
fn f1() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "4.4.4")]
#[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
fn f2() { }
- #[stable(feature = "a", since = "b")]
- #[deprecated(since = "a")] //~ ERROR missing 'note' [E0543]
+ #[stable(feature = "a", since = "4.4.4")]
+ #[deprecated(since = "5.5.5")] //~ ERROR missing 'note' [E0543]
fn f3() { }
}
#[unstable(feature = "b", issue = "none")]
-#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
fn multiple1() { }
#[unstable(feature = "b", issue = "none")]
#[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
fn multiple2() { }
-#[stable(feature = "a", since = "b")]
-#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+#[stable(feature = "a", since = "4.4.4")]
+#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
fn multiple3() { }
-#[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found
-#[deprecated(since = "b", note = "text")]
-#[deprecated(since = "b", note = "text")] //~ ERROR multiple `deprecated` attributes
+#[stable(feature = "e", since = "b")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
+#[deprecated(since = "5.5.5", note = "text")]
+#[deprecated(since = "5.5.5", note = "text")] //~ ERROR multiple `deprecated` attributes
#[rustc_const_unstable(feature = "c", issue = "none")]
#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
pub const fn multiple4() { }
-#[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found
-//~^ ERROR feature `a` is declared stable since 1.0.0
-#[deprecated(since = "invalid", note = "text")]
+#[stable(feature = "a", since = "1.0.0")] //~ ERROR feature `a` is declared stable since 1.0.0
+#[deprecated(since = "invalid", note = "text")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
fn invalid_deprecation_version() {}
-#[deprecated(since = "a", note = "text")]
+#[deprecated(since = "5.5.5", note = "text")]
fn deprecated_without_unstable_or_stable() { }
//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.stderr b/tests/ui/stability-attribute/stability-attribute-sanity.stderr
index 89a8425f5..c614fc2b9 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-sanity.stderr
@@ -1,20 +1,20 @@
error: multiple `deprecated` attributes
--> $DIR/stability-attribute-sanity.rs:62:1
|
-LL | #[deprecated(since = "b", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/stability-attribute-sanity.rs:61:1
|
-LL | #[deprecated(since = "b", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0541]: unknown meta item 'reason'
- --> $DIR/stability-attribute-sanity.rs:8:42
+ --> $DIR/stability-attribute-sanity.rs:8:46
|
-LL | #[stable(feature = "a", since = "b", reason)]
- | ^^^^^^ expected one of `feature`, `since`
+LL | #[stable(feature = "a", since = "4.4.4", reason)]
+ | ^^^^^^ expected one of `feature`, `since`
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:11:29
@@ -25,7 +25,7 @@ LL | #[stable(feature = "a", since)]
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:14:14
|
-LL | #[stable(feature, since = "a")]
+LL | #[stable(feature, since = "3.3.3")]
| ^^^^^^^
error[E0539]: incorrect meta item
@@ -37,7 +37,7 @@ LL | #[stable(feature = "a", since(b))]
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:20:14
|
-LL | #[stable(feature(b), since = "a")]
+LL | #[stable(feature(b), since = "3.3.3")]
| ^^^^^^^^^^
error[E0546]: missing 'feature'
@@ -55,8 +55,8 @@ LL | #[unstable(feature = "b")]
error[E0546]: missing 'feature'
--> $DIR/stability-attribute-sanity.rs:31:5
|
-LL | #[stable(since = "a")]
- | ^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity.rs:36:5
@@ -73,14 +73,14 @@ LL | #[deprecated(note = "a")]
error[E0543]: missing 'note'
--> $DIR/stability-attribute-sanity.rs:44:5
|
-LL | #[deprecated(since = "a")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:49:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(feature = "a", since = "4.4.4")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:53:1
@@ -91,7 +91,13 @@ LL | #[unstable(feature = "b", issue = "none")]
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:57:1
|
-LL | #[stable(feature = "a", since = "b")]
+LL | #[stable(feature = "a", since = "4.4.4")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: 'since' must be a Rust version number, such as "1.31.0"
+ --> $DIR/stability-attribute-sanity.rs:60:1
+ |
+LL | #[stable(feature = "e", since = "b")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
@@ -100,31 +106,19 @@ error[E0544]: multiple stability levels
LL | #[rustc_const_unstable(feature = "d", issue = "none")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: invalid stability version found
- --> $DIR/stability-attribute-sanity.rs:60:1
+error: 'since' must be a Rust version number, such as "1.31.0"
+ --> $DIR/stability-attribute-sanity.rs:68:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid stability version
-...
-LL | pub const fn multiple4() { }
- | ---------------------------- the stability attribute annotates this item
-
-error: invalid deprecation version found
- --> $DIR/stability-attribute-sanity.rs:67:1
- |
-LL | #[stable(feature = "a", since = "1.0.0")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid deprecation version
-...
-LL | fn invalid_deprecation_version() {}
- | ----------------------------------- the stability attribute annotates this item
+LL | #[deprecated(since = "invalid", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0549]: deprecated attribute must be paired with either stable or unstable attribute
- --> $DIR/stability-attribute-sanity.rs:72:1
+ --> $DIR/stability-attribute-sanity.rs:71:1
|
-LL | #[deprecated(since = "a", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since b
+error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since 4.4.4
--> $DIR/stability-attribute-sanity.rs:67:1
|
LL | #[stable(feature = "a", since = "1.0.0")]
diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
index 1d138e264..880000ee7 100644
--- a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
+++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
@@ -1,13 +1,13 @@
#![feature(staged_api, never_type, rust_cold_cc)]
//~^ ERROR module has missing stability attribute
-#[stable(feature = "a", since = "1")]
+#[stable(feature = "a", since = "3.3.3")]
struct StableType;
#[unstable(feature = "b", issue = "none")]
struct UnstableType;
-#[stable(feature = "c", since = "1")]
+#[stable(feature = "c", since = "3.3.3")]
trait StableTrait {}
#[unstable(feature = "d", issue = "none")]
diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
index 96322c2c9..018786dd2 100644
--- a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
@@ -21,7 +21,7 @@ error: module has missing stability attribute
LL | / #![feature(staged_api, never_type, rust_cold_cc)]
LL | |
LL | |
-LL | | #[stable(feature = "a", since = "1")]
+LL | | #[stable(feature = "a", since = "3.3.3")]
... |
LL | |
LL | | fn main() {}
diff --git a/tests/ui/str/str-idx.stderr b/tests/ui/str/str-idx.stderr
index cb1a6fcac..e8bbb8058 100644
--- a/tests/ui/str/str-idx.stderr
+++ b/tests/ui/str/str-idx.stderr
@@ -7,7 +7,8 @@ LL | let _: u8 = s[4];
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
= note: required for `str` to implement `Index<{integer}>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -21,7 +22,8 @@ LL | let _ = s.get(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -36,7 +38,8 @@ LL | let _ = s.get_unchecked(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_unchecked`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
diff --git a/tests/ui/str/str-mut-idx.stderr b/tests/ui/str/str-mut-idx.stderr
index ca4b86ba3..e6835bb54 100644
--- a/tests/ui/str/str-mut-idx.stderr
+++ b/tests/ui/str/str-mut-idx.stderr
@@ -31,7 +31,8 @@ LL | s[1usize] = bot();
| ^^^^^^ string indices are ranges of `usize`
|
= help: the trait `SliceIndex<str>` is not implemented for `usize`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
= note: required for `str` to implement `Index<usize>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -45,7 +46,8 @@ LL | s.get_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -60,7 +62,8 @@ LL | s.get_unchecked_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
diff --git a/tests/ui/structs/method-chain-expression-failure.rs b/tests/ui/structs/method-chain-expression-failure.rs
new file mode 100644
index 000000000..43ebc5bac
--- /dev/null
+++ b/tests/ui/structs/method-chain-expression-failure.rs
@@ -0,0 +1,31 @@
+struct A;
+struct B;
+struct C;
+struct D;
+struct E;
+
+impl A {
+ fn b(&self) -> B { B }
+ fn foo(&self) {}
+}
+
+impl B {
+ fn c(&self) -> C { C }
+}
+
+impl C {
+ fn d(&self) -> D { D }
+ fn foo(&self) {}
+}
+
+impl D {
+ fn e(&self) -> E { E }
+}
+
+impl E {
+ fn f(&self) {}
+}
+fn main() {
+ A.b().c().d().e().foo();
+//~^ ERROR no method named `foo` found for struct `E` in the current scope
+}
diff --git a/tests/ui/structs/method-chain-expression-failure.stderr b/tests/ui/structs/method-chain-expression-failure.stderr
new file mode 100644
index 000000000..ba635ab1f
--- /dev/null
+++ b/tests/ui/structs/method-chain-expression-failure.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `foo` found for struct `E` in the current scope
+ --> $DIR/method-chain-expression-failure.rs:29:23
+ |
+LL | struct E;
+ | -------- method `foo` not found for this struct
+...
+LL | A.b().c().d().e().foo();
+ | - --- ^^^ method not found in `E`
+ | | |
+ | | method `foo` is available on `&C`
+ | method `foo` is available on `&A`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr
index acfddaf37..0c9d2aad5 100644
--- a/tests/ui/structs/struct-path-associated-type.stderr
+++ b/tests/ui/structs/struct-path-associated-type.stderr
@@ -48,19 +48,19 @@ error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:32:13
|
LL | let s = S::A {};
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:33:13
|
LL | let z = S::A::<u8> {};
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:35:9
|
LL | S::A {} => {}
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error: aborting due to 8 previous errors
diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
index 128160f10..2dd6fb6a3 100644
--- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
+++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
@@ -18,7 +18,10 @@ error[E0599]: no method named `sort` found for unit type `()` in the current sco
--> $DIR/chain-method-call-mutation-in-place.rs:3:72
|
LL | vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort();
- | ^^^^ method not found in `()`
+ | ------------- --------------------- ^^^^ method not found in `()`
+ | | |
+ | | method `sort` is available on `&mut [i32]`
+ | method `sort` is available on `Vec<i32>`
|
note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains.
--> $DIR/chain-method-call-mutation-in-place.rs:3:53
diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
index 0716005c6..8c973995c 100644
--- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
+++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn wat<T>(t: &T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | t.clone()
| ^^^^^^^^^ expected type parameter `T`, found `&T`
|
diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr
index 1cc37d611..0372a7e6c 100644
--- a/tests/ui/suggestions/deref-path-method.stderr
+++ b/tests/ui/suggestions/deref-path-method.stderr
@@ -4,6 +4,13 @@ error[E0599]: no function or associated item named `contains` found for struct `
LL | Vec::contains(&vec, &0);
| ^^^^^^^^ function or associated item not found in `Vec<_, _>`
|
+note: if you're trying to build a new `Vec<_, _>` consider using one of the following associated functions:
+ Vec::<T>::new
+ Vec::<T>::with_capacity
+ Vec::<T>::from_raw_parts
+ Vec::<T, A>::new_in
+ and 2 others
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
help: the function `contains` is implemented on `[_]`
|
LL | <[_]>::contains(&vec, &0);
diff --git a/tests/ui/suggestions/dont-suggest-ref/simple.stderr b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
index 526326524..7d902dbcc 100644
--- a/tests/ui/suggestions/dont-suggest-ref/simple.stderr
+++ b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
@@ -43,7 +43,7 @@ LL - while let Either::One(_t) = *r { }
LL + while let Either::One(_t) = r { }
|
-error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
+error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
--> $DIR/simple.rs:47:11
|
LL | match *r {
@@ -124,7 +124,7 @@ LL - while let Either::One(_t) = *rm { }
LL + while let Either::One(_t) = rm { }
|
-error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
+error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
--> $DIR/simple.rs:70:11
|
LL | match *rm {
@@ -392,7 +392,7 @@ LL - while let &Either::One(_t) = r { }
LL + while let Either::One(_t) = r { }
|
-error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
+error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
--> $DIR/simple.rs:155:11
|
LL | match r {
@@ -491,7 +491,7 @@ LL - while let &mut Either::One(_t) = rm { }
LL + while let Either::One(_t) = rm { }
|
-error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
+error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
--> $DIR/simple.rs:187:11
|
LL | match rm {
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
index 5093448d2..7c81825e5 100644
--- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
|
LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
- | - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
+ | - found this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
LL | // We could instead use an `async` block, but this way we have no std spans.
LL | x
| ^ expected `Pin<Box<...>>`, found type parameter `F`
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
|
LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
- | - this type parameter
+ | - found this type parameter
LL | Pin::new(x)
| -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F`
| |
diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
index b476d6101..2c29cfa0b 100644
--- a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
+++ b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
@@ -26,9 +26,9 @@ error: lifetime may not live long enough
--> $DIR/impl-trait-missing-lifetime.rs:16:69
|
LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
- | -------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
- | |
- | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
+ | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+ | |
+ | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/issue-101623.stderr b/tests/ui/suggestions/issue-101623.stderr
index 361483cc0..9f00de174 100644
--- a/tests/ui/suggestions/issue-101623.stderr
+++ b/tests/ui/suggestions/issue-101623.stderr
@@ -7,7 +7,8 @@ LL | Trait::do_stuff({ fun(&mut *inner) });
| | the trait `Trait<'_>` is not implemented for `*mut ()`
| required by a bound introduced by this call
|
- = help: the trait `Trait<'a>` is implemented for `()`
+ = help: the trait `Trait<'_>` is implemented for `()`
+ = help: for that trait implementation, expected `()`, found `*mut ()`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-102972.fixed b/tests/ui/suggestions/issue-102972.fixed
new file mode 100644
index 000000000..ebd73b2dc
--- /dev/null
+++ b/tests/ui/suggestions/issue-102972.fixed
@@ -0,0 +1,41 @@
+// run-rustfix
+
+fn test1() {
+ let mut chars = "Hello".chars();
+ let iter = chars.by_ref();
+ while let Some(_c) = iter.next() {
+ iter.next(); //~ ERROR cannot borrow `chars` as mutable more than once at a time
+ }
+}
+
+fn test2() {
+ let v = vec![1, 2, 3];
+ let mut iter = v.iter();
+ while let Some(_i) = iter.next() {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn test3() {
+ let v = vec![(), (), ()];
+ let mut i = v.iter();
+ let iter = i.by_ref();
+ while let Some(()) = iter.next() {
+ iter.next(); //~ ERROR cannot borrow `i`
+ }
+}
+
+fn test4() {
+ let v = vec![(), (), ()];
+ let mut iter = v.iter();
+ while let Some(()) = iter.next() {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn main() {
+ test1();
+ test2();
+ test3();
+ test4();
+}
diff --git a/tests/ui/suggestions/issue-102972.rs b/tests/ui/suggestions/issue-102972.rs
index 106288b05..1f8e97767 100644
--- a/tests/ui/suggestions/issue-102972.rs
+++ b/tests/ui/suggestions/issue-102972.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+
fn test1() {
let mut chars = "Hello".chars();
for _c in chars.by_ref() {
@@ -13,4 +15,25 @@ fn test2() {
}
}
-fn main() { }
+fn test3() {
+ let v = vec![(), (), ()];
+ let mut i = v.iter();
+ for () in i.by_ref() {
+ i.next(); //~ ERROR cannot borrow `i`
+ }
+}
+
+fn test4() {
+ let v = vec![(), (), ()];
+ let mut iter = v.iter();
+ for () in iter {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn main() {
+ test1();
+ test2();
+ test3();
+ test4();
+}
diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr
index 3303d6bbc..4b0d3b96f 100644
--- a/tests/ui/suggestions/issue-102972.stderr
+++ b/tests/ui/suggestions/issue-102972.stderr
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `chars` as mutable more than once at a time
- --> $DIR/issue-102972.rs:4:9
+ --> $DIR/issue-102972.rs:6:9
|
LL | for _c in chars.by_ref() {
| --------------
@@ -8,9 +8,17 @@ LL | for _c in chars.by_ref() {
| first borrow later used here
LL | chars.next();
| ^^^^^ second mutable borrow occurs here
+ |
+ = note: a for loop advances the iterator for you, the result is stored in `_c`
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL ~ let iter = chars.by_ref();
+LL ~ while let Some(_c) = iter.next() {
+LL ~ iter.next();
+ |
error[E0382]: borrow of moved value: `iter`
- --> $DIR/issue-102972.rs:12:9
+ --> $DIR/issue-102972.rs:14:9
|
LL | let mut iter = v.iter();
| -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait
@@ -19,10 +27,52 @@ LL | for _i in iter {
LL | iter.next();
| ^^^^ value borrowed here after move
|
+ = note: a for loop advances the iterator for you, the result is stored in `_i`
note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL | while let Some(_i) = iter.next() {
+ | ~~~~~~~~~~~~~~~ ~~~ +++++++
+
+error[E0499]: cannot borrow `i` as mutable more than once at a time
+ --> $DIR/issue-102972.rs:22:9
+ |
+LL | for () in i.by_ref() {
+ | ----------
+ | |
+ | first mutable borrow occurs here
+ | first borrow later used here
+LL | i.next();
+ | ^ second mutable borrow occurs here
+ |
+ = note: a for loop advances the iterator for you, the result is stored in its pattern
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL ~ let iter = i.by_ref();
+LL ~ while let Some(()) = iter.next() {
+LL ~ iter.next();
+ |
+
+error[E0382]: borrow of moved value: `iter`
+ --> $DIR/issue-102972.rs:30:9
+ |
+LL | let mut iter = v.iter();
+ | -------- move occurs because `iter` has type `std::slice::Iter<'_, ()>`, which does not implement the `Copy` trait
+LL | for () in iter {
+ | ---- `iter` moved due to this implicit call to `.into_iter()`
+LL | iter.next();
+ | ^^^^ value borrowed here after move
+ |
+ = note: a for loop advances the iterator for you, the result is stored in its pattern
+note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL | while let Some(()) = iter.next() {
+ | ~~~~~~~~~~~~~~~ ~~~ +++++++
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
Some errors have detailed explanations: E0382, E0499.
For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/suggestions/issue-104961.fixed b/tests/ui/suggestions/issue-104961.fixed
index 520d638b1..36917cf33 100644
--- a/tests/ui/suggestions/issue-104961.fixed
+++ b/tests/ui/suggestions/issue-104961.fixed
@@ -2,12 +2,12 @@
fn foo(x: &str) -> bool {
x.starts_with(&("hi".to_string() + " you"))
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn foo2(x: &str) -> bool {
x.starts_with(&"hi".to_string())
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn main() {
diff --git a/tests/ui/suggestions/issue-104961.rs b/tests/ui/suggestions/issue-104961.rs
index aeb787abb..25a8e0c45 100644
--- a/tests/ui/suggestions/issue-104961.rs
+++ b/tests/ui/suggestions/issue-104961.rs
@@ -2,12 +2,12 @@
fn foo(x: &str) -> bool {
x.starts_with("hi".to_string() + " you")
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn foo2(x: &str) -> bool {
x.starts_with("hi".to_string())
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn main() {
diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr
index 8cec6a3f8..7e795a74c 100644
--- a/tests/ui/suggestions/issue-104961.stderr
+++ b/tests/ui/suggestions/issue-104961.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-104961.rs:4:19
|
LL | x.starts_with("hi".to_string() + " you")
@@ -15,7 +15,7 @@ help: consider borrowing here
LL | x.starts_with(&("hi".to_string() + " you"))
| ++ +
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-104961.rs:9:19
|
LL | x.starts_with("hi".to_string())
diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr
index 4ef5948d9..644841fdf 100644
--- a/tests/ui/suggestions/issue-109291.stderr
+++ b/tests/ui/suggestions/issue-109291.stderr
@@ -6,6 +6,13 @@ LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capt
| |
| function or associated item not found in `Backtrace`
| help: there is an associated function with a similar name: `force_capture`
+ |
+note: if you're trying to build a new `Backtrace` consider using one of the following associated functions:
+ Backtrace::capture
+ Backtrace::force_capture
+ Backtrace::disabled
+ Backtrace::create
+ --> $SRC_DIR/std/src/backtrace.rs:LL:COL
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-61963.stderr b/tests/ui/suggestions/issue-61963.stderr
index b99b1b0b9..ec62153b0 100644
--- a/tests/ui/suggestions/issue-61963.stderr
+++ b/tests/ui/suggestions/issue-61963.stderr
@@ -37,6 +37,7 @@ LL | bar: Box<Bar>,
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | bar: Box<dyn Bar>,
@@ -50,6 +51,7 @@ LL | bar: Box<Bar>,
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | bar: Box<dyn Bar>,
@@ -63,6 +65,7 @@ LL | pub struct Foo {
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
@@ -76,6 +79,7 @@ LL | pub struct Foo {
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
@@ -89,6 +93,7 @@ LL | pub struct Foo {
|
= 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: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
diff --git a/tests/ui/suggestions/issue-62843.stderr b/tests/ui/suggestions/issue-62843.stderr
index b6e271de8..ead8f1854 100644
--- a/tests/ui/suggestions/issue-62843.stderr
+++ b/tests/ui/suggestions/issue-62843.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-62843.rs:4:32
|
LL | println!("{:?}", line.find(pattern));
diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr
index 6d0a0c7b3..238ee637c 100644
--- a/tests/ui/suggestions/issue-81839.stderr
+++ b/tests/ui/suggestions/issue-81839.stderr
@@ -4,15 +4,22 @@ error[E0308]: `match` arms have incompatible types
LL | / match num {
LL | | 1 => {
LL | | cx.answer_str("hi");
- | | --------------------
- | | | |
- | | | help: consider removing this semicolon
- | | this is found to be of type `()`
+ | | -------------------- this is found to be of type `()`
LL | | }
LL | | _ => cx.answer_str("hi"),
| | ^^^^^^^^^^^^^^^^^^^ expected `()`, found future
LL | | }
| |_____- `match` arms have incompatible types
+ |
+help: consider removing this semicolon
+ |
+LL - cx.answer_str("hi");
+LL + cx.answer_str("hi")
+ |
+help: consider using a semicolon here, but this will discard any values in the match arms
+ |
+LL | };
+ | +
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-83892.stderr b/tests/ui/suggestions/issue-83892.stderr
index baf6b1447..5e471819b 100644
--- a/tests/ui/suggestions/issue-83892.stderr
+++ b/tests/ui/suggestions/issue-83892.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-83892.rs:9:15
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | match () {
LL | () => func()
| ^^^^^^ expected `()`, found `u8`
diff --git a/tests/ui/suggestions/issue-84973-blacklist.rs b/tests/ui/suggestions/issue-84973-blacklist.rs
index 6813b07a2..6a35d779c 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.rs
+++ b/tests/ui/suggestions/issue-84973-blacklist.rs
@@ -1,7 +1,7 @@
// Checks that certain traits for which we don't want to suggest borrowing
// are blacklisted and don't cause the suggestion to be issued.
-#![feature(generators)]
+#![feature(coroutines)]
fn f_copy<T: Copy>(t: T) {}
fn f_clone<T: Clone>(t: T) {}
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index c8ce146ce..e0bdb6949 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 coroutine@$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 coroutine@$DIR/issue-84973-blacklist.rs:17:13: 17:22}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.fixed b/tests/ui/suggestions/lifetimes/issue-105544.fixed
index 47087eb47..c92114e18 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.fixed
+++ b/tests/ui/suggestions/lifetimes/issue-105544.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
+fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `impl Sized` may not live long enough
@@ -10,19 +10,20 @@ fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the
}
fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
//~^ ERROR the parameter type `impl Sized` may not live long enough
}
-fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
+fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `impl Sized + 'a` may not live long enough
//~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
}
-fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
+fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `T` may not live long enough
@@ -30,12 +31,13 @@ fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE th
}
fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `T` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
//~^ ERROR the parameter type `T` may not live long enough
}
-fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
+fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `T` may not live long enough
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.rs b/tests/ui/suggestions/lifetimes/issue-105544.rs
index bd3bc1ef9..bbd0f097f 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.rs
+++ b/tests/ui/suggestions/lifetimes/issue-105544.rs
@@ -10,7 +10,8 @@ fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ { //~ NOTE the parameter ty
}
fn foo1<'b>(d: impl Sized, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
//~^ ERROR the parameter type `impl Sized` may not live long enough
}
@@ -30,7 +31,8 @@ fn bar<T : Sized>(d: T, p: & mut ()) -> impl Sized + '_ { //~ NOTE the parameter
}
fn bar1<'b, T : Sized>(d: T, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `T` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
//~^ ERROR the parameter type `T` may not live long enough
}
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.stderr b/tests/ui/suggestions/lifetimes/issue-105544.stderr
index 08fe21b11..553643c0c 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.stderr
+++ b/tests/ui/suggestions/lifetimes/issue-105544.stderr
@@ -1,108 +1,86 @@
error[E0311]: the parameter type `impl Sized` may not live long enough
--> $DIR/issue-105544.rs:7:5
|
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:5:26
- |
LL | fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `impl Sized` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:7:5
- |
+ | ------- the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds
|
-LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ {
- | ++++ ++++ ++
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a {
+ | ++++ ++++ ++ ~~
error[E0309]: the parameter type `impl Sized` may not live long enough
- --> $DIR/issue-105544.rs:14:5
+ --> $DIR/issue-105544.rs:15:5
|
+LL | fn foo1<'b>(d: impl Sized, p: &'b mut ()) -> impl Sized + '_ {
+ | -- the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+...
LL | (d, p)
| ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ {
| ++++
error[E0311]: the parameter type `impl Sized + 'a` may not live long enough
- --> $DIR/issue-105544.rs:20:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:18:36
+ --> $DIR/issue-105544.rs:21:5
|
LL | fn foo2<'a>(d: impl Sized + 'a, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:20:5
- |
+ | ------- the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b {
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:27:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:25:28
+ --> $DIR/issue-105544.rs:28:5
|
LL | fn bar<T : Sized>(d: T, p: & mut ()) -> impl Sized + '_ {
- | ^^^^^^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:27:5
- |
+ | -------- the parameter type `T` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a {
+ | +++ ++++ ++ ~~
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:34:5
+ --> $DIR/issue-105544.rs:36:5
|
+LL | fn bar1<'b, T : Sized>(d: T, p: &'b mut ()) -> impl Sized + '_ {
+ | -- the parameter type `T` must be valid for the lifetime `'b` as defined here...
+...
LL | (d, p)
| ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
| ++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:40:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:38:38
+ --> $DIR/issue-105544.rs:42:5
|
LL | fn bar2<'a, T : Sized + 'a>(d: T, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:40:5
- |
+ | ------- the parameter type `T` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b {
+ | +++ ++++ ++ ~~
error: aborting due to 6 previous errors
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
index 4013d98c3..474986283 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
@@ -19,11 +19,16 @@ trait Test {
fn test(&self);
}
-fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) {
+fn func<'a, T: Test + 'a>(_dummy: &Foo, foo: &Foo<'a>, t: T) {
foo.bar(move |_| {
//~^ ERROR the parameter type `T` may not live long enough
t.test();
});
}
+// Test that the suggested fix does not overconstrain `func`. See #115375.
+fn test_func<'a, T: Test + 'a>(dummy: &Foo, foo: &Foo<'a>, t: T) {
+ func(dummy, foo, t);
+}
+
fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
index 4096d95e5..99c8e9626 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
@@ -19,11 +19,16 @@ trait Test {
fn test(&self);
}
-fn func<T: Test>(foo: &Foo, t: T) {
+fn func<T: Test>(_dummy: &Foo, foo: &Foo, t: T) {
foo.bar(move |_| {
//~^ ERROR the parameter type `T` may not live long enough
t.test();
});
}
+// Test that the suggested fix does not overconstrain `func`. See #115375.
+fn test_func<'a, T: Test + 'a>(dummy: &Foo, foo: &Foo<'a>, t: T) {
+ func(dummy, foo, t);
+}
+
fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
index 936d87f79..6c63e1ada 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
@@ -1,29 +1,18 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/missing-lifetimes-in-signature-2.rs:23:5
|
+LL | fn func<T: Test>(_dummy: &Foo, foo: &Foo, t: T) {
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | / foo.bar(move |_| {
LL | |
LL | | t.test();
LL | | });
- | |______^
+ | |______^ ...so that the type `T` will meet its required lifetime bounds
|
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature-2.rs:22:24
+help: consider adding an explicit lifetime bound
|
-LL | fn func<T: Test>(foo: &Foo, t: T) {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature-2.rs:23:5
- |
-LL | / foo.bar(move |_| {
-LL | |
-LL | | t.test();
-LL | | });
- | |______^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) {
- | +++ ++++ ++ ++++
+LL | fn func<'a, T: Test + 'a>(_dummy: &Foo, foo: &Foo<'a>, t: T) {
+ | +++ ++++ ++++
error: aborting due to previous error
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index 318ea4083..64af17c83 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -28,28 +28,18 @@ LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:30:5
|
+LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:26:26
- |
-LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:30:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_
+LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
LL | where
LL ~ G: Get<T> + 'a,
|
@@ -57,85 +47,53 @@ LL ~ G: Get<T> + 'a,
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:52:5
|
+LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:48:34
- |
-LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:52:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_
- | +++ ++++ ++
+LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:61:9
|
+LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_________^
+ | |_________^ ...so that the type `G` will meet its required lifetime bounds
|
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:60:47
+help: consider adding an explicit lifetime bound
|
-LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:61:9
- |
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_________^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + '_ {
- | +++ ++++ ++
+LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + 'c {
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:73:5
|
+LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:69:34
- |
-LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:73:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_ + 'a
- | +++ ++++ ++
+LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + 'a
+ | +++ ++++ ++ ~~
error[E0621]: explicit lifetime required in the type of `dest`
--> $DIR/missing-lifetimes-in-signature.rs:73:5
@@ -153,13 +111,16 @@ LL | | }
error[E0309]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:85:5
|
+LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
+ | -- the parameter type `G` must be valid for the lifetime `'a` as defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
| |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | G: Get<T> + 'a,
| ++++
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed b/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed
new file mode 100644
index 000000000..470cc67b9
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed
@@ -0,0 +1,47 @@
+// Make sure we suggest the bound `T: 'a` in the correct scope:
+// trait, impl or associated fn.
+// run-rustfix
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+trait Trait1<'a>: Sized where Self: 'a {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait2: Sized {
+ fn foo<'a>(self, lt: Inv<'a>) where Self: 'a {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait3<T> {
+ fn foo<'a>(arg: T, lt: Inv<'a>) where T: 'a {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait4<'a> {
+ fn foo<T: 'a>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait5<'a> {
+ fn foo(self, _: Inv<'a>);
+}
+impl<'a, T: 'a> Trait5<'a> for T {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt);
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs b/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs
new file mode 100644
index 000000000..874788e13
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs
@@ -0,0 +1,47 @@
+// Make sure we suggest the bound `T: 'a` in the correct scope:
+// trait, impl or associated fn.
+// run-rustfix
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+trait Trait1<'a>: Sized {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait2: Sized {
+ fn foo<'a>(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait3<T> {
+ fn foo<'a>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait4<'a> {
+ fn foo<T>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait5<'a> {
+ fn foo(self, _: Inv<'a>);
+}
+impl<'a, T> Trait5<'a> for T {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt);
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr b/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr
new file mode 100644
index 000000000..d3ca2cc11
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr
@@ -0,0 +1,71 @@
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:11:9
+ |
+LL | trait Trait1<'a>: Sized {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, lt: Inv<'a>) {
+LL | check_bound(self, lt)
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | trait Trait1<'a>: Sized where Self: 'a {
+ | ++++++++++++++
+
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:18:9
+ |
+LL | fn foo<'a>(self, lt: Inv<'a>) {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | check_bound(self, lt)
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(self, lt: Inv<'a>) where Self: 'a {
+ | ++++++++++++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:25:9
+ |
+LL | fn foo<'a>(arg: T, lt: Inv<'a>) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | check_bound(arg, lt)
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(arg: T, lt: Inv<'a>) where T: 'a {
+ | +++++++++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:32:9
+ |
+LL | trait Trait4<'a> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | fn foo<T>(arg: T, lt: Inv<'a>) {
+LL | check_bound(arg, lt)
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<T: 'a>(arg: T, lt: Inv<'a>) {
+ | ++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:42:9
+ |
+LL | impl<'a, T> Trait5<'a> for T {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, lt: Inv<'a>) {
+LL | check_bound(self, lt);
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | impl<'a, T: 'a> Trait5<'a> for T {
+ | ++++
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed
new file mode 100644
index 000000000..e30c55645
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed
@@ -0,0 +1,52 @@
+// We want to suggest a bound `T: 'a` but `'a` is elided,
+// run-rustfix
+// edition: 2018
+#![allow(dead_code)]
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+struct Elided<'a, T = ()>(Inv<'a>, T);
+
+struct MyTy<X>(X);
+
+impl<'a, X> MyTy<Elided<'a, X>> {
+ async fn foo<A: 'a>(self, arg: A, _: &str) -> &str {
+ check_bound(arg, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ ""
+ }
+}
+
+// Make sure the new lifetime name doesn't conflict with
+// other early- or late-bound lifetimes in-scope.
+impl<'a, A> MyTy<(A, &'a ())> {
+ async fn foo2<'b>(
+ arg: A,
+ lt: Inv<'b>,
+ ) -> (
+ impl Into<&'b str> + Into<&'b str> + 'b,
+ impl Into<Option<Elided<'b>>> + 'b,
+ impl Into<Option<Elided<'b, ()>>>,
+ ) where A: 'b {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ ("", None, None)
+ }
+
+ // same as above but there is a late-bound lifetime named `'b`.
+ async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+impl<'a, A: 'a> MyTy<Elided<'a, A>> {
+ async fn foo3(self) {
+ check_bound(self.0 .1, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs
new file mode 100644
index 000000000..85f08808b
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs
@@ -0,0 +1,52 @@
+// We want to suggest a bound `T: 'a` but `'a` is elided,
+// run-rustfix
+// edition: 2018
+#![allow(dead_code)]
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+struct Elided<'a, T = ()>(Inv<'a>, T);
+
+struct MyTy<X>(X);
+
+impl<X> MyTy<Elided<'_, X>> {
+ async fn foo<A>(self, arg: A, _: &str) -> &str {
+ check_bound(arg, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ ""
+ }
+}
+
+// Make sure the new lifetime name doesn't conflict with
+// other early- or late-bound lifetimes in-scope.
+impl<'a, A> MyTy<(A, &'a ())> {
+ async fn foo2(
+ arg: A,
+ lt: Inv<'_>,
+ ) -> (
+ impl Into<&str> + Into<&'_ str> + '_,
+ impl Into<Option<Elided>> + '_,
+ impl Into<Option<Elided<()>>>,
+ ) {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ ("", None, None)
+ }
+
+ // same as above but there is a late-bound lifetime named `'b`.
+ async fn bar2<'b>(_dummy: &'a u8, arg: A, lt: Inv<'_>) {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+impl<A> MyTy<Elided<'_, A>> {
+ async fn foo3(self) {
+ check_bound(self.0 .1, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr
new file mode 100644
index 000000000..2f74a006b
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr
@@ -0,0 +1,66 @@
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:16:9
+ |
+LL | impl<X> MyTy<Elided<'_, X>> {
+ | -- the parameter type `A` must be valid for the anonymous lifetime as defined here...
+LL | async fn foo<A>(self, arg: A, _: &str) -> &str {
+LL | check_bound(arg, self.0 .0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL ~ impl<'a, X> MyTy<Elided<'a, X>> {
+LL ~ async fn foo<A: 'a>(self, arg: A, _: &str) -> &str {
+ |
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:33:9
+ |
+LL | lt: Inv<'_>,
+ | ------- the parameter type `A` must be valid for the anonymous lifetime defined here...
+...
+LL | check_bound(arg, lt);
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL ~ async fn foo2<'b>(
+LL | arg: A,
+LL ~ lt: Inv<'b>,
+LL | ) -> (
+LL ~ impl Into<&'b str> + Into<&'b str> + 'b,
+LL ~ impl Into<Option<Elided<'b>>> + 'b,
+LL ~ impl Into<Option<Elided<'b, ()>>>,
+LL ~ ) where A: 'b {
+ |
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:40:9
+ |
+LL | async fn bar2<'b>(_dummy: &'a u8, arg: A, lt: Inv<'_>) {
+ | ------- the parameter type `A` must be valid for the anonymous lifetime defined here...
+LL | check_bound(arg, lt);
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c {
+ | +++ ~~ +++++++++++
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:47:9
+ |
+LL | impl<A> MyTy<Elided<'_, A>> {
+ | -- the parameter type `A` must be valid for the anonymous lifetime as defined here...
+LL | async fn foo3(self) {
+LL | check_bound(self.0 .1, self.0 .0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | impl<'a, A: 'a> MyTy<Elided<'a, A>> {
+ | +++ ++++ ~~
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr
index 21d237838..fa4bc2fa7 100644
--- a/tests/ui/suggestions/missing-lifetime-specifier.stderr
+++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr
@@ -164,6 +164,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -182,6 +183,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -200,6 +202,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -218,6 +221,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -254,6 +258,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -272,6 +277,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -290,6 +296,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -308,6 +315,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
diff --git a/tests/ui/suggestions/path-display.stderr b/tests/ui/suggestions/path-display.stderr
index 8359b3658..46d0b3582 100644
--- a/tests/ui/suggestions/path-display.stderr
+++ b/tests/ui/suggestions/path-display.stderr
@@ -5,6 +5,7 @@ LL | println!("{}", path);
| ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it
|
= help: the trait `std::fmt::Display` is not implemented for `Path`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
= note: this error 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)
@@ -15,6 +16,7 @@ LL | println!("{}", path);
| ^^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
|
= help: the trait `std::fmt::Display` is not implemented for `PathBuf`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
= note: this error 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)
diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr
index 14a244b79..fe8338c18 100644
--- a/tests/ui/suggestions/restrict-existing-type-bounds.stderr
+++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/restrict-existing-type-bounds.rs:13:12
|
LL | impl<T: TryAdd> TryAdd for Option<T> {
- | - this type parameter
+ | - found this type parameter
...
LL | Ok(self)
| -- ^^^^ expected `Option<<T as TryAdd>::Output>`, found `Option<T>`
@@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/restrict-existing-type-bounds.rs:26:12
|
LL | impl<T: TryAdd<Error = X>> TryAdd for Other<T> {
- | - this type parameter
+ | - found this type parameter
...
LL | Ok(self)
| -- ^^^^ expected `Other<<T as TryAdd>::Output>`, found `Other<T>`
diff --git a/tests/ui/suggestions/return-closures.stderr b/tests/ui/suggestions/return-closures.stderr
index f0810bbb2..97c13200a 100644
--- a/tests/ui/suggestions/return-closures.stderr
+++ b/tests/ui/suggestions/return-closures.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/return-closures.rs:3:5
|
LL | fn foo() {
- | - help: try adding a return type: `-> impl for<'a> Fn(&'a i32) -> i32`
+ | - help: try adding a return type: `-> impl for<'a> Fn(&'a i32) -> i32`
LL |
LL | |x: &i32| 1i32
| ^^^^^^^^^^^^^^ expected `()`, found closure
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/return-closures.rs:9:5
|
LL | fn bar(i: impl Sized) {
- | - help: a return type might be missing here: `-> _`
+ | - help: a return type might be missing here: `-> _`
LL |
LL | || i
| ^^^^ expected `()`, found closure
diff --git a/tests/ui/suggestions/silenced-binding-typo.fixed b/tests/ui/suggestions/silenced-binding-typo.fixed
new file mode 100644
index 000000000..e0f9e31be
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.fixed
@@ -0,0 +1,5 @@
+// run-rustfix
+fn main() {
+ let x = 42; //~ HELP
+ let _y = x; //~ ERROR
+}
diff --git a/tests/ui/suggestions/silenced-binding-typo.rs b/tests/ui/suggestions/silenced-binding-typo.rs
new file mode 100644
index 000000000..6cadd5a93
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.rs
@@ -0,0 +1,5 @@
+// run-rustfix
+fn main() {
+ let _x = 42; //~ HELP
+ let _y = x; //~ ERROR
+}
diff --git a/tests/ui/suggestions/silenced-binding-typo.stderr b/tests/ui/suggestions/silenced-binding-typo.stderr
new file mode 100644
index 000000000..9c0e6e265
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/silenced-binding-typo.rs:4:14
+ |
+LL | let _y = x;
+ | ^
+ |
+help: a local variable with a similar name exists, consider changing it
+ |
+LL | let x = 42;
+ | ~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/suggestions/slice-issue-87994.stderr b/tests/ui/suggestions/slice-issue-87994.stderr
index 84ecd749b..656f71eb8 100644
--- a/tests/ui/suggestions/slice-issue-87994.stderr
+++ b/tests/ui/suggestions/slice-issue-87994.stderr
@@ -1,4 +1,4 @@
-error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+error[E0277]: `[i32]` is not an iterator
--> $DIR/slice-issue-87994.rs:3:12
|
LL | for _ in v[1..] {
@@ -13,7 +13,7 @@ LL | for _ in &v[1..] {
LL | for _ in &mut v[1..] {
| ++++
-error[E0277]: `[i32]` is not an iterator
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/slice-issue-87994.rs:3:12
|
LL | for _ in v[1..] {
@@ -28,7 +28,7 @@ LL | for _ in &v[1..] {
LL | for _ in &mut v[1..] {
| ++++
-error[E0277]: the size for values of type `[K]` cannot be known at compilation time
+error[E0277]: `[K]` is not an iterator
--> $DIR/slice-issue-87994.rs:11:13
|
LL | for i2 in v2[1..] {
@@ -43,7 +43,7 @@ LL | for i2 in &v2[1..] {
LL | for i2 in &mut v2[1..] {
| ++++
-error[E0277]: `[K]` is not an iterator
+error[E0277]: the size for values of type `[K]` cannot be known at compilation time
--> $DIR/slice-issue-87994.rs:11:13
|
LL | for i2 in v2[1..] {
diff --git a/tests/ui/suggestions/suggest-dereferencing-index.stderr b/tests/ui/suggestions/suggest-dereferencing-index.stderr
index 147dc9234..adf013399 100644
--- a/tests/ui/suggestions/suggest-dereferencing-index.stderr
+++ b/tests/ui/suggestions/suggest-dereferencing-index.stderr
@@ -5,7 +5,8 @@ LL | let one_item_please: i32 = [1, 2, 3][i];
| ^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `&usize`
= note: required for `[{integer}]` to implement `Index<&usize>`
help: dereference this index
|
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed b/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
index 589ee1a47..4f2fd5ba6 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
@@ -3,9 +3,10 @@
use std::fmt::Debug;
fn foo(d: impl Debug + 'static) {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ HELP consider adding an explicit lifetime bound
bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
+//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
}
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.rs b/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
index 9a87129fb..a266e360e 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
@@ -3,9 +3,10 @@
use std::fmt::Debug;
fn foo(d: impl Debug) {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ HELP consider adding an explicit lifetime bound
bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
+//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
}
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr b/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
index cf912f4aa..1660db1aa 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `impl Debug` may not live long enough
--> $DIR/suggest-impl-trait-lifetime.rs:7:5
|
LL | bar(d);
- | ^^^^^^ ...so that the type `impl Debug` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `impl Debug` must be valid for the static lifetime...
+ | ...so that the type `impl Debug` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo(d: impl Debug + 'static) {
| +++++++++
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed b/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed
new file mode 100644
index 000000000..0a0838331
--- /dev/null
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed
@@ -0,0 +1,14 @@
+// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
+
+// Make sure we don't ICE when suggesting a return type
+// for an async fn that has late-bound vars...
+
+async fn ice(_: &i32) -> bool {
+ true
+ //~^ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
index 459b94f94..5c8f185bd 100644
--- a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
@@ -1,4 +1,7 @@
// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
// Make sure we don't ICE when suggesting a return type
// for an async fn that has late-bound vars...
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
index bff864b22..352f6da36 100644
--- a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
@@ -1,8 +1,8 @@
error[E0308]: mismatched types
- --> $DIR/suggest-ret-on-async-w-late.rs:7:5
+ --> $DIR/suggest-ret-on-async-w-late.rs:10:5
|
LL | async fn ice(_: &i32) {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | true
| ^^^^ expected `()`, found `bool`
diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
index 0ca5b9b92..0d1eed67c 100644
--- a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
+++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38
|
LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {}
- | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item`
+ | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'a S as IntoIterator>::Item`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr
index a5a65d193..5dec20718 100644
--- a/tests/ui/suggestions/trait-hidden-method.stderr
+++ b/tests/ui/suggestions/trait-hidden-method.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
+error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
--> $DIR/trait-hidden-method.rs:6:33
|
LL | Box::new(1..=10) as Box<dyn Iterator>
diff --git a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
index 7deb9a434..980c2455c 100644
--- a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
+++ b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
@@ -124,7 +124,7 @@ error[E0308]: mismatched types
--> $DIR/trait-with-missing-associated-type-restriction.rs:31:9
|
LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
- | - this type parameter
+ | - found this type parameter
LL | qux(x.func())
| --- ^^^^^^^^ expected `usize`, found type parameter `D`
| |
diff --git a/tests/ui/suggestions/unnamable-types.rs b/tests/ui/suggestions/unnamable-types.rs
index f2485041d..a4e32d7c8 100644
--- a/tests/ui/suggestions/unnamable-types.rs
+++ b/tests/ui/suggestions/unnamable-types.rs
@@ -1,7 +1,7 @@
// Test that we do not suggest to add type annotations for unnamable types.
#![crate_type="lib"]
-#![feature(generators)]
+#![feature(coroutines)]
const A = 5;
//~^ ERROR: missing type for `const` item
diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr
index 19e9af145..d003b9169 100644
--- a/tests/ui/suggestions/unnamable-types.stderr
+++ b/tests/ui/suggestions/unnamable-types.stderr
@@ -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 `{coroutine@$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/suggestions/use-type-argument-instead-of-assoc-type.stderr b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
index 175a5fbba..7c84dd4b8 100644
--- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
+++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
@@ -14,7 +14,7 @@ help: replace the generic bounds with the associated types
LL | i: Box<dyn T<usize, usize, A = usize, C = usize, B=usize>>,
| +++ +++
-error[E0191]: the value of the associated types `A` (from trait `T`), `C` (from trait `T`) must be specified
+error[E0191]: the value of the associated types `C` and `A` in `T` must be specified
--> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
|
LL | type A;
diff --git a/tests/ui/symbol-mangling-version/bad-value.bad.stderr b/tests/ui/symbol-mangling-version/bad-value.bad.stderr
new file mode 100644
index 000000000..c36c73c60
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.bad.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `bad-value` for codegen option `symbol-mangling-version` - either `legacy` or `v0` (RFC 2603) was expected
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.blank.stderr b/tests/ui/symbol-mangling-version/bad-value.blank.stderr
new file mode 100644
index 000000000..0e70af5b8
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.blank.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `` for codegen option `symbol-mangling-version` - either `legacy` or `v0` (RFC 2603) was expected
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.no-value.stderr b/tests/ui/symbol-mangling-version/bad-value.no-value.stderr
new file mode 100644
index 000000000..77013b72b
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.no-value.stderr
@@ -0,0 +1,2 @@
+error: codegen option `symbol-mangling-version` requires either `legacy` or `v0` (RFC 2603) (C symbol-mangling-version=<value>)
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.rs b/tests/ui/symbol-mangling-version/bad-value.rs
new file mode 100644
index 000000000..7623857d4
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.rs
@@ -0,0 +1,6 @@
+// revisions: no-value blank bad
+// [no-value] compile-flags: -Csymbol-mangling-version
+// [blank] compile-flags: -Csymbol-mangling-version=
+// [bad] compile-flags: -Csymbol-mangling-version=bad-value
+
+fn main() {}
diff --git a/tests/ui/symbol-mangling-version/stable.rs b/tests/ui/symbol-mangling-version/stable.rs
new file mode 100644
index 000000000..dac9bb18d
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/stable.rs
@@ -0,0 +1,5 @@
+// check-pass
+// revisions: v0
+// [v0] compile-flags: -Csymbol-mangling-version=v0
+
+fn main() {}
diff --git a/tests/ui/symbol-mangling-version/unstable.legacy.stderr b/tests/ui/symbol-mangling-version/unstable.legacy.stderr
new file mode 100644
index 000000000..c5b359b41
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/unstable.legacy.stderr
@@ -0,0 +1,2 @@
+error: `-C symbol-mangling-version=legacy` requires `-Z unstable-options`
+
diff --git a/tests/ui/symbol-mangling-version/unstable.rs b/tests/ui/symbol-mangling-version/unstable.rs
new file mode 100644
index 000000000..df87a39cd
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/unstable.rs
@@ -0,0 +1,6 @@
+// revisions: legacy legacy-ok
+// [legacy] compile-flags: -Csymbol-mangling-version=legacy
+// [legacy-ok] check-pass
+// [legacy-ok] compile-flags: -Zunstable-options -Csymbol-mangling-version=legacy
+
+fn main() {}
diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs
index 782444417..971a4654b 100644
--- a/tests/ui/target-feature/gate.rs
+++ b/tests/ui/target-feature/gate.rs
@@ -18,6 +18,7 @@
// gate-test-bpf_target_feature
// gate-test-aarch64_ver_target_feature
// gate-test-csky_target_feature
+// gate-test-loongarch_target_feature
#[target_feature(enable = "avx512bw")]
//~^ ERROR: currently unstable
diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr
index f56efb3bb..0ec7427c3 100644
--- a/tests/ui/target-feature/gate.stderr
+++ b/tests/ui/target-feature/gate.stderr
@@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable
- --> $DIR/gate.rs:22:18
+ --> $DIR/gate.rs:23:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/target-feature/similar-feature-suggestion.stderr b/tests/ui/target-feature/similar-feature-suggestion.stderr
index 2f376065f..f39dfd401 100644
--- a/tests/ui/target-feature/similar-feature-suggestion.stderr
+++ b/tests/ui/target-feature/similar-feature-suggestion.stderr
@@ -1,6 +1,6 @@
-warning: unknown feature specified for `-Ctarget-feature`: `rdrnd`
+warning: unknown and unstable feature specified for `-Ctarget-feature`: `rdrnd`
|
- = note: it is still passed through to the codegen backend
+ = note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
= help: you might have meant: `rdrand`
warning: 1 warning emitted
diff --git a/tests/ui/target-feature/unstable-feature.rs b/tests/ui/target-feature/unstable-feature.rs
new file mode 100644
index 000000000..bd0d72938
--- /dev/null
+++ b/tests/ui/target-feature/unstable-feature.rs
@@ -0,0 +1,6 @@
+// compile-flags: -Ctarget-feature=+vaes --crate-type=rlib --target=x86_64-unknown-linux-gnu
+// build-pass
+// needs-llvm-components: x86
+
+#![feature(no_core)]
+#![no_core]
diff --git a/tests/ui/target-feature/unstable-feature.stderr b/tests/ui/target-feature/unstable-feature.stderr
new file mode 100644
index 000000000..d34544c5c
--- /dev/null
+++ b/tests/ui/target-feature/unstable-feature.stderr
@@ -0,0 +1,6 @@
+warning: unstable feature specified for `-Ctarget-feature`: `vaes`
+ |
+ = note: this feature is not stably supported; its behavior can change in the future
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.mir.stderr
index 712050a25..607d7ee90 100644
--- a/tests/ui/thread-local/thread-local-static.stderr
+++ b/tests/ui/thread-local/thread-local-static.mir.stderr
@@ -1,5 +1,5 @@
error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/thread-local-static.rs:7:12
+ --> $DIR/thread-local-static.rs:10:12
|
LL | const fn g(x: &mut [u32; 8]) {
| ^
@@ -8,13 +8,13 @@ LL | const fn g(x: &mut [u32; 8]) {
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-static.rs:9:28
+ --> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
error[E0013]: constant functions cannot refer to statics
- --> $DIR/thread-local-static.rs:9:28
+ --> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
@@ -22,7 +22,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/thread-local-static.rs:9:23
+ --> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
- --> $DIR/thread-local-static.rs:9:23
+ --> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^ use of mutable static
diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs
index c7fee9e6b..afaffbb7e 100644
--- a/tests/ui/thread-local/thread-local-static.rs
+++ b/tests/ui/thread-local/thread-local-static.rs
@@ -1,7 +1,10 @@
// edition:2018
+// revisions: mir thir
+//thir: -Zthir-unsafeck
#![feature(thread_local)]
#![feature(const_swap)]
+
#[thread_local]
static mut STATIC_VAR_2: [u32; 8] = [4; 8];
const fn g(x: &mut [u32; 8]) {
diff --git a/tests/ui/thread-local/thread-local-static.thir.stderr b/tests/ui/thread-local/thread-local-static.thir.stderr
new file mode 100644
index 000000000..607d7ee90
--- /dev/null
+++ b/tests/ui/thread-local/thread-local-static.thir.stderr
@@ -0,0 +1,44 @@
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/thread-local-static.rs:10:12
+ |
+LL | const fn g(x: &mut [u32; 8]) {
+ | ^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-static.rs:12:28
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^
+
+error[E0013]: constant functions cannot refer to statics
+ --> $DIR/thread-local-static.rs:12:28
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^
+ |
+ = help: consider extracting the value of the `static` to a `const`, and referring to that
+
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/thread-local-static.rs:12:23
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/thread-local-static.rs:12:23
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0013, E0133, E0625, E0658.
+For more information about an error, try `rustc --explain E0013`.
diff --git a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
index fd53bb607..61f54ac4e 100644
--- a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
+++ b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
@@ -37,7 +37,7 @@ macro_rules! is_sync_send {
}
fn main() {
- // The iterator "generator" list should exhaust what corresponding
+ // The iterator "coroutine" list should exhaust what corresponding
// implementations have where `Sync` and `Send` semantics apply.
all_sync_send!(BinaryHeap::<usize>::new(), iter, drain, into_iter);
diff --git a/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
index 71fd5f1d4..2045dc6a3 100644
--- a/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
+++ b/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `rustfmt` in this scope
|
LL | #[derive(rustfmt)]
| ^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find attribute `rustfmt` in this scope
--> $DIR/tool-attributes-misplaced-1.rs:9:3
diff --git a/tests/ui/tool_lints.stderr b/tests/ui/tool_lints.stderr
index d36cd193b..f1d825cab 100644
--- a/tests/ui/tool_lints.stderr
+++ b/tests/ui/tool_lints.stderr
@@ -13,6 +13,7 @@ LL | #[warn(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
index b114d295d..63280b861 100644
--- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
+++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
@@ -12,8 +12,11 @@ LL + use std::borrow::Cow;
error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText`
--> $DIR/impl-bound-with-references-error.rs:9:1
|
-LL | impl<T> From<T> for LabelText
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T> From<T> for LabelText
+LL | |
+LL | | where
+LL | | T: Into<Cow<'static, str>>,
+ | |_______________________________^
|
= note: conflicting implementation in crate `core`:
- impl<T> From<T> for T;
diff --git a/tests/ui/trait-bounds/mismatch-fn-trait.stderr b/tests/ui/trait-bounds/mismatch-fn-trait.stderr
index 961e6d88f..519aa9ea3 100644
--- a/tests/ui/trait-bounds/mismatch-fn-trait.stderr
+++ b/tests/ui/trait-bounds/mismatch-fn-trait.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(u32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(u32)`
--> $DIR/mismatch-fn-trait.rs:4:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(u32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut(u32)`
| |
| required by a bound introduced by this call
|
@@ -14,11 +14,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
--> $DIR/mismatch-fn-trait.rs:9:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
| |
| required by a bound introduced by this call
|
@@ -29,11 +29,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut()`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut()`
--> $DIR/mismatch-fn-trait.rs:14:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut()`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut()`
| |
| required by a bound introduced by this call
|
@@ -44,11 +44,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(i32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(i32)`
--> $DIR/mismatch-fn-trait.rs:19:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(i32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnOnce(i32)`
| |
| required by a bound introduced by this call
|
@@ -59,11 +59,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(u32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(u32)`
--> $DIR/mismatch-fn-trait.rs:24:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(u32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnOnce(u32)`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed
new file mode 100644
index 000000000..b3f5ad52d
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+pub trait MyTrait {
+ type T;
+
+ fn bar(self) -> Self::T;
+}
+
+pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
+ return a.bar(); //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs
new file mode 100644
index 000000000..213abda77
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+pub trait MyTrait {
+ type T;
+
+ fn bar(self) -> Self::T;
+}
+
+pub fn foo<A: MyTrait, B>(a: A) -> B {
+ return a.bar(); //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr
new file mode 100644
index 000000000..61132efc4
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+ --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
+ |
+LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
+ | - - expected `B` because of return type
+ | |
+ | expected this type parameter
+LL | return a.bar();
+ | ^^^^^^^ expected type parameter `B`, found associated type
+ |
+ = note: expected type parameter `B`
+ found associated type `<A as MyTrait>::T`
+help: consider further restricting this bound
+ |
+LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
+ | +++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr
index 048a150df..a27a3ea0e 100644
--- a/tests/ui/traits/alias/object-fail.stderr
+++ b/tests/ui/traits/alias/object-fail.stderr
@@ -9,7 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
-error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
+error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
--> $DIR/object-fail.rs:9:17
|
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
new file mode 100644
index 000000000..e0edd5224
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
@@ -0,0 +1,43 @@
+// Regression test for #116464
+// Checks that we do not suggest Trait<..., Assoc=arg> when the trait
+// is referred to from one of its impls but do so at all other places
+
+pub trait Trait<T> {
+ type Assoc;
+}
+
+impl<T, S> Trait<T> for i32 {
+ type Assoc = String;
+}
+
+// Should not not trigger suggestion here...
+impl<T, S> Trait<T, S> for () {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+//... but should do so in all of the below cases except the last one
+fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+//~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ 3
+}
+
+struct Struct<T: Trait<u32, String>> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ a: T
+}
+
+trait AnotherTrait<T: Trait<T, i32>> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+impl<T: Trait<u32, String>> Struct<T> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+// Test for self type. Should not trigger suggestion as it doesn't have an
+// associated type
+trait YetAnotherTrait {}
+impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+//~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
+
+
+fn main() {
+}
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
new file mode 100644
index 000000000..711ccf1b6
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
@@ -0,0 +1,109 @@
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:14:12
+ |
+LL | impl<T, S> Trait<T, S> for () {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:12
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, Assoc = String>>(t: T) -> impl Trait<(), i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:46
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), Assoc = i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:18
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | struct Struct<T: Trait<u32, Assoc = String>> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:29:23
+ |
+LL | trait AnotherTrait<T: Trait<T, i32>> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | trait AnotherTrait<T: Trait<T, Assoc = i32>> {}
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:32:9
+ |
+LL | impl<T: Trait<u32, String>> Struct<T> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | impl<T: Trait<u32, Assoc = String>> Struct<T> {}
+ | +++++++
+
+error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:38:58
+ |
+LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+ | ^^^^^^ - help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: struct defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:8
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^^ -
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
index eb2fb6e84..1359eb6cb 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
@@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() {
fn main() {
f::<dyn for<'x> X<'x, F = i32>>();
- //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
+ //~^ expected a `FnOnce(&i32)` closure, found `i32`
}
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
index 10e82c54e..68b9319d6 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32`
+error[E0277]: expected a `FnOnce(&i32)` closure, found `i32`
--> $DIR/check-trait-object-bounds-2.rs:13:9
|
LL | f::<dyn for<'x> X<'x, F = i32>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a i32,)>` is not implemented for `i32`
note: required by a bound in `f`
diff --git a/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
new file mode 100644
index 000000000..6c3125a9f
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
@@ -0,0 +1,21 @@
+// check-pass
+trait Bar<'a> {
+ type Assoc: 'static;
+}
+
+impl<'a> Bar<'a> for () {
+ type Assoc = ();
+}
+
+struct ImplsStatic<CG: Bar<'static>> {
+ d: &'static <CG as Bar<'static>>::Assoc,
+}
+
+fn caller(b: ImplsStatic<()>)
+where
+ for<'a> (): Bar<'a>
+{
+ let _: &<() as Bar<'static>>::Assoc = b.d;
+}
+
+fn main() {}
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
index f9a934764..f8e3f8e96 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
@@ -1,7 +1,7 @@
fn strip_lf(s: &str) -> &str {
s.strip_suffix(b'\n').unwrap_or(s)
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8`
- //~| NOTE expected an `FnMut<(char,)>` closure, found `u8`
+ //~^ ERROR expected a `FnMut(char)` closure, found `u8`
+ //~| NOTE expected an `FnMut(char)` closure, found `u8`
//~| HELP the trait `FnMut<(char,)>` is not implemented for `u8`
//~| HELP the following other types implement trait `Pattern<'a>`:
//~| NOTE required for `u8` to implement `Pattern<'_>`
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
index b1c683e47..f30fe12b2 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `u8`
+error[E0277]: expected a `FnMut(char)` closure, found `u8`
--> $DIR/assoc-fn-bound-root-obligation.rs:2:7
|
LL | s.strip_suffix(b'\n').unwrap_or(s)
- | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8`
+ | ^^^^^^^^^^^^ expected an `FnMut(char)` closure, found `u8`
|
= help: the trait `FnMut<(char,)>` is not implemented for `u8`
= help: the following other types implement trait `Pattern<'a>`:
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.rs b/tests/ui/traits/bound/on-structs-and-enums-static.rs
index df3f8b8a5..066416cb3 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.rs
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.rs
@@ -8,7 +8,7 @@ struct Foo<T:Trait> {
static X: Foo<usize> = Foo {
//~^ ERROR E0277
- x: 1,
+ x: 1, //~ ERROR: E0277
};
fn main() {
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 fa14aff68..28bbe00c5 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
@@ -15,6 +15,23 @@ note: required by a bound in `Foo`
LL | struct Foo<T:Trait> {
| ^^^^^ required by this bound in `Foo`
-error: aborting due to previous error
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/on-structs-and-enums-static.rs:11:8
+ |
+LL | x: 1,
+ | ^ 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
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^ required by this bound in `Foo`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr
index e7e8a7967..30a3c40db 100644
--- a/tests/ui/traits/coercion-generic-bad.stderr
+++ b/tests/ui/traits/coercion-generic-bad.stderr
@@ -5,6 +5,7 @@ LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
|
= help: the trait `Trait<&'static str>` is implemented for `Struct`
+ = help: for that trait implementation, expected `&'static str`, found `isize`
= note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
error: aborting due to previous error
diff --git a/tests/ui/traits/copy-guessing.stderr b/tests/ui/traits/copy-guessing.stderr
index 568b7e5a6..7e676c9da 100644
--- a/tests/ui/traits/copy-guessing.stderr
+++ b/tests/ui/traits/copy-guessing.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/copy-guessing.rs:20:9
|
LL | let n = None;
- | ^
+ | ^ ---- type must be known at this point
|
help: consider giving `n` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
index 9a444be50..205b1173e 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
@@ -14,7 +14,5 @@ impl<X> Method<u32> for Thing<X> {
fn main() {
let thing = Thing(true);
- thing.method(42);
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(42); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
index 57b2587ae..2185c51e5 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
- |
-LL | thing.method(42);
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing<bool> as Method<T>>::method(thing, 42);
- | +++++++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Thing<bool> as Method<T>>::method(thing, 42);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr
index 80a502c63..06e1dfd37 100644
--- a/tests/ui/traits/issue-33140-hack-boundaries.stderr
+++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr
@@ -60,7 +60,7 @@ error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn Send
LL | impl Trait5 for dyn Send {}
| ------------------------ first implementation here
LL | impl Trait5 for dyn Send where u32: Copy {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
error: aborting due to 8 previous errors
diff --git a/tests/ui/traits/issue-38404.stderr b/tests/ui/traits/issue-38404.stderr
index f8625f53b..a5c258eb3 100644
--- a/tests/ui/traits/issue-38404.stderr
+++ b/tests/ui/traits/issue-38404.stderr
@@ -25,6 +25,7 @@ LL | trait A<T>: std::ops::Add<Self> + Sized {}
| ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-38604.stderr b/tests/ui/traits/issue-38604.stderr
index d53276024..3ab9af21b 100644
--- a/tests/ui/traits/issue-38604.stderr
+++ b/tests/ui/traits/issue-38604.stderr
@@ -11,6 +11,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/issue-38604.rs:15:9
@@ -25,6 +26,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `Box<()>` to `Box<dyn Foo>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-52893.stderr b/tests/ui/traits/issue-52893.stderr
index db807a388..c57921a08 100644
--- a/tests/ui/traits/issue-52893.stderr
+++ b/tests/ui/traits/issue-52893.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-52893.rs:53:22
|
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
- | - this type parameter
+ | - expected this type parameter
...
LL | builder.push(output);
| ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
diff --git a/tests/ui/traits/issue-59029-1.stderr b/tests/ui/traits/issue-59029-1.stderr
index 203a89285..5c47eefcd 100644
--- a/tests/ui/traits/issue-59029-1.stderr
+++ b/tests/ui/traits/issue-59029-1.stderr
@@ -2,13 +2,15 @@ error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-77982.rs b/tests/ui/traits/issue-77982.rs
index f5be6cf21..2331dda91 100644
--- a/tests/ui/traits/issue-77982.rs
+++ b/tests/ui/traits/issue-77982.rs
@@ -1,3 +1,4 @@
+// ignore-windows different list of satisfying impls
use std::collections::HashMap;
fn what() {
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index 33cc186ac..592cfd970 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -1,5 +1,5 @@
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------------ type must be known at this point
@@ -18,7 +18,7 @@ LL | opts.get::<Q>(opt.as_ref());
| +++++
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------ type must be known at this point
@@ -35,25 +35,34 @@ help: consider specifying the generic argument
LL | opts.get::<Q>(opt.as_ref());
| +++++
-error[E0282]: type annotations needed
- --> $DIR/issue-77982.rs:13:59
+error[E0283]: type annotations needed
+ --> $DIR/issue-77982.rs:14:59
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
- | ^^^^
- |
+ | --- ^^^^
+ | |
+ | type must be known at this point
+ |
+ = 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;
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();
| +++++++++++++++++++++++ ~
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:36:9
+ --> $DIR/issue-77982.rs:37:9
|
LL | let _ = ().foo();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `(): Foo<'_, _>` found
- --> $DIR/issue-77982.rs:29:1
+ --> $DIR/issue-77982.rs:30:1
|
LL | impl Foo<'static, u32> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -65,13 +74,13 @@ LL | let _: Box<T> = ().foo();
| ++++++++
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:40:9
+ --> $DIR/issue-77982.rs:41:9
|
LL | let _ = (&()).bar();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `&(): Bar<'_, _>` found
- --> $DIR/issue-77982.rs:32:1
+ --> $DIR/issue-77982.rs:33:1
|
LL | impl<'a> Bar<'static, u32> for &'a () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,5 +93,4 @@ LL | let _: Box<T> = (&()).bar();
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr
index f53813189..244cc2fc5 100644
--- a/tests/ui/traits/item-privacy.stderr
+++ b/tests/ui/traits/item-privacy.stderr
@@ -8,11 +8,10 @@ LL | S.a();
| ^ method not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no method named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:68:7
@@ -51,11 +50,10 @@ LL | S::a(&S);
| ^ function or associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:80:8
@@ -91,11 +89,10 @@ LL | S::A;
| ^ associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:24:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use assoc_const::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no associated item named `B` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:98:8
@@ -143,6 +140,7 @@ LL | const C: u8 = 0;
= help: consider moving `C` to another trait
= help: consider moving `A` to another trait
= help: consider moving `B` to another trait
+ = help: only type `S` implements the trait, consider using it directly instead
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:115:12
@@ -159,13 +157,13 @@ error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:116:12
|
LL | let _: S::B;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::B>::B`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:117:12
|
LL | let _: S::C;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::C>::C`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
error[E0624]: associated type `A` is private
--> $DIR/item-privacy.rs:119:12
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.rs b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
index aa74e11c3..36e1e868f 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.rs
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
@@ -25,7 +25,6 @@ where T : Convert<U>
fn a() {
test(22, std::default::Default::default());
//~^ ERROR type annotations needed
- //~| ERROR type annotations needed
}
fn main() {}
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
index e927f26e9..e3bfc78bb 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
- |
-LL | test(22, std::default::Default::default());
- | ^^^^ cannot infer type of the type parameter `U` declared on the function `test`
- |
-help: consider specifying the generic arguments
- |
-LL | test::<i32, U>(22, std::default::Default::default());
- | ++++++++++
-
error[E0283]: type annotations needed
--> $DIR/multidispatch-convert-ambig-dest.rs:26:5
|
@@ -37,7 +26,6 @@ help: consider specifying the generic arguments
LL | test::<i32, U>(22, std::default::Default::default());
| ++++++++++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs
index 38d83d289..825e874d7 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.rs
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs
@@ -27,6 +27,5 @@ fn main() {
//~| ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed`
//~| ERROR overflow evaluating the requirement `String <: <() as Foo>::Item`
//~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed`
- //~| ERROR type annotations needed
println!("{x}");
}
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
index abc6677c1..ca4b5c90f 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
@@ -11,18 +11,7 @@ note: required by a bound in `Foo::Item`
LL | type Item: Copy
| ^^^^ required by this bound in `Foo::Item`
-error[E0282]: type annotations needed
- --> $DIR/alias-bound-unsound.rs:24:5
- |
-LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^ cannot infer type of the type parameter `T` declared on the function `drop`
- |
-help: consider specifying the generic argument
- |
-LL | drop::<T>(<() as Foo>::copy_me(&x));
- | +++++
-
-error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
--> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
@@ -30,40 +19,39 @@ LL | drop(<() as Foo>::copy_me(&x));
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
- --> $DIR/alias-bound-unsound.rs:24:31
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
+ --> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+ = note: the return type of a function must have a statically known size
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
- --> $DIR/alias-bound-unsound.rs:24:10
+error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+ --> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
- = note: the return type of a function must have a statically known size
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
index 47004821a..414deb477 100644
--- a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/runaway-impl-candidate-selection.rs:13:22
|
LL | println!("{:?}", iter::<_>());
| ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter`
+ |
+ = note: cannot satisfy `_: Iterator`
+note: required by a bound in `iter`
+ --> $DIR/runaway-impl-candidate-selection.rs:8:12
+ |
+LL | fn iter<T: Iterator>() -> <T as Iterator>::Item {
+ | ^^^^^^^^ required by this bound in `iter`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
index 17a43838f..41bf68a1d 100644
--- a/tests/ui/traits/new-solver/coherence/issue-102048.stderr
+++ b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
@@ -1,11 +1,15 @@
error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
--> $DIR/issue-102048.rs:39:1
|
-LL | impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
- | --------------------------------------------------------------------------------------------------- first implementation here
+LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
+LL | | where
+LL | | T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
+LL | | U: for<'a> WithAssoc2<'a>,
+ | |______________________________- first implementation here
...
-LL | impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)`
+LL | / impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
+LL | | U: for<'a> WithAssoc1<'a>
+ | |_____________________________^ conflicting implementation for `(_, _)`
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/coroutine.fail.stderr b/tests/ui/traits/new-solver/coroutine.fail.stderr
new file mode 100644
index 000000000..14e67727d
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.fail.stderr
@@ -0,0 +1,64 @@
+error[E0277]: the trait bound `{coroutine@$DIR/coroutine.rs:18:21: 18:23}: Coroutine<A>` is not satisfied
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:18:21: 18:23}`
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:28
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Yield == B`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:41
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Return == C`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:52
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0271, E0277.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/coroutine.rs b/tests/ui/traits/new-solver/coroutine.rs
new file mode 100644
index 000000000..af16f70fb
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Ztrait-solver=next
+// edition: 2021
+// revisions: pass fail
+//[pass] check-pass
+
+#![feature(coroutine_trait, coroutines)]
+
+use std::ops::Coroutine;
+
+struct A;
+struct B;
+struct C;
+
+fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+
+#[cfg(fail)]
+fn main() {
+ needs_coroutine(|| {
+ //[fail]~^ ERROR Coroutine<A>` is not satisfied
+ //[fail]~| ERROR as Coroutine<A>>::Yield == B`
+ //[fail]~| ERROR as Coroutine<A>>::Return == C`
+ yield ();
+ });
+}
+
+#[cfg(pass)]
+fn main() {
+ needs_coroutine(|_: A| {
+ let _: A = yield B;
+ C
+ })
+}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
index fcafdcf63..44e763ef9 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
@@ -27,6 +27,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement
+ //~^ ERROR overflow evaluating the requirement
}
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 a86115671..1ac0e2977 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
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/fixpoint-exponential-growth.rs:29:5
- |
-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:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
new file mode 100644
index 000000000..51f62bc23
--- /dev/null
+++ b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
@@ -0,0 +1,10 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Foo {
+ fn test() -> impl Fn(u32) -> u32 {
+ |x| x.count_ones()
+ }
+}
+
+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
index 7ad495a35..368f5cd0c 100644
--- a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
@@ -13,7 +13,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `()`
LL | impl Foo for () {}
| --------------- first implementation here
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
- | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/new-solver/fn-trait.rs
index 0599e51d7..0a19e6265 100644
--- a/tests/ui/traits/new-solver/fn-trait.rs
+++ b/tests/ui/traits/new-solver/fn-trait.rs
@@ -18,15 +18,15 @@ fn main() {
require_fn(f);
require_fn(f as fn() -> i32);
require_fn(f as unsafe fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(g);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
require_fn(g as extern "C" fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(h);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
}
diff --git a/tests/ui/traits/new-solver/fn-trait.stderr b/tests/ui/traits/new-solver/fn-trait.stderr
index d52bcaf25..e33487235 100644
--- a/tests/ui/traits/new-solver/fn-trait.stderr
+++ b/tests/ui/traits/new-solver/fn-trait.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32`
--> $DIR/fn-trait.rs:20:16
|
LL | require_fn(f as unsafe fn() -> i32);
@@ -7,6 +7,7 @@ LL | require_fn(f as unsafe fn() -> i32);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
@@ -28,11 +29,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
--> $DIR/fn-trait.rs:23:16
|
LL | require_fn(g);
- | ---------- ^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ | ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
| |
| required by a bound introduced by this call
|
@@ -58,11 +59,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
--> $DIR/fn-trait.rs:26:16
|
LL | require_fn(g as extern "C" fn() -> i32);
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `extern "C" fn() -> i32`
| |
| required by a bound introduced by this call
|
@@ -88,7 +89,7 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
--> $DIR/fn-trait.rs:29:16
|
LL | require_fn(h);
@@ -97,6 +98,7 @@ LL | require_fn(h);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() -> i32 {h}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32 {h}` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
index 9a8060133..9aa4f4531 100644
--- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed: cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
--> $DIR/generalize-proj-new-universe-index-2.rs:74:5
|
LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
+ |
+note: required by a bound in `bound`
+ --> $DIR/generalize-proj-new-universe-index-2.rs:69:21
+ |
+LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+ | ----- required by a bound in this function
+LL | where
+LL | T: WithAssoc<U, Assoc = V>,
+ | ^^^^^^^^^ required by this bound in `bound`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr
deleted file mode 100644
index e3fe4bf5a..000000000
--- a/tests/ui/traits/new-solver/generator.fail.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-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(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ 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
- |
-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`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:41
- |
-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`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:52
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^^ required by this bound in `needs_generator`
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0271, E0277.
-For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/generator.rs b/tests/ui/traits/new-solver/generator.rs
deleted file mode 100644
index 364373ca8..000000000
--- a/tests/ui/traits/new-solver/generator.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// compile-flags: -Ztrait-solver=next
-// edition: 2021
-// revisions: pass fail
-//[pass] check-pass
-
-#![feature(generator_trait, generators)]
-
-use std::ops::Generator;
-
-struct A;
-struct B;
-struct C;
-
-fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
-
-#[cfg(fail)]
-fn main() {
- needs_generator(|| {
- //[fail]~^ ERROR Generator<A>` is not satisfied
- //[fail]~| ERROR as Generator<A>>::Yield == B`
- //[fail]~| ERROR as Generator<A>>::Return == C`
- yield ();
- });
-}
-
-#[cfg(pass)]
-fn main() {
- needs_generator(|_: A| {
- let _: A = yield B;
- C
- })
-}
diff --git a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
new file mode 100644
index 000000000..cc16cc871
--- /dev/null
+++ b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
@@ -0,0 +1,9 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+// edition:2021
+
+trait Foo {
+ async fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
index 062832012..f482e8cfa 100644
--- a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
+++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:36:5
|
LL | foo(unconstrained())
- | ^^^ cannot infer type of the type parameter `T` declared on the function `foo`
+ | ^^^ --------------- type must be known at this point
+ | |
+ | cannot infer type of the type parameter `T` declared on the function `foo`
|
+ = note: cannot satisfy `_: Trait`
+note: required by a bound in `foo`
+ --> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:19:11
+ |
+LL | fn foo<T: Trait<Assoc = u8>>(x: T) {}
+ | ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
|
LL | foo::<T>(unconstrained())
@@ -11,4 +19,4 @@ LL | foo::<T>(unconstrained())
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/new-solver/object-unsafety.stderr
index bb7c68b89..914a8f9d4 100644
--- a/tests/ui/traits/new-solver/object-unsafety.stderr
+++ b/tests/ui/traits/new-solver/object-unsafety.stderr
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
LL | pub fn copy_any<T>(t: &T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | copy::<dyn Setup<From=T>>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
index b37f09ee1..3d2e70a63 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
@@ -15,6 +15,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement `W<_>: Trait`
+ //~^ ERROR overflow evaluating the requirement `W<_>: Trait`
}
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 beed40f36..023efc41a 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/exponential-trait-goals.rs:17:5
- |
-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:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs
index f6b19e7ad..fac7d76f8 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.rs
+++ b/tests/ui/traits/new-solver/specialization-transmute.rs
@@ -10,7 +10,7 @@ trait Default {
}
impl<T> Default for T {
- default type Id = T;
+ default type Id = T; //~ ERROR type annotations needed
// This will be fixed by #111994
fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed
self
diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/new-solver/specialization-transmute.stderr
index 09b1405fe..18965a465 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.stderr
+++ b/tests/ui/traits/new-solver/specialization-transmute.stderr
@@ -16,6 +16,13 @@ LL | fn intu(&self) -> &Self::Id {
|
= note: cannot satisfy `<T as Default>::Id == _`
-error: aborting due to previous error; 1 warning emitted
+error[E0282]: type annotations needed
+ --> $DIR/specialization-transmute.rs:13:23
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
+error: aborting due to 2 previous errors; 1 warning emitted
-For more information about this error, try `rustc --explain E0284`.
+Some errors have detailed explanations: E0282, E0284.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
index 9915da1a2..ed4dafa14 100644
--- a/tests/ui/traits/new-solver/specialization-unconstrained.stderr
+++ b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
@@ -8,12 +8,6 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
-error[E0282]: type annotations needed
- --> $DIR/specialization-unconstrained.rs:14:22
- |
-LL | default type Id = T;
- | ^ cannot infer type for associated type `<T as Default>::Id`
-
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
--> $DIR/specialization-unconstrained.rs:20:5
|
@@ -26,6 +20,12 @@ note: required by a bound in `test`
LL | fn test<T: Default<Id = U>, U>() {}
| ^^^^^^ required by this bound in `test`
+error[E0282]: type annotations needed
+ --> $DIR/specialization-unconstrained.rs:14:22
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0282, E0284.
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5: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
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5: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
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
new file mode 100644
index 000000000..9a8a5ced2
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
@@ -0,0 +1,16 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete and may not be safe
+
+fn trivial<A>()
+where
+ for<B> dyn Fn(A, *const B): Fn(A, *const B),
+{
+}
+
+fn main() {
+ trivial::<u8>();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
index ed9b57cb1..d8db07277 100644
--- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
+++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
@@ -23,13 +23,13 @@ LL | where
LL | for<V> V: Sized,
| ^^^^^ required by this bound in `foo`
-error[E0277]: the size for values of type `V` cannot be known at compilation time
+error[E0277]: `V` is not an iterator
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ doesn't have a size known at compile-time
+ | ^^^ `V` is not an iterator
|
- = help: the trait `Sized` is not implemented for `V`
+ = help: the trait `Iterator` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
@@ -40,13 +40,13 @@ LL | where
LL | for<V> V: IntoIterator,
| ^^^^^^^^^^^^ required by this bound in `bar`
-error[E0277]: `V` is not an iterator
+error[E0277]: the size for values of type `V` cannot be known at compilation time
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ `V` is not an iterator
+ | ^^^ doesn't have a size known at compile-time
|
- = help: the trait `Iterator` is not implemented for `V`
+ = help: the trait `Sized` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
diff --git a/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
new file mode 100644
index 000000000..b999f251d
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+trait Foo {
+ type Bar<T>
+ where
+ dyn Send + 'static: Send;
+}
+
+impl Foo for () {
+ type Bar<T> = i32;
+ // We take `<() as Foo>::Bar<T>: Sized` and normalize it under the where clause
+ // of `for<S> <() as Foo>::Bar<S> = i32`. This gives us back `i32: Send` with
+ // the nested obligation `(dyn Send + 'static): Send`. However, during candidate
+ // assembly for object types, we disqualify any obligations that has non-region
+ // late-bound vars in the param env(!), rather than just the predicate. This causes
+ // the where clause to not hold even though it trivially should.
+}
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.rs b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
new file mode 100644
index 000000000..c501e057e
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete
+
+trait Trait<T: ?Sized> {}
+
+impl<T: ?Sized> Trait<T> for i32 {}
+
+fn produce() -> impl for<T> Trait<T> {
+ 16
+}
+
+fn main() {
+ let _ = produce();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.stderr b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
new file mode 100644
index 000000000..34c56068c
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/on-rpit.rs:3: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
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
index d56519223..b6e540c5f 100644
--- a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
+++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
@@ -20,6 +20,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `&()` to `&dyn Foo`
error[E0038]: the trait `Foo` cannot be made into an object
@@ -35,6 +36,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/supertrait-object-safety.rs:22:5
@@ -49,6 +51,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error: aborting due to 3 previous errors; 1 warning emitted
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
index 538e74ee1..e9e2f6b12 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
@@ -18,7 +18,5 @@ where
fn main() {
let a = A(B);
- a.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ a.method(); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
index 92d9d32cf..86ae49b32 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
- |
-LL | a.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <A<B> as V<U>>::method(a);
- | +++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
|
@@ -35,7 +24,6 @@ help: try using a fully qualified path to specify the expected types
LL | <A<B> as V<U>>::method(a);
| +++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
new file mode 100644
index 000000000..21f7fd92e
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
@@ -0,0 +1,7 @@
+trait Foo {
+ type Bar<T>;
+}
+
+fn bar(x: &dyn Foo) {} //~ ERROR the trait `Foo` cannot be made into an object
+
+fn main() {}
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
new file mode 100644
index 000000000..fcaa583e2
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
@@ -0,0 +1,18 @@
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-unsafe-missing-assoc-type.rs:5:16
+ |
+LL | fn bar(x: &dyn Foo) {}
+ | ^^^ `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-unsafe-missing-assoc-type.rs:2:10
+ |
+LL | trait Foo {
+ | --- this trait cannot be made into an object...
+LL | type Bar<T>;
+ | ^^^ ...because it contains the generic associated type `Bar`
+ = help: consider moving `Bar` to another trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/traits/object/print_vtable_sizes.stdout b/tests/ui/traits/object/print_vtable_sizes.stdout
index ce90c7621..b43e168df 100644
--- a/tests/ui/traits/object/print_vtable_sizes.stdout
+++ b/tests/ui/traits/object/print_vtable_sizes.stdout
@@ -1,11 +1,11 @@
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
diff --git a/tests/ui/traits/object/safety.stderr b/tests/ui/traits/object/safety.stderr
index a51b69759..19a46a502 100644
--- a/tests/ui/traits/object/safety.stderr
+++ b/tests/ui/traits/object/safety.stderr
@@ -11,6 +11,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
= note: required for the cast from `&St` to `&dyn Tr`
help: consider turning `foo` into a method by giving it a `&self` argument
|
@@ -34,6 +35,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self);
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.rs b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
index f34fa80a0..9515397fb 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.rs
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
@@ -43,8 +43,8 @@ impl NormalizableHelper for u32
fn main() {
let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
let _y: Box<dyn NormalizableHelper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
}
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
index 641bfe236..c9b36e8d2 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:45:21
|
LL | type Output;
@@ -7,7 +7,7 @@ LL | type Output;
LL | let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
| ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper<Target=i32, Output = Type>`
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:48:21
|
LL | type Output;
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
index 7a8433f90..d03d733c7 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.fixed
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(*c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs
index 51bac2107..9d9ffb3f5 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.rs
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
index 1363fb8c4..a19708e46 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(char,)>` closure, found `char`
+error[E0277]: expected a `Fn(char)` closure, found `char`
--> $DIR/root-obligation.rs:6:38
|
LL | .filter(|c| "aeiou".contains(c))
- | -------- ^ expected an `Fn<(char,)>` closure, found `char`
+ | -------- ^ expected an `Fn(char)` closure, found `char`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 2aea3783f..43cef7027 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-closure.rs:23:7
- |
-LL | q.lol(||());
- | ^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
- | +++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-closure.rs:23:7
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
index 9a2cf469d..f0861857b 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut thing = Thing;
- thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(); //~ ERROR type annotations needed
thing.mut_method(); //~ ERROR type annotations needed
thing.by_self(); //~ ERROR type annotations needed
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
index 68b31a1ca..841acb5ff 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
- |
-LL | thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(&thing);
- | ++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(&thing);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11
|
LL | thing.mut_method();
| ^^^^^^^^^^
@@ -48,7 +37,7 @@ LL | <Thing as Method<T>>::mut_method(&mut thing);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11
|
LL | thing.by_self();
| ^^^^^^^
@@ -67,7 +56,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&thing);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14
|
LL | deref_to.method();
| ^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::method(&deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -105,7 +94,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -124,7 +113,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&deref_to);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::method(&deref_deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -162,7 +151,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -180,7 +169,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(&deref_deref_to);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
index da640c8c8..6a63e27f7 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut ref_thing = &Thing;
- ref_thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ ref_thing.method(); //~ ERROR type annotations needed
ref_thing.by_self(); //~ ERROR type annotations needed
let mut mut_thing = &mut Thing;
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
index 27518a54e..1865d81ba 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
- |
-LL | ref_thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(ref_thing);
- | +++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(ref_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15
|
LL | ref_thing.by_self();
| ^^^^^^^
@@ -48,7 +37,7 @@ LL | <&Thing as MethodRef<T>>::by_self(ref_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15
|
LL | mut_thing.method();
| ^^^^^^
@@ -67,7 +56,7 @@ LL | <Thing as Method<T>>::method(mut_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15
|
LL | mut_thing.mut_method();
| ^^^^^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::mut_method(mut_thing);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
|
LL | mut_thing.by_self();
| ^^^^^^^
@@ -105,7 +94,7 @@ LL | <&Thing as MethodRef<T>>::by_self(mut_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14
|
LL | deref_to.method();
| ^^^^^^
@@ -124,7 +113,7 @@ LL | <Thing as Method<T>>::method(deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::mut_method(deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -162,7 +151,7 @@ LL | <&Thing as MethodRef<T>>::by_self(deref_to);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -181,7 +170,7 @@ LL | <Thing as Method<T>>::method(deref_deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -200,7 +189,7 @@ LL | <Thing as Method<T>>::mut_method(deref_deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -218,7 +207,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(deref_deref_to);
| ++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 12 previous errors
+error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr
index 74a0fc427..3972e5397 100644
--- a/tests/ui/traits/test-2.stderr
+++ b/tests/ui/traits/test-2.stderr
@@ -42,6 +42,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:5
@@ -59,6 +62,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:6
@@ -76,6 +82,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
error: aborting due to 5 previous errors
diff --git a/tests/ui/try-block/try-block-bad-type.stderr b/tests/ui/try-block/try-block-bad-type.stderr
index e11c3f810..b41bf86d3 100644
--- a/tests/ui/try-block/try-block-bad-type.stderr
+++ b/tests/ui/try-block/try-block-bad-type.stderr
@@ -6,6 +6,7 @@ LL | Err("")?;
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `From<Infallible>` is implemented for `TryFromSliceError`
+ = help: for that trait implementation, expected `Infallible`, found `&str`
= note: required for `Result<u32, TryFromSliceError>` to implement `FromResidual<Result<Infallible, &str>>`
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr
index 7eb392faa..d8b9431be 100644
--- a/tests/ui/try-trait/bad-interconversion.stderr
+++ b/tests/ui/try-trait/bad-interconversion.stderr
@@ -73,7 +73,8 @@ LL | ControlFlow::Continue(Err("hello")?)
| ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
|
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for `ControlFlow<String>`
+ = help: for that trait implementation, expected `ControlFlow<String, Infallible>`, found `Result<Infallible, &str>`
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
--> $DIR/bad-interconversion.rs:37:12
@@ -84,7 +85,8 @@ LL | Some(3)?;
| ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for `ControlFlow<u64>`
+ = help: for that trait implementation, expected `ControlFlow<u64, Infallible>`, found `Option<Infallible>`
error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
--> $DIR/bad-interconversion.rs:43:29
@@ -96,7 +98,8 @@ LL | ControlFlow::Break(4_u8)?;
|
= help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>`
= note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<i64, Infallible>>` is implemented for `ControlFlow<i64>`
+ = help: for that trait implementation, expected `i64`, found `u8`
error: aborting due to 8 previous errors
diff --git a/tests/ui/tuple/tuple-struct-fields/test2.stderr b/tests/ui/tuple/tuple-struct-fields/test2.stderr
index 64a9ac135..784411aba 100644
--- a/tests/ui/tuple/tuple-struct-fields/test2.stderr
+++ b/tests/ui/tuple/tuple-struct-fields/test2.stderr
@@ -22,6 +22,8 @@ error[E0412]: cannot find type `foo` in this scope
|
LL | define_struct! { (foo) }
| ^^^ not found in this scope
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/tuple/tuple-struct-fields/test3.stderr b/tests/ui/tuple/tuple-struct-fields/test3.stderr
index 75262ed57..00b07c031 100644
--- a/tests/ui/tuple/tuple-struct-fields/test3.stderr
+++ b/tests/ui/tuple/tuple-struct-fields/test3.stderr
@@ -22,6 +22,8 @@ error[E0412]: cannot find type `foo` in this scope
|
LL | define_struct! { foo }
| ^^^ not found in this scope
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
index e24cb1128..96a5c1327 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:13:25
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
LL | fn ts_variant() {
LL | Self::TSVariant(());
| --------------- ^^ expected type parameter `T`, found `()`
@@ -50,7 +50,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:17:31
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::TSVariant(());
| --------------------- ^^ expected type parameter `T`, found `()`
@@ -98,7 +98,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:26:29
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::SVariant { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -125,7 +125,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:28:35
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::SVariant::<()> { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -158,7 +158,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:31:35
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::SVariant { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -206,7 +206,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:34:41
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::SVariant::<()> { v: () };
| ^^ expected type parameter `T`, found `()`
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
index 0202a2fea..359bd09ec 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
@@ -36,6 +36,7 @@ note: `V` could also refer to the associated type defined here
|
LL | type V;
| ^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
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 660950d59..cad75cffe 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
@@ -5,9 +5,6 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ 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 d86988266..d47b1fe36 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
@@ -1,44 +1,5 @@
-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;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/auto-trait-leakage3.rs:16:9
- |
-LL | is_send(foo());
- | ^^^^^^^
- = note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = 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 | 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 opaque `m::Foo::{opaque#0}`
- --> $DIR/auto-trait-leakage3.rs:7:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/auto-trait-leakage3.rs:15:5
- |
-LL | pub fn bar() {
- | ^^^^^^^^^^^^
- = 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 | 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
- --> $DIR/auto-trait-leakage3.rs:16:17
+ --> $DIR/auto-trait-leakage3.rs:13:17
|
LL | is_send(foo());
| ------- ^^^^^
@@ -51,16 +12,15 @@ note: opaque type is declared here
LL | pub type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
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-leakage3.rs:15:12
+ --> $DIR/auto-trait-leakage3.rs:12:12
|
LL | pub fn bar() {
| ^^^
note: required by a bound in `is_send`
- --> $DIR/auto-trait-leakage3.rs:20:19
+ --> $DIR/auto-trait-leakage3.rs:17:19
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 3 previous errors
+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/closure_parent_substs.rs b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
index 3ff20d99a..7d8193b26 100644
--- a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
+++ b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
@@ -1,5 +1,5 @@
// When WF checking the hidden type in the ParamEnv of the opaque type,
-// one complication arises when the hidden type is a closure/generator:
+// one complication arises when the hidden type is a closure/coroutine:
// the "parent_substs" of the type may reference lifetime parameters
// not present in the opaque type.
// These region parameters are not really useful in this check.
diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
index ae6462bb6..3484485e3 100644
--- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
+++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
@@ -46,14 +46,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/closure_wf_outlives.rs:54:22
|
LL | type Opaque<T> = impl Sized;
- | ^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/closure_wf_outlives.rs:59:12
|
LL | T: 'static,
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type Opaque<T: 'static> = impl Sized;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
new file mode 100644
index 000000000..4c56fe2d1
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque<'lt> = impl Sized + 'lt;
+
+fn test<'a>(
+ arg: impl Iterator<Item = &'a u8>,
+) -> impl Iterator<Item = Opaque<'a>> {
+ arg
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs
new file mode 100644
index 000000000..97f8c799f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs
@@ -0,0 +1,15 @@
+// check-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+struct Foo<'a>(&'a ());
+
+impl<'a> Foo<'a> {
+ async fn new() -> () {
+ type T = impl Sized;
+ let _: T = ();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
index 8c3a25dbf..c352a33fb 100644
--- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
@@ -17,9 +17,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:13:9
|
LL | t
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> {
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
index d87a25aad..1acacc778 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
@@ -8,5 +8,6 @@ type Underconstrained<T: Trait> = impl Send;
// no `Trait` bound
fn underconstrain<T>(_: T) -> Underconstrained<T> {
//~^ ERROR the trait bound `T: Trait`
+ //~| ERROR the trait bound `T: Trait`
unimplemented!()
}
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
index bc9280127..88529b370 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
@@ -14,6 +14,27 @@ help: consider restricting type parameter `T`
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
| +++++++
-error: aborting due to previous error
+error[E0277]: the trait bound `T: Trait` is not satisfied
+ --> $DIR/generic_underconstrained.rs:9:51
+ |
+LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
+ | ___________________________________________________^
+LL | |
+LL | |
+LL | | unimplemented!()
+LL | | }
+ | |_^ the trait `Trait` is not implemented for `T`
+ |
+note: required by a bound on the type alias `Underconstrained`
+ --> $DIR/generic_underconstrained.rs:6:26
+ |
+LL | type Underconstrained<T: Trait> = impl Send;
+ | ^^^^^ required by this bound
+help: consider restricting type parameter `T`
+ |
+LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
+ | +++++++
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
index 8adc0bf32..1e1bece9a 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
@@ -7,6 +7,7 @@ type Underconstrained<T: std::fmt::Debug> = impl Send;
// not a defining use, because it doesn't define *all* possible generics
fn underconstrained<U>(_: U) -> Underconstrained<U> {
//~^ ERROR `U` doesn't implement `Debug`
+ //~| ERROR `U` doesn't implement `Debug`
5u32
}
@@ -15,5 +16,6 @@ type Underconstrained2<T: std::fmt::Debug> = impl Send;
// not a defining use, because it doesn't define *all* possible generics
fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
//~^ ERROR `V` doesn't implement `Debug`
+ //~| ERROR `V` doesn't implement `Debug`
5u32
}
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
index fdc9ec090..b3b9cbca9 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
@@ -15,13 +15,13 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++
error[E0277]: `V` doesn't implement `Debug`
- --> $DIR/generic_underconstrained2.rs:16:43
+ --> $DIR/generic_underconstrained2.rs:17:43
|
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound on the type alias `Underconstrained2`
- --> $DIR/generic_underconstrained2.rs:13:27
+ --> $DIR/generic_underconstrained2.rs:14:27
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
@@ -30,6 +30,48 @@ help: consider restricting type parameter `V`
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: `U` doesn't implement `Debug`
+ --> $DIR/generic_underconstrained2.rs:8:53
+ |
+LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
+ | _____________________________________________________^
+LL | |
+LL | |
+LL | | 5u32
+LL | | }
+ | |_^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
+ |
+note: required by a bound on the type alias `Underconstrained`
+ --> $DIR/generic_underconstrained2.rs:5:26
+ |
+LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
+ | ^^^^^^^^^^^^^^^ required by this bound
+help: consider restricting type parameter `U`
+ |
+LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
+ | +++++++++++++++++
+
+error[E0277]: `V` doesn't implement `Debug`
+ --> $DIR/generic_underconstrained2.rs:17:64
+ |
+LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
+ | ________________________________________________________________^
+LL | |
+LL | |
+LL | | 5u32
+LL | | }
+ | |_^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
+ |
+note: required by a bound on the type alias `Underconstrained2`
+ --> $DIR/generic_underconstrained2.rs:14:27
+ |
+LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
+ | ^^^^^^^^^^^^^^^ required by this bound
+help: consider restricting type parameter `V`
+ |
+LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
+ | +++++++++++++++++
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
index aaf75cc3d..e35913be8 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
@@ -15,6 +15,8 @@ LL | impl Bop for Bar<()> {}
...
LL | impl Bop for Barr {}
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
+ |
+ = note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `Barr` in future versions
error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
--> $DIR/impl_trait_for_same_tait.rs:30:1
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
index 399775641..d6dd20739 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
@@ -22,9 +22,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check3.rs:29:41
|
LL | fn test<A>() where Ty<A>: 'static { assert_static::<A>() }
- | ^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<A: 'static>() where Ty<A>: 'static { assert_static::<A>() }
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
index 47bc31e78..81bc64bc3 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check4_static.rs:4:18
|
LL | type Ty<A> = impl Sized + 'static;
- | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type Ty<A: 'static> = impl Sized + 'static;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.rs b/tests/ui/type-alias-impl-trait/inference-cycle.rs
index 20175a4fe..6e4507ed4 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.rs
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.rs
@@ -3,17 +3,14 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ ERROR cycle detected
- //~| ERROR cycle detected
-
- // Cycle: error today, but it'd be nice if it eventually worked
pub fn foo() -> Foo {
is_send(bar())
}
pub fn bar() {
- is_send(foo()); // Today: error
+ // Cycle: error today, but it'd be nice if it eventually worked
+ is_send(foo());
//~^ 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/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
index 4ab059d05..ef7abe588 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
@@ -1,46 +1,7 @@
-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;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/inference-cycle.rs:16:9
- |
-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 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 | 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 opaque `m::Foo::{opaque#0}`
- --> $DIR/inference-cycle.rs:5:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/inference-cycle.rs:15:5
- |
-LL | pub fn bar() {
- | ^^^^^^^^^^^^
- = 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 | 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
- --> $DIR/inference-cycle.rs:16:17
+ --> $DIR/inference-cycle.rs:13:17
|
-LL | is_send(foo()); // Today: error
+LL | is_send(foo());
| ------- ^^^^^
| |
| required by a bound introduced by this call
@@ -51,16 +12,15 @@ note: opaque type is declared here
LL | pub type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
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/inference-cycle.rs:15:12
+ --> $DIR/inference-cycle.rs:11:12
|
LL | pub fn bar() {
| ^^^
note: required by a bound in `is_send`
- --> $DIR/inference-cycle.rs:24:19
+ --> $DIR/inference-cycle.rs:21:19
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 3 previous errors
+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/infinite-cycle-involving-weak.rs b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
new file mode 100644
index 000000000..6609d4eb5
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
@@ -0,0 +1,8 @@
+#![feature(type_alias_impl_trait)]
+
+type T = impl Copy;
+//~^ ERROR cannot resolve opaque type
+
+static STATIC: T = None::<&'static T>;
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr
new file mode 100644
index 000000000..50ae6f386
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr
@@ -0,0 +1,9 @@
+error[E0720]: cannot resolve opaque type
+ --> $DIR/infinite-cycle-involving-weak.rs:3:10
+ |
+LL | type T = impl Copy;
+ | ^^^^^^^^^ cannot resolve opaque type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
new file mode 100644
index 000000000..ad1ede9c3
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
@@ -0,0 +1,22 @@
+#![feature(coroutines, coroutine_trait, rustc_attrs)]
+#![feature(type_alias_impl_trait)]
+
+// check-pass
+
+mod gen {
+ use std::ops::Coroutine;
+
+ pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
+
+ pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
+ move || {
+ yield yielding;
+
+ return returning;
+ }
+ }
+}
+
+const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100);
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs
deleted file mode 100644
index a213dbba4..000000000
--- a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-#![feature(generators, generator_trait, rustc_attrs)]
-#![feature(type_alias_impl_trait)]
-
-// check-pass
-
-mod gen {
- use std::ops::Generator;
-
- pub type GenOnce<Y, R> = impl Generator<Yield = Y, Return = R>;
-
- pub const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
- move || {
- yield yielding;
-
- return returning;
- }
- }
-}
-
-const FOO: gen::GenOnce<usize, usize> = gen::const_generator(10, 100);
-
-fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
new file mode 100644
index 000000000..bc6a34392
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
@@ -0,0 +1,39 @@
+// check-pass
+
+#![feature(coroutines, coroutine_trait)]
+#![feature(type_alias_impl_trait)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::Pin;
+
+type RandCoroutine<'a> = impl Coroutine<Return = (), Yield = u64> + 'a;
+fn rand_coroutine<'a>(rng: &'a ()) -> RandCoroutine<'a> {
+ move || {
+ let _rng = rng;
+ loop {
+ yield 0;
+ }
+ }
+}
+
+pub type RandCoroutineWithIndirection<'c> = impl Coroutine<Return = (), Yield = u64> + 'c;
+pub fn rand_coroutine_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndirection<'a> {
+ fn helper<'b>(rng: &'b ()) -> impl 'b + Coroutine<Return = (), Yield = u64> {
+ move || {
+ let _rng = rng;
+ loop {
+ yield 0;
+ }
+ }
+ }
+
+ helper(rng)
+}
+
+fn main() {
+ let mut gen = rand_coroutine(&());
+ match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) {
+ CoroutineState::Yielded(_) => {}
+ CoroutineState::Complete(_) => {}
+ };
+}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs
deleted file mode 100644
index 477b61390..000000000
--- a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// check-pass
-
-#![feature(generators, generator_trait)]
-#![feature(type_alias_impl_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-type RandGenerator<'a> = impl Generator<Return = (), Yield = u64> + 'a;
-fn rand_generator<'a>(rng: &'a ()) -> RandGenerator<'a> {
- move || {
- let _rng = rng;
- loop {
- yield 0;
- }
- }
-}
-
-pub type RandGeneratorWithIndirection<'c> = impl Generator<Return = (), Yield = u64> + 'c;
-pub fn rand_generator_with_indirection<'a>(rng: &'a ()) -> RandGeneratorWithIndirection<'a> {
- fn helper<'b>(rng: &'b ()) -> impl 'b + Generator<Return = (), Yield = u64> {
- move || {
- let _rng = rng;
- loop {
- yield 0;
- }
- }
- }
-
- helper(rng)
-}
-
-fn main() {
- let mut gen = rand_generator(&());
- match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) {
- GeneratorState::Yielded(_) => {}
- GeneratorState::Complete(_) => {}
- };
-}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
index 27ca7d0fd..a1cf23dab 100644
--- a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![feature(type_alias_impl_trait)]
trait Trait {}
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.rs b/tests/ui/type-alias-impl-trait/issue-63279.rs
index 0e46745c6..02f211146 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63279.rs
@@ -3,11 +3,11 @@
type Closure = impl FnOnce();
fn c() -> Closure {
- //~^ ERROR: expected a `FnOnce<()>` closure, found `()`
+ //~^ ERROR: expected a `FnOnce()` closure, found `()`
|| -> Closure { || () }
//~^ ERROR: mismatched types
//~| ERROR: mismatched types
- //~| ERROR: expected a `FnOnce<()>` closure, found `()`
+ //~| ERROR: expected a `FnOnce()` closure, found `()`
}
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr
index a86856247..58cafd21c 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr
@@ -1,17 +1,17 @@
-error[E0277]: expected a `FnOnce<()>` closure, found `()`
+error[E0277]: expected a `FnOnce()` closure, found `()`
--> $DIR/issue-63279.rs:5:11
|
LL | fn c() -> Closure {
- | ^^^^^^^ expected an `FnOnce<()>` closure, found `()`
+ | ^^^^^^^ expected an `FnOnce()` closure, found `()`
|
= help: the trait `FnOnce<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
-error[E0277]: expected a `FnOnce<()>` closure, found `()`
+error[E0277]: expected a `FnOnce()` closure, found `()`
--> $DIR/issue-63279.rs:7:11
|
LL | || -> Closure { || () }
- | ^^^^^^^ expected an `FnOnce<()>` closure, found `()`
+ | ^^^^^^^ expected an `FnOnce()` closure, found `()`
|
= help: the trait `FnOnce<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.rs b/tests/ui/type-alias-impl-trait/issue-94429.rs
index d764545f9..306e73003 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.rs
+++ b/tests/ui/type-alias-impl-trait/issue-94429.rs
@@ -1,18 +1,18 @@
-#![feature(impl_trait_in_assoc_type, generator_trait, generators)]
-use std::ops::Generator;
+#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)]
+use std::ops::Coroutine;
trait Runnable {
- type Gen: Generator<Yield = (), Return = ()>;
+ type Coro: Coroutine<Yield = (), Return = ()>;
- fn run(&mut self) -> Self::Gen;
+ fn run(&mut self) -> Self::Coro;
}
struct Implementor {}
impl Runnable for Implementor {
- type Gen = impl Generator<Yield = (), Return = ()>;
+ type Coro = impl Coroutine<Yield = (), Return = ()>;
- fn run(&mut self) -> Self::Gen {
+ fn run(&mut self) -> Self::Coro {
//~^ ERROR: type mismatch resolving
move || {
yield 1;
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr
index 26605cdd2..360ecfa61 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr
@@ -1,8 +1,8 @@
-error[E0271]: type mismatch resolving `<{generator@$DIR/issue-94429.rs:17:9: 17:16} as Generator>::Yield == ()`
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/issue-94429.rs:17:9: 17:16} as Coroutine>::Yield == ()`
--> $DIR/issue-94429.rs:15:26
|
-LL | fn run(&mut self) -> Self::Gen {
- | ^^^^^^^^^ expected integer, found `()`
+LL | fn run(&mut self) -> Self::Coro {
+ | ^^^^^^^^^^ expected integer, found `()`
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
index fdd8fa65b..5bd854be8 100644
--- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
@@ -26,11 +26,9 @@ fn upvar() {
fn enum_upvar() {
type T = impl Copy;
let foo: T = Some((1u32, 2u32));
- let x = move || {
- match foo {
- None => (),
- Some((a, b)) => (),
- }
+ let x = move || match foo {
+ None => (),
+ Some((a, b)) => (),
};
}
@@ -63,6 +61,19 @@ mod only_pattern {
None => {}
}
}
+
+ type V = impl Copy;
+
+ fn baz(baz: Option<V>) {
+ match baz {
+ _ => {}
+ Some((mut x, mut y)) => {
+ x = 42;
+ y = "foo";
+ }
+ None => {}
+ }
+ }
}
mod only_pattern_rpit {
@@ -71,11 +82,7 @@ mod only_pattern_rpit {
let (mut x, mut y) = foo(false);
x = 42;
y = "foo";
- if b {
- panic!()
- } else {
- foo(true)
- }
+ if b { panic!() } else { foo(true) }
}
fn bar(b: bool) -> Option<impl Copy> {
diff --git a/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs b/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs
new file mode 100644
index 000000000..5f3dbaa17
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs
@@ -0,0 +1,44 @@
+//! This test checks that we do not walk types in async blocks for
+//! determining the opaque types that appear in a signature. async blocks,
+//! all other coroutines and closures are always private and not part of
+//! a signature. They become part of a signature via `dyn Trait` or `impl Trait`,
+//! which is something that we process abstractly without looking at its hidden
+//! types.
+// edition: 2021
+// check-pass
+
+#![feature(impl_trait_in_assoc_type)]
+
+use std::future::Future;
+
+pub struct MemtableLocalStateStore {
+ mem_table: MemTable,
+}
+
+impl LocalStateStore for MemtableLocalStateStore {
+ type IterStream<'a> = impl Sized + 'a where Self: 'a;
+
+ fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_ {
+ async move { merge_stream(self.mem_table.iter()) }
+ }
+}
+
+trait LocalStateStore {
+ type IterStream<'a>
+ where
+ Self: 'a;
+
+ fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_;
+}
+
+struct MemTable;
+
+impl MemTable {
+ fn iter<'a>(&'a self) -> impl Iterator<Item = &'a ()> {
+ std::iter::empty()
+ }
+}
+
+pub(crate) async fn merge_stream<'a>(mem_table_iter: impl Iterator<Item = &'a ()>) {}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.fixed b/tests/ui/type-alias-impl-trait/not_well_formed.fixed
new file mode 100644
index 000000000..d98e83ff6
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.fixed
@@ -0,0 +1,19 @@
+// run-rustfix
+#![feature(type_alias_impl_trait)]
+#![allow(dead_code)]
+
+fn main() {}
+
+trait TraitWithAssoc {
+ type Assoc;
+}
+
+type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
+
+trait Trait<U> {}
+
+impl<W> Trait<W> for () {}
+
+fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T> {
+ ()
+}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.rs b/tests/ui/type-alias-impl-trait/not_well_formed.rs
index fbb7a4d58..18f173a69 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.rs
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.rs
@@ -1,4 +1,6 @@
+// run-rustfix
#![feature(type_alias_impl_trait)]
+#![allow(dead_code)]
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
index c36b95f47..b267e6a75 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
@@ -1,8 +1,13 @@
error[E0220]: associated type `Assoc` not found for `V`
- --> $DIR/not_well_formed.rs:9:29
+ --> $DIR/not_well_formed.rs:11:29
|
LL | type Foo<V> = impl Trait<V::Assoc>;
- | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+ | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
+ |
+help: consider restricting type parameter `V`
+ |
+LL | type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
+ | ++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
new file mode 100644
index 000000000..3d1759097
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
@@ -0,0 +1,17 @@
+// test for #113326
+#![feature(type_alias_impl_trait)]
+
+pub type Diff = impl Fn(usize) -> usize;
+
+pub fn lift() -> Diff {
+ |_: usize |loop {}
+}
+
+pub fn add(
+ n: Diff,
+ m: Diff,
+) -> Diff {
+ move |x: usize| m(n(x)) //~ ERROR: concrete type differs
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
new file mode 100644
index 000000000..b2898a211
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
@@ -0,0 +1,14 @@
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/recursive-fn-tait.rs:14:5
+ |
+LL | move |x: usize| m(n(x))
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}`
+ |
+note: previous use here
+ --> $DIR/recursive-fn-tait.rs:7:5
+ |
+LL | |_: usize |loop {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs
index 7943bb240..07fd989b0 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.rs
+++ b/tests/ui/type-alias-impl-trait/reveal_local.rs
@@ -3,9 +3,6 @@
use std::fmt::Debug;
type Foo = impl Debug;
-//~^ ERROR cycle detected
-//~| ERROR cycle detected
-//~| ERROR cycle detected
fn is_send<T: Send>() {}
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index c62fd88f4..796e2d011 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -1,44 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_good`...
- --> $DIR/reveal_local.rs:15:5
- |
-LL | is_send::<Foo>();
- | ^^^^^^^^^^^^^^
- = note: ...which requires evaluating trait selection obligation `Foo: core::marker::Send`...
- = 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 opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_good`...
- --> $DIR/reveal_local.rs:12:1
- |
-LL | fn not_good() {
- | ^^^^^^^^^^^^^
- = 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
- --> $DIR/reveal_local.rs:15:15
+ --> $DIR/reveal_local.rs:12:15
|
LL | is_send::<Foo>();
| ^^^
@@ -49,37 +10,18 @@ note: opaque type is declared here
LL | type Foo = impl Debug;
| ^^^^^^^^^^
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/reveal_local.rs:12:4
+ --> $DIR/reveal_local.rs:9:4
|
LL | fn not_good() {
| ^^^^^^^^
note: required by a bound in `is_send`
- --> $DIR/reveal_local.rs:10:15
+ --> $DIR/reveal_local.rs:7:15
|
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_gooder`...
- --> $DIR/reveal_local.rs:19:1
- |
-LL | fn not_gooder() -> Foo {
- | ^^^^^^^^^^^^^^^^^^^^^^
- = 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
- --> $DIR/reveal_local.rs:25:15
+ --> $DIR/reveal_local.rs:22:15
|
LL | is_send::<Foo>();
| ^^^
@@ -90,16 +32,15 @@ note: opaque type is declared here
LL | type Foo = impl Debug;
| ^^^^^^^^^^
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/reveal_local.rs:19:4
+ --> $DIR/reveal_local.rs:16:4
|
LL | fn not_gooder() -> Foo {
| ^^^^^^^^^^
note: required by a bound in `is_send`
- --> $DIR/reveal_local.rs:10:15
+ --> $DIR/reveal_local.rs:7:15
|
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 5 previous errors
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
index 857066c78..9796823a7 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
@@ -4,7 +4,7 @@
// FIXME: this is ruled out for now but should work
type Foo = fn() -> impl Send;
-//~^ ERROR: `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR: `impl Trait` only allowed in function and inherent method argument and return types
fn make_foo() -> Foo {
|| 15
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
index ff375b2ff..e57c59d61 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/type-alias-impl-trait-fn-type.rs:6:20
|
LL | type Foo = fn() -> impl Send;
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
new file mode 100644
index 000000000..ae3d317ab
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
@@ -0,0 +1,14 @@
+#![feature(type_alias_impl_trait)]
+
+type Tait = impl Copy;
+// Make sure that this TAIT isn't considered unconstrained...
+
+fn empty_opaque() -> Tait {
+ if false {
+ match empty_opaque() {}
+ //~^ ERROR non-empty
+ }
+ 0u8
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
new file mode 100644
index 000000000..6cc5b7a8a
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: type `Tait` is non-empty
+ --> $DIR/unconstrained-due-to-bad-pattern.rs:8:15
+ |
+LL | match empty_opaque() {}
+ | ^^^^^^^^^^^^^^
+ |
+ = note: the matched value is of type `Tait`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+ |
+LL ~ match empty_opaque() {
+LL + _ => todo!(),
+LL + }
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
index 9e96323ab..7d72c9f81 100644
--- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-in-associated-type.rs:36:23
|
+LL | impl<'a, T> Trait<'a, T> for () {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Opaque = impl Sized + 'a;
| ^^^^^^^^^^^^^^^ ...so that the type `&'a T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for () {
| ++++
@@ -12,10 +14,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for () {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-in-associated-type.rs:36:23
|
+LL | impl<'a, T> Trait<'a, T> for () {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Opaque = impl Sized + 'a;
| ^^^^^^^^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for () {
| ++++
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr b/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
index 753a46e88..2858afcd4 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-nested.rs:55:27
|
LL | type InnerOpaque<T> = impl Sized;
- | ^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/wf-nested.rs:12:20
|
LL | struct IsStatic<T: 'static>(T);
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type InnerOpaque<T: 'static> = impl Sized;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr b/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
index 9ab6685a7..285e4f18c 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-nested.rs:46:17
|
LL | let _ = outer.get();
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<T: 'static>() {
| +++++++++
diff --git a/tests/ui/type-inference/sort_by_key.stderr b/tests/ui/type-inference/sort_by_key.stderr
index de7b4b248..81af024b3 100644
--- a/tests/ui/type-inference/sort_by_key.stderr
+++ b/tests/ui/type-inference/sort_by_key.stderr
@@ -1,9 +1,14 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/sort_by_key.rs:3:40
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum());
- | ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+ | ----------- ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+ | |
+ | type must be known at this point
|
+ = note: cannot satisfy `_: Ord`
+note: required by a bound in `slice::<impl [T]>::sort_by_key`
+ --> $SRC_DIR/alloc/src/slice.rs:LL:COL
help: consider specifying the generic argument
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
@@ -11,4 +16,4 @@ LL | lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
index 09c4b2053..7be00341d 100644
--- a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
+++ b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/cannot_infer_local_or_vec.rs:2:9
|
LL | let x = vec![];
- | ^
+ | ^ ------ type must be known at this point
|
help: consider giving `x` an explicit type, where the placeholders `_` are specified
|
diff --git a/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs
new file mode 100644
index 000000000..adf3049b4
--- /dev/null
+++ b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs
@@ -0,0 +1,6 @@
+fn foo() -> Result<String, ()> {
+ let out: Result<(), ()> = Ok(());
+ out //~ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr
new file mode 100644
index 000000000..447b22a15
--- /dev/null
+++ b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-116967-cannot-coerce-returned-result.rs:3:5
+ |
+LL | fn foo() -> Result<String, ()> {
+ | ------------------ expected `Result<String, ()>` because of return type
+LL | let out: Result<(), ()> = Ok(());
+LL | out
+ | ^^^ expected `Result<String, ()>`, found `Result<(), ()>`
+ |
+ = note: expected enum `Result<String, _>`
+ found enum `Result<(), _>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type/type-check/point-at-inference-issue-116155.rs b/tests/ui/type/type-check/point-at-inference-issue-116155.rs
new file mode 100644
index 000000000..1e9942d42
--- /dev/null
+++ b/tests/ui/type/type-check/point-at-inference-issue-116155.rs
@@ -0,0 +1,17 @@
+struct S<T>(T);
+
+impl<T> S<T> {
+ fn new() -> Self {
+ loop {}
+ }
+
+ fn constrain<F: Fn() -> T>(&self, _f: F) {}
+}
+
+fn main() {
+ let s = S::new();
+ let c = || true;
+ s.constrain(c);
+ let _: S<usize> = s;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/type/type-check/point-at-inference-issue-116155.stderr b/tests/ui/type/type-check/point-at-inference-issue-116155.stderr
new file mode 100644
index 000000000..c8c01603c
--- /dev/null
+++ b/tests/ui/type/type-check/point-at-inference-issue-116155.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/point-at-inference-issue-116155.rs:15:23
+ |
+LL | s.constrain(c);
+ | - - this argument has type `{closure@$DIR/point-at-inference-issue-116155.rs:13:13: 13:15}`...
+ | |
+ | ... which causes `s` to have type `S<bool>`
+LL | let _: S<usize> = s;
+ | -------- ^ expected `S<usize>`, found `S<bool>`
+ | |
+ | expected due to this
+ |
+ = note: expected struct `S<usize>`
+ found struct `S<bool>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
index 8a296dc7e..4412c49ea 100644
--- a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
+++ b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
@@ -24,6 +24,7 @@ LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; }
| |
| this trait cannot be made into an object...
= help: consider moving `add` to another trait
+ = help: only type `i32` implements the trait, consider using it directly instead
error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr
index f9cdb280e..0b705d467 100644
--- a/tests/ui/typeck/bad-index-due-to-nested.stderr
+++ b/tests/ui/typeck/bad-index-due-to-nested.stderr
@@ -40,7 +40,7 @@ error[E0308]: mismatched types
--> $DIR/bad-index-due-to-nested.rs:20:9
|
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
- | - this type parameter
+ | - found this type parameter
LL | map[k]
| ^ expected `&K`, found type parameter `K`
|
@@ -55,7 +55,7 @@ error[E0308]: mismatched types
--> $DIR/bad-index-due-to-nested.rs:20:5
|
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
- | - this type parameter ----- expected `&'a V` because of return type
+ | - found this type parameter ----- expected `&'a V` because of return type
LL | map[k]
| ^^^^^^ expected `&V`, found type parameter `V`
|
diff --git a/tests/ui/typeck/escaping_bound_vars.rs b/tests/ui/typeck/escaping_bound_vars.rs
new file mode 100644
index 000000000..1fb063d2c
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.rs
@@ -0,0 +1,16 @@
+// Test for issues/115517 which is fixed by pull/115486
+// This should not ice
+trait Test<const C: usize> {}
+
+trait Elide<T> {
+ fn call();
+}
+
+pub fn test()
+where
+ (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+ //~^ ERROR cannot capture late-bound lifetime in constant
+{
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/escaping_bound_vars.stderr b/tests/ui/typeck/escaping_bound_vars.stderr
new file mode 100644
index 000000000..f7077e52a
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/escaping_bound_vars.rs:11:35
+ |
+LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+ | -^
+ | |
+ | lifetime defined here
+
+error: aborting due to previous error
+
diff --git a/tests/ui/typeck/issue-104513-ice.rs b/tests/ui/typeck/issue-104513-ice.rs
index bcac0fa1e..4968d3f51 100644
--- a/tests/ui/typeck/issue-104513-ice.rs
+++ b/tests/ui/typeck/issue-104513-ice.rs
@@ -1,6 +1,6 @@
struct S;
fn f() {
let _: S<impl Oops> = S; //~ ERROR cannot find trait `Oops` in this scope
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
fn main() {}
diff --git a/tests/ui/typeck/issue-104513-ice.stderr b/tests/ui/typeck/issue-104513-ice.stderr
index 09187d786..56c6b3361 100644
--- a/tests/ui/typeck/issue-104513-ice.stderr
+++ b/tests/ui/typeck/issue-104513-ice.stderr
@@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Oops` in this scope
LL | let _: S<impl Oops> = S;
| ^^^^ not found in this scope
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-104513-ice.rs:3:14
|
LL | let _: S<impl Oops> = S;
diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr
index 70f193208..8921e3f76 100644
--- a/tests/ui/typeck/issue-107087.stderr
+++ b/tests/ui/typeck/issue-107087.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-107087.rs:16:5
|
LL | A::B::<>::C
- | ^^^^^^^^ help: use the fully-qualified path: `<A<_> as Foo>::B`
+ | ^^^^^^^^ help: use fully-qualified syntax: `<A<_> as Foo>::B`
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-110052.stderr b/tests/ui/typeck/issue-110052.stderr
index 0c15c03a7..75374fa61 100644
--- a/tests/ui/typeck/issue-110052.stderr
+++ b/tests/ui/typeck/issue-110052.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-110052.rs:6:30
|
LL | for<'iter> dyn Validator<<&'iter I>::Item>:,
- | ^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'iter I as IntoIterator>::Item`
+ | ^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'iter I as IntoIterator>::Item`
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.rs b/tests/ui/typeck/issue-114529-illegal-break-with-value.rs
new file mode 100644
index 000000000..613d1b634
--- /dev/null
+++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.rs
@@ -0,0 +1,20 @@
+// Regression test for issue #114529
+// Tests that we do not ICE during const eval for a
+// break-with-value in contexts where it is illegal
+
+#[allow(while_true)]
+fn main() {
+ [(); {
+ while true {
+ break 9; //~ ERROR `break` with value from a `while` loop
+ };
+ 51
+ }];
+
+ [(); {
+ while let Some(v) = Some(9) {
+ break v; //~ ERROR `break` with value from a `while` loop
+ };
+ 51
+ }];
+}
diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr
new file mode 100644
index 000000000..4d6c27bbb
--- /dev/null
+++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr
@@ -0,0 +1,29 @@
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/issue-114529-illegal-break-with-value.rs:9:13
+ |
+LL | while true {
+ | ---------- you can't `break` with a value in a `while` loop
+LL | break 9;
+ | ^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
+help: use `break` on its own without a value inside this `while` loop
+ |
+LL | break;
+ | ~~~~~
+
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/issue-114529-illegal-break-with-value.rs:16:13
+ |
+LL | while let Some(v) = Some(9) {
+ | --------------------------- you can't `break` with a value in a `while` loop
+LL | break v;
+ | ^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
+help: use `break` on its own without a value inside this `while` loop
+ |
+LL | break;
+ | ~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0571`.
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
index a1b9a7eba..193544ebd 100644
--- 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
@@ -5,7 +5,7 @@
trait Trait {
- fn func<const N: u32>() -> [ (); N ];
+ fn func<const N: u32>() -> [ (); N ]; //~ ERROR mismatched types
}
struct S {}
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
index 9843651b1..16aaf0615 100644
--- 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
@@ -4,6 +4,12 @@ error[E0308]: mismatched types
LL | fn func<const N: u32>() -> [ (); { () }] {
| ^^ expected `usize`, found `()`
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/const-in-impl-fn-return-type.rs:8:38
+ |
+LL | fn func<const N: u32>() -> [ (); N ];
+ | ^ expected `usize`, found `u32`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
new file mode 100644
index 000000000..c319c63ed
--- /dev/null
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
@@ -0,0 +1,96 @@
+// Regression test for ICE #116473.
+// The ICE occurs when arguments are specified on an enum variant
+// (which is illegal) and the variant and its preceding path are
+// located at different places such as in different macros or
+// different expansions of the same macro (i.e. when the macro
+// calls itself recursively)
+
+enum Enum<T1, T2> { VariantA { _v1: T1, _v2: T2 }, VariantB }
+
+type EnumUnit = Enum<(), ()>;
+
+// Recursive macro call using a tt metavariable for variant
+macro_rules! recursive_tt {
+ () => (recursive_tt!(VariantB));
+ ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Recursive macro call using an ident metavariable for variant
+// (the behaviour is different for tt and ident)
+macro_rules! recursive_ident {
+ () => (recursive_ident!(VariantB));
+ ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls (i.e. one calling another) using a tt
+// metavariable for variant
+macro_rules! nested1_tt {
+ () => (nested2_tt!(VariantB));
+}
+
+macro_rules! nested2_tt {
+ ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls using an ident metavariable for variant
+// (the behaviour is different for tt and ident)
+macro_rules! nested1_ident {
+ () => (nested2_ident!(VariantB));
+}
+
+macro_rules! nested2_ident {
+ ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls when args are passed as metavariable
+// instead of the enum variant
+macro_rules! nested1_tt_args_in_first_macro {
+ () => (nested2_tt_args_in_first_macro!(i32, u32));
+}
+
+macro_rules! nested2_tt_args_in_first_macro {
+ ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+ = 5 { true } else { false });
+}
+
+// Mested macro calls when args are passed as metavariable
+// instead of the enum variant
+macro_rules! nested1_ident_args_in_first_macro {
+ () => (nested2_ident_args_in_first_macro!(i32, u32));
+}
+
+macro_rules! nested2_ident_args_in_first_macro {
+ ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+ = 5 { true } else { false });
+}
+
+fn main() {
+ // Macro cases
+ recursive_tt!();
+ recursive_ident!();
+ nested1_tt!();
+ nested1_ident!();
+ nested1_tt_args_in_first_macro!();
+ nested1_ident_args_in_first_macro!();
+
+ // Regular, non-macro case
+ if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
new file mode 100644
index 000000000..b17936ee3
--- /dev/null
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
@@ -0,0 +1,237 @@
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:51
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | recursive_tt!();
+ | --------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:tt) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:30
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | recursive_tt!();
+ | --------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:54
+ |
+LL | () => (recursive_ident!(VariantB));
+ | -------- not allowed on this type
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^ ^^^ type argument not allowed
+...
+LL | recursive_ident!();
+ | ------------------ in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:ident) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:33
+ |
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | recursive_ident!();
+ | ------------------ in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:51
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_tt!();
+ | ------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:tt) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:30
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | nested1_tt!();
+ | ------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:54
+ |
+LL | () => (nested2_ident!(VariantB));
+ | -------- not allowed on this type
+...
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^ ^^^ type argument not allowed
+...
+LL | nested1_ident!();
+ | ---------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:ident) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:33
+ |
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | nested1_ident!();
+ | ---------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:58
+ |
+LL | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | -------- ^^^^^ ^^^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_tt_args_in_first_macro!();
+ | --------------------------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+LL + ($arg1:tt, $arg2:tt) => (if let EnumUnit::<$arg1, $arg2>::VariantB {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:37
+ |
+LL | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>`
+...
+LL | = 5 { true } else { false });
+ | - this expression has type `{integer}`
+...
+LL | nested1_tt_args_in_first_macro!();
+ | --------------------------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_tt_args_in_first_macro` which comes from the expansion of the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:64
+ |
+LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | -------- ^^^^^ ^^^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_ident_args_in_first_macro!();
+ | ------------------------------------ in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+LL + ($arg1:ident, $arg2:ident) => (if let EnumUnit::<$arg1, $arg2>::VariantB {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:43
+ |
+LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>`
+...
+LL | = 5 { true } else { false });
+ | - this expression has type `{integer}`
+...
+LL | nested1_ident_args_in_first_macro!();
+ | ------------------------------------ in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:93:33
+ |
+LL | if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+ |
+ = note: enum variants can't have type parameters
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+LL + if let EnumUnit::<i32, u32>::VariantB {} = 5 { true } else { false };
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:93:12
+ |
+LL | if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+
+error: aborting due to 14 previous errors
+
+Some errors have detailed explanations: E0109, E0308.
+For more information about an error, try `rustc --explain E0109`.
diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr
index 8ecb8b680..0683c7829 100644
--- a/tests/ui/typeck/issue-13853.stderr
+++ b/tests/ui/typeck/issue-13853.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-13853.rs:14:9
|
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
- | - this type parameter - expected `I` because of return type
+ | - expected this type parameter - expected `I` because of return type
...
LL | self.iter()
| ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
diff --git a/tests/ui/typeck/issue-36708.stderr b/tests/ui/typeck/issue-36708.stderr
index 140f19f1f..f1e0f4719 100644
--- a/tests/ui/typeck/issue-36708.stderr
+++ b/tests/ui/typeck/issue-36708.stderr
@@ -2,7 +2,12 @@ error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0
--> $DIR/issue-36708.rs:8:12
|
LL | fn foo<T>() {}
- | ^ found 1 type parameter, expected 0
+ | ^ found 1 type parameter
+ |
+ ::: $DIR/auxiliary/issue-36708.rs:4:5
+ |
+LL | fn foo();
+ | --------- expected 0 type parameters
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
index dc4bc5b5f..6c3302f29 100644
--- a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
+++ b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-57673-ice-on-deref-of-boxed-trait.rs:5:5
|
LL | fn ice(x: Box<dyn Iterator<Item=()>>) {
- | - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
+ | - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
LL | *x
| ^^ expected `()`, found `dyn Iterator`
|
diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
index 0d72ae118..c46f4ec1e 100644
--- a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
+++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5
|
LL | async fn hello() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
diff --git a/tests/ui/typeck/issue-91267.stderr b/tests/ui/typeck/issue-91267.stderr
index 72acd9c67..7e48b2519 100644
--- a/tests/ui/typeck/issue-91267.stderr
+++ b/tests/ui/typeck/issue-91267.stderr
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/issue-91267.rs:4:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | type_ascribe!(0, u8<e<5>=e>)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u8`
diff --git a/tests/ui/typeck/issue-91334.rs b/tests/ui/typeck/issue-91334.rs
index 29204276b..1ffc56e66 100644
--- a/tests/ui/typeck/issue-91334.rs
+++ b/tests/ui/typeck/issue-91334.rs
@@ -2,6 +2,6 @@
// error-pattern: this file contains an unclosed delimiter
-#![feature(generators)]
+#![feature(coroutines)]
fn f(){||yield(((){),
diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
index f53abe53b..c4f164295 100644
--- a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
+++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
@@ -8,6 +8,10 @@ LL | let x : char = last(y);
|
= note: expected type `char`
found enum `Option<_>`
+help: consider using `Option::expect` to unwrap the `Option<_>` value, panicking if the value is an `Option::None`
+ |
+LL | let x : char = last(y).expect("REASON");
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
index a3517af87..67ca2b061 100644
--- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
+++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
@@ -21,6 +21,8 @@ LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| |
| expected 0 generic arguments
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:8:21
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
index cb1fac0ba..9b0f99a18 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.rs
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
@@ -36,6 +36,7 @@ impl<'a, T> SomeTrait for &'a Bar<T> {
fn dummy1(self: &&'a Bar<T>) { }
fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched `self` parameter type
//~^ ERROR mismatched `self` parameter type
+ //~| ERROR has an incompatible type for trait
fn dummy3(self: &&Bar<T>) {}
//~^ ERROR mismatched `self` parameter type
//~| expected reference `&'a Bar<T>`
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
index f325d1d81..0efaa41d4 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
@@ -64,7 +64,7 @@ LL | fn dummy2(self: &Bar<T>) {}
| ^^^^^^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -72,7 +72,7 @@ LL | fn dummy3(self: &&Bar<T>) {}
= note: expected reference `&'a Bar<T>`
found reference `&Bar<T>`
note: the anonymous lifetime defined here...
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
@@ -83,7 +83,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -96,12 +96,29 @@ note: the lifetime `'a` as defined here...
LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
note: ...does not necessarily outlive the anonymous lifetime defined here
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
-error: aborting due to 7 previous errors
+error[E0053]: method `dummy2` has an incompatible type for trait
+ --> $DIR/ufcs-explicit-self-bad.rs:37:21
+ |
+LL | fn dummy2(self: &Bar<T>) {}
+ | ------^^^^^^^
+ | | |
+ | | expected `&'a Bar<T>`, found `Bar<T>`
+ | help: change the self-receiver type to match the trait: `&self`
+ |
+note: type in trait
+ --> $DIR/ufcs-explicit-self-bad.rs:31:15
+ |
+LL | fn dummy2(&self);
+ | ^^^^^
+ = note: expected signature `fn(&&'a Bar<T>)`
+ found signature `fn(&Bar<T>)`
+
+error: aborting due to 8 previous errors
-Some errors have detailed explanations: E0307, E0308.
-For more information about an error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0053, E0307, E0308.
+For more information about an error, try `rustc --explain E0053`.
diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
index 9d0aa4132..057bdf0f6 100644
--- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
+++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
@@ -5,5 +5,5 @@
fn g<F>(_: F) where F: FnOnce(Option<F>) {}
fn main() {
- g(|_| { }); //~ ERROR closure/generator type that references itself
+ g(|_| { }); //~ ERROR closure/coroutine type that references itself
}
diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
index 6d5dbca05..9d3c1902c 100644
--- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
@@ -1,4 +1,4 @@
-error[E0644]: closure/generator type that references itself
+error[E0644]: closure/coroutine type that references itself
--> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7
|
LL | g(|_| { });
diff --git a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
index 0ea1c1dcd..ce4d0fe25 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(isize,)>` closure, found `S`
+error[E0277]: expected a `Fn(isize)` closure, found `S`
--> $DIR/unboxed-closures-fnmut-as-fn.rs:27:21
|
LL | let x = call_it(&S, 22);
- | ------- ^^ expected an `Fn<(isize,)>` closure, found `S`
+ | ------- ^^ expected an `Fn(isize)` closure, found `S`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs
new file mode 100644
index 000000000..157383fed
--- /dev/null
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs
@@ -0,0 +1,23 @@
+fn test() {
+ let x = match **x { //~ ERROR
+ Some(&a) if { panic!() } => {}
+ };
+ let mut p = &x;
+
+ {
+ let mut closure = expect_sig(|p, y| *p = y);
+ closure(&mut p, &y); //~ ERROR
+ //~^ ERROR
+ }
+
+ deref(p); //~ ERROR
+}
+
+fn expect_sig<F>(f: F) -> F
+where
+ F: FnMut(&mut &i32, &i32),
+{
+ f
+}
+
+fn main() {}
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
new file mode 100644
index 000000000..1470c32d7
--- /dev/null
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
@@ -0,0 +1,44 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:2:21
+ |
+LL | let x = match **x {
+ | ^ not found in this scope
+
+error[E0425]: cannot find value `y` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:26
+ |
+LL | closure(&mut p, &y);
+ | ^ help: a local variable with a similar name exists: `p`
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:17
+ |
+LL | closure(&mut p, &y);
+ | ------- ^^^^^^ expected `&mut &i32`, found `&mut &()`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected mutable reference `&mut &i32`
+ found mutable reference `&mut &()`
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:8:39
+ |
+LL | let mut closure = expect_sig(|p, y| *p = y);
+ | ^
+
+error[E0425]: cannot find function `deref` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:13:5
+ |
+LL | deref(p);
+ | ^^^^^ not found in this scope
+ |
+help: use the `.` operator to call the method `Deref::deref` on `&&()`
+ |
+LL - deref(p);
+LL + p.deref();
+ |
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0308, E0425.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
index 9f76849e5..0999f61b0 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
@@ -1,7 +1,35 @@
use std::ops::FnMut;
-pub fn main() {
+fn main() {
let mut f = |x: isize, y: isize| -> isize { x + y };
- let z = f(1_usize, 2); //~ ERROR mismatched types
+ let z = f(1_usize, 2); //~ ERROR mismatched types
println!("{}", z);
+ let mut g = |x, y| { x + y };
+ let y = g(1_i32, 2);
+ let z = g(1_usize, 2); //~ ERROR mismatched types
+ println!("{}", z);
+}
+
+trait T {
+ fn bar(&self) {
+ let identity = |x| x;
+ identity(1u8);
+ identity(1u16); //~ ERROR mismatched types
+ let identity = |x| x;
+ identity(&1u8);
+ identity(&1u16); //~ ERROR mismatched types
+ }
+}
+
+struct S;
+
+impl T for S {
+ fn bar(&self) {
+ let identity = |x| x;
+ identity(1u8);
+ identity(1u16); //~ ERROR mismatched types
+ let identity = |x| x;
+ identity(&1u8);
+ identity(&1u16); //~ ERROR mismatched types
+ }
}
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
index 455f83f57..327df50e6 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
@@ -16,6 +16,127 @@ help: change the type of the numeric literal from `usize` to `isize`
LL | let z = f(1_isize, 2);
| ~~~~~
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:9:15
+ |
+LL | let z = g(1_usize, 2);
+ | - ^^^^^^^ expected `i32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `i32`
+ --> $DIR/unboxed-closures-type-mismatch.rs:8:15
+ |
+LL | let y = g(1_i32, 2);
+ | - ^^^^^ expected because this argument is of type `i32`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:7:18
+ |
+LL | let mut g = |x, y| { x + y };
+ | ^
+help: change the type of the numeric literal from `usize` to `i32`
+ |
+LL | let z = g(1_i32, 2);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:17:18
+ |
+LL | identity(1u16);
+ | -------- ^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:16:18
+ |
+LL | identity(1u8);
+ | -------- ^^^ expected because this argument is of type `u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:15:25
+ |
+LL | let identity = |x| x;
+ | ^
+help: change the type of the numeric literal from `u16` to `u8`
+ |
+LL | identity(1u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:20:18
+ |
+LL | identity(&1u16);
+ | -------- ^^^^^ expected `&u8`, found `&u16`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected reference `&u8`
+ found reference `&u16`
+note: expected because the closure was earlier called with an argument of type `&u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:19:18
+ |
+LL | identity(&1u8);
+ | -------- ^^^^ expected because this argument is of type `&u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:18:25
+ |
+LL | let identity = |x| x;
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:30:18
+ |
+LL | identity(1u16);
+ | -------- ^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:29:18
+ |
+LL | identity(1u8);
+ | -------- ^^^ expected because this argument is of type `u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:28:25
+ |
+LL | let identity = |x| x;
+ | ^
+help: change the type of the numeric literal from `u16` to `u8`
+ |
+LL | identity(1u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:33:18
+ |
+LL | identity(&1u16);
+ | -------- ^^^^^ expected `&u8`, found `&u16`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected reference `&u8`
+ found reference `&u16`
+note: expected because the closure was earlier called with an argument of type `&u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:32:18
+ |
+LL | identity(&1u8);
+ | -------- ^^^^ expected because this argument is of type `&u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:31:25
+ |
+LL | let identity = |x| x;
+ | ^
+
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
index 802696e1b..d836af2b0 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21
|
LL | let x = call_it(&square, 22);
@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26
|
LL | let z = call_it_once(square, 22);
diff --git a/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
index 0bbb9836c..c0dcf83a5 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:20:21
|
LL | let x = call_it(&square, 22);
- | ------- ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ------- ^^^^^^^ expected an `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
@@ -13,11 +13,11 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
- | ----------- ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ----------- ^^^^^^^^^^^ expected an `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
@@ -28,11 +28,11 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:30:26
|
LL | let z = call_it_once(square, 22);
- | ------------ ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ------------ ^^^^^^ expected an `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
index 31a66790c..d261c38f5 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:21:21
|
LL | let x = call_it(&square, 22);
@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:26:25
|
LL | let y = call_it_mut(&mut square, 22);
@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:31:26
|
LL | let z = call_it_once(square, 22);
diff --git a/tests/ui/uninhabited/diverging-guard.rs b/tests/ui/uninhabited/diverging-guard.rs
new file mode 100644
index 000000000..7d57cd51c
--- /dev/null
+++ b/tests/ui/uninhabited/diverging-guard.rs
@@ -0,0 +1,10 @@
+// check-pass
+
+enum Void {}
+
+fn main() {
+ let x: Void;
+ match x {
+ _ if { loop {} } => (),
+ }
+}
diff --git a/tests/ui/union/issue-81199.rs b/tests/ui/union/issue-81199.rs
index 628e7c6ed..b8b0d9d33 100644
--- a/tests/ui/union/issue-81199.rs
+++ b/tests/ui/union/issue-81199.rs
@@ -4,6 +4,7 @@ union PtrRepr<T: ?Sized> {
mut_ptr: *mut T,
components: PtrComponents<T>,
//~^ ERROR the trait bound
+ //~| ERROR field must implement `Copy`
}
#[repr(C)]
diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr
index 5bb986753..0dd894beb 100644
--- a/tests/ui/union/issue-81199.stderr
+++ b/tests/ui/union/issue-81199.stderr
@@ -5,7 +5,7 @@ LL | components: PtrComponents<T>,
| ^^^^^^^^^^^^^^^^ the trait `Pointee` is not implemented for `T`
|
note: required by a bound in `PtrComponents`
- --> $DIR/issue-81199.rs:10:25
+ --> $DIR/issue-81199.rs:11:25
|
LL | struct PtrComponents<T: Pointee + ?Sized> {
| ^^^^^^^ required by this bound in `PtrComponents`
@@ -14,6 +14,19 @@ help: consider further restricting this bound
LL | union PtrRepr<T: ?Sized + Pointee> {
| +++++++++
-error: aborting due to previous error
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/issue-81199.rs:5:5
+ |
+LL | components: PtrComponents<T>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | components: std::mem::ManuallyDrop<PtrComponents<T>>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/union/union-unsafe.mir.stderr b/tests/ui/union/union-unsafe.mir.stderr
index 544213dbc..15f059ffa 100644
--- a/tests/ui/union/union-unsafe.mir.stderr
+++ b/tests/ui/union/union-unsafe.mir.stderr
@@ -1,5 +1,5 @@
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:33:5
+ --> $DIR/union-unsafe.rs:34:5
|
LL | *(u.p) = 13;
| ^^^^^^^^^^^ access to union field
@@ -7,7 +7,7 @@ LL | *(u.p) = 13;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:46:6
+ --> $DIR/union-unsafe.rs:47:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -15,7 +15,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:52:6
+ --> $DIR/union-unsafe.rs:53:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -23,7 +23,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:60:13
+ --> $DIR/union-unsafe.rs:61:13
|
LL | let a = u1.a;
| ^^^^ access to union field
@@ -31,7 +31,7 @@ LL | let a = u1.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:63:14
+ --> $DIR/union-unsafe.rs:64:14
|
LL | let U1 { a } = u1;
| ^ access to union field
@@ -39,7 +39,7 @@ LL | let U1 { a } = u1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:64:12
+ --> $DIR/union-unsafe.rs:65:12
|
LL | if let U1 { a: 12 } = u1 {}
| ^^^^^^^^^^^^ access to union field
@@ -47,7 +47,15 @@ LL | if let U1 { a: 12 } = u1 {}
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:69:6
+ --> $DIR/union-unsafe.rs:66:12
+ |
+LL | if let Some(U1 { a: 13 }) = Some(u1) {}
+ | ^^^^^^^^^^^^^^^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:71:6
|
LL | *u2.a = String::from("new");
| ^^^^ access to union field
@@ -55,7 +63,7 @@ LL | *u2.a = String::from("new");
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:73:6
+ --> $DIR/union-unsafe.rs:75:6
|
LL | *u3.a = 1;
| ^^^^ access to union field
@@ -63,13 +71,13 @@ LL | *u3.a = 1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:77:6
+ --> $DIR/union-unsafe.rs:79:6
|
LL | *u3.a = String::from("new");
| ^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
-error: aborting due to 9 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/union/union-unsafe.rs b/tests/ui/union/union-unsafe.rs
index 5e1837a90..d1465486f 100644
--- a/tests/ui/union/union-unsafe.rs
+++ b/tests/ui/union/union-unsafe.rs
@@ -1,30 +1,31 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
-use std::mem::ManuallyDrop;
use std::cell::RefCell;
+use std::mem::ManuallyDrop;
union U1 {
- a: u8
+ a: u8,
}
union U2 {
- a: ManuallyDrop<String>
+ a: ManuallyDrop<String>,
}
union U3<T> {
- a: ManuallyDrop<T>
+ a: ManuallyDrop<T>,
}
union U4<T: Copy> {
- a: T
+ a: T,
}
union URef {
p: &'static mut i32,
}
-union URefCell { // field that does not drop but is not `Copy`, either
+union URefCell {
+ // field that does not drop but is not `Copy`, either
a: (ManuallyDrop<RefCell<i32>>, i32),
}
@@ -62,6 +63,7 @@ fn main() {
let U1 { a } = u1; //~ ERROR access to union field is unsafe
if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe
+ if let Some(U1 { a: 13 }) = Some(u1) {} //~ ERROR access to union field is unsafe
// let U1 { .. } = u1; // OK
let mut u2 = U2 { a: ManuallyDrop::new(String::from("old")) }; // OK
diff --git a/tests/ui/union/union-unsafe.thir.stderr b/tests/ui/union/union-unsafe.thir.stderr
index f959fe5bd..9ce835497 100644
--- a/tests/ui/union/union-unsafe.thir.stderr
+++ b/tests/ui/union/union-unsafe.thir.stderr
@@ -1,5 +1,5 @@
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:33:6
+ --> $DIR/union-unsafe.rs:34:6
|
LL | *(u.p) = 13;
| ^^^^^ access to union field
@@ -7,7 +7,7 @@ LL | *(u.p) = 13;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:46:6
+ --> $DIR/union-unsafe.rs:47:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -15,7 +15,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:52:6
+ --> $DIR/union-unsafe.rs:53:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -23,7 +23,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:60:13
+ --> $DIR/union-unsafe.rs:61:13
|
LL | let a = u1.a;
| ^^^^ access to union field
@@ -31,7 +31,7 @@ LL | let a = u1.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:63:14
+ --> $DIR/union-unsafe.rs:64:14
|
LL | let U1 { a } = u1;
| ^ access to union field
@@ -39,15 +39,23 @@ LL | let U1 { a } = u1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:64:8
+ --> $DIR/union-unsafe.rs:65:20
|
LL | if let U1 { a: 12 } = u1 {}
- | ^^^^^^^^^^^^^^^^^^^^^ access to union field
+ | ^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:69:6
+ --> $DIR/union-unsafe.rs:66:25
+ |
+LL | if let Some(U1 { a: 13 }) = Some(u1) {}
+ | ^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:71:6
|
LL | *u2.a = String::from("new");
| ^^^^ access to union field
@@ -55,7 +63,7 @@ LL | *u2.a = String::from("new");
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:73:6
+ --> $DIR/union-unsafe.rs:75:6
|
LL | *u3.a = 1;
| ^^^^ access to union field
@@ -63,13 +71,13 @@ LL | *u3.a = 1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:77:6
+ --> $DIR/union-unsafe.rs:79:6
|
LL | *u3.a = String::from("new");
| ^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
-error: aborting due to 9 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/union/union-unsized.mirunsafeck.stderr b/tests/ui/union/union-unsized.mirunsafeck.stderr
index 59ab835fb..f8da20413 100644
--- a/tests/ui/union/union-unsized.mirunsafeck.stderr
+++ b/tests/ui/union/union-unsized.mirunsafeck.stderr
@@ -17,7 +17,7 @@ LL | a: Box<str>,
| ++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/union-unsized.rs:13:8
+ --> $DIR/union-unsized.rs:14:8
|
LL | b: str,
| ^^^ doesn't have a size known at compile-time
@@ -34,6 +34,31 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | b: Box<str>,
| ++++ +
-error: aborting due to 2 previous errors
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:5:5
+ |
+LL | a: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | a: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:14:5
+ |
+LL | b: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | b: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/union/union-unsized.rs b/tests/ui/union/union-unsized.rs
index 8e897d7d3..b95b2e414 100644
--- a/tests/ui/union/union-unsized.rs
+++ b/tests/ui/union/union-unsized.rs
@@ -4,6 +4,7 @@
union U {
a: str,
//~^ ERROR the size for values of type
+ //~| ERROR field must implement `Copy`
b: u8,
}
@@ -12,6 +13,7 @@ union W {
a: u8,
b: str,
//~^ ERROR the size for values of type
+ //~| ERROR field must implement `Copy`
}
fn main() {}
diff --git a/tests/ui/union/union-unsized.thirunsafeck.stderr b/tests/ui/union/union-unsized.thirunsafeck.stderr
index 59ab835fb..f8da20413 100644
--- a/tests/ui/union/union-unsized.thirunsafeck.stderr
+++ b/tests/ui/union/union-unsized.thirunsafeck.stderr
@@ -17,7 +17,7 @@ LL | a: Box<str>,
| ++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/union-unsized.rs:13:8
+ --> $DIR/union-unsized.rs:14:8
|
LL | b: str,
| ^^^ doesn't have a size known at compile-time
@@ -34,6 +34,31 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | b: Box<str>,
| ++++ +
-error: aborting due to 2 previous errors
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:5:5
+ |
+LL | a: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | a: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:14:5
+ |
+LL | b: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | b: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/unknown-lint-tool-name.stderr b/tests/ui/unknown-lint-tool-name.stderr
index 5f8349ce6..72731ab1e 100644
--- a/tests/ui/unknown-lint-tool-name.stderr
+++ b/tests/ui/unknown-lint-tool-name.stderr
@@ -21,6 +21,7 @@ LL | #![deny(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
--> $DIR/unknown-lint-tool-name.rs:4:9
@@ -29,6 +30,7 @@ LL | #[allow(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 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 32f8d2f45..f0450aea4 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
@@ -8,11 +8,13 @@ error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
index 2a2a9811b..20a36b28d 100644
--- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
+++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
@@ -20,6 +20,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:1
@@ -29,6 +30,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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 dd9ecf02f..a2deecf1c 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
@@ -8,11 +8,13 @@ warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
index 0548cd226..12afb2e29 100644
--- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
+++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
@@ -20,6 +20,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
--> $DIR/warn-unknown-unstable-lint-inline.rs:4:1
@@ -29,6 +30,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/unresolved/auxiliary/library.rs b/tests/ui/unresolved/auxiliary/library.rs
new file mode 100644
index 000000000..1169ed962
--- /dev/null
+++ b/tests/ui/unresolved/auxiliary/library.rs
@@ -0,0 +1 @@
+pub struct SomeUsefulType;
diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs
new file mode 100644
index 000000000..af8207aaa
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs
@@ -0,0 +1,31 @@
+// Test that we don't prepend `::` to paths referencing crates from the extern prelude
+// when it can be avoided[^1] since it's more idiomatic to do so.
+//
+// [^1]: Counterexample: `unresolved-import-suggest-disambiguated-crate-name.rs`
+#![feature(decl_macro)] // allows us to create items with hygienic names
+
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod hygiene {
+ make!();
+ macro make() {
+ // This won't conflict with the suggested *non-global* path as the syntax context differs.
+ mod library {}
+ }
+
+ mod module {}
+ use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
+}
+
+mod glob {
+ use inner::*;
+ mod inner {
+ mod library {}
+ }
+
+ mod module {}
+ use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
+}
+
+fn main() {}
diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
new file mode 100644
index 000000000..b0352ab67
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
@@ -0,0 +1,25 @@
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:18:9
+ |
+LL | use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `hygiene::module`
+ |
+help: consider importing this struct instead
+ |
+LL | use library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:28:9
+ |
+LL | use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `glob::module`
+ |
+help: consider importing this struct instead
+ |
+LL | use library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed
new file mode 100644
index 000000000..2b20d3f10
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed
@@ -0,0 +1,19 @@
+// Regression test for issue #116970.
+//
+// When we suggest importing an item from a crate found in the extern prelude and there
+// happens to exist a module or type in the current scope with the same name as the crate,
+// disambiguate the suggested path by making it global (i.e., by prefixing it with `::`).
+//
+// For context, when it can be avoided we don't prepend `::` to paths referencing crates
+// from the extern prelude. See also `unresolved-import-avoid-suggesting-global-path.rs`.
+
+// run-rustfix
+
+// compile-flags: --crate-type=lib
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod library {} // this module shares the same name as the external crate!
+
+mod module {}
+pub use ::library::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs
new file mode 100644
index 000000000..b810a7f52
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs
@@ -0,0 +1,19 @@
+// Regression test for issue #116970.
+//
+// When we suggest importing an item from a crate found in the extern prelude and there
+// happens to exist a module or type in the current scope with the same name as the crate,
+// disambiguate the suggested path by making it global (i.e., by prefixing it with `::`).
+//
+// For context, when it can be avoided we don't prepend `::` to paths referencing crates
+// from the extern prelude. See also `unresolved-import-avoid-suggesting-global-path.rs`.
+
+// run-rustfix
+
+// compile-flags: --crate-type=lib
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod library {} // this module shares the same name as the external crate!
+
+mod module {}
+pub use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
new file mode 100644
index 000000000..f139c0f3c
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
@@ -0,0 +1,14 @@
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-suggest-disambiguated-crate-name.rs:19:9
+ |
+LL | pub use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `module`
+ |
+help: consider importing this struct instead
+ |
+LL | pub use ::library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
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.mir.stderr
index fbc621f4d..ea53bf59d 100644
--- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr
@@ -1,12 +1,12 @@
warning: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:5
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13: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
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1
|
LL | unsafe fn foo() {
| ^^^^^^^^^^^^^^^
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
index a192f3445..1b429955c 100644
--- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
@@ -1,17 +1,21 @@
// edition: 2024
// compile-flags: -Zunstable-options
// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![crate_type = "lib"]
-
#![deny(unused_unsafe)]
unsafe fn unsf() {}
unsafe fn foo() {
unsf();
- //~^ WARN call to unsafe function is unsafe and requires unsafe block
+ //[mir]~^ WARN call to unsafe function is unsafe and requires unsafe block
+ //[thir]~^^ WARN call to unsafe function `unsf` is unsafe and requires unsafe block
// no unused_unsafe
- unsafe { unsf(); }
+ unsafe {
+ unsf();
+ }
}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr
new file mode 100644
index 000000000..d63843ed2
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr
@@ -0,0 +1,16 @@
+warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13: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:12: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.stderr b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
index d34554c66..13438fd31 100644
--- a/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnOnce<({integer},)>` closure, found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+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());
diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
index 9e9cbcf33..2267da315 100644
--- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
+++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
@@ -16,9 +16,9 @@ LL | #[deny(unused_unsafe)]
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38
|
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-...
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | v.set_len(24);
LL | |w: &mut Vec<u32>| { unsafe {
| ^^^^^^ unnecessary `unsafe` block
diff --git a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
index 427843f8d..dc6bd72f5 100644
--- a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
+++ b/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
@@ -6,6 +6,14 @@ LL | let y = &mut x.0;
|
= note: mutating layout constrained fields cannot statically be checked for valid values
-error: aborting due to previous error
+error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
+ --> $DIR/ranged_ints2.rs:12:25
+ |
+LL | if let Some(NonZero(ref mut y)) = Some(x) {}
+ | ^^^^^^^^^ mutation of layout constrained field
+ |
+ = note: mutating layout constrained fields cannot statically be checked for valid values
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/ranged_ints2.rs b/tests/ui/unsafe/ranged_ints2.rs
index 9a6bb18f9..ad9d598ab 100644
--- a/tests/ui/unsafe/ranged_ints2.rs
+++ b/tests/ui/unsafe/ranged_ints2.rs
@@ -9,4 +9,5 @@ pub(crate) struct NonZero<T>(pub(crate) T);
fn main() {
let mut x = unsafe { NonZero(1) };
let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe
+ if let Some(NonZero(ref mut y)) = Some(x) {} //~ ERROR mutation of layout constrained field is unsafe
}
diff --git a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
index 427843f8d..dc6bd72f5 100644
--- a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
+++ b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
@@ -6,6 +6,14 @@ LL | let y = &mut x.0;
|
= note: mutating layout constrained fields cannot statically be checked for valid values
-error: aborting due to previous error
+error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
+ --> $DIR/ranged_ints2.rs:12:25
+ |
+LL | if let Some(NonZero(ref mut y)) = Some(x) {}
+ | ^^^^^^^^^ mutation of layout constrained field
+ |
+ = note: mutating layout constrained fields cannot statically be checked for valid values
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
index 13c080e5b..ad0621a1d 100644
--- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
+++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
@@ -5,6 +5,11 @@ 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/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1
+ |
+LL | unsafe fn deny_level() {
+ | ^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9
|
@@ -46,6 +51,11 @@ 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/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1
+ |
+LL | unsafe fn warning_level() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8
|
@@ -76,12 +86,10 @@ LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:14
+ --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5
|
LL | unsafe { unsafe { unsf() } }
- | ------ ^^^^^^ unnecessary `unsafe` block
- | |
- | because it's nested under this `unsafe` block
+ | ^^^^^^ unnecessary `unsafe` block
error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed
index db1c10221..b59029df6 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed
@@ -1,7 +1,10 @@
// run-rustfix
// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
extern crate external_unsafe_macro;
@@ -9,11 +12,13 @@ unsafe fn unsf() {}
pub unsafe fn foo() { unsafe {
//~^ NOTE an unsafe function restricts its caller, but its body is safe by default
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
}}
@@ -39,10 +44,12 @@ pub unsafe fn baz() -> i32 { unsafe {
}}
macro_rules! unsafe_macro { () => (unsf()) }
-//~^ ERROR call to unsafe function is unsafe
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
-//~| ERROR call to unsafe function is unsafe
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr
index 43f619c27..7a1b83c73 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr
@@ -1,23 +1,23 @@
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:12:5
+ --> $DIR/wrapping-unsafe-block-sugg.rs:15: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/wrapping-unsafe-block-sugg.rs:10:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:13:1
|
LL | pub unsafe fn foo() {
| ^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
- --> $DIR/wrapping-unsafe-block-sugg.rs:4:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:6:9
|
LL | #![deny(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:15:5
+ --> $DIR/wrapping-unsafe-block-sugg.rs:19:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
@@ -25,20 +25,20 @@ LL | unsf();
= note: consult the function's documentation for information on how to avoid undefined behavior
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:22:13
+ --> $DIR/wrapping-unsafe-block-sugg.rs:27:13
|
LL | let y = *x;
| ^^ dereference of raw pointer
|
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:20:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:25:1
|
LL | pub unsafe fn bar(x: *const i32) -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:25:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:30:9
|
LL | y + *x
| ^^ dereference of raw pointer
@@ -46,20 +46,20 @@ LL | y + *x
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
error: use of mutable static is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:33:13
+ --> $DIR/wrapping-unsafe-block-sugg.rs:38:13
|
LL | let y = BAZ;
| ^^^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:31:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:36:1
|
LL | pub unsafe fn baz() -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of mutable static is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:36:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:41:9
|
LL | y + BAZ
| ^^^ use of mutable static
@@ -67,7 +67,7 @@ LL | y + BAZ
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:41:36
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
|
LL | macro_rules! unsafe_macro { () => (unsf()) }
| ^^^^^^ call to unsafe function
@@ -77,14 +77,14 @@ LL | unsafe_macro!();
|
= 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/wrapping-unsafe-block-sugg.rs:49:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:56:1
|
LL | pub unsafe fn unsafe_in_macro() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:41:36
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
|
LL | macro_rules! unsafe_macro { () => (unsf()) }
| ^^^^^^ call to unsafe function
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
index 9c6be4589..3629b8a1b 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
@@ -1,7 +1,10 @@
// run-rustfix
// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
extern crate external_unsafe_macro;
@@ -9,11 +12,13 @@ unsafe fn unsf() {}
pub unsafe fn foo() {
//~^ NOTE an unsafe function restricts its caller, but its body is safe by default
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
}
@@ -39,10 +44,12 @@ pub unsafe fn baz() -> i32 {
}
macro_rules! unsafe_macro { () => (unsf()) }
-//~^ ERROR call to unsafe function is unsafe
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
-//~| ERROR call to unsafe function is unsafe
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed
new file mode 100644
index 000000000..b59029df6
--- /dev/null
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
+
+#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
+
+extern crate external_unsafe_macro;
+
+unsafe fn unsf() {}
+
+pub unsafe fn foo() { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
+ //~| NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
+ //~| NOTE
+}}
+
+pub unsafe fn bar(x: *const i32) -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ let y = *x; //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+ y + *x //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+}}
+
+static mut BAZ: i32 = 0;
+pub unsafe fn baz() -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ let y = BAZ; //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+ y + BAZ //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+}}
+
+macro_rules! unsafe_macro { () => (unsf()) }
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
+//~| NOTE
+//~| NOTE
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
+//~| NOTE
+//~| NOTE
+
+pub unsafe fn unsafe_in_macro() { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ unsafe_macro!();
+ //~^ NOTE
+ //~| NOTE
+ unsafe_macro!();
+ //~^ NOTE
+ //~| NOTE
+}}
+
+pub unsafe fn unsafe_in_external_macro() {
+ // FIXME: https://github.com/rust-lang/rust/issues/112504
+ // FIXME: ~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ external_unsafe_macro::unsafe_macro!();
+ external_unsafe_macro::unsafe_macro!();
+}
+
+fn main() {}
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr
new file mode 100644
index 000000000..b1fb35f85
--- /dev/null
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr
@@ -0,0 +1,99 @@
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:15: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/wrapping-unsafe-block-sugg.rs:13:1
+ |
+LL | pub unsafe fn foo() {
+ | ^^^^^^^^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/wrapping-unsafe-block-sugg.rs:6:9
+ |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:19:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:27:13
+ |
+LL | let y = *x;
+ | ^^ dereference of raw pointer
+ |
+ = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:25:1
+ |
+LL | pub unsafe fn bar(x: *const i32) -> i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:30:9
+ |
+LL | y + *x
+ | ^^ dereference of raw pointer
+ |
+ = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: use of mutable static is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:38:13
+ |
+LL | let y = BAZ;
+ | ^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:36:1
+ |
+LL | pub unsafe fn baz() -> i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of mutable static is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:41:9
+ |
+LL | y + BAZ
+ | ^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
+ |
+LL | macro_rules! unsafe_macro { () => (unsf()) }
+ | ^^^^^^ call to unsafe function
+...
+LL | unsafe_macro!();
+ | --------------- in this macro invocation
+ |
+ = 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/wrapping-unsafe-block-sugg.rs:56:1
+ |
+LL | pub unsafe fn unsafe_in_macro() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
+ |
+LL | macro_rules! unsafe_macro { () => (unsf()) }
+ | ^^^^^^ call to unsafe function
+...
+LL | unsafe_macro!();
+ | --------------- in this macro invocation
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/maybe-bounds-where.rs
index d7af0c424..7e82a3eb4 100644
--- a/tests/ui/unsized/maybe-bounds-where.rs
+++ b/tests/ui/unsized/maybe-bounds-where.rs
@@ -11,11 +11,11 @@ trait Trait<'a> {}
struct S4<T>(T) where for<'a> T: ?Trait<'a>;
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-//~| WARN default bound relaxed for a type parameter
+//~| WARN relaxing a default bound only does something for `?Sized`
struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
//~^ ERROR type parameter has more than one relaxed default bound
-//~| WARN default bound relaxed for a type parameter
+//~| WARN relaxing a default bound only does something for `?Sized`
impl<T> S1<T> {
fn f() where T: ?Sized {}
diff --git a/tests/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/maybe-bounds-where.stderr
index 39bc1b88e..683bd387b 100644
--- a/tests/ui/unsized/maybe-bounds-where.stderr
+++ b/tests/ui/unsized/maybe-bounds-where.stderr
@@ -28,23 +28,23 @@ error: `?Trait` bounds are only permitted at the point where a type parameter is
LL | fn f() where T: ?Sized {}
| ^^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/maybe-bounds-where.rs:12:11
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/maybe-bounds-where.rs:12:34
|
LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
- | ^
+ | ^^^^^^^^^^
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
- --> $DIR/maybe-bounds-where.rs:16:11
+ --> $DIR/maybe-bounds-where.rs:16:33
|
LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
- | ^
+ | ^^^^^^^^^^^^^^^ ^^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/maybe-bounds-where.rs:16:11
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/maybe-bounds-where.rs:16:33
|
LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
- | ^
+ | ^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors; 2 warnings emitted
diff --git a/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs b/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs
new file mode 100644
index 000000000..eba341ff2
--- /dev/null
+++ b/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs
@@ -0,0 +1,29 @@
+// check-pass
+
+struct Foo<T, U>
+where
+ (T, U): Trait,
+{
+ f: <(T, U) as Trait>::Assoc,
+}
+
+trait Trait {
+ type Assoc: ?Sized;
+}
+
+struct Count<const N: usize>;
+
+impl<const N: usize> Trait for (i32, Count<N>) {
+ type Assoc = [(); N];
+}
+
+impl<'a> Trait for (u32, ()) {
+ type Assoc = [()];
+}
+
+// Test that we can unsize several trait params in creative ways.
+fn unsize<const N: usize>(x: &Foo<i32, Count<N>>) -> &Foo<u32, ()> {
+ x
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/unsized-trait-impl-self-type.rs b/tests/ui/unsized/unsized-trait-impl-self-type.rs
index df571a833..603c0a221 100644
--- a/tests/ui/unsized/unsized-trait-impl-self-type.rs
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.rs
@@ -9,6 +9,7 @@ struct S5<Y>(Y);
impl<X: ?Sized> T3<X> for S5<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized-trait-impl-self-type.stderr b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
index 4955d463f..5bc8dc590 100644
--- a/tests/ui/unsized/unsized-trait-impl-self-type.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
@@ -24,6 +24,16 @@ LL - impl<X: ?Sized> T3<X> for S5<X> {
LL + impl<X> T3<X> for S5<X> {
|
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `foo`
+ --> $DIR/unsized-trait-impl-self-type.rs:10:1
+ |
+LL | fn foo(&self, z: &Z);
+ | --------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T3<X> for S5<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/unsized/unsized-trait-impl-trait-arg.rs b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
index 96e7e371f..e7602b175 100644
--- a/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
@@ -7,6 +7,7 @@ trait T2<Z> {
struct S4<Y: ?Sized>(Box<Y>);
impl<X: ?Sized> T2<X> for S4<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
index 8761c293a..e9353d2bb 100644
--- a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
@@ -21,6 +21,16 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T2<Z: ?Sized> {
| ++++++++
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `foo`
+ --> $DIR/unsized-trait-impl-trait-arg.rs:8:1
+ |
+LL | fn foo(&self, z: Z);
+ | -------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T2<X> for S4<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/unsized/unsized7.rs b/tests/ui/unsized/unsized7.rs
index 422a78481..63e015c28 100644
--- a/tests/ui/unsized/unsized7.rs
+++ b/tests/ui/unsized/unsized7.rs
@@ -11,6 +11,7 @@ trait T1<Z: T> {
struct S3<Y: ?Sized>(Box<Y>);
impl<X: ?Sized + T> T1<X> for S3<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized7.stderr b/tests/ui/unsized/unsized7.stderr
index c313a2724..2edde1596 100644
--- a/tests/ui/unsized/unsized7.stderr
+++ b/tests/ui/unsized/unsized7.stderr
@@ -21,6 +21,16 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T1<Z: T + ?Sized> {
| ++++++++
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `dummy`
+ --> $DIR/unsized7.rs:12:1
+ |
+LL | fn dummy(&self) -> Z;
+ | --------------------- `dummy` from trait
+...
+LL | impl<X: ?Sized + T> T1<X> for S3<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/use/use-super-global-path.stderr b/tests/ui/use/use-super-global-path.stderr
index 7014a12e9..00d172f47 100644
--- a/tests/ui/use/use-super-global-path.stderr
+++ b/tests/ui/use/use-super-global-path.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: global paths cannot start with `super`
|
LL | use ::super::{S, Z};
| ^^^^^ global paths cannot start with `super`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: global paths cannot start with `super`
--> $DIR/use-super-global-path.rs:11:15
diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs
index 892b28135..6d40d6377 100644
--- a/tests/ui/weird-exprs.rs
+++ b/tests/ui/weird-exprs.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs
index 3855f2c35..2820d5f6d 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.rs
+++ b/tests/ui/wf/hir-wf-check-erase-regions.rs
@@ -5,6 +5,7 @@ pub struct Table<T, const N: usize>([Option<T>; N]);
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&'a T` is not an iterator
+ //~^ ERROR `&'a T` is not an iterator
type Item = &'a T;
fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr
index 2843983c7..eb0a8f8f6 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.stderr
+++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr
@@ -11,7 +11,7 @@ note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
- --> $DIR/hir-wf-check-erase-regions.rs:10:27
+ --> $DIR/hir-wf-check-erase-regions.rs:11:27
|
LL | fn into_iter(self) -> Self::IntoIter {
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
@@ -22,6 +22,18 @@ LL | fn into_iter(self) -> Self::IntoIter {
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
-error: aborting due to 2 previous errors
+error[E0277]: `&'a T` is not an iterator
+ --> $DIR/hir-wf-check-erase-regions.rs:7:21
+ |
+LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `&'a T`
+ = help: the trait `Iterator` is implemented for `&mut I`
+ = note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
+note: required by a bound in `std::iter::IntoIterator::IntoIter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/issue-110157.rs b/tests/ui/wf/issue-110157.rs
index 43a8ce72f..07e2c5d58 100644
--- a/tests/ui/wf/issue-110157.rs
+++ b/tests/ui/wf/issue-110157.rs
@@ -2,6 +2,7 @@ struct NeedsDropTypes<'tcx, F>(std::marker::PhantomData<&'tcx F>);
impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
//~^ ERROR type annotations needed
+//~| ERROR not all trait items implemented
where
F: Fn(&Missing) -> Result<I, ()>,
//~^ ERROR cannot find type `Missing` in this scope
diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr
index 91d801e94..16bd34a6d 100644
--- a/tests/ui/wf/issue-110157.stderr
+++ b/tests/ui/wf/issue-110157.stderr
@@ -1,11 +1,11 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/issue-110157.rs:6:12
+ --> $DIR/issue-110157.rs:7:12
|
LL | F: Fn(&Missing) -> Result<I, ()>,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/issue-110157.rs:8:24
+ --> $DIR/issue-110157.rs:9:24
|
LL | I: Iterator<Item = Missing>,
| ^^^^^^^ not found in this scope
@@ -26,7 +26,22 @@ LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
LL | I: Iterator<Item = Missing>,
| ------------------------ unsatisfied trait bound introduced here
-error: aborting due to 3 previous errors
+error[E0046]: not all trait items implemented, missing: `Item`, `next`
+ --> $DIR/issue-110157.rs:3:1
+ |
+LL | / impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
+LL | |
+LL | |
+LL | | where
+LL | | F: Fn(&Missing) -> Result<I, ()>,
+LL | |
+LL | | I: Iterator<Item = Missing>,
+ | |________________________________^ missing `Item`, `next` in implementation
+ |
+ = help: implement the missing item: `type Item = /* Type */;`
+ = help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
+
+error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0283, E0412.
-For more information about an error, try `rustc --explain E0283`.
+Some errors have detailed explanations: E0046, E0283, E0412.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/wf/unnormalized-projection-guides-inference.rs b/tests/ui/wf/unnormalized-projection-guides-inference.rs
new file mode 100644
index 000000000..ca2d6c2e8
--- /dev/null
+++ b/tests/ui/wf/unnormalized-projection-guides-inference.rs
@@ -0,0 +1,24 @@
+// The WF requirements of the *unnormalized* form of type annotations
+// can guide inference.
+// check-pass
+
+pub trait EqualTo {
+ type Ty;
+}
+impl<X> EqualTo for X {
+ type Ty = X;
+}
+
+trait MyTrait<U: EqualTo<Ty = Self>> {
+ type Out;
+}
+impl<T, U: EqualTo<Ty = T>> MyTrait<U> for T {
+ type Out = ();
+}
+
+fn main() {
+ let _: <_ as MyTrait<u8>>::Out;
+ // We shoud be able to infer a value for the inference variable above.
+ // The WF of the unnormalized projection requires `u8: EqualTo<Ty = _>`,
+ // which is sufficient to guide inference.
+}
diff --git a/tests/ui/wf/wf-const-type.rs b/tests/ui/wf/wf-const-type.rs
index df79aa267..64b0d9c8d 100644
--- a/tests/ui/wf/wf-const-type.rs
+++ b/tests/ui/wf/wf-const-type.rs
@@ -9,6 +9,7 @@ struct NotCopy;
const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
//~^ ERROR E0277
+//~| ERROR E0277
fn main() { }
diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr
index 617969720..039e90770 100644
--- a/tests/ui/wf/wf-const-type.stderr
+++ b/tests/ui/wf/wf-const-type.stderr
@@ -16,6 +16,24 @@ LL + #[derive(Copy)]
LL | struct NotCopy;
|
-error: aborting due to previous error
+error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
+ --> $DIR/wf-const-type.rs:10:50
+ |
+LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^ the trait `Copy` is not implemented for `NotCopy`
+ |
+ = note: required for `Option<NotCopy>` to implement `Copy`
+note: required by a bound in `IsCopy`
+ --> $DIR/wf-const-type.rs:7:17
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^ required by this bound in `IsCopy`
+help: consider annotating `NotCopy` with `#[derive(Copy)]`
+ |
+LL + #[derive(Copy)]
+LL | struct NotCopy;
+ |
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
index 40a25c7df..85f507336 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
@@ -11,6 +11,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<dyn Trait>`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -26,6 +27,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -41,6 +43,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<dyn Trait>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
index e2c71df2f..a2a196316 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
@@ -11,6 +11,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -26,6 +27,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -41,6 +43,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error: aborting due to 3 previous errors
diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr
index 2aec641e7..cd6c051fe 100644
--- a/tests/ui/wf/wf-fn-where-clause.stderr
+++ b/tests/ui/wf/wf-fn-where-clause.stderr
@@ -14,6 +14,15 @@ help: consider further restricting type parameter `U`
LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++
+error[E0038]: the trait `Copy` cannot be made into an object
+ --> $DIR/wf-fn-where-clause.rs:12:16
+ |
+LL | fn bar() where Vec<dyn Copy>:, {}
+ | ^^^^^^^^^^^^^ `Copy` cannot be made into an object
+ |
+ = note: the trait cannot be made into an object because it requires `Self: Sized`
+ = 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>
+
error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time
--> $DIR/wf-fn-where-clause.rs:12:16
|
@@ -34,15 +43,6 @@ LL | struct Vec<T> {
LL | t: T,
| - ...if indirection were used here: `Box<T>`
-error[E0038]: the trait `Copy` cannot be made into an object
- --> $DIR/wf-fn-where-clause.rs:12:16
- |
-LL | fn bar() where Vec<dyn Copy>:, {}
- | ^^^^^^^^^^^^^ `Copy` cannot be made into an object
- |
- = note: the trait cannot be made into an object because it requires `Self: Sized`
- = 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>
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0038, E0277.
diff --git a/tests/ui/wf/wf-impl-associated-type-region.stderr b/tests/ui/wf/wf-impl-associated-type-region.stderr
index b9d4857a3..e6fb81247 100644
--- a/tests/ui/wf/wf-impl-associated-type-region.stderr
+++ b/tests/ui/wf/wf-impl-associated-type-region.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-impl-associated-type-region.rs:10:16
|
+LL | impl<'a, T> Foo<'a> for T {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Bar = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Foo<'a> for T {
| ++++
diff --git a/tests/ui/wf/wf-in-fn-type-static.stderr b/tests/ui/wf/wf-in-fn-type-static.stderr
index 73fbb9ca6..45ad9fba0 100644
--- a/tests/ui/wf/wf-in-fn-type-static.stderr
+++ b/tests/ui/wf/wf-in-fn-type-static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-fn-type-static.rs:13:8
|
LL | x: fn() -> &'static T
- | ^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-fn-type-static.rs:18:8
|
LL | x: fn(&'static T)
- | ^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Bar<T: 'static> {
| +++++++++
diff --git a/tests/ui/wf/wf-in-obj-type-static.stderr b/tests/ui/wf/wf-in-obj-type-static.stderr
index c3ad42dd5..4b9b18916 100644
--- a/tests/ui/wf/wf-in-obj-type-static.stderr
+++ b/tests/ui/wf/wf-in-obj-type-static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-obj-type-static.rs:14:8
|
LL | x: dyn Object<&'static T>
- | ^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
diff --git a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
index 4d4d8b2ab..e0cf42fd1 100644
--- a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
+++ b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
|
+LL | impl<'a, T> Trait<'a, T> for usize {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a fn(T);
| ^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
@@ -12,10 +14,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
|
+LL | impl<'a, T> Trait<'a, T> for u32 {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a dyn Baz<T>;
| ^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
diff --git a/tests/ui/wf/wf-static-type.rs b/tests/ui/wf/wf-static-type.rs
index 1c35e1daf..f454fe30e 100644
--- a/tests/ui/wf/wf-static-type.rs
+++ b/tests/ui/wf/wf-static-type.rs
@@ -9,6 +9,7 @@ struct NotCopy;
static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
//~^ ERROR E0277
+//~| ERROR E0277
fn main() { }
diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr
index bb5a57834..65dae2601 100644
--- a/tests/ui/wf/wf-static-type.stderr
+++ b/tests/ui/wf/wf-static-type.stderr
@@ -16,6 +16,24 @@ LL + #[derive(Copy)]
LL | struct NotCopy;
|
-error: aborting due to previous error
+error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
+ --> $DIR/wf-static-type.rs:10:51
+ |
+LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^ the trait `Copy` is not implemented for `NotCopy`
+ |
+ = note: required for `Option<NotCopy>` to implement `Copy`
+note: required by a bound in `IsCopy`
+ --> $DIR/wf-static-type.rs:7:17
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^ required by this bound in `IsCopy`
+help: consider annotating `NotCopy` with `#[derive(Copy)]`
+ |
+LL + #[derive(Copy)]
+LL | struct NotCopy;
+ |
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/wf-trait-associated-type-region.stderr b/tests/ui/wf/wf-trait-associated-type-region.stderr
index 6e2cc8aba..ca7aeb55b 100644
--- a/tests/ui/wf/wf-trait-associated-type-region.stderr
+++ b/tests/ui/wf/wf-trait-associated-type-region.stderr
@@ -1,11 +1,16 @@
error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
--> $DIR/wf-trait-associated-type-region.rs:9:18
|
+LL | trait SomeTrait<'a> {
+ | -- the associated type `<Self as SomeTrait<'a>>::Type1` must be valid for the lifetime `'a` as defined here...
+LL | type Type1;
LL | type Type2 = &'a Self::Type1;
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
|
- = help: consider adding an explicit lifetime bound `<Self as SomeTrait<'a>>::Type1: 'a`...
- = note: ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
+help: consider adding an explicit lifetime bound
+ |
+LL | type Type2 = &'a Self::Type1 where <Self as SomeTrait<'a>>::Type1: 'a;
+ | ++++++++++++++++++++++++++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
index 66504e440..a0279774a 100644
--- a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
+++ b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
@@ -11,6 +11,10 @@ LL | | }
|
= note: expected reference `&S`
found reference `&R`
+help: consider using a semicolon here, but this will discard any values in the match arms
+ |
+LL | };
+ | +
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:26:21
@@ -25,6 +29,9 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
+ S
+ R
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -44,6 +51,9 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
+ S
+ R
= note: required for the cast from `&R` to `&dyn Trait`
error: aborting due to 3 previous errors