From 4f9fe856a25ab29345b90e7725509e9ee38a37be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:41 +0200 Subject: Adding upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/abi/stack-probes-lto.rs | 1 + tests/ui/abi/stack-probes.rs | 1 + .../alloc-error-handler-bad-signature-1.stderr | 2 +- .../alloc-error-handler-bad-signature-2.stderr | 8 +- .../alloc-error-handler-bad-signature-3.stderr | 6 +- tests/ui/argument-suggestions/basic.stderr | 9 +- tests/ui/argument-suggestions/exotic-calls.stderr | 36 +- tests/ui/argument-suggestions/extra_arguments.rs | 8 + .../ui/argument-suggestions/extra_arguments.stderr | 214 ++++---- .../formal-and-expected-differ.stderr | 4 +- .../argument-suggestions/invalid_arguments.stderr | 48 +- tests/ui/argument-suggestions/issue-100154.stderr | 2 +- tests/ui/argument-suggestions/issue-100478.stderr | 2 +- tests/ui/argument-suggestions/issue-101097.stderr | 8 +- tests/ui/argument-suggestions/issue-97484.stderr | 13 +- tests/ui/argument-suggestions/mixed_cases.stderr | 17 +- tests/ui/argument-suggestions/too-long.stderr | 2 +- .../argument-suggestions/two-mismatch-notes.stderr | 5 +- tests/ui/array-slice-vec/array-not-vector.rs | 4 +- tests/ui/array-slice-vec/array-not-vector.stderr | 4 +- .../array-slice-vec/slice-to-vec-comparison.stderr | 2 +- tests/ui/asm/issue-72570.rs | 2 - tests/ui/asm/issue-72570.stderr | 2 +- tests/ui/asm/type-check-4.stderr | 6 +- .../associated-const-generic-obligations.stderr | 2 +- tests/ui/associated-consts/issue-105330.stderr | 2 +- tests/ui/associated-inherent-types/ambiguity.rs | 16 + .../ui/associated-inherent-types/ambiguity.stderr | 20 + .../bugs/ice-substitution.rs | 23 + .../bugs/ice-substitution.stderr | 6 + .../bugs/inference-fail.rs | 15 + .../bugs/inference-fail.stderr | 9 + .../bugs/lack-of-regionck.rs | 19 + .../dispatch-on-self-type-0.rs | 41 ++ .../dispatch-on-self-type-1.rs | 39 ++ .../dispatch-on-self-type-2.rs | 17 + .../dispatch-on-self-type-2.stderr | 19 + ...found-self-type-differs-shadowing-trait-item.rs | 31 ++ ...pe-differs-shadowing-trait-item.shadowed.stderr | 15 + ...e-differs-shadowing-trait-item.uncovered.stderr | 9 + .../not-found-self-type-differs.alias.stderr | 16 + .../not-found-self-type-differs.local.stderr | 16 + .../not-found-self-type-differs.rs | 22 + .../not-found-unsatisfied-bounds-0.rs | 21 + .../not-found-unsatisfied-bounds-0.stderr | 27 + .../not-found-unsatisfied-bounds-1.rs | 18 + .../not-found-unsatisfied-bounds-1.stderr | 14 + ...t-found-unsatisfied-bounds-in-multiple-impls.rs | 20 + ...und-unsatisfied-bounds-in-multiple-impls.stderr | 20 + .../associated-inherent-types/struct-generics.rs | 15 - .../substitute-params-bad.rs | 23 + .../substitute-params-bad.stderr | 20 + .../associated-inherent-types/substitute-params.rs | 23 + .../bad-universal-in-dyn-in-where-clause.rs | 14 + .../bad-universal-in-dyn-in-where-clause.stderr | 8 + .../bad-universal-in-impl-sig.rs | 13 + .../bad-universal-in-impl-sig.stderr | 8 + tests/ui/associated-type-bounds/elision.stderr | 6 +- tests/ui/associated-type-bounds/inside-adt.rs | 22 +- tests/ui/associated-type-bounds/inside-adt.stderr | 105 +--- .../ui/associated-type-bounds/issue-71443-1.stderr | 2 +- ...sociated-type-projection-from-supertrait.stderr | 12 +- tests/ui/associated-types/associated-types-eq-3.rs | 2 +- .../associated-types/associated-types-eq-3.stderr | 2 +- .../associated-types/associated-types-eq-hr.stderr | 12 +- .../associated-types-outlives.stderr | 3 + .../defaults-in-other-trait-items.rs | 14 + .../defaults-in-other-trait-items.stderr | 17 +- .../associated-types/defaults-suitability.stderr | 6 +- .../hr-associated-type-bound-1.stderr | 2 +- .../hr-associated-type-bound-object.stderr | 2 +- .../hr-associated-type-bound-param-1.stderr | 2 +- .../hr-associated-type-bound-param-2.stderr | 6 +- .../hr-associated-type-bound-param-3.stderr | 2 +- .../hr-associated-type-bound-param-4.stderr | 2 +- .../hr-associated-type-bound-param-5.stderr | 4 +- .../hr-associated-type-projection-1.stderr | 6 +- tests/ui/associated-types/issue-26681.stderr | 4 +- tests/ui/associated-types/issue-38821.rs | 33 ++ tests/ui/associated-types/issue-38821.stderr | 22 + tests/ui/associated-types/issue-43924.stderr | 2 +- tests/ui/associated-types/issue-87261.rs | 6 +- tests/ui/associated-types/issue-87261.stderr | 6 +- .../point-at-type-on-obligation-failure-2.stderr | 4 +- .../async-await-let-else.drop_tracking.stderr | 106 ++++ .../async-await-let-else.drop_tracking_mir.stderr | 100 ++++ .../async-await-let-else.no_drop_tracking.stderr | 90 ++++ tests/ui/async-await/async-await-let-else.rs | 6 +- ...sync-block-control-flow-static-semantics.stderr | 4 +- .../async-error-span.drop_tracking.stderr | 25 + .../async-error-span.drop_tracking_mir.stderr | 24 + .../async-error-span.no_drop_tracking.stderr | 25 + tests/ui/async-await/async-error-span.rs | 7 +- tests/ui/async-await/async-error-span.stderr | 25 - .../async-fn-nonsend.drop_tracking.stderr | 49 ++ .../async-fn-nonsend.drop_tracking_mir.stderr | 43 ++ .../async-fn-nonsend.no_drop_tracking.stderr | 120 +++++ tests/ui/async-await/async-fn-nonsend.rs | 8 +- tests/ui/async-await/async-fn-nonsend.stderr | 12 +- tests/ui/async-await/async-fn-path-elision.stderr | 1 - tests/ui/async-await/default-struct-update.rs | 4 +- .../async-await/dont-suggest-missing-await.stderr | 12 +- tests/ui/async-await/drop-and-assign.rs | 4 +- ...track-field-assign-nonsend.drop_tracking.stderr | 25 + ...k-field-assign-nonsend.drop_tracking_mir.stderr | 23 + ...ck-field-assign-nonsend.no_drop_tracking.stderr | 25 + .../async-await/drop-track-field-assign-nonsend.rs | 4 +- .../drop-track-field-assign-nonsend.stderr | 25 - tests/ui/async-await/drop-track-field-assign.rs | 4 +- .../field-assign-nonsend.drop_tracking.stderr | 25 + .../field-assign-nonsend.drop_tracking_mir.stderr | 23 + .../field-assign-nonsend.no_drop_tracking.stderr | 25 + tests/ui/async-await/field-assign-nonsend.rs | 47 ++ tests/ui/async-await/field-assign.rs | 46 ++ .../async-await/future-sizes/async-awaiting-fut.rs | 24 + .../future-sizes/async-awaiting-fut.stdout | 72 +++ tests/ui/async-await/future-sizes/future-as-arg.rs | 16 + tests/ui/async-await/future-sizes/large-arg.rs | 18 + tests/ui/async-await/future-sizes/large-arg.stdout | 60 +++ tests/ui/async-await/generator-desc.stderr | 14 +- .../in-trait/async-default-fn-overridden.rs | 66 +++ .../in-trait/async-default-fn-overridden.stderr | 11 + .../async-example-desugared-boxed-in-trait.stderr | 2 +- .../dont-project-to-specializable-projection.rs | 71 +++ ...dont-project-to-specializable-projection.stderr | 19 + tests/ui/async-await/in-trait/fn-not-async-err2.rs | 2 +- .../async-await/in-trait/fn-not-async-err2.stderr | 2 +- .../in-trait/return-type-suggestion.stderr | 2 +- tests/ui/async-await/issue-61076.rs | 5 +- tests/ui/async-await/issue-61076.stderr | 17 +- .../issue-64130-1-sync.drop_tracking.stderr | 25 + .../issue-64130-1-sync.drop_tracking_mir.stderr | 22 + .../issue-64130-1-sync.no_drop_tracking.stderr | 25 + tests/ui/async-await/issue-64130-1-sync.rs | 4 + tests/ui/async-await/issue-64130-1-sync.stderr | 6 +- .../issue-64130-2-send.drop_tracking.stderr | 28 + .../issue-64130-2-send.drop_tracking_mir.stderr | 26 + .../issue-64130-2-send.no_drop_tracking.stderr | 28 + tests/ui/async-await/issue-64130-2-send.rs | 5 +- tests/ui/async-await/issue-64130-2-send.stderr | 6 +- .../issue-64130-3-other.drop_tracking.stderr | 27 + .../issue-64130-3-other.drop_tracking_mir.stderr | 25 + .../issue-64130-3-other.no_drop_tracking.stderr | 27 + tests/ui/async-await/issue-64130-3-other.rs | 5 +- tests/ui/async-await/issue-64130-3-other.stderr | 6 +- .../issue-64130-4-async-move.drop-tracking.stderr | 6 +- ...ssue-64130-4-async-move.no_drop_tracking.stderr | 6 +- tests/ui/async-await/issue-64130-4-async-move.rs | 8 +- ...issue-67252-unnamed-future.drop_tracking.stderr | 30 ++ ...e-67252-unnamed-future.drop_tracking_mir.stderr | 22 + ...ue-67252-unnamed-future.no_drop_tracking.stderr | 30 ++ tests/ui/async-await/issue-67252-unnamed-future.rs | 6 +- .../async-await/issue-67252-unnamed-future.stderr | 28 - .../async-await/issue-68112.drop_tracking.stderr | 3 + .../issue-68112.drop_tracking_mir.stderr | 80 +++ .../issue-68112.no_drop_tracking.stderr | 3 + tests/ui/async-await/issue-68112.rs | 8 +- .../async-await/issue-70818.drop_tracking.stderr | 18 + .../issue-70818.drop_tracking_mir.stderr | 18 + .../issue-70818.no_drop_tracking.stderr | 18 + tests/ui/async-await/issue-70818.rs | 3 + tests/ui/async-await/issue-70818.stderr | 4 +- ...ue-70935-complex-spans.drop_tracking_mir.stderr | 34 ++ tests/ui/async-await/issue-70935-complex-spans.rs | 8 +- ...741-type-err-drop-tracking.drop_tracking.stderr | 11 + ...type-err-drop-tracking.drop_tracking_mir.stderr | 11 + ...-type-err-drop-tracking.no_drop_tracking.stderr | 11 + .../issue-73741-type-err-drop-tracking.rs | 5 +- .../issue-73741-type-err-drop-tracking.stderr | 2 +- .../issue-74072-lifetime-name-annotations.stderr | 16 +- .../issue-75785-confusing-named-region.stderr | 4 +- .../async-await/issue-86507.drop_tracking.stderr | 23 + .../issue-86507.drop_tracking_mir.stderr | 23 + .../issue-86507.no_drop_tracking.stderr | 23 + tests/ui/async-await/issue-86507.rs | 3 + tests/ui/async-await/issue-86507.stderr | 23 - tests/ui/async-await/issue-93648.rs | 4 +- tests/ui/async-await/issue-98634.rs | 6 +- tests/ui/async-await/issue-98634.stderr | 33 +- .../ui/async-await/issues/auxiliary/issue_67893.rs | 3 + tests/ui/async-await/issues/issue-102206.stderr | 9 +- tests/ui/async-await/issues/issue-107280.rs | 15 + tests/ui/async-await/issues/issue-107280.stderr | 82 +++ tests/ui/async-await/issues/issue-62097.rs | 2 +- tests/ui/async-await/issues/issue-62097.stderr | 6 +- tests/ui/async-await/issues/issue-65159.rs | 2 +- tests/ui/async-await/issues/issue-65159.stderr | 2 +- ...-65436-raw-ptr-not-send.no_drop_tracking.stderr | 10 +- .../issues/issue-65436-raw-ptr-not-send.rs | 7 +- .../issues/issue-67611-static-mut-refs.rs | 4 + tests/ui/async-await/issues/issue-67893.stderr | 2 +- tests/ui/async-await/issues/issue-72312.stderr | 6 +- .../member-constraints-min-choice-issue-63033.rs | 10 + .../multiple-lifetimes/ret-impl-trait-one.stderr | 5 +- .../async-await/multiple-lifetimes/ret-ref.stderr | 12 +- ...sive-async-impl-trait-type.drop_tracking.stderr | 21 + ...-async-impl-trait-type.drop_tracking_mir.stderr | 21 + ...e-async-impl-trait-type.no_drop_tracking.stderr | 21 + .../mutually-recursive-async-impl-trait-type.rs | 4 + ...mutually-recursive-async-impl-trait-type.stderr | 4 +- tests/ui/async-await/no-const-async.stderr | 4 +- tests/ui/async-await/non-trivial-drop.rs | 4 +- .../async-await/proper-span-for-type-error.stderr | 2 +- ...sive-async-impl-trait-type.drop_tracking.stderr | 12 + ...-async-impl-trait-type.drop_tracking_mir.stderr | 12 + ...e-async-impl-trait-type.no_drop_tracking.stderr | 12 + .../async-await/recursive-async-impl-trait-type.rs | 3 + .../recursive-async-impl-trait-type.stderr | 2 +- tests/ui/async-await/send-bound-async-closure.rs | 37 ++ .../suggest-missing-await-closure.stderr | 12 +- tests/ui/async-await/suggest-missing-await.stderr | 59 +-- .../unresolved_type_param.drop_tracking.stderr | 39 ++ .../unresolved_type_param.drop_tracking_mir.stderr | 14 + .../unresolved_type_param.no_drop_tracking.stderr | 63 +++ tests/ui/async-await/unresolved_type_param.rs | 38 +- tests/ui/async-await/unresolved_type_param.stderr | 12 +- .../ui/attributes/invalid_macro_export_argument.rs | 26 + .../invalid_macro_export_argument.stderr | 16 + tests/ui/attributes/key-value-expansion.stderr | 7 +- tests/ui/attributes/log-backtrace.rs | 4 +- tests/ui/attributes/rustc-box.rs | 18 + tests/ui/attributes/rustc-box.stderr | 34 ++ tests/ui/augmented-assignments.rs | 2 +- tests/ui/augmented-assignments.stderr | 2 + tests/ui/auto-traits/auto-trait-validation.stderr | 6 +- tests/ui/auto-traits/issue-23080-2.stderr | 2 +- tests/ui/auto-traits/issue-23080.stderr | 2 +- tests/ui/auto-traits/issue-84075.stderr | 2 +- .../auto-traits/str-contains-slice-conceptually.rs | 13 + .../str-contains-slice-conceptually.stderr | 16 + .../typeck-auto-trait-no-supertraits-2.stderr | 4 +- .../typeck-auto-trait-no-supertraits.stderr | 2 +- tests/ui/autoref-autoderef/issue-38940.stderr | 2 +- tests/ui/binding/issue-53114-safety-checks.rs | 4 - tests/ui/binding/issue-53114-safety-checks.stderr | 92 +--- tests/ui/binop/binary-op-on-double-ref.fixed | 2 +- tests/ui/binop/binary-op-on-double-ref.rs | 2 +- tests/ui/binop/binary-op-on-double-ref.stderr | 2 +- tests/ui/binop/binop-move-semantics.stderr | 5 + tests/ui/binop/issue-28837.rs | 2 +- tests/ui/binop/issue-28837.stderr | 2 +- tests/ui/blind/blind-item-block-middle.stderr | 2 +- .../consider-removing-last-semi.stderr | 4 +- tests/ui/block-result/issue-13428.stderr | 4 +- tests/ui/block-result/issue-13624.rs | 4 +- tests/ui/block-result/issue-13624.stderr | 4 +- tests/ui/block-result/issue-22645.stderr | 2 +- tests/ui/block-result/issue-5500.rs | 2 +- tests/ui/block-result/issue-5500.stderr | 2 +- ...-or-patterns-slice-patterns-box-patterns.stderr | 8 +- tests/ui/borrowck/borrow-tuple-fields.stderr | 4 + .../borrowck/borrowck-anon-fields-variant.stderr | 4 +- tests/ui/borrowck/borrowck-assign-comp.stderr | 12 +- ...orrowck-assign-to-andmut-in-borrowed-loc.stderr | 6 +- .../borrowck/borrowck-bad-nested-calls-move.stderr | 5 + ...wck-borrow-mut-base-ptr-in-aliasable-loc.stderr | 8 +- .../borrowck/borrowck-closures-mut-and-imm.stderr | 16 +- tests/ui/borrowck/borrowck-describe-lvalue.stderr | 42 +- .../ui/borrowck/borrowck-field-sensitivity.stderr | 4 + ...ck-imm-ref-to-mut-rec-field-issue-3162-c.stderr | 4 +- tests/ui/borrowck/borrowck-issue-14498.stderr | 32 +- tests/ui/borrowck/borrowck-lend-flow-match.stderr | 4 +- .../borrowck/borrowck-loan-blocks-move-cc.stderr | 4 + tests/ui/borrowck/borrowck-loan-blocks-move.stderr | 2 + ...borrowck-loan-of-static-data-issue-27616.stderr | 4 +- .../borrowck-loan-rcvr-overloaded-op.stderr | 2 +- ...owck-local-borrow-with-panic-outlives-fn.stderr | 2 + .../borrowck-match-already-borrowed.stderr | 8 +- tests/ui/borrowck/borrowck-move-by-capture.stderr | 2 +- ...rowck-move-from-subpath-of-borrowed-path.stderr | 2 + .../ui/borrowck/borrowck-move-mut-base-ptr.stderr | 2 + .../ui/borrowck/borrowck-move-subcomponent.stderr | 2 + .../ui/borrowck/borrowck-multiple-captures.stderr | 6 + ...ck-overloaded-index-and-overloaded-deref.stderr | 4 +- .../borrowck-overloaded-index-autoderef.stderr | 16 +- .../borrowck-overloaded-index-move-index.stderr | 4 + .../borrowck/borrowck-pat-reassign-binding.stderr | 4 +- tests/ui/borrowck/borrowck-unary-move.stderr | 2 + .../borrowck/borrowck-union-borrow-nested.stderr | 2 +- tests/ui/borrowck/borrowck-union-borrow.stderr | 20 +- tests/ui/borrowck/borrowck-use-mut-borrow.stderr | 18 +- .../borrowck/borrowck-vec-pattern-move-tail.stderr | 4 +- tests/ui/borrowck/borrowck-vec-pattern-nesting.rs | 8 +- .../borrowck/borrowck-vec-pattern-nesting.stderr | 8 +- tests/ui/borrowck/issue-103624.rs | 2 +- tests/ui/borrowck/issue-103624.stderr | 6 +- tests/ui/borrowck/issue-25793.stderr | 2 +- tests/ui/borrowck/issue-52713-bug.stderr | 4 +- .../issue-58776-borrowck-scans-children.stderr | 4 +- tests/ui/borrowck/issue-81365-1.stderr | 4 +- tests/ui/borrowck/issue-81365-10.stderr | 4 +- tests/ui/borrowck/issue-81365-11.stderr | 4 +- tests/ui/borrowck/issue-81365-2.stderr | 4 +- tests/ui/borrowck/issue-81365-3.stderr | 4 +- tests/ui/borrowck/issue-81365-4.stderr | 4 +- tests/ui/borrowck/issue-81365-5.stderr | 4 +- tests/ui/borrowck/issue-81365-6.stderr | 4 +- tests/ui/borrowck/issue-81365-7.stderr | 4 +- tests/ui/borrowck/issue-81365-8.stderr | 4 +- tests/ui/borrowck/issue-81365-9.stderr | 4 +- .../issue-82126-mismatched-subst-and-hir.rs | 4 +- .../issue-82126-mismatched-subst-and-hir.stderr | 4 +- tests/ui/borrowck/issue-83924.fixed | 20 + tests/ui/borrowck/issue-83924.rs | 20 + tests/ui/borrowck/issue-83924.stderr | 22 + tests/ui/borrowck/issue-85765.rs | 6 +- tests/ui/borrowck/issue-85765.stderr | 24 +- tests/ui/borrowck/issue-91206.rs | 2 +- tests/ui/borrowck/issue-91206.stderr | 8 +- tests/ui/borrowck/issue-92015.stderr | 7 +- ...ssue-95079-missing-move-in-nested-closure.fixed | 26 + .../issue-95079-missing-move-in-nested-closure.rs | 12 + ...sue-95079-missing-move-in-nested-closure.stderr | 31 +- ...low-access-during-reservation.nll_target.stderr | 4 +- .../borrowck/two-phase-surprise-no-conflict.stderr | 2 +- tests/ui/bounds-lifetime.stderr | 11 +- tests/ui/box/issue-82446.stderr | 2 +- tests/ui/box/leak-alloc.stderr | 2 + tests/ui/btreemap/btreemap_dropck.stderr | 2 + tests/ui/c-variadic/variadic-ffi-1.stderr | 2 + tests/ui/c-variadic/variadic-ffi-4.stderr | 4 +- tests/ui/check-cfg/invalid-cfg-value.stderr | 4 +- .../expect-infer-var-appearing-twice.stderr | 2 +- .../diagnostics/arrays.stderr | 14 +- .../2229_closure_analysis/diagnostics/box.stderr | 8 +- .../diagnostics/repr_packed.rs | 1 - .../diagnostics/repr_packed.stderr | 20 +- .../2229_closure_analysis/diagnostics/union.rs | 4 +- .../2229_closure_analysis/diagnostics/union.stderr | 4 +- .../closures/2229_closure_analysis/issue_88118.rs | 5 +- .../migrations/auto_traits.fixed | 4 +- .../migrations/auto_traits.rs | 4 +- .../migrations/auto_traits.stderr | 4 +- .../migrations/multi_diagnostics.fixed | 2 +- .../migrations/multi_diagnostics.rs | 2 +- .../migrations/multi_diagnostics.stderr | 2 +- tests/ui/closures/binder/const-bound.rs | 7 + tests/ui/closures/binder/const-bound.stderr | 17 + tests/ui/closures/binder/disallow-const.stderr | 6 +- tests/ui/closures/binder/disallow-ty.stderr | 6 +- tests/ui/closures/binder/type-bound-2.rs | 7 + tests/ui/closures/binder/type-bound-2.stderr | 17 + tests/ui/closures/binder/type-bound.rs | 7 + tests/ui/closures/binder/type-bound.stderr | 17 + tests/ui/closures/issue-78720.stderr | 2 +- tests/ui/coercion/coerce-block-tail-26978.stderr | 2 +- tests/ui/coercion/coerce-block-tail-57749.stderr | 2 +- tests/ui/coercion/coerce-block-tail-83783.stderr | 2 +- tests/ui/coercion/coerce-block-tail-83850.stderr | 2 +- tests/ui/coercion/coerce-block-tail.stderr | 2 +- .../coercion/coerce-expect-unsized-ascribed.stderr | 28 +- .../coerce-overloaded-autoderef-fail.stderr | 4 +- tests/ui/coercion/coerce-to-bang.stderr | 2 +- .../coercion-missing-tail-expected-type.stderr | 2 +- tests/ui/coercion/coercion-slice.rs | 2 +- tests/ui/coercion/coercion-slice.stderr | 2 +- ...herence-impl-trait-for-marker-trait-negative.rs | 23 +- ...nce-impl-trait-for-marker-trait-negative.stderr | 42 +- ...herence-impl-trait-for-marker-trait-positive.rs | 23 +- ...nce-impl-trait-for-marker-trait-positive.stderr | 42 +- tests/ui/coherence/issue-85026.stderr | 8 +- tests/ui/coinduction/canonicalization-rerun.rs | 54 ++ tests/ui/command/command-setgroups.rs | 1 + tests/ui/compare-method/bad-self-type.stderr | 6 +- .../cfg-generic-params.stderr | 46 +- .../ui/confuse-field-and-method/issue-33784.stderr | 4 +- tests/ui/const-generics/bad-const-generic-exprs.rs | 34 +- .../const-generics/bad-const-generic-exprs.stderr | 106 +++- .../const-argument-non-static-lifetime.min.stderr | 2 +- .../const-argument-non-static-lifetime.rs | 1 - .../const-param-elided-lifetime.min.stderr | 10 +- .../const-generics/const-param-elided-lifetime.rs | 10 +- ...nst-param-type-depends-on-type-param-ungated.rs | 3 - ...param-type-depends-on-type-param-ungated.stderr | 2 +- tests/ui/const-generics/defaults/mismatch.stderr | 10 +- tests/ui/const-generics/defaults/wfness.stderr | 2 +- .../early/invalid-const-arguments.stderr | 9 +- .../ui/const-generics/ensure_is_evaluatable.stderr | 2 +- .../const-generics/fn_with_two_const_inputs.stderr | 2 +- .../const_kind_expr/relate_binop_arg_tys.rs | 18 + .../const_kind_expr/relate_binop_arg_tys.stderr | 20 + .../const_kind_expr/relate_cast_arg_ty.rs | 12 + .../const_kind_expr/relate_cast_arg_ty.stderr | 20 + .../const_kind_expr/relate_ty_with_infer_1.rs | 30 ++ .../const_kind_expr/relate_ty_with_infer_2.rs | 151 ++++++ .../generic_const_exprs/issue-102768.rs | 4 +- .../generic_const_exprs/issue-102768.stderr | 4 +- .../generic_const_exprs/issue-105608.stderr | 2 +- .../issue-72819-generic-in-const-eval.full.stderr | 4 +- .../generic_const_exprs/issue-76595.stderr | 2 +- ...79518-default_trait_method_normalization.stderr | 2 +- .../generic_const_exprs/obligation-cause.stderr | 2 +- .../single-satisfied-ConstEvaluatable-in-probe.rs | 39 ++ .../incorrect-number-of-const-args.stderr | 4 +- tests/ui/const-generics/infer/method-chain.stderr | 2 +- .../const-generics/infer/uninferred-consts.stderr | 2 +- .../invalid-const-arg-for-type-param.rs | 4 +- .../invalid-const-arg-for-type-param.stderr | 4 +- .../ui/const-generics/invalid-constant-in-args.rs | 2 +- .../const-generics/invalid-constant-in-args.stderr | 2 +- tests/ui/const-generics/issues/issue-105821.rs | 23 + .../const-generics/issues/issue-56445-1.min.stderr | 2 +- tests/ui/const-generics/issues/issue-56445-1.rs | 2 +- .../ui/const-generics/issues/issue-67185-2.stderr | 8 +- .../issues/issue-67945-1.full.stderr | 2 +- tests/ui/const-generics/issues/issue-73260.rs | 1 - tests/ui/const-generics/issues/issue-73260.stderr | 12 +- tests/ui/const-generics/issues/issue-79674.stderr | 2 +- tests/ui/const-generics/issues/issue-86530.stderr | 2 +- tests/ui/const-generics/issues/issue-87493.rs | 2 +- tests/ui/const-generics/issues/issue-87493.stderr | 2 +- .../min_const_generics/macro-fail.stderr | 23 +- tests/ui/const-generics/nested-type.min.stderr | 11 +- tests/ui/const-generics/nested-type.rs | 2 +- .../occurs-check/unused-substs-1.stderr | 2 +- .../parser-error-recovery/issue-89013-no-kw.rs | 2 +- .../parser-error-recovery/issue-89013-no-kw.stderr | 2 +- .../parser-error-recovery/issue-89013.rs | 2 +- .../parser-error-recovery/issue-89013.stderr | 2 +- tests/ui/const-generics/type_mismatch.stderr | 2 +- tests/ui/const-generics/type_not_in_scope.stderr | 2 +- .../types-mismatch-const-args.full.stderr | 4 +- .../types-mismatch-const-args.min.stderr | 4 +- .../const-generics/unify_with_nested_expr.stderr | 2 +- tests/ui/const-generics/wrong-normalization.rs | 19 + tests/ui/const-generics/wrong-normalization.stderr | 11 + tests/ui/constructor-lifetime-args.rs | 8 +- tests/ui/constructor-lifetime-args.stderr | 8 +- tests/ui/consts/array-literal-len-mismatch.rs | 4 + tests/ui/consts/array-literal-len-mismatch.stderr | 11 + tests/ui/consts/const-array-oob-arith.stderr | 8 +- tests/ui/consts/const-err-late.stderr | 12 - .../ui/consts/const-eval/const-eval-query-stack.rs | 3 +- .../const-eval/const-eval-query-stack.stderr | 2 +- tests/ui/consts/const-eval/const-eval-span.rs | 2 +- tests/ui/consts/const-eval/const-eval-span.stderr | 2 +- tests/ui/consts/const-eval/infinite_loop.stderr | 9 +- tests/ui/consts/const-eval/issue-52475.rs | 4 +- tests/ui/consts/const-eval/issue-52475.stderr | 9 +- .../consts/const-eval/issue-91827-extern-types.rs | 5 +- tests/ui/consts/const-eval/raw-bytes.32bit.stderr | 4 +- tests/ui/consts/const-eval/raw-bytes.64bit.stderr | 4 +- .../const-eval/stable-metric/ctfe-fn-call.rs | 36 ++ .../const-eval/stable-metric/ctfe-fn-call.stderr | 20 + .../const-eval/stable-metric/ctfe-labelled-loop.rs | 19 + .../stable-metric/ctfe-labelled-loop.stderr | 30 ++ .../const-eval/stable-metric/ctfe-recursion.rs | 16 + .../const-eval/stable-metric/ctfe-recursion.stderr | 25 + .../const-eval/stable-metric/ctfe-simple-loop.rs | 15 + .../stable-metric/ctfe-simple-loop.stderr | 24 + .../stable-metric/dominators-edge-case.rs | 19 + tests/ui/consts/const-eval/ub-ref-ptr.stderr | 4 +- .../validate_uninhabited_zsts.32bit.stderr | 10 +- .../validate_uninhabited_zsts.64bit.stderr | 10 +- tests/ui/consts/const-tup-index-span.rs | 2 +- tests/ui/consts/const-tup-index-span.stderr | 2 +- .../const_limit/const_eval_limit_reached.stderr | 9 +- .../consts/ct-var-in-collect_all_mismatches.stderr | 2 +- tests/ui/consts/gate-do-not-const-check.rs | 5 + tests/ui/consts/gate-do-not-const-check.stderr | 11 + tests/ui/consts/issue-33903.rs | 10 + tests/ui/consts/issue-54582.rs | 16 + tests/ui/consts/nested_erroneous_ctfe.stderr | 2 +- tests/ui/consts/promote_const_let.stderr | 1 + tests/ui/cross/cross-borrow-trait.stderr | 2 +- tests/ui/deprecation/deprecation-lint.rs | 96 ++-- tests/ui/deprecation/deprecation-lint.stderr | 140 ++--- ...ssue-84637-deprecated-associated-function.fixed | 4 +- .../issue-84637-deprecated-associated-function.rs | 4 +- ...sue-84637-deprecated-associated-function.stderr | 8 +- tests/ui/deprecation/suggestion.stderr | 4 +- tests/ui/deref-patterns/gate.stderr | 2 +- tests/ui/derives/deriving-copyclone.stderr | 24 +- tests/ui/derives/deriving-with-repr-packed-2.rs | 20 + .../ui/derives/deriving-with-repr-packed-2.stderr | 33 ++ tests/ui/derives/deriving-with-repr-packed.rs | 53 +- tests/ui/derives/deriving-with-repr-packed.stderr | 138 ++--- tests/ui/deriving/deriving-all-codegen.rs | 85 ++- tests/ui/deriving/deriving-all-codegen.stderr | 63 +++ tests/ui/deriving/deriving-all-codegen.stdout | 570 +++++++++++++++++---- tests/ui/destructure-trait-ref.stderr | 6 +- .../default-match-bindings-forbidden.stderr | 2 +- tests/ui/diagnostic-flags/terminal_urls.rs | 4 + tests/ui/diagnostic-flags/terminal_urls.stderr | 11 + tests/ui/diagnostic-width/long-E0308.stderr | 8 +- .../brackets-to-braces-single-element.stderr | 6 +- .../did_you_mean/compatible-variants-in-pat.stderr | 6 +- tests/ui/did_you_mean/compatible-variants.stderr | 26 +- tests/ui/did_you_mean/issue-42764.stderr | 4 +- .../issue-46718-struct-pattern-dotdotdot.stderr | 7 +- tests/ui/did_you_mean/println-typo.rs | 6 + tests/ui/did_you_mean/println-typo.stderr | 11 + tests/ui/did_you_mean/recursion_limit_deref.stderr | 2 +- tests/ui/disambiguate-identical-names.stderr | 2 +- tests/ui/diverging-fn-tail-35849.stderr | 2 +- tests/ui/drop/issue-2735-2.rs | 27 + tests/ui/drop/issue-2735-3.rs | 27 + tests/ui/drop/issue-2735.rs | 22 + tests/ui/dropck/drop-with-active-borrows-1.stderr | 2 + .../ui/dropck/dropck-eyepatch-extern-crate.stderr | 6 + tests/ui/dropck/dropck-eyepatch-reorder.stderr | 6 + tests/ui/dropck/dropck-eyepatch.stderr | 6 + tests/ui/dropck/dropck-union.stderr | 2 + tests/ui/dropck/dropck_trait_cycle_checked.stderr | 12 +- tests/ui/dst/dst-bad-assign-3.rs | 2 +- tests/ui/dst/dst-bad-assign-3.stderr | 2 +- tests/ui/dst/dst-bad-assign.rs | 2 +- tests/ui/dst/dst-bad-assign.stderr | 2 +- tests/ui/dst/dst-bad-coerce1.stderr | 4 +- tests/ui/dst/dst-bad-coerce3.stderr | 10 +- tests/ui/dst/dst-bad-coerce4.rs | 4 +- tests/ui/dst/dst-bad-coerce4.stderr | 4 +- tests/ui/dyn-star/align.over_aligned.stderr | 6 +- tests/ui/dyn-star/align.rs | 2 +- .../dyn-star/check-size-at-cast-polymorphic-bad.rs | 2 +- .../check-size-at-cast-polymorphic-bad.stderr | 10 +- tests/ui/dyn-star/check-size-at-cast.rs | 2 +- tests/ui/dyn-star/check-size-at-cast.stderr | 6 +- tests/ui/dyn-star/dyn-star-to-dyn.rs | 14 +- tests/ui/dyn-star/llvm-old-style-ptrs.rs | 23 + tests/ui/dyn-star/no-implicit-dyn-star.stderr | 2 +- tests/ui/dyn-star/upcast.stderr | 6 +- tests/ui/empty/empty-struct-braces-expr.stderr | 4 +- tests/ui/empty/issue-37026.stderr | 4 +- tests/ui/error-codes/E0057.stderr | 9 +- tests/ui/error-codes/E0071.rs | 2 +- tests/ui/error-codes/E0071.stderr | 2 +- tests/ui/error-codes/E0107.rs | 20 +- tests/ui/error-codes/E0107.stderr | 20 +- tests/ui/error-codes/E0116.stderr | 2 +- tests/ui/error-codes/E0118.stderr | 4 +- tests/ui/error-codes/E0208.rs | 2 +- tests/ui/error-codes/E0208.stderr | 2 +- tests/ui/error-codes/E0390.stderr | 8 +- tests/ui/error-codes/E0476.rs | 13 + tests/ui/error-codes/E0476.stderr | 31 ++ tests/ui/error-codes/E0503.stderr | 2 +- tests/ui/error-codes/E0504.stderr | 2 + tests/ui/error-codes/E0505.stderr | 3 + tests/ui/error-codes/E0506.stderr | 4 +- tests/ui/error-codes/E0520.stderr | 2 +- tests/ui/error-codes/E0523.rs | 14 + tests/ui/error-codes/E0523.stderr | 13 + tests/ui/error-codes/E0597.stderr | 2 + tests/ui/error-codes/E0624.rs | 2 +- tests/ui/error-codes/E0624.stderr | 6 +- tests/ui/error-codes/E0789.rs | 12 + tests/ui/error-codes/E0789.stderr | 15 + .../trait-bound-error-spans/blame-trait-error.rs | 102 ++++ .../blame-trait-error.stderr | 402 +++++++++++++++ .../traits/blame-trait-error-spans-on-exprs.rs | 137 +++++ .../traits/blame-trait-error-spans-on-exprs.stderr | 412 +++++++++++++++ tests/ui/explore-issue-38412.stderr | 36 +- .../missing_braces_around_block.fixed | 9 +- .../missing_braces_around_block.rs | 9 +- .../missing_braces_around_block.stderr | 33 +- tests/ui/extenv/extenv-not-defined-default.rs | 4 +- tests/ui/extenv/extenv-not-defined-default.stderr | 7 +- tests/ui/extenv/issue-55897.stderr | 3 +- tests/ui/extern/extern-types-distinct-types.stderr | 2 +- .../feature-gate-associated_type_bounds.rs | 3 - .../feature-gate-associated_type_bounds.stderr | 40 +- .../feature-gate-dispatch-from-dyn-cell.rs | 9 + .../feature-gate-dispatch-from-dyn-cell.stderr | 12 + .../feature-gate-dispatch-from-dyn-missing-impl.rs | 35 ++ ...ture-gate-dispatch-from-dyn-missing-impl.stderr | 45 ++ ...ature-gate-impl_trait_in_fn_trait_return.stderr | 4 +- .../feature-gate-multiple_supertrait_upcastable.rs | 12 + ...ture-gate-multiple_supertrait_upcastable.stderr | 57 +++ .../feature-gate-non_lifetime_binders.rs | 4 + .../feature-gate-non_lifetime_binders.stderr | 12 + ...gate-return_position_impl_trait_in_trait.stderr | 6 +- .../feature-gate-trivial_bounds.stderr | 2 +- tests/ui/ffi_const.rs | 10 + tests/ui/ffi_const.stderr | 14 +- tests/ui/ffi_pure.rs | 10 + tests/ui/ffi_pure.stderr | 14 +- tests/ui/ffi_returns_twice.rs | 10 + tests/ui/ffi_returns_twice.stderr | 14 +- tests/ui/fmt/format-string-wrong-order.rs | 15 + tests/ui/fmt/format-string-wrong-order.stderr | 54 ++ tests/ui/fmt/ifmt-bad-arg.stderr | 4 +- tests/ui/fmt/ifmt-unimpl.stderr | 2 +- tests/ui/fmt/issue-75307.rs | 3 + tests/ui/fmt/issue-75307.stderr | 8 + tests/ui/fmt/respanned-literal-issue-106191.rs | 2 +- tests/ui/fmt/send-sync.stderr | 4 +- tests/ui/fn/fn-compare-mismatch.stderr | 2 + tests/ui/fn/fn-item-type.rs | 38 +- tests/ui/fn/fn-item-type.stderr | 53 +- tests/ui/fn/fn-pointer-mismatch.rs | 56 ++ tests/ui/fn/fn-pointer-mismatch.stderr | 91 ++++ tests/ui/fn/fn-trait-formatting.stderr | 6 +- .../implied-bounds-unnorm-associated-type-4.stderr | 2 + .../implied-bounds-unnorm-associated-type.stderr | 2 + tests/ui/fn/issue-3044.stderr | 2 +- .../fn/signature-error-reporting-under-verbose.rs | 3 +- .../signature-error-reporting-under-verbose.stderr | 3 +- tests/ui/for/for-else-err.rs | 8 + tests/ui/for/for-else-err.stderr | 17 + tests/ui/for/for-else-let-else-err.rs | 8 + tests/ui/for/for-else-let-else-err.stderr | 17 + .../fully-qualified-type-name1.rs | 2 +- .../fully-qualified-type-name1.stderr | 2 +- .../fully-qualified-type-name2.rs | 2 +- .../fully-qualified-type-name2.stderr | 8 +- .../fully-qualified-type-name4.rs | 2 +- .../fully-qualified-type-name4.stderr | 2 +- tests/ui/function-pointer/unsized-ret.stderr | 2 +- .../ui/functions-closures/fn-help-with-err.stderr | 2 +- tests/ui/generator/addassign-yield.rs | 3 + .../auto-trait-regions.drop_tracking.stderr | 47 ++ .../auto-trait-regions.drop_tracking_mir.stderr | 47 ++ .../auto-trait-regions.no_drop_tracking.stderr | 47 ++ tests/ui/generator/auto-trait-regions.rs | 3 + tests/ui/generator/auto-trait-regions.stderr | 8 +- tests/ui/generator/borrowing.drop_tracking.stderr | 31 ++ .../generator/borrowing.drop_tracking_mir.stderr | 39 ++ .../ui/generator/borrowing.no_drop_tracking.stderr | 31 ++ tests/ui/generator/borrowing.rs | 4 + tests/ui/generator/borrowing.stderr | 4 +- ...tracking-parent-expression.drop_tracking.stderr | 128 +++++ ...king-parent-expression.drop_tracking_mir.stderr | 122 +++++ ...cking-parent-expression.no_drop_tracking.stderr | 334 ++++++++++++ .../generator/drop-tracking-parent-expression.rs | 12 +- .../drop-tracking-parent-expression.stderr | 128 ----- .../drop-tracking-yielding-in-match-guards.rs | 4 +- tests/ui/generator/dropck.stderr | 3 + .../generator-yielding-or-returning-itself.stderr | 4 +- tests/ui/generator/issue-102645.stderr | 2 +- .../issue-105084.drop_tracking_mir.stderr | 51 ++ tests/ui/generator/issue-105084.rs | 49 ++ .../generator/issue-57017.no_drop_tracking.stderr | 248 +++++++++ tests/ui/generator/issue-57017.rs | 14 +- .../generator/issue-57478.no_drop_tracking.stderr | 31 ++ tests/ui/generator/issue-57478.rs | 8 +- .../ui/generator/issue-68112.drop_tracking.stderr | 66 +++ .../generator/issue-68112.drop_tracking_mir.stderr | 61 +++ .../generator/issue-68112.no_drop_tracking.stderr | 66 +++ tests/ui/generator/issue-68112.rs | 11 +- tests/ui/generator/issue-68112.stderr | 64 --- tests/ui/generator/issue-93161.rs | 4 +- .../generator/not-send-sync.drop_tracking.stderr | 60 +++ .../not-send-sync.drop_tracking_mir.stderr | 42 ++ .../not-send-sync.no_drop_tracking.stderr | 60 +++ tests/ui/generator/not-send-sync.rs | 19 +- tests/ui/generator/not-send-sync.stderr | 56 -- .../parent-expression.drop_tracking.stderr | 128 +++++ .../parent-expression.drop_tracking_mir.stderr | 122 +++++ .../parent-expression.no_drop_tracking.stderr | 334 ++++++++++++ tests/ui/generator/parent-expression.rs | 77 +++ .../ui/generator/partial-drop.drop_tracking.stderr | 61 +++ .../generator/partial-drop.no_drop_tracking.stderr | 61 +++ tests/ui/generator/partial-drop.rs | 21 +- tests/ui/generator/partial-drop.stderr | 92 ---- .../generator-print-verbose-1.drop_tracking.stderr | 64 +++ ...erator-print-verbose-1.drop_tracking_mir.stderr | 60 +++ ...nerator-print-verbose-1.no_drop_tracking.stderr | 64 +++ .../generator/print/generator-print-verbose-1.rs | 5 +- .../print/generator-print-verbose-1.stderr | 62 --- .../generator-print-verbose-2.drop_tracking.stderr | 60 +++ ...erator-print-verbose-2.drop_tracking_mir.stderr | 42 ++ ...nerator-print-verbose-2.no_drop_tracking.stderr | 60 +++ .../generator/print/generator-print-verbose-2.rs | 19 +- .../print/generator-print-verbose-2.stderr | 56 -- .../retain-resume-ref.drop_tracking.stderr | 13 + .../retain-resume-ref.drop_tracking_mir.stderr | 14 + .../retain-resume-ref.no_drop_tracking.stderr | 13 + tests/ui/generator/retain-resume-ref.rs | 4 + tests/ui/generator/retain-resume-ref.stderr | 2 +- .../generator/static-mut-reference-across-yield.rs | 4 +- .../type-mismatch-signature-deduction.stderr | 4 +- .../bugs/issue-88460.stderr | 2 +- .../collections-project-default.stderr | 3 +- .../constraint-assoc-type-suggestion.stderr | 2 +- .../gat-trait-path-parenthesised-args.rs | 6 +- .../gat-trait-path-parenthesised-args.stderr | 6 +- .../generic-associated-types/issue-101020.stderr | 2 +- .../issue-68656-unsized-values.stderr | 4 +- .../generic-associated-types/issue-74684-1.stderr | 1 + .../issue-79422.extended.stderr | 4 +- .../ui/generic-associated-types/issue-88360.fixed | 20 + tests/ui/generic-associated-types/issue-88360.rs | 2 + .../ui/generic-associated-types/issue-88360.stderr | 12 +- .../method-unsatified-assoc-type-predicate.rs | 33 -- .../method-unsatified-assoc-type-predicate.stderr | 24 - .../method-unsatisfied-assoc-type-predicate.rs | 33 ++ .../method-unsatisfied-assoc-type-predicate.stderr | 24 + .../generic-associated-types/missing-bounds.fixed | 6 +- .../generic-associated-types/missing-bounds.stderr | 12 +- .../missing_lifetime_args.rs | 4 +- .../missing_lifetime_args.stderr | 4 +- .../missing_lifetime_const.rs | 2 +- .../missing_lifetime_const.stderr | 2 +- .../parameter_number_and_kind.rs | 6 +- .../parameter_number_and_kind.stderr | 6 +- .../trait-path-type-error-once-implemented.rs | 4 +- .../trait-path-type-error-once-implemented.stderr | 4 +- .../unsatified-item-lifetime-bound.rs | 25 - .../unsatified-item-lifetime-bound.stderr | 50 -- .../unsatisfied-item-lifetime-bound.rs | 27 + .../unsatisfied-item-lifetime-bound.stderr | 55 ++ tests/ui/generics/bad-mid-path-type-params.rs | 10 +- tests/ui/generics/bad-mid-path-type-params.stderr | 10 +- tests/ui/generics/generic-arg-mismatch-recover.rs | 6 +- .../generics/generic-arg-mismatch-recover.stderr | 6 +- .../generic-impl-less-params-with-defaults.rs | 2 +- .../generic-impl-less-params-with-defaults.stderr | 2 +- .../generic-impl-more-params-with-defaults.rs | 2 +- .../generic-impl-more-params-with-defaults.stderr | 2 +- .../generic-type-more-params-with-defaults.rs | 2 +- .../generic-type-more-params-with-defaults.stderr | 2 +- tests/ui/generics/generic-type-params-name-repr.rs | 12 +- .../generics/generic-type-params-name-repr.stderr | 12 +- ...5285-incorrect-explicit-lifetime-name-needed.rs | 1 - ...-incorrect-explicit-lifetime-name-needed.stderr | 18 +- tests/ui/generics/wrong-number-of-args.rs | 106 ++-- tests/ui/generics/wrong-number-of-args.stderr | 106 ++-- ...exclusive_range_pattern_syntax_collision.stderr | 2 +- ...xclusive_range_pattern_syntax_collision2.stderr | 2 +- ...xclusive_range_pattern_syntax_collision3.stderr | 6 +- .../half-open-range-pats-inclusive-match-arrow.rs | 9 + ...lf-open-range-pats-inclusive-match-arrow.stderr | 15 + .../ui/half-open-range-patterns/pat-tuple-5.stderr | 2 +- .../hang-on-deeply-nested-dyn.stderr | 4 +- ...rtb-higher-ranker-supertraits-transitive.stderr | 2 +- .../hrtb-higher-ranker-supertraits.stderr | 4 +- .../hrtb-identity-fn-borrows.stderr | 4 +- .../hrtb-wrong-kind.stderr | 11 +- tests/ui/higher-rank-trait-bounds/issue-30786.rs | 2 + .../ui/higher-rank-trait-bounds/issue-30786.stderr | 27 +- tests/ui/higher-rank-trait-bounds/issue-39292.rs | 17 + .../issue-62203-hrtb-ice.stderr | 10 +- .../normalize-under-binder/issue-89118.stderr | 6 +- .../normalize-under-binder/issue-90950.stderr | 2 +- .../norm-before-method-resolution.stderr | 2 +- tests/ui/hygiene/panic-location.run.stderr | 2 +- .../path-elided.stderr | 1 - .../trait-elided.stderr | 1 - tests/ui/impl-trait/auto-trait-leak.stderr | 4 +- tests/ui/impl-trait/bound-normalization-pass.rs | 2 - .../dyn-trait-return-should-be-impl-trait.stderr | 26 +- tests/ui/impl-trait/equal-hidden-lifetimes.rs | 1 - tests/ui/impl-trait/equal-hidden-lifetimes.stderr | 10 - tests/ui/impl-trait/equality2.stderr | 2 + .../explicit-generic-args-for-impl.stderr | 2 +- .../not-enough-args.stderr | 2 +- .../ui/impl-trait/feature-self-return-type.stderr | 3 + tests/ui/impl-trait/hidden-lifetimes.stderr | 8 +- tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr | 2 + tests/ui/impl-trait/in-trait/deep-match.stderr | 2 +- .../in-trait/default-body-type-err-2.stderr | 2 +- .../in-trait/default-body-type-err.stderr | 2 +- .../in-trait/default-method-constraint.rs | 17 + .../in-trait/default-method-constraint.stderr | 11 + .../in-trait/method-signature-matches.stderr | 10 - .../in-trait/new-lowering-strategy/simple-trait.rs | 11 + .../impl-trait/in-trait/signature-mismatch.stderr | 4 +- .../impl-trait/in-trait/specialization-broken.rs | 1 + .../in-trait/specialization-broken.stderr | 10 +- tests/ui/impl-trait/issue-102605.stderr | 12 +- .../impl-trait/issue-55872-2.drop_tracking.stderr | 8 + .../issue-55872-2.drop_tracking_mir.stderr | 14 + .../issue-55872-2.no_drop_tracking.stderr | 8 + tests/ui/impl-trait/issue-55872-2.rs | 4 + tests/ui/impl-trait/issue-55872-2.stderr | 2 +- tests/ui/impl-trait/issue-99914.stderr | 9 +- .../issues/infinite-impl-trait-issue-38064.stderr | 4 +- tests/ui/impl-trait/issues/issue-54600.stderr | 2 +- tests/ui/impl-trait/issues/issue-54840.stderr | 2 +- tests/ui/impl-trait/issues/issue-58504.stderr | 2 +- tests/ui/impl-trait/issues/issue-58956.stderr | 4 +- tests/ui/impl-trait/issues/issue-70971.stderr | 2 +- tests/ui/impl-trait/issues/issue-74282.stderr | 4 +- tests/ui/impl-trait/issues/issue-79099.stderr | 2 +- ...ssue-83929-impl-trait-in-generic-default.stderr | 4 +- tests/ui/impl-trait/issues/issue-84919.stderr | 2 +- tests/ui/impl-trait/issues/issue-86642.stderr | 2 +- tests/ui/impl-trait/issues/issue-86800.stderr | 4 +- tests/ui/impl-trait/issues/issue-87295.stderr | 2 +- .../multiple-lifetimes/error-handling-2.stderr | 3 + .../ordinary-bounds-unrelated.stderr | 4 +- .../ordinary-bounds-unsuited.stderr | 4 +- .../must_outlive_least_region_or_bound.stderr | 14 +- tests/ui/impl-trait/nested-return-type2.rs | 3 + tests/ui/impl-trait/nested-return-type2.stderr | 2 +- tests/ui/impl-trait/nested-return-type4.stderr | 4 +- tests/ui/impl-trait/nested_impl_trait.stderr | 2 +- .../impl-trait/no-method-suggested-traits.stderr | 16 +- tests/ui/impl-trait/normalize-tait-in-const.rs | 1 + tests/ui/impl-trait/normalize-tait-in-const.stderr | 2 +- ...safe-trait-in-return-position-impl-trait.stderr | 4 +- ...e-impl-trait-type-indirect.drop_tracking.stderr | 152 ++++++ ...pl-trait-type-indirect.drop_tracking_mir.stderr | 144 ++++++ ...mpl-trait-type-indirect.no_drop_tracking.stderr | 152 ++++++ .../recursive-impl-trait-type-indirect.rs | 4 + .../recursive-impl-trait-type-indirect.stderr | 152 ------ ...-alias-impl-trait-declaration-too-subtle.stderr | 4 +- tests/ui/impl-trait/region-escape-via-bound.stderr | 4 +- .../static-return-lifetime-infered.stderr | 8 +- .../ui/impl-trait/universal-mismatched-type.stderr | 2 +- tests/ui/impl-trait/where-allowed.stderr | 82 +-- .../assoc-ty-wf-used-to-get-assoc-ty.stderr | 2 + tests/ui/implied-bounds/issue-100690.stderr | 2 +- tests/ui/imports/import-prefix-macro-1.stderr | 2 +- tests/ui/include-macros/mismatched-types.stderr | 4 +- .../needs-has-incoherent-impls.stderr | 78 +-- .../no-attr-empty-impl.stderr | 12 +- tests/ui/inference/array-len-mismatch.rs | 12 + tests/ui/inference/array-len-mismatch.stderr | 21 + tests/ui/inference/deref-suggestion.stderr | 6 +- tests/ui/inference/inference_unstable.rs | 8 +- tests/ui/inference/inference_unstable.stderr | 8 +- .../inference/inference_unstable_featured.stderr | 4 +- tests/ui/inference/issue-107090.rs | 25 + tests/ui/inference/issue-107090.stderr | 84 +++ tests/ui/inference/issue-71732.stderr | 2 +- ...issue-107745-avoid-expr-from-macro-expansion.rs | 19 + ...e-107745-avoid-expr-from-macro-expansion.stderr | 11 + tests/ui/inference/question-mark-type-infer.stderr | 2 +- tests/ui/infinite/auxiliary/alias.rs | 2 + tests/ui/infinite/infinite-alias.rs | 9 + tests/ui/infinite/infinite-alias.stderr | 14 + .../ui/inline-const/const-expr-lifetime-err.stderr | 1 + tests/ui/instrument-xray/flags-always-never-1.rs | 7 + .../ui/instrument-xray/flags-always-never-1.stderr | 2 + tests/ui/instrument-xray/flags-always-never-2.rs | 9 + tests/ui/instrument-xray/flags-basic.rs | 9 + tests/ui/instrument-xray/flags-dupe-always.rs | 7 + tests/ui/instrument-xray/flags-dupe-always.stderr | 2 + .../ui/instrument-xray/flags-dupe-ignore-loops.rs | 7 + .../instrument-xray/flags-dupe-ignore-loops.stderr | 2 + tests/ui/instrument-xray/target-not-supported.rs | 9 + .../ui/instrument-xray/target-not-supported.stderr | 4 + tests/ui/intrinsics/const-eval-select-bad.rs | 2 +- tests/ui/intrinsics/const-eval-select-bad.stderr | 2 +- tests/ui/intrinsics/intrinsic-alignment.rs | 4 +- tests/ui/io-checks/inaccessbile-temp-dir.rs | 39 ++ tests/ui/io-checks/inaccessbile-temp-dir.stderr | 4 + .../io-checks/non-ice-error-on-worker-io-fail.rs | 40 ++ .../non-ice-error-on-worker-io-fail.stderr | 6 + tests/ui/issues/issue-100605.stderr | 4 +- tests/ui/issues/issue-102964.stderr | 2 +- tests/ui/issues/issue-10412.stderr | 1 - tests/ui/issues/issue-106755.rs | 19 + tests/ui/issues/issue-106755.stderr | 22 + tests/ui/issues/issue-10764.stderr | 1 + tests/ui/issues/issue-11374.stderr | 4 +- tests/ui/issues/issue-11844.stderr | 2 +- tests/ui/issues/issue-13446.stderr | 2 +- tests/ui/issues/issue-13466.rs | 4 +- tests/ui/issues/issue-13466.stderr | 4 +- tests/ui/issues/issue-14541.rs | 2 +- tests/ui/issues/issue-14541.stderr | 2 +- tests/ui/issues/issue-15783.rs | 2 +- tests/ui/issues/issue-15783.stderr | 2 +- tests/ui/issues/issue-15896.stderr | 2 +- tests/ui/issues/issue-16338.stderr | 2 +- tests/ui/issues/issue-16401.rs | 2 +- tests/ui/issues/issue-16401.stderr | 2 +- tests/ui/issues/issue-16939.stderr | 9 +- tests/ui/issues/issue-16966.stderr | 6 +- tests/ui/issues/issue-17337.stderr | 2 +- tests/ui/issues/issue-18423.rs | 2 +- tests/ui/issues/issue-18423.stderr | 2 +- tests/ui/issues/issue-18446.stderr | 2 +- tests/ui/issues/issue-18819.stderr | 2 +- tests/ui/issues/issue-19521.stderr | 2 +- tests/ui/issues/issue-20225.stderr | 6 +- tests/ui/issues/issue-21202.rs | 2 +- tests/ui/issues/issue-21202.stderr | 6 +- tests/ui/issues/issue-21332.rs | 2 +- tests/ui/issues/issue-21332.stderr | 2 +- tests/ui/issues/issue-22536-copy-mustnt-zero.rs | 28 - tests/ui/issues/issue-23041.stderr | 2 +- tests/ui/issues/issue-24322.stderr | 2 +- tests/ui/issues/issue-24819.rs | 2 +- tests/ui/issues/issue-24819.stderr | 2 +- tests/ui/issues/issue-26094.rs | 7 +- tests/ui/issues/issue-26094.stderr | 6 +- tests/ui/issues/issue-27008.rs | 2 +- tests/ui/issues/issue-27008.stderr | 2 +- tests/ui/issues/issue-2735-2.rs | 27 - tests/ui/issues/issue-2735-3.rs | 27 - tests/ui/issues/issue-2735.rs | 22 - tests/ui/issues/issue-27583.rs | 47 -- tests/ui/issues/issue-30123.stderr | 2 +- tests/ui/issues/issue-30438-c.rs | 1 - tests/ui/issues/issue-30438-c.stderr | 12 +- tests/ui/issues/issue-32122-1.stderr | 2 +- tests/ui/issues/issue-32122-2.stderr | 2 +- tests/ui/issues/issue-3214.rs | 2 +- tests/ui/issues/issue-3214.stderr | 2 +- tests/ui/issues/issue-33504.stderr | 2 +- tests/ui/issues/issue-33903.rs | 10 - tests/ui/issues/issue-33941.stderr | 6 +- tests/ui/issues/issue-35241.stderr | 2 +- tests/ui/issues/issue-3680.rs | 2 +- tests/ui/issues/issue-3680.stderr | 2 +- tests/ui/issues/issue-3702-2.stderr | 4 +- tests/ui/issues/issue-3763.rs | 7 +- tests/ui/issues/issue-3763.stderr | 22 +- tests/ui/issues/issue-38821.rs | 33 -- tests/ui/issues/issue-38821.stderr | 22 - tests/ui/issues/issue-39292.rs | 17 - tests/ui/issues/issue-39970.rs | 2 +- tests/ui/issues/issue-39970.stderr | 4 +- tests/ui/issues/issue-40003.rs | 178 ------- tests/ui/issues/issue-40288.stderr | 4 +- tests/ui/issues/issue-40749.stderr | 2 +- tests/ui/issues/issue-43420-no-over-suggest.stderr | 2 +- tests/ui/issues/issue-4517.rs | 2 +- tests/ui/issues/issue-4517.stderr | 2 +- tests/ui/issues/issue-45697-1.stderr | 6 +- tests/ui/issues/issue-45697.stderr | 6 +- tests/ui/issues/issue-46471-1.stderr | 7 +- tests/ui/issues/issue-47715.stderr | 8 +- tests/ui/issues/issue-48179.rs | 38 -- tests/ui/issues/issue-48364.stderr | 4 +- tests/ui/issues/issue-4935.stderr | 9 +- tests/ui/issues/issue-4968.rs | 2 +- tests/ui/issues/issue-4968.stderr | 2 +- tests/ui/issues/issue-50576.rs | 6 - tests/ui/issues/issue-50576.stderr | 22 - tests/ui/issues/issue-5100.rs | 4 +- tests/ui/issues/issue-5100.stderr | 6 +- tests/ui/issues/issue-51515.rs | 1 + tests/ui/issues/issue-51515.stderr | 9 +- ...sue-51632-try-desugar-incompatible-types.stderr | 2 +- .../issues/issue-52126-assign-op-invariance.stderr | 2 + tests/ui/issues/issue-53251.rs | 4 +- tests/ui/issues/issue-53251.stderr | 4 +- tests/ui/issues/issue-53348.rs | 2 +- tests/ui/issues/issue-53348.stderr | 2 +- tests/ui/issues/issue-5358-1.rs | 2 +- tests/ui/issues/issue-5358-1.stderr | 2 +- tests/ui/issues/issue-53712.rs | 9 - tests/ui/issues/issue-53712.stderr | 11 - tests/ui/issues/issue-54582.rs | 16 - tests/ui/issues/issue-56943.stderr | 2 +- tests/ui/issues/issue-57362-2.stderr | 4 +- tests/ui/issues/issue-57741-1.stderr | 4 +- tests/ui/issues/issue-57741.stderr | 8 +- tests/ui/issues/issue-59488.stderr | 4 +- tests/ui/issues/issue-60218.stderr | 2 +- tests/ui/issues/issue-60622.rs | 2 +- tests/ui/issues/issue-60622.stderr | 4 +- tests/ui/issues/issue-61106.stderr | 2 +- tests/ui/issues/issue-6458-4.stderr | 2 +- ...e-65634-raw-ident-suggestion.edition2015.stderr | 4 +- ...e-65634-raw-ident-suggestion.edition2018.stderr | 4 +- .../issue-67039-unsound-pin-partialeq.stderr | 2 +- tests/ui/issues/issue-69306.stderr | 6 +- tests/ui/issues/issue-69455.stderr | 4 +- tests/ui/issues/issue-69683.stderr | 2 +- tests/ui/issues/issue-70093.rs | 10 - .../issue-70093/issue-70093-link-directives.rs | 10 + tests/ui/issues/issue-70093/issue-70093.rs | 10 + tests/ui/issues/issue-7061.stderr | 2 +- tests/ui/issues/issue-7092.rs | 2 +- tests/ui/issues/issue-7092.stderr | 2 +- tests/ui/issues/issue-71676-1.stderr | 6 +- tests/ui/issues/issue-7364.stderr | 1 + tests/ui/issues/issue-74236/main.stderr | 2 +- tests/ui/issues/issue-75307.rs | 3 - tests/ui/issues/issue-75307.stderr | 8 - tests/ui/issues/issue-75777.rs | 15 - tests/ui/issues/issue-75777.stderr | 11 - tests/ui/issues/issue-76191.stderr | 4 +- tests/ui/issues/issue-7813.rs | 4 - tests/ui/issues/issue-7813.stderr | 14 - tests/ui/issues/issue-7867.rs | 2 +- tests/ui/issues/issue-7867.stderr | 2 +- tests/ui/issues/issue-83924.fixed | 20 - tests/ui/issues/issue-83924.rs | 20 - tests/ui/issues/issue-83924.stderr | 22 - tests/ui/issues/issue-92741.fixed | 13 + tests/ui/issues/issue-92741.rs | 17 + tests/ui/issues/issue-92741.stderr | 49 ++ tests/ui/json/json-bom-plus-crlf-multifile.stderr | 8 +- tests/ui/json/json-bom-plus-crlf.stderr | 8 +- tests/ui/kindck/kindck-send-object1.stderr | 2 +- tests/ui/kinds-of-primitive-impl.stderr | 16 +- tests/ui/lang-items/bad-add-impl.rs | 18 + tests/ui/lang-items/bad-add-impl.stderr | 11 + .../fn-fn_mut-call-ill-formed.bad_item.stderr | 18 + .../fn-fn_mut-call-ill-formed.bad_sig.stderr | 18 + .../fn-fn_mut-call-ill-formed.fn_bad_item.stderr | 18 + .../fn-fn_mut-call-ill-formed.fn_bad_sig.stderr | 18 + ...n-fn_mut-call-ill-formed.fn_mut_bad_item.stderr | 18 + ...fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr | 18 + ...-fn_mut-call-ill-formed.fn_once_bad_item.stderr | 18 + ...n-fn_mut-call-ill-formed.fn_once_bad_sig.stderr | 18 + tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs | 34 +- .../ui/lang-items/fn-fn_mut-call-ill-formed.stderr | 14 - tests/ui/lang-items/issue-86238.stderr | 2 +- tests/ui/lang-items/lang-item-missing-generator.rs | 21 - .../lang-items/lang-item-missing-generator.stderr | 15 - .../late-bound-lifetimes/mismatched_arg_count.rs | 2 +- .../mismatched_arg_count.stderr | 2 +- tests/ui/layout/valid_range_oob.stderr | 2 +- tests/ui/let-else/accidental-if.rs | 6 + tests/ui/let-else/accidental-if.stderr | 19 + tests/ui/let-else/issue-94176.stderr | 2 +- tests/ui/let-else/let-else-brace-before-else.fixed | 4 - tests/ui/let-else/let-else-brace-before-else.rs | 4 - .../ui/let-else/let-else-brace-before-else.stderr | 17 +- tests/ui/let-else/let-else-deref-coercion.stderr | 4 +- tests/ui/let-else/let-else-non-diverging.stderr | 6 +- tests/ui/let-else/let-else-ref-bindings.stderr | 16 +- ...me-bound-on-trait-object-using-type-alias.fixed | 45 ++ ...etime-bound-on-trait-object-using-type-alias.rs | 45 ++ ...e-bound-on-trait-object-using-type-alias.stderr | 15 + .../issue-104432-unused-lifetimes-in-expansion.rs | 12 + tests/ui/lifetimes/issue-105227.stderr | 13 +- .../issue-107492-default-value-for-lifetime.rs | 6 + .../issue-107492-default-value-for-lifetime.stderr | 8 + tests/ui/lifetimes/issue-107988.rs | 13 + tests/ui/lifetimes/issue-107988.stderr | 27 + tests/ui/lifetimes/issue-17728.stderr | 2 +- tests/ui/lifetimes/issue-26638.stderr | 8 +- tests/ui/lifetimes/issue-69314.fixed | 22 + tests/ui/lifetimes/issue-69314.rs | 22 + tests/ui/lifetimes/issue-69314.stderr | 26 + ...ue-90600-expected-return-static-indirect.stderr | 2 + ...rn-one-existing-name-return-type-is-anon.stderr | 2 +- ...x1-return-one-existing-name-self-is-anon.stderr | 2 +- ...x3-both-anon-regions-return-type-is-anon.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.stderr | 2 +- tests/ui/lifetimes/unusual-rib-combinations.rs | 2 +- tests/ui/lifetimes/unusual-rib-combinations.stderr | 2 +- tests/ui/lint/dead-code/in-closure.rs | 16 + tests/ui/lint/dead-code/in-closure.stderr | 20 + tests/ui/lint/dead-code/issue-85255.rs | 12 +- tests/ui/lint/dead-code/issue-85255.stderr | 12 +- tests/ui/lint/dead-code/lint-dead-code-3.rs | 2 +- tests/ui/lint/dead-code/lint-dead-code-3.stderr | 2 +- tests/ui/lint/invalid_value-polymorphic.rs | 8 + tests/ui/lint/invalid_value.stderr | 40 +- tests/ui/lint/issue-104897.rs | 1 - tests/ui/lint/issue-104897.stderr | 35 +- tests/ui/lint/issue-106991.rs | 13 + tests/ui/lint/issue-106991.stderr | 11 + tests/ui/lint/lint-missing-doc.rs | 6 +- tests/ui/lint/lint-missing-doc.stderr | 46 +- tests/ui/lint/lint-stability-deprecated.rs | 144 +++--- tests/ui/lint/lint-stability-deprecated.stderr | 224 ++++---- tests/ui/lint/lint_map_unit_fn.rs | 20 + tests/ui/lint/lint_map_unit_fn.stderr | 66 +++ .../must_not_suspend/dedup.drop_tracking.stderr | 21 + .../dedup.drop_tracking_mir.stderr | 21 + .../must_not_suspend/dedup.no_drop_tracking.stderr | 33 ++ tests/ui/lint/must_not_suspend/dedup.rs | 7 +- tests/ui/lint/must_not_suspend/dedup.stderr | 6 +- .../lint/must_not_suspend/ref.drop_tracking.stderr | 8 +- .../must_not_suspend/ref.drop_tracking_mir.stderr | 27 + .../must_not_suspend/ref.no_drop_tracking.stderr | 8 +- tests/ui/lint/must_not_suspend/ref.rs | 8 +- .../must_not_suspend/trait.drop_tracking.stderr | 37 ++ .../trait.drop_tracking_mir.stderr | 37 ++ .../must_not_suspend/trait.no_drop_tracking.stderr | 37 ++ tests/ui/lint/must_not_suspend/trait.rs | 6 + tests/ui/lint/must_not_suspend/trait.stderr | 10 +- .../ui/lint/must_not_suspend/tuple-mismatch.stderr | 2 +- .../must_not_suspend/unit.drop_tracking.stderr | 26 + .../must_not_suspend/unit.drop_tracking_mir.stderr | 26 + .../must_not_suspend/unit.no_drop_tracking.stderr | 26 + tests/ui/lint/must_not_suspend/unit.rs | 5 +- tests/ui/lint/must_not_suspend/unit.stderr | 8 +- .../must_not_suspend/warn.drop_tracking.stderr | 26 + .../must_not_suspend/warn.drop_tracking_mir.stderr | 26 + .../must_not_suspend/warn.no_drop_tracking.stderr | 26 + tests/ui/lint/must_not_suspend/warn.rs | 4 + tests/ui/lint/must_not_suspend/warn.stderr | 8 +- tests/ui/lint/reasons-forbidden.rs | 2 +- tests/ui/lint/unaligned_references.rs | 42 +- tests/ui/lint/unaligned_references.stderr | 214 +------- .../ui/lint/unaligned_references_external_macro.rs | 1 - .../unaligned_references_external_macro.stderr | 47 +- tests/ui/lint/unused/issue-103320-must-use-ops.rs | 27 + .../lint/unused/issue-103320-must-use-ops.stderr | 67 +++ tests/ui/lint/unused/issue-96606.rs | 8 + tests/ui/lint/unused/issue-96606.stderr | 33 ++ tests/ui/lint/unused_parens_multibyte_recovery.rs | 1 - .../lint/unused_parens_multibyte_recovery.stderr | 35 +- tests/ui/loops/issue-50576.rs | 6 + tests/ui/loops/issue-50576.stderr | 22 + tests/ui/loops/loop-break-value.stderr | 2 +- tests/ui/loops/loop-else-break-with-value.rs | 10 + tests/ui/loops/loop-else-break-with-value.stderr | 18 + tests/ui/loops/loop-else-err.rs | 8 + tests/ui/loops/loop-else-err.stderr | 17 + tests/ui/loops/loop-else-let-else-err.rs | 8 + tests/ui/loops/loop-else-let-else-err.stderr | 17 + .../macros/format-args-temporaries-in-write.stderr | 4 + tests/ui/macros/issue-102878.rs | 4 - tests/ui/macros/issue-102878.stderr | 51 +- tests/ui/macros/macros-nonfatal-errors.stderr | 9 +- ...consuming-methods-have-optimized-codegen.stdout | 36 +- tests/ui/macros/stringify.rs | 6 +- .../issue-107423-unused-delim-only-one-no-pair.rs | 7 + ...sue-107423-unused-delim-only-one-no-pair.stderr | 12 + tests/ui/match/issue-12552.stderr | 4 +- tests/ui/match/issue-74050-end-span.stderr | 1 + tests/ui/match/issue-91058.stderr | 2 +- tests/ui/match/match-ref-mut-invariance.stderr | 2 +- tests/ui/match/match-ref-mut-let-invariance.stderr | 2 +- tests/ui/match/match-struct.rs | 2 +- tests/ui/match/match-struct.stderr | 2 +- tests/ui/match/match-tag-nullary.stderr | 2 +- tests/ui/match/match-tag-unary.stderr | 2 +- tests/ui/methods/assign-to-method.rs | 3 +- tests/ui/methods/assign-to-method.stderr | 4 +- tests/ui/methods/issues/issue-105732.stderr | 2 +- tests/ui/methods/issues/issue-61525.stderr | 4 +- tests/ui/methods/issues/issue-90315.stderr | 10 +- .../method-ambig-two-traits-cross-crate.stderr | 4 +- .../method-ambig-two-traits-from-bounds.stderr | 4 +- .../method-ambig-two-traits-from-impls.stderr | 4 +- ...hod-ambig-two-traits-with-default-method.stderr | 4 +- tests/ui/methods/method-call-err-msg.stderr | 34 +- tests/ui/methods/method-call-lifetime-args-fail.rs | 8 +- .../methods/method-call-lifetime-args-fail.stderr | 16 +- ...o-same-trait-object-with-separate-params.stderr | 6 +- tests/ui/methods/method-not-found-but-doc-alias.rs | 11 + .../methods/method-not-found-but-doc-alias.stderr | 12 + tests/ui/methods/method-self-arg-1.rs | 4 +- tests/ui/methods/method-self-arg-1.stderr | 8 +- tests/ui/mir/field-projection-invariant.rs | 24 + tests/ui/mir/field-projection-mutating-context.rs | 19 + .../mir/field-projection-mutating-context.stderr | 12 + tests/ui/mir/field-projection-mutating-context2.rs | 17 + .../mir/field-projection-mutating-context2.stderr | 10 + tests/ui/mir/field-ty-ascription-enums.rs | 15 + tests/ui/mir/field-ty-ascription.rs | 37 ++ .../mir/issue-107678-projection-with-lifetime.rs | 20 + tests/ui/mir/issue-107691.rs | 42 ++ tests/ui/mir/issue-109743.rs | 51 ++ tests/ui/mir/mir_codegen_ssa.rs | 19 + tests/ui/mir/validate/storage-live.rs | 30 ++ tests/ui/mir/validate/storage-live.stderr | 13 + tests/ui/mismatched_types/abridged.stderr | 16 +- ...oxed-trait-objects-instead-of-impl-trait.stderr | 4 +- tests/ui/mismatched_types/issue-106182.stderr | 2 +- .../mismatched_types/issue-38371-unfixable.stderr | 2 +- tests/ui/mismatched_types/issue-38371.stderr | 4 +- tests/ui/mismatched_types/issue-47706.stderr | 2 +- .../issue-74918-missing-lifetime.stderr | 4 +- .../non_zero_assigned_something.stderr | 4 +- tests/ui/mismatched_types/normalize-fn-sig.stderr | 3 +- .../mismatched_types/overloaded-calls-bad.stderr | 7 +- .../ui/mismatched_types/ref-pat-suggestions.stderr | 18 +- tests/ui/mismatched_types/show_module.stderr | 8 +- tests/ui/mismatched_types/similar_paths.stderr | 8 +- .../similar_paths_primitive.stderr | 6 +- ...oxed-trait-objects-instead-of-impl-trait.stderr | 4 +- .../suggest-removing-tuple-struct-field.stderr | 4 +- .../wrap-suggestion-privacy.stderr | 6 +- tests/ui/modules/issue-107649.rs | 106 ++++ tests/ui/modules/issue-107649.stderr | 18 + tests/ui/moves/issue-22536-copy-mustnt-zero.rs | 28 + tests/ui/moves/move-fn-self-receiver.stderr | 2 + .../pin-mut-reborrow-infer-var-issue-107419.fixed | 11 + .../pin-mut-reborrow-infer-var-issue-107419.rs | 11 + .../pin-mut-reborrow-infer-var-issue-107419.stderr | 20 + tests/ui/mut/mut-cross-borrowing.stderr | 2 +- .../ui/mut/mut-pattern-internal-mutability.stderr | 4 +- tests/ui/mutexguard-sync.rs | 13 - tests/ui/mutexguard-sync.stderr | 19 - .../mix-bundle-and-whole-archive-link-attr.rs | 13 +- .../mix-bundle-and-whole-archive-link-attr.stderr | 6 +- .../mix-bundle-and-whole-archive.rs | 9 +- .../mix-bundle-and-whole-archive.stderr | 6 +- .../never_type/diverging-tuple-parts-39485.stderr | 4 +- tests/ui/never_type/issue-10176.rs | 2 +- tests/ui/never_type/issue-10176.stderr | 2 +- tests/ui/never_type/issue-52443.stderr | 2 +- tests/ui/never_type/issue-96335.stderr | 2 +- tests/ui/nll/borrowed-local-error.stderr | 1 + tests/ui/nll/borrowed-match-issue-45045.stderr | 2 +- tests/ui/nll/capture-ref-in-struct.stderr | 3 + tests/ui/nll/closure-access-spans.stderr | 4 +- tests/ui/nll/closure-borrow-spans.stderr | 14 +- .../closure-requirements/escape-argument.stderr | 3 + ...shorter-to-static-comparing-against-free.stderr | 2 + .../type-test-subject-non-trivial-region.rs | 19 + .../type-test-subject-opaque-1.rs | 18 + .../type-test-subject-opaque-2.rs | 17 + .../type-test-subject-unnamed-region.rs | 24 + tests/ui/nll/closure-use-spans.stderr | 12 +- ...-not-ignore-lifetime-bounds-in-copy-proj.stderr | 2 + .../do-not-ignore-lifetime-bounds-in-copy.stderr | 2 + tests/ui/nll/dont-print-desugared.stderr | 1 + tests/ui/nll/drop-no-may-dangle.stderr | 8 +- tests/ui/nll/guarantor-issue-46974.stderr | 4 +- .../nll/issue-27282-move-ref-mut-into-guard.stderr | 4 +- tests/ui/nll/issue-27282-mutation-in-guard.stderr | 4 +- tests/ui/nll/issue-27583.rs | 47 ++ tests/ui/nll/issue-27868.stderr | 4 +- tests/ui/nll/issue-46036.stderr | 2 + tests/ui/nll/issue-48179.rs | 38 ++ tests/ui/nll/issue-48803.stderr | 4 +- tests/ui/nll/issue-52057.rs | 4 +- tests/ui/nll/issue-52534-2.stderr | 2 + tests/ui/nll/issue-52663-trait-object.stderr | 2 + .../issue-54382-use-span-of-tail-of-block.stderr | 3 + tests/ui/nll/issue-54556-niconii.stderr | 3 + tests/ui/nll/issue-54556-stephaneyfx.stderr | 2 + .../issue-54556-temps-in-tail-diagnostic.stderr | 3 + .../ui/nll/issue-54556-used-vs-unused-tails.stderr | 103 ++-- tests/ui/nll/issue-54556-wrap-it-up.stderr | 4 +- tests/ui/nll/issue-55511.stderr | 2 + .../nll/issue-57642-higher-ranked-subtype.stderr | 6 +- tests/ui/nll/issue-57989.stderr | 4 +- tests/ui/nll/issue-68550.stderr | 4 +- tests/ui/nll/issue-69114-static-mut-ty.stderr | 6 + tests/ui/nll/issue-69114-static-ty.stderr | 2 + tests/ui/nll/issue-73159-rpit-static.stderr | 1 + tests/ui/nll/issue-75777.rs | 15 + tests/ui/nll/issue-75777.stderr | 11 + tests/ui/nll/loan_ends_mid_block_pair.stderr | 4 +- tests/ui/nll/local-outlives-static-via-hrtb.stderr | 5 + tests/ui/nll/match-cfg-fake-edges2.stderr | 2 +- tests/ui/nll/match-guards-always-borrow.stderr | 4 +- tests/ui/nll/match-guards-partially-borrow.stderr | 8 +- tests/ui/nll/match-on-borrowed.stderr | 6 +- ...-initialized-drop-implicit-fragment-drop.stderr | 4 +- .../maybe-initialized-drop-with-fragment.stderr | 4 +- ...alized-drop-with-uninitialized-fragments.stderr | 4 +- tests/ui/nll/maybe-initialized-drop.stderr | 4 +- .../min-choice-reject-ambiguous.rs | 43 ++ .../min-choice-reject-ambiguous.stderr | 42 ++ tests/ui/nll/member-constraints/min-choice.rs | 34 ++ .../member-constraints/nested-impl-trait-fail.rs | 33 ++ .../nested-impl-trait-fail.stderr | 83 +++ .../member-constraints/nested-impl-trait-pass.rs | 29 ++ tests/ui/nll/outlives-suggestion-simple.stderr | 4 +- tests/ui/nll/polonius/polonius-smoke-test.stderr | 8 +- tests/ui/nll/promoted-bounds.stderr | 1 + .../reference-carried-through-struct-field.stderr | 2 +- tests/ui/nll/relate_tys/var-appears-twice.stderr | 3 + .../ui/nll/ty-outlives/impl-trait-captures.stderr | 4 +- .../projection-one-region-closure.stderr | 2 +- ...rojection-one-region-trait-bound-closure.stderr | 2 +- ...rojection-two-region-trait-bound-closure.stderr | 28 +- .../ui/nll/user-annotations/adt-brace-enums.stderr | 3 + .../nll/user-annotations/adt-brace-structs.stderr | 3 + .../nll/user-annotations/adt-nullary-enums.stderr | 6 +- .../ui/nll/user-annotations/adt-tuple-enums.stderr | 3 + .../user-annotations/adt-tuple-struct-calls.stderr | 7 +- .../nll/user-annotations/adt-tuple-struct.stderr | 3 + .../user-annotations/cast_static_lifetime.stderr | 2 + .../constant-in-expr-inherent-2.stderr | 11 + tests/ui/nll/user-annotations/fns.stderr | 3 + tests/ui/nll/user-annotations/method-call.stderr | 4 + tests/ui/nll/user-annotations/method-ufcs-1.stderr | 5 + tests/ui/nll/user-annotations/method-ufcs-2.stderr | 8 +- tests/ui/nll/user-annotations/method-ufcs-3.stderr | 4 + .../user-annotations/method-ufcs-inherent-1.stderr | 1 + .../user-annotations/method-ufcs-inherent-2.stderr | 2 + .../user-annotations/method-ufcs-inherent-3.stderr | 1 + .../user-annotations/method-ufcs-inherent-4.stderr | 2 + tests/ui/nll/user-annotations/normalization.stderr | 4 + .../pattern_substs_on_brace_enum_variant.stderr | 4 + .../pattern_substs_on_brace_struct.stderr | 4 + .../pattern_substs_on_tuple_enum_variant.stderr | 4 + .../pattern_substs_on_tuple_struct.stderr | 4 + tests/ui/nll/user-annotations/patterns.stderr | 24 + .../user-annotations/promoted-annotation.stderr | 1 + .../type_ascription_static_lifetime.stderr | 2 + tests/ui/noexporttypeexe.rs | 2 +- tests/ui/noexporttypeexe.stderr | 2 +- tests/ui/non-ice-error-on-worker-io-fail.rs | 40 -- tests/ui/non-ice-error-on-worker-io-fail.stderr | 6 - tests/ui/numbers-arithmetic/issue-105626.rs | 17 + .../next-power-of-two-overflow-debug.rs | 2 +- tests/ui/object-pointer-types.stderr | 2 +- .../object-safety-supertrait-mentions-GAT.stderr | 5 + tests/ui/optimization-remark.rs | 1 - tests/ui/or-patterns/already-bound-name.stderr | 2 +- .../nested-undelimited-precedence.stderr | 8 +- tests/ui/packed/issue-27060-rpass.rs | 23 - tests/ui/packed/issue-27060-rpass.stderr | 68 --- tests/ui/packed/issue-27060.rs | 4 - tests/ui/packed/issue-27060.stderr | 76 +-- .../packed/packed-struct-borrow-element-64bit.rs | 5 +- .../packed-struct-borrow-element-64bit.stderr | 31 +- tests/ui/packed/packed-struct-borrow-element.rs | 8 +- .../ui/packed/packed-struct-borrow-element.stderr | 54 +- tests/ui/panics/default-backtrace-ice.stderr | 5 +- tests/ui/parser/anon-enums-are-ambiguous.rs | 26 + tests/ui/parser/bastion-of-the-turbofish.rs | 2 +- tests/ui/parser/deli-ident-issue-1.rs | 22 + tests/ui/parser/deli-ident-issue-1.stderr | 17 + tests/ui/parser/deli-ident-issue-2.rs | 7 + tests/ui/parser/deli-ident-issue-2.stderr | 19 + .../do-not-suggest-semicolon-before-array.rs | 2 +- .../do-not-suggest-semicolon-before-array.stderr | 4 +- tests/ui/parser/fn-header-semantic-fail.stderr | 12 +- tests/ui/parser/issue-102806.stderr | 7 +- tests/ui/parser/issue-103451.rs | 1 - tests/ui/parser/issue-103451.stderr | 24 +- tests/ui/parser/issue-107705.rs | 3 + tests/ui/parser/issue-107705.stderr | 10 + tests/ui/parser/issue-108495-dec.rs | 39 ++ tests/ui/parser/issue-108495-dec.stderr | 69 +++ tests/ui/parser/issue-68987-unmatch-issue-1.rs | 12 + tests/ui/parser/issue-68987-unmatch-issue-1.stderr | 16 + tests/ui/parser/issue-68987-unmatch-issue-2.rs | 14 + tests/ui/parser/issue-68987-unmatch-issue-2.stderr | 19 + tests/ui/parser/issue-68987-unmatch-issue-3.rs | 8 + tests/ui/parser/issue-68987-unmatch-issue-3.stderr | 19 + tests/ui/parser/issue-68987-unmatch-issue.rs | 12 + tests/ui/parser/issue-68987-unmatch-issue.stderr | 16 + tests/ui/parser/issue-81804.rs | 3 - tests/ui/parser/issue-81804.stderr | 36 +- tests/ui/parser/issue-81827.rs | 1 - tests/ui/parser/issue-81827.stderr | 32 +- tests/ui/parser/issues/issue-104367.rs | 6 + tests/ui/parser/issues/issue-104367.stderr | 26 + tests/ui/parser/issues/issue-105209.rs | 3 + tests/ui/parser/issues/issue-105209.stderr | 22 + tests/ui/parser/issues/issue-10636-2.rs | 4 +- tests/ui/parser/issues/issue-10636-2.stderr | 19 +- tests/ui/parser/issues/issue-44406.stderr | 4 +- .../issue-58094-missing-right-square-bracket.rs | 3 +- ...issue-58094-missing-right-square-bracket.stderr | 10 +- tests/ui/parser/issues/issue-58856-1.rs | 5 +- tests/ui/parser/issues/issue-58856-1.stderr | 29 +- tests/ui/parser/issues/issue-58856-2.rs | 5 +- tests/ui/parser/issues/issue-58856-2.stderr | 33 +- tests/ui/parser/issues/issue-60075.rs | 5 +- tests/ui/parser/issues/issue-60075.stderr | 20 +- tests/ui/parser/issues/issue-62524.rs | 2 +- tests/ui/parser/issues/issue-62524.stderr | 25 +- tests/ui/parser/issues/issue-62546.rs | 4 +- tests/ui/parser/issues/issue-62546.stderr | 15 +- tests/ui/parser/issues/issue-62554.rs | 1 - tests/ui/parser/issues/issue-62554.stderr | 64 +-- tests/ui/parser/issues/issue-62881.rs | 5 +- tests/ui/parser/issues/issue-62881.stderr | 24 +- tests/ui/parser/issues/issue-62894.rs | 1 - tests/ui/parser/issues/issue-62894.stderr | 40 +- tests/ui/parser/issues/issue-62895.rs | 14 +- tests/ui/parser/issues/issue-62895.stderr | 51 +- tests/ui/parser/issues/issue-62973.rs | 2 +- tests/ui/parser/issues/issue-62973.stderr | 80 +-- tests/ui/parser/issues/issue-63116.rs | 2 +- tests/ui/parser/issues/issue-63116.stderr | 25 +- tests/ui/parser/issues/issue-63135.rs | 4 +- tests/ui/parser/issues/issue-63135.stderr | 34 +- .../issues/issue-66357-unexpected-unreachable.rs | 4 +- .../issue-66357-unexpected-unreachable.stderr | 17 +- ...ue-67377-invalid-syntax-in-enum-discriminant.rs | 14 +- ...7377-invalid-syntax-in-enum-discriminant.stderr | 113 +--- tests/ui/parser/issues/issue-68629.rs | Bin 336 -> 129 bytes tests/ui/parser/issues/issue-68629.stderr | Bin 1637 -> 944 bytes tests/ui/parser/issues/issue-69259.rs | 3 + tests/ui/parser/issues/issue-69259.stderr | 8 + .../issues/issue-70583-block-is-empty-1.stderr | 4 +- .../issues/issue-70583-block-is-empty-2.stderr | 6 +- tests/ui/parser/issues/issue-84104.rs | 1 - tests/ui/parser/issues/issue-84104.stderr | 10 +- tests/ui/parser/issues/issue-84148-2.rs | 1 - tests/ui/parser/issues/issue-84148-2.stderr | 21 +- .../ui/parser/issues/issue-87086-colon-path-sep.rs | 1 - .../issues/issue-87086-colon-path-sep.stderr | 81 ++- tests/ui/parser/issues/issue-87812-path.stderr | 2 +- tests/ui/parser/issues/issue-88770.rs | 3 - tests/ui/parser/issues/issue-88770.stderr | 50 +- .../macro-mismatched-delim-paren-brace.stderr | 22 +- tests/ui/parser/match-arm-without-braces.stderr | 10 +- tests/ui/parser/mbe_missing_right_paren.rs | 2 +- tests/ui/parser/mbe_missing_right_paren.stderr | 23 +- .../missing-close-brace-in-impl-trait.rs | 6 +- .../missing-close-brace-in-impl-trait.stderr | 25 +- .../missing-close-brace-in-struct.rs | 2 +- .../missing-close-brace-in-struct.stderr | 11 +- .../missing-close-brace-in-trait.rs | 3 +- .../missing-close-brace-in-trait.stderr | 20 +- .../missing-closing-angle-bracket-eq-constraint.rs | 2 +- ...sing-closing-angle-bracket-eq-constraint.stderr | 12 +- tests/ui/parser/missing-expression-in-for-loop.rs | 5 + .../parser/missing-expression-in-for-loop.stderr | 13 + tests/ui/parser/missing_right_paren.rs | 3 +- tests/ui/parser/missing_right_paren.stderr | 25 +- tests/ui/parser/parser-recovery-1.rs | 3 - tests/ui/parser/parser-recovery-1.stderr | 25 +- tests/ui/parser/parser-recovery-2.rs | 5 +- tests/ui/parser/parser-recovery-2.stderr | 21 +- tests/ui/parser/raw/too-many-hash.rs | 6 + tests/ui/parser/raw/too-many-hash.stderr | 8 + .../ui/parser/recover-fn-ptr-with-generics.stderr | 12 +- tests/ui/parser/recover-quantified-closure.rs | 2 +- tests/ui/parser/recover-quantified-closure.stderr | 4 +- tests/ui/parser/recover-range-pats.stderr | 6 +- .../parser/suggest_misplaced_generics/enum.fixed | 9 + tests/ui/parser/suggest_misplaced_generics/enum.rs | 9 + .../parser/suggest_misplaced_generics/enum.stderr | 14 + .../existing_generics.rs | 9 + .../existing_generics.stderr | 10 + .../fn-complex-generics.fixed | 9 + .../fn-complex-generics.rs | 9 + .../fn-complex-generics.stderr | 14 + .../fn-invalid-generics.rs | 8 + .../fn-invalid-generics.stderr | 8 + .../suggest_misplaced_generics/fn-simple.fixed | 9 + .../parser/suggest_misplaced_generics/fn-simple.rs | 9 + .../suggest_misplaced_generics/fn-simple.stderr | 14 + .../parser/suggest_misplaced_generics/struct.fixed | 9 + .../ui/parser/suggest_misplaced_generics/struct.rs | 9 + .../suggest_misplaced_generics/struct.stderr | 14 + .../parser/suggest_misplaced_generics/trait.fixed | 11 + .../ui/parser/suggest_misplaced_generics/trait.rs | 11 + .../parser/suggest_misplaced_generics/trait.stderr | 14 + .../parser/suggest_misplaced_generics/type.fixed | 9 + tests/ui/parser/suggest_misplaced_generics/type.rs | 9 + .../parser/suggest_misplaced_generics/type.stderr | 14 + tests/ui/parser/trait-object-delimiters.rs | 2 + tests/ui/parser/trait-object-delimiters.stderr | 28 +- tests/ui/parser/type-ascription-in-pattern.rs | 16 + tests/ui/parser/type-ascription-in-pattern.stderr | 54 ++ tests/ui/parser/unclosed-delimiter-in-dep.rs | 1 - tests/ui/parser/unclosed-delimiter-in-dep.stderr | 14 +- tests/ui/parser/use-unclosed-brace.rs | 2 - tests/ui/parser/use-unclosed-brace.stderr | 20 +- ...ther-can-live-while-the-other-survives-1.stderr | 8 +- .../borrowck-pat-at-and-box.stderr | 32 +- .../borrowck-pat-by-move-and-ref.stderr | 120 ++--- .../borrowck-pat-ref-mut-and-ref.stderr | 144 +++--- .../borrowck-pat-ref-mut-twice.stderr | 96 ++-- ...ult-binding-modes-both-sides-independent.stderr | 16 +- tests/ui/pattern/for-loop-bad-item.stderr | 2 +- ...-67037-pat-tup-scrut-ty-diff-less-fields.stderr | 2 +- .../borrowck-move-ref-pattern.stderr | 2 + .../pattern/pat-struct-field-expr-has-type.stderr | 2 +- tests/ui/pattern/pat-type-err-formal-param.stderr | 2 +- tests/ui/pattern/pat-type-err-let-stmt.stderr | 8 +- tests/ui/pattern/pattern-error-continue.rs | 2 +- tests/ui/pattern/pattern-error-continue.stderr | 2 +- .../ui/pattern/pattern-ident-path-generics.stderr | 2 +- tests/ui/pattern/pattern-tyvar.stderr | 2 +- ...to-type-err-cause-on-impl-trait-return-2.stderr | 2 +- tests/ui/print_type_sizes/async.stdout | 14 +- tests/ui/print_type_sizes/generator.stdout | 10 +- .../generator_discr_placement.stdout | 6 +- tests/ui/privacy/privacy1.rs | 2 +- tests/ui/privacy/privacy1.stderr | 6 +- tests/ui/privacy/private-impl-method.rs | 2 +- tests/ui/privacy/private-impl-method.stderr | 6 +- .../ui/privacy/private-in-public-ill-formed.stderr | 8 +- tests/ui/privacy/private-method-cross-crate.rs | 2 +- tests/ui/privacy/private-method-cross-crate.stderr | 6 +- tests/ui/privacy/private-method-inherited.rs | 2 +- tests/ui/privacy/private-method-inherited.stderr | 6 +- tests/ui/privacy/private-method.rs | 2 +- tests/ui/privacy/private-method.stderr | 6 +- tests/ui/privacy/restricted/test.stderr | 18 +- tests/ui/proc-macro/allowed-signatures.rs | 26 + tests/ui/proc-macro/break-token-spans.stderr | 2 +- tests/ui/proc-macro/crt-static.rs | 3 + tests/ui/proc-macro/issue-37788.stderr | 2 +- tests/ui/proc-macro/proc-macro-abi.rs | 31 ++ tests/ui/proc-macro/proc-macro-abi.stderr | 20 + tests/ui/proc-macro/resolved-located-at.stderr | 2 +- .../proc-macro/signature-proc-macro-attribute.rs | 32 ++ .../signature-proc-macro-attribute.stderr | 42 ++ tests/ui/proc-macro/signature-proc-macro-derive.rs | 31 ++ .../proc-macro/signature-proc-macro-derive.stderr | 40 ++ tests/ui/proc-macro/signature-proc-macro.rs | 31 ++ tests/ui/proc-macro/signature-proc-macro.stderr | 40 ++ tests/ui/proc-macro/signature.rs | 6 +- tests/ui/proc-macro/signature.stderr | 46 +- tests/ui/process/process-sigpipe.rs | 1 + tests/ui/pub/pub-ident-fn-3.rs | 8 - tests/ui/pub/pub-ident-fn-3.stderr | 8 - tests/ui/pub/pub-ident-fn-or-struct-2.rs | 4 - tests/ui/pub/pub-ident-fn-or-struct-2.stderr | 8 - tests/ui/pub/pub-ident-struct-2.rs | 8 + tests/ui/pub/pub-ident-struct-2.stderr | 13 + tests/ui/pub/pub-ident-struct-3.rs | 4 + tests/ui/pub/pub-ident-struct-3.stderr | 13 + tests/ui/pub/pub-ident-struct-4.fixed | 6 + tests/ui/pub/pub-ident-struct-4.rs | 6 + tests/ui/pub/pub-ident-struct-4.stderr | 13 + .../no-query-in-printing-during-query-descr.rs | 6 + .../no-query-in-printing-during-query-descr.stderr | 9 + tests/ui/range/issue-54505-no-literals.stderr | 24 +- tests/ui/range/issue-54505-no-std.stderr | 12 +- tests/ui/range/issue-54505.stderr | 12 +- .../issue-73553-misinterp-range-literal.stderr | 4 +- tests/ui/recursion/issue-83150.stderr | 4 +- tests/ui/recursion_limit/issue-105700.rs | 9 + tests/ui/recursion_limit/issue-105700.stderr | 10 + tests/ui/recursion_limit/issue-40003.rs | 178 +++++++ ...-not-suggest-adding-bound-to-opaque-type.stderr | 2 + tests/ui/regions/higher-ranked-implied.rs | 14 + tests/ui/regions/higher-ranked-implied.stderr | 21 + tests/ui/regions/issue-102374.stderr | 2 +- ...gion-lifetime-bounds-on-fns-where-clause.stderr | 1 + ...iple-lifetime-bounds-on-fns-where-clause.stderr | 1 + tests/ui/regions/regions-addr-of-arg.stderr | 2 + .../regions-early-bound-error-method.stderr | 2 +- .../regions-fn-subtyping-return-static-fail.stderr | 1 + .../regions-free-region-ordering-caller1.stderr | 2 + .../regions-free-region-ordering-incorrect.stderr | 2 +- ...-region-outlives-static-outlives-free-region.rs | 2 + ...ion-outlives-static-outlives-free-region.stderr | 7 +- .../regions/regions-infer-proc-static-upvar.stderr | 2 + .../regions/regions-lifetime-bounds-on-fns.stderr | 1 + tests/ui/regions/regions-mock-codegen.rs | 8 +- tests/ui/regions/regions-nested-fns.stderr | 2 + .../regions-pattern-typing-issue-19552.stderr | 2 + .../regions-pattern-typing-issue-19997.stderr | 4 +- tests/ui/regions/regions-static-bound-rpass.rs | 2 + tests/ui/regions/regions-static-bound-rpass.stderr | 11 +- tests/ui/regions/regions-static-bound.rs | 8 +- tests/ui/regions/regions-static-bound.stderr | 30 +- tests/ui/regions/resolve-re-error-ice.rs | 22 + tests/ui/regions/resolve-re-error-ice.stderr | 15 + tests/ui/reify-intrinsic.stderr | 5 +- tests/ui/repeat-expr/repeat_count.rs | 2 +- tests/ui/repeat-expr/repeat_count.stderr | 2 +- tests/ui/repr/16-bit-repr-c-enum.rs | 52 ++ tests/ui/resolve/issue-108529.rs | 8 + tests/ui/resolve/issue-108529.stderr | 9 + tests/ui/resolve/name-clash-nullary.stderr | 2 +- tests/ui/resolve/privacy-enum-ctor.stderr | 6 +- tests/ui/resolve/resolve-inconsistent-names.stderr | 2 +- tests/ui/resolve/resolve-primitive-fallback.stderr | 9 +- tests/ui/resolve/token-error-correct-2.rs | 1 - tests/ui/resolve/token-error-correct-2.stderr | 10 +- tests/ui/resolve/token-error-correct-3.rs | 5 +- tests/ui/resolve/token-error-correct-3.stderr | 26 +- tests/ui/resolve/token-error-correct-4.fixed | 10 - tests/ui/resolve/token-error-correct-4.rs | 5 +- tests/ui/resolve/token-error-correct-4.stderr | 18 +- tests/ui/resolve/token-error-correct.rs | 1 - tests/ui/resolve/token-error-correct.stderr | 10 +- tests/ui/return/return-type.stderr | 2 +- .../ui/return/tail-expr-as-potential-return.stderr | 4 +- .../ui/rfc-2005-default-binding-mode/const.stderr | 2 +- tests/ui/rfc-2005-default-binding-mode/lit.stderr | 4 +- .../borrowck-non-exhaustive.stderr | 2 +- .../uninhabited/coercions.stderr | 8 +- .../uninhabited/coercions_same_crate.stderr | 8 +- tests/ui/rfc-2091-track-caller/call-chain.rs | 2 +- .../rfc-2091-track-caller/error-with-main.stderr | 2 +- tests/ui/rfc-2294-if-let-guard/typeck.stderr | 4 +- .../ui/rfc-2457/mod_file_nonascii_forbidden.stderr | 2 +- .../disallowed-positions.stderr | 46 +- ...t-else-does-not-interact-with-let-chains.stderr | 13 +- .../const-closure-parse-not-item.rs | 10 + .../const_derives/derive-const-with-params.rs | 13 + .../do-not-const-check-override.rs | 19 + .../do-not-const-check.rs | 18 + .../function-pointer-does-not-require-const.rs | 8 + .../rfc-2396-target_feature-11/fn-ptr.mir.stderr | 6 + .../rfc-2396-target_feature-11/fn-ptr.thir.stderr | 6 + .../feature-gate.stderr | 2 +- .../issue-92010-trait-bound-not-satisfied.stderr | 2 +- .../lifetime-update.stderr | 3 + .../type-generic-update.stderr | 4 +- tests/ui/runtime/out-of-stack.rs | 1 + tests/ui/runtime/signal-alternate-stack-cleanup.rs | 1 + .../edition-lint-infer-outlives-multispan.rs | 20 + .../edition-lint-infer-outlives-multispan.stderr | 58 ++- .../ui/rust-2018/edition-lint-infer-outlives.fixed | 9 + tests/ui/rust-2018/edition-lint-infer-outlives.rs | 9 + .../rust-2018/edition-lint-infer-outlives.stderr | 14 +- tests/ui/rust-2018/remove-extern-crate.fixed | 10 + tests/ui/rust-2018/remove-extern-crate.rs | 10 + tests/ui/rust-2018/remove-extern-crate.stderr | 22 +- tests/ui/sanitize/cfg-kasan.rs | 28 + tests/ui/sanitize/memory-eager.rs | 1 - .../emit-notifications.polonius.stderr | 2 - tests/ui/save-analysis/emit-notifications.rs | 7 - tests/ui/save-analysis/emit-notifications.stderr | 2 - tests/ui/save-analysis/issue-26459.rs | 8 - tests/ui/save-analysis/issue-26459.stderr | 9 - tests/ui/save-analysis/issue-37323.rs | 20 - tests/ui/save-analysis/issue-59134-0.rs | 12 - tests/ui/save-analysis/issue-59134-0.stderr | 9 - tests/ui/save-analysis/issue-59134-1.rs | 12 - tests/ui/save-analysis/issue-59134-1.stderr | 9 - tests/ui/save-analysis/issue-63663.rs | 28 - tests/ui/save-analysis/issue-64659.rs | 10 - tests/ui/save-analysis/issue-65411.rs | 15 - tests/ui/save-analysis/issue-65590.rs | 21 - tests/ui/save-analysis/issue-68621.rs | 17 - tests/ui/save-analysis/issue-68621.stderr | 10 - tests/ui/save-analysis/issue-72267.rs | 7 - tests/ui/save-analysis/issue-72267.stderr | 15 - tests/ui/save-analysis/issue-73020.rs | 5 - tests/ui/save-analysis/issue-73020.stderr | 9 - tests/ui/save-analysis/issue-73022.rs | 13 - tests/ui/save-analysis/issue-89066.rs | 28 - tests/ui/save-analysis/issue-89066.stderr | 39 -- ...self_types_pin_lifetime_impl_trait-async.stderr | 5 +- ...trary_self_types_pin_lifetime_impl_trait.stderr | 5 +- ...y_self_types_pin_lifetime_mismatch-async.stderr | 6 +- ...bitrary_self_types_pin_lifetime_mismatch.stderr | 6 +- .../arbitrary_self_types_pointers_and_wrappers.rs | 22 + tests/ui/self/elision/lt-ref-self-async.stderr | 12 +- tests/ui/self/elision/lt-ref-self.stderr | 12 +- tests/ui/self/elision/ref-mut-self-async.stderr | 12 +- tests/ui/self/elision/ref-mut-self.stderr | 12 +- tests/ui/self/elision/ref-mut-struct-async.stderr | 10 +- tests/ui/self/elision/ref-mut-struct.stderr | 10 +- tests/ui/self/elision/ref-self-async.stderr | 14 +- tests/ui/self/elision/ref-self.stderr | 14 +- tests/ui/self/elision/ref-struct-async.stderr | 10 +- tests/ui/self/elision/ref-struct.stderr | 10 +- tests/ui/self/issue-61882-2.stderr | 2 + tests/ui/self/issue-61882.stderr | 2 +- tests/ui/seq-args.rs | 4 +- tests/ui/seq-args.stderr | 4 +- tests/ui/simd/intrinsic/generic-cast-pass.rs | 146 ++---- tests/ui/simd/intrinsic/generic-gather-pass.rs | 24 +- tests/ui/simd/issue-89193.rs | 11 +- tests/ui/single-use-lifetime/issue-107998.rs | 9 + tests/ui/single-use-lifetime/issue-107998.stderr | 30 ++ tests/ui/slightly-nice-generic-literal-messages.rs | 2 +- .../slightly-nice-generic-literal-messages.stderr | 2 +- .../borrowck-call-is-borrow-issue-12224.stderr | 3 + tests/ui/span/borrowck-let-suggestion-suffixes.rs | 1 + .../span/borrowck-let-suggestion-suffixes.stderr | 11 +- tests/ui/span/coerce-suggestions.stderr | 6 +- tests/ui/span/destructor-restrictions.stderr | 2 + ...ust-2021-incompatible-closure-captures-93117.rs | 12 +- ...2021-incompatible-closure-captures-93117.stderr | 93 +--- tests/ui/span/dropck-object-cycle.stderr | 2 + tests/ui/span/dropck_arr_cycle_checked.stderr | 9 + tests/ui/span/dropck_direct_cycle_with_drop.stderr | 5 + tests/ui/span/dropck_misc_variants.stderr | 6 + tests/ui/span/dropck_vec_cycle_checked.stderr | 9 + tests/ui/span/issue-107353.rs | 9 + ...ue-23338-locals-die-before-temps-of-body.stderr | 4 + ...-24805-dropck-child-has-items-via-parent.stderr | 3 + .../span/issue-24805-dropck-trait-has-items.stderr | 9 + tests/ui/span/issue-24895-copy-clone-dropck.stderr | 3 + tests/ui/span/issue-25199.stderr | 2 + tests/ui/span/issue-26656.stderr | 3 + tests/ui/span/issue-29106.stderr | 6 + tests/ui/span/issue-33884.stderr | 2 +- tests/ui/span/issue-34264.stderr | 18 +- tests/ui/span/issue-36537.stderr | 2 + tests/ui/span/issue-37767.stderr | 12 +- tests/ui/span/issue-39018.stderr | 2 +- tests/ui/span/issue-40157.stderr | 9 +- .../issue-42234-unknown-receiver-type.full.stderr | 2 +- ...-42234-unknown-receiver-type.generic_arg.stderr | 2 +- .../span/issue28498-reject-lifetime-param.stderr | 3 + .../ui/span/issue28498-reject-passed-to-fn.stderr | 3 + tests/ui/span/issue28498-reject-trait-bound.stderr | 3 + tests/ui/span/missing-unit-argument.stderr | 4 +- tests/ui/span/mut-ptr-cant-outlive-ref.stderr | 2 + tests/ui/span/range-2.stderr | 8 +- .../span/regionck-unboxed-closure-lifetimes.stderr | 2 + .../regions-close-over-type-parameter-2.stderr | 2 + .../span/regions-escape-loop-via-variable.stderr | 4 +- tests/ui/span/regions-escape-loop-via-vec.stderr | 13 +- .../regions-infer-borrow-scope-within-loop.stderr | 3 + .../span/send-is-not-static-ensures-scoping.stderr | 1 + tests/ui/span/send-is-not-static-std-sync-2.stderr | 6 +- tests/ui/span/send-is-not-static-std-sync.stderr | 15 + tests/ui/span/type-annotations-needed-expr.stderr | 2 +- .../span/vec-must-not-hide-type-from-dropck.stderr | 6 + .../ui/span/vec_refs_data_with_early_death.stderr | 6 + tests/ui/span/wf-method-late-bound-regions.stderr | 1 + .../defaultimpl/specialization-no-default.stderr | 10 +- tests/ui/specialization/issue-50452-fail.stderr | 2 +- .../specialization/non-defaulted-item-fail.stderr | 12 +- .../specialization-default-types.stderr | 4 +- .../specialization-no-default.stderr | 10 +- .../unresolved_stability_lint.rs | 8 + .../unresolved_stability_lint.stderr | 9 + tests/ui/static/bad-const-type.rs | 2 +- tests/ui/static/bad-const-type.stderr | 2 +- tests/ui/static/issue-5216.stderr | 4 +- tests/ui/static/static-lifetime-bound.rs | 2 +- tests/ui/static/static-lifetime-bound.stderr | 12 +- tests/ui/static/static-reference-to-fn-1.stderr | 8 +- tests/ui/statics/uninhabited-static.stderr | 10 +- tests/ui/stats/hir-stats.rs | 6 +- tests/ui/stats/hir-stats.stderr | 208 ++++---- tests/ui/stdlib-unit-tests/not-sync.stderr | 2 + tests/ui/str/str-lit-type-mismatch.stderr | 6 +- tests/ui/structs-enums/rec-align-u64.rs | 4 +- .../struct-enum-ignoring-field-with-underscore.rs | 3 +- ...ruct-enum-ignoring-field-with-underscore.stderr | 23 +- tests/ui/structs/struct-base-wrong-type.stderr | 8 +- tests/ui/structs/struct-path-associated-type.rs | 4 +- .../ui/structs/struct-path-associated-type.stderr | 4 +- .../structs/struct-path-self-type-mismatch.stderr | 2 +- tests/ui/structs/struct-record-suggestion.stderr | 2 +- .../structs/structure-constructor-type-mismatch.rs | 4 +- .../structure-constructor-type-mismatch.stderr | 10 +- tests/ui/suggest-null-ptr.fixed | 31 ++ tests/ui/suggest-null-ptr.rs | 31 ++ tests/ui/suggest-null-ptr.stderr | 83 +++ .../args-instead-of-tuple-errors.stderr | 22 +- tests/ui/suggestions/args-instead-of-tuple.stderr | 4 +- tests/ui/suggestions/as-ref.stderr | 22 +- tests/ui/suggestions/assoc-const-without-self.rs | 11 + .../ui/suggestions/assoc-const-without-self.stderr | 14 + .../suggestions/assoc-ct-for-assoc-method.stderr | 2 +- tests/ui/suggestions/borrow-for-loop-head.stderr | 2 + tests/ui/suggestions/boxed-variant-field.stderr | 2 +- tests/ui/suggestions/call-boxed.stderr | 2 +- .../chain-method-call-mutation-in-place.stderr | 2 +- ...one-on-unconstrained-borrowed-type-param.stderr | 2 +- tests/ui/suggestions/const-in-struct-pat.stderr | 2 +- tests/ui/suggestions/constrain-suggest-ice.rs | 10 +- tests/ui/suggestions/constrain-suggest-ice.stderr | 61 +-- tests/ui/suggestions/copied-and-cloned.stderr | 8 +- ...t-suggest-deref-inside-macro-issue-58298.stderr | 2 +- .../hidden-child.stderr | 2 +- .../hidden-parent.stderr | 2 +- .../expected-boxed-future-isnt-pinned.stderr | 8 +- tests/ui/suggestions/field-access.stderr | 8 +- .../fn-or-tuple-struct-without-args.stderr | 14 +- tests/ui/suggestions/format-borrow.stderr | 8 +- tests/ui/suggestions/if-then-neeing-semi.rs | 26 +- tests/ui/suggestions/if-then-neeing-semi.stderr | 46 +- ...m-ref-trait-object-literal-bound-regions.stderr | 2 +- ...-on-dyn-trait-with-implicit-static-bound.stderr | 8 +- tests/ui/suggestions/into-convert.stderr | 6 +- tests/ui/suggestions/issue-101065.stderr | 2 +- tests/ui/suggestions/issue-101421.rs | 2 +- tests/ui/suggestions/issue-101421.stderr | 4 +- tests/ui/suggestions/issue-101465.stderr | 2 +- tests/ui/suggestions/issue-101984.stderr | 2 +- tests/ui/suggestions/issue-102892.stderr | 6 +- tests/ui/suggestions/issue-104287.rs | 2 +- tests/ui/suggestions/issue-104287.stderr | 4 +- tests/ui/suggestions/issue-104961.fixed | 16 + tests/ui/suggestions/issue-104961.rs | 16 + tests/ui/suggestions/issue-104961.stderr | 37 ++ tests/ui/suggestions/issue-105494.stderr | 8 +- .../issue-106443-sugg-clone-for-arg.stderr | 4 +- tests/ui/suggestions/issue-52820.stderr | 4 +- tests/ui/suggestions/issue-53692.stderr | 4 +- tests/ui/suggestions/issue-59819.stderr | 4 +- tests/ui/suggestions/issue-81839.stderr | 10 +- tests/ui/suggestions/issue-83943.stderr | 2 +- tests/ui/suggestions/issue-84973.stderr | 2 +- tests/ui/suggestions/issue-85347.rs | 2 +- tests/ui/suggestions/issue-85347.stderr | 2 +- .../issue-86100-tuple-paren-comma.stderr | 6 +- tests/ui/suggestions/issue-89064.stderr | 8 +- .../issue-90213-expected-boxfuture-self-ice.stderr | 2 +- .../late-bound-in-borrow-closure-sugg.rs | 28 + .../late-bound-in-borrow-closure-sugg.stderr | 26 + .../missing-lifetimes-in-signature.stderr | 4 +- tests/ui/suggestions/match-ergonomics.stderr | 6 +- .../ui/suggestions/match-prev-arm-needing-semi.rs | 26 +- .../suggestions/match-prev-arm-needing-semi.stderr | 46 +- ...ferent-arm-types-as-stmt-instead-of-expr.stderr | 4 +- .../method-access-to-range-literal-typo.stderr | 4 +- tests/ui/suggestions/missing-lifetime-specifier.rs | 20 +- .../suggestions/missing-lifetime-specifier.stderr | 20 +- .../missing-type-param-used-in-param.stderr | 2 +- .../move-generic-to-trait-in-method-with-params.rs | 2 +- ...e-generic-to-trait-in-method-with-params.stderr | 4 +- tests/ui/suggestions/mut-ref-reassignment.stderr | 8 +- tests/ui/suggestions/opaque-type-error.stderr | 8 +- tests/ui/suggestions/option-content-move2.stderr | 2 +- tests/ui/suggestions/option-to-bool.stderr | 2 +- .../recover-from-semicolon-trailing-item.stderr | 4 +- .../suggestions/recover-invalid-float-invalid.rs | 24 + .../recover-invalid-float-invalid.stderr | 26 + tests/ui/suggestions/ref-pattern-binding.stderr | 8 +- .../suggestions/restrict-existing-type-bounds.rs | 30 ++ .../restrict-existing-type-bounds.stderr | 57 +++ tests/ui/suggestions/return-bindings.stderr | 12 +- .../ui/suggestions/shadowed-lplace-method-2.stderr | 2 +- tests/ui/suggestions/shadowed-lplace-method.stderr | 2 +- tests/ui/suggestions/sugg-else-for-closure.stderr | 2 +- tests/ui/suggestions/suggest-box.stderr | 2 +- .../ui/suggestions/suggest-call-on-pat-mismatch.rs | 16 + .../suggest-call-on-pat-mismatch.stderr | 33 ++ .../suggest-fn-ptr-for-fn-item-in-fn-ret.fixed | 12 + .../suggest-fn-ptr-for-fn-item-in-fn-ret.rs | 12 + .../suggest-fn-ptr-for-fn-item-in-fn-ret.stderr | 12 + ...ggest-full-enum-variant-for-local-module.stderr | 2 +- tests/ui/suggestions/suggest-remove-deref.fixed | 28 + tests/ui/suggestions/suggest-remove-deref.rs | 28 + tests/ui/suggestions/suggest-remove-deref.stderr | 43 ++ .../suggestions/suggest-trait-in-ufcs-in-hrtb.rs | 8 + .../suggest-trait-in-ufcs-in-hrtb.stderr | 9 + tests/ui/suggestions/suggest-using-chars.stderr | 4 +- tests/ui/suggestions/trait-hidden-method.rs | 11 + tests/ui/suggestions/trait-hidden-method.stderr | 24 + ...with-missing-associated-type-restriction.stderr | 2 +- .../type-ascription-instead-of-path-in-type.stderr | 2 +- tests/ui/suggestions/type-mismatch-byte-literal.rs | 12 + .../suggestions/type-mismatch-byte-literal.stderr | 45 +- ...necessary_dot_for_floating_point_literal.stderr | 8 +- .../use-type-argument-instead-of-assoc-type.rs | 2 +- .../use-type-argument-instead-of-assoc-type.stderr | 2 +- tests/ui/suppressed-error.rs | 2 +- tests/ui/suppressed-error.stderr | 2 +- tests/ui/switched-expectations.stderr | 2 +- tests/ui/symbol-names/basic.legacy.stderr | 4 +- tests/ui/symbol-names/issue-60925.legacy.stderr | 4 +- tests/ui/sync/mutexguard-sync.rs | 13 + tests/ui/sync/mutexguard-sync.stderr | 20 + tests/ui/sync/suggest-cell.rs | 31 ++ tests/ui/sync/suggest-cell.stderr | 59 +++ tests/ui/sync/suggest-once-cell.rs | 12 + tests/ui/sync/suggest-once-cell.stderr | 17 + tests/ui/sync/suggest-ref-cell.rs | 12 + tests/ui/sync/suggest-ref-cell.stderr | 17 + tests/ui/tag-that-dare-not-speak-its-name.rs | 2 +- tests/ui/tag-that-dare-not-speak-its-name.stderr | 2 +- tests/ui/terr-in-field.rs | 2 +- tests/ui/terr-in-field.stderr | 2 +- tests/ui/terr-sorts.stderr | 2 +- tests/ui/thir-print/thir-flat.rs | 4 + tests/ui/thir-print/thir-flat.stdout | 59 +++ tests/ui/thir-print/thir-tree-match.rs | 23 + tests/ui/thir-print/thir-tree-match.stdout | 342 +++++++++++++ tests/ui/thir-print/thir-tree.rs | 4 + tests/ui/thir-print/thir-tree.stdout | 43 ++ tests/ui/thir-tree.rs | 4 - tests/ui/thir-tree.stdout | 56 -- tests/ui/thread-local/tls.rs | 1 + tests/ui/tool-attributes/auxiliary/p1.rs | 3 + tests/ui/tool-attributes/auxiliary/p2.rs | 3 + tests/ui/tool-attributes/duplicate-diagnostic.rs | 13 + .../ui/tool-attributes/duplicate-diagnostic.stderr | 14 + tests/ui/track-diagnostics/track4.stderr | 2 +- tests/ui/traits/alias/ambiguous.stderr | 4 +- .../issue-107747-do-not-assemble-supertraits.rs | 21 + .../alias/issue-108072-unmet-trait-alias-bound.rs | 11 + .../issue-108072-unmet-trait-alias-bound.stderr | 19 + ...8132-unmet-trait-alias-bound-on-generic-impl.rs | 15 + ...-unmet-trait-alias-bound-on-generic-impl.stderr | 25 + tests/ui/traits/alias/issue-60755.rs | 12 + tests/ui/traits/alias/self-in-generics.rs | 4 - tests/ui/traits/alias/self-in-generics.stderr | 2 +- .../check-trait-object-bounds-3.stderr | 2 + tests/ui/traits/coercion-generic-regions.stderr | 2 + .../supertrait-auto-trait.stderr | 2 +- tests/ui/traits/issue-103563.rs | 75 +++ tests/ui/traits/issue-52893.stderr | 4 +- tests/ui/traits/issue-68295.stderr | 2 +- tests/ui/traits/issue-77982.stderr | 6 +- tests/ui/traits/item-privacy.rs | 4 +- tests/ui/traits/item-privacy.stderr | 12 +- tests/ui/traits/method-private.stderr | 6 +- .../traits/multidispatch-convert-ambig-dest.stderr | 2 +- .../negated-auto-traits-error.stderr | 4 +- tests/ui/traits/negative-impls/no-items.stderr | 2 +- .../alias_eq_cant_be_furthur_normalized.rs | 29 ++ ...alias_eq_dont_use_normalizes_to_if_substs_eq.rs | 45 ++ ...s_eq_dont_use_normalizes_to_if_substs_eq.stderr | 9 + tests/ui/traits/new-solver/alias_eq_simple.rs | 22 + .../alias_eq_substs_eq_not_intercrate.rs | 20 + .../alias_eq_substs_eq_not_intercrate.stderr | 9 + tests/ui/traits/new-solver/async.fail.stderr | 17 + tests/ui/traits/new-solver/async.rs | 19 + .../new-solver/builtin-fn-must-return-sized.rs | 17 + .../new-solver/builtin-fn-must-return-sized.stderr | 18 + .../ui/traits/new-solver/elaborate-item-bounds.rs | 12 + tests/ui/traits/new-solver/fn-trait-closure.rs | 9 +- tests/ui/traits/new-solver/generator.fail.stderr | 64 +++ tests/ui/traits/new-solver/generator.rs | 32 ++ .../traits/new-solver/higher-ranked-dyn-bounds.rs | 17 + tests/ui/traits/new-solver/more-object-bound.rs | 27 + .../ui/traits/new-solver/more-object-bound.stderr | 19 + ...rmalizes_to_ignores_unnormalizable_candidate.rs | 40 ++ ...ores_unnormalizable_candidate.self_infer.stderr | 14 + tests/ui/traits/new-solver/object-unsafety.rs | 20 + tests/ui/traits/new-solver/object-unsafety.stderr | 19 + .../param-candidate-doesnt-shadow-project.rs | 25 + tests/ui/traits/new-solver/pointee.rs | 23 + tests/ui/traits/new-solver/pointer-like.rs | 14 + tests/ui/traits/new-solver/pointer-like.stderr | 24 + tests/ui/traits/new-solver/pointer-sized.rs | 12 - tests/ui/traits/new-solver/pointer-sized.stderr | 24 - .../traits/new-solver/provisional-result-done.rs | 33 ++ tests/ui/traits/new-solver/temporary-ambiguity.rs | 22 + tests/ui/traits/new-solver/try-example.rs | 28 + ...wo-projection-param-candidates-are-ambiguous.rs | 30 ++ ...rojection-param-candidates-are-ambiguous.stderr | 16 + .../ui/traits/new-solver/unsafe-auto-trait-impl.rs | 8 + tests/ui/traits/new-solver/unsize-good.rs | 25 + tests/ui/traits/new-solver/upcast-right-substs.rs | 14 + tests/ui/traits/new-solver/upcast-wrong-substs.rs | 13 + .../traits/new-solver/upcast-wrong-substs.stderr | 14 + .../traits/non_lifetime_binders/bad-sized-cond.rs | 23 + .../non_lifetime_binders/bad-sized-cond.stderr | 62 +++ tests/ui/traits/non_lifetime_binders/basic.rs | 19 + tests/ui/traits/non_lifetime_binders/basic.stderr | 11 + tests/ui/traits/non_lifetime_binders/fail.rs | 23 + tests/ui/traits/non_lifetime_binders/fail.stderr | 43 ++ .../non_lifetime_binders/late-bound-in-anon-ct.rs | 11 + .../late-bound-in-anon-ct.stderr | 27 + .../object-lifetime-default-for-late.rs | 7 + .../object-lifetime-default-for-late.stderr | 11 + tests/ui/traits/non_lifetime_binders/on-dyn.rs | 13 + tests/ui/traits/non_lifetime_binders/on-dyn.stderr | 17 + tests/ui/traits/non_lifetime_binders/on-ptr.rs | 13 + tests/ui/traits/non_lifetime_binders/on-ptr.stderr | 17 + .../type-match-with-late-bound.rs | 14 + .../type-match-with-late-bound.stderr | 11 + .../object/enforce-supertrait-projection.stderr | 2 +- tests/ui/traits/object/vs-lifetime.rs | 4 +- tests/ui/traits/object/vs-lifetime.stderr | 4 +- .../traits/suggest-deferences/issue-39029.stderr | 4 +- tests/ui/traits/test-2.rs | 4 +- tests/ui/traits/test-2.stderr | 8 +- tests/ui/traits/trait-or-new-type-instead.stderr | 7 +- .../multiple_supertrait_upcastable.rs | 10 + .../multiple_supertrait_upcastable.stderr | 14 + tests/ui/traits/unsend-future.rs | 21 + tests/ui/traits/unsend-future.stderr | 24 + tests/ui/traits/vtable/issue-97381.stderr | 3 + .../should_require_well_defined_layout.stderr | 12 +- ...imitive_reprs_should_have_correct_length.stderr | 40 +- .../repr/should_require_well_defined_layout.stderr | 12 +- .../enums/should_pad_variants.stderr | 2 +- .../enums/should_respect_endianness.stderr | 2 +- tests/ui/transmutability/issue-101739-1.stderr | 2 +- tests/ui/transmutability/issue-101739-2.rs | 2 +- tests/ui/transmutability/issue-101739-2.stderr | 2 +- tests/ui/transmutability/primitives/bool.stderr | 2 +- tests/ui/transmutability/primitives/numbers.stderr | 114 ++--- tests/ui/transmutability/primitives/unit.stderr | 2 +- tests/ui/transmutability/references.stderr | 2 +- .../repr/should_require_well_defined_layout.stderr | 24 +- .../repr/should_require_well_defined_layout.stderr | 4 +- .../unions/should_pad_variants.stderr | 2 +- .../unions/should_reject_contraction.stderr | 2 +- .../unions/should_reject_disjoint.stderr | 4 +- .../unions/should_reject_intersecting.stderr | 4 +- .../should_reject_if_dst_has_private_field.stderr | 2 +- ...should_reject_if_dst_has_private_variant.stderr | 2 +- ...ould_reject_if_dst_has_unreachable_field.stderr | 2 +- .../should_reject_if_dst_has_unreachable_ty.stderr | 2 +- tests/ui/transmute/transmute-padding-ice.stderr | 2 +- tests/ui/treat-err-as-bug/delay_span_bug.stderr | 2 +- tests/ui/treat-err-as-bug/err.stderr | 2 +- tests/ui/try-block/try-block-bad-lifetime.stderr | 9 +- .../try-block/try-block-maybe-bad-lifetime.stderr | 8 +- tests/ui/tuple/add-tuple-within-arguments.stderr | 2 +- tests/ui/tuple/wrong_argument_ice-3.stderr | 11 +- tests/ui/tuple/wrong_argument_ice-4.stderr | 9 +- tests/ui/tuple/wrong_argument_ice.stderr | 2 +- .../enum-variant-generic-args.rs | 12 +- .../enum-variant-generic-args.stderr | 12 +- ...iant-priority-higher-than-other-inherent.stderr | 2 +- .../ui/type-alias-impl-trait/bounds-are-checked.rs | 3 +- .../bounds-are-checked.stderr | 15 +- .../generic_nondefining_use.rs | 2 +- .../generic_nondefining_use.stderr | 2 +- .../generic_type_does_not_live_long_enough.rs | 2 +- .../generic_type_does_not_live_long_enough.stderr | 2 +- .../implied_lifetime_wf_check3.rs | 3 - .../implied_lifetime_wf_check3.stderr | 34 +- .../imply_bounds_from_bounds_param.stderr | 4 +- tests/ui/type-alias-impl-trait/issue-63279.rs | 2 - tests/ui/type-alias-impl-trait/issue-63279.stderr | 12 +- .../issue-65679-inst-opaque-ty-from-val-twice.rs | 1 - tests/ui/type-alias-impl-trait/issue-98604.rs | 2 +- tests/ui/type-alias-impl-trait/issue-98604.stderr | 11 +- tests/ui/type-alias-impl-trait/issue-98608.rs | 2 +- tests/ui/type-alias-impl-trait/issue-98608.stderr | 4 +- .../ui/type-alias-impl-trait/match-unification.rs | 14 + .../missing_lifetime_bound.stderr | 2 + .../type-alias-impl-trait-fn-type.stderr | 2 +- .../type-alias-impl-trait/unnameable_type.stderr | 2 +- tests/ui/type-inference/issue-30225.stderr | 2 +- tests/ui/type-inference/sort_by_key.stderr | 2 +- tests/ui/type/issue-91268.rs | 4 - tests/ui/type/issue-91268.stderr | 55 +- .../type-ascription-instead-of-initializer.stderr | 9 +- tests/ui/type/type-ascription-precedence.stderr | 12 +- tests/ui/type/type-ascription-soundness.stderr | 8 +- tests/ui/type/type-check/assignment-in-if.stderr | 9 + .../type-check/cannot_infer_local_or_vec.stderr | 6 +- .../cannot_infer_local_or_vec_in_tuples.stderr | 6 +- .../type-check/coerce-result-return-value-2.rs | 24 + .../type-check/coerce-result-return-value-2.stderr | 47 ++ .../type-check/coerce-result-return-value.fixed | 24 + .../type/type-check/coerce-result-return-value.rs | 24 + .../type-check/coerce-result-return-value.stderr | 65 +++ .../ui/type/type-check/point-at-inference-2.stderr | 11 +- .../ui/type/type-check/point-at-inference-3.fixed | 3 +- tests/ui/type/type-check/point-at-inference-3.rs | 3 +- .../ui/type/type-check/point-at-inference-3.stderr | 7 +- tests/ui/type/type-check/point-at-inference-4.rs | 21 + .../ui/type/type-check/point-at-inference-4.stderr | 31 ++ tests/ui/type/type-check/point-at-inference.fixed | 13 + tests/ui/type/type-check/point-at-inference.rs | 1 + tests/ui/type/type-check/point-at-inference.stderr | 13 +- tests/ui/type/type-mismatch-same-crate-name.rs | 2 +- tests/ui/type/type-mismatch-same-crate-name.stderr | 8 +- tests/ui/type/type-mismatch.stderr | 94 ++-- ...rong-call-return-type-due-to-generic-arg.stderr | 2 +- tests/ui/typeck/assign-non-lval-derefmut.stderr | 2 +- tests/ui/typeck/bad-type-in-vec-contains.rs | 7 + tests/ui/typeck/bad-type-in-vec-contains.stderr | 19 + tests/ui/typeck/bad-type-in-vec-push.rs | 20 + tests/ui/typeck/bad-type-in-vec-push.stderr | 29 ++ tests/ui/typeck/conversion-methods.stderr | 8 +- tests/ui/typeck/deref-multi.stderr | 2 +- tests/ui/typeck/explain_clone_autoref.rs | 2 +- tests/ui/typeck/explain_clone_autoref.stderr | 2 +- tests/ui/typeck/issue-100246.stderr | 2 +- tests/ui/typeck/issue-104513-ice.stderr | 2 +- tests/ui/typeck/issue-107087.rs | 18 + tests/ui/typeck/issue-107087.stderr | 9 + tests/ui/typeck/issue-107775.rs | 40 ++ tests/ui/typeck/issue-107775.stderr | 16 + tests/ui/typeck/issue-13853.stderr | 4 +- tests/ui/typeck/issue-31173.stderr | 15 +- tests/ui/typeck/issue-46112.stderr | 2 +- tests/ui/typeck/issue-50687-ice-on-borrow.stderr | 2 +- tests/ui/typeck/issue-53712.rs | 9 + tests/ui/typeck/issue-53712.stderr | 11 + .../issue-57673-ice-on-deref-of-boxed-trait.stderr | 2 +- tests/ui/typeck/issue-67971.stderr | 2 +- tests/ui/typeck/issue-75883.rs | 4 +- tests/ui/typeck/issue-75883.stderr | 4 +- tests/ui/typeck/issue-7813.rs | 4 + tests/ui/typeck/issue-7813.stderr | 14 + tests/ui/typeck/issue-84160.stderr | 2 +- tests/ui/typeck/issue-84768.stderr | 4 +- tests/ui/typeck/issue-89856.fixed | 18 + tests/ui/typeck/issue-89856.rs | 14 +- tests/ui/typeck/issue-89856.stderr | 54 +- .../issue-90027-async-fn-return-suggestion.rs | 21 + .../issue-90027-async-fn-return-suggestion.stderr | 39 ++ tests/ui/typeck/issue-91334.rs | 3 - tests/ui/typeck/issue-91334.stderr | 47 +- tests/ui/typeck/issue-91450-inner-ty-error.stderr | 2 +- tests/ui/typeck/issue-92481.rs | 9 +- tests/ui/typeck/issue-92481.stderr | 61 +-- tests/ui/typeck/issue-96530.stderr | 2 +- .../lazy-norm/cast-checks-handling-projections.rs | 6 + .../cast-checks-handling-projections.stderr | 9 + .../lazy-norm/equating-projection-cyclically.rs | 24 + .../equating-projection-cyclically.stderr | 14 + tests/ui/typeck/remove-extra-argument.stderr | 9 +- tests/ui/typeck/return_type_containing_closure.rs | 2 +- .../typeck/return_type_containing_closure.stderr | 2 +- tests/ui/typeck/struct-enum-wrong-args.stderr | 36 +- .../typeck/typeck-builtin-bound-type-parameters.rs | 12 +- .../typeck-builtin-bound-type-parameters.stderr | 12 +- tests/ui/typeck/typeck_type_placeholder_item.rs | 4 +- .../ui/typeck/typeck_type_placeholder_item.stderr | 34 +- .../typeck/typeck_type_placeholder_lifetime_1.rs | 2 +- .../typeck_type_placeholder_lifetime_1.stderr | 2 +- .../typeck/typeck_type_placeholder_lifetime_2.rs | 2 +- .../typeck_type_placeholder_lifetime_2.stderr | 2 +- .../ui/typeck/typeck_type_placeholder_mismatch.rs | 4 +- .../typeck/typeck_type_placeholder_mismatch.stderr | 4 +- tests/ui/ufcs/ufcs-qpath-missing-params.rs | 2 +- tests/ui/ufcs/ufcs-qpath-missing-params.stderr | 4 +- tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr | 4 +- .../unboxed-closure-sugar-region.rs | 2 +- .../unboxed-closure-sugar-region.stderr | 2 +- .../unboxed-closure-sugar-used-on-struct-1.rs | 2 +- .../unboxed-closure-sugar-used-on-struct-1.stderr | 2 +- .../unboxed-closure-sugar-used-on-struct.rs | 2 +- .../unboxed-closure-sugar-used-on-struct.stderr | 2 +- ...-sugar-wrong-number-number-type-parameters-3.rs | 2 +- ...ar-wrong-number-number-type-parameters-3.stderr | 2 +- ...re-sugar-wrong-number-number-type-parameters.rs | 10 +- ...ugar-wrong-number-number-type-parameters.stderr | 10 +- .../unboxed-closure-sugar-wrong-trait.rs | 2 +- .../unboxed-closure-sugar-wrong-trait.stderr | 2 +- .../unboxed-closures-borrow-conflict.stderr | 2 +- .../unboxed-closures-failed-recursive-fn-1.stderr | 8 +- ...sures-infer-fn-once-move-from-projection.stderr | 2 +- ...unboxed-closures-static-call-wrong-trait.stderr | 2 +- tests/ui/uninhabited/issue-107505.rs | 18 + tests/ui/union/projection-as-union-type-error-2.rs | 20 + .../union/projection-as-union-type-error-2.stderr | 17 + tests/ui/union/projection-as-union-type-error.rs | 15 + .../ui/union/projection-as-union-type-error.stderr | 9 + tests/ui/union/projection-as-union-type.rs | 19 + tests/ui/unop-move-semantics.stderr | 5 + tests/ui/unpretty/ast-const-trait-bound.rs | 4 + tests/ui/unpretty/ast-const-trait-bound.stdout | 4 + tests/ui/unsized-locals/suggest-borrow.stderr | 4 +- tests/ui/unsized/box-instead-of-dyn-fn.stderr | 2 +- tests/ui/unsized/issue-71659.stderr | 2 +- .../param-mentioned-by-different-field.stderr | 2 +- tests/ui/unsized/unsized3-rpass.rs | 4 +- tests/ui/variance/variance-associated-types.rs | 2 +- tests/ui/variance/variance-associated-types.stderr | 2 +- tests/ui/variance/variance-issue-20533.stderr | 6 + tests/ui/variance/variance-regions-direct.rs | 12 +- tests/ui/variance/variance-regions-direct.stderr | 12 +- tests/ui/variance/variance-regions-indirect.rs | 8 +- tests/ui/variance/variance-regions-indirect.stderr | 8 +- tests/ui/variance/variance-trait-object-bound.rs | 2 +- .../ui/variance/variance-trait-object-bound.stderr | 2 +- tests/ui/variance/variance-types.rs | 2 +- tests/ui/variance/variance-types.stderr | 2 +- tests/ui/wait-forked-but-failed-child.rs | 1 + tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs | 2 +- .../wf/wf-in-foreign-fn-decls-issue-80468.stderr | 25 +- tests/ui/wf/wf-unsafe-trait-obj-match.stderr | 2 +- .../higher-ranked-fn-type.quiet.stderr | 2 +- .../higher-ranked-fn-type.verbose.stderr | 2 +- .../where-clauses/self-in-where-clause-allowed.rs | 23 + .../self-in-where-clause-allowed.stderr | 15 + tests/ui/while/while-else-err.rs | 8 + tests/ui/while/while-else-err.stderr | 17 + tests/ui/while/while-else-let-else-err.rs | 8 + tests/ui/while/while-else-let-else-err.stderr | 17 + tests/ui/wrong-mul-method-signature.stderr | 6 +- tests/ui/xc-private-method2.rs | 4 +- tests/ui/xc-private-method2.stderr | 12 +- 2119 files changed, 23433 insertions(+), 8948 deletions(-) create mode 100644 tests/ui/associated-inherent-types/ambiguity.rs create mode 100644 tests/ui/associated-inherent-types/ambiguity.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.rs create mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/inference-fail.rs create mode 100644 tests/ui/associated-inherent-types/bugs/inference-fail.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs create mode 100644 tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs create mode 100644 tests/ui/associated-inherent-types/dispatch-on-self-type-1.rs create mode 100644 tests/ui/associated-inherent-types/dispatch-on-self-type-2.rs create mode 100644 tests/ui/associated-inherent-types/dispatch-on-self-type-2.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-self-type-differs.rs create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.rs create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.rs create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.rs create mode 100644 tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr delete mode 100644 tests/ui/associated-inherent-types/struct-generics.rs create mode 100644 tests/ui/associated-inherent-types/substitute-params-bad.rs create mode 100644 tests/ui/associated-inherent-types/substitute-params-bad.stderr create mode 100644 tests/ui/associated-inherent-types/substitute-params.rs create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr create mode 100644 tests/ui/associated-types/issue-38821.rs create mode 100644 tests/ui/associated-types/issue-38821.stderr create mode 100644 tests/ui/async-await/async-await-let-else.drop_tracking.stderr create mode 100644 tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/async-error-span.drop_tracking.stderr create mode 100644 tests/ui/async-await/async-error-span.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/async-error-span.no_drop_tracking.stderr delete mode 100644 tests/ui/async-await/async-error-span.stderr create mode 100644 tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr create mode 100644 tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr create mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr delete mode 100644 tests/ui/async-await/drop-track-field-assign-nonsend.stderr create mode 100644 tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr create mode 100644 tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/field-assign-nonsend.rs create mode 100644 tests/ui/async-await/field-assign.rs create mode 100644 tests/ui/async-await/future-sizes/async-awaiting-fut.rs create mode 100644 tests/ui/async-await/future-sizes/async-awaiting-fut.stdout create mode 100644 tests/ui/async-await/future-sizes/future-as-arg.rs create mode 100644 tests/ui/async-await/future-sizes/large-arg.rs create mode 100644 tests/ui/async-await/future-sizes/large-arg.stdout create mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.rs create mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.stderr create mode 100644 tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs create mode 100644 tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr create mode 100644 tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr delete mode 100644 tests/ui/async-await/issue-67252-unnamed-future.stderr create mode 100644 tests/ui/async-await/issue-68112.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-70818.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-70818.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-70818.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-86507.drop_tracking.stderr create mode 100644 tests/ui/async-await/issue-86507.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/issue-86507.no_drop_tracking.stderr delete mode 100644 tests/ui/async-await/issue-86507.stderr create mode 100644 tests/ui/async-await/issues/issue-107280.rs create mode 100644 tests/ui/async-await/issues/issue-107280.stderr create mode 100644 tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs create mode 100644 tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr create mode 100644 tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr create mode 100644 tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr create mode 100644 tests/ui/async-await/send-bound-async-closure.rs create mode 100644 tests/ui/async-await/unresolved_type_param.drop_tracking.stderr create mode 100644 tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr create mode 100644 tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr create mode 100644 tests/ui/attributes/invalid_macro_export_argument.rs create mode 100644 tests/ui/attributes/invalid_macro_export_argument.stderr create mode 100644 tests/ui/attributes/rustc-box.rs create mode 100644 tests/ui/attributes/rustc-box.stderr create mode 100644 tests/ui/auto-traits/str-contains-slice-conceptually.rs create mode 100644 tests/ui/auto-traits/str-contains-slice-conceptually.stderr create mode 100644 tests/ui/borrowck/issue-83924.fixed create mode 100644 tests/ui/borrowck/issue-83924.rs create mode 100644 tests/ui/borrowck/issue-83924.stderr create mode 100644 tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.fixed create mode 100644 tests/ui/closures/binder/const-bound.rs create mode 100644 tests/ui/closures/binder/const-bound.stderr create mode 100644 tests/ui/closures/binder/type-bound-2.rs create mode 100644 tests/ui/closures/binder/type-bound-2.stderr create mode 100644 tests/ui/closures/binder/type-bound.rs create mode 100644 tests/ui/closures/binder/type-bound.stderr create mode 100644 tests/ui/coinduction/canonicalization-rerun.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_1.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_2.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs create mode 100644 tests/ui/const-generics/issues/issue-105821.rs create mode 100644 tests/ui/const-generics/wrong-normalization.rs create mode 100644 tests/ui/const-generics/wrong-normalization.stderr create mode 100644 tests/ui/consts/array-literal-len-mismatch.rs create mode 100644 tests/ui/consts/array-literal-len-mismatch.stderr create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.rs create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-recursion.rs create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs create mode 100644 tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.stderr create mode 100644 tests/ui/consts/const-eval/stable-metric/dominators-edge-case.rs create mode 100644 tests/ui/consts/gate-do-not-const-check.rs create mode 100644 tests/ui/consts/gate-do-not-const-check.stderr create mode 100644 tests/ui/consts/issue-33903.rs create mode 100644 tests/ui/consts/issue-54582.rs create mode 100644 tests/ui/derives/deriving-with-repr-packed-2.rs create mode 100644 tests/ui/derives/deriving-with-repr-packed-2.stderr create mode 100644 tests/ui/deriving/deriving-all-codegen.stderr create mode 100644 tests/ui/diagnostic-flags/terminal_urls.rs create mode 100644 tests/ui/diagnostic-flags/terminal_urls.stderr create mode 100644 tests/ui/did_you_mean/println-typo.rs create mode 100644 tests/ui/did_you_mean/println-typo.stderr create mode 100644 tests/ui/drop/issue-2735-2.rs create mode 100644 tests/ui/drop/issue-2735-3.rs create mode 100644 tests/ui/drop/issue-2735.rs create mode 100644 tests/ui/dyn-star/llvm-old-style-ptrs.rs create mode 100644 tests/ui/error-codes/E0476.rs create mode 100644 tests/ui/error-codes/E0476.stderr create mode 100644 tests/ui/error-codes/E0523.rs create mode 100644 tests/ui/error-codes/E0523.stderr create mode 100644 tests/ui/error-codes/E0789.rs create mode 100644 tests/ui/error-codes/E0789.stderr create mode 100644 tests/ui/errors/trait-bound-error-spans/blame-trait-error.rs create mode 100644 tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr create mode 100644 tests/ui/errors/traits/blame-trait-error-spans-on-exprs.rs create mode 100644 tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr create mode 100644 tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.rs create mode 100644 tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr create mode 100644 tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs create mode 100644 tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr create mode 100644 tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.rs create mode 100644 tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr create mode 100644 tests/ui/feature-gates/feature-gate-non_lifetime_binders.rs create mode 100644 tests/ui/feature-gates/feature-gate-non_lifetime_binders.stderr create mode 100644 tests/ui/fmt/format-string-wrong-order.rs create mode 100644 tests/ui/fmt/format-string-wrong-order.stderr create mode 100644 tests/ui/fmt/issue-75307.rs create mode 100644 tests/ui/fmt/issue-75307.stderr create mode 100644 tests/ui/fn/fn-pointer-mismatch.rs create mode 100644 tests/ui/fn/fn-pointer-mismatch.stderr create mode 100644 tests/ui/for/for-else-err.rs create mode 100644 tests/ui/for/for-else-err.stderr create mode 100644 tests/ui/for/for-else-let-else-err.rs create mode 100644 tests/ui/for/for-else-let-else-err.stderr create mode 100644 tests/ui/generator/auto-trait-regions.drop_tracking.stderr create mode 100644 tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr create mode 100644 tests/ui/generator/borrowing.drop_tracking.stderr create mode 100644 tests/ui/generator/borrowing.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/borrowing.no_drop_tracking.stderr create mode 100644 tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr create mode 100644 tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/drop-tracking-parent-expression.stderr create mode 100644 tests/ui/generator/issue-105084.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/issue-105084.rs create mode 100644 tests/ui/generator/issue-57017.no_drop_tracking.stderr create mode 100644 tests/ui/generator/issue-57478.no_drop_tracking.stderr create mode 100644 tests/ui/generator/issue-68112.drop_tracking.stderr create mode 100644 tests/ui/generator/issue-68112.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/issue-68112.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/issue-68112.stderr create mode 100644 tests/ui/generator/not-send-sync.drop_tracking.stderr create mode 100644 tests/ui/generator/not-send-sync.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/not-send-sync.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/not-send-sync.stderr create mode 100644 tests/ui/generator/parent-expression.drop_tracking.stderr create mode 100644 tests/ui/generator/parent-expression.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/parent-expression.no_drop_tracking.stderr create mode 100644 tests/ui/generator/parent-expression.rs create mode 100644 tests/ui/generator/partial-drop.drop_tracking.stderr create mode 100644 tests/ui/generator/partial-drop.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/partial-drop.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/print/generator-print-verbose-1.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr delete mode 100644 tests/ui/generator/print/generator-print-verbose-2.stderr create mode 100644 tests/ui/generator/retain-resume-ref.drop_tracking.stderr create mode 100644 tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr create mode 100644 tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr create mode 100644 tests/ui/generic-associated-types/issue-88360.fixed delete mode 100644 tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs delete mode 100644 tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr create mode 100644 tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs create mode 100644 tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr delete mode 100644 tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs delete mode 100644 tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr create mode 100644 tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs create mode 100644 tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr create mode 100644 tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs create mode 100644 tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr create mode 100644 tests/ui/higher-rank-trait-bounds/issue-39292.rs delete mode 100644 tests/ui/impl-trait/equal-hidden-lifetimes.stderr create mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.rs create mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.stderr create mode 100644 tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs create mode 100644 tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr create mode 100644 tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr create mode 100644 tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr create mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr create mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr create mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr delete mode 100644 tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr create mode 100644 tests/ui/inference/array-len-mismatch.rs create mode 100644 tests/ui/inference/array-len-mismatch.stderr create mode 100644 tests/ui/inference/issue-107090.rs create mode 100644 tests/ui/inference/issue-107090.stderr create mode 100644 tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs create mode 100644 tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr create mode 100644 tests/ui/infinite/auxiliary/alias.rs create mode 100644 tests/ui/infinite/infinite-alias.rs create mode 100644 tests/ui/infinite/infinite-alias.stderr create mode 100644 tests/ui/instrument-xray/flags-always-never-1.rs create mode 100644 tests/ui/instrument-xray/flags-always-never-1.stderr create mode 100644 tests/ui/instrument-xray/flags-always-never-2.rs create mode 100644 tests/ui/instrument-xray/flags-basic.rs create mode 100644 tests/ui/instrument-xray/flags-dupe-always.rs create mode 100644 tests/ui/instrument-xray/flags-dupe-always.stderr create mode 100644 tests/ui/instrument-xray/flags-dupe-ignore-loops.rs create mode 100644 tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr create mode 100644 tests/ui/instrument-xray/target-not-supported.rs create mode 100644 tests/ui/instrument-xray/target-not-supported.stderr create mode 100644 tests/ui/io-checks/inaccessbile-temp-dir.rs create mode 100644 tests/ui/io-checks/inaccessbile-temp-dir.stderr create mode 100644 tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs create mode 100644 tests/ui/io-checks/non-ice-error-on-worker-io-fail.stderr create mode 100644 tests/ui/issues/issue-106755.rs create mode 100644 tests/ui/issues/issue-106755.stderr delete mode 100644 tests/ui/issues/issue-22536-copy-mustnt-zero.rs delete mode 100644 tests/ui/issues/issue-2735-2.rs delete mode 100644 tests/ui/issues/issue-2735-3.rs delete mode 100644 tests/ui/issues/issue-2735.rs delete mode 100644 tests/ui/issues/issue-27583.rs delete mode 100644 tests/ui/issues/issue-33903.rs delete mode 100644 tests/ui/issues/issue-38821.rs delete mode 100644 tests/ui/issues/issue-38821.stderr delete mode 100644 tests/ui/issues/issue-39292.rs delete mode 100644 tests/ui/issues/issue-40003.rs delete mode 100644 tests/ui/issues/issue-48179.rs delete mode 100644 tests/ui/issues/issue-50576.rs delete mode 100644 tests/ui/issues/issue-50576.stderr delete mode 100644 tests/ui/issues/issue-53712.rs delete mode 100644 tests/ui/issues/issue-53712.stderr delete mode 100644 tests/ui/issues/issue-54582.rs delete mode 100644 tests/ui/issues/issue-70093.rs create mode 100644 tests/ui/issues/issue-70093/issue-70093-link-directives.rs create mode 100644 tests/ui/issues/issue-70093/issue-70093.rs delete mode 100644 tests/ui/issues/issue-75307.rs delete mode 100644 tests/ui/issues/issue-75307.stderr delete mode 100644 tests/ui/issues/issue-75777.rs delete mode 100644 tests/ui/issues/issue-75777.stderr delete mode 100644 tests/ui/issues/issue-7813.rs delete mode 100644 tests/ui/issues/issue-7813.stderr delete mode 100644 tests/ui/issues/issue-83924.fixed delete mode 100644 tests/ui/issues/issue-83924.rs delete mode 100644 tests/ui/issues/issue-83924.stderr create mode 100644 tests/ui/issues/issue-92741.fixed create mode 100644 tests/ui/issues/issue-92741.rs create mode 100644 tests/ui/issues/issue-92741.stderr create mode 100644 tests/ui/lang-items/bad-add-impl.rs create mode 100644 tests/ui/lang-items/bad-add-impl.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr create mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr delete mode 100644 tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr delete mode 100644 tests/ui/lang-items/lang-item-missing-generator.rs delete mode 100644 tests/ui/lang-items/lang-item-missing-generator.stderr create mode 100644 tests/ui/let-else/accidental-if.rs create mode 100644 tests/ui/let-else/accidental-if.stderr create mode 100644 tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.fixed create mode 100644 tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs create mode 100644 tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.stderr create mode 100644 tests/ui/lifetimes/issue-104432-unused-lifetimes-in-expansion.rs create mode 100644 tests/ui/lifetimes/issue-107492-default-value-for-lifetime.rs create mode 100644 tests/ui/lifetimes/issue-107492-default-value-for-lifetime.stderr create mode 100644 tests/ui/lifetimes/issue-107988.rs create mode 100644 tests/ui/lifetimes/issue-107988.stderr create mode 100644 tests/ui/lifetimes/issue-69314.fixed create mode 100644 tests/ui/lifetimes/issue-69314.rs create mode 100644 tests/ui/lifetimes/issue-69314.stderr create mode 100644 tests/ui/lint/dead-code/in-closure.rs create mode 100644 tests/ui/lint/dead-code/in-closure.stderr create mode 100644 tests/ui/lint/invalid_value-polymorphic.rs create mode 100644 tests/ui/lint/issue-106991.rs create mode 100644 tests/ui/lint/issue-106991.stderr create mode 100644 tests/ui/lint/lint_map_unit_fn.rs create mode 100644 tests/ui/lint/lint_map_unit_fn.stderr create mode 100644 tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr create mode 100644 tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr create mode 100644 tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr create mode 100644 tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr create mode 100644 tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr create mode 100644 tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr create mode 100644 tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr create mode 100644 tests/ui/lint/unused/issue-103320-must-use-ops.rs create mode 100644 tests/ui/lint/unused/issue-103320-must-use-ops.stderr create mode 100644 tests/ui/lint/unused/issue-96606.rs create mode 100644 tests/ui/lint/unused/issue-96606.stderr create mode 100644 tests/ui/loops/issue-50576.rs create mode 100644 tests/ui/loops/issue-50576.stderr create mode 100644 tests/ui/loops/loop-else-break-with-value.rs create mode 100644 tests/ui/loops/loop-else-break-with-value.stderr create mode 100644 tests/ui/loops/loop-else-err.rs create mode 100644 tests/ui/loops/loop-else-err.stderr create mode 100644 tests/ui/loops/loop-else-let-else-err.rs create mode 100644 tests/ui/loops/loop-else-let-else-err.stderr create mode 100644 tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.rs create mode 100644 tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr create mode 100644 tests/ui/methods/method-not-found-but-doc-alias.rs create mode 100644 tests/ui/methods/method-not-found-but-doc-alias.stderr create mode 100644 tests/ui/mir/field-projection-invariant.rs create mode 100644 tests/ui/mir/field-projection-mutating-context.rs create mode 100644 tests/ui/mir/field-projection-mutating-context.stderr create mode 100644 tests/ui/mir/field-projection-mutating-context2.rs create mode 100644 tests/ui/mir/field-projection-mutating-context2.stderr create mode 100644 tests/ui/mir/field-ty-ascription-enums.rs create mode 100644 tests/ui/mir/field-ty-ascription.rs create mode 100644 tests/ui/mir/issue-107678-projection-with-lifetime.rs create mode 100644 tests/ui/mir/issue-107691.rs create mode 100644 tests/ui/mir/issue-109743.rs create mode 100644 tests/ui/mir/mir_codegen_ssa.rs create mode 100644 tests/ui/mir/validate/storage-live.rs create mode 100644 tests/ui/mir/validate/storage-live.stderr create mode 100644 tests/ui/modules/issue-107649.rs create mode 100644 tests/ui/modules/issue-107649.stderr create mode 100644 tests/ui/moves/issue-22536-copy-mustnt-zero.rs create mode 100644 tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed create mode 100644 tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs create mode 100644 tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr delete mode 100644 tests/ui/mutexguard-sync.rs delete mode 100644 tests/ui/mutexguard-sync.stderr create mode 100644 tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs create mode 100644 tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs create mode 100644 tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs create mode 100644 tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs create mode 100644 tests/ui/nll/issue-27583.rs create mode 100644 tests/ui/nll/issue-48179.rs create mode 100644 tests/ui/nll/issue-75777.rs create mode 100644 tests/ui/nll/issue-75777.stderr create mode 100644 tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs create mode 100644 tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr create mode 100644 tests/ui/nll/member-constraints/min-choice.rs create mode 100644 tests/ui/nll/member-constraints/nested-impl-trait-fail.rs create mode 100644 tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr create mode 100644 tests/ui/nll/member-constraints/nested-impl-trait-pass.rs delete mode 100644 tests/ui/non-ice-error-on-worker-io-fail.rs delete mode 100644 tests/ui/non-ice-error-on-worker-io-fail.stderr create mode 100644 tests/ui/numbers-arithmetic/issue-105626.rs delete mode 100644 tests/ui/packed/issue-27060-rpass.rs delete mode 100644 tests/ui/packed/issue-27060-rpass.stderr create mode 100644 tests/ui/parser/anon-enums-are-ambiguous.rs create mode 100644 tests/ui/parser/deli-ident-issue-1.rs create mode 100644 tests/ui/parser/deli-ident-issue-1.stderr create mode 100644 tests/ui/parser/deli-ident-issue-2.rs create mode 100644 tests/ui/parser/deli-ident-issue-2.stderr create mode 100644 tests/ui/parser/issue-107705.rs create mode 100644 tests/ui/parser/issue-107705.stderr create mode 100644 tests/ui/parser/issue-108495-dec.rs create mode 100644 tests/ui/parser/issue-108495-dec.stderr create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-1.rs create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-1.stderr create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-2.rs create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-2.stderr create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-3.rs create mode 100644 tests/ui/parser/issue-68987-unmatch-issue-3.stderr create mode 100644 tests/ui/parser/issue-68987-unmatch-issue.rs create mode 100644 tests/ui/parser/issue-68987-unmatch-issue.stderr create mode 100644 tests/ui/parser/issues/issue-104367.rs create mode 100644 tests/ui/parser/issues/issue-104367.stderr create mode 100644 tests/ui/parser/issues/issue-105209.rs create mode 100644 tests/ui/parser/issues/issue-105209.stderr create mode 100644 tests/ui/parser/issues/issue-69259.rs create mode 100644 tests/ui/parser/issues/issue-69259.stderr create mode 100644 tests/ui/parser/missing-expression-in-for-loop.rs create mode 100644 tests/ui/parser/missing-expression-in-for-loop.stderr create mode 100644 tests/ui/parser/raw/too-many-hash.rs create mode 100644 tests/ui/parser/raw/too-many-hash.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/enum.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/enum.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/enum.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/existing_generics.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-simple.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/struct.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/struct.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/struct.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/trait.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/trait.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/trait.stderr create mode 100644 tests/ui/parser/suggest_misplaced_generics/type.fixed create mode 100644 tests/ui/parser/suggest_misplaced_generics/type.rs create mode 100644 tests/ui/parser/suggest_misplaced_generics/type.stderr create mode 100644 tests/ui/parser/type-ascription-in-pattern.rs create mode 100644 tests/ui/parser/type-ascription-in-pattern.stderr create mode 100644 tests/ui/proc-macro/allowed-signatures.rs create mode 100644 tests/ui/proc-macro/proc-macro-abi.rs create mode 100644 tests/ui/proc-macro/proc-macro-abi.stderr create mode 100644 tests/ui/proc-macro/signature-proc-macro-attribute.rs create mode 100644 tests/ui/proc-macro/signature-proc-macro-attribute.stderr create mode 100644 tests/ui/proc-macro/signature-proc-macro-derive.rs create mode 100644 tests/ui/proc-macro/signature-proc-macro-derive.stderr create mode 100644 tests/ui/proc-macro/signature-proc-macro.rs create mode 100644 tests/ui/proc-macro/signature-proc-macro.stderr delete mode 100644 tests/ui/pub/pub-ident-fn-3.rs delete mode 100644 tests/ui/pub/pub-ident-fn-3.stderr delete mode 100644 tests/ui/pub/pub-ident-fn-or-struct-2.rs delete mode 100644 tests/ui/pub/pub-ident-fn-or-struct-2.stderr create mode 100644 tests/ui/pub/pub-ident-struct-2.rs create mode 100644 tests/ui/pub/pub-ident-struct-2.stderr create mode 100644 tests/ui/pub/pub-ident-struct-3.rs create mode 100644 tests/ui/pub/pub-ident-struct-3.stderr create mode 100644 tests/ui/pub/pub-ident-struct-4.fixed create mode 100644 tests/ui/pub/pub-ident-struct-4.rs create mode 100644 tests/ui/pub/pub-ident-struct-4.stderr create mode 100644 tests/ui/query-system/no-query-in-printing-during-query-descr.rs create mode 100644 tests/ui/query-system/no-query-in-printing-during-query-descr.stderr create mode 100644 tests/ui/recursion_limit/issue-105700.rs create mode 100644 tests/ui/recursion_limit/issue-105700.stderr create mode 100644 tests/ui/recursion_limit/issue-40003.rs create mode 100644 tests/ui/regions/higher-ranked-implied.rs create mode 100644 tests/ui/regions/higher-ranked-implied.stderr create mode 100644 tests/ui/regions/resolve-re-error-ice.rs create mode 100644 tests/ui/regions/resolve-re-error-ice.stderr create mode 100644 tests/ui/repr/16-bit-repr-c-enum.rs create mode 100644 tests/ui/resolve/issue-108529.rs create mode 100644 tests/ui/resolve/issue-108529.stderr delete mode 100644 tests/ui/resolve/token-error-correct-4.fixed create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/do-not-const-check-override.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/do-not-const-check.rs create mode 100644 tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs create mode 100644 tests/ui/sanitize/cfg-kasan.rs delete mode 100644 tests/ui/save-analysis/emit-notifications.polonius.stderr delete mode 100644 tests/ui/save-analysis/emit-notifications.rs delete mode 100644 tests/ui/save-analysis/emit-notifications.stderr delete mode 100644 tests/ui/save-analysis/issue-26459.rs delete mode 100644 tests/ui/save-analysis/issue-26459.stderr delete mode 100644 tests/ui/save-analysis/issue-37323.rs delete mode 100644 tests/ui/save-analysis/issue-59134-0.rs delete mode 100644 tests/ui/save-analysis/issue-59134-0.stderr delete mode 100644 tests/ui/save-analysis/issue-59134-1.rs delete mode 100644 tests/ui/save-analysis/issue-59134-1.stderr delete mode 100644 tests/ui/save-analysis/issue-63663.rs delete mode 100644 tests/ui/save-analysis/issue-64659.rs delete mode 100644 tests/ui/save-analysis/issue-65411.rs delete mode 100644 tests/ui/save-analysis/issue-65590.rs delete mode 100644 tests/ui/save-analysis/issue-68621.rs delete mode 100644 tests/ui/save-analysis/issue-68621.stderr delete mode 100644 tests/ui/save-analysis/issue-72267.rs delete mode 100644 tests/ui/save-analysis/issue-72267.stderr delete mode 100644 tests/ui/save-analysis/issue-73020.rs delete mode 100644 tests/ui/save-analysis/issue-73020.stderr delete mode 100644 tests/ui/save-analysis/issue-73022.rs delete mode 100644 tests/ui/save-analysis/issue-89066.rs delete mode 100644 tests/ui/save-analysis/issue-89066.stderr create mode 100644 tests/ui/single-use-lifetime/issue-107998.rs create mode 100644 tests/ui/single-use-lifetime/issue-107998.stderr create mode 100644 tests/ui/span/issue-107353.rs create mode 100644 tests/ui/stability-attribute/unresolved_stability_lint.rs create mode 100644 tests/ui/stability-attribute/unresolved_stability_lint.stderr create mode 100644 tests/ui/suggest-null-ptr.fixed create mode 100644 tests/ui/suggest-null-ptr.rs create mode 100644 tests/ui/suggest-null-ptr.stderr create mode 100644 tests/ui/suggestions/assoc-const-without-self.rs create mode 100644 tests/ui/suggestions/assoc-const-without-self.stderr create mode 100644 tests/ui/suggestions/issue-104961.fixed create mode 100644 tests/ui/suggestions/issue-104961.rs create mode 100644 tests/ui/suggestions/issue-104961.stderr create mode 100644 tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs create mode 100644 tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr create mode 100644 tests/ui/suggestions/recover-invalid-float-invalid.rs create mode 100644 tests/ui/suggestions/recover-invalid-float-invalid.stderr create mode 100644 tests/ui/suggestions/restrict-existing-type-bounds.rs create mode 100644 tests/ui/suggestions/restrict-existing-type-bounds.stderr create mode 100644 tests/ui/suggestions/suggest-call-on-pat-mismatch.rs create mode 100644 tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr create mode 100644 tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed create mode 100644 tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs create mode 100644 tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr create mode 100644 tests/ui/suggestions/suggest-remove-deref.fixed create mode 100644 tests/ui/suggestions/suggest-remove-deref.rs create mode 100644 tests/ui/suggestions/suggest-remove-deref.stderr create mode 100644 tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs create mode 100644 tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr create mode 100644 tests/ui/suggestions/trait-hidden-method.rs create mode 100644 tests/ui/suggestions/trait-hidden-method.stderr create mode 100644 tests/ui/sync/mutexguard-sync.rs create mode 100644 tests/ui/sync/mutexguard-sync.stderr create mode 100644 tests/ui/sync/suggest-cell.rs create mode 100644 tests/ui/sync/suggest-cell.stderr create mode 100644 tests/ui/sync/suggest-once-cell.rs create mode 100644 tests/ui/sync/suggest-once-cell.stderr create mode 100644 tests/ui/sync/suggest-ref-cell.rs create mode 100644 tests/ui/sync/suggest-ref-cell.stderr create mode 100644 tests/ui/thir-print/thir-flat.rs create mode 100644 tests/ui/thir-print/thir-flat.stdout create mode 100644 tests/ui/thir-print/thir-tree-match.rs create mode 100644 tests/ui/thir-print/thir-tree-match.stdout create mode 100644 tests/ui/thir-print/thir-tree.rs create mode 100644 tests/ui/thir-print/thir-tree.stdout delete mode 100644 tests/ui/thir-tree.rs delete mode 100644 tests/ui/thir-tree.stdout create mode 100644 tests/ui/tool-attributes/auxiliary/p1.rs create mode 100644 tests/ui/tool-attributes/auxiliary/p2.rs create mode 100644 tests/ui/tool-attributes/duplicate-diagnostic.rs create mode 100644 tests/ui/tool-attributes/duplicate-diagnostic.stderr create mode 100644 tests/ui/traits/alias/issue-107747-do-not-assemble-supertraits.rs create mode 100644 tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.rs create mode 100644 tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr create mode 100644 tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs create mode 100644 tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr create mode 100644 tests/ui/traits/alias/issue-60755.rs create mode 100644 tests/ui/traits/issue-103563.rs create mode 100644 tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs create mode 100644 tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs create mode 100644 tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.stderr create mode 100644 tests/ui/traits/new-solver/alias_eq_simple.rs create mode 100644 tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs create mode 100644 tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr create mode 100644 tests/ui/traits/new-solver/async.fail.stderr create mode 100644 tests/ui/traits/new-solver/async.rs create mode 100644 tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs create mode 100644 tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr create mode 100644 tests/ui/traits/new-solver/elaborate-item-bounds.rs create mode 100644 tests/ui/traits/new-solver/generator.fail.stderr create mode 100644 tests/ui/traits/new-solver/generator.rs create mode 100644 tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs create mode 100644 tests/ui/traits/new-solver/more-object-bound.rs create mode 100644 tests/ui/traits/new-solver/more-object-bound.stderr create mode 100644 tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs create mode 100644 tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr create mode 100644 tests/ui/traits/new-solver/object-unsafety.rs create mode 100644 tests/ui/traits/new-solver/object-unsafety.stderr create mode 100644 tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs create mode 100644 tests/ui/traits/new-solver/pointee.rs create mode 100644 tests/ui/traits/new-solver/pointer-like.rs create mode 100644 tests/ui/traits/new-solver/pointer-like.stderr delete mode 100644 tests/ui/traits/new-solver/pointer-sized.rs delete mode 100644 tests/ui/traits/new-solver/pointer-sized.stderr create mode 100644 tests/ui/traits/new-solver/provisional-result-done.rs create mode 100644 tests/ui/traits/new-solver/temporary-ambiguity.rs create mode 100644 tests/ui/traits/new-solver/try-example.rs create mode 100644 tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs create mode 100644 tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr create mode 100644 tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs create mode 100644 tests/ui/traits/new-solver/unsize-good.rs create mode 100644 tests/ui/traits/new-solver/upcast-right-substs.rs create mode 100644 tests/ui/traits/new-solver/upcast-wrong-substs.rs create mode 100644 tests/ui/traits/new-solver/upcast-wrong-substs.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs create mode 100644 tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/basic.rs create mode 100644 tests/ui/traits/non_lifetime_binders/basic.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/fail.rs create mode 100644 tests/ui/traits/non_lifetime_binders/fail.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs create mode 100644 tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs create mode 100644 tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/on-dyn.rs create mode 100644 tests/ui/traits/non_lifetime_binders/on-dyn.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/on-ptr.rs create mode 100644 tests/ui/traits/non_lifetime_binders/on-ptr.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs create mode 100644 tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr create mode 100644 tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.rs create mode 100644 tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.stderr create mode 100644 tests/ui/traits/unsend-future.rs create mode 100644 tests/ui/traits/unsend-future.stderr create mode 100644 tests/ui/type-alias-impl-trait/match-unification.rs create mode 100644 tests/ui/type/type-check/coerce-result-return-value-2.rs create mode 100644 tests/ui/type/type-check/coerce-result-return-value-2.stderr create mode 100644 tests/ui/type/type-check/coerce-result-return-value.fixed create mode 100644 tests/ui/type/type-check/coerce-result-return-value.rs create mode 100644 tests/ui/type/type-check/coerce-result-return-value.stderr create mode 100644 tests/ui/type/type-check/point-at-inference-4.rs create mode 100644 tests/ui/type/type-check/point-at-inference-4.stderr create mode 100644 tests/ui/type/type-check/point-at-inference.fixed create mode 100644 tests/ui/typeck/bad-type-in-vec-contains.rs create mode 100644 tests/ui/typeck/bad-type-in-vec-contains.stderr create mode 100644 tests/ui/typeck/bad-type-in-vec-push.rs create mode 100644 tests/ui/typeck/bad-type-in-vec-push.stderr create mode 100644 tests/ui/typeck/issue-107087.rs create mode 100644 tests/ui/typeck/issue-107087.stderr create mode 100644 tests/ui/typeck/issue-107775.rs create mode 100644 tests/ui/typeck/issue-107775.stderr create mode 100644 tests/ui/typeck/issue-53712.rs create mode 100644 tests/ui/typeck/issue-53712.stderr create mode 100644 tests/ui/typeck/issue-7813.rs create mode 100644 tests/ui/typeck/issue-7813.stderr create mode 100644 tests/ui/typeck/issue-89856.fixed create mode 100644 tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs create mode 100644 tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr create mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs create mode 100644 tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr create mode 100644 tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs create mode 100644 tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr create mode 100644 tests/ui/uninhabited/issue-107505.rs create mode 100644 tests/ui/union/projection-as-union-type-error-2.rs create mode 100644 tests/ui/union/projection-as-union-type-error-2.stderr create mode 100644 tests/ui/union/projection-as-union-type-error.rs create mode 100644 tests/ui/union/projection-as-union-type-error.stderr create mode 100644 tests/ui/union/projection-as-union-type.rs create mode 100644 tests/ui/unpretty/ast-const-trait-bound.rs create mode 100644 tests/ui/unpretty/ast-const-trait-bound.stdout create mode 100644 tests/ui/where-clauses/self-in-where-clause-allowed.rs create mode 100644 tests/ui/where-clauses/self-in-where-clause-allowed.stderr create mode 100644 tests/ui/while/while-else-err.rs create mode 100644 tests/ui/while/while-else-err.stderr create mode 100644 tests/ui/while/while-else-let-else-err.rs create mode 100644 tests/ui/while/while-else-let-else-err.stderr (limited to 'tests/ui') diff --git a/tests/ui/abi/stack-probes-lto.rs b/tests/ui/abi/stack-probes-lto.rs index 6d934538f..a455eef42 100644 --- a/tests/ui/abi/stack-probes-lto.rs +++ b/tests/ui/abi/stack-probes-lto.rs @@ -13,5 +13,6 @@ // ignore-fuchsia no exception handler registered for segfault // compile-flags: -C lto // no-prefer-dynamic +// ignore-nto Crash analysis impossible at SIGSEGV in QNX Neutrino include!("stack-probes.rs"); diff --git a/tests/ui/abi/stack-probes.rs b/tests/ui/abi/stack-probes.rs index e7b91644b..8dba54c3f 100644 --- a/tests/ui/abi/stack-probes.rs +++ b/tests/ui/abi/stack-probes.rs @@ -9,6 +9,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-fuchsia no exception handler registered for segfault +// ignore-nto Crash analysis impossible at SIGSEGV in QNX Neutrino use std::env; use std::mem::MaybeUninit; diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index 59192a1ec..de92841d7 100644 --- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -10,7 +10,7 @@ LL | || ) -> () LL | | { LL | | loop {} LL | | } - | |__^ expected `&Layout`, found struct `Layout` + | |__^ expected `&Layout`, found `Layout` | note: function defined here --> $DIR/alloc-error-handler-bad-signature-1.rs:10:4 diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index 7d23c2fc0..7a495380f 100644 --- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -9,12 +9,12 @@ LL | || ) { | ||_- arguments to this function are incorrect LL | | loop {} LL | | } - | |__^ expected struct `Layout`, found struct `core::alloc::Layout` + | |__^ expected `Layout`, found `core::alloc::Layout` | - = note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types -note: struct `core::alloc::Layout` is defined in crate `core` + = note: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types +note: `core::alloc::Layout` is defined in crate `core` --> $SRC_DIR/core/src/alloc/layout.rs:LL:COL -note: struct `Layout` is defined in the current crate +note: `Layout` is defined in the current crate --> $DIR/alloc-error-handler-bad-signature-2.rs:7:1 | LL | struct Layout; diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr index 77ea8ef05..eb739b149 100644 --- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr +++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr @@ -7,7 +7,7 @@ LL | fn oom() -> ! { | _-^^^^^^^^^^^^ LL | | loop {} LL | | } - | |_- argument of type `core::alloc::Layout` unexpected + | |_- unexpected argument of type `core::alloc::Layout` | note: function defined here --> $DIR/alloc-error-handler-bad-signature-3.rs:10:4 @@ -15,10 +15,6 @@ note: function defined here LL | fn oom() -> ! { | ^^^ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info) -help: remove the extra argument - | -LL | fn oom() -> !() { - | ++ error: aborting due to previous error diff --git a/tests/ui/argument-suggestions/basic.stderr b/tests/ui/argument-suggestions/basic.stderr index 062b37688..c74186285 100644 --- a/tests/ui/argument-suggestions/basic.stderr +++ b/tests/ui/argument-suggestions/basic.stderr @@ -16,17 +16,16 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/basic.rs:21:5 | LL | extra(""); - | ^^^^^ -- argument of type `&'static str` unexpected + | ^^^^^ -- + | | + | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/basic.rs:14:4 | LL | fn extra() {} | ^^^^^ -help: remove the extra argument - | -LL | extra(); - | ~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/basic.rs:22:5 diff --git a/tests/ui/argument-suggestions/exotic-calls.stderr b/tests/ui/argument-suggestions/exotic-calls.stderr index 0580e53c5..ff795b507 100644 --- a/tests/ui/argument-suggestions/exotic-calls.stderr +++ b/tests/ui/argument-suggestions/exotic-calls.stderr @@ -2,65 +2,61 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:2:5 | LL | t(1i32); - | ^ ---- argument of type `i32` unexpected + | ^ ---- + | | + | unexpected argument of type `i32` + | help: remove the extra argument | note: callable defined here --> $DIR/exotic-calls.rs:1:11 | LL | fn foo(t: T) { | ^^^^ -help: remove the extra argument - | -LL | t(); - | ~~ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:7:5 | LL | t(1i32); - | ^ ---- argument of type `i32` unexpected + | ^ ---- + | | + | unexpected argument of type `i32` + | help: remove the extra argument | note: type parameter defined here --> $DIR/exotic-calls.rs:6:11 | LL | fn bar(t: impl Fn()) { | ^^^^^^^^^ -help: remove the extra argument - | -LL | t(); - | ~~ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:16:5 | LL | baz()(1i32) - | ^^^^^ ---- argument of type `i32` unexpected + | ^^^^^ ---- + | | + | unexpected argument of type `i32` + | help: remove the extra argument | note: opaque type defined here --> $DIR/exotic-calls.rs:11:13 | LL | fn baz() -> impl Fn() { | ^^^^^^^^^ -help: remove the extra argument - | -LL | baz()() - | ~~ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/exotic-calls.rs:22:5 | LL | x(1i32); - | ^ ---- argument of type `i32` unexpected + | ^ ---- + | | + | unexpected argument of type `i32` + | help: remove the extra argument | note: closure defined here --> $DIR/exotic-calls.rs:21:13 | LL | let x = || {}; | ^^ -help: remove the extra argument - | -LL | x(); - | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/argument-suggestions/extra_arguments.rs b/tests/ui/argument-suggestions/extra_arguments.rs index 3f83de95e..144206232 100644 --- a/tests/ui/argument-suggestions/extra_arguments.rs +++ b/tests/ui/argument-suggestions/extra_arguments.rs @@ -3,8 +3,15 @@ fn one_arg(_a: i32) {} fn two_arg_same(_a: i32, _b: i32) {} fn two_arg_diff(_a: i32, _b: &str) {} +macro_rules! foo { + ($x:expr) => { + empty($x, 1); //~ ERROR function takes + } +} + fn main() { empty(""); //~ ERROR function takes + empty(1, 1); //~ ERROR function takes one_arg(1, 1); //~ ERROR function takes one_arg(1, ""); //~ ERROR function takes @@ -32,4 +39,5 @@ fn main() { 1, "" ); + foo!(1); } diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr index 48787b0c3..11c710997 100644 --- a/tests/ui/argument-suggestions/extra_arguments.stderr +++ b/tests/ui/argument-suggestions/extra_arguments.stderr @@ -1,58 +1,74 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/extra_arguments.rs:7:3 + --> $DIR/extra_arguments.rs:13:3 | LL | empty(""); - | ^^^^^ -- argument of type `&'static str` unexpected + | ^^^^^ -- + | | + | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:1:4 | LL | fn empty() {} | ^^^^^ -help: remove the extra argument + +error[E0061]: this function takes 0 arguments but 2 arguments were supplied + --> $DIR/extra_arguments.rs:14:3 + | +LL | empty(1, 1); + | ^^^^^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/extra_arguments.rs:1:4 + | +LL | fn empty() {} + | ^^^^^ +help: remove the extra arguments + | +LL - empty(1, 1); +LL + empty(); | -LL | empty(); - | ~~ error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/extra_arguments.rs:9:3 + --> $DIR/extra_arguments.rs:16:3 | LL | one_arg(1, 1); - | ^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- -help: remove the extra argument - | -LL | one_arg(1); - | ~~~ error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/extra_arguments.rs:10:3 + --> $DIR/extra_arguments.rs:17:3 | LL | one_arg(1, ""); - | ^^^^^^^ -- argument of type `&'static str` unexpected + | ^^^^^^^ ---- + | | | + | | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- -help: remove the extra argument - | -LL | one_arg(1); - | ~~~ error[E0061]: this function takes 1 argument but 3 arguments were supplied - --> $DIR/extra_arguments.rs:11:3 + --> $DIR/extra_arguments.rs:18:3 | LL | one_arg(1, "", 1.0); - | ^^^^^^^ -- --- argument of type `{float}` unexpected + | ^^^^^^^ -- --- unexpected argument of type `{float}` | | - | argument of type `&'static str` unexpected + | unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:2:4 @@ -61,80 +77,77 @@ LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- help: remove the extra arguments | -LL | one_arg(1); - | ~~~ +LL - one_arg(1, "", 1.0); +LL + one_arg(1); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:13:3 + --> $DIR/extra_arguments.rs:20:3 | LL | two_arg_same(1, 1, 1); - | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- -help: remove the extra argument - | -LL | two_arg_same(1, 1); - | ~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:14:3 + --> $DIR/extra_arguments.rs:21:3 | LL | two_arg_same(1, 1, 1.0); - | ^^^^^^^^^^^^ --- argument of type `{float}` unexpected + | ^^^^^^^^^^^^ ----- + | | | + | | unexpected argument of type `{float}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- -help: remove the extra argument - | -LL | two_arg_same(1, 1); - | ~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:16:3 + --> $DIR/extra_arguments.rs:23:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- -help: remove the extra argument - | -LL | two_arg_diff(1, ""); - | ~~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:17:3 + --> $DIR/extra_arguments.rs:24:3 | LL | two_arg_diff(1, "", ""); - | ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected + | ^^^^^^^^^^^^ ---- + | | | + | | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- -help: remove the extra argument - | -LL | two_arg_diff(1, ""); - | ~~~~~~~ error[E0061]: this function takes 2 arguments but 4 arguments were supplied - --> $DIR/extra_arguments.rs:18:3 + --> $DIR/extra_arguments.rs:25:3 | LL | two_arg_diff(1, 1, "", ""); - | ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected + | ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str` | | - | argument of type `{integer}` unexpected + | unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -143,16 +156,17 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- help: remove the extra arguments | -LL | two_arg_diff(1, ""); - | ~~~~~~~ +LL - two_arg_diff(1, 1, "", ""); +LL + two_arg_diff(1, ""); + | error[E0061]: this function takes 2 arguments but 4 arguments were supplied - --> $DIR/extra_arguments.rs:19:3 + --> $DIR/extra_arguments.rs:26:3 | LL | two_arg_diff(1, "", 1, ""); - | ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected + | ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str` | | - | argument of type `{integer}` unexpected + | unexpected argument of type `{integer}` | note: function defined here --> $DIR/extra_arguments.rs:4:4 @@ -161,79 +175,99 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- help: remove the extra arguments | -LL | two_arg_diff(1, ""); - | ~~~~~~~ +LL - two_arg_diff(1, "", 1, ""); +LL + two_arg_diff(1, ""); + | error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:22:3 + --> $DIR/extra_arguments.rs:29:3 | LL | two_arg_same(1, 1, ""); - | ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected + | ^^^^^^^^^^^^ -------- + | | | + | | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- -help: remove the extra argument - | -LL | two_arg_same(1, 1); - | ~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:23:3 + --> $DIR/extra_arguments.rs:30:3 | LL | two_arg_diff(1, 1, ""); - | ^^^^^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- -help: remove the extra argument - | -LL | two_arg_diff(1, ""); - | ~~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:24:3 - | -LL | two_arg_same( - | ^^^^^^^^^^^^ -... -LL | "" - | -- argument of type `&'static str` unexpected + --> $DIR/extra_arguments.rs:31:3 + | +LL | two_arg_same( + | ^^^^^^^^^^^^ +LL | 1, +LL | 1, + | ______- +LL | | "" + | | -- + | |_____|| + | |help: remove the extra argument + | unexpected argument of type `&'static str` | note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- -help: remove the extra argument - | -LL | two_arg_same(1, 1); - | ~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:30:3 - | -LL | two_arg_diff( - | ^^^^^^^^^^^^ -LL | 1, -LL | 1, - | - argument of type `{integer}` unexpected + --> $DIR/extra_arguments.rs:37:3 + | +LL | two_arg_diff( + | ^^^^^^^^^^^^ +LL | 1, + | ______- +LL | | 1, + | | - + | | | + | |_____unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- -help: remove the extra argument + +error[E0061]: this function takes 0 arguments but 2 arguments were supplied + --> $DIR/extra_arguments.rs:8:9 + | +LL | empty($x, 1); + | ^^^^^ - unexpected argument of type `{integer}` +... +LL | foo!(1); + | ------- + | | | + | | unexpected argument of type `{integer}` + | | help: remove the extra argument + | in this macro invocation + | +note: function defined here + --> $DIR/extra_arguments.rs:1:4 | -LL | two_arg_diff(1, ""); - | ~~~~~~~ +LL | fn empty() {} + | ^^^^^ + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 14 previous errors +error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/argument-suggestions/formal-and-expected-differ.stderr b/tests/ui/argument-suggestions/formal-and-expected-differ.stderr index 905875b52..6076b7ccb 100644 --- a/tests/ui/argument-suggestions/formal-and-expected-differ.stderr +++ b/tests/ui/argument-suggestions/formal-and-expected-differ.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/formal-and-expected-differ.rs:22:29 | LL | let _: U<_, u32> = U(1, S(3u32)); - | - ^^^^^^^ expected `f32`, found `u32` + | - ^^^^^^^ expected `S`, found `S` | | | arguments to this struct are incorrect | @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/formal-and-expected-differ.rs:22:24 | LL | let _: U<_, u32> = U(1, S(3u32)); - | --------- ^^^^^^^^^^^^^ expected `u32`, found `f32` + | --------- ^^^^^^^^^^^^^ expected `U<_, u32>`, found `U` | | | expected due to this | diff --git a/tests/ui/argument-suggestions/invalid_arguments.stderr b/tests/ui/argument-suggestions/invalid_arguments.stderr index 303f08695..d26f33d09 100644 --- a/tests/ui/argument-suggestions/invalid_arguments.stderr +++ b/tests/ui/argument-suggestions/invalid_arguments.stderr @@ -100,7 +100,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:24:18 | LL | three_arg_diff(X{}, 1.0, ""); - | -------------- ^^^ expected `i32`, found struct `X` + | -------------- ^^^ expected `i32`, found `X` | | | arguments to this function are incorrect | @@ -114,7 +114,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:25:21 | LL | three_arg_diff(1, X {}, ""); - | -------------- ^^^^ expected `f32`, found struct `X` + | -------------- ^^^^ expected `f32`, found `X` | | | arguments to this function are incorrect | @@ -128,7 +128,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:26:26 | LL | three_arg_diff(1, 1.0, X {}); - | -------------- ^^^^ expected `&str`, found struct `X` + | -------------- ^^^^ expected `&str`, found `X` | | | arguments to this function are incorrect | @@ -142,9 +142,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:28:3 | LL | three_arg_diff(X {}, X {}, ""); - | ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found struct `X` + | ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found `X` | | - | expected `i32`, found struct `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:8:4 @@ -156,9 +156,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:29:3 | LL | three_arg_diff(X {}, 1.0, X {}); - | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X` | | - | expected `i32`, found struct `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:8:4 @@ -170,9 +170,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:30:3 | LL | three_arg_diff(1, X {}, X {}); - | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X` | | - | expected `f32`, found struct `X` + | expected `f32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:8:4 @@ -184,10 +184,10 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:32:3 | LL | three_arg_diff(X {}, X {}, X {}); - | ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X` | | | - | | expected `f32`, found struct `X` - | expected `i32`, found struct `X` + | | expected `f32`, found `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:8:4 @@ -199,7 +199,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:34:20 | LL | three_arg_repeat(X {}, 1, ""); - | ---------------- ^^^^ expected `i32`, found struct `X` + | ---------------- ^^^^ expected `i32`, found `X` | | | arguments to this function are incorrect | @@ -213,7 +213,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:35:23 | LL | three_arg_repeat(1, X {}, ""); - | ---------------- ^^^^ expected `i32`, found struct `X` + | ---------------- ^^^^ expected `i32`, found `X` | | | arguments to this function are incorrect | @@ -227,7 +227,7 @@ error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:36:26 | LL | three_arg_repeat(1, 1, X {}); - | ---------------- ^^^^ expected `&str`, found struct `X` + | ---------------- ^^^^ expected `&str`, found `X` | | | arguments to this function are incorrect | @@ -241,9 +241,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:38:3 | LL | three_arg_repeat(X {}, X {}, ""); - | ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found struct `X` + | ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found `X` | | - | expected `i32`, found struct `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:9:4 @@ -255,9 +255,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:39:3 | LL | three_arg_repeat(X {}, 1, X {}); - | ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X` | | - | expected `i32`, found struct `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:9:4 @@ -269,9 +269,9 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:40:3 | LL | three_arg_repeat(1, X {}, X{}); - | ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found `X` | | - | expected `i32`, found struct `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:9:4 @@ -283,10 +283,10 @@ error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:42:3 | LL | three_arg_repeat(X {}, X {}, X {}); - | ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X` + | ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X` | | | - | | expected `i32`, found struct `X` - | expected `i32`, found struct `X` + | | expected `i32`, found `X` + | expected `i32`, found `X` | note: function defined here --> $DIR/invalid_arguments.rs:9:4 diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 1499229c3..2504f616f 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-100154.rs:4:5 | LL | foo::<()>(()); diff --git a/tests/ui/argument-suggestions/issue-100478.stderr b/tests/ui/argument-suggestions/issue-100478.stderr index df02a312c..e4304988f 100644 --- a/tests/ui/argument-suggestions/issue-100478.stderr +++ b/tests/ui/argument-suggestions/issue-100478.stderr @@ -41,7 +41,7 @@ error[E0308]: arguments to this function are incorrect --> $DIR/issue-100478.rs:36:5 | LL | four_shuffle(T3::default(), T2::default(), T1::default(), T3::default()); - | ^^^^^^^^^^^^ ------------- ------------- ------------- expected struct `T4`, found struct `T3` + | ^^^^^^^^^^^^ ------------- ------------- ------------- expected `T4`, found `T3` | | | | | expected `T3`, found `T1` | expected `T1`, found `T3` diff --git a/tests/ui/argument-suggestions/issue-101097.stderr b/tests/ui/argument-suggestions/issue-101097.stderr index 096f8c226..061f51014 100644 --- a/tests/ui/argument-suggestions/issue-101097.stderr +++ b/tests/ui/argument-suggestions/issue-101097.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 6 arguments but 7 arguments were supplied LL | f(C, A, A, A, B, B, C); | ^ - - - - expected `C`, found `B` | | | | - | | | argument of type `A` unexpected + | | | unexpected argument of type `A` | | expected `B`, found `A` | expected `A`, found `C` | @@ -64,8 +64,8 @@ error[E0308]: arguments to this function are incorrect LL | f(A, A, D, D, B, B); | ^ - - ---- two arguments of type `C` and `C` are missing | | | - | | argument of type `D` unexpected - | argument of type `D` unexpected + | | unexpected argument of type `D` + | unexpected argument of type `D` | note: function defined here --> $DIR/issue-101097.rs:6:4 @@ -128,7 +128,7 @@ LL | f(C, C, A, B, A, A); | ^ - - - - - expected `C`, found `A` | | | | | | | | | expected `C`, found `A` - | | | expected struct `B`, found struct `A` + | | | expected `B`, found `A` | | expected `A`, found `C` | expected `A`, found `C` | diff --git a/tests/ui/argument-suggestions/issue-97484.stderr b/tests/ui/argument-suggestions/issue-97484.stderr index caa50f14b..a86cbbf18 100644 --- a/tests/ui/argument-suggestions/issue-97484.stderr +++ b/tests/ui/argument-suggestions/issue-97484.stderr @@ -2,11 +2,11 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied --> $DIR/issue-97484.rs:12:5 | LL | foo(&&A, B, C, D, E, F, G); - | ^^^ - - - - argument of type `F` unexpected + | ^^^ - - - - unexpected argument of type `F` | | | | - | | | expected `&E`, found struct `E` - | | argument of type `C` unexpected - | argument of type `B` unexpected + | | | expected `&E`, found `E` + | | unexpected argument of type `C` + | unexpected argument of type `B` | note: function defined here --> $DIR/issue-97484.rs:9:4 @@ -19,8 +19,9 @@ LL | foo(&&A, B, C, D, &E, F, G); | ~~ help: remove the extra arguments | -LL | foo(&&A, D, /* &E */, G); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - foo(&&A, B, C, D, E, F, G); +LL + foo(&&A, D, /* &E */, G); + | error: aborting due to previous error diff --git a/tests/ui/argument-suggestions/mixed_cases.stderr b/tests/ui/argument-suggestions/mixed_cases.stderr index 8c525db1a..c645dd381 100644 --- a/tests/ui/argument-suggestions/mixed_cases.stderr +++ b/tests/ui/argument-suggestions/mixed_cases.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/mixed_cases.rs:10:3 | LL | two_args(1, "", X {}); - | ^^^^^^^^ -- ---- argument of type `X` unexpected + | ^^^^^^^^ -- ---- unexpected argument of type `X` | | | expected `f32`, found `&str` | @@ -13,16 +13,17 @@ LL | fn two_args(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: remove the extra argument | -LL | two_args(1, /* f32 */); - | ~~~~~~~~~~~~~~ +LL - two_args(1, "", X {}); +LL + two_args(1, /* f32 */); + | error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/mixed_cases.rs:11:3 | LL | three_args(1, "", X {}, ""); - | ^^^^^^^^^^ -- ---- -- argument of type `&'static str` unexpected + | ^^^^^^^^^^ -- ---- -- unexpected argument of type `&'static str` | | | - | | argument of type `X` unexpected + | | unexpected argument of type `X` | an argument of type `f32` is missing | note: function defined here @@ -41,7 +42,7 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied LL | three_args(1, X {}); | ^^^^^^^^^^--------- | | | - | | expected `f32`, found struct `X` + | | expected `f32`, found `X` | an argument of type `&str` is missing | note: function defined here @@ -58,7 +59,7 @@ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:17:3 | LL | three_args(1, "", X {}); - | ^^^^^^^^^^ -- ---- argument of type `X` unexpected + | ^^^^^^^^^^ -- ---- unexpected argument of type `X` | | | an argument of type `f32` is missing | @@ -78,7 +79,7 @@ error[E0308]: arguments to this function are incorrect LL | three_args("", X {}, 1); | ^^^^^^^^^^ -- ---- - expected `&str`, found `{integer}` | | | - | | expected `f32`, found struct `X` + | | expected `f32`, found `X` | expected `i32`, found `&'static str` | note: function defined here diff --git a/tests/ui/argument-suggestions/too-long.stderr b/tests/ui/argument-suggestions/too-long.stderr index 492894329..bb6f06a35 100644 --- a/tests/ui/argument-suggestions/too-long.stderr +++ b/tests/ui/argument-suggestions/too-long.stderr @@ -6,7 +6,7 @@ LL | qux.foo(a, b, c, d, e, f, g, h, i, j, k, l); | | | arguments to this method are incorrect | -note: associated function defined here +note: method defined here --> $DIR/too-long.rs:4:8 | LL | fn foo( diff --git a/tests/ui/argument-suggestions/two-mismatch-notes.stderr b/tests/ui/argument-suggestions/two-mismatch-notes.stderr index 7873cf964..38cf23ddc 100644 --- a/tests/ui/argument-suggestions/two-mismatch-notes.stderr +++ b/tests/ui/argument-suggestions/two-mismatch-notes.stderr @@ -4,14 +4,15 @@ error[E0308]: arguments to this function are incorrect LL | foo(f, w); | ^^^ | -note: expected `i32`, found `u32` +note: expected fn pointer, found fn item --> $DIR/two-mismatch-notes.rs:10:9 | LL | foo(f, w); | ^ = note: expected fn pointer `fn(i32)` found fn item `fn(u32) {f}` -note: expected `i32`, found `isize` + = note: when the arguments and return types match, functions can be coerced to function pointers +note: expected `Wrapper`, found `Wrapper` --> $DIR/two-mismatch-notes.rs:10:12 | LL | foo(f, w); diff --git a/tests/ui/array-slice-vec/array-not-vector.rs b/tests/ui/array-slice-vec/array-not-vector.rs index 5e46f015b..d8b5b10d5 100644 --- a/tests/ui/array-slice-vec/array-not-vector.rs +++ b/tests/ui/array-slice-vec/array-not-vector.rs @@ -1,12 +1,12 @@ fn main() { let _x: i32 = [1, 2, 3]; //~^ ERROR mismatched types - //~| expected `i32`, found array + //~| expected `i32`, found `[{integer}; 3]` let x: &[i32] = &[1, 2, 3]; let _y: &i32 = x; //~^ ERROR mismatched types //~| expected reference `&i32` //~| found reference `&[i32]` - //~| expected `i32`, found slice + //~| expected `&i32`, found `&[i32]` } diff --git a/tests/ui/array-slice-vec/array-not-vector.stderr b/tests/ui/array-slice-vec/array-not-vector.stderr index 0e187d907..f20d99524 100644 --- a/tests/ui/array-slice-vec/array-not-vector.stderr +++ b/tests/ui/array-slice-vec/array-not-vector.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/array-not-vector.rs:2:19 | LL | let _x: i32 = [1, 2, 3]; - | --- ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]` + | --- ^^^^^^^^^ expected `i32`, found `[{integer}; 3]` | | | expected due to this @@ -10,7 +10,7 @@ error[E0308]: mismatched types --> $DIR/array-not-vector.rs:7:20 | LL | let _y: &i32 = x; - | ---- ^ expected `i32`, found slice `[i32]` + | ---- ^ expected `&i32`, found `&[i32]` | | | expected due to this | diff --git a/tests/ui/array-slice-vec/slice-to-vec-comparison.stderr b/tests/ui/array-slice-vec/slice-to-vec-comparison.stderr index e3b3b040f..47008e1d9 100644 --- a/tests/ui/array-slice-vec/slice-to-vec-comparison.stderr +++ b/tests/ui/array-slice-vec/slice-to-vec-comparison.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/slice-to-vec-comparison.rs:4:9 | LL | a > b; - | ^ expected array of 0 elements, found struct `Vec` + | ^ expected `&[_; 0]`, found `&Vec` | = note: expected reference `&[_; 0]` found reference `&Vec` diff --git a/tests/ui/asm/issue-72570.rs b/tests/ui/asm/issue-72570.rs index bb1381634..ac589de23 100644 --- a/tests/ui/asm/issue-72570.rs +++ b/tests/ui/asm/issue-72570.rs @@ -1,6 +1,4 @@ -// compile-flags: -Zsave-analysis // needs-asm-support -// Also test for #72960 use std::arch::asm; diff --git a/tests/ui/asm/issue-72570.stderr b/tests/ui/asm/issue-72570.stderr index fa5792688..49013a23c 100644 --- a/tests/ui/asm/issue-72570.stderr +++ b/tests/ui/asm/issue-72570.stderr @@ -1,5 +1,5 @@ error: invalid register `invalid`: unknown register - --> $DIR/issue-72570.rs:9:18 + --> $DIR/issue-72570.rs:7:18 | LL | asm!("", in("invalid") "".len()); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/type-check-4.stderr b/tests/ui/asm/type-check-4.stderr index c97cd171b..b5ecb3e1b 100644 --- a/tests/ui/asm/type-check-4.stderr +++ b/tests/ui/asm/type-check-4.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed --> $DIR/type-check-4.rs:14:9 | LL | let p = &a; - | -- borrow of `a` occurs here + | -- `a` is borrowed here LL | asm!("{}", out(reg) a); - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^ `a` is assigned to here but it was already borrowed LL | LL | println!("{}", p); | - borrow later used here @@ -13,7 +13,7 @@ error[E0503]: cannot use `a` because it was mutably borrowed --> $DIR/type-check-4.rs:22:28 | LL | let p = &mut a; - | ------ borrow of `a` occurs here + | ------ `a` is borrowed here LL | asm!("{}", in(reg) a); | ^ use of borrowed `a` LL | diff --git a/tests/ui/associated-consts/associated-const-generic-obligations.stderr b/tests/ui/associated-consts/associated-const-generic-obligations.stderr index f45fa0ad5..d45868151 100644 --- a/tests/ui/associated-consts/associated-const-generic-obligations.stderr +++ b/tests/ui/associated-consts/associated-const-generic-obligations.stderr @@ -2,7 +2,7 @@ error[E0326]: implemented const `FROM` has an incompatible type for trait --> $DIR/associated-const-generic-obligations.rs:14:17 | LL | const FROM: &'static str = "foo"; - | ^^^^^^^^^^^^ expected associated type, found `&str` + | ^^^^^^^^^^^^ expected associated type, found `&'static str` | note: type in trait --> $DIR/associated-const-generic-obligations.rs:10:17 diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr index 30c380152..bbafc55da 100644 --- a/tests/ui/associated-consts/issue-105330.stderr +++ b/tests/ui/associated-consts/issue-105330.stderr @@ -33,7 +33,7 @@ LL | fn main>() { = note: see issue #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 type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers --> $DIR/issue-105330.rs:6:27 | LL | impl TraitWAssocConst for impl Demo { diff --git a/tests/ui/associated-inherent-types/ambiguity.rs b/tests/ui/associated-inherent-types/ambiguity.rs new file mode 100644 index 000000000..73920555b --- /dev/null +++ b/tests/ui/associated-inherent-types/ambiguity.rs @@ -0,0 +1,16 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Wrapper(T); + +impl Wrapper { + type Foo = i32; +} + +impl Wrapper<()> { + type Foo = (); +} + +fn main() { + let _: Wrapper<_>::Foo = (); //~ ERROR multiple applicable items in scope +} diff --git a/tests/ui/associated-inherent-types/ambiguity.stderr b/tests/ui/associated-inherent-types/ambiguity.stderr new file mode 100644 index 000000000..155c296cb --- /dev/null +++ b/tests/ui/associated-inherent-types/ambiguity.stderr @@ -0,0 +1,20 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/ambiguity.rs:15:24 + | +LL | let _: Wrapper<_>::Foo = (); + | ^^^ multiple `Foo` found + | +note: candidate #1 is defined in an impl for the type `Wrapper` + --> $DIR/ambiguity.rs:7:5 + | +LL | type Foo = i32; + | ^^^^^^^^ +note: candidate #2 is defined in an impl for the type `Wrapper<()>` + --> $DIR/ambiguity.rs:11:5 + | +LL | type Foo = (); + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.rs b/tests/ui/associated-inherent-types/bugs/ice-substitution.rs new file mode 100644 index 000000000..53ac79e05 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/ice-substitution.rs @@ -0,0 +1,23 @@ +// known-bug: unknown +// failure-status: 101 +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +// rustc-env:RUST_BACKTRACE=0 + +// FIXME: I presume a type variable that couldn't be solved by `resolve_vars_if_possible` +// escapes the InferCtxt snapshot. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Cont(T); + +impl Cont { + type Out = Vec; +} + +pub fn weird(x: T) { + let _: Cont<_>::Out = vec![true]; +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr b/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr new file mode 100644 index 000000000..7b0d1c505 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr @@ -0,0 +1,6 @@ +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [typeck] type-checking `weird` +#1 [typeck_item_bodies] type-checking all item bodies +end of query stack diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.rs b/tests/ui/associated-inherent-types/bugs/inference-fail.rs new file mode 100644 index 000000000..a920b412b --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/inference-fail.rs @@ -0,0 +1,15 @@ +// known-bug: unknown + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S<()> { + type P = i128; +} + +fn main() { + // We fail to infer `_ == ()` here. + let _: S<_>::P; +} diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.stderr b/tests/ui/associated-inherent-types/bugs/inference-fail.stderr new file mode 100644 index 000000000..425691bd6 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/inference-fail.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/inference-fail.rs:14:14 + | +LL | let _: S<_>::P; + | ^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs b/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs new file mode 100644 index 000000000..632dbf385 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs @@ -0,0 +1,19 @@ +// known-bug: unknown +// check-pass + +// We currently don't region-check inherent associated type projections at all. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features, dead_code)] + +struct S(T); + +impl S<&'static ()> { + type T = (); +} + +fn usr<'a>() { + let _: S::<&'a ()>::T; // this should *fail* but it doesn't! +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs b/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs new file mode 100644 index 000000000..f846bfa41 --- /dev/null +++ b/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs @@ -0,0 +1,41 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// Check that inherent associated types are dispatched on the concrete Self type. + +struct Select(T); + +impl Select { + type Projection = (); +} + +impl Select { + type Projection = bool; +} + +struct Choose(T); +struct NonCopy; + +impl Choose { + type Result = Vec; +} + +impl Choose { + type Result = (); +} + +fn main() { + let _: Select::Projection = false; + let _: Select::Projection = (); + + let _: Choose::Result = (); + let _: Choose::Result = vec![true]; +} + +// Test if we use the correct `ParamEnv` when proving obligations. + +pub fn parameterized(x: T) { + let _: Choose::Result = vec![x]; +} diff --git a/tests/ui/associated-inherent-types/dispatch-on-self-type-1.rs b/tests/ui/associated-inherent-types/dispatch-on-self-type-1.rs new file mode 100644 index 000000000..9b0fa8dc6 --- /dev/null +++ b/tests/ui/associated-inherent-types/dispatch-on-self-type-1.rs @@ -0,0 +1,39 @@ +// check-pass + +#![feature(inherent_associated_types, auto_traits, negative_impls)] +#![allow(incomplete_features)] + +use std::cmp::Ordering; + +// Check that inherent associated types are dispatched on the concrete Self type. + +struct Select(T, U); + +impl Select { + type Type = (); +} + +impl Select { + type Type = bool; +} + +impl Select { + type Type = Ordering; +} + +impl Select { + type Type = (bool, bool); +} + +fn main() { + let _: Select::Type = false; + let _: Select::Type = (true, false); + let _: Select::Type = Ordering::Equal; + let _: Select::Type = (); +} + +enum Special {} + +impl !Ordinary for Special {} + +auto trait Ordinary {} diff --git a/tests/ui/associated-inherent-types/dispatch-on-self-type-2.rs b/tests/ui/associated-inherent-types/dispatch-on-self-type-2.rs new file mode 100644 index 000000000..7b205952f --- /dev/null +++ b/tests/ui/associated-inherent-types/dispatch-on-self-type-2.rs @@ -0,0 +1,17 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Parameterized(T, U); + +impl Parameterized<(), ()> { + type Output = bool; +} + +impl Parameterized { + type Result = T; +} + +fn main() { + let _: Parameterized<(), ()>::Output = String::new(); //~ ERROR mismatched types + let _: Parameterized::Result = (); //~ ERROR mismatched types +} diff --git a/tests/ui/associated-inherent-types/dispatch-on-self-type-2.stderr b/tests/ui/associated-inherent-types/dispatch-on-self-type-2.stderr new file mode 100644 index 000000000..c9a48872a --- /dev/null +++ b/tests/ui/associated-inherent-types/dispatch-on-self-type-2.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/dispatch-on-self-type-2.rs:15:44 + | +LL | let _: Parameterized<(), ()>::Output = String::new(); + | ----------------------------- ^^^^^^^^^^^^^ expected `bool`, found `String` + | | + | expected due to this + +error[E0308]: mismatched types + --> $DIR/dispatch-on-self-type-2.rs:16:47 + | +LL | let _: Parameterized::Result = (); + | -------------------------------- ^^ expected `u32`, found `()` + | | + | expected due to this + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs new file mode 100644 index 000000000..d2efb24c6 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs @@ -0,0 +1,31 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// Check that it's okay to report “[inherent] associated type […] not found” for inherent associated +// type candidates that are not applicable (due to unsuitable Self type) even if there exists a +// “shadowed” associated type from a trait with the same name since its use would be ambiguous +// anyway if the IAT didn't exist. +// FIXME(inherent_associated_types): Figure out which error would be more helpful here. + +// revisions: shadowed uncovered + +struct S(T); + +trait Tr { + type Pr; +} + +impl Tr for S { + type Pr = (); +} + +#[cfg(shadowed)] +impl S<()> { + type Pr = i32; +} + +fn main() { + let _: S::::Pr = (); + //[shadowed]~^ ERROR associated type `Pr` not found + //[uncovered]~^^ ERROR ambiguous associated type +} diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr new file mode 100644 index 000000000..3561db354 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.shadowed.stderr @@ -0,0 +1,15 @@ +error[E0220]: associated type `Pr` not found for `S` in the current scope + --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:23 + | +LL | struct S(T); + | ----------- associated item `Pr` not found for this struct +... +LL | let _: S::::Pr = (); + | ^^ associated item not found in `S` + | + = note: the associated type was found for + - `S<()>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0220`. 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 new file mode 100644 index 000000000..88c72042c --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr @@ -0,0 +1,9 @@ +error[E0223]: ambiguous associated type + --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12 + | +LL | let _: S::::Pr = (); + | ^^^^^^^^^^^^^ help: use the fully-qualified path: ` as Tr>::Pr` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr new file mode 100644 index 000000000..4396435a6 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr @@ -0,0 +1,16 @@ +error[E0220]: associated type `Proj` not found for `Family>` in the current scope + --> $DIR/not-found-self-type-differs.rs:17:34 + | +LL | struct Family(T); + | ---------------- associated item `Proj` not found for this struct +... +LL | type Alias = Family>::Proj; + | ^^^^ associated item not found in `Family>` + | + = note: the associated type was found for + - `Family<()>` + - `Family>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr new file mode 100644 index 000000000..d527db022 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr @@ -0,0 +1,16 @@ +error[E0220]: associated type `Proj` not found for `Family` in the current scope + --> $DIR/not-found-self-type-differs.rs:21:40 + | +LL | struct Family(T); + | ---------------- associated item `Proj` not found for this struct +... +LL | let _: Family::Proj = (); + | ^^^^ associated item not found in `Family` + | + = note: the associated type was found for + - `Family<()>` + - `Family>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.rs b/tests/ui/associated-inherent-types/not-found-self-type-differs.rs new file mode 100644 index 000000000..93f58dcb6 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.rs @@ -0,0 +1,22 @@ +// revisions: local alias + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Family(T); + +impl Family<()> { + type Proj = (); +} + +impl Family> { + type Proj = Self; +} + +#[cfg(alias)] +type Alias = Family>::Proj; //[alias]~ ERROR associated type `Proj` not found for `Family>` + +fn main() { + #[cfg(local)] + let _: Family::Proj = (); //[local]~ ERROR associated type `Proj` not found for `Family` +} diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.rs b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.rs new file mode 100644 index 000000000..b00830fa1 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.rs @@ -0,0 +1,21 @@ +// Regression test for issue #104251. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Container(T); + +impl Container { + type Yield = i32; +} + +struct Duple(T, U); + +impl Duple { + type Combination = (T, U); +} + +fn main() { + let _: Container<[u8]>::Yield = 1; //~ ERROR the associated type `Yield` exists for `Container<[u8]>`, but its trait bounds were not satisfied + let _: Duple>::Combination; //~ ERROR the associated type `Combination` exists for `Duple>`, but its trait bounds were not satisfied +} diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr new file mode 100644 index 000000000..736579067 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-0.stderr @@ -0,0 +1,27 @@ +error: the associated type `Yield` exists for `Container<[u8]>`, but its trait bounds were not satisfied + --> $DIR/not-found-unsatisfied-bounds-0.rs:19:29 + | +LL | struct Container(T); + | --------------------------- associated item `Yield` not found for this struct +... +LL | let _: Container<[u8]>::Yield = 1; + | ^^^^^ associated type cannot be referenced on `Container<[u8]>` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `[u8]: Sized` + +error: the associated type `Combination` exists for `Duple>`, but its trait bounds were not satisfied + --> $DIR/not-found-unsatisfied-bounds-0.rs:20:45 + | +LL | struct Duple(T, U); + | ------------------ associated item `Combination` not found for this struct +... +LL | let _: Duple>::Combination; + | ^^^^^^^^^^^ associated type cannot be referenced on `Duple>` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `Rc: Send` + `String: Copy` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.rs b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.rs new file mode 100644 index 000000000..c80b1364a --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.rs @@ -0,0 +1,18 @@ +// fail-check + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// Test if we use the correct `ParamEnv` when proving obligations. + +fn parameterized() { + let _: Container::Proj = String::new(); //~ ERROR the associated type `Proj` exists for `Container`, but its trait bounds were not satisfied +} + +struct Container(T); + +impl Container { + type Proj = String; +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr new file mode 100644 index 000000000..230bfa538 --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-1.stderr @@ -0,0 +1,14 @@ +error: the associated type `Proj` exists for `Container`, but its trait bounds were not satisfied + --> $DIR/not-found-unsatisfied-bounds-1.rs:9:26 + | +LL | let _: Container::Proj = String::new(); + | ^^^^ associated type cannot be referenced on `Container` due to unsatisfied trait bounds +... +LL | struct Container(T); + | ------------------- associated item `Proj` not found for this struct + | + = note: the following trait bounds were not satisfied: + `T: Clone` + +error: aborting due to previous error + diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.rs b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.rs new file mode 100644 index 000000000..5b0e8de9c --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.rs @@ -0,0 +1,20 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(A, B); +struct Featureless; + +trait One {} +trait Two {} + +impl S { + type X = (); +} + +impl S { + type X = String; +} + +fn main() { + let _: S::::X; //~ ERROR the associated type `X` exists for `S`, but its trait bounds were not satisfied +} diff --git a/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr new file mode 100644 index 000000000..3ddab25de --- /dev/null +++ b/tests/ui/associated-inherent-types/not-found-unsatisfied-bounds-in-multiple-impls.stderr @@ -0,0 +1,20 @@ +error: the associated type `X` exists for `S`, but its trait bounds were not satisfied + --> $DIR/not-found-unsatisfied-bounds-in-multiple-impls.rs:19:43 + | +LL | struct S(A, B); + | -------------- associated item `X` not found for this struct +LL | struct Featureless; + | ------------------ + | | + | doesn't satisfy `Featureless: One` + | doesn't satisfy `Featureless: Two` +... +LL | let _: S::::X; + | ^ associated type cannot be referenced on `S` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `Featureless: One` + `Featureless: Two` + +error: aborting due to previous error + diff --git a/tests/ui/associated-inherent-types/struct-generics.rs b/tests/ui/associated-inherent-types/struct-generics.rs deleted file mode 100644 index 8952b3791..000000000 --- a/tests/ui/associated-inherent-types/struct-generics.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass - -#![feature(inherent_associated_types)] -#![allow(incomplete_features)] - -struct S(T); - -impl S { - type P = T; -} - -fn main() { - type A = S<()>::P; - let _: A = (); -} diff --git a/tests/ui/associated-inherent-types/substitute-params-bad.rs b/tests/ui/associated-inherent-types/substitute-params-bad.rs new file mode 100644 index 000000000..00eb1a14d --- /dev/null +++ b/tests/ui/associated-inherent-types/substitute-params-bad.rs @@ -0,0 +1,23 @@ +// Regression test for issue #105305 and for +// https://github.com/rust-lang/rust/issues/107468#issuecomment-1409096700 + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S { //~ ERROR lifetime parameters must be declared prior to type and const parameters + type P = T; +} + +struct Subj(T); + +impl Subj<(T, S)> { + type Un = (T, S); +} + +fn main() { + type A = S<()>::P; + + let _: Subj<(i32, i32)>::Un = 0i32; //~ ERROR mismatched types +} diff --git a/tests/ui/associated-inherent-types/substitute-params-bad.stderr b/tests/ui/associated-inherent-types/substitute-params-bad.stderr new file mode 100644 index 000000000..7a7808ba6 --- /dev/null +++ b/tests/ui/associated-inherent-types/substitute-params-bad.stderr @@ -0,0 +1,20 @@ +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/substitute-params-bad.rs:9:9 + | +LL | impl S { + | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` + +error[E0308]: mismatched types + --> $DIR/substitute-params-bad.rs:22:35 + | +LL | let _: Subj<(i32, i32)>::Un = 0i32; + | -------------------- ^^^^ expected `(i32, i32)`, found `i32` + | | + | expected due to this + | + = note: expected tuple `(i32, i32)` + found type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/substitute-params.rs b/tests/ui/associated-inherent-types/substitute-params.rs new file mode 100644 index 000000000..e94d68331 --- /dev/null +++ b/tests/ui/associated-inherent-types/substitute-params.rs @@ -0,0 +1,23 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S { + type P = T; +} + +impl S<(T,)> { + type Un = T; +} + +fn main() { + // Regression test for issue #104240. + type A = S<()>::P; + let _: A = (); + + // Regression test for issue #107468. + let _: S<(i32,)>::Un = 0i32; +} diff --git a/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs new file mode 100644 index 000000000..8cab1f66c --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs @@ -0,0 +1,14 @@ +#![feature(associated_type_bounds)] + +trait B { + type AssocType; +} + +fn f() +where + dyn for<'j> B:, + //~^ ERROR associated type bounds are only allowed in where clauses and function signatures +{ +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr new file mode 100644 index 000000000..6fa266d23 --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr @@ -0,0 +1,8 @@ +error: associated type bounds are only allowed in where clauses and function signatures, not in bounds + --> $DIR/bad-universal-in-dyn-in-where-clause.rs:9:19 + | +LL | dyn for<'j> B:, + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs new file mode 100644 index 000000000..1d5d181ef --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs @@ -0,0 +1,13 @@ +#![feature(associated_type_bounds)] + +trait Trait { + type Item; +} + +trait Trait2 {} + +// It's not possible to insert a universal `impl Trait` here! +impl dyn Trait {} +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures + +fn main() {} diff --git a/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr new file mode 100644 index 000000000..8b66627d5 --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr @@ -0,0 +1,8 @@ +error: associated type bounds are only allowed in where clauses and function signatures, not in impl headers + --> $DIR/bad-universal-in-impl-sig.rs:10:16 + | +LL | impl dyn Trait {} + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/associated-type-bounds/elision.stderr b/tests/ui/associated-type-bounds/elision.stderr index ea3024627..cc10bbcc0 100644 --- a/tests/ui/associated-type-bounds/elision.stderr +++ b/tests/ui/associated-type-bounds/elision.stderr @@ -14,12 +14,12 @@ error[E0308]: mismatched types --> $DIR/elision.rs:5:79 | LL | fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() } - | ----------------------------- -------------- ^^^^^^^^ expected `&()`, found type parameter `impl Iterator` + | ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option>` | | | - | | expected `Option<&'static ()>` because of return type + | | expected `Option<&()>` because of return type | this type parameter | - = note: expected enum `Option<&'static ()>` + = note: expected enum `Option<&()>` found enum `Option>` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/inside-adt.rs b/tests/ui/associated-type-bounds/inside-adt.rs index 8eb8c44bb..057966941 100644 --- a/tests/ui/associated-type-bounds/inside-adt.rs +++ b/tests/ui/associated-type-bounds/inside-adt.rs @@ -3,28 +3,24 @@ use std::mem::ManuallyDrop; struct S1 { f: dyn Iterator } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures struct S2 { f: Box> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures struct S3 { f: dyn Iterator } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures enum E1 { V(dyn Iterator) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures enum E2 { V(Box>) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures enum E3 { V(dyn Iterator) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures union U1 { f: ManuallyDrop> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures union U2 { f: ManuallyDrop>> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures union U3 { f: ManuallyDrop> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures fn main() {} diff --git a/tests/ui/associated-type-bounds/inside-adt.stderr b/tests/ui/associated-type-bounds/inside-adt.stderr index dbfcfa580..f848bd798 100644 --- a/tests/ui/associated-type-bounds/inside-adt.stderr +++ b/tests/ui/associated-type-bounds/inside-adt.stderr @@ -1,131 +1,56 @@ -error: associated type bounds are not allowed within structs, enums, or unions +error: associated type bounds are only allowed in where clauses and function signatures, not in field types --> $DIR/inside-adt.rs:5:29 | LL | struct S1 { f: dyn Iterator } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions +error: associated type bounds are only allowed in where clauses and function signatures, not in field types --> $DIR/inside-adt.rs:7:33 | LL | struct S2 { f: Box> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions +error: associated type bounds are only allowed in where clauses and function signatures, not in field types --> $DIR/inside-adt.rs:9:29 | LL | struct S3 { f: dyn Iterator } | ^^^^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions +error: associated type bounds are only allowed in where clauses and function signatures, not in field types --> $DIR/inside-adt.rs:12:26 | LL | enum E1 { V(dyn Iterator) } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:15:30 +error: associated type bounds are only allowed in where clauses and function signatures, not in field types + --> $DIR/inside-adt.rs:14:30 | LL | enum E2 { V(Box>) } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:17:26 +error: associated type bounds are only allowed in where clauses and function signatures, not in field types + --> $DIR/inside-adt.rs:16:26 | LL | enum E3 { V(dyn Iterator) } | ^^^^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:21:41 +error: associated type bounds are only allowed in where clauses and function signatures, not in field types + --> $DIR/inside-adt.rs:19:41 | LL | union U1 { f: ManuallyDrop> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:24:45 +error: associated type bounds are only allowed in where clauses and function signatures, not in field types + --> $DIR/inside-adt.rs:21:45 | LL | union U2 { f: ManuallyDrop>> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:26:41 +error: associated type bounds are only allowed in where clauses and function signatures, not in field types + --> $DIR/inside-adt.rs:23:41 | LL | union U3 { f: ManuallyDrop> } | ^^^^^^^^^^^^^ -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:12:13 - | -LL | enum E1 { V(dyn Iterator) } - | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | enum E1 { V(&dyn Iterator) } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | enum E1 { V(Box>) } - | ++++ + - -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:17:13 - | -LL | enum E3 { V(dyn Iterator) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | enum E3 { V(&dyn Iterator) } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | enum E3 { V(Box>) } - | ++++ + - -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:21:15 - | -LL | union U1 { f: ManuallyDrop> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `ManuallyDrop<(dyn Iterator + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: required because it appears within the type `ManuallyDrop<(dyn Iterator + 'static)>` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | union U1 { f: &ManuallyDrop> } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | union U1 { f: Box>> } - | ++++ + - -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:26:15 - | -LL | union U3 { f: ManuallyDrop> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `ManuallyDrop<(dyn Iterator + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: required because it appears within the type `ManuallyDrop<(dyn Iterator + 'static)>` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | union U3 { f: &ManuallyDrop> } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | union U3 { f: Box>> } - | ++++ + - -error: aborting due to 13 previous errors +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-type-bounds/issue-71443-1.stderr b/tests/ui/associated-type-bounds/issue-71443-1.stderr index a9459ee74..15cc9646b 100644 --- a/tests/ui/associated-type-bounds/issue-71443-1.stderr +++ b/tests/ui/associated-type-bounds/issue-71443-1.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn hello Iterator>() { | - help: try adding a return type: `-> Incorrect` LL | Incorrect - | ^^^^^^^^^ expected `()`, found struct `Incorrect` + | ^^^^^^^^^ expected `()`, found `Incorrect` error: aborting due to previous error diff --git a/tests/ui/associated-types/associated-type-projection-from-supertrait.stderr b/tests/ui/associated-types/associated-type-projection-from-supertrait.stderr index d6b18d4ed..3f3bf22b0 100644 --- a/tests/ui/associated-types/associated-type-projection-from-supertrait.stderr +++ b/tests/ui/associated-types/associated-type-projection-from-supertrait.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:27:23 | LL | fn b() { dent(ModelT, Blue); } - | ---- ^^^^ expected struct `Black`, found struct `Blue` + | ---- ^^^^ expected `Black`, found `Blue` | | | arguments to this function are incorrect | @@ -16,7 +16,7 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:28:23 | LL | fn c() { dent(ModelU, Black); } - | ---- ^^^^^ expected struct `Blue`, found struct `Black` + | ---- ^^^^^ expected `Blue`, found `Black` | | | arguments to this function are incorrect | @@ -30,11 +30,11 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:32:28 | LL | fn f() { ModelT.chip_paint(Blue); } - | ---------- ^^^^ expected struct `Black`, found struct `Blue` + | ---------- ^^^^ expected `Black`, found `Blue` | | | arguments to this method are incorrect | -note: associated function defined here +note: method defined here --> $DIR/associated-type-projection-from-supertrait.rs:12:8 | LL | fn chip_paint(&self, c: Self::Color) { } @@ -44,11 +44,11 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:33:28 | LL | fn g() { ModelU.chip_paint(Black); } - | ---------- ^^^^^ expected struct `Blue`, found struct `Black` + | ---------- ^^^^^ expected `Blue`, found `Black` | | | arguments to this method are incorrect | -note: associated function defined here +note: method defined here --> $DIR/associated-type-projection-from-supertrait.rs:12:8 | LL | fn chip_paint(&self, c: Self::Color) { } diff --git a/tests/ui/associated-types/associated-types-eq-3.rs b/tests/ui/associated-types/associated-types-eq-3.rs index f6988dcf6..380d0e95c 100644 --- a/tests/ui/associated-types/associated-types-eq-3.rs +++ b/tests/ui/associated-types/associated-types-eq-3.rs @@ -23,7 +23,7 @@ fn foo2(x: I) { let _: Bar = x.boo(); //~^ ERROR mismatched types //~| found associated type `::A` - //~| expected struct `Bar`, found associated type + //~| expected `Bar`, found //~| expected struct `Bar` } diff --git a/tests/ui/associated-types/associated-types-eq-3.stderr b/tests/ui/associated-types/associated-types-eq-3.stderr index fbe1a1ee8..15ce4fc91 100644 --- a/tests/ui/associated-types/associated-types-eq-3.stderr +++ b/tests/ui/associated-types/associated-types-eq-3.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/associated-types-eq-3.rs:23:18 | LL | let _: Bar = x.boo(); - | --- ^^^^^^^ expected struct `Bar`, found associated type + | --- ^^^^^^^ expected `Bar`, found associated type | | | expected due to this | diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 6cff403b3..3e1142d5d 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -1,8 +1,8 @@ -error[E0271]: type mismatch resolving `for<'x> >::A == &'x isize` +error[E0271]: type mismatch resolving `>::A == &isize` --> $DIR/associated-types-eq-hr.rs:87:11 | LL | foo::(); - | ^^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x isize` + | ^^^^^^^^^^ type mismatch resolving `>::A == &isize` | note: expected this to be `&isize` --> $DIR/associated-types-eq-hr.rs:26:14 @@ -15,16 +15,16 @@ note: required by a bound in `foo` --> $DIR/associated-types-eq-hr.rs:45:36 | LL | fn foo() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, | ^^^^^^^^^^^^^ required by this bound in `foo` -error[E0271]: type mismatch resolving `for<'x> >::A == &'x usize` +error[E0271]: type mismatch resolving `>::A == &usize` --> $DIR/associated-types-eq-hr.rs:91:11 | LL | bar::(); - | ^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x usize` + | ^^^^^^^^^ type mismatch resolving `>::A == &usize` | note: expected this to be `&usize` --> $DIR/associated-types-eq-hr.rs:14:14 @@ -37,7 +37,7 @@ note: required by a bound in `bar` --> $DIR/associated-types-eq-hr.rs:52:36 | LL | fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, | ^^^^^^^^^^^^^ required by this bound in `bar` diff --git a/tests/ui/associated-types/associated-types-outlives.stderr b/tests/ui/associated-types/associated-types-outlives.stderr index 840e33b4b..2fe3f2d4a 100644 --- a/tests/ui/associated-types/associated-types-outlives.stderr +++ b/tests/ui/associated-types/associated-types-outlives.stderr @@ -1,6 +1,9 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/associated-types-outlives.rs:22:14 | +LL | F: for<'a> FnOnce(>::Bar)>(x: T, f: F) { + | - binding `x` declared here +... LL | 's: loop { y = denormalise(&x); break } | -- borrow of `x` occurs here LL | drop(x); diff --git a/tests/ui/associated-types/defaults-in-other-trait-items.rs b/tests/ui/associated-types/defaults-in-other-trait-items.rs index 505751969..f26380955 100644 --- a/tests/ui/associated-types/defaults-in-other-trait-items.rs +++ b/tests/ui/associated-types/defaults-in-other-trait-items.rs @@ -44,4 +44,18 @@ impl AssocConst for () { const C: Self::Ty = 0u8; } +pub trait Trait { + type Res = isize; //~ NOTE associated type defaults can't be assumed inside the trait defining them + + fn infer_me_correctly() -> Self::Res { + //~^ NOTE expected `::Res` because of return type + + // {integer} == isize + 2 + //~^ ERROR mismatched types + //~| NOTE expected associated type, found integer + //~| NOTE expected associated type `::Res` + } +} + fn main() {} diff --git a/tests/ui/associated-types/defaults-in-other-trait-items.stderr b/tests/ui/associated-types/defaults-in-other-trait-items.stderr index 71d421926..bdcfadd39 100644 --- a/tests/ui/associated-types/defaults-in-other-trait-items.stderr +++ b/tests/ui/associated-types/defaults-in-other-trait-items.stderr @@ -24,6 +24,21 @@ LL | const C: Self::Ty = 0u8; = note: expected associated type `::Ty` found type `u8` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/defaults-in-other-trait-items.rs:54:9 + | +LL | type Res = isize; + | ----------------- associated type defaults can't be assumed inside the trait defining them +LL | +LL | fn infer_me_correctly() -> Self::Res { + | --------- expected `::Res` because of return type +... +LL | 2 + | ^ expected associated type, found integer + | + = note: expected associated type `::Res` + found type `{integer}` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.stderr index eadad4cd5..248575875 100644 --- a/tests/ui/associated-types/defaults-suitability.stderr +++ b/tests/ui/associated-types/defaults-suitability.stderr @@ -27,7 +27,7 @@ LL | Self::Ty: Clone, | ^^^^^ required by this bound in `Tr2::Ty` LL | { LL | type Ty = NotClone; - | -- required by a bound in this + | -- required by a bound in this associated type help: consider annotating `NotClone` with `#[derive(Clone)]` | LL | #[derive(Clone)] @@ -75,7 +75,7 @@ LL | Self::Assoc: IsU8, | ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc` ... LL | type Assoc = NotClone; - | ----- required by a bound in this + | ----- required by a bound in this associated type error[E0277]: the trait bound `>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:65:23 @@ -124,7 +124,7 @@ LL | Self::Baz: Clone, | ^^^^^ required by this bound in `Foo3::Baz` ... LL | type Baz = T; - | --- required by a bound in this + | --- required by a bound in this associated type help: consider further restricting type parameter `T` | LL | Self::Baz: Clone, T: std::clone::Clone diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-1.stderr index 73b5e1053..b380a1b6f 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-1.rs:3:33 | LL | trait X<'a> - | - required by a bound in this + | - required by a bound in this trait LL | where LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 6d19186bd..a0a6f76a5 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -8,7 +8,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-object.rs:3:33 | LL | trait X<'a> - | - required by a bound in this + | - required by a bound in this trait LL | where LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr index af2e61689..e249f2e0c 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Y` --> $DIR/hr-associated-type-bound-param-1.rs:4:36 | LL | trait Y<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::V: Clone, | ^^^^^ required by this bound in `Y` 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 52294f8c9..366670269 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 @@ -9,7 +9,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` @@ -25,7 +25,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` @@ -41,7 +41,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr index 84d5e0494..f49439d35 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-3.rs:4:33 | LL | trait X<'a, T> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr index ee1d5d324..f8733b423 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-4.rs:4:36 | LL | trait X<'a, T> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> <(T,) as X<'b, T>>::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr index ece3151ba..aae80a9b2 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-5.rs:17:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` @@ -25,7 +25,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-5.rs:17:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` 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 a65f84ae5..dd0389c34 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -10,14 +10,14 @@ note: required by a bound in `UnsafeCopy` --> $DIR/hr-associated-type-projection-1.rs:3:64 | LL | trait UnsafeCopy<'a, T: Copy> - | ---------- required by a bound in this + | ---------- required by a bound in this trait LL | where LL | for<'b> >::Item: std::ops::Deref, | ^^^^^^^^^^ required by this bound in `UnsafeCopy` help: consider further restricting this bound | -LL | impl> UnsafeCopy<'_, T> for T { - | +++++++++++++++++++ +LL | impl> UnsafeCopy<'_, T> for T { + | ++++++++++++ error: aborting due to previous error diff --git a/tests/ui/associated-types/issue-26681.stderr b/tests/ui/associated-types/issue-26681.stderr index 74411008c..977620d90 100644 --- a/tests/ui/associated-types/issue-26681.stderr +++ b/tests/ui/associated-types/issue-26681.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types --> $DIR/issue-26681.rs:17:39 | +LL | type Fv: Foo = u8; + | ------------------ associated type defaults can't be assumed inside the trait defining them LL | const C: ::Bar = 6665; | ^^^^ expected associated type, found integer | = note: expected associated type `<::Fv as Foo>::Bar` found type `{integer}` - = help: consider constraining the associated type `<::Fv as Foo>::Bar` to `{integer}` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html error: aborting due to previous error diff --git a/tests/ui/associated-types/issue-38821.rs b/tests/ui/associated-types/issue-38821.rs new file mode 100644 index 000000000..6753860e9 --- /dev/null +++ b/tests/ui/associated-types/issue-38821.rs @@ -0,0 +1,33 @@ +pub struct Nullable(T); + +pub trait NotNull {} + +pub trait IntoNullable { + type Nullable; +} + +impl IntoNullable for T { + type Nullable = Nullable; +} + +impl IntoNullable for Nullable { + type Nullable = Nullable; +} + +pub trait Expression { + type SqlType; +} + +pub trait Column: Expression {} + +#[derive(Debug, Copy, Clone)] +//~^ ERROR the trait bound `::SqlType: NotNull` is not satisfied +pub enum ColumnInsertValue where + Col: Column, + Expr: Expression::Nullable>, +{ + Expression(Col, Expr), + Default(Col), +} + +fn main() {} diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr new file mode 100644 index 000000000..a52a9c138 --- /dev/null +++ b/tests/ui/associated-types/issue-38821.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied + --> $DIR/issue-38821.rs:23:17 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^ the trait `NotNull` is not implemented for `::SqlType` + | +note: required for `::SqlType` to implement `IntoNullable` + --> $DIR/issue-38821.rs:9:18 + | +LL | impl IntoNullable for T { + | ------- ^^^^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting the associated type + | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull, + | +++++++++++++++++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-43924.stderr b/tests/ui/associated-types/issue-43924.stderr index 526f425b2..ab1a9511e 100644 --- a/tests/ui/associated-types/issue-43924.stderr +++ b/tests/ui/associated-types/issue-43924.stderr @@ -14,7 +14,7 @@ error[E0599]: no function or associated item named `default` found for trait obj --> $DIR/issue-43924.rs:14:39 | LL | assert_eq!(<() as Foo>::Out::default().to_string(), "false"); - | ^^^^^^^ function or associated item not found in `(dyn ToString + 'static)` + | ^^^^^^^ function or associated item not found in `dyn ToString` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/issue-87261.rs b/tests/ui/associated-types/issue-87261.rs index e8548d402..384561f8c 100644 --- a/tests/ui/associated-types/issue-87261.rs +++ b/tests/ui/associated-types/issue-87261.rs @@ -77,10 +77,10 @@ where fn main() { accepts_trait(returns_opaque()); - //~^ ERROR type mismatch resolving `::Associated == ()` + //~^ ERROR type mismatch resolving `::Associated == ()` accepts_trait(returns_opaque_derived()); - //~^ ERROR type mismatch resolving `::Associated == ()` + //~^ ERROR type mismatch resolving `::Associated == ()` accepts_trait(returns_opaque_foo()); //~^ ERROR type mismatch resolving `::Associated == ()` @@ -89,7 +89,7 @@ fn main() { //~^ ERROR type mismatch resolving `::Associated == ()` accepts_generic_trait(returns_opaque_generic()); - //~^ ERROR type mismatch resolving ` + 'static as GenericTrait<()>>::Associated == ()` + //~^ ERROR type mismatch resolving ` as GenericTrait<()>>::Associated == ()` accepts_generic_trait(returns_opaque_generic_foo()); //~^ ERROR type mismatch resolving ` + Foo as GenericTrait<()>>::Associated == ()` diff --git a/tests/ui/associated-types/issue-87261.stderr b/tests/ui/associated-types/issue-87261.stderr index 2cce6b947..f5c6d8247 100644 --- a/tests/ui/associated-types/issue-87261.stderr +++ b/tests/ui/associated-types/issue-87261.stderr @@ -132,7 +132,7 @@ note: required by a bound in `accepts_generic_trait` LL | fn accepts_generic_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` -error[E0271]: type mismatch resolving `::Associated == ()` +error[E0271]: type mismatch resolving `::Associated == ()` --> $DIR/issue-87261.rs:79:19 | LL | fn returns_opaque() -> impl Trait + 'static { @@ -155,7 +155,7 @@ help: consider constraining the associated type ` LL | fn returns_opaque() -> impl Trait + 'static { | +++++++++++++++++ -error[E0271]: type mismatch resolving `::Associated == ()` +error[E0271]: type mismatch resolving `::Associated == ()` --> $DIR/issue-87261.rs:82:19 | LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static { @@ -222,7 +222,7 @@ note: required by a bound in `accepts_trait` LL | fn accepts_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` -error[E0271]: type mismatch resolving ` + 'static as GenericTrait<()>>::Associated == ()` +error[E0271]: type mismatch resolving ` as GenericTrait<()>>::Associated == ()` --> $DIR/issue-87261.rs:91:27 | LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static { diff --git a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr index 2e7a1dd2a..3b4689e08 100644 --- a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr +++ b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr @@ -23,7 +23,7 @@ LL | Self::Assoc: Bar, | ^^^ required by this bound in `Baz::Assoc` LL | { LL | type Assoc; - | ----- required by a bound in this + | ----- required by a bound in this associated type error[E0277]: the trait bound `bool: Bar` is not satisfied --> $DIR/point-at-type-on-obligation-failure-2.rs:30:18 @@ -38,7 +38,7 @@ LL | ::Assoc: Bar, | ^^^ required by this bound in `Bat::Assoc` LL | { LL | type Assoc; - | ----- required by a bound in this + | ----- required by a bound in this associated type error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr new file mode 100644 index 000000000..fb83ca90a --- /dev/null +++ b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr @@ -0,0 +1,106 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:48:13 + | +LL | is_send(foo(Some(true))); + | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:11:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^^ await occurs here, with `r` maybe used later +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error[E0277]: `Rc<()>` cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:50:13 + | +LL | async fn foo2(x: Option) { + | - within this `impl Future` +... +LL | is_send(foo2(Some(true))); + | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:27:29 + | +LL | async fn bar2(_: T) -> ! { + | _____________________________^ +LL | | panic!() +LL | | } + | |_^ + = note: required because it captures the following types: `ResumeTy`, `Option`, `impl Future`, `()` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:21:32 + | +LL | async fn foo2(x: Option) { + | ________________________________^ +LL | | let Some(_) = x else { +LL | | bar2(Rc::new(())).await +LL | | }; +LL | | } + | |_^ +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:52:13 + | +LL | is_send(foo3(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:33:28 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later + | has type `Rc<()>` which is not `Send` +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:54:13 + | +LL | is_send(foo4(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:41:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^^ await occurs here, with `r` maybe used later +... +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr new file mode 100644 index 000000000..c284bbfb1 --- /dev/null +++ b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr @@ -0,0 +1,100 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:48:13 + | +LL | is_send(foo(Some(true))); + | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:11:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^^ await occurs here, with `r` maybe used later +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error[E0277]: `Rc<()>` cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:50:13 + | +LL | async fn foo2(x: Option) { + | - within this `impl Future` +... +LL | is_send(foo2(Some(true))); + | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:27:29 + | +LL | async fn bar2(_: T) -> ! { + | _____________________________^ +LL | | panic!() +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:21:32 + | +LL | async fn foo2(x: Option) { + | ________________________________^ +LL | | let Some(_) = x else { +LL | | bar2(Rc::new(())).await +LL | | }; +LL | | } + | |_^ +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:52:13 + | +LL | is_send(foo3(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:33:28 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later + | | + | has type `Rc<()>` which is not `Send` +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:54:13 + | +LL | is_send(foo4(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:41:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^^ await occurs here, with `r` maybe used later +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr new file mode 100644 index 000000000..d3c5e80a3 --- /dev/null +++ b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr @@ -0,0 +1,90 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:48:13 + | +LL | is_send(foo(Some(true))); + | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:11:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^^ await occurs here, with `r` maybe used later +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:50:13 + | +LL | is_send(foo2(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:23:26 + | +LL | bar2(Rc::new(())).await + | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later + | | + | has type `Rc<()>` which is not `Send` +LL | }; + | - `Rc::new(())` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:52:13 + | +LL | is_send(foo3(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:33:28 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later + | has type `Rc<()>` which is not `Send` +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:54:13 + | +LL | is_send(foo4(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:41:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^^ await occurs here, with `r` maybe used later +... +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/async-await/async-await-let-else.rs b/tests/ui/async-await/async-await-let-else.rs index 3fb2142b9..113d576b5 100644 --- a/tests/ui/async-await/async-await-let-else.rs +++ b/tests/ui/async-await/async-await-let-else.rs @@ -1,7 +1,7 @@ // edition:2021 -// revisions: drop-tracking no-drop-tracking -// [drop-tracking] compile-flags: -Zdrop-tracking=yes -// [no-drop-tracking] compile-flags: -Zdrop-tracking=no +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir use std::rc::Rc; diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr index c4487eb84..a6dbb0716 100644 --- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -57,7 +57,7 @@ error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:49:44 | LL | fn rethrow_targets_async_block_not_fn() -> Result { - | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` + | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | @@ -68,7 +68,7 @@ error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:58:50 | LL | fn rethrow_targets_async_block_not_async_fn() -> Result { - | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` + | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/async-await/async-error-span.drop_tracking.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr new file mode 100644 index 000000000..c6257cb32 --- /dev/null +++ b/tests/ui/async-await/async-error-span.drop_tracking.stderr @@ -0,0 +1,25 @@ +error[E0277]: `()` is not a future + --> $DIR/async-error-span.rs:10:20 + | +LL | fn get_future() -> impl Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/async-error-span.rs:16:9 + | +LL | let a; + | ^ cannot infer type + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/async-error-span.rs:19:17 + | +LL | get_future().await; + | ^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0698. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr b/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr new file mode 100644 index 000000000..2f29ee6cd --- /dev/null +++ b/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr @@ -0,0 +1,24 @@ +error[E0277]: `()` is not a future + --> $DIR/async-error-span.rs:10:20 + | +LL | fn get_future() -> impl Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited + +error[E0282]: type annotations needed + --> $DIR/async-error-span.rs:16:9 + | +LL | let a; + | ^ + | +help: consider giving `a` an explicit type + | +LL | let a: /* Type */; + | ++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0282. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr new file mode 100644 index 000000000..c6257cb32 --- /dev/null +++ b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr @@ -0,0 +1,25 @@ +error[E0277]: `()` is not a future + --> $DIR/async-error-span.rs:10:20 + | +LL | fn get_future() -> impl Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/async-error-span.rs:16:9 + | +LL | let a; + | ^ cannot infer type + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/async-error-span.rs:19:17 + | +LL | get_future().await; + | ^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0698. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs index 86d459bf0..c9ecf359e 100644 --- a/tests/ui/async-await/async-error-span.rs +++ b/tests/ui/async-await/async-error-span.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 // Regression test for issue #62382. @@ -10,7 +13,9 @@ fn get_future() -> impl Future { } async fn foo() { - let a; //~ ERROR type inside `async fn` body must be known in this context + let a; + //[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context + //[drop_tracking_mir]~^^ ERROR type annotations needed get_future().await; } diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr deleted file mode 100644 index 7d4447b6d..000000000 --- a/tests/ui/async-await/async-error-span.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/async-error-span.rs:7:20 - | -LL | fn get_future() -> impl Future { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/async-error-span.rs:13:9 - | -LL | let a; - | ^ cannot infer type - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/async-error-span.rs:14:17 - | -LL | get_future().await; - | ^^^^^^ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0698. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr new file mode 100644 index 000000000..0f0dc335e --- /dev/null +++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr @@ -0,0 +1,49 @@ +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:72:17 + | +LL | assert_send(non_send_temporary_in_match()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:36:25 + | +LL | match Some(non_send()) { + | ---------------- has type `Option` which is not `Send` +LL | Some(_) => fut().await, + | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later +... +LL | } + | - `Some(non_send())` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:74:17 + | +LL | assert_send(non_sync_with_method_call()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:49:14 + | +LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); + | --------------- has type `Formatter<'_>` which is not `Send` +... +LL | fut().await; + | ^^^^^^ await occurs here, with `get_formatter()` maybe used later +LL | } +LL | } + | - `get_formatter()` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr new file mode 100644 index 000000000..57a012801 --- /dev/null +++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr @@ -0,0 +1,43 @@ +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:72:17 + | +LL | assert_send(non_send_temporary_in_match()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:36:25 + | +LL | match Some(non_send()) { + | ---------------- has type `Option` which is not `Send` +LL | Some(_) => fut().await, + | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:74:17 + | +LL | assert_send(non_sync_with_method_call()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:49:14 + | +LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); + | --------------- has type `Formatter<'_>` which is not `Send` +... +LL | fut().await; + | ^^^^^^ await occurs here, with `get_formatter()` maybe used later +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr new file mode 100644 index 000000000..5cec21d89 --- /dev/null +++ b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr @@ -0,0 +1,120 @@ +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:70:17 + | +LL | assert_send(local_dropped_before_await()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:27:10 + | +LL | let x = non_send(); + | - has type `impl Debug` which is not `Send` +LL | drop(x); +LL | fut().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | } + | - `x` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:72:17 + | +LL | assert_send(non_send_temporary_in_match()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:36:25 + | +LL | match Some(non_send()) { + | ---------- has type `impl Debug` which is not `Send` +LL | Some(_) => fut().await, + | ^^^^^^ await occurs here, with `non_send()` maybe used later +... +LL | } + | - `non_send()` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:74:17 + | +LL | assert_send(non_sync_with_method_call()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:49:14 + | +LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); + | --------------- has type `Formatter<'_>` which is not `Send` +... +LL | fut().await; + | ^^^^^^ await occurs here, with `get_formatter()` maybe used later +LL | } +LL | } + | - `get_formatter()` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:76:17 + | +LL | assert_send(non_sync_with_method_call_panic()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:56:14 + | +LL | let f: &mut std::fmt::Formatter = panic!(); + | - has type `&mut Formatter<'_>` which is not `Send` +LL | if non_sync().fmt(f).unwrap() == () { +LL | fut().await; + | ^^^^^^ await occurs here, with `f` maybe used later +LL | } +LL | } + | - `f` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:78:17 + | +LL | assert_send(non_sync_with_method_call_infinite_loop()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` +note: future is not `Send` as this value is used across an await + --> $DIR/async-fn-nonsend.rs:63:14 + | +LL | let f: &mut std::fmt::Formatter = loop {}; + | - has type `&mut Formatter<'_>` which is not `Send` +LL | if non_sync().fmt(f).unwrap() == () { +LL | fut().await; + | ^^^^^^ await occurs here, with `f` maybe used later +LL | } +LL | } + | - `f` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:67:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 5 previous errors + diff --git a/tests/ui/async-await/async-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs index d7f8d7ac5..ed440bd01 100644 --- a/tests/ui/async-await/async-fn-nonsend.rs +++ b/tests/ui/async-await/async-fn-nonsend.rs @@ -1,5 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 -// compile-flags: --crate-type lib -Zdrop-tracking +// compile-flags: --crate-type lib use std::{cell::RefCell, fmt::Debug, rc::Rc}; @@ -65,10 +68,13 @@ fn assert_send(_: impl Send) {} pub fn pass_assert() { assert_send(local_dropped_before_await()); + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely assert_send(non_send_temporary_in_match()); //~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call()); //~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call_panic()); + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call_infinite_loop()); + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely } diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr index a7b872fe4..0f0dc335e 100644 --- a/tests/ui/async-await/async-fn-nonsend.stderr +++ b/tests/ui/async-await/async-fn-nonsend.stderr @@ -1,12 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/async-fn-nonsend.rs:68:17 + --> $DIR/async-fn-nonsend.rs:72:17 | LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` note: future is not `Send` as this value is used across an await - --> $DIR/async-fn-nonsend.rs:33:25 + --> $DIR/async-fn-nonsend.rs:36:25 | LL | match Some(non_send()) { | ---------------- has type `Option` which is not `Send` @@ -16,20 +16,20 @@ LL | Some(_) => fut().await, LL | } | - `Some(non_send())` is later dropped here note: required by a bound in `assert_send` - --> $DIR/async-fn-nonsend.rs:64:24 + --> $DIR/async-fn-nonsend.rs:67:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` error: future cannot be sent between threads safely - --> $DIR/async-fn-nonsend.rs:70:17 + --> $DIR/async-fn-nonsend.rs:74:17 | LL | assert_send(non_sync_with_method_call()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `dyn std::fmt::Write` note: future is not `Send` as this value is used across an await - --> $DIR/async-fn-nonsend.rs:46:14 + --> $DIR/async-fn-nonsend.rs:49:14 | LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); | --------------- has type `Formatter<'_>` which is not `Send` @@ -40,7 +40,7 @@ LL | } LL | } | - `get_formatter()` is later dropped here note: required by a bound in `assert_send` - --> $DIR/async-fn-nonsend.rs:64:24 + --> $DIR/async-fn-nonsend.rs:67:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` diff --git a/tests/ui/async-await/async-fn-path-elision.stderr b/tests/ui/async-await/async-fn-path-elision.stderr index 5e0c8c299..224198653 100644 --- a/tests/ui/async-await/async-fn-path-elision.stderr +++ b/tests/ui/async-await/async-fn-path-elision.stderr @@ -4,7 +4,6 @@ error[E0726]: implicit elided lifetime not allowed here LL | async fn error(lt: HasLifetime) { | ^^^^^^^^^^^ expected lifetime parameter | - = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | LL | async fn error(lt: HasLifetime<'_>) { diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs index 64fb6280d..daee8469a 100644 --- a/tests/ui/async-await/default-struct-update.rs +++ b/tests/ui/async-await/default-struct-update.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking=y fn main() { let _ = foo(); diff --git a/tests/ui/async-await/dont-suggest-missing-await.stderr b/tests/ui/async-await/dont-suggest-missing-await.stderr index 627bf05bb..1fa4e5db0 100644 --- a/tests/ui/async-await/dont-suggest-missing-await.stderr +++ b/tests/ui/async-await/dont-suggest-missing-await.stderr @@ -2,17 +2,15 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-missing-await.rs:14:18 | LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type + | -------- ^ expected `u32`, found future | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/dont-suggest-missing-await.rs:7:24 +note: calling an async function returns a future + --> $DIR/dont-suggest-missing-await.rs:14:18 | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` +LL | take_u32(x) + | ^ note: function defined here --> $DIR/dont-suggest-missing-await.rs:5:4 | diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs index fa3f33036..e520dfbdc 100644 --- a/tests/ui/async-await/drop-and-assign.rs +++ b/tests/ui/async-await/drop-and-assign.rs @@ -1,5 +1,7 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2021 -// compile-flags: -Zdrop-tracking // build-pass struct A; diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr new file mode 100644 index 000000000..e2bba812d --- /dev/null +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be sent between threads safely + --> $DIR/drop-track-field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/drop-track-field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +LL | } + | - `mut info` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/drop-track-field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr new file mode 100644 index 000000000..b89d86804 --- /dev/null +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/drop-track-field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/drop-track-field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +note: required by a bound in `assert_send` + --> $DIR/drop-track-field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr new file mode 100644 index 000000000..e2bba812d --- /dev/null +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be sent between threads safely + --> $DIR/drop-track-field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/drop-track-field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +LL | } + | - `mut info` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/drop-track-field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs index b6c0fda15..3e2228000 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // Derived from an ICE found in tokio-xmpp during a crater run. // edition:2021 -// compile-flags: -Zdrop-tracking #![allow(dead_code)] diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr deleted file mode 100644 index d95483c81..000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/drop-track-field-assign-nonsend.rs:43:17 - | -LL | assert_send(agent.handle()); - | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc` -note: future is not `Send` as this value is used across an await - --> $DIR/drop-track-field-assign-nonsend.rs:21:38 - | -LL | let mut info = self.info_result.clone(); - | -------- has type `InfoResult` which is not `Send` -... -LL | let _ = send_element(element).await; - | ^^^^^^ await occurs here, with `mut info` maybe used later -LL | } - | - `mut info` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/drop-track-field-assign-nonsend.rs:38:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to previous error - diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs index 3a393cd16..dd0e3f11c 100644 --- a/tests/ui/async-await/drop-track-field-assign.rs +++ b/tests/ui/async-await/drop-track-field-assign.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // Derived from an ICE found in tokio-xmpp during a crater run. // edition:2021 -// compile-flags: -Zdrop-tracking // build-pass #![allow(dead_code)] diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr new file mode 100644 index 000000000..ac461a671 --- /dev/null +++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be sent between threads safely + --> $DIR/field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +LL | } + | - `mut info` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr new file mode 100644 index 000000000..8c9d14d62 --- /dev/null +++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +note: required by a bound in `assert_send` + --> $DIR/field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr new file mode 100644 index 000000000..ac461a671 --- /dev/null +++ b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be sent between threads safely + --> $DIR/field-assign-nonsend.rs:45:17 + | +LL | assert_send(agent.handle()); + | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc` +note: future is not `Send` as this value is used across an await + --> $DIR/field-assign-nonsend.rs:23:38 + | +LL | let mut info = self.info_result.clone(); + | -------- has type `InfoResult` which is not `Send` +... +LL | let _ = send_element(element).await; + | ^^^^^^ await occurs here, with `mut info` maybe used later +LL | } + | - `mut info` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/field-assign-nonsend.rs:40:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs new file mode 100644 index 000000000..3e2228000 --- /dev/null +++ b/tests/ui/async-await/field-assign-nonsend.rs @@ -0,0 +1,47 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// Derived from an ICE found in tokio-xmpp during a crater run. +// edition:2021 + +#![allow(dead_code)] + +#[derive(Clone)] +struct InfoResult { + node: Option> +} + +struct Agent { + info_result: InfoResult +} + +impl Agent { + async fn handle(&mut self) { + let mut info = self.info_result.clone(); + info.node = None; + let element = parse_info(info); + let _ = send_element(element).await; + } +} + +struct Element { +} + +async fn send_element(_: Element) {} + +fn parse(_: &[u8]) -> Result<(), ()> { + Ok(()) +} + +fn parse_info(_: InfoResult) -> Element { + Element { } +} + +fn assert_send(_: T) {} + +fn main() { + let agent = Agent { info_result: InfoResult { node: None } }; + // FIXME: It would be nice for this to work. See #94067. + assert_send(agent.handle()); + //~^ cannot be sent between threads safely +} diff --git a/tests/ui/async-await/field-assign.rs b/tests/ui/async-await/field-assign.rs new file mode 100644 index 000000000..dd0e3f11c --- /dev/null +++ b/tests/ui/async-await/field-assign.rs @@ -0,0 +1,46 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// Derived from an ICE found in tokio-xmpp during a crater run. +// edition:2021 +// build-pass + +#![allow(dead_code)] + +#[derive(Clone)] +struct InfoResult { + node: Option +} + +struct Agent { + info_result: InfoResult +} + +impl Agent { + async fn handle(&mut self) { + let mut info = self.info_result.clone(); + info.node = Some("bar".into()); + let element = parse_info(info); + let _ = send_element(element).await; + } +} + +struct Element { +} + +async fn send_element(_: Element) {} + +fn parse(_: &[u8]) -> Result<(), ()> { + Ok(()) +} + +fn parse_info(_: InfoResult) -> Element { + Element { } +} + +fn main() { + let mut agent = Agent { + info_result: InfoResult { node: None } + }; + let _ = agent.handle(); +} diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.rs b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs new file mode 100644 index 000000000..1816d842d --- /dev/null +++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs @@ -0,0 +1,24 @@ +// compile-flags: -Z print-type-sizes --crate-type lib +// edition:2021 +// build-pass +// ignore-pass + +async fn wait() {} + +async fn big_fut(arg: [u8; 1024]) {} + +async fn calls_fut(fut: impl std::future::Future) { + loop { + wait().await; + if true { + return fut.await; + } else { + wait().await; + } + } +} + +pub async fn test() { + let fut = big_fut([0u8; 1024]); + calls_fut(fut).await; +} diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout new file mode 100644 index 000000000..eaf3e4b61 --- /dev/null +++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout @@ -0,0 +1,72 @@ +print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2]`: 3078 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Suspend0`: 3077 bytes +print-type-size local `.__awaitee`: 3077 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes +print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]`: 3077 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 2051 bytes +print-type-size padding: 1026 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 2052 bytes +print-type-size local `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size local `..generator_field4`: 1 bytes +print-type-size padding: 1 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size local `.__awaitee`: 1 bytes +print-type-size variant `Suspend1`: 3076 bytes +print-type-size padding: 1024 bytes +print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes +print-type-size padding: 1 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size local `.__awaitee`: 1025 bytes +print-type-size variant `Suspend2`: 2052 bytes +print-type-size local `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size local `..generator_field4`: 1 bytes +print-type-size padding: 1 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size local `.__awaitee`: 1 bytes +print-type-size variant `Returned`: 2051 bytes +print-type-size padding: 1026 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 2051 bytes +print-type-size padding: 1026 bytes +print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes +print-type-size field `.value`: 3077 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 3077 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 3077 bytes +print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]`: 1025 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 1024 bytes +print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 1024 bytes +print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 1024 bytes +print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 1025 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes +print-type-size type: `std::mem::ManuallyDrop`: 1 bytes, alignment: 1 bytes +print-type-size field `.value`: 1 bytes +print-type-size type: `std::mem::MaybeUninit`: 1 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 1 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 1 bytes +print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Ready`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Pending`: 0 bytes diff --git a/tests/ui/async-await/future-sizes/future-as-arg.rs b/tests/ui/async-await/future-sizes/future-as-arg.rs new file mode 100644 index 000000000..93c69b052 --- /dev/null +++ b/tests/ui/async-await/future-sizes/future-as-arg.rs @@ -0,0 +1,16 @@ +// edition: 2021 +// run-pass + +async fn test(_arg: [u8; 16]) {} + +async fn use_future(fut: impl std::future::Future) { + fut.await +} + +fn main() { + let actual = std::mem::size_of_val( + &use_future(use_future(use_future(use_future(use_future(test([0; 16]))))))); + // Not using an exact number in case it slightly changes over different commits + let expected = 550; + assert!(actual > expected, "expected: >{expected}, actual: {actual}"); +} diff --git a/tests/ui/async-await/future-sizes/large-arg.rs b/tests/ui/async-await/future-sizes/large-arg.rs new file mode 100644 index 000000000..7e7ff9d8d --- /dev/null +++ b/tests/ui/async-await/future-sizes/large-arg.rs @@ -0,0 +1,18 @@ +// compile-flags: -Z print-type-sizes --crate-type=lib +// edition: 2021 +// build-pass +// ignore-pass + +pub async fn test() { + let _ = a([0u8; 1024]).await; +} + +pub async fn a(t: T) -> T { + b(t).await +} +async fn b(t: T) -> T { + c(t).await +} +async fn c(t: T) -> T { + t +} diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout new file mode 100644 index 000000000..91db4b153 --- /dev/null +++ b/tests/ui/async-await/future-sizes/large-arg.stdout @@ -0,0 +1,60 @@ +print-type-size type: `[async fn body@$DIR/large-arg.rs:6:21: 8:2]`: 3076 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Suspend0`: 3075 bytes +print-type-size local `.__awaitee`: 3075 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes +print-type-size type: `[async fn body@$DIR/large-arg.rs:10:30: 12:2]`: 3075 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 3074 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size local `.__awaitee`: 2050 bytes +print-type-size variant `Returned`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes +print-type-size field `.value`: 3075 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 3075 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 3075 bytes +print-type-size type: `[async fn body@$DIR/large-arg.rs:13:26: 15:2]`: 2050 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 2049 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size local `.__awaitee`: 1025 bytes +print-type-size variant `Returned`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes +print-type-size field `.value`: 2050 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 2050 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 2050 bytes +print-type-size type: `[async fn body@$DIR/large-arg.rs:16:26: 18:2]`: 1025 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 1025 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `std::task::Poll<[u8; 1024]>`: 1025 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Ready`: 1024 bytes +print-type-size field `.0`: 1024 bytes +print-type-size variant `Pending`: 0 bytes diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr index 963c6ba57..51ac9d86b 100644 --- a/tests/ui/async-await/generator-desc.stderr +++ b/tests/ui/async-await/generator-desc.stderr @@ -17,22 +17,10 @@ error[E0308]: mismatched types --> $DIR/generator-desc.rs:12:16 | LL | fun(one(), two()); - | --- ^^^^^ expected opaque type, found a different opaque type + | --- ^^^^^ expected future, found a different future | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:5:16 - | -LL | async fn one() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/generator-desc.rs:6:16 - | -LL | async fn two() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:5:16>) - found opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:6:16>) = help: consider `await`ing on both `Future`s = note: distinct uses of `impl Trait` result in different opaque types note: function defined here 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 new file mode 100644 index 000000000..0fd1a2703 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs @@ -0,0 +1,66 @@ +// run-pass +// edition:2021 + +#![feature(async_fn_in_trait)] +//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use + +use std::future::Future; + +trait AsyncTrait { + async fn default_impl() { + assert!(false); + } + + async fn call_default_impl() { + Self::default_impl().await + } +} + +struct AsyncType; + +impl AsyncTrait for AsyncType { + async fn default_impl() { + // :) + } +} + +async fn async_main() { + // Should not assert false + AsyncType::call_default_impl().await; +} + +// ------------------------------------------------------------------------- // +// Implementation Details Below... + +use std::pin::Pin; +use std::task::*; + +pub fn noop_waker() -> Waker { + let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); + + // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld + unsafe { Waker::from_raw(raw) } +} + +const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); + +unsafe fn noop_clone(_p: *const ()) -> RawWaker { + RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) +} + +unsafe fn noop(_p: *const ()) {} + +fn main() { + let mut fut = async_main(); + + // Poll loop, just to test the future... + let waker = noop_waker(); + let ctx = &mut Context::from_waker(&waker); + + loop { + match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + Poll::Pending => {} + Poll::Ready(()) => break, + } + } +} diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr new file mode 100644 index 000000000..61a826258 --- /dev/null +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr @@ -0,0 +1,11 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/async-default-fn-overridden.rs:4:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + 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 13e722255..168ef8e9e 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 @@ -2,7 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28 | LL | async fn foo(&self) -> i32 { - | ^^^ expected struct `Pin`, found opaque type + | ^^^ expected `Pin>>`, found future | note: type in trait --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22 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 new file mode 100644 index 000000000..afd3db5e0 --- /dev/null +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs @@ -0,0 +1,71 @@ +// edition: 2021 +// known-bug: #108309 + +#![feature(async_fn_in_trait)] +#![feature(min_specialization)] + +struct MyStruct; + +trait MyTrait { + async fn foo(_: T) -> &'static str; +} + +impl MyTrait for MyStruct { + default async fn foo(_: T) -> &'static str { + "default" + } +} + +impl MyTrait for MyStruct { + async fn foo(_: i32) -> &'static str { + "specialized" + } +} + +async fn async_main() { + assert_eq!(MyStruct::foo(42).await, "specialized"); + assert_eq!(indirection(42).await, "specialized"); +} + +async fn indirection(x: T) -> &'static str { + //explicit type coercion is currently necessary + // because of https://github.com/rust-lang/rust/issues/67918 + >::foo(x).await +} + +// ------------------------------------------------------------------------- // +// Implementation Details Below... + +use std::future::Future; +use std::pin::Pin; +use std::task::*; + +pub fn noop_waker() -> Waker { + let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); + + // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld + unsafe { Waker::from_raw(raw) } +} + +const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); + +unsafe fn noop_clone(_p: *const ()) -> RawWaker { + RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) +} + +unsafe fn noop(_p: *const ()) {} + +fn main() { + let mut fut = async_main(); + + // Poll loop, just to test the future... + let waker = noop_waker(); + let ctx = &mut Context::from_waker(&waker); + + loop { + match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + Poll::Pending => {} + Poll::Ready(()) => break, + } + } +} 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 new file mode 100644 index 000000000..f71fd9980 --- /dev/null +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -0,0 +1,19 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-project-to-specializable-projection.rs:4:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: async associated function in trait cannot be specialized + --> $DIR/dont-project-to-specializable-projection.rs:14: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 + +error: aborting due to previous error; 1 warning emitted + 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 2c4ed5535..78017429f 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 @@ -11,7 +11,7 @@ trait MyTrait { impl MyTrait for i32 { fn foo(&self) -> impl Future { - //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562] + //~^ 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 index f591f1847..37d9669c0 100644 --- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr +++ b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr @@ -1,4 +1,4 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return +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 { 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 5a9b15e54..b8d83d0f2 100644 --- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr +++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr @@ -13,7 +13,7 @@ error[E0308]: mismatched types LL | Ok(()) | ^^^^^^- help: consider using a semicolon here: `;` | | - | expected `()`, found enum `Result` + | expected `()`, found `Result<(), _>` | = note: expected unit type `()` found enum `Result<(), _>` diff --git a/tests/ui/async-await/issue-61076.rs b/tests/ui/async-await/issue-61076.rs index 750fad839..cf6e5b4e4 100644 --- a/tests/ui/async-await/issue-61076.rs +++ b/tests/ui/async-await/issue-61076.rs @@ -54,9 +54,6 @@ async fn struct_() -> Struct { } async fn tuple() -> Tuple { - //~^ NOTE checked the `Output` of this `async fn`, expected opaque type - //~| NOTE while checking the return type of the `async fn` - //~| NOTE in this expansion of desugaring of `async` block or function Tuple(1i32) } @@ -89,7 +86,7 @@ async fn match_() { match tuple() { //~ HELP consider `await`ing on the `Future` //~^ NOTE this expression has type `impl Future` Tuple(_) => {} //~ ERROR mismatched types - //~^ NOTE expected opaque type, found struct `Tuple` + //~^ NOTE expected future, found `Tuple` //~| NOTE expected opaque type `impl Future` } } diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr index 33839ea59..44de28298 100644 --- a/tests/ui/async-await/issue-61076.stderr +++ b/tests/ui/async-await/issue-61076.stderr @@ -11,7 +11,7 @@ LL | foo().await?; | ++++++ error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/issue-61076.rs:65:5 + --> $DIR/issue-61076.rs:62:5 | LL | t?; | ^^ the `?` operator cannot be applied to type `T` @@ -23,7 +23,7 @@ LL | t.await?; | ++++++ error[E0609]: no field `0` on type `impl Future` - --> $DIR/issue-61076.rs:74:26 + --> $DIR/issue-61076.rs:71:26 | LL | let _: i32 = tuple().0; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -34,7 +34,7 @@ LL | let _: i32 = tuple().await.0; | ++++++ error[E0609]: no field `a` on type `impl Future` - --> $DIR/issue-61076.rs:78:28 + --> $DIR/issue-61076.rs:75:28 | LL | let _: i32 = struct_().a; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -45,7 +45,7 @@ LL | let _: i32 = struct_().await.a; | ++++++ error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope - --> $DIR/issue-61076.rs:82:15 + --> $DIR/issue-61076.rs:79:15 | LL | struct_().method(); | ^^^^^^ method not found in `impl Future` @@ -56,19 +56,14 @@ LL | struct_().await.method(); | ++++++ error[E0308]: mismatched types - --> $DIR/issue-61076.rs:91:9 + --> $DIR/issue-61076.rs:88:9 | LL | match tuple() { | ------- this expression has type `impl Future` LL | LL | Tuple(_) => {} - | ^^^^^^^^ expected opaque type, found struct `Tuple` + | ^^^^^^^^ expected future, found `Tuple` | -note: while checking the return type of the `async fn` - --> $DIR/issue-61076.rs:56:21 - | -LL | async fn tuple() -> Tuple { - | ^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future` found struct `Tuple` help: consider `await`ing on the `Future` diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr new file mode 100644 index 000000000..c4c7f26c7 --- /dev/null +++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be shared between threads safely + --> $DIR/issue-64130-1-sync.rs:25:13 + | +LL | is_sync(bar()); + | ^^^^^ future returned by `bar` is not `Sync` + | + = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` +note: future is not `Sync` as this value is used across an await + --> $DIR/issue-64130-1-sync.rs:18:10 + | +LL | let x = Foo; + | - has type `Foo` which is not `Sync` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | drop(x); +LL | } + | - `x` is later dropped here +note: required by a bound in `is_sync` + --> $DIR/issue-64130-1-sync.rs:14:15 + | +LL | fn is_sync(t: T) { } + | ^^^^ required by this bound in `is_sync` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr new file mode 100644 index 000000000..6f43b568a --- /dev/null +++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr @@ -0,0 +1,22 @@ +error: future cannot be shared between threads safely + --> $DIR/issue-64130-1-sync.rs:25:13 + | +LL | is_sync(bar()); + | ^^^^^ future returned by `bar` is not `Sync` + | + = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` +note: future is not `Sync` as this value is used across an await + --> $DIR/issue-64130-1-sync.rs:18:10 + | +LL | let x = Foo; + | - has type `Foo` which is not `Sync` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_sync` + --> $DIR/issue-64130-1-sync.rs:14:15 + | +LL | fn is_sync(t: T) { } + | ^^^^ required by this bound in `is_sync` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr new file mode 100644 index 000000000..c4c7f26c7 --- /dev/null +++ b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be shared between threads safely + --> $DIR/issue-64130-1-sync.rs:25:13 + | +LL | is_sync(bar()); + | ^^^^^ future returned by `bar` is not `Sync` + | + = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` +note: future is not `Sync` as this value is used across an await + --> $DIR/issue-64130-1-sync.rs:18:10 + | +LL | let x = Foo; + | - has type `Foo` which is not `Sync` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | drop(x); +LL | } + | - `x` is later dropped here +note: required by a bound in `is_sync` + --> $DIR/issue-64130-1-sync.rs:14:15 + | +LL | fn is_sync(t: T) { } + | ^^^^ required by this bound in `is_sync` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs index 1714cec52..44646e0e5 100644 --- a/tests/ui/async-await/issue-64130-1-sync.rs +++ b/tests/ui/async-await/issue-64130-1-sync.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(negative_impls)] // edition:2018 @@ -13,6 +16,7 @@ fn is_sync(t: T) { } async fn bar() { let x = Foo; baz().await; + drop(x); } async fn baz() { } diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr index e205de473..8d5169a63 100644 --- a/tests/ui/async-await/issue-64130-1-sync.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -1,12 +1,12 @@ error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:21:13 + --> $DIR/issue-64130-1-sync.rs:24:13 | LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` note: future is not `Sync` as this value is used across an await - --> $DIR/issue-64130-1-sync.rs:15:10 + --> $DIR/issue-64130-1-sync.rs:18:10 | LL | let x = Foo; | - has type `Foo` which is not `Sync` @@ -15,7 +15,7 @@ LL | baz().await; LL | } | - `x` is later dropped here note: required by a bound in `is_sync` - --> $DIR/issue-64130-1-sync.rs:11:15 + --> $DIR/issue-64130-1-sync.rs:14:15 | LL | fn is_sync(t: T) { } | ^^^^ required by this bound in `is_sync` diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr new file mode 100644 index 000000000..b6a73c2a5 --- /dev/null +++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr @@ -0,0 +1,28 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-2-send.rs:24:13 + | +LL | is_send(bar()); + | ^^^^^ future returned by `bar` is not `Send` + | + = note: the trait bound `Unique: Send` is not satisfied +note: future is not `Send` as this value is used across an await + --> $DIR/issue-64130-2-send.rs:18:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which is not `Send` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | } + | - `x` is later dropped here +note: required by a bound in `is_send` + --> $DIR/issue-64130-2-send.rs:14:15 + | +LL | fn is_send(t: T) { } + | ^^^^ required by this bound in `is_send` +help: consider borrowing here + | +LL | is_send(&bar()); + | + + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr new file mode 100644 index 000000000..560560f60 --- /dev/null +++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr @@ -0,0 +1,26 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-2-send.rs:24:13 + | +LL | is_send(bar()); + | ^^^^^ future returned by `bar` is not `Send` + | + = note: the trait bound `Unique: Send` is not satisfied +note: future is not `Send` as this value is used across an await + --> $DIR/issue-64130-2-send.rs:18:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which is not `Send` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_send` + --> $DIR/issue-64130-2-send.rs:14:15 + | +LL | fn is_send(t: T) { } + | ^^^^ required by this bound in `is_send` +help: consider borrowing here + | +LL | is_send(&bar()); + | + + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr new file mode 100644 index 000000000..b6a73c2a5 --- /dev/null +++ b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr @@ -0,0 +1,28 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-2-send.rs:24:13 + | +LL | is_send(bar()); + | ^^^^^ future returned by `bar` is not `Send` + | + = note: the trait bound `Unique: Send` is not satisfied +note: future is not `Send` as this value is used across an await + --> $DIR/issue-64130-2-send.rs:18:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which is not `Send` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | } + | - `x` is later dropped here +note: required by a bound in `is_send` + --> $DIR/issue-64130-2-send.rs:14:15 + | +LL | fn is_send(t: T) { } + | ^^^^ required by this bound in `is_send` +help: consider borrowing here + | +LL | is_send(&bar()); + | + + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs index 7a6e5952c..d6d855bac 100644 --- a/tests/ui/async-await/issue-64130-2-send.rs +++ b/tests/ui/async-await/issue-64130-2-send.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(negative_impls)] // edition:2018 @@ -11,7 +14,7 @@ impl !Send for Foo {} fn is_send(t: T) { } async fn bar() { - let x = Foo; + let x = Box::new(Foo); baz().await; } diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr index 2225000e2..f6505cad6 100644 --- a/tests/ui/async-await/issue-64130-2-send.stderr +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -1,12 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-64130-2-send.rs:21:13 + --> $DIR/issue-64130-2-send.rs:24:13 | LL | is_send(bar()); | ^^^^^ future returned by `bar` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Foo` note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-2-send.rs:15:10 + --> $DIR/issue-64130-2-send.rs:18:10 | LL | let x = Foo; | - has type `Foo` which is not `Send` @@ -15,7 +15,7 @@ LL | baz().await; LL | } | - `x` is later dropped here note: required by a bound in `is_send` - --> $DIR/issue-64130-2-send.rs:11:15 + --> $DIR/issue-64130-2-send.rs:14:15 | LL | fn is_send(t: T) { } | ^^^^ required by this bound in `is_send` diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr new file mode 100644 index 000000000..d65aae8cc --- /dev/null +++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr @@ -0,0 +1,27 @@ +error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` + --> $DIR/issue-64130-3-other.rs:27:12 + | +LL | async fn bar() { + | - within this `impl Future` +... +LL | is_qux(bar()); + | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` + | +note: future does not implement `Qux` as this value is used across an await + --> $DIR/issue-64130-3-other.rs:21:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which does not implement `Qux` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | } + | - `x` is later dropped here +note: required by a bound in `is_qux` + --> $DIR/issue-64130-3-other.rs:17:14 + | +LL | fn is_qux(t: T) {} + | ^^^ required by this bound in `is_qux` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr new file mode 100644 index 000000000..8fed69d9d --- /dev/null +++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` + --> $DIR/issue-64130-3-other.rs:27:12 + | +LL | async fn bar() { + | - within this `impl Future` +... +LL | is_qux(bar()); + | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` + | +note: future does not implement `Qux` as this value is used across an await + --> $DIR/issue-64130-3-other.rs:21:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which does not implement `Qux` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_qux` + --> $DIR/issue-64130-3-other.rs:17:14 + | +LL | fn is_qux(t: T) {} + | ^^^ required by this bound in `is_qux` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr new file mode 100644 index 000000000..d65aae8cc --- /dev/null +++ b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr @@ -0,0 +1,27 @@ +error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` + --> $DIR/issue-64130-3-other.rs:27:12 + | +LL | async fn bar() { + | - within this `impl Future` +... +LL | is_qux(bar()); + | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` + | +note: future does not implement `Qux` as this value is used across an await + --> $DIR/issue-64130-3-other.rs:21:10 + | +LL | let x = Box::new(Foo); + | - has type `Box` which does not implement `Qux` +LL | baz().await; + | ^^^^^^ await occurs here, with `x` maybe used later +LL | } + | - `x` is later dropped here +note: required by a bound in `is_qux` + --> $DIR/issue-64130-3-other.rs:17:14 + | +LL | fn is_qux(t: T) {} + | ^^^ required by this bound in `is_qux` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs index 630fb2c41..92d3b7c81 100644 --- a/tests/ui/async-await/issue-64130-3-other.rs +++ b/tests/ui/async-await/issue-64130-3-other.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(auto_traits)] #![feature(negative_impls)] // edition:2018 @@ -14,7 +17,7 @@ impl !Qux for Foo {} fn is_qux(t: T) {} async fn bar() { - let x = Foo; + let x = Box::new(Foo); baz().await; } diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index 17867a6a3..cb36a3811 100644 --- a/tests/ui/async-await/issue-64130-3-other.stderr +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future` - --> $DIR/issue-64130-3-other.rs:24:12 + --> $DIR/issue-64130-3-other.rs:27:12 | LL | async fn bar() { | - within this `impl Future` @@ -8,7 +8,7 @@ LL | is_qux(bar()); | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` | note: future does not implement `Qux` as this value is used across an await - --> $DIR/issue-64130-3-other.rs:18:10 + --> $DIR/issue-64130-3-other.rs:21:10 | LL | let x = Foo; | - has type `Foo` which does not implement `Qux` @@ -17,7 +17,7 @@ LL | baz().await; LL | } | - `x` is later dropped here note: required by a bound in `is_qux` - --> $DIR/issue-64130-3-other.rs:14:14 + --> $DIR/issue-64130-3-other.rs:17:14 | LL | fn is_qux(t: T) {} | ^^^ required by this bound in `is_qux` diff --git a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr index f609e3636..884619f4d 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr +++ b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr @@ -1,12 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:19:17 + --> $DIR/issue-64130-4-async-move.rs:20:17 | LL | pub fn foo() -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-4-async-move.rs:25:31 + --> $DIR/issue-64130-4-async-move.rs:27:31 | LL | match client.status() { | ------ has type `&Client` which is not `Send` @@ -17,7 +17,7 @@ LL | let _x = get().await; LL | } | - `client` is later dropped here help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:23:15 + --> $DIR/issue-64130-4-async-move.rs:25:15 | LL | match client.status() { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr index f609e3636..0bc7cb2f2 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr @@ -1,12 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:19:17 + --> $DIR/issue-64130-4-async-move.rs:21:17 | LL | pub fn foo() -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-4-async-move.rs:25:31 + --> $DIR/issue-64130-4-async-move.rs:27:31 | LL | match client.status() { | ------ has type `&Client` which is not `Send` @@ -17,7 +17,7 @@ LL | let _x = get().await; LL | } | - `client` is later dropped here help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:23:15 + --> $DIR/issue-64130-4-async-move.rs:25:15 | LL | match client.status() { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/issue-64130-4-async-move.rs b/tests/ui/async-await/issue-64130-4-async-move.rs index a38428fc0..bcb297aaa 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.rs +++ b/tests/ui/async-await/issue-64130-4-async-move.rs @@ -1,8 +1,10 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// [drop_tracking_mir] check-pass // [drop_tracking] check-pass -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no + use std::any::Any; use std::future::Future; diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr new file mode 100644 index 000000000..fc8bcc8ae --- /dev/null +++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr @@ -0,0 +1,30 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-67252-unnamed-future.rs:21:11 + | +LL | spawn(async { + | ___________^ +LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` +LL | | AFuture.await; +LL | | drop(a); +LL | | }); + | |_____^ future created by async block is not `Send` + | + = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-67252-unnamed-future.rs:23:16 + | +LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` + | - has type `*mut ()` which is not `Send` +LL | AFuture.await; + | ^^^^^^ await occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `spawn` + --> $DIR/issue-67252-unnamed-future.rs:9:13 + | +LL | fn spawn(_: T) {} + | ^^^^ required by this bound in `spawn` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr new file mode 100644 index 000000000..a3ef7add1 --- /dev/null +++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr @@ -0,0 +1,22 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-67252-unnamed-future.rs:21:5 + | +LL | spawn(async { + | ^^^^^ future created by async block is not `Send` + | + = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-67252-unnamed-future.rs:23:16 + | +LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` + | - has type `*mut ()` which is not `Send` +LL | AFuture.await; + | ^^^^^^ await occurs here, with `a` maybe used later +note: required by a bound in `spawn` + --> $DIR/issue-67252-unnamed-future.rs:9:13 + | +LL | fn spawn(_: T) {} + | ^^^^ required by this bound in `spawn` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr new file mode 100644 index 000000000..fc8bcc8ae --- /dev/null +++ b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr @@ -0,0 +1,30 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-67252-unnamed-future.rs:21:11 + | +LL | spawn(async { + | ___________^ +LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` +LL | | AFuture.await; +LL | | drop(a); +LL | | }); + | |_____^ future created by async block is not `Send` + | + = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-67252-unnamed-future.rs:23:16 + | +LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` + | - has type `*mut ()` which is not `Send` +LL | AFuture.await; + | ^^^^^^ await occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `spawn` + --> $DIR/issue-67252-unnamed-future.rs:9:13 + | +LL | fn spawn(_: T) {} + | ^^^^ required by this bound in `spawn` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs index 1a7ff6133..bb9ad77ce 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.rs +++ b/tests/ui/async-await/issue-67252-unnamed-future.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 use std::future::Future; use std::pin::Pin; @@ -16,8 +19,9 @@ impl Future for AFuture{ async fn foo() { spawn(async { //~ ERROR future cannot be sent between threads safely - let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` + let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` AFuture.await; + drop(a); }); } diff --git a/tests/ui/async-await/issue-67252-unnamed-future.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr deleted file mode 100644 index fcba4410b..000000000 --- a/tests/ui/async-await/issue-67252-unnamed-future.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:18:11 - | -LL | spawn(async { - | ___________^ -LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` -LL | | AFuture.await; -LL | | }); - | |_____^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6]`, the trait `Send` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-67252-unnamed-future.rs:20:16 - | -LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` - | -- has type `*mut ()` which is not `Send` -LL | AFuture.await; - | ^^^^^^ await occurs here, with `_a` maybe used later -LL | }); - | - `_a` is later dropped here -note: required by a bound in `spawn` - --> $DIR/issue-67252-unnamed-future.rs:6:13 - | -LL | fn spawn(_: T) {} - | ^^^^ required by this bound in `spawn` - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-68112.drop_tracking.stderr b/tests/ui/async-await/issue-68112.drop_tracking.stderr index f2802698f..bd648de30 100644 --- a/tests/ui/async-await/issue-68112.drop_tracking.stderr +++ b/tests/ui/async-await/issue-68112.drop_tracking.stderr @@ -5,6 +5,7 @@ LL | require_send(send_fut); | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:34:17 | @@ -23,6 +24,7 @@ LL | require_send(send_fut); | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:43:17 | @@ -43,6 +45,7 @@ LL | require_send(send_fut); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc>` to implement `Send` note: required because it's used within this `async fn` body --> $DIR/issue-68112.rs:50:31 diff --git a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr b/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr new file mode 100644 index 000000000..7a9242cba --- /dev/null +++ b/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr @@ -0,0 +1,80 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:37:5 + | +LL | require_send(send_fut); + | ^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:34:17 + | +LL | let _ = non_send_fut.await; + | ^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:46:5 + | +LL | require_send(send_fut); + | ^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:43:17 + | +LL | let _ = make_non_send_future1().await; + | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:65:5 + | +LL | require_send(send_fut); + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this `async fn` body + --> $DIR/issue-68112.rs:50:31 + | +LL | async fn ready2(t: T) -> T { + | _______________________________^ +LL | | t +LL | | } + | |_^ +note: required because it appears within the type `impl Future>>` + --> $DIR/issue-68112.rs:53:31 + | +LL | fn make_non_send_future2() -> impl Future>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Future>>`, `Ready` +note: required because it's used within this `async` block + --> $DIR/issue-68112.rs:60:20 + | +LL | let send_fut = async { + | ____________________^ +LL | | let non_send_fut = make_non_send_future2(); +LL | | let _ = non_send_fut.await; +LL | | ready(0).await; +LL | | }; + | |_____^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr index 38eb85b30..35b7341f6 100644 --- a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr +++ b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr @@ -5,6 +5,7 @@ LL | require_send(send_fut); | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:34:17 | @@ -23,6 +24,7 @@ LL | require_send(send_fut); | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:43:17 | @@ -43,6 +45,7 @@ LL | require_send(send_fut); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc>` to implement `Send` note: required because it's used within this `async fn` body --> $DIR/issue-68112.rs:50:31 diff --git a/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs index 9c705137a..19119ae0f 100644 --- a/tests/ui/async-await/issue-68112.rs +++ b/tests/ui/async-await/issue-68112.rs @@ -1,7 +1,7 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir use std::{ cell::RefCell, @@ -14,7 +14,7 @@ use std::{ fn require_send(_: impl Send) {} struct Ready(Option); -impl Future for Ready { +impl Future for Ready { type Output = T; fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { Poll::Ready(self.0.take().unwrap()) diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr new file mode 100644 index 000000000..ab0698c3e --- /dev/null +++ b/tests/ui/async-await/issue-70818.drop_tracking.stderr @@ -0,0 +1,18 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-70818.rs:7:38 + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | +note: captured value is not `Send` + --> $DIR/issue-70818.rs:9:18 + | +LL | async { (ty, ty1) } + | ^^^ has type `U` which is not `Send` +help: consider restricting type parameter `U` + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr new file mode 100644 index 000000000..ab0698c3e --- /dev/null +++ b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr @@ -0,0 +1,18 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-70818.rs:7:38 + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | +note: captured value is not `Send` + --> $DIR/issue-70818.rs:9:18 + | +LL | async { (ty, ty1) } + | ^^^ has type `U` which is not `Send` +help: consider restricting type parameter `U` + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr new file mode 100644 index 000000000..ab0698c3e --- /dev/null +++ b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr @@ -0,0 +1,18 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-70818.rs:7:38 + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | +note: captured value is not `Send` + --> $DIR/issue-70818.rs:9:18 + | +LL | async { (ty, ty1) } + | ^^^ has type `U` which is not `Send` +help: consider restricting type parameter `U` + | +LL | fn foo(ty: T, ty1: U) -> impl Future + Send { + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs index 019c56eb2..2941de0f5 100644 --- a/tests/ui/async-await/issue-70818.rs +++ b/tests/ui/async-await/issue-70818.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 use std::future::Future; diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr index 20109d4d1..ab0698c3e 100644 --- a/tests/ui/async-await/issue-70818.stderr +++ b/tests/ui/async-await/issue-70818.stderr @@ -1,11 +1,11 @@ error: future cannot be sent between threads safely - --> $DIR/issue-70818.rs:4:38 + --> $DIR/issue-70818.rs:7:38 | LL | fn foo(ty: T, ty1: U) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | note: captured value is not `Send` - --> $DIR/issue-70818.rs:6:18 + --> $DIR/issue-70818.rs:9:18 | LL | async { (ty, ty1) } | ^^^ has type `U` which is not `Send` diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr new file mode 100644 index 000000000..c636be15a --- /dev/null +++ b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr @@ -0,0 +1,34 @@ +error[E0277]: `Sender` cannot be shared between threads safely + --> $DIR/issue-70935-complex-spans.rs:13:45 + | +LL | fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ `Sender` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Sender` + = note: required for `&Sender` to implement `Send` +note: required because it's used within this closure + --> $DIR/issue-70935-complex-spans.rs:17:13 + | +LL | baz(|| async{ + | ^^ +note: required because it's used within this `async fn` body + --> $DIR/issue-70935-complex-spans.rs:10:67 + | +LL | async fn baz(_c: impl FnMut() -> T) where T: Future { + | ___________________________________________________________________^ +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future` +note: required because it's used within this `async` block + --> $DIR/issue-70935-complex-spans.rs:16:5 + | +LL | / async move { +LL | | baz(|| async{ +LL | | foo(tx.clone()); +LL | | }).await; +LL | | } + | |_____^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs index b6d17f93a..78625bd39 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.rs +++ b/tests/ui/async-await/issue-70935-complex-spans.rs @@ -1,7 +1,7 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking -// [no_drop_tracking]compile-flags:-Zdrop-tracking=no -// [drop_tracking]compile-flags:-Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // #70935: Check if we do not emit snippet // with newlines which lead complex diagnostics. @@ -12,7 +12,7 @@ async fn baz(_c: impl FnMut() -> T) where T: Future { fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely - //[drop_tracking]~^^ ERROR `Sender` cannot be shared between threads + //[drop_tracking,drop_tracking_mir]~^^ ERROR `Sender` cannot be shared between threads async move { baz(|| async{ foo(tx.clone()); diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr new file mode 100644 index 000000000..6d19c3beb --- /dev/null +++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7 + | +LL | 1 = 2; + | - ^ + | | + | cannot assign to this expression + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr new file mode 100644 index 000000000..6d19c3beb --- /dev/null +++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7 + | +LL | 1 = 2; + | - ^ + | | + | cannot assign to this expression + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr new file mode 100644 index 000000000..6d19c3beb --- /dev/null +++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7 + | +LL | 1 = 2; + | - ^ + | | + | cannot assign to this expression + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs index c3423ad62..1fa8d6914 100644 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs +++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs @@ -1,5 +1,8 @@ // edition:2018 -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// // Regression test for issue #73741 // Ensures that we don't emit spurious errors when // a type error ocurrs in an `async fn` diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr index d4e3b6c3b..6d19c3beb 100644 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr +++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-73741-type-err-drop-tracking.rs:8:7 + --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7 | LL | 1 = 2; | - ^ diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr index b96cab9f0..628ba1a48 100644 --- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr +++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr @@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | pub async fn async_fn(x: &mut i32) -> &i32 { | - let's call the lifetime of this reference `'1` LL | let y = &*x; - | --- borrow of `*x` occurs here + | --- `*x` is borrowed here LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^^ `*x` is assigned to here but it was already borrowed LL | y | - returning this value requires that `*x` is borrowed for `'1` @@ -14,9 +14,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-74072-lifetime-name-annotations.rs:16:9 | LL | let y = &*x; - | --- borrow of `*x` occurs here + | --- `*x` is borrowed here LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^^ `*x` is assigned to here but it was already borrowed LL | y | - returning this value requires that `*x` is borrowed for `'1` LL | })() @@ -28,9 +28,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | (async move || -> &i32 { | - let's call the lifetime of this reference `'1` LL | let y = &*x; - | --- borrow of `*x` occurs here + | --- `*x` is borrowed here LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^^ `*x` is assigned to here but it was already borrowed LL | y | - returning this value requires that `*x` is borrowed for `'1` @@ -38,9 +38,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-74072-lifetime-name-annotations.rs:32:9 | LL | let y = &*x; - | --- borrow of `*x` occurs here + | --- `*x` is borrowed here LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^^ `*x` is assigned to here but it was already borrowed LL | y | - returning this value requires that `*x` is borrowed for `'1` LL | } diff --git a/tests/ui/async-await/issue-75785-confusing-named-region.stderr b/tests/ui/async-await/issue-75785-confusing-named-region.stderr index 3b731d9c6..b69033a0e 100644 --- a/tests/ui/async-await/issue-75785-confusing-named-region.stderr +++ b/tests/ui/async-await/issue-75785-confusing-named-region.stderr @@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) { | - let's call the lifetime of this reference `'1` LL | let y = &*x; - | --- borrow of `*x` occurs here + | --- `*x` is borrowed here LL | *x += 1; - | ^^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^^ `*x` is assigned to here but it was already borrowed LL | (&32, y) | -------- returning this value requires that `*x` is borrowed for `'1` diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.drop_tracking.stderr new file mode 100644 index 000000000..5c8b7ef1b --- /dev/null +++ b/tests/ui/async-await/issue-86507.drop_tracking.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-86507.rs:20:13 + | +LL | / Box::pin( +LL | | async move { +LL | | let x = x; +LL | | } +LL | | ) + | |_____________^ future created by async block is not `Send` + | +note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` + --> $DIR/issue-86507.rs:22:29 + | +LL | let x = x; + | ^ has type `&T` which is not `Send`, because `T` is not `Sync` + = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future + Send` +help: consider further restricting this bound + | +LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr new file mode 100644 index 000000000..5c8b7ef1b --- /dev/null +++ b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-86507.rs:20:13 + | +LL | / Box::pin( +LL | | async move { +LL | | let x = x; +LL | | } +LL | | ) + | |_____________^ future created by async block is not `Send` + | +note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` + --> $DIR/issue-86507.rs:22:29 + | +LL | let x = x; + | ^ has type `&T` which is not `Send`, because `T` is not `Sync` + = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future + Send` +help: consider further restricting this bound + | +LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr new file mode 100644 index 000000000..5c8b7ef1b --- /dev/null +++ b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-86507.rs:20:13 + | +LL | / Box::pin( +LL | | async move { +LL | | let x = x; +LL | | } +LL | | ) + | |_____________^ future created by async block is not `Send` + | +note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` + --> $DIR/issue-86507.rs:22:29 + | +LL | let x = x; + | ^ has type `&T` which is not `Send`, because `T` is not `Sync` + = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future + Send` +help: consider further restricting this bound + | +LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) + | +++++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-86507.rs b/tests/ui/async-await/issue-86507.rs index 317f03176..63c298dbe 100644 --- a/tests/ui/async-await/issue-86507.rs +++ b/tests/ui/async-await/issue-86507.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 use ::core::pin::Pin; diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.stderr deleted file mode 100644 index 8c2c06da2..000000000 --- a/tests/ui/async-await/issue-86507.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-86507.rs:17:13 - | -LL | / Box::pin( -LL | | async move { -LL | | let x = x; -LL | | } -LL | | ) - | |_____________^ future created by async block is not `Send` - | -note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` - --> $DIR/issue-86507.rs:19:29 - | -LL | let x = x; - | ^ has type `&T` which is not `Send`, because `T` is not `Sync` - = note: required for the cast from `[async block@$DIR/issue-86507.rs:18:17: 20:18]` to the object type `dyn Future + Send` -help: consider further restricting this bound - | -LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) - | +++++++++++++++++++ - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs index 4ce3ac1e8..ec2249ca5 100644 --- a/tests/ui/async-await/issue-93648.rs +++ b/tests/ui/async-await/issue-93648.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2021 // build-pass -// compile-flags: -Zdrop-tracking fn main() { let _ = async { diff --git a/tests/ui/async-await/issue-98634.rs b/tests/ui/async-await/issue-98634.rs index b0d38687f..169cc7f9b 100644 --- a/tests/ui/async-await/issue-98634.rs +++ b/tests/ui/async-await/issue-98634.rs @@ -43,8 +43,8 @@ impl Runtime { fn main() { Runtime.block_on(async { StructAsync { callback }.await; - //~^ ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - //~| ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` - //~| ERROR expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` + //~^ ERROR expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` + //~| ERROR expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` + //~| ERROR expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` }); } diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr index 5160e48d8..5b7f18a98 100644 --- a/tests/ui/async-await/issue-98634.stderr +++ b/tests/ui/async-await/issue-98634.stderr @@ -1,54 +1,33 @@ -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` +error[E0271]: expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` --> $DIR/issue-98634.rs:45:23 | LL | StructAsync { callback }.await; - | ^^^^^^^^ expected struct `Pin`, found opaque type + | ^^^^^^^^ expected `Pin>>`, found future | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 - | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` note: required by a bound in `StructAsync` --> $DIR/issue-98634.rs:9:35 | LL | pub struct StructAsync Pin>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` +error[E0271]: expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` --> $DIR/issue-98634.rs:45:9 | LL | StructAsync { callback }.await; - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin>>`, found future | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` note: required by a bound in `StructAsync` --> $DIR/issue-98634.rs:9:35 | LL | pub struct StructAsync Pin>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` -error[E0271]: expected `fn() -> impl Future {callback}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` +error[E0271]: expected `callback` to be a fn item that returns `Pin>>`, but it returns `impl Future` --> $DIR/issue-98634.rs:45:33 | LL | StructAsync { callback }.await; - | ^^^^^^ expected struct `Pin`, found opaque type - | -note: while checking the return type of the `async fn` - --> $DIR/issue-98634.rs:24:21 + | ^^^^^^ expected `Pin>>`, found future | -LL | async fn callback() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` note: required by a bound in `StructAsync` --> $DIR/issue-98634.rs:9:35 | diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs index 387966a50..d53944698 100644 --- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs +++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 use std::sync::{Arc, Mutex}; diff --git a/tests/ui/async-await/issues/issue-102206.stderr b/tests/ui/async-await/issues/issue-102206.stderr index 2ab790ac7..750b7a886 100644 --- a/tests/ui/async-await/issues/issue-102206.stderr +++ b/tests/ui/async-await/issues/issue-102206.stderr @@ -4,17 +4,10 @@ error[E0308]: mismatched types LL | std::mem::size_of_val(foo()); | --------------------- ^^^^^ | | | - | | expected reference, found opaque type + | | expected `&_`, found future | | help: consider borrowing here: `&foo()` | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/issue-102206.rs:3:16 - | -LL | async fn foo() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected reference `&_` - found opaque type `impl Future` note: function defined here --> $SRC_DIR/core/src/mem/mod.rs:LL:COL diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs new file mode 100644 index 000000000..85fce8740 --- /dev/null +++ b/tests/ui/async-await/issues/issue-107280.rs @@ -0,0 +1,15 @@ +// edition:2021 + +async fn foo() { + inner::().await + //~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied + //~| ERROR: type inside `async fn` body must be known in this context + //~| ERROR: type inside `async fn` body must be known in this context + //~| ERROR: type inside `async fn` body must be known in this context + //~| ERROR: type inside `async fn` body must be known in this context + //~| ERROR: type inside `async fn` body must be known in this context +} + +async fn inner() {} + +fn main() {} diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr new file mode 100644 index 000000000..dd3e10fcc --- /dev/null +++ b/tests/ui/async-await/issues/issue-107280.stderr @@ -0,0 +1,82 @@ +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^ ----- supplied 1 generic argument + | | + | expected 2 generic arguments + | +note: function defined here, with 2 generic parameters: `T`, `PING` + --> $DIR/issue-107280.rs:13:10 + | +LL | async fn inner() {} + | ^^^^^ - ---------------- +help: add missing generic argument + | +LL | inner::().await + | ++++++ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/issue-107280.rs:4:21 + | +LL | inner::().await + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/issue-107280.rs:4:21 + | +LL | inner::().await + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/issue-107280.rs:4:21 + | +LL | inner::().await + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/issue-107280.rs:4:21 + | +LL | inner::().await + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/issue-107280.rs:4:5 + | +LL | inner::().await + | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/issue-107280.rs:4:21 + | +LL | inner::().await + | ^^^^^^ + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0107, E0698. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/async-await/issues/issue-62097.rs b/tests/ui/async-await/issues/issue-62097.rs index a24c84cff..13c72abb1 100644 --- a/tests/ui/async-await/issues/issue-62097.rs +++ b/tests/ui/async-await/issues/issue-62097.rs @@ -12,7 +12,7 @@ impl Struct { pub async fn run_dummy_fn(&self) { foo(|| self.bar()).await; //~^ ERROR closure may outlive the current function - //~| ERROR borrowed data escapes outside of associated function + //~| ERROR borrowed data escapes outside of method } pub fn bar(&self) {} diff --git a/tests/ui/async-await/issues/issue-62097.stderr b/tests/ui/async-await/issues/issue-62097.stderr index 786f62132..21a61548d 100644 --- a/tests/ui/async-await/issues/issue-62097.stderr +++ b/tests/ui/async-await/issues/issue-62097.stderr @@ -16,18 +16,18 @@ help: to force the closure to take ownership of `self` (and any other referenced LL | foo(move || self.bar()).await; | ++++ -error[E0521]: borrowed data escapes outside of associated function +error[E0521]: borrowed data escapes outside of method --> $DIR/issue-62097.rs:13:9 | LL | pub async fn run_dummy_fn(&self) { | ----- | | - | `self` is a reference that is only valid in the associated function body + | `self` is a reference that is only valid in the method body | let's call the lifetime of this reference `'1` LL | foo(|| self.bar()).await; | ^^^^^^^^^^^^^^^^^^ | | - | `self` escapes the associated function body here + | `self` escapes the method body here | argument requires that `'1` must outlive `'static` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issues/issue-65159.rs b/tests/ui/async-await/issues/issue-65159.rs index df2ca0257..6e547508b 100644 --- a/tests/ui/async-await/issues/issue-65159.rs +++ b/tests/ui/async-await/issues/issue-65159.rs @@ -3,7 +3,7 @@ // edition:2018 async fn copy() -> Result<()> -//~^ ERROR this enum takes 2 generic arguments +//~^ ERROR enum takes 2 generic arguments { Ok(()) } diff --git a/tests/ui/async-await/issues/issue-65159.stderr b/tests/ui/async-await/issues/issue-65159.stderr index 40c0e72b2..b8741333c 100644 --- a/tests/ui/async-await/issues/issue-65159.stderr +++ b/tests/ui/async-await/issues/issue-65159.stderr @@ -1,4 +1,4 @@ -error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-65159.rs:5:20 | LL | async fn copy() -> Result<()> diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr index 1033fa6cc..8745bdd97 100644 --- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -1,5 +1,5 @@ error: future cannot be sent between threads safely - --> $DIR/issue-65436-raw-ptr-not-send.rs:16:17 + --> $DIR/issue-65436-raw-ptr-not-send.rs:17:17 | LL | assert_send(async { | _________________^ @@ -8,9 +8,9 @@ LL | | bar(Foo(std::ptr::null())).await; LL | | }) | |_____^ future created by async block is not `Send` | - = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 19:6]`, the trait `Send` is not implemented for `*const u8` + = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 + --> $DIR/issue-65436-raw-ptr-not-send.rs:19:35 | LL | bar(Foo(std::ptr::null())).await; | ---------------- ^^^^^^- `std::ptr::null()` is later dropped here @@ -18,12 +18,12 @@ LL | bar(Foo(std::ptr::null())).await; | | await occurs here, with `std::ptr::null()` maybe used later | has type `*const u8` which is not `Send` help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13 + --> $DIR/issue-65436-raw-ptr-not-send.rs:19:13 | LL | bar(Foo(std::ptr::null())).await; | ^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `assert_send` - --> $DIR/issue-65436-raw-ptr-not-send.rs:13:19 + --> $DIR/issue-65436-raw-ptr-not-send.rs:14:19 | LL | fn assert_send(_: T) {} | ^^^^ required by this bound in `assert_send` diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs index 91edbc10d..d7ef92951 100644 --- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs +++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs @@ -1,8 +1,9 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // [drop_tracking] check-pass -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no +// [drop_tracking_mir] check-pass struct Foo(*const u8); diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs index dda4a151d..c4f8f607d 100644 --- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs +++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs @@ -1,6 +1,10 @@ // build-pass // edition:2018 +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + static mut A: [i32; 5] = [1, 2, 3, 4, 5]; fn is_send_sync(_: T) {} diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index 2ce68a782..ce9424c8b 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -6,7 +6,7 @@ LL | g(issue_67893::run()) | = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` note: future is not `Send` as this value is used across an await - --> $DIR/auxiliary/issue_67893.rs:9:26 + --> $DIR/auxiliary/issue_67893.rs:12:26 | LL | f(*x.lock().unwrap()).await; | ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here diff --git a/tests/ui/async-await/issues/issue-72312.stderr b/tests/ui/async-await/issues/issue-72312.stderr index aa947b690..679272858 100644 --- a/tests/ui/async-await/issues/issue-72312.stderr +++ b/tests/ui/async-await/issues/issue-72312.stderr @@ -1,10 +1,10 @@ -error[E0521]: borrowed data escapes outside of associated function +error[E0521]: borrowed data escapes outside of method --> $DIR/issue-72312.rs:12:9 | LL | pub async fn start(&self) { | ----- | | - | `self` is a reference that is only valid in the associated function body + | `self` is a reference that is only valid in the method body | let's call the lifetime of this reference `'1` ... LL | / require_static(async move { @@ -15,7 +15,7 @@ LL | | &self; LL | | }); | | ^ | | | - | |__________`self` escapes the associated function body here + | |__________`self` escapes the method body here | argument requires that `'1` must outlive `'static` error: aborting due to previous error diff --git a/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs b/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs new file mode 100644 index 000000000..614f18972 --- /dev/null +++ b/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs @@ -0,0 +1,10 @@ +// Regression test for #63033. + +// check-pass +// edition: 2018 + +async fn test1(_: &'static u8, _: &'_ u8, _: &'_ u8) {} + +async fn test2<'s>(_: &'s u8, _: &'_ &'s u8, _: &'_ &'s u8) {} + +fn main() {} diff --git a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr index ae4d0d585..5ae1d78a9 100644 --- a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr @@ -17,8 +17,9 @@ error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not a --> $DIR/ret-impl-trait-one.rs:16:80 | LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { - | ____________________________________--__________________________________________^ - | | | + | ____________________________________--___________________________--------------_^ + | | | | + | | | opaque type defined here | | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here LL | | LL | | (a, b) diff --git a/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr b/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr index d86e84033..a599ac1d9 100644 --- a/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr +++ b/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed --> $DIR/ret-ref.rs:16:5 | LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `a` occurs here + | -- `a` is borrowed here LL | a += 1; - | ^^^^^^ assignment to borrowed `a` occurs here + | ^^^^^^ `a` is assigned to here but it was already borrowed LL | b += 1; LL | let p = future.await; | ------ borrow later used here @@ -13,10 +13,10 @@ error[E0506]: cannot assign to `b` because it is borrowed --> $DIR/ret-ref.rs:17:5 | LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `b` occurs here + | -- `b` is borrowed here LL | a += 1; LL | b += 1; - | ^^^^^^ assignment to borrowed `b` occurs here + | ^^^^^^ `b` is assigned to here but it was already borrowed LL | let p = future.await; | ------ borrow later used here @@ -24,10 +24,10 @@ error[E0506]: cannot assign to `a` because it is borrowed --> $DIR/ret-ref.rs:28:5 | LL | let future = multiple_named_lifetimes(&a, &b); - | -- borrow of `a` occurs here + | -- `a` is borrowed here LL | let p = future.await; LL | a += 1; - | ^^^^^^ assignment to borrowed `a` occurs here + | ^^^^^^ `a` is assigned to here but it was already borrowed LL | b += 1; LL | drop(p); | - borrow later used here diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr new file mode 100644 index 000000000..8a7317bb9 --- /dev/null +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr @@ -0,0 +1,21 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 + | +LL | async fn rec_1() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18 + | +LL | async fn rec_2() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr new file mode 100644 index 000000000..8a7317bb9 --- /dev/null +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr @@ -0,0 +1,21 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 + | +LL | async fn rec_1() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18 + | +LL | async fn rec_2() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr new file mode 100644 index 000000000..8a7317bb9 --- /dev/null +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr @@ -0,0 +1,21 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 + | +LL | async fn rec_1() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18 + | +LL | async fn rec_2() { + | ^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs index bb2a61f03..a241f30e7 100644 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs @@ -1,3 +1,7 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + // edition:2018 // Test that impl trait does not allow creating recursive types that are // otherwise forbidden when using `async` and `await`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr index f789ad2a0..8a7317bb9 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,5 +1,5 @@ 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:9:18 | LL | async fn rec_1() { | ^ recursive `async fn` @@ -8,7 +8,7 @@ LL | async fn rec_1() { = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18 + --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18 | LL | async fn rec_2() { | ^ recursive `async fn` diff --git a/tests/ui/async-await/no-const-async.stderr b/tests/ui/async-await/no-const-async.stderr index c5bd520aa..71c228958 100644 --- a/tests/ui/async-await/no-const-async.stderr +++ b/tests/ui/async-await/no-const-async.stderr @@ -28,8 +28,8 @@ note: ...which requires const checking `x`... | LL | pub const async fn x() {} | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... + = note: ...which requires computing whether `x::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `x::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `x::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/no-const-async.rs:4:1 diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs index a3167215d..d4df9d439 100644 --- a/tests/ui/async-await/non-trivial-drop.rs +++ b/tests/ui/async-await/non-trivial-drop.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking=y #![feature(generators)] diff --git a/tests/ui/async-await/proper-span-for-type-error.stderr b/tests/ui/async-await/proper-span-for-type-error.stderr index 25f05156c..592ef7faf 100644 --- a/tests/ui/async-await/proper-span-for-type-error.stderr +++ b/tests/ui/async-await/proper-span-for-type-error.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/proper-span-for-type-error.rs:8:5 | LL | a().await - | ^^^^^^^^^ expected enum `Result`, found `()` + | ^^^^^^^^^ expected `Result<(), i32>`, found `()` | = note: expected enum `Result<(), i32>` found unit type `()` diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr new file mode 100644 index 000000000..7e63a8da5 --- /dev/null +++ b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/recursive-async-impl-trait-type.rs:8:40 + | +LL | async fn recursive_async_function() -> () { + | ^^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr new file mode 100644 index 000000000..7e63a8da5 --- /dev/null +++ b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/recursive-async-impl-trait-type.rs:8:40 + | +LL | async fn recursive_async_function() -> () { + | ^^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr new file mode 100644 index 000000000..7e63a8da5 --- /dev/null +++ b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/recursive-async-impl-trait-type.rs:8:40 + | +LL | async fn recursive_async_function() -> () { + | ^^ recursive `async fn` + | + = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future` + = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.rs b/tests/ui/async-await/recursive-async-impl-trait-type.rs index edc4cb8ac..60b34d3a1 100644 --- a/tests/ui/async-await/recursive-async-impl-trait-type.rs +++ b/tests/ui/async-await/recursive-async-impl-trait-type.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 // Test that impl trait does not allow creating recursive types that are // otherwise forbidden when using `async` and `await`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr index 63f64f445..7e63a8da5 100644 --- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr +++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr @@ -1,5 +1,5 @@ error[E0733]: recursion in an `async fn` requires boxing - --> $DIR/recursive-async-impl-trait-type.rs:5:40 + --> $DIR/recursive-async-impl-trait-type.rs:8:40 | LL | async fn recursive_async_function() -> () { | ^^ recursive `async fn` diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs new file mode 100644 index 000000000..4e9e7309b --- /dev/null +++ b/tests/ui/async-await/send-bound-async-closure.rs @@ -0,0 +1,37 @@ +// edition: 2021 +// 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. + +use std::future::Future; +use std::pin::Pin; +use std::task::{Context, Poll}; + +type ChannelTask = Pin + Send>>; + +pub fn register_message_type() -> ChannelTask { + Box::pin(async move { + let f = |__cx: &mut Context<'_>| Poll::<()>::Pending; + PollFn { f }.await + }) +} + +struct PollFn { + f: F, +} + +impl Unpin for PollFn {} + +impl Future for PollFn +where + F: FnMut(&mut Context<'_>) -> Poll, +{ + type Output = T; + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + (&mut self.f)(cx) + } +} + +fn main() {} diff --git a/tests/ui/async-await/suggest-missing-await-closure.stderr b/tests/ui/async-await/suggest-missing-await-closure.stderr index a5958baff..d44af5b8d 100644 --- a/tests/ui/async-await/suggest-missing-await-closure.stderr +++ b/tests/ui/async-await/suggest-missing-await-closure.stderr @@ -2,17 +2,15 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await-closure.rs:16:18 | LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type + | -------- ^ expected `u32`, found future | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await-closure.rs:8:24 +note: calling an async function returns a future + --> $DIR/suggest-missing-await-closure.rs:16:18 | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` +LL | take_u32(x) + | ^ note: function defined here --> $DIR/suggest-missing-await-closure.rs:6:4 | diff --git a/tests/ui/async-await/suggest-missing-await.stderr b/tests/ui/async-await/suggest-missing-await.stderr index 1196601ac..f0ec34a6a 100644 --- a/tests/ui/async-await/suggest-missing-await.stderr +++ b/tests/ui/async-await/suggest-missing-await.stderr @@ -2,17 +2,15 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:12:14 | LL | take_u32(x) - | -------- ^ expected `u32`, found opaque type + | -------- ^ expected `u32`, found future | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:5:24 +note: calling an async function returns a future + --> $DIR/suggest-missing-await.rs:12:14 | -LL | async fn make_u32() -> u32 { - | ^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected type `u32` - found opaque type `impl Future` +LL | take_u32(x) + | ^ note: function defined here --> $DIR/suggest-missing-await.rs:3:4 | @@ -27,15 +25,13 @@ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:22:5 | LL | dummy() - | ^^^^^^^ expected `()`, found opaque type + | ^^^^^^^ expected `()`, found future | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 +note: calling an async function returns a future + --> $DIR/suggest-missing-await.rs:22:5 | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` +LL | dummy() + | ^^^^^^^ help: consider `await`ing on the `Future` | LL | dummy().await @@ -55,16 +51,11 @@ LL | | dummy() LL | | LL | | } else { LL | | dummy().await - | | ^^^^^^^^^^^^^ expected opaque type, found `()` + | | ^^^^^^^^^^^^^ expected future, found `()` LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future` found unit type `()` help: consider `await`ing on the `Future` @@ -82,16 +73,11 @@ LL | | 0 => dummy(), LL | | 1 => dummy(), | | ------- this is found to be of type `impl Future` LL | | 2 => dummy().await, - | | ^^^^^^^^^^^^^ expected opaque type, found `()` + | | ^^^^^^^^^^^^^ expected future, found `()` LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 - | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future` found unit type `()` help: consider `await`ing on the `Future` @@ -106,13 +92,8 @@ error[E0308]: mismatched types LL | let _x = match dummy() { | ------- this expression has type `impl Future` LL | () => {} - | ^^ expected opaque type, found `()` - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:18:18 + | ^^ expected future, found `()` | -LL | async fn dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future` found unit type `()` help: consider `await`ing on the `Future` @@ -127,13 +108,8 @@ LL | match dummy_result() { | -------------- this expression has type `impl Future>` ... LL | Ok(_) => {} - | ^^^^^ expected opaque type, found enum `Result` + | ^^^^^ expected future, found `Result<_, _>` | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 - | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future>` found enum `Result<_, _>` help: consider `await`ing on the `Future` @@ -148,13 +124,8 @@ LL | match dummy_result() { | -------------- this expression has type `impl Future>` ... LL | Err(_) => {} - | ^^^^^^ expected opaque type, found enum `Result` - | -note: while checking the return type of the `async fn` - --> $DIR/suggest-missing-await.rs:57:28 + | ^^^^^^ expected future, found `Result<_, _>` | -LL | async fn dummy_result() -> Result<(), ()> { - | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type = note: expected opaque type `impl Future>` found enum `Result<_, _>` help: consider `await`ing on the `Future` diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr new file mode 100644 index 000000000..912e2b34c --- /dev/null +++ b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr @@ -0,0 +1,39 @@ +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0698`. diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr new file mode 100644 index 000000000..95c799468 --- /dev/null +++ b/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type of the type parameter `T` declared on the function `bar` + | +help: consider specifying the generic argument + | +LL | bar::().await; + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr new file mode 100644 index 000000000..16d618caa --- /dev/null +++ b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr @@ -0,0 +1,63 @@ +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:12:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:12:10 + | +LL | bar().await; + | ^^^^^^ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0698`. diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs index 6d6d80614..ca0a92b94 100644 --- a/tests/ui/async-await/unresolved_type_param.rs +++ b/tests/ui/async-await/unresolved_type_param.rs @@ -1,24 +1,36 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // Provoke an unresolved type error (T). // Error message should pinpoint the type parameter T as needing to be bound // (rather than give a general error message) // edition:2018 -// compile-flags: -Zdrop-tracking async fn bar() -> () {} async fn foo() { bar().await; - //~^ ERROR type inside `async fn` body must be known in this context - //~| ERROR type inside `async fn` body must be known in this context - //~| ERROR type inside `async fn` body must be known in this context - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE cannot infer type for type parameter `T` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE the type is part of the `async fn` body because of this `await` - //~| NOTE in this expansion of desugaring of `await` - //~| NOTE in this expansion of desugaring of `await` - //~| NOTE in this expansion of desugaring of `await` + //[drop_tracking_mir]~^ ERROR type annotations needed + //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T` + //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context + //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context + //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context + //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` + //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` + //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` + //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` + //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` + //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` + //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` + //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` + //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` + //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context + //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context + //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T` + //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T` + //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` + //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` + //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await` + //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await` } fn main() {} diff --git a/tests/ui/async-await/unresolved_type_param.stderr b/tests/ui/async-await/unresolved_type_param.stderr index 7236c681f..64a31b5fc 100644 --- a/tests/ui/async-await/unresolved_type_param.stderr +++ b/tests/ui/async-await/unresolved_type_param.stderr @@ -1,35 +1,35 @@ error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 + --> $DIR/unresolved_type_param.rs:13:5 | LL | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 + --> $DIR/unresolved_type_param.rs:13:10 | LL | bar().await; | ^^^^^^ error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 + --> $DIR/unresolved_type_param.rs:13:5 | LL | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 + --> $DIR/unresolved_type_param.rs:13:10 | LL | bar().await; | ^^^^^^ error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 + --> $DIR/unresolved_type_param.rs:13:5 | LL | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:10:10 + --> $DIR/unresolved_type_param.rs:13:10 | LL | bar().await; | ^^^^^^ diff --git a/tests/ui/attributes/invalid_macro_export_argument.rs b/tests/ui/attributes/invalid_macro_export_argument.rs new file mode 100644 index 000000000..85d009f11 --- /dev/null +++ b/tests/ui/attributes/invalid_macro_export_argument.rs @@ -0,0 +1,26 @@ +// check-pass +#[macro_export(hello, world)] //~ WARN `#[macro_export]` can only take 1 or 0 arguments +macro_rules! a { + () => () +} + +#[macro_export(not_local_inner_macros)] //~ WARN `not_local_inner_macros` isn't a valid `#[macro_export]` argument +macro_rules! b { + () => () +} + +#[macro_export] +macro_rules! c { + () => () +} +#[macro_export(local_inner_macros)] +macro_rules! d { + () => () +} + +#[macro_export()] +macro_rules! e { + () => () +} + +fn main() {} diff --git a/tests/ui/attributes/invalid_macro_export_argument.stderr b/tests/ui/attributes/invalid_macro_export_argument.stderr new file mode 100644 index 000000000..a4e17642c --- /dev/null +++ b/tests/ui/attributes/invalid_macro_export_argument.stderr @@ -0,0 +1,16 @@ +warning: `#[macro_export]` can only take 1 or 0 arguments + --> $DIR/invalid_macro_export_argument.rs:2:1 + | +LL | #[macro_export(hello, world)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(invalid_macro_export_arguments)]` on by default + +warning: `not_local_inner_macros` isn't a valid `#[macro_export]` argument + --> $DIR/invalid_macro_export_argument.rs:7:16 + | +LL | #[macro_export(not_local_inner_macros)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: 2 warnings emitted + diff --git a/tests/ui/attributes/key-value-expansion.stderr b/tests/ui/attributes/key-value-expansion.stderr index 1b776322a..aaa8b1695 100644 --- a/tests/ui/attributes/key-value-expansion.stderr +++ b/tests/ui/attributes/key-value-expansion.stderr @@ -15,12 +15,7 @@ LL | bug!(); | = note: this error originates in the macro `bug` (in Nightly builds, run with -Z macro-backtrace for more info) -error: unexpected expression: `{ - let res = - ::alloc::fmt::format(::core::fmt::Arguments::new_v1(&[""], - &[::core::fmt::ArgumentV1::new_display(&"u8")])); - res - }.as_str()` +error: unexpected expression: `{ let res = ::alloc::fmt::format(format_args!("{0}", "u8")); res }.as_str()` --> $DIR/key-value-expansion.rs:48:23 | LL | doc_comment! {format!("{coor}", coor = stringify!($t1)).as_str()} diff --git a/tests/ui/attributes/log-backtrace.rs b/tests/ui/attributes/log-backtrace.rs index 3979d2001..e42edf1d4 100644 --- a/tests/ui/attributes/log-backtrace.rs +++ b/tests/ui/attributes/log-backtrace.rs @@ -1,9 +1,9 @@ // run-pass // -// This test makes sure that log-backtrace option doesn't give a compilation error. +// This test makes sure that log-backtrace option at least parses correctly // // dont-check-compiler-stdout // dont-check-compiler-stderr // rustc-env:RUSTC_LOG=info -// compile-flags: -Zlog-backtrace=rustc_metadata::creader +// rustc-env:RUSTC_LOG_BACKTRACE=rustc_metadata::creader fn main() {} diff --git a/tests/ui/attributes/rustc-box.rs b/tests/ui/attributes/rustc-box.rs new file mode 100644 index 000000000..b3726fb38 --- /dev/null +++ b/tests/ui/attributes/rustc-box.rs @@ -0,0 +1,18 @@ +#![feature(rustc_attrs, stmt_expr_attributes)] + +fn foo(_: u32, _: u32) {} +fn bar(_: u32) {} + +fn main() { + #[rustc_box] + Box::new(1); // OK + #[rustc_box] + Box::pin(1); //~ ERROR `#[rustc_box]` attribute used incorrectly + #[rustc_box] + foo(1, 1); //~ ERROR `#[rustc_box]` attribute used incorrectly + #[rustc_box] + bar(1); //~ ERROR `#[rustc_box]` attribute used incorrectly + #[rustc_box] //~ ERROR `#[rustc_box]` attribute used incorrectly + #[rustfmt::skip] + Box::new(1); +} diff --git a/tests/ui/attributes/rustc-box.stderr b/tests/ui/attributes/rustc-box.stderr new file mode 100644 index 000000000..073a18c7d --- /dev/null +++ b/tests/ui/attributes/rustc-box.stderr @@ -0,0 +1,34 @@ +error: `#[rustc_box]` attribute used incorrectly + --> $DIR/rustc-box.rs:10:5 + | +LL | Box::pin(1); + | ^^^^^^^^^^^ + | + = note: `#[rustc_box]` may only be applied to a `Box::new()` call + +error: `#[rustc_box]` attribute used incorrectly + --> $DIR/rustc-box.rs:12:5 + | +LL | foo(1, 1); + | ^^^^^^^^^ + | + = note: `#[rustc_box]` may only be applied to a `Box::new()` call + +error: `#[rustc_box]` attribute used incorrectly + --> $DIR/rustc-box.rs:14:5 + | +LL | bar(1); + | ^^^^^^ + | + = note: `#[rustc_box]` may only be applied to a `Box::new()` call + +error: `#[rustc_box]` attribute used incorrectly + --> $DIR/rustc-box.rs:15:5 + | +LL | #[rustc_box] + | ^^^^^^^^^^^^ + | + = note: no other attributes may be applied + +error: aborting due to 4 previous errors + diff --git a/tests/ui/augmented-assignments.rs b/tests/ui/augmented-assignments.rs index 20c7fb3a9..bd2435a78 100644 --- a/tests/ui/augmented-assignments.rs +++ b/tests/ui/augmented-assignments.rs @@ -9,7 +9,7 @@ impl AddAssign for Int { } fn main() { - let mut x = Int(1); + let mut x = Int(1); //~ NOTE binding `x` declared here x //~^ NOTE borrow of `x` occurs here += diff --git a/tests/ui/augmented-assignments.stderr b/tests/ui/augmented-assignments.stderr index 2910c910d..d1096aea2 100644 --- a/tests/ui/augmented-assignments.stderr +++ b/tests/ui/augmented-assignments.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/augmented-assignments.rs:16:5 | +LL | let mut x = Int(1); + | ----- binding `x` declared here LL | x | - borrow of `x` occurs here ... diff --git a/tests/ui/auto-traits/auto-trait-validation.stderr b/tests/ui/auto-traits/auto-trait-validation.stderr index 2c380e5b0..89b63d23d 100644 --- a/tests/ui/auto-traits/auto-trait-validation.stderr +++ b/tests/ui/auto-traits/auto-trait-validation.stderr @@ -12,7 +12,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Bound : Copy {} | -----^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/auto-trait-validation.rs:9:25 @@ -20,7 +20,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait LifetimeBound : 'static {} | -------------^^^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error[E0380]: auto traits cannot have associated items --> $DIR/auto-trait-validation.rs:11:25 @@ -29,7 +29,7 @@ LL | auto trait MyTrait { fn foo() {} } | ------- ---^^^----- | | | | | help: remove these associated items - | auto trait cannot have associated items + | auto traits cannot have associated items error: aborting due to 4 previous errors diff --git a/tests/ui/auto-traits/issue-23080-2.stderr b/tests/ui/auto-traits/issue-23080-2.stderr index 267a712f6..fed485612 100644 --- a/tests/ui/auto-traits/issue-23080-2.stderr +++ b/tests/ui/auto-traits/issue-23080-2.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080-2.rs:5:10 | LL | unsafe auto trait Trait { - | ----- auto trait cannot have associated items + | ----- auto traits cannot have associated items LL | type Output; | -----^^^^^^- help: remove these associated items diff --git a/tests/ui/auto-traits/issue-23080.stderr b/tests/ui/auto-traits/issue-23080.stderr index c1b16b2f4..f5d607298 100644 --- a/tests/ui/auto-traits/issue-23080.stderr +++ b/tests/ui/auto-traits/issue-23080.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | LL | unsafe auto trait Trait { - | ----- auto trait cannot have associated items + | ----- auto traits cannot have associated items LL | fn method(&self) { | _____- ^^^^^^ LL | | println!("Hello"); diff --git a/tests/ui/auto-traits/issue-84075.stderr b/tests/ui/auto-traits/issue-84075.stderr index 02dca598e..6fbdc669b 100644 --- a/tests/ui/auto-traits/issue-84075.stderr +++ b/tests/ui/auto-traits/issue-84075.stderr @@ -4,7 +4,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Magic where Self: Copy {} | ----- ^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error: aborting due to previous error diff --git a/tests/ui/auto-traits/str-contains-slice-conceptually.rs b/tests/ui/auto-traits/str-contains-slice-conceptually.rs new file mode 100644 index 000000000..6a16fdcf2 --- /dev/null +++ b/tests/ui/auto-traits/str-contains-slice-conceptually.rs @@ -0,0 +1,13 @@ +#![feature(negative_impls)] +#![feature(auto_traits)] + +auto trait AutoTrait {} + +impl !AutoTrait for [T] {} + +fn needs_auto_trait() {} + +fn main() { + needs_auto_trait::(); + //~^ ERROR the trait bound `[u8]: AutoTrait` is not satisfied in `str` +} diff --git a/tests/ui/auto-traits/str-contains-slice-conceptually.stderr b/tests/ui/auto-traits/str-contains-slice-conceptually.stderr new file mode 100644 index 000000000..1cf16cebd --- /dev/null +++ b/tests/ui/auto-traits/str-contains-slice-conceptually.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `[u8]: AutoTrait` is not satisfied in `str` + --> $DIR/str-contains-slice-conceptually.rs:11:22 + | +LL | needs_auto_trait::(); + | ^^^ within `str`, the trait `AutoTrait` is not implemented for `[u8]` + | + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes +note: required by a bound in `needs_auto_trait` + --> $DIR/str-contains-slice-conceptually.rs:8:24 + | +LL | fn needs_auto_trait() {} + | ^^^^^^^^^ required by this bound in `needs_auto_trait` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr index 4827916fa..547b4bb54 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr @@ -4,7 +4,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Magic : Sized where Option : Magic {} | -----^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error[E0568]: auto traits cannot have super traits or lifetime bounds --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:26 @@ -12,7 +12,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Magic : Sized where Option : Magic {} | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error: aborting due to 2 previous errors diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr index d7716f4b6..80f074103 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr @@ -4,7 +4,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Magic: Copy {} | -----^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error: aborting due to previous error diff --git a/tests/ui/autoref-autoderef/issue-38940.stderr b/tests/ui/autoref-autoderef/issue-38940.stderr index f0b840577..8e98bfcd9 100644 --- a/tests/ui/autoref-autoderef/issue-38940.stderr +++ b/tests/ui/autoref-autoderef/issue-38940.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types --> $DIR/issue-38940.rs:49:22 | LL | let x: &Bottom = &t; - | ------- ^^ expected struct `Bottom`, found struct `Top` + | ------- ^^ expected `&Bottom`, found `&Top` | | | expected due to this | diff --git a/tests/ui/binding/issue-53114-safety-checks.rs b/tests/ui/binding/issue-53114-safety-checks.rs index d0eb28c57..e234db516 100644 --- a/tests/ui/binding/issue-53114-safety-checks.rs +++ b/tests/ui/binding/issue-53114-safety-checks.rs @@ -21,13 +21,11 @@ fn let_wild_gets_unsafe_field() { let u2 = U { a: I(1) }; let p = P { a: &2, b: &3 }; let _ = &p.b; //~ ERROR reference to packed field - //~^ WARN will become a hard error let _ = u1.a; // #53114: should eventually signal error as well let _ = &u2.a; //~ ERROR [E0133] // variation on above with `_` in substructure let (_,) = (&p.b,); //~ ERROR reference to packed field - //~^ WARN will become a hard error let (_,) = (u1.a,); //~ ERROR [E0133] let (_,) = (&u2.a,); //~ ERROR [E0133] } @@ -37,13 +35,11 @@ fn match_unsafe_field_to_wild() { let u2 = U { a: I(1) }; let p = P { a: &2, b: &3 }; match &p.b { _ => { } } //~ ERROR reference to packed field - //~^ WARN will become a hard error match u1.a { _ => { } } //~ ERROR [E0133] match &u2.a { _ => { } } //~ ERROR [E0133] // variation on above with `_` in substructure match (&p.b,) { (_,) => { } } //~ ERROR reference to packed field - //~^ WARN will become a hard error match (u1.a,) { (_,) => { } } //~ ERROR [E0133] match (&u2.a,) { (_,) => { } } //~ ERROR [E0133] } diff --git a/tests/ui/binding/issue-53114-safety-checks.stderr b/tests/ui/binding/issue-53114-safety-checks.stderr index 57a065d6d..5c9d78772 100644 --- a/tests/ui/binding/issue-53114-safety-checks.stderr +++ b/tests/ui/binding/issue-53114-safety-checks.stderr @@ -1,50 +1,41 @@ -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/issue-53114-safety-checks.rs:23:13 | LL | let _ = &p.b; | ^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default -error: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:29:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:28:17 | LL | let (_,) = (&p.b,); | ^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:39:11 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:37:11 | LL | match &p.b { _ => { } } | ^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:45:12 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-53114-safety-checks.rs:42:12 | LL | match (&p.b,) { (_,) => { } } | ^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-53114-safety-checks.rs:26:13 + --> $DIR/issue-53114-safety-checks.rs:25:13 | LL | let _ = &u2.a; | ^^^^^ access to union field @@ -52,7 +43,7 @@ LL | let _ = &u2.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/issue-53114-safety-checks.rs:31:17 + --> $DIR/issue-53114-safety-checks.rs:29:17 | LL | let (_,) = (u1.a,); | ^^^^ access to union field @@ -60,7 +51,7 @@ LL | let (_,) = (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/issue-53114-safety-checks.rs:32:17 + --> $DIR/issue-53114-safety-checks.rs:30:17 | LL | let (_,) = (&u2.a,); | ^^^^^ access to union field @@ -68,7 +59,7 @@ LL | let (_,) = (&u2.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/issue-53114-safety-checks.rs:41:11 + --> $DIR/issue-53114-safety-checks.rs:38:11 | LL | match u1.a { _ => { } } | ^^^^ access to union field @@ -76,7 +67,7 @@ LL | match 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/issue-53114-safety-checks.rs:42:11 + --> $DIR/issue-53114-safety-checks.rs:39:11 | LL | match &u2.a { _ => { } } | ^^^^^ access to union field @@ -84,7 +75,7 @@ LL | match &u2.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/issue-53114-safety-checks.rs:47:12 + --> $DIR/issue-53114-safety-checks.rs:43:12 | LL | match (u1.a,) { (_,) => { } } | ^^^^ access to union field @@ -92,7 +83,7 @@ LL | match (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/issue-53114-safety-checks.rs:48:12 + --> $DIR/issue-53114-safety-checks.rs:44:12 | LL | match (&u2.a,) { (_,) => { } } | ^^^^^ access to union field @@ -101,56 +92,5 @@ LL | match (&u2.a,) { (_,) => { } } error: aborting due to 11 previous errors -For more information about this error, try `rustc --explain E0133`. -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:23:13 - | -LL | let _ = &p.b; - | ^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:29:17 - | -LL | let (_,) = (&p.b,); - | ^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:39:11 - | -LL | match &p.b { _ => { } } - | ^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-53114-safety-checks.rs:45:12 - | -LL | match (&p.b,) { (_,) => { } } - | ^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - +Some errors have detailed explanations: E0133, E0793. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/binop/binary-op-on-double-ref.fixed b/tests/ui/binop/binary-op-on-double-ref.fixed index de9dc19af..586d2568c 100644 --- a/tests/ui/binop/binary-op-on-double-ref.fixed +++ b/tests/ui/binop/binary-op-on-double-ref.fixed @@ -3,7 +3,7 @@ fn main() { let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9]; let vr = v.iter().filter(|x| { *x % 2 == 0 - //~^ ERROR cannot mod `&&{integer}` by `{integer}` + //~^ ERROR cannot calculate the remainder of `&&{integer}` divided by `{integer}` }); println!("{:?}", vr); } diff --git a/tests/ui/binop/binary-op-on-double-ref.rs b/tests/ui/binop/binary-op-on-double-ref.rs index 2616c560c..48ee44546 100644 --- a/tests/ui/binop/binary-op-on-double-ref.rs +++ b/tests/ui/binop/binary-op-on-double-ref.rs @@ -3,7 +3,7 @@ fn main() { let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9]; let vr = v.iter().filter(|x| { x % 2 == 0 - //~^ ERROR cannot mod `&&{integer}` by `{integer}` + //~^ ERROR cannot calculate the remainder of `&&{integer}` divided by `{integer}` }); println!("{:?}", vr); } diff --git a/tests/ui/binop/binary-op-on-double-ref.stderr b/tests/ui/binop/binary-op-on-double-ref.stderr index 34826d2f4..2e8aeebc6 100644 --- a/tests/ui/binop/binary-op-on-double-ref.stderr +++ b/tests/ui/binop/binary-op-on-double-ref.stderr @@ -1,4 +1,4 @@ -error[E0369]: cannot mod `&&{integer}` by `{integer}` +error[E0369]: cannot calculate the remainder of `&&{integer}` divided by `{integer}` --> $DIR/binary-op-on-double-ref.rs:5:11 | LL | x % 2 == 0 diff --git a/tests/ui/binop/binop-move-semantics.stderr b/tests/ui/binop/binop-move-semantics.stderr index dae267da0..8645169b9 100644 --- a/tests/ui/binop/binop-move-semantics.stderr +++ b/tests/ui/binop/binop-move-semantics.stderr @@ -41,6 +41,8 @@ LL | fn move_then_borrow + Clone + Copy>(x: T) { error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/binop-move-semantics.rs:21:5 | +LL | fn move_borrowed>(x: T, mut y: T) { + | - binding `x` declared here LL | let m = &x; | -- borrow of `x` occurs here ... @@ -53,6 +55,9 @@ LL | use_mut(n); use_imm(m); error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/binop-move-semantics.rs:23:5 | +LL | fn move_borrowed>(x: T, mut y: T) { + | ----- binding `y` declared here +LL | let m = &x; LL | let n = &mut y; | ------ borrow of `y` occurs here ... diff --git a/tests/ui/binop/issue-28837.rs b/tests/ui/binop/issue-28837.rs index 9719c3afa..54c8838e4 100644 --- a/tests/ui/binop/issue-28837.rs +++ b/tests/ui/binop/issue-28837.rs @@ -11,7 +11,7 @@ fn main() { a / a; //~ ERROR cannot divide `A` by `A` - a % a; //~ ERROR cannot mod `A` by `A` + a % a; //~ ERROR cannot calculate the remainder of `A` divided by `A` a & a; //~ ERROR no implementation for `A & A` diff --git a/tests/ui/binop/issue-28837.stderr b/tests/ui/binop/issue-28837.stderr index 6e236ca52..cca1da3b6 100644 --- a/tests/ui/binop/issue-28837.stderr +++ b/tests/ui/binop/issue-28837.stderr @@ -62,7 +62,7 @@ LL | struct A; note: the trait `Div` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -error[E0369]: cannot mod `A` by `A` +error[E0369]: cannot calculate the remainder of `A` divided by `A` --> $DIR/issue-28837.rs:14:7 | LL | a % a; diff --git a/tests/ui/blind/blind-item-block-middle.stderr b/tests/ui/blind/blind-item-block-middle.stderr index eb64fea94..63e6d7684 100644 --- a/tests/ui/blind/blind-item-block-middle.stderr +++ b/tests/ui/blind/blind-item-block-middle.stderr @@ -7,7 +7,7 @@ LL | mod foo { pub struct bar; } LL | let bar = 5; | ^^^ - this expression has type `{integer}` | | - | expected integer, found struct `bar` + | expected integer, found `bar` | `bar` is interpreted as a unit struct, not a new binding | help: introduce a new binding instead: `other_bar` diff --git a/tests/ui/block-result/consider-removing-last-semi.stderr b/tests/ui/block-result/consider-removing-last-semi.stderr index 9be0367ae..d30ab1293 100644 --- a/tests/ui/block-result/consider-removing-last-semi.stderr +++ b/tests/ui/block-result/consider-removing-last-semi.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:3:15 | LL | pub fn f() -> String { - | - ^^^^^^ expected struct `String`, found `()` + | - ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | 0u8; @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:8:15 | LL | pub fn g() -> String { - | - ^^^^^^ expected struct `String`, found `()` + | - ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | "this won't work".to_string(); diff --git a/tests/ui/block-result/issue-13428.stderr b/tests/ui/block-result/issue-13428.stderr index 2b386d10c..c119b69da 100644 --- a/tests/ui/block-result/issue-13428.stderr +++ b/tests/ui/block-result/issue-13428.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-13428.rs:3:13 | LL | fn foo() -> String { - | --- ^^^^^^ expected struct `String`, found `()` + | --- ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression @@ -10,7 +10,7 @@ error[E0308]: mismatched types --> $DIR/issue-13428.rs:11:13 | LL | fn bar() -> String { - | --- ^^^^^^ expected struct `String`, found `()` + | --- ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | "foobar".to_string() diff --git a/tests/ui/block-result/issue-13624.rs b/tests/ui/block-result/issue-13624.rs index 4d2844cc5..8f93e5a35 100644 --- a/tests/ui/block-result/issue-13624.rs +++ b/tests/ui/block-result/issue-13624.rs @@ -6,7 +6,7 @@ mod a { pub fn get_enum_struct_variant() -> () { Enum::EnumStructVariant { x: 1, y: 2, z: 3 } //~^ ERROR mismatched types - //~| expected `()`, found enum `Enum` + //~| expected `()`, found `Enum` } } @@ -19,7 +19,7 @@ mod b { match enum_struct_variant { a::Enum::EnumStructVariant { x, y, z } => { //~^ ERROR mismatched types - //~| expected `()`, found enum `Enum` + //~| expected `()`, found `Enum` } } } diff --git a/tests/ui/block-result/issue-13624.stderr b/tests/ui/block-result/issue-13624.stderr index 13070b4e8..d41bd057f 100644 --- a/tests/ui/block-result/issue-13624.stderr +++ b/tests/ui/block-result/issue-13624.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | pub fn get_enum_struct_variant() -> () { | -- expected `()` because of return type LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum` error[E0308]: mismatched types --> $DIR/issue-13624.rs:20:9 @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | match enum_struct_variant { | ------------------- this expression has type `()` LL | a::Enum::EnumStructVariant { x, y, z } => { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum` error: aborting due to 2 previous errors diff --git a/tests/ui/block-result/issue-22645.stderr b/tests/ui/block-result/issue-22645.stderr index 24341c0f5..677b40aaa 100644 --- a/tests/ui/block-result/issue-22645.stderr +++ b/tests/ui/block-result/issue-22645.stderr @@ -20,7 +20,7 @@ LL | fn main() { | - expected `()` because of default return type LL | let b = Bob + 3.5; LL | b + 3 - | ^^^^^ expected `()`, found struct `Bob` + | ^^^^^ expected `()`, found `Bob` error: aborting due to 2 previous errors diff --git a/tests/ui/block-result/issue-5500.rs b/tests/ui/block-result/issue-5500.rs index 577987a45..de7fd39a2 100644 --- a/tests/ui/block-result/issue-5500.rs +++ b/tests/ui/block-result/issue-5500.rs @@ -3,5 +3,5 @@ fn main() { //~^ ERROR mismatched types //~| expected unit type `()` //~| found reference `&_` - //~| expected `()`, found reference + //~| expected `()`, found `&_` } diff --git a/tests/ui/block-result/issue-5500.stderr b/tests/ui/block-result/issue-5500.stderr index 211a60528..8cd4bd658 100644 --- a/tests/ui/block-result/issue-5500.stderr +++ b/tests/ui/block-result/issue-5500.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | &panic!() - | ^^^^^^^^^ expected `()`, found reference + | ^^^^^^^^^ expected `()`, found `&_` | = note: expected unit type `()` found reference `&_` diff --git a/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr index 50eee1049..5835f0675 100644 --- a/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr +++ b/tests/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr @@ -4,8 +4,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref foo @ [.., ref mut bar] => (), | -------^^^^^^^^-----------^ | | | - | | mutable borrow, by `bar`, occurs here - | immutable borrow, by `foo`, occurs here + | | value is mutably borrowed by `bar` here + | value is borrowed by `foo` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9 @@ -13,8 +13,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref foo @ Some(box ref mut s) => (), | -------^^^^^^^^^^^^---------^ | | | - | | mutable borrow, by `s`, occurs here - | immutable borrow, by `foo`, occurs here + | | value is mutably borrowed by `s` here + | value is borrowed by `foo` here error[E0382]: borrow of moved value: `x` --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:18:5 diff --git a/tests/ui/borrowck/borrow-tuple-fields.stderr b/tests/ui/borrowck/borrow-tuple-fields.stderr index befa751a6..d7d3efe49 100644 --- a/tests/ui/borrowck/borrow-tuple-fields.stderr +++ b/tests/ui/borrowck/borrow-tuple-fields.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/borrow-tuple-fields.rs:12:13 | +LL | let x: (Box<_>, _) = (Box::new(1), 2); + | - binding `x` declared here LL | let r = &x.0; | ---- borrow of `x.0` occurs here LL | let y = x; @@ -32,6 +34,8 @@ LL | a.use_ref(); error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/borrow-tuple-fields.rs:28:13 | +LL | let x = Foo(Box::new(1), 2); + | - binding `x` declared here LL | let r = &x.0; | ---- borrow of `x.0` occurs here LL | let y = x; diff --git a/tests/ui/borrowck/borrowck-anon-fields-variant.stderr b/tests/ui/borrowck/borrowck-anon-fields-variant.stderr index 98f6f00a7..c1d668f74 100644 --- a/tests/ui/borrowck/borrowck-anon-fields-variant.stderr +++ b/tests/ui/borrowck/borrowck-anon-fields-variant.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed --> $DIR/borrowck-anon-fields-variant.rs:16:19 | LL | Foo::Y(ref mut a, _) => a, - | --------- borrow of `y.0` occurs here + | --------- `y.0` is borrowed here ... LL | let b = match y { | ^ use of borrowed `y.0` @@ -14,7 +14,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed --> $DIR/borrowck-anon-fields-variant.rs:34:19 | LL | Foo::Y(ref mut a, _) => a, - | --------- borrow of `y.0` occurs here + | --------- `y.0` is borrowed here ... LL | let b = match y { | ^ use of borrowed `y.0` diff --git a/tests/ui/borrowck/borrowck-assign-comp.stderr b/tests/ui/borrowck/borrowck-assign-comp.stderr index 2b7cef7b3..d35f2331a 100644 --- a/tests/ui/borrowck/borrowck-assign-comp.stderr +++ b/tests/ui/borrowck/borrowck-assign-comp.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `p.x` because it is borrowed --> $DIR/borrowck-assign-comp.rs:10:5 | LL | let q = &p; - | -- borrow of `p.x` occurs here + | -- `p.x` is borrowed here ... LL | p.x = 5; - | ^^^^^^^ assignment to borrowed `p.x` occurs here + | ^^^^^^^ `p.x` is assigned to here but it was already borrowed LL | q.x; | --- borrow later used here @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `p` because it is borrowed --> $DIR/borrowck-assign-comp.rs:20:5 | LL | let q = &p.y; - | ---- borrow of `p` occurs here + | ---- `p` is borrowed here LL | p = Point {x: 5, y: 7}; - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^ `p` is assigned to here but it was already borrowed LL | p.x; // silence warning LL | *q; // stretch loan | -- borrow later used here @@ -24,9 +24,9 @@ error[E0506]: cannot assign to `p.y` because it is borrowed --> $DIR/borrowck-assign-comp.rs:31:5 | LL | let q = &p.y; - | ---- borrow of `p.y` occurs here + | ---- `p.y` is borrowed here LL | p.y = 5; - | ^^^^^^^ assignment to borrowed `p.y` occurs here + | ^^^^^^^ `p.y` is assigned to here but it was already borrowed LL | *q; | -- borrow later used here diff --git a/tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr index 0b21d113f..8c0a8efcc 100644 --- a/tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr +++ b/tests/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `y` occurs here + | ------ `y` is borrowed here LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` ... @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `*y.pointer` occurs here + | ------ `*y.pointer` is borrowed here LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here + | ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed ... LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/tests/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/tests/ui/borrowck/borrowck-bad-nested-calls-move.stderr index 371bcf2b6..e582ec605 100644 --- a/tests/ui/borrowck/borrowck-bad-nested-calls-move.stderr +++ b/tests/ui/borrowck/borrowck-bad-nested-calls-move.stderr @@ -1,6 +1,9 @@ error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/borrowck-bad-nested-calls-move.rs:25:9 | +LL | let mut a: Box<_> = Box::new(1); + | ----- binding `a` declared here +... LL | add( | --- borrow later used by call LL | &*a, @@ -11,6 +14,8 @@ LL | a); error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/borrowck-bad-nested-calls-move.rs:32:9 | +LL | let mut a: Box<_> = Box::new(1); + | ----- binding `a` declared here LL | add( | --- borrow later used by call LL | &*a, diff --git a/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index ce9f7aa05..dd0817ff2 100644 --- a/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -1,11 +1,13 @@ error[E0594]: cannot assign to `**t1`, which is behind a `&` reference --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | -LL | let t1 = t0; - | -- consider changing this binding's type to be: `&mut &mut isize` -LL | let p: &isize = &**t0; LL | **t1 = 22; | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written + | +help: consider specifying this binding's type + | +LL | let t1: &mut &mut isize = t0; + | +++++++++++++++++ error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21 diff --git a/tests/ui/borrowck/borrowck-closures-mut-and-imm.stderr b/tests/ui/borrowck/borrowck-closures-mut-and-imm.stderr index fadcd11a5..8a7870e0c 100644 --- a/tests/ui/borrowck/borrowck-closures-mut-and-imm.stderr +++ b/tests/ui/borrowck/borrowck-closures-mut-and-imm.stderr @@ -49,9 +49,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let c2 = || x * 5; | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 5; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | LL | drop(c2); | -- borrow later used here @@ -62,9 +62,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let c1 = || get(&x); | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 5; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | LL | drop(c1); | -- borrow later used here @@ -75,9 +75,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | let c1 = || get(&*x); | -- -- borrow occurs due to use in closure | | - | borrow of `*x` occurs here + | `*x` is borrowed here LL | *x = 5; - | ^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | LL | drop(c1); | -- borrow later used here @@ -88,9 +88,9 @@ error[E0506]: cannot assign to `*x.f` because it is borrowed LL | let c1 = || get(&*x.f); | -- ---- borrow occurs due to use in closure | | - | borrow of `*x.f` occurs here + | `*x.f` is borrowed here LL | *x.f = 5; - | ^^^^^^^^ assignment to borrowed `*x.f` occurs here + | ^^^^^^^^ `*x.f` is assigned to here but it was already borrowed LL | LL | drop(c1); | -- borrow later used here diff --git a/tests/ui/borrowck/borrowck-describe-lvalue.stderr b/tests/ui/borrowck/borrowck-describe-lvalue.stderr index 2c1b9c10d..cb29c9fda 100644 --- a/tests/ui/borrowck/borrowck-describe-lvalue.stderr +++ b/tests/ui/borrowck/borrowck-describe-lvalue.stderr @@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:37:9 | LL | let x = f.x(); - | ----- borrow of `f` occurs here + | ----- `f` is borrowed here LL | f.x; | ^^^ use of borrowed `f` LL | drop(x); @@ -55,7 +55,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:44:9 | LL | let x = g.x(); - | ----- borrow of `g` occurs here + | ----- `g` is borrowed here LL | g.0; | ^^^ use of borrowed `g` LL | drop(x); @@ -65,7 +65,7 @@ error[E0503]: cannot use `h.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:51:9 | LL | let x = &mut h.0; - | -------- borrow of `h.0` occurs here + | -------- `h.0` is borrowed here LL | h.0; | ^^^ use of borrowed `h.0` LL | drop(x); @@ -75,7 +75,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:59:20 | LL | let x = e.x(); - | ----- borrow of `e` occurs here + | ----- `e` is borrowed here LL | match e { LL | Baz::X(value) => value | ^^^^^ use of borrowed `e` @@ -87,7 +87,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:67:9 | LL | let x = &mut u.a; - | -------- borrow of `u.a` occurs here + | -------- `u.a` is borrowed here LL | u.a; | ^^^ use of borrowed `u.a` LL | drop(x); @@ -97,7 +97,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:74:9 | LL | let x = f.x(); - | ----- borrow of `*f` occurs here + | ----- `*f` is borrowed here LL | f.x; | ^^^ use of borrowed `*f` LL | drop(x); @@ -107,7 +107,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:81:9 | LL | let x = g.x(); - | ----- borrow of `*g` occurs here + | ----- `*g` is borrowed here LL | g.0; | ^^^ use of borrowed `*g` LL | drop(x); @@ -117,7 +117,7 @@ error[E0503]: cannot use `h.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:88:9 | LL | let x = &mut h.0; - | -------- borrow of `h.0` occurs here + | -------- `h.0` is borrowed here LL | h.0; | ^^^ use of borrowed `h.0` LL | drop(x); @@ -127,7 +127,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:96:20 | LL | let x = e.x(); - | ----- borrow of `*e` occurs here + | ----- `*e` is borrowed here LL | match *e { LL | Baz::X(value) => value | ^^^^^ use of borrowed `*e` @@ -139,7 +139,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:105:9 | LL | let x = &mut u.a; - | -------- borrow of `u.a` occurs here + | -------- `u.a` is borrowed here LL | u.a; | ^^^ use of borrowed `u.a` LL | drop(x); @@ -149,7 +149,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:113:15 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here LL | match v { LL | &[x, _, .., _, _] => println!("{}", x), | ^ use of borrowed `v` @@ -161,7 +161,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:118:18 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[_, x, .., _, _] => println!("{}", x), | ^ use of borrowed `v` @@ -173,7 +173,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:123:25 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[_, _, .., x, _] => println!("{}", x), | ^ use of borrowed `v` @@ -185,7 +185,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:128:28 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[_, _, .., _, x] => println!("{}", x), | ^ use of borrowed `v` @@ -197,7 +197,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:139:15 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here LL | match v { LL | &[x @ ..] => println!("{:?}", x), | ^ use of borrowed `v` @@ -209,7 +209,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:144:18 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[_, x @ ..] => println!("{:?}", x), | ^ use of borrowed `v` @@ -221,7 +221,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:149:15 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[x @ .., _] => println!("{:?}", x), | ^ use of borrowed `v` @@ -233,7 +233,7 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:154:18 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here ... LL | &[_, x @ .., _] => println!("{:?}", x), | ^ use of borrowed `v` @@ -245,7 +245,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:166:15 | LL | let x = &mut e; - | ------ borrow of `e` occurs here + | ------ `e` is borrowed here LL | match e { | ^ use of borrowed `e` ... @@ -304,7 +304,7 @@ error[E0503]: cannot use `*v` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:232:9 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here LL | v[0].y; | ^^^^ use of borrowed `v` ... @@ -315,7 +315,7 @@ error[E0503]: cannot use `v[_].y` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:232:9 | LL | let x = &mut v; - | ------ borrow of `v` occurs here + | ------ `v` is borrowed here LL | v[0].y; | ^^^^^^ use of borrowed `v` ... diff --git a/tests/ui/borrowck/borrowck-field-sensitivity.stderr b/tests/ui/borrowck/borrowck-field-sensitivity.stderr index e009f5913..11812847d 100644 --- a/tests/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/tests/ui/borrowck/borrowck-field-sensitivity.stderr @@ -41,6 +41,8 @@ LL | let p = &x.b; error[E0505]: cannot move out of `x.b` because it is borrowed --> $DIR/borrowck-field-sensitivity.rs:34:10 | +LL | let x = A { a: 1, b: Box::new(2) }; + | - binding `x` declared here LL | let p = &x.b; | ---- borrow of `x.b` occurs here LL | drop(x.b); @@ -51,6 +53,8 @@ LL | drop(**p); error[E0505]: cannot move out of `x.b` because it is borrowed --> $DIR/borrowck-field-sensitivity.rs:41:14 | +LL | let x = A { a: 1, b: Box::new(2) }; + | - binding `x` declared here LL | let p = &x.b; | ---- borrow of `x.b` occurs here LL | let _y = A { a: 3, .. x }; diff --git a/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr index a66db05cc..1a20ec85f 100644 --- a/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr +++ b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `_a` because it is borrowed --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:6:9 | LL | let b = &mut _a; - | ------- borrow of `_a` occurs here + | ------- `_a` is borrowed here ... LL | _a = 4; - | ^^^^^^ assignment to borrowed `_a` occurs here + | ^^^^^^ `_a` is assigned to here but it was already borrowed ... LL | drop(b); | - borrow later used here diff --git a/tests/ui/borrowck/borrowck-issue-14498.stderr b/tests/ui/borrowck/borrowck-issue-14498.stderr index 42a55b7a8..374c5ee3e 100644 --- a/tests/ui/borrowck/borrowck-issue-14498.stderr +++ b/tests/ui/borrowck/borrowck-issue-14498.stderr @@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed --> $DIR/borrowck-issue-14498.rs:25:5 | LL | let p = &y; - | -- borrow of `**y` occurs here + | -- `**y` is borrowed here LL | let q = &***p; LL | **y = 2; - | ^^^^^^^ assignment to borrowed `**y` occurs here + | ^^^^^^^ `**y` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -24,10 +24,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed --> $DIR/borrowck-issue-14498.rs:35:5 | LL | let p = &y; - | -- borrow of `**y` occurs here + | -- `**y` is borrowed here LL | let q = &***p; LL | **y = 2; - | ^^^^^^^ assignment to borrowed `**y` occurs here + | ^^^^^^^ `**y` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -35,10 +35,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed --> $DIR/borrowck-issue-14498.rs:45:5 | LL | let p = &y; - | -- borrow of `**y` occurs here + | -- `**y` is borrowed here LL | let q = &***p; LL | **y = 2; - | ^^^^^^^ assignment to borrowed `**y` occurs here + | ^^^^^^^ `**y` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -46,10 +46,10 @@ error[E0506]: cannot assign to `**y` because it is borrowed --> $DIR/borrowck-issue-14498.rs:55:5 | LL | let p = &y; - | -- borrow of `**y` occurs here + | -- `**y` is borrowed here LL | let q = &***p; LL | **y = 2; - | ^^^^^^^ assignment to borrowed `**y` occurs here + | ^^^^^^^ `**y` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -57,10 +57,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed --> $DIR/borrowck-issue-14498.rs:65:5 | LL | let p = &y.a; - | ---- borrow of `**y.a` occurs here + | ---- `**y.a` is borrowed here LL | let q = &***p; LL | **y.a = 2; - | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here + | ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -68,10 +68,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed --> $DIR/borrowck-issue-14498.rs:75:5 | LL | let p = &y.a; - | ---- borrow of `**y.a` occurs here + | ---- `**y.a` is borrowed here LL | let q = &***p; LL | **y.a = 2; - | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here + | ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -79,10 +79,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed --> $DIR/borrowck-issue-14498.rs:85:5 | LL | let p = &y.a; - | ---- borrow of `**y.a` occurs here + | ---- `**y.a` is borrowed here LL | let q = &***p; LL | **y.a = 2; - | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here + | ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here @@ -90,10 +90,10 @@ error[E0506]: cannot assign to `**y.a` because it is borrowed --> $DIR/borrowck-issue-14498.rs:95:5 | LL | let p = &y.a; - | ---- borrow of `**y.a` occurs here + | ---- `**y.a` is borrowed here LL | let q = &***p; LL | **y.a = 2; - | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here + | ^^^^^^^^^ `**y.a` is assigned to here but it was already borrowed LL | drop(p); | - borrow later used here diff --git a/tests/ui/borrowck/borrowck-lend-flow-match.stderr b/tests/ui/borrowck/borrowck-lend-flow-match.stderr index 66f1cd9bd..6cdce7bee 100644 --- a/tests/ui/borrowck/borrowck-lend-flow-match.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow-match.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/borrowck-lend-flow-match.rs:12:13 | LL | Some(ref r) => { - | ----- borrow of `x` occurs here + | ----- `x` is borrowed here LL | x = Some(1); - | ^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^^^^^^^^^^^ `x` is assigned to here but it was already borrowed LL | drop(r); | - borrow later used here diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr index 3548da35b..6eabfff90 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `v` because it is borrowed --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19 | +LL | let v: Box<_> = Box::new(3); + | - binding `v` declared here LL | let w = &v; | -- borrow of `v` occurs here LL | thread::spawn(move|| { @@ -15,6 +17,8 @@ LL | w.use_ref(); error[E0505]: cannot move out of `v` because it is borrowed --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 | +LL | let v: Box<_> = Box::new(3); + | - binding `v` declared here LL | let w = &v; | -- borrow of `v` occurs here LL | thread::spawn(move|| { diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr index b5c6b101f..38e06fa01 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `v` because it is borrowed --> $DIR/borrowck-loan-blocks-move.rs:11:10 | +LL | let v = Box::new(3); + | - binding `v` declared here LL | let w = &v; | -- borrow of `v` occurs here LL | take(v); diff --git a/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr index 6994c837d..311369a26 100644 --- a/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr +++ b/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr @@ -2,12 +2,12 @@ error[E0506]: cannot assign to `*s` because it is borrowed --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5 | LL | let alias: &'static mut String = s; - | ------------------- - borrow of `*s` occurs here + | ------------------- - `*s` is borrowed here | | | type annotation requires that `*s` is borrowed for `'static` ... LL | *s = String::new(); - | ^^ assignment to borrowed `*s` occurs here + | ^^ `*s` is assigned to here but it was already borrowed error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index 24cc4933e..f1640d3b7 100644 --- a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5 | LL | let q = &mut p; - | ------ borrow of `p` occurs here + | ------ `p` is borrowed here LL | LL | p + 3; | ^ use of borrowed `p` diff --git a/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr b/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr index 6ea6951ad..0fdb1dabb 100644 --- a/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr +++ b/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr @@ -1,6 +1,8 @@ error[E0597]: `z.1` does not live long enough --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:3:15 | +LL | let mut z = (0, 0); + | ----- binding `z` declared here LL | *x = Some(&mut z.1); | ----------^^^^^^^^- | | | diff --git a/tests/ui/borrowck/borrowck-match-already-borrowed.stderr b/tests/ui/borrowck/borrowck-match-already-borrowed.stderr index 39047be9d..e5c0ec960 100644 --- a/tests/ui/borrowck/borrowck-match-already-borrowed.stderr +++ b/tests/ui/borrowck/borrowck-match-already-borrowed.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `foo` because it was mutably borrowed --> $DIR/borrowck-match-already-borrowed.rs:9:19 | LL | let p = &mut foo; - | -------- borrow of `foo` occurs here + | -------- `foo` is borrowed here LL | let _ = match foo { | ^^^ use of borrowed `foo` ... @@ -13,7 +13,7 @@ error[E0503]: cannot use `foo.0` because it was mutably borrowed --> $DIR/borrowck-match-already-borrowed.rs:12:16 | LL | let p = &mut foo; - | -------- borrow of `foo` occurs here + | -------- `foo` is borrowed here ... LL | Foo::A(x) => x | ^ use of borrowed `foo` @@ -25,7 +25,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-match-already-borrowed.rs:22:9 | LL | let r = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | let _ = match x { LL | x => x + 1, | ^ use of borrowed `x` @@ -37,7 +37,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-match-already-borrowed.rs:23:9 | LL | let r = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | y => y + 2, | ^ use of borrowed `x` diff --git a/tests/ui/borrowck/borrowck-move-by-capture.stderr b/tests/ui/borrowck/borrowck-move-by-capture.stderr index 8ddc48b2a..6eaa1fa31 100644 --- a/tests/ui/borrowck/borrowck-move-by-capture.stderr +++ b/tests/ui/borrowck/borrowck-move-by-capture.stderr @@ -10,7 +10,7 @@ LL | let _h = to_fn_once(move || -> isize { *bar }); | | | | | variable moved due to use in closure | | move occurs because `bar` has type `Box`, which does not implement the `Copy` trait - | move out of `bar` occurs here + | `bar` is moved here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index f833abcc0..bd94f1a42 100644 --- a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `*a` because it is borrowed --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13 | +LL | let a: Box> = Box::new(Box::new(2)); + | - binding `a` declared here LL | let b = &a; | -- borrow of `a` occurs here LL | diff --git a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr index d5ff0c501..cdad20c52 100644 --- a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `t0` because it is borrowed --> $DIR/borrowck-move-mut-base-ptr.rs:10:14 | +LL | fn foo(t0: &mut isize) { + | -- binding `t0` declared here LL | let p: &isize = &*t0; // Freezes `*t0` | ---- borrow of `*t0` occurs here LL | let t1 = t0; diff --git a/tests/ui/borrowck/borrowck-move-subcomponent.stderr b/tests/ui/borrowck/borrowck-move-subcomponent.stderr index 8c9083fcf..341146bd1 100644 --- a/tests/ui/borrowck/borrowck-move-subcomponent.stderr +++ b/tests/ui/borrowck/borrowck-move-subcomponent.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `a.x` because it is borrowed --> $DIR/borrowck-move-subcomponent.rs:15:14 | +LL | let a : S = S { x : Box::new(1) }; + | - binding `a` declared here LL | let pb = &a; | -- borrow of `a` occurs here LL | let S { x: ax } = a; diff --git a/tests/ui/borrowck/borrowck-multiple-captures.stderr b/tests/ui/borrowck/borrowck-multiple-captures.stderr index f94cbc30d..70abe7b34 100644 --- a/tests/ui/borrowck/borrowck-multiple-captures.stderr +++ b/tests/ui/borrowck/borrowck-multiple-captures.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x1` because it is borrowed --> $DIR/borrowck-multiple-captures.rs:12:19 | +LL | let x1: Box<_> = Box::new(1); + | -- binding `x1` declared here LL | let p1 = &x1; | --- borrow of `x1` occurs here ... @@ -16,6 +18,8 @@ LL | borrow(&*p1); error[E0505]: cannot move out of `x2` because it is borrowed --> $DIR/borrowck-multiple-captures.rs:12:19 | +LL | let x2: Box<_> = Box::new(2); + | -- binding `x2` declared here LL | let p2 = &x2; | --- borrow of `x2` occurs here LL | thread::spawn(move|| { @@ -77,6 +81,8 @@ LL | drop(x); error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/borrowck-multiple-captures.rs:38:19 | +LL | let x: Box<_> = Box::new(1); + | - binding `x` declared here LL | let p = &x; | -- borrow of `x` occurs here LL | thread::spawn(move|| { diff --git a/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr b/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr index 5d52e4919..7f42becd2 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `v` because it is borrowed --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:31:5 | LL | let i = &v[0].f; - | - borrow of `v` occurs here + | - `v` is borrowed here LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `v` is assigned to here but it was already borrowed LL | LL | read(*i); | -- borrow later used here diff --git a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr index 087f2ac79..fb7af50bc 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr @@ -42,9 +42,9 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5 | LL | let p = &f.foo[&s]; - | ----- borrow of `f.foo` occurs here + | ----- `f.foo` is borrowed here LL | f.foo = g; - | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here + | ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed LL | p.use_ref(); | ----------- borrow later used here @@ -52,9 +52,9 @@ error[E0506]: cannot assign to `*f` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5 | LL | let p = &f.foo[&s]; - | ----- borrow of `*f` occurs here + | ----- `*f` is borrowed here LL | *f = g; - | ^^^^^^ assignment to borrowed `*f` occurs here + | ^^^^^^ `*f` is assigned to here but it was already borrowed LL | p.use_ref(); | ----------- borrow later used here @@ -62,9 +62,9 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5 | LL | let p = &mut f.foo[&s]; - | ----- borrow of `f.foo` occurs here + | ----- `f.foo` is borrowed here LL | f.foo = g; - | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here + | ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed LL | p.use_mut(); | ----------- borrow later used here @@ -72,9 +72,9 @@ error[E0506]: cannot assign to `*f` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5 | LL | let p = &mut f.foo[&s]; - | ----- borrow of `*f` occurs here + | ----- `*f` is borrowed here LL | *f = g; - | ^^^^^^ assignment to borrowed `*f` occurs here + | ^^^^^^ `*f` is assigned to here but it was already borrowed LL | p.use_mut(); | ----------- borrow later used here diff --git a/tests/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/tests/ui/borrowck/borrowck-overloaded-index-move-index.stderr index fb0e274c2..7f8cc74a7 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-move-index.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-move-index.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `s` because it is borrowed --> $DIR/borrowck-overloaded-index-move-index.rs:50:22 | +LL | let mut s = "hello".to_string(); + | ----- binding `s` declared here LL | let rs = &mut s; | ------ borrow of `s` occurs here LL | @@ -13,6 +15,8 @@ LL | use_mut(rs); error[E0505]: cannot move out of `s` because it is borrowed --> $DIR/borrowck-overloaded-index-move-index.rs:53:7 | +LL | let mut s = "hello".to_string(); + | ----- binding `s` declared here LL | let rs = &mut s; | ------ borrow of `s` occurs here ... diff --git a/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr b/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr index 9e65ccf5a..b86a86938 100644 --- a/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr +++ b/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/borrowck-pat-reassign-binding.rs:10:11 | LL | Some(ref i) => { - | ----- borrow of `x` occurs here + | ----- `x` is borrowed here LL | // But on this branch, `i` is an outstanding borrow LL | x = Some(*i+1); - | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed LL | drop(i); | - borrow later used here diff --git a/tests/ui/borrowck/borrowck-unary-move.stderr b/tests/ui/borrowck/borrowck-unary-move.stderr index aab225ed4..f3b962059 100644 --- a/tests/ui/borrowck/borrowck-unary-move.stderr +++ b/tests/ui/borrowck/borrowck-unary-move.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/borrowck-unary-move.rs:3:10 | +LL | fn foo(x: Box) -> isize { + | - binding `x` declared here LL | let y = &*x; | --- borrow of `*x` occurs here LL | free(x); diff --git a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr index 4bd7d54cf..a87a14e7c 100644 --- a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed --> $DIR/borrowck-union-borrow-nested.rs:24:21 | LL | let ra = &mut u.s.a; - | ---------- borrow of `u.s.a` occurs here + | ---------- `u.s.a` is borrowed here LL | let b = u.c; | ^^^ use of borrowed `u.s.a` LL | ra.use_mut(); diff --git a/tests/ui/borrowck/borrowck-union-borrow.stderr b/tests/ui/borrowck/borrowck-union-borrow.stderr index 090c7b6b5..11a28f674 100644 --- a/tests/ui/borrowck/borrowck-union-borrow.stderr +++ b/tests/ui/borrowck/borrowck-union-borrow.stderr @@ -12,9 +12,9 @@ error[E0506]: cannot assign to `u.a` because it is borrowed --> $DIR/borrowck-union-borrow.rs:28:13 | LL | let ra = &u.a; - | ---- borrow of `u.a` occurs here + | ---- `u.a` is borrowed here LL | u.a = 1; - | ^^^^^^^ assignment to borrowed `u.a` occurs here + | ^^^^^^^ `u.a` is assigned to here but it was already borrowed LL | drop(ra); | -- borrow later used here @@ -34,9 +34,9 @@ error[E0506]: cannot assign to `u.b` because it is borrowed --> $DIR/borrowck-union-borrow.rs:49:13 | LL | let ra = &u.a; - | ---- borrow of `u.b` occurs here + | ---- `u.b` is borrowed here LL | u.b = 1; - | ^^^^^^^ assignment to borrowed `u.b` occurs here + | ^^^^^^^ `u.b` is assigned to here but it was already borrowed LL | drop(ra); | -- borrow later used here @@ -54,7 +54,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed --> $DIR/borrowck-union-borrow.rs:60:21 | LL | let ra = &mut u.a; - | -------- borrow of `u.a` occurs here + | -------- `u.a` is borrowed here LL | let a = u.a; | ^^^ use of borrowed `u.a` LL | drop(ra); @@ -74,9 +74,9 @@ error[E0506]: cannot assign to `u.a` because it is borrowed --> $DIR/borrowck-union-borrow.rs:70:13 | LL | let rma = &mut u.a; - | -------- borrow of `u.a` occurs here + | -------- `u.a` is borrowed here LL | u.a = 1; - | ^^^^^^^ assignment to borrowed `u.a` occurs here + | ^^^^^^^ `u.a` is assigned to here but it was already borrowed LL | drop(rma); | --- borrow later used here @@ -96,7 +96,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed --> $DIR/borrowck-union-borrow.rs:81:21 | LL | let ra = &mut u.a; - | -------- borrow of `u.a` occurs here + | -------- `u.a` is borrowed here LL | let b = u.b; | ^^^ use of borrowed `u.a` LL | @@ -119,9 +119,9 @@ error[E0506]: cannot assign to `u.b` because it is borrowed --> $DIR/borrowck-union-borrow.rs:92:13 | LL | let rma = &mut u.a; - | -------- borrow of `u.b` occurs here + | -------- `u.b` is borrowed here LL | u.b = 1; - | ^^^^^^^ assignment to borrowed `u.b` occurs here + | ^^^^^^^ `u.b` is assigned to here but it was already borrowed LL | drop(rma); | --- borrow later used here diff --git a/tests/ui/borrowck/borrowck-use-mut-borrow.stderr b/tests/ui/borrowck/borrowck-use-mut-borrow.stderr index 91d69c51e..4d300ae3c 100644 --- a/tests/ui/borrowck/borrowck-use-mut-borrow.stderr +++ b/tests/ui/borrowck/borrowck-use-mut-borrow.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:11:10 | LL | let p = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | drop(x); | ^ use of borrowed `x` LL | *p = 2; @@ -12,7 +12,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:18:10 | LL | let p = &mut x.a; - | -------- borrow of `x.a` occurs here + | -------- `x.a` is borrowed here LL | drop(x); | ^ use of borrowed `x.a` LL | *p = 3; @@ -22,7 +22,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:25:10 | LL | let p = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | drop(x.a); | ^^^ use of borrowed `x` LL | p.a = 3; @@ -32,7 +32,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:32:10 | LL | let p = &mut x.a; - | -------- borrow of `x.a` occurs here + | -------- `x.a` is borrowed here LL | drop(x.a); | ^^^ use of borrowed `x.a` LL | *p = 3; @@ -42,7 +42,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:39:13 | LL | let p = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x` LL | drop(y); @@ -53,7 +53,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:47:13 | LL | let p = &mut x.a; - | -------- borrow of `x.a` occurs here + | -------- `x.a` is borrowed here LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x.a` LL | drop(y); @@ -64,7 +64,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:55:10 | LL | let p = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | drop(*x); | ^^ use of borrowed `x` LL | **p = 2; @@ -74,7 +74,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:62:10 | LL | let p = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | drop(*x.b); | ^^^^ use of borrowed `x` LL | p.a = 3; @@ -84,7 +84,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed --> $DIR/borrowck-use-mut-borrow.rs:69:10 | LL | let p = &mut x.b; - | -------- borrow of `x.b` occurs here + | -------- `x.b` is borrowed here LL | drop(*x.b); | ^^^^ use of borrowed `x.b` LL | **p = 3; diff --git a/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr index 0ac7df944..494d8c351 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5 | LL | [1, 2, ref tail @ ..] => tail, - | -------- borrow of `a[_]` occurs here + | -------- `a[_]` is borrowed here ... LL | a[2] = 0; - | ^^^^^^^^ assignment to borrowed `a[_]` occurs here + | ^^^^^^^^ `a[_]` is assigned to here but it was already borrowed LL | println!("t[0]: {}", t[0]); | ---- borrow later used here diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs index 0e9284a2c..1bda7a497 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -5,9 +5,9 @@ fn a() { let mut vec = [Box::new(1), Box::new(2), Box::new(3)]; match vec { [box ref _a, _, _] => { - //~^ NOTE borrow of `vec[_]` occurs here + //~^ NOTE `vec[_]` is borrowed here vec[0] = Box::new(4); //~ ERROR cannot assign - //~^ NOTE assignment to borrowed `vec[_]` occurs here + //~^ NOTE `vec[_]` is assigned to here _a.use_ref(); //~^ NOTE borrow later used here } @@ -19,9 +19,9 @@ fn b() { let vec: &mut [Box] = &mut vec; match vec { &mut [ref _b @ ..] => { - //~^ borrow of `vec[_]` occurs here + //~^ `vec[_]` is borrowed here vec[0] = Box::new(4); //~ ERROR cannot assign - //~^ NOTE assignment to borrowed `vec[_]` occurs here + //~^ NOTE `vec[_]` is assigned to here _b.use_ref(); //~^ NOTE borrow later used here } diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 0dc5e64e4..70b9e4f44 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-nesting.rs:9:13 | LL | [box ref _a, _, _] => { - | ------ borrow of `vec[_]` occurs here + | ------ `vec[_]` is borrowed here LL | LL | vec[0] = Box::new(4); - | ^^^^^^ assignment to borrowed `vec[_]` occurs here + | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed LL | LL | _a.use_ref(); | ------------ borrow later used here @@ -14,10 +14,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 | LL | &mut [ref _b @ ..] => { - | ------ borrow of `vec[_]` occurs here + | ------ `vec[_]` is borrowed here LL | LL | vec[0] = Box::new(4); - | ^^^^^^ assignment to borrowed `vec[_]` occurs here + | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed LL | LL | _b.use_ref(); | ------------ borrow later used here diff --git a/tests/ui/borrowck/issue-103624.rs b/tests/ui/borrowck/issue-103624.rs index f1fa95f92..d95a40bd4 100644 --- a/tests/ui/borrowck/issue-103624.rs +++ b/tests/ui/borrowck/issue-103624.rs @@ -12,7 +12,7 @@ impl StructA { async fn foo(&self) { let bar = self.b.bar().await; spawn_blocking(move || { - //~^ ERROR borrowed data escapes outside of associated function + //~^ ERROR borrowed data escapes outside of method self.b; //~^ ERROR cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure }) diff --git a/tests/ui/borrowck/issue-103624.stderr b/tests/ui/borrowck/issue-103624.stderr index e6a35dd88..7a281e8aa 100644 --- a/tests/ui/borrowck/issue-103624.stderr +++ b/tests/ui/borrowck/issue-103624.stderr @@ -10,13 +10,13 @@ LL | LL | self.b; | ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait -error[E0521]: borrowed data escapes outside of associated function +error[E0521]: borrowed data escapes outside of method --> $DIR/issue-103624.rs:14:9 | LL | async fn foo(&self) { | ----- | | - | `self` is a reference that is only valid in the associated function body + | `self` is a reference that is only valid in the method body | let's call the lifetime of this reference `'1` LL | let bar = self.b.bar().await; LL | / spawn_blocking(move || { @@ -26,7 +26,7 @@ LL | | LL | | }) | | ^ | | | - | |__________`self` escapes the associated function body here + | |__________`self` escapes the method body here | argument requires that `'1` must outlive `'static` error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/issue-25793.stderr b/tests/ui/borrowck/issue-25793.stderr index da3412f11..27dab53e4 100644 --- a/tests/ui/borrowck/issue-25793.stderr +++ b/tests/ui/borrowck/issue-25793.stderr @@ -5,7 +5,7 @@ LL | $this.width.unwrap() | ^^^^^^^^^^^ use of borrowed `*self` ... LL | let r = &mut *self; - | ---------- borrow of `*self` occurs here + | ---------- `*self` is borrowed here LL | r.get_size(width!(self)) | -------- ------------ in this macro invocation | | diff --git a/tests/ui/borrowck/issue-52713-bug.stderr b/tests/ui/borrowck/issue-52713-bug.stderr index 4abb6fb2c..3f7715645 100644 --- a/tests/ui/borrowck/issue-52713-bug.stderr +++ b/tests/ui/borrowck/issue-52713-bug.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/issue-52713-bug.rs:12:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here ... LL | x += 1; - | ^^^^^^ assignment to borrowed `x` occurs here + | ^^^^^^ `x` is assigned to here but it was already borrowed LL | println!("{}", y); | - borrow later used here diff --git a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr index 57803247b..0870b4237 100644 --- a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr +++ b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -4,10 +4,10 @@ error[E0506]: cannot assign to `greeting` because it is borrowed LL | let res = (|| (|| &greeting)())(); | -- -------- borrow occurs due to use in closure | | - | borrow of `greeting` occurs here + | `greeting` is borrowed here LL | LL | greeting = "DEALLOCATED".to_string(); - | ^^^^^^^^ assignment to borrowed `greeting` occurs here + | ^^^^^^^^ `greeting` is assigned to here but it was already borrowed ... LL | println!("thread result: {:?}", res); | --- borrow later used here diff --git a/tests/ui/borrowck/issue-81365-1.stderr b/tests/ui/borrowck/issue-81365-1.stderr index d79394834..0d803b042 100644 --- a/tests/ui/borrowck/issue-81365-1.stderr +++ b/tests/ui/borrowck/issue-81365-1.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-1.rs:21:9 | LL | let first = &self.target_field; - | ---- borrow of `self.container_field` occurs here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-10.stderr b/tests/ui/borrowck/issue-81365-10.stderr index 27123ef2b..d0986e9f9 100644 --- a/tests/ui/borrowck/issue-81365-10.stderr +++ b/tests/ui/borrowck/issue-81365-10.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-10.rs:21:9 | LL | let first = &self.deref().target_field; - | ------------ borrow of `self.container_field` occurs here + | ------------ `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here diff --git a/tests/ui/borrowck/issue-81365-11.stderr b/tests/ui/borrowck/issue-81365-11.stderr index 0770c1366..5f7e86f11 100644 --- a/tests/ui/borrowck/issue-81365-11.stderr +++ b/tests/ui/borrowck/issue-81365-11.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-11.rs:27:9 | LL | let first = &mut self.target_field; - | ---- borrow of `self.container_field` occurs here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here diff --git a/tests/ui/borrowck/issue-81365-2.stderr b/tests/ui/borrowck/issue-81365-2.stderr index 764eaaa7c..d9aeaf15f 100644 --- a/tests/ui/borrowck/issue-81365-2.stderr +++ b/tests/ui/borrowck/issue-81365-2.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container.container_field` because it is bo --> $DIR/issue-81365-2.rs:25:9 | LL | let first = &self.container.target_field; - | -------------- borrow of `self.container.container_field` occurs here + | -------------- `self.container.container_field` is borrowed here LL | self.container.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-3.stderr b/tests/ui/borrowck/issue-81365-3.stderr index 9447174fd..0c0d1994b 100644 --- a/tests/ui/borrowck/issue-81365-3.stderr +++ b/tests/ui/borrowck/issue-81365-3.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container.container_field` because it is bo --> $DIR/issue-81365-3.rs:32:9 | LL | let first = &self.target_field; - | ---- borrow of `self.container.container_field` occurs here + | ---- `self.container.container_field` is borrowed here LL | self.container.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-4.stderr b/tests/ui/borrowck/issue-81365-4.stderr index 0ab3fa927..98093daa9 100644 --- a/tests/ui/borrowck/issue-81365-4.stderr +++ b/tests/ui/borrowck/issue-81365-4.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.outer_field` because it is borrowed --> $DIR/issue-81365-4.rs:33:9 | LL | let first = &self.target_field; - | ---- borrow of `self.outer_field` occurs here + | ---- `self.outer_field` is borrowed here LL | self.outer_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.outer_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^ `self.outer_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-5.stderr b/tests/ui/borrowck/issue-81365-5.stderr index 20ff229ff..c00e48288 100644 --- a/tests/ui/borrowck/issue-81365-5.stderr +++ b/tests/ui/borrowck/issue-81365-5.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-5.rs:28:9 | LL | let first = self.get(); - | ---------- borrow of `self.container_field` occurs here + | ---------- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-6.stderr b/tests/ui/borrowck/issue-81365-6.stderr index 575aed73b..e61dc95ec 100644 --- a/tests/ui/borrowck/issue-81365-6.stderr +++ b/tests/ui/borrowck/issue-81365-6.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-6.rs:18:9 | LL | let first = &self[0]; - | ---- borrow of `self.container_field` occurs here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-7.stderr b/tests/ui/borrowck/issue-81365-7.stderr index 52d2d9e75..0565127e3 100644 --- a/tests/ui/borrowck/issue-81365-7.stderr +++ b/tests/ui/borrowck/issue-81365-7.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `c.container_field` because it is borrowed --> $DIR/issue-81365-7.rs:20:5 | LL | let first = &c.target_field; - | - borrow of `c.container_field` occurs here + | - `c.container_field` is borrowed here LL | c.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `c.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^ `c.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-8.stderr b/tests/ui/borrowck/issue-81365-8.stderr index fd83e10a2..0ca732ff2 100644 --- a/tests/ui/borrowck/issue-81365-8.stderr +++ b/tests/ui/borrowck/issue-81365-8.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-8.rs:21:9 | LL | let first = &(*self).target_field; - | ------- borrow of `self.container_field` occurs here + | ------- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here | diff --git a/tests/ui/borrowck/issue-81365-9.stderr b/tests/ui/borrowck/issue-81365-9.stderr index c7d48214f..4d305268a 100644 --- a/tests/ui/borrowck/issue-81365-9.stderr +++ b/tests/ui/borrowck/issue-81365-9.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-9.rs:21:9 | LL | let first = &Deref::deref(self).target_field; - | ---- borrow of `self.container_field` occurs here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.container_field` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; | ----- borrow later used here 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 dd0320bc5..d067ff447 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -14,8 +14,8 @@ impl MarketMultiplier { } async fn buy_lock(generator: &Mutex) -> LockedMarket<'_> { - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied - //~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied + //~^ 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()) } 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 d2b927fb6..73e0aaf1e 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +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) -> LockedMarket<'_> { @@ -12,7 +12,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket(T); | ^^^^^^^^^^^^ -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +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) -> LockedMarket<'_> { diff --git a/tests/ui/borrowck/issue-83924.fixed b/tests/ui/borrowck/issue-83924.fixed new file mode 100644 index 000000000..aa40da12b --- /dev/null +++ b/tests/ui/borrowck/issue-83924.fixed @@ -0,0 +1,20 @@ +// run-rustfix + +fn main() { + let mut values = vec![10, 11, 12]; + let v = &mut values; + + let mut max = 0; + + for n in &mut *v { + max = std::cmp::max(max, *n); + } + + println!("max is {}", max); + println!("Converting to percentages of maximum value..."); + for n in v { + //~^ ERROR: use of moved value: `v` [E0382] + *n = 100 * (*n) / max; + } + println!("values: {:#?}", values); +} diff --git a/tests/ui/borrowck/issue-83924.rs b/tests/ui/borrowck/issue-83924.rs new file mode 100644 index 000000000..22b80fe2f --- /dev/null +++ b/tests/ui/borrowck/issue-83924.rs @@ -0,0 +1,20 @@ +// run-rustfix + +fn main() { + let mut values = vec![10, 11, 12]; + let v = &mut values; + + let mut max = 0; + + for n in v { + max = std::cmp::max(max, *n); + } + + println!("max is {}", max); + println!("Converting to percentages of maximum value..."); + for n in v { + //~^ ERROR: use of moved value: `v` [E0382] + *n = 100 * (*n) / max; + } + println!("values: {:#?}", values); +} diff --git a/tests/ui/borrowck/issue-83924.stderr b/tests/ui/borrowck/issue-83924.stderr new file mode 100644 index 000000000..572414df2 --- /dev/null +++ b/tests/ui/borrowck/issue-83924.stderr @@ -0,0 +1,22 @@ +error[E0382]: use of moved value: `v` + --> $DIR/issue-83924.rs:15:14 + | +LL | let v = &mut values; + | - move occurs because `v` has type `&mut Vec`, which does not implement the `Copy` trait +... +LL | for n in v { + | - `v` moved due to this implicit call to `.into_iter()` +... +LL | for n in v { + | ^ value used here after move + | +note: `into_iter` takes ownership of the receiver `self`, which moves `v` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL +help: consider creating a fresh reborrow of `v` here + | +LL | for n in &mut *v { + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/issue-85765.rs b/tests/ui/borrowck/issue-85765.rs index 1598cd5d3..76e0b5173 100644 --- a/tests/ui/borrowck/issue-85765.rs +++ b/tests/ui/borrowck/issue-85765.rs @@ -1,7 +1,7 @@ fn main() { let mut test = Vec::new(); let rofl: &Vec> = &mut test; - //~^ NOTE consider changing this binding's type to be + //~^ HELP consider changing this binding's type rofl.push(Vec::new()); //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -15,14 +15,14 @@ fn main() { #[rustfmt::skip] let x: &usize = &mut{0}; - //~^ NOTE consider changing this binding's type to be + //~^ HELP consider changing this binding's type *x = 1; //~^ ERROR cannot assign to `*x`, which is behind a `&` reference //~| NOTE `x` is a `&` reference, so the data it refers to cannot be written #[rustfmt::skip] let y: &usize = &mut(0); - //~^ NOTE consider changing this binding's type to be + //~^ HELP consider changing this binding's type *y = 1; //~^ ERROR cannot assign to `*y`, which is behind a `&` reference //~| NOTE `y` is a `&` reference, so the data it refers to cannot be written diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr index 7da7dba68..b4bb128cb 100644 --- a/tests/ui/borrowck/issue-85765.stderr +++ b/tests/ui/borrowck/issue-85765.stderr @@ -1,11 +1,13 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference --> $DIR/issue-85765.rs:5:5 | -LL | let rofl: &Vec> = &mut test; - | ---- consider changing this binding's type to be: `&mut Vec>` -LL | LL | rofl.push(Vec::new()); | ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider changing this binding's type + | +LL | let rofl: &mut Vec> = &mut test; + | ~~~~~~~~~~~~~~~~~~ error[E0594]: cannot assign to `*r`, which is behind a `&` reference --> $DIR/issue-85765.rs:12:5 @@ -21,20 +23,24 @@ LL | let r = &mut mutvar; error[E0594]: cannot assign to `*x`, which is behind a `&` reference --> $DIR/issue-85765.rs:19:5 | -LL | let x: &usize = &mut{0}; - | - consider changing this binding's type to be: `&mut usize` -LL | LL | *x = 1; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this binding's type + | +LL | let x: &mut usize = &mut{0}; + | ~~~~~~~~~~ error[E0594]: cannot assign to `*y`, which is behind a `&` reference --> $DIR/issue-85765.rs:26:5 | -LL | let y: &usize = &mut(0); - | - consider changing this binding's type to be: `&mut usize` -LL | LL | *y = 1; | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this binding's type + | +LL | let y: &mut usize = &mut(0); + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/borrowck/issue-91206.rs b/tests/ui/borrowck/issue-91206.rs index 67407c1ea..e062a2537 100644 --- a/tests/ui/borrowck/issue-91206.rs +++ b/tests/ui/borrowck/issue-91206.rs @@ -9,7 +9,7 @@ impl TestClient { fn main() { let client = TestClient; let inner = client.get_inner_ref(); - //~^ NOTE consider changing this binding's type to be + //~^ HELP consider specifying this binding's type inner.clear(); //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596] //~| NOTE `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable diff --git a/tests/ui/borrowck/issue-91206.stderr b/tests/ui/borrowck/issue-91206.stderr index 12d8d27c5..6653d4978 100644 --- a/tests/ui/borrowck/issue-91206.stderr +++ b/tests/ui/borrowck/issue-91206.stderr @@ -1,11 +1,13 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference --> $DIR/issue-91206.rs:13:5 | -LL | let inner = client.get_inner_ref(); - | ----- consider changing this binding's type to be: `&mut Vec` -LL | LL | inner.clear(); | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider specifying this binding's type + | +LL | let inner: &mut Vec = client.get_inner_ref(); + | +++++++++++++++++ error: aborting due to previous error diff --git a/tests/ui/borrowck/issue-92015.stderr b/tests/ui/borrowck/issue-92015.stderr index 62b1183e7..ea4f9abb8 100644 --- a/tests/ui/borrowck/issue-92015.stderr +++ b/tests/ui/borrowck/issue-92015.stderr @@ -1,10 +1,13 @@ error[E0594]: cannot assign to `*foo`, which is behind a `&` reference --> $DIR/issue-92015.rs:6:5 | -LL | let foo = Some(&0).unwrap(); - | --- consider changing this binding's type to be: `&mut i32` LL | *foo = 1; | ^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written + | +help: consider specifying this binding's type + | +LL | let foo: &mut i32 = Some(&0).unwrap(); + | ++++++++++ error: aborting due to previous error diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.fixed b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.fixed new file mode 100644 index 000000000..1a0847006 --- /dev/null +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.fixed @@ -0,0 +1,26 @@ +// run-rustfix +#![allow(dead_code, path_statements)] +fn foo1(s: &str) -> impl Iterator + '_ { + None.into_iter() + .flat_map(move |()| s.chars().map(move |c| format!("{}{}", c, s))) + //~^ ERROR captured variable cannot escape `FnMut` closure body + //~| HELP consider adding 'move' keyword before the nested closure +} + +fn foo2(s: &str) -> impl Sized + '_ { + move |()| s.chars().map(move |c| format!("{}{}", c, s)) + //~^ ERROR lifetime may not live long enough + //~| HELP consider adding 'move' keyword before the nested closure +} + +pub struct X; +pub fn foo3<'a>( + bar: &'a X, +) -> impl Iterator + 'a { + Some(()).iter().flat_map(move |()| { + Some(()).iter().map(move |()| { bar; }) //~ ERROR captured variable cannot escape + //~^ HELP consider adding 'move' keyword before the nested closure + }) +} + +fn main() {} diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs index 95847d8d3..b93292e35 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs @@ -1,3 +1,5 @@ +// run-rustfix +#![allow(dead_code, path_statements)] fn foo1(s: &str) -> impl Iterator + '_ { None.into_iter() .flat_map(move |()| s.chars().map(|c| format!("{}{}", c, s))) @@ -11,4 +13,14 @@ fn foo2(s: &str) -> impl Sized + '_ { //~| HELP consider adding 'move' keyword before the nested closure } +pub struct X; +pub fn foo3<'a>( + bar: &'a X, +) -> impl Iterator + 'a { + Some(()).iter().flat_map(move |()| { + Some(()).iter().map(|()| { bar; }) //~ ERROR captured variable cannot escape + //~^ HELP consider adding 'move' keyword before the nested closure + }) +} + fn main() {} diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr index 2eae614a2..776c338de 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -1,5 +1,5 @@ error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-95079-missing-move-in-nested-closure.rs:3:29 + --> $DIR/issue-95079-missing-move-in-nested-closure.rs:5:29 | LL | fn foo1(s: &str) -> impl Iterator + '_ { | - variable defined here @@ -7,7 +7,7 @@ LL | None.into_iter() LL | .flat_map(move |()| s.chars().map(|c| format!("{}{}", c, s))) | - -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | returns a reference to a captured variable which escapes the closure body + | | returns a closure that contains a reference to a captured variable, which then escapes the closure body | | variable captured here | inferred to be a `FnMut` closure | @@ -19,12 +19,12 @@ LL | .flat_map(move |()| s.chars().map(move |c| format!("{}{}", c, s))) | ++++ error: lifetime may not live long enough - --> $DIR/issue-95079-missing-move-in-nested-closure.rs:9:15 + --> $DIR/issue-95079-missing-move-in-nested-closure.rs:11:15 | LL | move |()| s.chars().map(|c| format!("{}{}", c, s)) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `Map, [closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:9:29: 9:32]>` contains a lifetime `'2` + | | return type of closure `Map, [closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32]>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure @@ -33,5 +33,26 @@ help: consider adding 'move' keyword before the nested closure LL | move |()| s.chars().map(move |c| format!("{}{}", c, s)) | ++++ -error: aborting due to 2 previous errors +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-95079-missing-move-in-nested-closure.rs:21:9 + | +LL | bar: &'a X, + | --- variable defined here +LL | ) -> impl Iterator + 'a { +LL | Some(()).iter().flat_map(move |()| { + | - inferred to be a `FnMut` closure +LL | Some(()).iter().map(|()| { bar; }) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^^ + | | | + | | variable captured here + | returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape +help: consider adding 'move' keyword before the nested closure + | +LL | Some(()).iter().map(move |()| { bar; }) + | ++++ + +error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr index a57ceb847..1356c8049 100644 --- a/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr +++ b/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed --> $DIR/two-phase-allow-access-during-reservation.rs:26:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) - | ------ borrow of `i` occurs here + | ------ `i` is borrowed here LL | LL | /*2*/ let j = i; // OK: `i` is only reserved here | ^ use of borrowed `i` @@ -14,7 +14,7 @@ error[E0503]: cannot use `i` because it was mutably borrowed --> $DIR/two-phase-allow-access-during-reservation.rs:31:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) - | ------ borrow of `i` occurs here + | ------ `i` is borrowed here ... LL | /*4*/ let k = i; | ^ use of borrowed `i` diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr index 5a240d900..e75094d4f 100644 --- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr +++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `self.cx` because it was mutably borrowed --> $DIR/two-phase-surprise-no-conflict.rs:21:23 | LL | let _mut_borrow = &mut *self; - | ---------- borrow of `*self` occurs here + | ---------- `*self` is borrowed here LL | let _access = self.cx; | ^^^^^^^ use of borrowed `*self` LL | diff --git a/tests/ui/bounds-lifetime.stderr b/tests/ui/bounds-lifetime.stderr index a0395ed49..f0bfe784c 100644 --- a/tests/ui/bounds-lifetime.stderr +++ b/tests/ui/bounds-lifetime.stderr @@ -16,17 +16,24 @@ error: lifetime bounds cannot be used in this context LL | type C = for<'b, 'a: 'b +> fn(); | ^^ -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:4:18 | LL | type D = for<'a, T> fn(); | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:5:18 | LL | type E = dyn for Fn(); | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/box/issue-82446.stderr b/tests/ui/box/issue-82446.stderr index 037473795..c03f35884 100644 --- a/tests/ui/box/issue-82446.stderr +++ b/tests/ui/box/issue-82446.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-82446.rs:11:9 | LL | val - | ^^^ expected struct `Box`, found reference + | ^^^ expected `Box`, found `&Box` | = note: expected struct `Box<(dyn MyTrait + 'static)>` found reference `&Box<(dyn MyTrait + 'static)>` diff --git a/tests/ui/box/leak-alloc.stderr b/tests/ui/box/leak-alloc.stderr index e8a6ad099..5140b5893 100644 --- a/tests/ui/box/leak-alloc.stderr +++ b/tests/ui/box/leak-alloc.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `alloc` because it is borrowed --> $DIR/leak-alloc.rs:26:10 | +LL | let alloc = Alloc {}; + | ----- binding `alloc` declared here LL | let boxed = Box::new_in(10, alloc.by_ref()); | -------------- borrow of `alloc` occurs here LL | let theref = Box::leak(boxed); diff --git a/tests/ui/btreemap/btreemap_dropck.stderr b/tests/ui/btreemap/btreemap_dropck.stderr index e953e7ae8..d405e465a 100644 --- a/tests/ui/btreemap/btreemap_dropck.stderr +++ b/tests/ui/btreemap/btreemap_dropck.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `s` because it is borrowed --> $DIR/btreemap_dropck.rs:15:10 | +LL | let s = String::from("Hello World!"); + | - binding `s` declared here LL | let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]); | -- borrow of `s` occurs here LL | drop(s); diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr index 4beea83d8..c78993381 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.stderr +++ b/tests/ui/c-variadic/variadic-ffi-1.stderr @@ -46,6 +46,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | = note: expected fn pointer `unsafe extern "C" fn(_, _)` found fn item `unsafe extern "C" fn(_, _, ...) {foo}` + = note: when the arguments and return types match, functions can be coerced to function pointers error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:26:54 @@ -57,6 +58,7 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | = note: expected fn pointer `extern "C" fn(_, _, ...)` found fn item `extern "C" fn(_, _) {bar}` + = note: when the arguments and return types match, functions can be coerced to function pointers error[E0617]: can't pass `f32` to variadic function --> $DIR/variadic-ffi-1.rs:28:19 diff --git a/tests/ui/c-variadic/variadic-ffi-4.stderr b/tests/ui/c-variadic/variadic-ffi-4.stderr index 6f8e53298..c9d90d73d 100644 --- a/tests/ui/c-variadic/variadic-ffi-4.stderr +++ b/tests/ui/c-variadic/variadic-ffi-4.stderr @@ -107,7 +107,9 @@ error[E0597]: `ap1` does not live long enough --> $DIR/variadic-ffi-4.rs:28:11 | LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | - let's call the lifetime of this reference `'3` + | - ------- binding `ap1` declared here + | | + | let's call the lifetime of this reference `'3` LL | ap0 = &mut ap1; | ------^^^^^^^^ | | | diff --git a/tests/ui/check-cfg/invalid-cfg-value.stderr b/tests/ui/check-cfg/invalid-cfg-value.stderr index 60abcb188..83383ea61 100644 --- a/tests/ui/check-cfg/invalid-cfg-value.stderr +++ b/tests/ui/check-cfg/invalid-cfg-value.stderr @@ -2,7 +2,9 @@ warning: unexpected `cfg` condition value --> $DIR/invalid-cfg-value.rs:7:7 | LL | #[cfg(feature = "sedre")] - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^------- + | | + | help: did you mean: `"serde"` | = note: expected values for `feature` are: full, serde = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 8dccf929b..c50892950 100644 --- a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -12,7 +12,7 @@ note: required by a bound in `with_closure` --> $DIR/expect-infer-var-appearing-twice.rs:2:14 | LL | fn with_closure(_: F) - | ------------ required by a bound in this + | ------------ required by a bound in this function LL | where F: FnOnce(A, A) | ^^^^^^^^^^^^ required by this bound in `with_closure` diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr index 4f41060dc..9e5200ef3 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed --> $DIR/arrays.rs:14:5 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[0] += 10; | --- borrow occurs due to use of `arr` in closure ... @@ -16,7 +16,7 @@ error[E0503]: cannot use `arr[_]` because it was mutably borrowed --> $DIR/arrays.rs:14:5 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[0] += 10; | --- borrow occurs due to use of `arr` in closure ... @@ -30,12 +30,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed --> $DIR/arrays.rs:29:5 | LL | let c = || { - | -- borrow of `arr[_]` occurs here + | -- `arr[_]` is borrowed here LL | println!("{:#?}", &arr[3..4]); | --- borrow occurs due to use in closure ... LL | arr[1] += 10; - | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here + | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -44,12 +44,12 @@ error[E0506]: cannot assign to `arr[_]` because it is borrowed --> $DIR/arrays.rs:43:5 | LL | let c = || { - | -- borrow of `arr[_]` occurs here + | -- `arr[_]` is borrowed here LL | println!("{}", arr[3]); | --- borrow occurs due to use in closure ... LL | arr[1] += 10; - | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here + | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -58,7 +58,7 @@ error[E0503]: cannot use `arr` because it was mutably borrowed --> $DIR/arrays.rs:57:20 | LL | let mut c = || { - | -- borrow of `arr` occurs here + | -- `arr` is borrowed here LL | arr[1] += 10; | --- borrow occurs due to use of `arr` in closure ... diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr index f8b178752..2e3259e64 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr @@ -2,12 +2,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed --> $DIR/box.rs:21:5 | LL | let mut c = || { - | -- borrow of `e.0.0.m.x` occurs here + | -- `e.0.0.m.x` is borrowed here LL | e.0.0.m.x = format!("not-x"); | --------- borrow occurs due to use in closure ... LL | e.0.0.m.x = format!("not-x"); - | ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here + | ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here @@ -32,12 +32,12 @@ error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed --> $DIR/box.rs:55:5 | LL | let c = || { - | -- borrow of `e.0.0.m.x` occurs here + | -- `e.0.0.m.x` is borrowed here LL | println!("{}", e.0.0.m.x); | --------- borrow occurs due to use in closure ... LL | e.0.0.m.x = format!("not-x"); - | ^^^^^^^^^ assignment to borrowed `e.0.0.m.x` occurs here + | ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed LL | LL | c(); | - borrow later used here diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs index 1488f3296..c7ee90ea7 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.rs @@ -20,7 +20,6 @@ fn test_missing_unsafe_warning_on_repr_packed() { let c = || { println!("{}", foo.x); //~^ ERROR: reference to packed field is unaligned - //~| WARNING: this was previously accepted by the compiler but is being phased out let _z = foo.x; }; diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr index 508c4b911..9c2c43457 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr @@ -1,29 +1,13 @@ -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/repr_packed.rs:21:24 | LL | println!("{}", foo.x); | ^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default = 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) error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/repr_packed.rs:21:24 - | -LL | println!("{}", foo.x); - | ^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - = 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) - +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs index 46b54846e..695337ea8 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs @@ -11,7 +11,7 @@ union A { fn main() { let mut a = A { y: 1 }; let mut c = || { - //~^ borrow of `a.y` occurs here + //~^ `a.y` is borrowed here let _ = unsafe { &a.y }; let _ = &mut a; //~^ borrow occurs due to use in closure @@ -19,7 +19,7 @@ fn main() { }; a.y = 1; //~^ cannot assign to `a.y` because it is borrowed [E0506] - //~| assignment to borrowed `a.y` occurs here + //~| `a.y` is assigned to here c(); //~^ borrow later used here } diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr index 7c34e2336..17834e612 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/union.stderr @@ -2,13 +2,13 @@ error[E0506]: cannot assign to `a.y` because it is borrowed --> $DIR/union.rs:20:5 | LL | let mut c = || { - | -- borrow of `a.y` occurs here + | -- `a.y` is borrowed here ... LL | let _ = &mut a; | - borrow occurs due to use in closure ... LL | a.y = 1; - | ^^^^^^^ assignment to borrowed `a.y` occurs here + | ^^^^^^^ `a.y` is assigned to here but it was already borrowed ... LL | c(); | - borrow later used here diff --git a/tests/ui/closures/2229_closure_analysis/issue_88118.rs b/tests/ui/closures/2229_closure_analysis/issue_88118.rs index 453b7e04a..bfb487649 100644 --- a/tests/ui/closures/2229_closure_analysis/issue_88118.rs +++ b/tests/ui/closures/2229_closure_analysis/issue_88118.rs @@ -1,10 +1,7 @@ // Regression test for #88118. Used to ICE. -// +// edition:2021 // check-pass -#![allow(incomplete_features)] -#![feature(capture_disjoint_fields)] - fn foo(handler: impl FnOnce() -> MsU + Clone + 'static) { Box::new(move |value| { (|_| handler.clone()())(value); diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed index 26703fbf8..b74b5e94e 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed +++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed @@ -26,7 +26,7 @@ fn test_send_trait() { //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0` - } }); + } }).join().unwrap(); } /* Test Sync Trait Migration */ @@ -47,7 +47,7 @@ fn test_sync_trait() { //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0` - } }); + } }).join().unwrap(); } /* Test Clone Trait Migration */ diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs index 932db51d4..e4965e33c 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs +++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.rs @@ -26,7 +26,7 @@ fn test_send_trait() { //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0` - }); + }).join().unwrap(); } /* Test Sync Trait Migration */ @@ -47,7 +47,7 @@ fn test_sync_trait() { //~| HELP: add a dummy let to cause `fptr` to be fully captured *fptr.0.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0` - }); + }).join().unwrap(); } /* Test Clone Trait Migration */ diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr index 3a42cc8b8..856ec4a5b 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr @@ -19,7 +19,7 @@ LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL | ... LL | -LL ~ } }); +LL ~ } }).join().unwrap(); | error: changes to closure capture in Rust 2021 will affect which traits the closure implements @@ -41,7 +41,7 @@ LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL | ... LL | -LL ~ } }); +LL ~ } }).join().unwrap(); | error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed index 173dd2e2c..bde8c7497 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed +++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.fixed @@ -145,7 +145,7 @@ fn test_multi_traits_issues() { //~^ NOTE: in Rust 2018, this closure captures all of `fptr1`, but in Rust 2021, it will only capture `fptr1.0.0` *fptr2.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr2`, but in Rust 2021, it will only capture `fptr2.0` - } }); + } }).join().unwrap(); } fn main() { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs index cfc4555ca..584c52ea1 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs +++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.rs @@ -141,7 +141,7 @@ fn test_multi_traits_issues() { //~^ NOTE: in Rust 2018, this closure captures all of `fptr1`, but in Rust 2021, it will only capture `fptr1.0.0` *fptr2.0 = 20; //~^ NOTE: in Rust 2018, this closure captures all of `fptr2`, but in Rust 2021, it will only capture `fptr2.0` - }); + }).join().unwrap(); } fn main() { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr index efb264447..344bc662e 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr @@ -111,7 +111,7 @@ LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe { LL | ... LL | -LL ~ } }); +LL ~ } }).join().unwrap(); | error: aborting due to 5 previous errors diff --git a/tests/ui/closures/binder/const-bound.rs b/tests/ui/closures/binder/const-bound.rs new file mode 100644 index 000000000..b1c79db13 --- /dev/null +++ b/tests/ui/closures/binder/const-bound.rs @@ -0,0 +1,7 @@ +#![feature(closure_lifetime_binder, non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe to use + +fn main() { + for || -> () {}; + //~^ ERROR late-bound const parameter not allowed on closures +} diff --git a/tests/ui/closures/binder/const-bound.stderr b/tests/ui/closures/binder/const-bound.stderr new file mode 100644 index 000000000..c016465c1 --- /dev/null +++ b/tests/ui/closures/binder/const-bound.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/const-bound.rs:1:37 + | +LL | #![feature(closure_lifetime_binder, non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: late-bound const parameter not allowed on closures + --> $DIR/const-bound.rs:5:9 + | +LL | for || -> () {}; + | ^^^^^^^^^^^^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/closures/binder/disallow-const.stderr b/tests/ui/closures/binder/disallow-const.stderr index 3c3b43d8c..59f299315 100644 --- a/tests/ui/closures/binder/disallow-const.stderr +++ b/tests/ui/closures/binder/disallow-const.stderr @@ -1,8 +1,12 @@ -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/disallow-const.rs:4:15 | LL | for || -> () {}; | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` 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/closures/binder/disallow-ty.stderr b/tests/ui/closures/binder/disallow-ty.stderr index 51b6773ed..3370e21bd 100644 --- a/tests/ui/closures/binder/disallow-ty.stderr +++ b/tests/ui/closures/binder/disallow-ty.stderr @@ -1,8 +1,12 @@ -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/disallow-ty.rs:4:9 | LL | for || -> () {}; | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` 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/closures/binder/type-bound-2.rs b/tests/ui/closures/binder/type-bound-2.rs new file mode 100644 index 000000000..f4edcdaa9 --- /dev/null +++ b/tests/ui/closures/binder/type-bound-2.rs @@ -0,0 +1,7 @@ +#![feature(closure_lifetime_binder, non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe to use + +fn main() { + for || -> () {}; + //~^ ERROR late-bound type parameter not allowed on closures +} diff --git a/tests/ui/closures/binder/type-bound-2.stderr b/tests/ui/closures/binder/type-bound-2.stderr new file mode 100644 index 000000000..14b2dbf03 --- /dev/null +++ b/tests/ui/closures/binder/type-bound-2.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/type-bound-2.rs:1:37 + | +LL | #![feature(closure_lifetime_binder, non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: late-bound type parameter not allowed on closures + --> $DIR/type-bound-2.rs:5:9 + | +LL | for || -> () {}; + | ^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/closures/binder/type-bound.rs b/tests/ui/closures/binder/type-bound.rs new file mode 100644 index 000000000..59a3353f4 --- /dev/null +++ b/tests/ui/closures/binder/type-bound.rs @@ -0,0 +1,7 @@ +#![feature(closure_lifetime_binder, non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe to use + +fn main() { + for || -> T {}; + //~^ ERROR late-bound type parameter not allowed on closures +} diff --git a/tests/ui/closures/binder/type-bound.stderr b/tests/ui/closures/binder/type-bound.stderr new file mode 100644 index 000000000..ef00a2dff --- /dev/null +++ b/tests/ui/closures/binder/type-bound.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/type-bound.rs:1:37 + | +LL | #![feature(closure_lifetime_binder, non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: late-bound type parameter not allowed on closures + --> $DIR/type-bound.rs:5:9 + | +LL | for || -> T {}; + | ^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 1e860d32b..5d65c87b0 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -26,7 +26,7 @@ error[E0308]: mismatched types --> $DIR/issue-78720.rs:7:39 | LL | fn map2(self, f: F) -> Map2 {} - | ^^ expected struct `Map2`, found `()` + | ^^ expected `Map2`, found `()` | = note: expected struct `Map2` found unit type `()` diff --git a/tests/ui/coercion/coerce-block-tail-26978.stderr b/tests/ui/coercion/coerce-block-tail-26978.stderr index 384debd48..90eb75f2b 100644 --- a/tests/ui/coercion/coerce-block-tail-26978.stderr +++ b/tests/ui/coercion/coerce-block-tail-26978.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-block-tail-26978.rs:9:9 | LL | f(&{x}); - | ^ expected `i32`, found struct `Box` + | ^ expected `i32`, found `Box` | = note: expected type `i32` found struct `Box` diff --git a/tests/ui/coercion/coerce-block-tail-57749.stderr b/tests/ui/coercion/coerce-block-tail-57749.stderr index d5660c81d..7e14f42ea 100644 --- a/tests/ui/coercion/coerce-block-tail-57749.stderr +++ b/tests/ui/coercion/coerce-block-tail-57749.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-block-tail-57749.rs:33:14 | LL | reset(&{ Homura }); - | ^^^^^^ expected `u32`, found struct `Homura` + | ^^^^^^ expected `u32`, found `Homura` | help: consider dereferencing the type | diff --git a/tests/ui/coercion/coerce-block-tail-83783.stderr b/tests/ui/coercion/coerce-block-tail-83783.stderr index 5f53606ce..d556d013b 100644 --- a/tests/ui/coercion/coerce-block-tail-83783.stderr +++ b/tests/ui/coercion/coerce-block-tail-83783.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-block-tail-83783.rs:7:32 | LL | _consume_reference::(&async { Box::new(7_i32) }.await); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Box` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `Box` | = note: expected type `i32` found struct `Box` diff --git a/tests/ui/coercion/coerce-block-tail-83850.stderr b/tests/ui/coercion/coerce-block-tail-83850.stderr index bbf607543..3cfebb8a5 100644 --- a/tests/ui/coercion/coerce-block-tail-83850.stderr +++ b/tests/ui/coercion/coerce-block-tail-83850.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-block-tail-83850.rs:5:7 | LL | f(&Box::new([1, 2])); - | - ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found struct `Box` + | - ^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&Box<[{integer}; 2]>` | | | arguments to this function are incorrect | diff --git a/tests/ui/coercion/coerce-block-tail.stderr b/tests/ui/coercion/coerce-block-tail.stderr index 318cf7586..7044fc3ce 100644 --- a/tests/ui/coercion/coerce-block-tail.stderr +++ b/tests/ui/coercion/coerce-block-tail.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-block-tail.rs:4:23 | LL | let _: &i32 = & { Box::new(1i32) }; - | ^^^^^^^^^^^^^^ expected `i32`, found struct `Box` + | ^^^^^^^^^^^^^^ expected `i32`, found `Box` | = note: expected type `i32` found struct `Box` diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index 44968244c..f94422a92 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:9:27 | LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:10:27 | LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:11:27 | LL | let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:27 | LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box _>); - | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure + | ^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:13:33]>` | = note: expected struct `Box u8>` found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>` @@ -38,7 +38,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | LL | let _ = type_ascribe!(box if true { false } else { true }, Box); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` | = note: expected struct `Box` found struct `Box` @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:27 | LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `Box` | = note: expected struct `Box` found struct `Box` @@ -56,7 +56,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:17:27 | LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); - | ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` @@ -65,7 +65,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:18:27 | LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` @@ -74,7 +74,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:19:27 | LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` @@ -83,7 +83,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:27 | LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); - | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure + | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:21:30]` | = note: expected reference `&dyn Fn(i32) -> u8` found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]` @@ -92,7 +92,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&bool` | = note: expected reference `&dyn Debug` found reference `&bool` @@ -101,7 +101,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:27 | LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&char` | = note: expected reference `&dyn Debug` found reference `&char` @@ -110,7 +110,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:25:27 | LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); - | ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` + | ^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:27 | LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:26:36]>` | = note: expected struct `Box u8>` found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>` diff --git a/tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr b/tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr index d067c3b3a..d412b8b08 100644 --- a/tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr +++ b/tests/ui/coercion/coerce-overloaded-autoderef-fail.stderr @@ -13,10 +13,10 @@ error[E0506]: cannot assign to `**x` because it is borrowed --> $DIR/coerce-overloaded-autoderef-fail.rs:17:5 | LL | let y = borrow(x); - | - borrow of `**x` occurs here + | - `**x` is borrowed here LL | let z = borrow(x); LL | **x += 1; - | ^^^^^^^^ assignment to borrowed `**x` occurs here + | ^^^^^^^^ `**x` is assigned to here but it was already borrowed LL | LL | drop((y, z)); | - borrow later used here diff --git a/tests/ui/coercion/coerce-to-bang.stderr b/tests/ui/coercion/coerce-to-bang.stderr index 1207dc7e7..3c737358a 100644 --- a/tests/ui/coercion/coerce-to-bang.stderr +++ b/tests/ui/coercion/coerce-to-bang.stderr @@ -82,7 +82,7 @@ error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 | LL | let x: [!; 2] = [return, 22]; - | ------ ^^^^^^^^^^^^ expected `!`, found integer + | ------ ^^^^^^^^^^^^ expected `[!; 2]`, found `[{integer}; 2]` | | | expected due to this | diff --git a/tests/ui/coercion/coercion-missing-tail-expected-type.stderr b/tests/ui/coercion/coercion-missing-tail-expected-type.stderr index 4c04bb113..288e945f1 100644 --- a/tests/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/tests/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -12,7 +12,7 @@ error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:8:13 | LL | fn foo() -> Result { - | --- ^^^^^^^^^^^^^^^ expected enum `Result`, found `()` + | --- ^^^^^^^^^^^^^^^ expected `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | Ok(1); diff --git a/tests/ui/coercion/coercion-slice.rs b/tests/ui/coercion/coercion-slice.rs index b756c8f82..b99235dd3 100644 --- a/tests/ui/coercion/coercion-slice.rs +++ b/tests/ui/coercion/coercion-slice.rs @@ -3,5 +3,5 @@ fn main() { let _: &[i32] = [0]; //~^ ERROR mismatched types - //~| expected `&[i32]`, found array `[{integer}; 1]` + //~| expected `&[i32]`, found `[{integer}; 1]` } diff --git a/tests/ui/coercion/coercion-slice.stderr b/tests/ui/coercion/coercion-slice.stderr index 42dc954ff..c7b856a57 100644 --- a/tests/ui/coercion/coercion-slice.stderr +++ b/tests/ui/coercion/coercion-slice.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let _: &[i32] = [0]; | ------ ^^^ | | | - | | expected `&[i32]`, found array `[{integer}; 1]` + | | expected `&[i32]`, found `[{integer}; 1]` | | help: consider borrowing here: `&[0]` | expected due to this diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs index 50d9a480a..98f1558b7 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs @@ -12,19 +12,26 @@ auto trait Marker2 {} trait Object: Marker1 {} // A supertrait marker is illegal... -impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +impl !Marker1 for dyn Object + Marker2 {} //~ ERROR E0371 + //~^ ERROR 0321 // ...and also a direct component. -impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 - -// But implementing a marker if it is not present is OK. -impl !Marker2 for dyn Object {} // OK +impl !Marker2 for dyn Object + Marker2 {} //~ ERROR E0371 + //~^ ERROR 0321 // A non-principal trait-object type is orphan even in its crate. impl !Send for dyn Marker2 {} //~ ERROR E0117 -// And impl'ing a remote marker for a local trait object is forbidden -// by one of these special orphan-like rules. +// Implementing a marker for a local trait object is forbidden by a special +// orphan-like rule. +impl !Marker2 for dyn Object {} //~ ERROR E0321 impl !Send for dyn Object {} //~ ERROR E0321 impl !Send for dyn Object + Marker2 {} //~ ERROR E0321 -fn main() { } +// Blanket impl that applies to dyn Object is equally problematic. +auto trait Marker3 {} +impl !Marker3 for T {} //~ ERROR E0321 + +auto trait Marker4 {} +impl !Marker4 for T {} // okay + +fn main() {} diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index c364c707f..ea38afc40 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -1,17 +1,41 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 | -LL | impl !Marker1 for dyn Object + Marker2 { } +LL | impl !Marker1 for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` +error[E0321]: traits with a default impl, like `Marker1`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:15:1 + | +LL | impl !Marker1 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker1` if and only if `Marker1` is one of the trait object's trait bounds + error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:17:1 + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:18:1 | -LL | impl !Marker2 for dyn Object + Marker2 { } +LL | impl !Marker2 for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` +error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:18:1 + | +LL | impl !Marker2 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds + +error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:26:1 + | +LL | impl !Marker2 for dyn Object {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds + error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:23:1 + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1 | LL | impl !Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^----------- @@ -33,7 +57,15 @@ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be i LL | impl !Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type -error: aborting due to 5 previous errors +error[E0321]: traits with a default impl, like `Marker3`, cannot be implemented for generic type `T` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:32:1 + | +LL | impl !Marker3 for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker3` if and only if `Marker3` is one of the trait object's trait bounds + +error: aborting due to 9 previous errors Some errors have detailed explanations: E0117, E0321, E0371. For more information about an error, try `rustc --explain E0117`. diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs index faac6d983..db2e2b450 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs @@ -12,19 +12,26 @@ auto trait Marker2 {} trait Object: Marker1 {} // A supertrait marker is illegal... -impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +impl Marker1 for dyn Object + Marker2 {} //~ ERROR E0371 + //~^ ERROR E0321 // ...and also a direct component. -impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 - -// But implementing a marker if it is not present is OK. -impl Marker2 for dyn Object {} // OK +impl Marker2 for dyn Object + Marker2 {} //~ ERROR E0371 + //~^ ERROR E0321 // A non-principal trait-object type is orphan even in its crate. unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 -// And impl'ing a remote marker for a local trait object is forbidden -// by one of these special orphan-like rules. +// Implementing a marker for a local trait object is forbidden by a special +// orphan-like rule. +impl Marker2 for dyn Object {} //~ ERROR E0321 unsafe impl Send for dyn Object {} //~ ERROR E0321 unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 -fn main() { } +// Blanket impl that applies to dyn Object is equally problematic. +auto trait Marker3 {} +impl Marker3 for T {} //~ ERROR E0321 + +auto trait Marker4 {} +impl Marker4 for T {} // okay + +fn main() {} diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index b80429794..2a8713bc3 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -1,17 +1,41 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1 | -LL | impl Marker1 for dyn Object + Marker2 { } +LL | impl Marker1 for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` +error[E0321]: traits with a default impl, like `Marker1`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:15:1 + | +LL | impl Marker1 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker1` if and only if `Marker1` is one of the trait object's trait bounds + error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:17:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:18:1 | -LL | impl Marker2 for dyn Object + Marker2 { } +LL | impl Marker2 for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` +error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:18:1 + | +LL | impl Marker2 for dyn Object + Marker2 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds + +error[E0321]: traits with a default impl, like `Marker2`, cannot be implemented for trait object `(dyn Object + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 + | +LL | impl Marker2 for dyn Object {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds + error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:23:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | LL | unsafe impl Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^----------- @@ -33,7 +57,15 @@ error[E0321]: cross-crate traits with a default impl, like `Send`, can only be i LL | unsafe impl Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type -error: aborting due to 5 previous errors +error[E0321]: traits with a default impl, like `Marker3`, cannot be implemented for generic type `T` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:32:1 + | +LL | impl Marker3 for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: a trait object implements `Marker3` if and only if `Marker3` is one of the trait object's trait bounds + +error: aborting due to 9 previous errors Some errors have detailed explanations: E0117, E0321, E0371. For more information about an error, try `rustc --explain E0117`. diff --git a/tests/ui/coherence/issue-85026.stderr b/tests/ui/coherence/issue-85026.stderr index a5da19bbf..fb6e99765 100644 --- a/tests/ui/coherence/issue-85026.stderr +++ b/tests/ui/coherence/issue-85026.stderr @@ -1,16 +1,16 @@ error[E0785]: cannot define inherent `impl` for a dyn auto trait - --> $DIR/issue-85026.rs:5:6 + --> $DIR/issue-85026.rs:5:1 | LL | impl dyn AutoTrait {} - | ^^^^^^^^^^^^^ impl requires at least one non-auto trait + | ^^^^^^^^^^^^^^^^^^ impl requires at least one non-auto trait | = note: define and implement a new trait or type instead error[E0785]: cannot define inherent `impl` for a dyn auto trait - --> $DIR/issue-85026.rs:8:6 + --> $DIR/issue-85026.rs:8:1 | LL | impl dyn Unpin {} - | ^^^^^^^^^ impl requires at least one non-auto trait + | ^^^^^^^^^^^^^^ impl requires at least one non-auto trait | = note: define and implement a new trait or type instead diff --git a/tests/ui/coinduction/canonicalization-rerun.rs b/tests/ui/coinduction/canonicalization-rerun.rs new file mode 100644 index 000000000..b10ba3a81 --- /dev/null +++ b/tests/ui/coinduction/canonicalization-rerun.rs @@ -0,0 +1,54 @@ +// check-pass +// revisions: old new +//[new] compile-flags: -Ztrait-solver=next + +// If we use canonical goals during trait solving we have to reevaluate +// the root goal of a cycle until we hit a fixpoint. +// +// Here `main` has a goal `(?0, ?1): Trait` which is canonicalized to +// `exists<^0, ^1> (^0, ^1): Trait`. +// +// - `exists<^0, ^1> (^0, ^1): Trait` -instantiate-> `(?0, ?1): Trait` +// -`(?1, ?0): Trait` -canonicalize-> `exists<^0, ^1> (^0, ^1): Trait` +// - COINDUCTIVE CYCLE OK (no constraints) +// - `(): ConstrainToU32` -canonicalize-> `exists<^0> (): ConstrainToU32<^0>` +// - OK (^0 = u32 -apply-> ?0 = u32) +// - OK (?0 = u32 -canonicalize-> ^0 = u32) +// - coinductive cycle with provisional result != final result, rerun +// +// - `exists<^0, ^1> (^0, ^1): Trait` -instantiate-> `(?0, ?1): Trait` +// -`(?1, ?0): Trait` -canonicalize-> `exists<^0, ^1> (^0, ^1): Trait` +// - COINDUCTIVE CYCLE OK (^0 = u32 -apply-> ?1 = u32) +// - `(): ConstrainToU32` -canonicalize-> `exists<^0> (): ConstrainToU32<^0>` +// - OK (^0 = u32 -apply-> ?1 = u32) +// - OK (?0 = u32, ?1 = u32 -canonicalize-> ^0 = u32, ^1 = u32) +// - coinductive cycle with provisional result != final result, rerun +// +// - `exists<^0, ^1> (^0, ^1): Trait` -instantiate-> `(?0, ?1): Trait` +// -`(?1, ?0): Trait` -canonicalize-> `exists<^0, ^1> (^0, ^1): Trait` +// - COINDUCTIVE CYCLE OK (^0 = u32, ^1 = u32 -apply-> ?1 = u32, ?0 = u32) +// - `(): ConstrainToU32` -canonicalize-> `exists<^0> (): ConstrainToU32<^0>` +// - OK (^0 = u32 -apply-> ?1 = u32) +// - OK (?0 = u32, ?1 = u32 -canonicalize-> ^0 = u32, ^1 = u32) +// - coinductive cycle with provisional result == final result, DONE +#![feature(rustc_attrs)] +#[rustc_coinductive] +trait Trait {} + +impl Trait for (T, U) +where + (U, T): Trait, + (): ConstrainToU32, +{} + +trait ConstrainToU32 {} +impl ConstrainToU32 for () {} + +fn impls_trait() +where + (T, U): Trait, +{} + +fn main() { + impls_trait::<_, _>(); +} diff --git a/tests/ui/command/command-setgroups.rs b/tests/ui/command/command-setgroups.rs index aff67f91b..7e321f2f0 100644 --- a/tests/ui/command/command-setgroups.rs +++ b/tests/ui/command/command-setgroups.rs @@ -3,6 +3,7 @@ // ignore-emscripten // ignore-sgx // ignore-musl - returns dummy result for _SC_NGROUPS_MAX +// ignore-nto - does not have `/bin/id`, expects groups to be i32 (not u32) #![feature(rustc_private)] #![feature(setgroups)] diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index cad942e64..f632a53f2 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -4,7 +4,7 @@ error[E0053]: method `poll` has an incompatible type for trait LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { | ^^^^ | | - | expected struct `Pin`, found struct `MyFuture` + | expected `Pin<&mut MyFuture>`, found `MyFuture` | help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>` | = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>` @@ -16,7 +16,7 @@ error[E0053]: method `foo` has an incompatible type for trait LL | fn foo(self: Box) {} | ------^^^^^^^^^ | | | - | | expected struct `MyFuture`, found struct `Box` + | | expected `MyFuture`, found `Box` | help: change the self-receiver type to match the trait: `self` | note: type in trait @@ -31,7 +31,7 @@ error[E0053]: method `bar` has an incompatible type for trait --> $DIR/bad-self-type.rs:24:18 | LL | fn bar(self) {} - | ^ expected enum `Option`, found `()` + | ^ expected `Option<()>`, found `()` | note: type in trait --> $DIR/bad-self-type.rs:18:21 diff --git a/tests/ui/conditional-compilation/cfg-generic-params.stderr b/tests/ui/conditional-compilation/cfg-generic-params.stderr index 4d6560e96..f733c09c2 100644 --- a/tests/ui/conditional-compilation/cfg-generic-params.stderr +++ b/tests/ui/conditional-compilation/cfg-generic-params.stderr @@ -1,21 +1,3 @@ -error: only lifetime parameters can be used in this context - --> $DIR/cfg-generic-params.rs:7:45 - | -LL | type FnBad = for<#[cfg(no)] 'a, #[cfg(yes)] T> fn(); - | ^ - -error: only lifetime parameters can be used in this context - --> $DIR/cfg-generic-params.rs:11:51 - | -LL | type PolyBad = dyn for<#[cfg(no)] 'a, #[cfg(yes)] T> Copy; - | ^ - -error: only lifetime parameters can be used in this context - --> $DIR/cfg-generic-params.rs:15:54 - | -LL | struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy; - | ^ - error: cannot find attribute `unknown` in this scope --> $DIR/cfg-generic-params.rs:19:29 | @@ -46,5 +28,33 @@ error: cannot find attribute `unknown` in this scope LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy; | ^^^^^^^ +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/cfg-generic-params.rs:7:45 + | +LL | type FnBad = for<#[cfg(no)] 'a, #[cfg(yes)] T> fn(); + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/cfg-generic-params.rs:11:51 + | +LL | type PolyBad = dyn for<#[cfg(no)] 'a, #[cfg(yes)] T> Copy; + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/cfg-generic-params.rs:15:54 + | +LL | struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy; + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable + error: aborting due to 8 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr index 3906d64c9..34debb683 100644 --- a/tests/ui/confuse-field-and-method/issue-33784.stderr +++ b/tests/ui/confuse-field-and-method/issue-33784.stderr @@ -1,4 +1,4 @@ -error[E0599]: no method named `closure` found for reference `&Obj<[closure@issue-33784.rs:25:43]>` in the current scope +error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope --> $DIR/issue-33784.rs:27:7 | LL | p.closure(); @@ -9,7 +9,7 @@ help: to call the function stored in `closure`, surround the field access with p LL | (p.closure)(); | + + -error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@issue-33784.rs:25:43]>` in the current scope +error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope --> $DIR/issue-33784.rs:29:7 | LL | q.fn_ptr(); diff --git a/tests/ui/const-generics/bad-const-generic-exprs.rs b/tests/ui/const-generics/bad-const-generic-exprs.rs index ca91643ed..423752ca2 100644 --- a/tests/ui/const-generics/bad-const-generic-exprs.rs +++ b/tests/ui/const-generics/bad-const-generic-exprs.rs @@ -13,10 +13,34 @@ fn main() { let _: Wow; //~^ ERROR expected one of //~| HELP expressions must be enclosed in braces to be used as const generic arguments - - // FIXME(compiler-errors): This one is still unsatisfying, - // and probably a case I could see someone typing by accident.. + let _: Wow<[]>; + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments let _: Wow<[12]>; - //~^ ERROR expected type, found - //~| ERROR type provided when a constant was expected + //~^ ERROR expected type + //~| ERROR invalid const generic expression + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<[0, 1, 3]>; + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<[0xff; 8]>; + //~^ ERROR expected type + //~| ERROR invalid const generic expression + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<[1, 2]>; // Regression test for issue #81698. + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<&0>; + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<("", 0)>; + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + let _: Wow<(1 + 2) * 3>; + //~^ ERROR expected type + //~| HELP expressions must be enclosed in braces to be used as const generic arguments + // FIXME(fmease): This one is pretty bad. + let _: Wow; + //~^ ERROR expected one of + //~| HELP you might have meant to end the type parameters here } diff --git a/tests/ui/const-generics/bad-const-generic-exprs.stderr b/tests/ui/const-generics/bad-const-generic-exprs.stderr index 24668b08b..17a63a96f 100644 --- a/tests/ui/const-generics/bad-const-generic-exprs.stderr +++ b/tests/ui/const-generics/bad-const-generic-exprs.stderr @@ -42,18 +42,118 @@ help: expressions must be enclosed in braces to be used as const generic argumen LL | let _: Wow<{ A.0 }>; | + + +error: expected type, found `]` + --> $DIR/bad-const-generic-exprs.rs:16:17 + | +LL | let _: Wow<[]>; + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ [] }>; + | + + + error: expected type, found `12` --> $DIR/bad-const-generic-exprs.rs:19:17 | LL | let _: Wow<[12]>; | ^^ expected type -error[E0747]: type provided when a constant was expected +error: invalid const generic expression --> $DIR/bad-const-generic-exprs.rs:19:16 | LL | let _: Wow<[12]>; | ^^^^ + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ [12] }>; + | + + + +error: expected type, found `0` + --> $DIR/bad-const-generic-exprs.rs:23:17 + | +LL | let _: Wow<[0, 1, 3]>; + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ [0, 1, 3] }>; + | + + + +error: expected type, found `0xff` + --> $DIR/bad-const-generic-exprs.rs:26:17 + | +LL | let _: Wow<[0xff; 8]>; + | ^^^^ expected type + +error: invalid const generic expression + --> $DIR/bad-const-generic-exprs.rs:26:16 + | +LL | let _: Wow<[0xff; 8]>; + | ^^^^^^^^^ + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ [0xff; 8] }>; + | + + + +error: expected type, found `1` + --> $DIR/bad-const-generic-exprs.rs:30:17 + | +LL | let _: Wow<[1, 2]>; // Regression test for issue #81698. + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ [1, 2] }>; // Regression test for issue #81698. + | + + + +error: expected type, found `0` + --> $DIR/bad-const-generic-exprs.rs:33:17 + | +LL | let _: Wow<&0>; + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ &0 }>; + | + + + +error: expected type, found `""` + --> $DIR/bad-const-generic-exprs.rs:36:17 + | +LL | let _: Wow<("", 0)>; + | ^^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ ("", 0) }>; + | + + + +error: expected type, found `1` + --> $DIR/bad-const-generic-exprs.rs:39:17 + | +LL | let _: Wow<(1 + 2) * 3>; + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | let _: Wow<{ (1 + 2) * 3 }>; + | + + + +error: expected one of `,` or `>`, found `0` + --> $DIR/bad-const-generic-exprs.rs:43:17 + | +LL | let _: Wow; + | - ^ expected one of `,` or `>` + | | + | while parsing the type for `_` + | +help: you might have meant to end the type parameters here + | +LL | let _: Wow0>; + | + -error: aborting due to 6 previous errors +error: aborting due to 15 previous errors -For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr b/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr index f1f3a9c3d..82030731c 100644 --- a/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr +++ b/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr @@ -1,5 +1,5 @@ error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-argument-non-static-lifetime.rs:15:17 + --> $DIR/const-argument-non-static-lifetime.rs:14:17 | LL | let _: &'a (); | ^^ diff --git a/tests/ui/const-generics/const-argument-non-static-lifetime.rs b/tests/ui/const-generics/const-argument-non-static-lifetime.rs index 36a569784..0357e4ed5 100644 --- a/tests/ui/const-generics/const-argument-non-static-lifetime.rs +++ b/tests/ui/const-generics/const-argument-non-static-lifetime.rs @@ -2,7 +2,6 @@ // revisions: full min // regression test for #78180 -// compile-flags: -Zsave-analysis #![cfg_attr(full, feature(generic_const_exprs))] #![cfg_attr(full, allow(incomplete_features))] diff --git a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr index 4bba42c77..656bc2946 100644 --- a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr +++ b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr @@ -28,7 +28,7 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here LL | fn bar() {} | ^ explicit lifetime name needed here -error: `&'static u8` is forbidden as the type of a const generic parameter +error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:9:19 | LL | struct A; @@ -37,7 +37,7 @@ LL | struct A; = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: `&'static u8` is forbidden as the type of a const generic parameter +error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:14:15 | LL | impl A { @@ -46,7 +46,7 @@ LL | impl A { = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: `&'static u8` is forbidden as the type of a const generic parameter +error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:22:15 | LL | impl B for A {} @@ -55,7 +55,7 @@ LL | impl B for A {} = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: `&'static u8` is forbidden as the type of a const generic parameter +error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:26:17 | LL | fn bar() {} @@ -64,7 +64,7 @@ LL | fn bar() {} = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: `&'static u8` is forbidden as the type of a const generic parameter +error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:17:21 | LL | fn foo(&self) {} diff --git a/tests/ui/const-generics/const-param-elided-lifetime.rs b/tests/ui/const-generics/const-param-elided-lifetime.rs index 487b82dbf..45611d6bf 100644 --- a/tests/ui/const-generics/const-param-elided-lifetime.rs +++ b/tests/ui/const-generics/const-param-elided-lifetime.rs @@ -8,23 +8,23 @@ struct A; //~^ ERROR `&` without an explicit lifetime name cannot be used here -//[min]~^^ ERROR `&'static u8` is forbidden +//[min]~^^ ERROR `&u8` is forbidden trait B {} impl A { //~^ ERROR `&` without an explicit lifetime name cannot be used here -//[min]~^^ ERROR `&'static u8` is forbidden +//[min]~^^ ERROR `&u8` is forbidden fn foo(&self) {} //~^ ERROR `&` without an explicit lifetime name cannot be used here - //[min]~^^ ERROR `&'static u8` is forbidden + //[min]~^^ ERROR `&u8` is forbidden } impl B for A {} //~^ ERROR `&` without an explicit lifetime name cannot be used here -//[min]~^^ ERROR `&'static u8` is forbidden +//[min]~^^ ERROR `&u8` is forbidden fn bar() {} //~^ ERROR `&` without an explicit lifetime name cannot be used here -//[min]~^^ ERROR `&'static u8` is forbidden +//[min]~^^ ERROR `&u8` is forbidden fn main() {} diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs index 781f50e61..b776f2017 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs @@ -1,6 +1,3 @@ -// compile-flags: -Zsave-analysis -// Regression test for #69414 ^ - use std::marker::PhantomData; struct B(PhantomData<[T; N]>); diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr index 8e14defd6..9c5c97bef 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr @@ -1,5 +1,5 @@ error[E0770]: the type of const parameters must not depend on other generic parameters - --> $DIR/const-param-type-depends-on-type-param-ungated.rs:6:22 + --> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:22 | LL | struct B(PhantomData<[T; N]>); | ^ the type must not depend on the parameter `T` diff --git a/tests/ui/const-generics/defaults/mismatch.stderr b/tests/ui/const-generics/defaults/mismatch.stderr index 52c54aace..9c4f0bc95 100644 --- a/tests/ui/const-generics/defaults/mismatch.stderr +++ b/tests/ui/const-generics/defaults/mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/mismatch.rs:7:26 | LL | let e: Example<13> = (); - | ----------- ^^ expected struct `Example`, found `()` + | ----------- ^^ expected `Example`, found `()` | | | expected due to this | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/mismatch.rs:10:32 | LL | let e: Example2 = (); - | ----------------- ^^ expected struct `Example2`, found `()` + | ----------------- ^^ expected `Example2`, found `()` | | | expected due to this | @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/mismatch.rs:13:32 | LL | let e: Example3<13, u32> = (); - | ----------------- ^^ expected struct `Example3`, found `()` + | ----------------- ^^ expected `Example3`, found `()` | | | expected due to this | @@ -35,7 +35,7 @@ error[E0308]: mismatched types --> $DIR/mismatch.rs:16:26 | LL | let e: Example3<7> = (); - | ----------- ^^ expected struct `Example3`, found `()` + | ----------- ^^ expected `Example3<7>`, found `()` | | | expected due to this | @@ -46,7 +46,7 @@ error[E0308]: mismatched types --> $DIR/mismatch.rs:19:26 | LL | let e: Example4<7> = (); - | ----------- ^^ expected struct `Example4`, found `()` + | ----------- ^^ expected `Example4<7>`, found `()` | | | expected due to this | diff --git a/tests/ui/const-generics/defaults/wfness.stderr b/tests/ui/const-generics/defaults/wfness.stderr index 25038f830..bd9bfcd7d 100644 --- a/tests/ui/const-generics/defaults/wfness.stderr +++ b/tests/ui/const-generics/defaults/wfness.stderr @@ -23,7 +23,7 @@ note: required by a bound in `WhereClause` --> $DIR/wfness.rs:8:9 | LL | struct WhereClause - | ----------- required by a bound in this + | ----------- required by a bound in this struct LL | where LL | (): Trait; | ^^^^^^^^ required by this bound in `WhereClause` diff --git a/tests/ui/const-generics/early/invalid-const-arguments.stderr b/tests/ui/const-generics/early/invalid-const-arguments.stderr index b46e7e24f..cee34e3b7 100644 --- a/tests/ui/const-generics/early/invalid-const-arguments.stderr +++ b/tests/ui/const-generics/early/invalid-const-arguments.stderr @@ -49,12 +49,9 @@ error[E0747]: type provided when a constant was expected --> $DIR/invalid-const-arguments.rs:10:19 | LL | impl Foo for B {} - | ^ - | -help: consider changing this type parameter to be a `const` generic - | -LL | impl Foo for B {} - | ~~~~~~~~~~~ + | - ^ + | | + | help: consider changing this type parameter to a const parameter: `const N: u8` error[E0747]: unresolved item provided when a constant was expected --> $DIR/invalid-const-arguments.rs:14:32 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index bf6c35ad8..ab2871ff2 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -9,7 +9,7 @@ note: required by a bound in `bar` --> $DIR/ensure_is_evaluatable.rs:15:10 | LL | fn bar() -> [(); N] - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index 614e7e0d2..c124010aa 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -9,7 +9,7 @@ note: required by a bound in `bar` --> $DIR/fn_with_two_const_inputs.rs:18:10 | LL | fn bar() -> [(); N] - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.rs b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.rs new file mode 100644 index 000000000..fd52fc355 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.rs @@ -0,0 +1,18 @@ +// checks that when we relate a `Expr::Binop` we also relate the types of the +// const arguments. +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +struct Bar; + +const fn make_generic(_: usize, a: bool) -> bool { + a +} + +fn foo() -> Bar<{ make_generic(N, true == false) }> { + Bar::<{ make_generic(N, 1_u8 == 0_u8) }> + //~^ error: mismatched types + //~| error: unconstrained generic constant +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.stderr new file mode 100644 index 000000000..ba824e84a --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_binop_arg_tys.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/relate_binop_arg_tys.rs:13:5 + | +LL | Bar::<{ make_generic(N, 1_u8 == 0_u8) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ make_generic(N, true == false) }`, found `{ make_generic(N, 1_u8 == 0_u8) }` + | + = note: expected constant `{ make_generic(N, true == false) }` + found constant `{ make_generic(N, 1_u8 == 0_u8) }` + +error: unconstrained generic constant + --> $DIR/relate_binop_arg_tys.rs:13:11 + | +LL | Bar::<{ make_generic(N, 1_u8 == 0_u8) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); { make_generic(N, 1_u8 == 0_u8) }]:` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.rs b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.rs new file mode 100644 index 000000000..bef9d4b9e --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.rs @@ -0,0 +1,12 @@ +// checks that when we relate a `Expr::Cast` we also relate the type of the +// const argument. +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn foo() -> [(); (true as usize) + N] { + [(); (1_u8 as usize) + N] + //~^ error: mismatched types + //~| error: unconstrained generic constant +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.stderr new file mode 100644 index 000000000..d3ba870a2 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_cast_arg_ty.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/relate_cast_arg_ty.rs:7:5 + | +LL | [(); (1_u8 as usize) + N] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(true as usize) + N`, found `(1_u8 as usize) + N` + | + = note: expected constant `(true as usize) + N` + found constant `(1_u8 as usize) + N` + +error: unconstrained generic constant + --> $DIR/relate_cast_arg_ty.rs:7:10 + | +LL | [(); (1_u8 as usize) + N] + | ^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); (1_u8 as usize) + N]:` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_1.rs b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_1.rs new file mode 100644 index 000000000..1e2484118 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_1.rs @@ -0,0 +1,30 @@ +// check-pass +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +// issue #107899 +// We end up relating `Const(ty: size_of, kind: Value(Branch([])))` with +// `Const(ty: size_of, kind: Value(Branch([])))` which if you were to `==` +// the `ty` fields would return `false` and ICE. This test checks that we use +// actual semantic equality that takes into account aliases and infer vars. + +use std::mem::size_of; + +trait X { + fn f(self); + fn g(self); +} + +struct Y; + +impl X for Y +where + [(); size_of::()]: Sized, +{ + fn f(self) { + self.g(); + } + fn g(self) {} +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_2.rs b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_2.rs new file mode 100644 index 000000000..91a8a7c4a --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/relate_ty_with_infer_2.rs @@ -0,0 +1,151 @@ +// check-pass +#![feature(inline_const, generic_const_exprs)] +#![allow(incomplete_features)] +use std::marker::PhantomData; + +pub struct Equal(); +pub trait True {} +impl True for Equal {} + +// replacement for generativity +pub struct Id<'id>(PhantomData &'id ()>); +pub struct Guard<'id>(Id<'id>); +fn make_guard<'id>(i: &'id Id<'id>) -> Guard<'id> { + Guard(Id(PhantomData)) +} + +impl<'id> Into> for Guard<'id> { + fn into(self) -> Id<'id> { + self.0 + } +} + +pub struct Arena<'life> { + bytes: *mut [u8], + //bitmap: RefCell, + _token: PhantomData>, +} + +#[repr(transparent)] +pub struct Item<'life, T> { + data: T, + _phantom: PhantomData>, +} + +#[repr(transparent)] +pub struct Token<'life, 'borrow, 'compact, 'reborrow, T> +where + 'life: 'reborrow, + T: Tokenize<'life, 'borrow, 'compact, 'reborrow>, +{ + //ptr: *mut ::Tokenized, + ptr: core::ptr::NonNull, + _phantom: PhantomData>, + _compact: PhantomData<&'borrow Guard<'compact>>, + _result: PhantomData<&'reborrow T::Untokenized>, +} + +impl<'life> Arena<'life> { + pub fn tokenize<'before, 'compact, 'borrow, 'reborrow, T, U>( + &self, + guard: &'borrow Guard<'compact>, + item: Item<'life, &'before mut T>, + ) -> Token<'life, 'borrow, 'compact, 'reborrow, U> + where + T: Tokenize<'life, 'borrow, 'compact, 'reborrow, Untokenized = U>, + T::Untokenized: Tokenize<'life, 'borrow, 'compact, 'reborrow>, + Equal<{ core::mem::size_of::() }, { core::mem::size_of::() }>: True, + 'compact: 'borrow, + 'life: 'reborrow, + 'life: 'compact, + 'life: 'borrow, + // 'borrow: 'before ?? + { + let dst = item.data as *mut T as *mut T::Tokenized; + Token { + ptr: core::ptr::NonNull::new(dst as *mut _).unwrap(), + _phantom: PhantomData, + _compact: PhantomData, + _result: PhantomData, + } + } +} + +pub trait Tokenize<'life, 'borrow, 'compact, 'reborrow> +where + 'compact: 'borrow, + 'life: 'reborrow, + 'life: 'borrow, + 'life: 'compact, +{ + type Tokenized; + type Untokenized; + const TO: fn(&Arena<'life>, &'borrow Guard<'compact>, Self) -> Self::Tokenized; + const FROM: fn(&'reborrow Arena<'life>, Self::Tokenized) -> Self::Untokenized; +} + +macro_rules! tokenize { + ($to:expr, $from:expr) => { + const TO: fn(&Arena<'life>, &'borrow Guard<'compact>, Self) -> Self::Tokenized = $to; + const FROM: fn(&'reborrow Arena<'life>, Self::Tokenized) -> Self::Untokenized = $from; + }; +} + +struct Foo<'life, 'borrow>(Option>); +struct TokenFoo<'life, 'borrow, 'compact, 'reborrow>( + Option>, +); +struct Bar(u8); + +impl<'life, 'before, 'borrow, 'compact, 'reborrow> Tokenize<'life, 'borrow, 'compact, 'reborrow> + for Foo<'life, 'before> +where + 'compact: 'borrow, + 'life: 'reborrow, + 'life: 'borrow, + 'life: 'compact, +{ + type Tokenized = TokenFoo<'life, 'borrow, 'compact, 'reborrow>; + type Untokenized = Foo<'life, 'reborrow>; + tokenize!(foo_to, foo_from); +} + +impl<'life, 'borrow, 'compact, 'reborrow> Tokenize<'life, 'borrow, 'compact, 'reborrow> for Bar +where + 'compact: 'borrow, + 'life: 'reborrow, + 'life: 'borrow, + 'life: 'compact, +{ + type Tokenized = Bar; + type Untokenized = Bar; + tokenize!(bar_to, bar_from); +} + +fn bar_to<'life, 'borrow, 'compact>( + arena: &Arena<'life>, + guard: &'borrow Guard<'compact>, + s: Bar, +) -> Bar { + s +} +fn bar_from<'life, 'reborrow>(arena: &'reborrow Arena<'life>, s: Bar) -> Bar { + s +} + +fn foo_to<'life, 'borrow, 'compact, 'reborrow, 'before>( + arena: &'before Arena<'life>, + guard: &'borrow Guard<'compact>, + s: Foo<'life, 'before>, +) -> TokenFoo<'life, 'borrow, 'compact, 'reborrow> { + let Foo(bar) = s; + TokenFoo(bar.map(|bar| arena.tokenize(guard, bar))) +} +fn foo_from<'life, 'borrow, 'compact, 'reborrow>( + arena: &'reborrow Arena<'life>, + s: TokenFoo<'life, 'borrow, 'compact, 'reborrow>, +) -> Foo<'life, 'reborrow> { + Foo(s.0.map(|bar| panic!())) +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.rs b/tests/ui/const-generics/generic_const_exprs/issue-102768.rs index 7aea0d30d..18a9b53cf 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.rs @@ -7,8 +7,8 @@ trait X { const _: () = { fn f2<'a>(arg: Box = &'a ()>>) {} - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument + //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 0 generic arguments but 1 generic argument }; fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index 8278edabe..175d54e41 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} @@ -14,7 +14,7 @@ help: add missing lifetime argument LL | fn f2<'a>(arg: Box = &'a ()>>) {} | +++ -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-105608.stderr b/tests/ui/const-generics/generic_const_exprs/issue-105608.stderr index 0be4c43da..827dd59d9 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-105608.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-105608.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-105608.rs:13:22 | LL | Combination::<0>.and::<_>().and::<_>(); - | ^^^ cannot infer type of the type parameter `M` declared on the associated function `and` + | ^^^ cannot infer type of the type parameter `M` declared on the method `and` | help: consider specifying the generic argument | diff --git a/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr b/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr index f2fddfbfb..996b75493 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Arr` --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` @@ -26,7 +26,7 @@ note: required by a bound in `Arr` --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` diff --git a/tests/ui/const-generics/generic_const_exprs/issue-76595.stderr b/tests/ui/const-generics/generic_const_exprs/issue-76595.stderr index c587a7e15..302da5965 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-76595.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-76595.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-76595.rs:15:5 | LL | test::<2>(); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr b/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr index 9baf9790e..511ae58a1 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-79518-default_trait_method_normalization.rs:16:32 | LL | Self::AssocInstance == [(); std::mem::size_of::()]; - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); std::mem::size_of::()]` + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `[(); std::mem::size_of::()]` | | | expected because this is `::Assoc` | diff --git a/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr b/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr index a253ec676..63e6fcc8e 100644 --- a/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr +++ b/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr @@ -10,7 +10,7 @@ note: required by a bound in `g` --> $DIR/obligation-cause.rs:13:44 | LL | fn g() - | - required by a bound in this + | - required by a bound in this function ... LL | Is<{ std::mem::size_of::() == 0 }>: True, | ^^^^ required by this bound in `g` diff --git a/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs new file mode 100644 index 000000000..0ba0c5a72 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs @@ -0,0 +1,39 @@ +// check-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +use std::marker::PhantomData; + +pub trait Bytes { + const BYTES: usize; +} + +#[derive(Clone, Debug)] +pub struct Conster +where + OT: Bytes, + [(); OT::BYTES]: Sized, +{ + _offset_type: PhantomData OT>, +} + +impl Conster +where + OT: Bytes, + [(); OT::BYTES]: Sized, +{ + pub fn new() -> Self { + Conster { _offset_type: PhantomData } + } +} + +pub fn make_conster() -> Conster +where + COT: Bytes, + [(); COT::BYTES]: Sized, +{ + Conster::new() +} + +fn main() {} diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index a845454f7..01ac4e69a 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/incorrect-number-of-const-args.rs:6:5 | LL | foo::<0>(); @@ -16,7 +16,7 @@ help: add missing generic argument LL | foo::<0, Y>(); | +++ -error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied +error[E0107]: function takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/incorrect-number-of-const-args.rs:9:5 | LL | foo::<0, 0, 0>(); diff --git a/tests/ui/const-generics/infer/method-chain.stderr b/tests/ui/const-generics/infer/method-chain.stderr index ff6da535b..f527ee6e4 100644 --- a/tests/ui/const-generics/infer/method-chain.stderr +++ b/tests/ui/const-generics/infer/method-chain.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/method-chain.rs:15:33 | LL | Foo.bar().bar().bar().bar().baz(); - | ^^^ cannot infer the value of the const parameter `N` declared on the associated function `baz` + | ^^^ cannot infer the value of the const parameter `N` declared on the method `baz` | help: consider specifying the generic argument | diff --git a/tests/ui/const-generics/infer/uninferred-consts.stderr b/tests/ui/const-generics/infer/uninferred-consts.stderr index 3980ecea8..20daf4570 100644 --- a/tests/ui/const-generics/infer/uninferred-consts.stderr +++ b/tests/ui/const-generics/infer/uninferred-consts.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/uninferred-consts.rs:9:9 | LL | Foo.foo(); - | ^^^ cannot infer the value of the const parameter `A` declared on the associated function `foo` + | ^^^ cannot infer the value of the const parameter `A` declared on the method `foo` | help: consider specifying the generic arguments | diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.rs b/tests/ui/const-generics/invalid-const-arg-for-type-param.rs index 7d4dc98f3..bf10f471d 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.rs +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.rs @@ -4,11 +4,11 @@ struct S; fn main() { let _: u32 = 5i32.try_into::<32>().unwrap(); - //~^ ERROR this associated function takes + //~^ ERROR method takes S.f::<0>(); //~^ ERROR no method named `f` S::<0>; - //~^ ERROR this struct takes 0 + //~^ ERROR struct takes 0 } diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 8c76ca690..4a649d8a7 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/invalid-const-arg-for-type-param.rs:6:23 | LL | let _: u32 = 5i32.try_into::<32>().unwrap(); @@ -23,7 +23,7 @@ LL | struct S; LL | S.f::<0>(); | ^ method not found in `S` -error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; diff --git a/tests/ui/const-generics/invalid-constant-in-args.rs b/tests/ui/const-generics/invalid-constant-in-args.rs index 7419d4a25..fd259197d 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.rs +++ b/tests/ui/const-generics/invalid-constant-in-args.rs @@ -2,5 +2,5 @@ use std::cell::Cell; fn main() { let _: Cell<&str, "a"> = Cell::new(""); - //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied + //~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied } diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index 993b63518..2545cc6f3 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); diff --git a/tests/ui/const-generics/issues/issue-105821.rs b/tests/ui/const-generics/issues/issue-105821.rs new file mode 100644 index 000000000..cba2e22c4 --- /dev/null +++ b/tests/ui/const-generics/issues/issue-105821.rs @@ -0,0 +1,23 @@ +// check-pass + +#![allow(incomplete_features)] +#![feature(adt_const_params, const_ptr_read, generic_const_exprs)] +#![allow(dead_code)] + +const fn catone(_a: &[u8; M]) -> [u8; M + 1] +where + [(); M + 1]:, +{ + unimplemented!() +} + +struct Catter; +impl Catter +where + [(); A.len() + 1]:, +{ + const ZEROS: &'static [u8; A.len()] = &[0_u8; A.len()]; + const R: &'static [u8] = &catone(Self::ZEROS); +} + +fn main() {} diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr index 43a5df117..9f8801341 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr @@ -6,7 +6,7 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | = note: for more information, see issue #74052 -error: `&'static str` is forbidden as the type of a const generic parameter +error: `&str` is forbidden as the type of a const generic parameter --> $DIR/issue-56445-1.rs:9:25 | LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); diff --git a/tests/ui/const-generics/issues/issue-56445-1.rs b/tests/ui/const-generics/issues/issue-56445-1.rs index 13eb2ea9f..0741c3796 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.rs +++ b/tests/ui/const-generics/issues/issue-56445-1.rs @@ -8,6 +8,6 @@ use std::marker::PhantomData; struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); //~^ ERROR: use of non-static lifetime `'a` in const generic -//[min]~| ERROR: `&'static str` is forbidden as the type of a const generic parameter +//[min]~| ERROR: `&str` is forbidden as the type of a const generic parameter impl Bug<'_, ""> {} diff --git a/tests/ui/const-generics/issues/issue-67185-2.stderr b/tests/ui/const-generics/issues/issue-67185-2.stderr index c7be8e14a..032b0c410 100644 --- a/tests/ui/const-generics/issues/issue-67185-2.stderr +++ b/tests/ui/const-generics/issues/issue-67185-2.stderr @@ -35,7 +35,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait ... LL | ::Quaks: Bar, | ^^^ required by this bound in `Foo` @@ -53,7 +53,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait LL | where LL | [::Quaks; 2]: Bar, | ^^^ required by this bound in `Foo` @@ -71,7 +71,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait LL | where LL | [::Quaks; 2]: Bar, | ^^^ required by this bound in `Foo` @@ -89,7 +89,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait ... LL | ::Quaks: Bar, | ^^^ required by this bound in `Foo` 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 8e18fcdff..8879aec35 100644 --- a/tests/ui/const-generics/issues/issue-67945-1.full.stderr +++ b/tests/ui/const-generics/issues/issue-67945-1.full.stderr @@ -5,7 +5,7 @@ LL | struct Bug { | - this type parameter ... LL | let x: S = MaybeUninit::uninit(); - | - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit` + | - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>` | | | expected due to this | diff --git a/tests/ui/const-generics/issues/issue-73260.rs b/tests/ui/const-generics/issues/issue-73260.rs index d762f9c8b..aa7ae90a3 100644 --- a/tests/ui/const-generics/issues/issue-73260.rs +++ b/tests/ui/const-generics/issues/issue-73260.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zsave-analysis #![feature(generic_const_exprs)] #![allow(incomplete_features)] struct Arr diff --git a/tests/ui/const-generics/issues/issue-73260.stderr b/tests/ui/const-generics/issues/issue-73260.stderr index 7670032e5..c56b45cc8 100644 --- a/tests/ui/const-generics/issues/issue-73260.stderr +++ b/tests/ui/const-generics/issues/issue-73260.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-73260.rs:16:12 + --> $DIR/issue-73260.rs:15:12 | LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^^^^^^^^^^^^^^^ expected `false`, found `true` @@ -7,16 +7,16 @@ LL | let x: Arr<{usize::MAX}> = Arr {}; = note: expected constant `false` found constant `true` note: required by a bound in `Arr` - --> $DIR/issue-73260.rs:6:37 + --> $DIR/issue-73260.rs:5:37 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where LL | Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` error[E0308]: mismatched types - --> $DIR/issue-73260.rs:16:32 + --> $DIR/issue-73260.rs:15:32 | LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^ expected `false`, found `true` @@ -24,10 +24,10 @@ LL | let x: Arr<{usize::MAX}> = Arr {}; = note: expected constant `false` found constant `true` note: required by a bound in `Arr` - --> $DIR/issue-73260.rs:6:37 + --> $DIR/issue-73260.rs:5:37 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where LL | Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` diff --git a/tests/ui/const-generics/issues/issue-79674.stderr b/tests/ui/const-generics/issues/issue-79674.stderr index 02b48b55f..ba7fd2ca3 100644 --- a/tests/ui/const-generics/issues/issue-79674.stderr +++ b/tests/ui/const-generics/issues/issue-79674.stderr @@ -10,7 +10,7 @@ note: required by a bound in `requires_distinct` --> $DIR/issue-79674.rs:23:37 | LL | fn requires_distinct(_a: A, _b: B) where - | ----------------- required by a bound in this + | ----------------- required by a bound in this function LL | A: MiniTypeId, B: MiniTypeId, LL | Lift<{is_same_type::()}>: IsFalse {} | ^^^^^^^ required by this bound in `requires_distinct` diff --git a/tests/ui/const-generics/issues/issue-86530.stderr b/tests/ui/const-generics/issues/issue-86530.stderr index c63857b23..620ed4f0f 100644 --- a/tests/ui/const-generics/issues/issue-86530.stderr +++ b/tests/ui/const-generics/issues/issue-86530.stderr @@ -10,7 +10,7 @@ note: required by a bound in `z` --> $DIR/issue-86530.rs:10:8 | LL | fn z(t: T) - | - required by a bound in this + | - required by a bound in this function LL | where LL | T: X, | ^ required by this bound in `z` diff --git a/tests/ui/const-generics/issues/issue-87493.rs b/tests/ui/const-generics/issues/issue-87493.rs index d8599ab22..80472e6bd 100644 --- a/tests/ui/const-generics/issues/issue-87493.rs +++ b/tests/ui/const-generics/issues/issue-87493.rs @@ -7,7 +7,7 @@ where S: MyTrait, T: MyTrait, //~^ ERROR: expected one of `,` or `>`, found `==` - //~| ERROR: this trait takes 0 generic arguments but 1 generic argument was supplied + //~| ERROR: trait takes 0 generic arguments but 1 generic argument was supplied { } diff --git a/tests/ui/const-generics/issues/issue-87493.stderr b/tests/ui/const-generics/issues/issue-87493.stderr index 653afae21..73bd6ed73 100644 --- a/tests/ui/const-generics/issues/issue-87493.stderr +++ b/tests/ui/const-generics/issues/issue-87493.stderr @@ -9,7 +9,7 @@ help: if you meant to use an associated type binding, replace `==` with `=` LL | T: MyTrait, | ~ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-87493.rs:8:8 | LL | T: MyTrait, diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.stderr b/tests/ui/const-generics/min_const_generics/macro-fail.stderr index 9f73b91aa..cc629fd92 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail.stderr @@ -8,7 +8,7 @@ LL | fn make_marker() -> impl Marker { | in this macro invocation ... LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type + | ^ expected type | = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -22,26 +22,21 @@ LL | Example:: | in this macro invocation ... LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type + | ^ expected type | = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected type, found `{` --> $DIR/macro-fail.rs:4:10 | -LL | () => {{ - | __________^ -LL | | -LL | | const X: usize = 1337; -LL | | X -LL | | }} - | |___^ expected type +LL | () => {{ + | ^ expected type ... -LL | let _fail = Example::; - | ----------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation +LL | let _fail = Example::; + | ----------------- + | | + | this macro call doesn't expand to a type + | in this macro invocation | = note: this error originates in the macro `external_macro` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/const-generics/nested-type.min.stderr b/tests/ui/const-generics/nested-type.min.stderr index cff02b0d4..257a9e31e 100644 --- a/tests/ui/const-generics/nested-type.min.stderr +++ b/tests/ui/const-generics/nested-type.min.stderr @@ -1,3 +1,11 @@ +error[E0015]: cannot call non-const fn `Foo::{constant#0}::Foo::<17>::value` in constants + --> $DIR/nested-type.rs:15:5 + | +LL | Foo::<17>::value() + | ^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + error: `[u8; { struct Foo; @@ -24,5 +32,6 @@ LL | | }]>; = note: the only supported types are integers, `bool` and `char` = help: more complex types are supported with `#![feature(adt_const_params)]` -error: aborting due to previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/const-generics/nested-type.rs b/tests/ui/const-generics/nested-type.rs index 742340f43..5240f5c3b 100644 --- a/tests/ui/const-generics/nested-type.rs +++ b/tests/ui/const-generics/nested-type.rs @@ -13,7 +13,7 @@ struct Foo::value() - //[full]~^ ERROR cannot call non-const fn + //~^ ERROR cannot call non-const fn }]>; fn main() {} 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 a3c011d92..51ef354e3 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `A` --> $DIR/unused-substs-1.rs:9:11 | LL | struct A - | - required by a bound in this + | - required by a bound in this unit struct LL | where LL | A: Bar; | ^^^^^^ required by this bound in `A` diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs index b126b2485..79743abe4 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs @@ -7,7 +7,7 @@ struct Bar; const T: usize = 42; impl Foo for Bar { -//~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied +//~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied //~| ERROR associated type bindings are not allowed here //~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr index acfdde8e1..4f4e1aa3a 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr @@ -7,7 +7,7 @@ LL | impl Foo for Bar { = note: see issue #92827 for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-89013-no-kw.rs:9:6 | LL | impl Foo for Bar { diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.rs b/tests/ui/const-generics/parser-error-recovery/issue-89013.rs index 9431779fa..335d0d94e 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.rs +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.rs @@ -8,7 +8,7 @@ const T: usize = 42; impl Foo for Bar { //~^ ERROR expected lifetime, type, or constant, found keyword `const` -//~| ERROR this trait takes 1 generic +//~| ERROR trait takes 1 generic //~| ERROR associated type bindings are not allowed here //~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr index 583749a85..3d2b98feb 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -19,7 +19,7 @@ LL | impl Foo for Bar { = note: see issue #92827 for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-89013.rs:9:6 | LL | impl Foo for Bar { diff --git a/tests/ui/const-generics/type_mismatch.stderr b/tests/ui/const-generics/type_mismatch.stderr index 8d779bee2..b28ae8f7e 100644 --- a/tests/ui/const-generics/type_mismatch.stderr +++ b/tests/ui/const-generics/type_mismatch.stderr @@ -8,7 +8,7 @@ error[E0308]: mismatched types --> $DIR/type_mismatch.rs:5:26 | LL | fn bar() -> [u8; N] {} - | --- ^^^^^^^ expected array `[u8; N]`, found `()` + | --- ^^^^^^^ expected `[u8; N]`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression diff --git a/tests/ui/const-generics/type_not_in_scope.stderr b/tests/ui/const-generics/type_not_in_scope.stderr index 16796acb3..5f45550a6 100644 --- a/tests/ui/const-generics/type_not_in_scope.stderr +++ b/tests/ui/const-generics/type_not_in_scope.stderr @@ -14,7 +14,7 @@ error[E0308]: mismatched types --> $DIR/type_not_in_scope.rs:7:33 | LL | fn getn() -> [u8; N] {} - | ---- ^^^^^^^ expected array `[u8; N]`, found `()` + | ---- ^^^^^^^ expected `[u8; N]`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression diff --git a/tests/ui/const-generics/types-mismatch-const-args.full.stderr b/tests/ui/const-generics/types-mismatch-const-args.full.stderr index b6a22df74..13cd5d17d 100644 --- a/tests/ui/const-generics/types-mismatch-const-args.full.stderr +++ b/tests/ui/const-generics/types-mismatch-const-args.full.stderr @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:16:41 | LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>` | | | expected due to this | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:18:41 | LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>` | | | expected due to this | diff --git a/tests/ui/const-generics/types-mismatch-const-args.min.stderr b/tests/ui/const-generics/types-mismatch-const-args.min.stderr index 6ac93a08d..cae3adfa1 100644 --- a/tests/ui/const-generics/types-mismatch-const-args.min.stderr +++ b/tests/ui/const-generics/types-mismatch-const-args.min.stderr @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:16:41 | LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>` | | | expected due to this | @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:18:41 | LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>` | | | expected due to this | diff --git a/tests/ui/const-generics/unify_with_nested_expr.stderr b/tests/ui/const-generics/unify_with_nested_expr.stderr index 8bab0dff7..d4d78b596 100644 --- a/tests/ui/const-generics/unify_with_nested_expr.stderr +++ b/tests/ui/const-generics/unify_with_nested_expr.stderr @@ -8,7 +8,7 @@ note: required by a bound in `bar` --> $DIR/unify_with_nested_expr.rs:14:10 | LL | fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/const-generics/wrong-normalization.rs b/tests/ui/const-generics/wrong-normalization.rs new file mode 100644 index 000000000..f1ce317b3 --- /dev/null +++ b/tests/ui/const-generics/wrong-normalization.rs @@ -0,0 +1,19 @@ +// This test ensures that if implementation on projections is supported, +// it doesn't end in very weird cycle error. + +#![crate_type = "lib"] + +pub trait Identity { + type Identity: ?Sized; +} + +impl Identity for T { + type Identity = Self; +} + +pub struct I8; + +impl as Identity>::Identity { +//~^ ERROR no nominal type found for inherent implementation + pub fn foo(&self) {} +} diff --git a/tests/ui/const-generics/wrong-normalization.stderr b/tests/ui/const-generics/wrong-normalization.stderr new file mode 100644 index 000000000..658a84066 --- /dev/null +++ b/tests/ui/const-generics/wrong-normalization.stderr @@ -0,0 +1,11 @@ +error[E0118]: no nominal type found for inherent implementation + --> $DIR/wrong-normalization.rs:16:1 + | +LL | impl as Identity>::Identity { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type + | + = note: either implement a trait on it or create a newtype to wrap it instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0118`. diff --git a/tests/ui/constructor-lifetime-args.rs b/tests/ui/constructor-lifetime-args.rs index a824a44c9..f5802e7d8 100644 --- a/tests/ui/constructor-lifetime-args.rs +++ b/tests/ui/constructor-lifetime-args.rs @@ -15,12 +15,12 @@ enum E<'a, 'b> { fn main() { S(&0, &0); // OK S::<'static>(&0, &0); - //~^ ERROR this struct takes 2 lifetime arguments + //~^ ERROR struct takes 2 lifetime arguments S::<'static, 'static, 'static>(&0, &0); - //~^ ERROR this struct takes 2 lifetime arguments + //~^ ERROR struct takes 2 lifetime arguments E::V(&0); // OK E::V::<'static>(&0); - //~^ ERROR this enum takes 2 lifetime arguments + //~^ ERROR enum takes 2 lifetime arguments E::V::<'static, 'static, 'static>(&0); - //~^ ERROR this enum takes 2 lifetime arguments + //~^ ERROR enum takes 2 lifetime arguments } diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index bc1141b16..a18123fe1 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:17:5 | LL | S::<'static>(&0, &0); @@ -16,7 +16,7 @@ help: add missing lifetime argument LL | S::<'static, 'static>(&0, &0); | +++++++++ -error[E0107]: this struct takes 2 lifetime arguments but 3 lifetime arguments were supplied +error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); @@ -30,7 +30,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b` LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- -error[E0107]: this enum takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:22:8 | LL | E::V::<'static>(&0); @@ -48,7 +48,7 @@ help: add missing lifetime argument LL | E::V::<'static, 'static>(&0); | +++++++++ -error[E0107]: this enum takes 2 lifetime arguments but 3 lifetime arguments were supplied +error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supplied --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); diff --git a/tests/ui/consts/array-literal-len-mismatch.rs b/tests/ui/consts/array-literal-len-mismatch.rs new file mode 100644 index 000000000..b30ff61a9 --- /dev/null +++ b/tests/ui/consts/array-literal-len-mismatch.rs @@ -0,0 +1,4 @@ +const NUMBERS: [u8; 3] = [10, 20]; +//~^ ERROR mismatched types +//~^^ HELP consider specifying the actual array length +fn main() {} diff --git a/tests/ui/consts/array-literal-len-mismatch.stderr b/tests/ui/consts/array-literal-len-mismatch.stderr new file mode 100644 index 000000000..22fec6389 --- /dev/null +++ b/tests/ui/consts/array-literal-len-mismatch.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/array-literal-len-mismatch.rs:1:26 + | +LL | const NUMBERS: [u8; 3] = [10, 20]; + | - ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | | + | help: consider specifying the actual array length: `2` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/const-array-oob-arith.stderr b/tests/ui/consts/const-array-oob-arith.stderr index f7a55d3ca..029d94273 100644 --- a/tests/ui/consts/const-array-oob-arith.stderr +++ b/tests/ui/consts/const-array-oob-arith.stderr @@ -2,13 +2,17 @@ error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:5:45 | LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; - | ^^^ expected an array with a fixed size of 2 elements, found one with 1 element + | ---------------------- ^^^ expected an array with a fixed size of 2 elements, found one with 1 element + | | + | help: consider specifying the actual array length: `1` error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:8:44 | LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; - | ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements + | ---------------------- ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements + | | + | help: consider specifying the actual array length: `2` error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr index c5c668189..cb0cab244 100644 --- a/tests/ui/consts/const-err-late.stderr +++ b/tests/ui/consts/const-err-late.stderr @@ -28,24 +28,12 @@ note: erroneous constant used LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/const-err-late.rs:19:31 - | -LL | black_box((S::::FOO, S::::FOO)); - | ^^^^^^^^^^^^^ - note: erroneous constant used --> $DIR/const-err-late.rs:19:16 | LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ -note: erroneous constant used - --> $DIR/const-err-late.rs:19:31 - | -LL | black_box((S::::FOO, S::::FOO)); - | ^^^^^^^^^^^^^ - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.rs b/tests/ui/consts/const-eval/const-eval-query-stack.rs index 8f8a8cee3..81f28c175 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.rs +++ b/tests/ui/consts/const-eval/const-eval-query-stack.rs @@ -1,8 +1,7 @@ // compile-flags: -Ztreat-err-as-bug=1 // failure-status: 101 // rustc-env:RUST_BACKTRACE=1 -// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "\nerror: .*unexpectedly panicked.*\n\n" -> "" // normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" // normalize-stderr-test "note: compiler flags.*\n\n" -> "" // normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr index b97975c4c..01fb8153c 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-eval-query-stack.rs:17:16 + --> $DIR/const-eval-query-stack.rs:16:16 | LL | const X: i32 = 1 / 0; | ^^^^^ attempt to divide `1_i32` by zero diff --git a/tests/ui/consts/const-eval/const-eval-span.rs b/tests/ui/consts/const-eval/const-eval-span.rs index 82f101b47..1667c77d1 100644 --- a/tests/ui/consts/const-eval/const-eval-span.rs +++ b/tests/ui/consts/const-eval/const-eval-span.rs @@ -8,7 +8,7 @@ const CONSTANT: S = S(0); enum E { V = CONSTANT, //~^ ERROR mismatched types - //~| expected `isize`, found struct `S` + //~| expected `isize`, found `S` } fn main() {} diff --git a/tests/ui/consts/const-eval/const-eval-span.stderr b/tests/ui/consts/const-eval/const-eval-span.stderr index c5b001899..fe33ad490 100644 --- a/tests/ui/consts/const-eval/const-eval-span.stderr +++ b/tests/ui/consts/const-eval/const-eval-span.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/const-eval-span.rs:9:9 | LL | V = CONSTANT, - | ^^^^^^^^ expected `isize`, found struct `S` + | ^^^^^^^^ expected `isize`, found `S` error: aborting due to previous error diff --git a/tests/ui/consts/const-eval/infinite_loop.stderr b/tests/ui/consts/const-eval/infinite_loop.stderr index 8b58cb279..f30bfaf3f 100644 --- a/tests/ui/consts/const-eval/infinite_loop.stderr +++ b/tests/ui/consts/const-eval/infinite_loop.stderr @@ -1,8 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/infinite_loop.rs:6:15 + --> $DIR/infinite_loop.rs:6:9 | -LL | while n != 0 { - | ^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) +LL | / while n != 0 { +LL | | +LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; +LL | | } + | |_________^ exceeded interpreter step limit (see `#[const_eval_limit]`) error: aborting due to previous error diff --git a/tests/ui/consts/const-eval/issue-52475.rs b/tests/ui/consts/const-eval/issue-52475.rs index ce65407bb..307c1a668 100644 --- a/tests/ui/consts/const-eval/issue-52475.rs +++ b/tests/ui/consts/const-eval/issue-52475.rs @@ -2,8 +2,8 @@ fn main() { let _ = [(); { let mut x = &0; let mut n = 0; - while n < 5 { - n = (n + 1) % 5; //~ ERROR evaluation of constant value failed + while n < 5 { //~ ERROR evaluation of constant value failed [E0080] + n = (n + 1) % 5; x = &0; // Materialize a new AllocId } 0 diff --git a/tests/ui/consts/const-eval/issue-52475.stderr b/tests/ui/consts/const-eval/issue-52475.stderr index 8536ff02c..3aa6bd277 100644 --- a/tests/ui/consts/const-eval/issue-52475.stderr +++ b/tests/ui/consts/const-eval/issue-52475.stderr @@ -1,8 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-52475.rs:6:17 + --> $DIR/issue-52475.rs:5:9 | -LL | n = (n + 1) % 5; - | ^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) +LL | / while n < 5 { +LL | | n = (n + 1) % 5; +LL | | x = &0; // Materialize a new AllocId +LL | | } + | |_________^ exceeded interpreter step limit (see `#[const_eval_limit]`) error: aborting due to previous error diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types.rs b/tests/ui/consts/const-eval/issue-91827-extern-types.rs index 43c99799f..c9aaa6e55 100644 --- a/tests/ui/consts/const-eval/issue-91827-extern-types.rs +++ b/tests/ui/consts/const-eval/issue-91827-extern-types.rs @@ -28,7 +28,10 @@ pub struct ListImpl { impl List { const fn as_slice(&self) -> &[T] { - unsafe { std::slice::from_raw_parts(self.data.as_ptr(), self.len) } + unsafe { + let ptr = addr_of!(self.tail) as *const T; + std::slice::from_raw_parts(ptr, self.len) + } } } diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr index 91a426580..a0f8dd097 100644 --- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr @@ -167,7 +167,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:96:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] 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: 4, align: 4) { @@ -178,7 +178,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:99:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] 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: 4, 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 e4c5e62f6..9706f3ec2 100644 --- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr @@ -167,7 +167,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:96:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] 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: 8, align: 8) { @@ -178,7 +178,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/raw-bytes.rs:99:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] 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: 8, align: 8) { diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.rs b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.rs new file mode 100644 index 000000000..c59596238 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.rs @@ -0,0 +1,36 @@ +// check-fail +// compile-flags: -Z tiny-const-eval-limit + +const fn foo() {} + +const fn call_foo() -> u32 { + foo(); + foo(); + foo(); + foo(); + foo(); + + foo(); + foo(); + foo(); + foo(); + foo(); + + foo(); + foo(); + foo(); + foo(); + foo(); + + foo(); + foo(); + foo(); + foo(); //~ ERROR evaluation of constant value failed [E0080] + 0 +} + +const X: u32 = call_foo(); + +fn main() { + println!("{X}"); +} diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr new file mode 100644 index 000000000..ed70975af --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr @@ -0,0 +1,20 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/ctfe-fn-call.rs:28:5 + | +LL | foo(); + | ^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) + | +note: inside `call_foo` + --> $DIR/ctfe-fn-call.rs:28:5 + | +LL | foo(); + | ^^^^^ +note: inside `X` + --> $DIR/ctfe-fn-call.rs:32:16 + | +LL | const X: u32 = call_foo(); + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs new file mode 100644 index 000000000..c10b8d837 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.rs @@ -0,0 +1,19 @@ +// check-fail +// compile-flags: -Z tiny-const-eval-limit + +const fn labelled_loop(n: u32) -> u32 { + let mut i = 0; + 'mylabel: loop { //~ ERROR evaluation of constant value failed [E0080] + if i > n { + break 'mylabel + } + i += 1; + } + 0 +} + +const X: u32 = labelled_loop(19); + +fn main() { + println!("{X}"); +} diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr new file mode 100644 index 000000000..d9404edd5 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr @@ -0,0 +1,30 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/ctfe-labelled-loop.rs:6:5 + | +LL | / 'mylabel: loop { +LL | | if i > n { +LL | | break 'mylabel +LL | | } +LL | | i += 1; +LL | | } + | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`) + | +note: inside `labelled_loop` + --> $DIR/ctfe-labelled-loop.rs:6:5 + | +LL | / 'mylabel: loop { +LL | | if i > n { +LL | | break 'mylabel +LL | | } +LL | | i += 1; +LL | | } + | |_____^ +note: inside `X` + --> $DIR/ctfe-labelled-loop.rs:15:16 + | +LL | const X: u32 = labelled_loop(19); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.rs b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.rs new file mode 100644 index 000000000..80ff835f3 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.rs @@ -0,0 +1,16 @@ +// check-fail +// compile-flags: -Z tiny-const-eval-limit + +const fn recurse(n: u32) -> u32 { + if n == 0 { + n + } else { + recurse(n - 1) //~ ERROR evaluation of constant value failed [E0080] + } +} + +const X: u32 = recurse(19); + +fn main() { + println!("{X}"); +} diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr new file mode 100644 index 000000000..ed9a31119 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr @@ -0,0 +1,25 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/ctfe-recursion.rs:8:9 + | +LL | recurse(n - 1) + | ^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) + | +note: inside `recurse` + --> $DIR/ctfe-recursion.rs:8:9 + | +LL | recurse(n - 1) + | ^^^^^^^^^^^^^^ +note: [... 18 additional calls inside `recurse` ...] + --> $DIR/ctfe-recursion.rs:8:9 + | +LL | recurse(n - 1) + | ^^^^^^^^^^^^^^ +note: inside `X` + --> $DIR/ctfe-recursion.rs:12:16 + | +LL | const X: u32 = recurse(19); + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs new file mode 100644 index 000000000..ca0eec93c --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.rs @@ -0,0 +1,15 @@ +// check-fail +// compile-flags: -Z tiny-const-eval-limit +const fn simple_loop(n: u32) -> u32 { + let mut index = 0; + while index < n { //~ ERROR evaluation of constant value failed [E0080] + index = index + 1; + } + 0 +} + +const X: u32 = simple_loop(19); + +fn main() { + println!("{X}"); +} diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.stderr new file mode 100644 index 000000000..83ff275de --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.stderr @@ -0,0 +1,24 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/ctfe-simple-loop.rs:5:5 + | +LL | / while index < n { +LL | | index = index + 1; +LL | | } + | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`) + | +note: inside `simple_loop` + --> $DIR/ctfe-simple-loop.rs:5:5 + | +LL | / while index < n { +LL | | index = index + 1; +LL | | } + | |_____^ +note: inside `X` + --> $DIR/ctfe-simple-loop.rs:11:16 + | +LL | const X: u32 = simple_loop(19); + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/stable-metric/dominators-edge-case.rs b/tests/ui/consts/const-eval/stable-metric/dominators-edge-case.rs new file mode 100644 index 000000000..0b0f36180 --- /dev/null +++ b/tests/ui/consts/const-eval/stable-metric/dominators-edge-case.rs @@ -0,0 +1,19 @@ +// check-pass +// +// Exercising an edge case which was found during Stage 2 compilation. +// Compilation would fail for this code when running the `CtfeLimit` +// MirPass (specifically when looking up the dominators). +#![crate_type="lib"] + +const DUMMY: Expr = Expr::Path(ExprPath { + attrs: Vec::new(), + path: Vec::new(), +}); + +pub enum Expr { + Path(ExprPath), +} +pub struct ExprPath { + pub attrs: Vec<()>, + pub path: Vec<()>, +} diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr index ce618802b..6bd367b64 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr @@ -85,7 +85,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:43:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] 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) { @@ -96,7 +96,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-ref-ptr.rs:46:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] 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) { diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index 9710bf476..69fb1a59d 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -2,10 +2,7 @@ warning: the type `!` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: the `!` type has no valid value = note: `#[warn(invalid_value)]` on by default @@ -40,10 +37,7 @@ warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: in this struct field --> $DIR/validate_uninhabited_zsts.rs:16:22 diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index 9710bf476..69fb1a59d 100644 --- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -2,10 +2,7 @@ warning: the type `!` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: the `!` type has no valid value = note: `#[warn(invalid_value)]` on by default @@ -40,10 +37,7 @@ warning: the type `empty::Empty` does not permit zero-initialization --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: in this struct field --> $DIR/validate_uninhabited_zsts.rs:16:22 diff --git a/tests/ui/consts/const-tup-index-span.rs b/tests/ui/consts/const-tup-index-span.rs index 778a21224..18f4f59d3 100644 --- a/tests/ui/consts/const-tup-index-span.rs +++ b/tests/ui/consts/const-tup-index-span.rs @@ -2,7 +2,7 @@ const TUP: (usize,) = 5usize << 64; //~^ ERROR mismatched types -//~| expected tuple, found `usize` +//~| expected `(usize,)`, found `usize` const ARR: [i32; TUP.0] = []; //~^ constant diff --git a/tests/ui/consts/const-tup-index-span.stderr b/tests/ui/consts/const-tup-index-span.stderr index ad8468056..65f0520f8 100644 --- a/tests/ui/consts/const-tup-index-span.stderr +++ b/tests/ui/consts/const-tup-index-span.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/const-tup-index-span.rs:3:23 | LL | const TUP: (usize,) = 5usize << 64; - | ^^^^^^^^^^^^ expected tuple, found `usize` + | ^^^^^^^^^^^^ expected `(usize,)`, found `usize` | = note: expected tuple `(usize,)` found type `usize` diff --git a/tests/ui/consts/const_limit/const_eval_limit_reached.stderr b/tests/ui/consts/const_limit/const_eval_limit_reached.stderr index 850aebdfb..a8e8ae9bb 100644 --- a/tests/ui/consts/const_limit/const_eval_limit_reached.stderr +++ b/tests/ui/consts/const_limit/const_eval_limit_reached.stderr @@ -1,8 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_eval_limit_reached.rs:6:11 + --> $DIR/const_eval_limit_reached.rs:6:5 | -LL | while x != 1000 { - | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) +LL | / while x != 1000 { +LL | | +LL | | x += 1; +LL | | } + | |_____^ exceeded interpreter step limit (see `#[const_eval_limit]`) error: aborting due to previous error diff --git a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr index 43fba2573..fa20077da 100644 --- a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr +++ b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr @@ -8,7 +8,7 @@ note: required by a bound in `Foo::::unsatisfied` --> $DIR/ct-var-in-collect_all_mismatches.rs:15:12 | LL | fn unsatisfied(self) - | ----------- required by a bound in this + | ----------- required by a bound in this associated function LL | where LL | T: Bar, | ^^^^^^ required by this bound in `Foo::::unsatisfied` diff --git a/tests/ui/consts/gate-do-not-const-check.rs b/tests/ui/consts/gate-do-not-const-check.rs new file mode 100644 index 000000000..be7e70dfa --- /dev/null +++ b/tests/ui/consts/gate-do-not-const-check.rs @@ -0,0 +1,5 @@ +#[rustc_do_not_const_check] +//~^ ERROR this is an internal attribute that will never be stable +const fn foo() {} + +fn main() {} diff --git a/tests/ui/consts/gate-do-not-const-check.stderr b/tests/ui/consts/gate-do-not-const-check.stderr new file mode 100644 index 000000000..3bb136016 --- /dev/null +++ b/tests/ui/consts/gate-do-not-const-check.stderr @@ -0,0 +1,11 @@ +error[E0658]: this is an internal attribute that will never be stable + --> $DIR/gate-do-not-const-check.rs:1:1 + | +LL | #[rustc_do_not_const_check] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(rustc_attrs)]` 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/consts/issue-33903.rs b/tests/ui/consts/issue-33903.rs new file mode 100644 index 000000000..613aa121a --- /dev/null +++ b/tests/ui/consts/issue-33903.rs @@ -0,0 +1,10 @@ +// check-pass +#![allow(dead_code)] +// Issue 33903: +// Built-in indexing should be used even when the index is not +// trivially an integer +// Only built-in indexing can be used in constant expressions + +const FOO: i32 = [12, 34][0 + 1]; + +fn main() {} diff --git a/tests/ui/consts/issue-54582.rs b/tests/ui/consts/issue-54582.rs new file mode 100644 index 000000000..8c50cac67 --- /dev/null +++ b/tests/ui/consts/issue-54582.rs @@ -0,0 +1,16 @@ +// run-pass + +pub trait Stage: Sync {} + +pub enum Enum { + A, + B, +} + +impl Stage for Enum {} + +pub static ARRAY: [(&dyn Stage, &str); 1] = [ + (&Enum::A, ""), +]; + +fn main() {} diff --git a/tests/ui/consts/nested_erroneous_ctfe.stderr b/tests/ui/consts/nested_erroneous_ctfe.stderr index d579a54e9..b6a172507 100644 --- a/tests/ui/consts/nested_erroneous_ctfe.stderr +++ b/tests/ui/consts/nested_erroneous_ctfe.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/nested_erroneous_ctfe.rs:2:16 | LL | [9; || [9; []]]; - | ^^ expected `usize`, found array of 0 elements + | ^^ expected `usize`, found `[_; 0]` | = note: expected type `usize` found array `[_; 0]` diff --git a/tests/ui/consts/promote_const_let.stderr b/tests/ui/consts/promote_const_let.stderr index 975a235a6..6e0349a47 100644 --- a/tests/ui/consts/promote_const_let.stderr +++ b/tests/ui/consts/promote_const_let.stderr @@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough LL | let x: &'static u32 = { | ------------ type annotation requires that `y` is borrowed for `'static` LL | let y = 42; + | - binding `y` declared here LL | &y | ^^ borrowed value does not live long enough LL | }; diff --git a/tests/ui/cross/cross-borrow-trait.stderr b/tests/ui/cross/cross-borrow-trait.stderr index 81f309eae..4f5af1066 100644 --- a/tests/ui/cross/cross-borrow-trait.stderr +++ b/tests/ui/cross/cross-borrow-trait.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/cross-borrow-trait.rs:10:26 | LL | let _y: &dyn Trait = x; - | ---------- ^ expected `&dyn Trait`, found struct `Box` + | ---------- ^ expected `&dyn Trait`, found `Box` | | | expected due to this | diff --git a/tests/ui/deprecation/deprecation-lint.rs b/tests/ui/deprecation/deprecation-lint.rs index 0417e952e..83056feaf 100644 --- a/tests/ui/deprecation/deprecation-lint.rs +++ b/tests/ui/deprecation/deprecation-lint.rs @@ -14,22 +14,22 @@ mod cross_crate { let foo = MethodTester; deprecated(); //~ ERROR use of deprecated function `deprecation_lint::deprecated` - foo.method_deprecated(); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated` - Foo::method_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated` - ::method_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated` - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` + foo.method_deprecated(); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated` + Foo::method_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated` + ::method_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated` + foo.trait_deprecated(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` deprecated_text(); //~ ERROR use of deprecated function `deprecation_lint::deprecated_text`: text - foo.method_deprecated_text(); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text - Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text - ::method_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text + foo.method_deprecated_text(); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text + Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text + ::method_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text let _ = DeprecatedStruct { //~ ERROR use of deprecated struct `deprecation_lint::DeprecatedStruct`: text i: 0 //~ ERROR use of deprecated field `deprecation_lint::DeprecatedStruct::i`: text @@ -61,19 +61,19 @@ mod cross_crate { } fn test_method_param(foo: Foo) { - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text } fn test_method_object(foo: &Trait) { - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text } struct S; @@ -243,22 +243,22 @@ mod this_crate { let foo = MethodTester; deprecated(); //~ ERROR use of deprecated function `this_crate::deprecated` - foo.method_deprecated(); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated` - Foo::method_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated` - ::method_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated` - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` + foo.method_deprecated(); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated` + Foo::method_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated` + ::method_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated` + foo.trait_deprecated(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` deprecated_text(); //~ ERROR use of deprecated function `this_crate::deprecated_text`: text - foo.method_deprecated_text(); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - ::method_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.method_deprecated_text(); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + ::method_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text // Future deprecations are only permitted with `#![feature(staged_api)]` deprecated_future(); //~ ERROR use of deprecated function @@ -289,19 +289,19 @@ mod this_crate { } fn test_method_param(foo: Foo) { - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text } fn test_method_object(foo: &Trait) { - foo.trait_deprecated(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ ERROR use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ ERROR use of deprecated method `this_crate::Trait::trait_deprecated_text`: text } #[deprecated(since = "1.0.0", note = "text")] diff --git a/tests/ui/deprecation/deprecation-lint.stderr b/tests/ui/deprecation/deprecation-lint.stderr index 3842f8492..209807340 100644 --- a/tests/ui/deprecation/deprecation-lint.stderr +++ b/tests/ui/deprecation/deprecation-lint.stderr @@ -10,13 +10,13 @@ note: the lint level is defined here LL | #![deny(deprecated)] | ^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:21:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:23:25 | LL | ::trait_deprecated(&foo); @@ -28,13 +28,13 @@ error: use of deprecated function `deprecation_lint::deprecated_text`: text LL | deprecated_text(); | ^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:30:16 | -LL | ... Trait::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:32:25 | LL | ... ::trait_deprecated_text(&foo); @@ -100,25 +100,25 @@ error: use of deprecated function `deprecation_lint::deprecated_text`: text LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:65:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:67:25 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:69:16 | -LL | ... Trait::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:71:25 | LL | ... ::trait_deprecated_text(&foo); @@ -184,13 +184,13 @@ error: use of deprecated function `this_crate::deprecated`: text LL | deprecated(); | ^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:250:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:252:25 | LL | ::trait_deprecated(&foo); @@ -202,17 +202,17 @@ error: use of deprecated function `this_crate::deprecated_text`: text LL | deprecated_text(); | ^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:259:16 | LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:261:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated function `this_crate::deprecated_future`: text --> $DIR/deprecation-lint.rs:264:9 @@ -274,29 +274,29 @@ error: use of deprecated tuple struct `this_crate::nested::DeprecatedTupleStruct LL | ... let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:293:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:295:25 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:297:16 | LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:299:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated function `this_crate::test_fn_closure_body::{closure#0}::bar` --> $DIR/deprecation-lint.rs:317:13 @@ -352,65 +352,65 @@ error: use of deprecated tuple struct `this_crate2::Deprecated2`: text LL | let Deprecated2 | ^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:17:13 | LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:18:14 | LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:19:16 | LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:20:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:22:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:26:13 | -LL | ... foo.method_deprecated_text(); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | foo.method_deprecated_text(); + | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:27:14 | -LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Foo::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::MethodTester::method_deprecated_text`: text +error: use of deprecated method `deprecation_lint::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:28:16 | LL | ... ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:29:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:31:16 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated field `deprecation_lint::DeprecatedStruct::i`: text --> $DIR/deprecation-lint.rs:35:13 @@ -424,37 +424,37 @@ error: use of deprecated field `deprecation_lint::nested::DeprecatedStruct::i`: LL | i: 0 | ^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:64:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:66:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:68:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:70:16 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:75:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `deprecation_lint::Trait::trait_deprecated_text`: text +error: use of deprecated method `deprecation_lint::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:76:13 | LL | foo.trait_deprecated_text(); @@ -544,61 +544,61 @@ error: use of deprecated field `deprecation_lint::Deprecated2::2`: text LL | _) | ^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:246:13 | LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:247:14 | LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/deprecation-lint.rs:248:16 | LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:249:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:251:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:255:13 | -LL | ... foo.method_deprecated_text(); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | foo.method_deprecated_text(); + | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:256:14 | -LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Foo::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +error: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/deprecation-lint.rs:257:16 | -LL | ... ::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | ::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:258:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:260:16 | LL | ::trait_deprecated_text(&foo); @@ -616,37 +616,37 @@ error: use of deprecated field `this_crate::nested::DeprecatedStruct::i`: text LL | i: 0 | ^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:292:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:294:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:296:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:298:16 | LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/deprecation-lint.rs:303:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +error: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/deprecation-lint.rs:304:13 | LL | foo.trait_deprecated_text(); diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed index 99a2b0961..85e882870 100644 --- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed +++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.fixed @@ -3,7 +3,7 @@ #![deny(deprecated)] fn main() { - let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` [deprecated] + let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated method `core::str::::trim_left`: superseded by `trim_start` [deprecated] - let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` [deprecated] + let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated method `core::str::::trim_left`: superseded by `trim_start` [deprecated] } diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs index 62bf84aa3..246de2f5e 100644 --- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs +++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.rs @@ -3,7 +3,7 @@ #![deny(deprecated)] fn main() { - let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` [deprecated] + let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated method `core::str::::trim_left`: superseded by `trim_start` [deprecated] - let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` [deprecated] + let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated method `core::str::::trim_left`: superseded by `trim_start` [deprecated] } diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr index 8d4529526..3b518d180 100644 --- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr +++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr @@ -1,4 +1,4 @@ -error: use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` +error: use of deprecated method `core::str::::trim_left`: superseded by `trim_start` --> $DIR/issue-84637-deprecated-associated-function.rs:6:21 | LL | let _foo = str::trim_left(" aoeu"); @@ -9,18 +9,18 @@ note: the lint level is defined here | LL | #![deny(deprecated)] | ^^^^^^^^^^ -help: replace the use of the deprecated associated function +help: replace the use of the deprecated method | LL | let _foo = str::trim_start(" aoeu"); | ~~~~~~~~~~ -error: use of deprecated associated function `core::str::::trim_left`: superseded by `trim_start` +error: use of deprecated method `core::str::::trim_left`: superseded by `trim_start` --> $DIR/issue-84637-deprecated-associated-function.rs:8:26 | LL | let _bar = " aoeu".trim_left(); | ^^^^^^^^^ | -help: replace the use of the deprecated associated function +help: replace the use of the deprecated method | LL | let _bar = " aoeu".trim_start(); | ~~~~~~~~~~ diff --git a/tests/ui/deprecation/suggestion.stderr b/tests/ui/deprecation/suggestion.stderr index c5f2fc091..5584b6d2f 100644 --- a/tests/ui/deprecation/suggestion.stderr +++ b/tests/ui/deprecation/suggestion.stderr @@ -14,13 +14,13 @@ help: replace the use of the deprecated function LL | bar::replacement(); | ~~~~~~~~~~~ -error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement` +error: use of deprecated method `Foo::deprecated`: replaced by `replacement` --> $DIR/suggestion.rs:40:9 | LL | foo.deprecated(); | ^^^^^^^^^^ | -help: replace the use of the deprecated associated function +help: replace the use of the deprecated method | LL | foo.replacement(); | ~~~~~~~~~~~ diff --git a/tests/ui/deref-patterns/gate.stderr b/tests/ui/deref-patterns/gate.stderr index 993468b5e..b5b79ed37 100644 --- a/tests/ui/deref-patterns/gate.stderr +++ b/tests/ui/deref-patterns/gate.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match String::new() { | ------------- this expression has type `String` LL | "" | _ => {} - | ^^ expected struct `String`, found `&str` + | ^^ expected `String`, found `&str` error: aborting due to previous error diff --git a/tests/ui/derives/deriving-copyclone.stderr b/tests/ui/derives/deriving-copyclone.stderr index 9c4ca01ff..c0c2215c0 100644 --- a/tests/ui/derives/deriving-copyclone.stderr +++ b/tests/ui/derives/deriving-copyclone.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:31:13 + --> $DIR/deriving-copyclone.rs:31:26 | LL | is_copy(B { a: 1, b: C }); - | ------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `B` + | ------- ^ the trait `Copy` is not implemented for `B` | | | required by a bound introduced by this call | @@ -19,14 +19,14 @@ LL | fn is_copy(_: T) {} = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider borrowing here | -LL | is_copy(&B { a: 1, b: C }); - | + +LL | is_copy(B { a: 1, b: &C }); + | + error[E0277]: the trait bound `B: Clone` is not satisfied - --> $DIR/deriving-copyclone.rs:32:14 + --> $DIR/deriving-copyclone.rs:32:27 | LL | is_clone(B { a: 1, b: C }); - | -------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` + | -------- ^ the trait `Clone` is not implemented for `B` | | | required by a bound introduced by this call | @@ -43,14 +43,14 @@ LL | fn is_clone(_: T) {} = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider borrowing here | -LL | is_clone(&B { a: 1, b: C }); - | + +LL | is_clone(B { a: 1, b: &C }); + | + error[E0277]: the trait bound `B: Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:35:13 + --> $DIR/deriving-copyclone.rs:35:26 | LL | is_copy(B { a: 1, b: D }); - | ------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `B` + | ------- ^ the trait `Copy` is not implemented for `B` | | | required by a bound introduced by this call | @@ -67,8 +67,8 @@ LL | fn is_copy(_: T) {} = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider borrowing here | -LL | is_copy(&B { a: 1, b: D }); - | + +LL | is_copy(B { a: 1, b: &D }); + | + error: aborting due to 3 previous errors diff --git a/tests/ui/derives/deriving-with-repr-packed-2.rs b/tests/ui/derives/deriving-with-repr-packed-2.rs new file mode 100644 index 000000000..79aca74df --- /dev/null +++ b/tests/ui/derives/deriving-with-repr-packed-2.rs @@ -0,0 +1,20 @@ +// Check that deriving certain builtin traits on certain packed structs cause +// errors. To avoid potentially misaligned references, field copies must be +// used, which involves adding `T: Copy` bounds. + +#[derive(Copy, Clone, Default, PartialEq, Eq)] +#[repr(packed)] +pub struct Foo(T, T, T); + +struct NonCopy; + +fn main() { + // This one is fine because `u32` impls `Copy`. + let x: Foo = Foo(1, 2, 3); + _ = x.clone(); + + // This one is an error because `NonCopy` doesn't impl `Copy`. + let x: Foo = Foo(NonCopy, NonCopy, NonCopy); + _ = x.clone(); + //~^ ERROR the method `clone` exists for struct `Foo`, but its trait bounds were not satisfied +} diff --git a/tests/ui/derives/deriving-with-repr-packed-2.stderr b/tests/ui/derives/deriving-with-repr-packed-2.stderr new file mode 100644 index 000000000..ab3646057 --- /dev/null +++ b/tests/ui/derives/deriving-with-repr-packed-2.stderr @@ -0,0 +1,33 @@ +error[E0599]: the method `clone` exists for struct `Foo`, but its trait bounds were not satisfied + --> $DIR/deriving-with-repr-packed-2.rs:18:11 + | +LL | pub struct Foo(T, T, T); + | ----------------- + | | + | method `clone` not found for this struct + | doesn't satisfy `Foo: Clone` +LL | +LL | struct NonCopy; + | -------------- + | | + | doesn't satisfy `NonCopy: Clone` + | doesn't satisfy `NonCopy: Copy` +... +LL | _ = x.clone(); + | ^^^^^ method cannot be called on `Foo` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `NonCopy: Clone` + `NonCopy: Copy` + --> $DIR/deriving-with-repr-packed-2.rs:5:16 + | +LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] + | ^^^^^ unsatisfied trait bound introduced in this `derive` macro +help: consider annotating `NonCopy` with `#[derive(Clone, Copy)]` + | +LL | #[derive(Clone, Copy)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/derives/deriving-with-repr-packed.rs b/tests/ui/derives/deriving-with-repr-packed.rs index 3884e3977..58be45197 100644 --- a/tests/ui/derives/deriving-with-repr-packed.rs +++ b/tests/ui/derives/deriving-with-repr-packed.rs @@ -1,45 +1,46 @@ -#![deny(unaligned_references)] - // Check that deriving certain builtin traits on certain packed structs cause -// errors. This happens when the derived trait would need to use a potentially -// misaligned reference. But there are two cases that are allowed: -// - If all the fields within the struct meet the required alignment: 1 for -// `repr(packed)`, or `N` for `repr(packed(N))`. -// - If `Default` is the only trait derived, because it doesn't involve any -// references. +// errors. To avoid potentially misaligned references, field copies must be +// used, which involves adding `T: Copy` bounds. #[derive(Copy, Clone, Default, PartialEq, Eq)] -//~^ ERROR `Clone` can't be derived on this `#[repr(packed)]` struct with type or const parameters -//~| hard error -//~^^^ ERROR `PartialEq` can't be derived on this `#[repr(packed)]` struct with type or const parameters -//~| hard error #[repr(packed)] pub struct Foo(T, T, T); +// This one is fine because the fields all impl `Copy`. #[derive(Default, Hash)] -//~^ ERROR `Hash` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` -//~| hard error #[repr(packed)] pub struct Bar(u32, u32, u32); -// This one is fine because the field alignment is 1. -#[derive(Default, Hash)] -#[repr(packed)] -pub struct Bar2(u8, i8, bool); - -// This one is fine because the field alignment is 2, matching `packed(2)`. -#[derive(Default, Hash)] -#[repr(packed(2))] -pub struct Bar3(u16, i16, bool); - // This one is fine because it's not packed. #[derive(Debug, Default)] struct Y(usize); +// This one has an error because `Y` doesn't impl `Copy`. +// Note: there is room for improvement in the error message. #[derive(Debug, Default)] -//~^ ERROR `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` -//~| hard error #[repr(packed)] struct X(Y); +//~^ ERROR cannot move out of `self` which is behind a shared reference + +// This is currently allowed, but will be phased out at some point. From +// `zerovec` within icu4x-0.9.0. +#[derive(Debug)] +#[repr(packed)] +struct FlexZeroSlice { + width: u8, + data: [u8], + //~^ WARNING byte slice in a packed struct that derives a built-in trait + //~^^ this was previously accepted +} + +// Again, currently allowed, but will be phased out. +#[derive(Debug)] +#[repr(packed)] +struct WithStr { + width: u8, + data: str, + //~^ WARNING string slice in a packed struct that derives a built-in trait + //~^^ this was previously accepted +} fn main() {} diff --git a/tests/ui/derives/deriving-with-repr-packed.stderr b/tests/ui/derives/deriving-with-repr-packed.stderr index 0ad800c39..0cfe03869 100644 --- a/tests/ui/derives/deriving-with-repr-packed.stderr +++ b/tests/ui/derives/deriving-with-repr-packed.stderr @@ -1,111 +1,75 @@ -error: `Clone` can't be derived on this `#[repr(packed)]` struct with type or const parameters - --> $DIR/deriving-with-repr-packed.rs:11:16 +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-with-repr-packed.rs:31:5 | -LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] - | ^^^^^ +LL | #[derive(Debug)] + | ----- in this derive macro expansion +... +LL | data: [u8], + | ^^^^^^^^^^ | = 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 #82523 -note: the lint level is defined here - --> $DIR/deriving-with-repr-packed.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `PartialEq` can't be derived on this `#[repr(packed)]` struct with type or const parameters - --> $DIR/deriving-with-repr-packed.rs:11:32 - | -LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] - | ^^^^^^^^^ - | - = 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 #82523 - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: for more information, see issue #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `Hash` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` - --> $DIR/deriving-with-repr-packed.rs:19:19 +warning: string slice in a packed struct that derives a built-in trait + --> $DIR/deriving-with-repr-packed.rs:41:5 | -LL | #[derive(Default, Hash)] - | ^^^^ +LL | #[derive(Debug)] + | ----- in this derive macro expansion +... +LL | data: str, + | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 - = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: for more information, see issue #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` - --> $DIR/deriving-with-repr-packed.rs:39:10 +error[E0507]: cannot move out of `self` which is behind a shared reference + --> $DIR/deriving-with-repr-packed.rs:22:10 | LL | #[derive(Debug, Default)] - | ^^^^^ + | ----- in this derive macro expansion +LL | #[repr(packed)] +LL | struct X(Y); + | ^ move occurs because `self.0` has type `Y`, which does not implement the `Copy` trait | - = 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 #82523 = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 4 previous errors +error: aborting due to previous error; 2 warnings emitted +For more information about this error, try `rustc --explain E0507`. Future incompatibility report: Future breakage diagnostic: -error: `Clone` can't be derived on this `#[repr(packed)]` struct with type or const parameters - --> $DIR/deriving-with-repr-packed.rs:11:16 - | -LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] - | ^^^^^ - | - = 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 #82523 -note: the lint level is defined here - --> $DIR/deriving-with-repr-packed.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: `PartialEq` can't be derived on this `#[repr(packed)]` struct with type or const parameters - --> $DIR/deriving-with-repr-packed.rs:11:32 +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-with-repr-packed.rs:31:5 | -LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] - | ^^^^^^^^^ +LL | #[derive(Debug)] + | ----- in this derive macro expansion +... +LL | data: [u8], + | ^^^^^^^^^^ | = 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 #82523 -note: the lint level is defined here - --> $DIR/deriving-with-repr-packed.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: for more information, see issue #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: -error: `Hash` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` - --> $DIR/deriving-with-repr-packed.rs:19:19 +warning: string slice in a packed struct that derives a built-in trait + --> $DIR/deriving-with-repr-packed.rs:41:5 | -LL | #[derive(Default, Hash)] - | ^^^^ +LL | #[derive(Debug)] + | ----- in this derive macro expansion +... +LL | data: str, + | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 -note: the lint level is defined here - --> $DIR/deriving-with-repr-packed.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` - --> $DIR/deriving-with-repr-packed.rs:39:10 - | -LL | #[derive(Debug, Default)] - | ^^^^^ - | - = 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 #82523 -note: the lint level is defined here - --> $DIR/deriving-with-repr-packed.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: for more information, see issue #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/deriving/deriving-all-codegen.rs b/tests/ui/deriving/deriving-all-codegen.rs index ba7809413..51f9708d3 100644 --- a/tests/ui/deriving/deriving-all-codegen.rs +++ b/tests/ui/deriving/deriving-all-codegen.rs @@ -21,36 +21,88 @@ #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Empty; -// A basic struct. +// A basic struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Point { x: u32, y: u32, } -// A large struct. -#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +// A basic packed struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[repr(packed)] +struct PackedPoint { + x: u32, + y: u32, +} + +// A large struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Big { b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8: u32, } +// A struct that doesn't impl `Copy`, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +#[derive(Clone)] +struct NonCopy(u32); + +// A packed struct that doesn't impl `Copy`, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +#[derive(Clone)] +#[repr(packed)] +struct PackedNonCopy(u32); + +// A struct that impls `Copy` manually, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +#[derive(Clone)] +struct ManualCopy(u32); +impl Copy for ManualCopy {} + +// A packed struct that impls `Copy` manually, which means it gets the +// non-simple `clone` implemention that clones the fields individually. +#[derive(Clone)] +#[repr(packed)] +struct PackedManualCopy(u32); +impl Copy for PackedManualCopy {} + // A struct with an unsized field. Some derives are not usable in this case. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] struct Unsized([u32]); -// A packed tuple struct that impls `Copy`. -#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +// A packed struct with an unsized `[u8]` field. This is currently allowed, but +// causes a warning and will be phased out at some point. +#[derive(Debug, Hash)] #[repr(packed)] -struct PackedCopy(u32); +struct PackedUnsizedU8([u8]); +//~^ WARNING byte slice in a packed struct that derives a built-in trait +//~^^ WARNING byte slice in a packed struct that derives a built-in trait +//~^^^ this was previously accepted +//~^^^^ this was previously accepted -// A packed tuple struct that does not impl `Copy`. Note that the alignment of -// the field must be 1 for this code to be valid. Otherwise it triggers an -// error "`#[derive]` can't be used on a `#[repr(packed)]` struct that does not -// derive Copy (error E0133)" at MIR building time. This is a weird case and -// it's possible that this struct is not supposed to work, but for now it does. -#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +trait Trait { + type A; +} + +// A generic struct involving an associated type. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +struct Generic { + t: T, + ta: T::A, + u: U, +} + +// A packed, generic tuple struct involving an associated type. Because it is +// packed, a `T: Copy` bound is added to all impls (and where clauses within +// them) except for `Default`. This is because we must access fields using +// copies (e.g. `&{self.0}`), instead of using direct references (e.g. +// `&self.0`) which may be misaligned in a packed struct. +#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] #[repr(packed)] -struct PackedNonCopy(u8); +struct PackedGeneric(T, T::A, U); // An empty enum. #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] @@ -97,6 +149,13 @@ enum Fielded { Z(Option), } +// A generic enum. Note that `Default` cannot be derived for this enum. +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum EnumGeneric { + One(T), + Two(U), +} + // A union. Most builtin traits are not derivable for unions. #[derive(Clone, Copy)] pub union Union { diff --git a/tests/ui/deriving/deriving-all-codegen.stderr b/tests/ui/deriving/deriving-all-codegen.stderr new file mode 100644 index 000000000..503f0cae7 --- /dev/null +++ b/tests/ui/deriving/deriving-all-codegen.stderr @@ -0,0 +1,63 @@ +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-all-codegen.rs:80:24 + | +LL | #[derive(Debug, Hash)] + | ----- in this derive macro expansion +LL | #[repr(packed)] +LL | struct PackedUnsizedU8([u8]); + | ^^^^ + | + = 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 #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-all-codegen.rs:80:24 + | +LL | #[derive(Debug, Hash)] + | ---- in this derive macro expansion +LL | #[repr(packed)] +LL | struct PackedUnsizedU8([u8]); + | ^^^^ + | + = 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 #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: this warning originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) + +warning: 2 warnings emitted + +Future incompatibility report: Future breakage diagnostic: +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-all-codegen.rs:80:24 + | +LL | #[derive(Debug, Hash)] + | ----- in this derive macro expansion +LL | #[repr(packed)] +LL | struct PackedUnsizedU8([u8]); + | ^^^^ + | + = 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 #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + +Future breakage diagnostic: +warning: byte slice in a packed struct that derives a built-in trait + --> $DIR/deriving-all-codegen.rs:80:24 + | +LL | #[derive(Debug, Hash)] + | ---- in this derive macro expansion +LL | #[repr(packed)] +LL | struct PackedUnsizedU8([u8]); + | ^^^^ + | + = 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 #107457 + = help: consider implementing the trait by hand, or remove the `packed` attribute + = note: `#[warn(byte_slice_in_packed_struct_with_derive)]` on by default + = note: this warning originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) + diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout index e6ee11a78..5bca83e87 100644 --- a/tests/ui/deriving/deriving-all-codegen.stdout +++ b/tests/ui/deriving/deriving-all-codegen.stdout @@ -78,7 +78,8 @@ impl ::core::cmp::Ord for Empty { } } -// A basic struct. +// A basic struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. struct Point { x: u32, y: u32, @@ -97,7 +98,7 @@ impl ::core::marker::Copy for Point { } impl ::core::fmt::Debug for Point { 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) + &self.x, "y", &&self.y) } } #[automatically_derived] @@ -161,7 +162,95 @@ impl ::core::cmp::Ord for Point { } } -// A large struct. +// A basic packed struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. +#[repr(packed)] +struct PackedPoint { + x: u32, + y: u32, +} +#[automatically_derived] +impl ::core::clone::Clone for PackedPoint { + #[inline] + fn clone(&self) -> PackedPoint { + let _: ::core::clone::AssertParamIsClone; + *self + } +} +#[automatically_derived] +impl ::core::marker::Copy for PackedPoint { } +#[automatically_derived] +impl ::core::fmt::Debug for PackedPoint { + 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 }) + } +} +#[automatically_derived] +impl ::core::default::Default for PackedPoint { + #[inline] + fn default() -> PackedPoint { + PackedPoint { + x: ::core::default::Default::default(), + y: ::core::default::Default::default(), + } + } +} +#[automatically_derived] +impl ::core::hash::Hash for PackedPoint { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&{ self.x }, state); + ::core::hash::Hash::hash(&{ self.y }, state) + } +} +#[automatically_derived] +impl ::core::marker::StructuralPartialEq for PackedPoint { } +#[automatically_derived] +impl ::core::cmp::PartialEq for PackedPoint { + #[inline] + fn eq(&self, other: &PackedPoint) -> bool { + ({ self.x }) == ({ other.x }) && ({ self.y }) == ({ other.y }) + } +} +#[automatically_derived] +impl ::core::marker::StructuralEq for PackedPoint { } +#[automatically_derived] +impl ::core::cmp::Eq for PackedPoint { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } +} +#[automatically_derived] +impl ::core::cmp::PartialOrd for PackedPoint { + #[inline] + fn partial_cmp(&self, other: &PackedPoint) + -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&{ self.x }, &{ other.x }) + { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => + ::core::cmp::PartialOrd::partial_cmp(&{ self.y }, + &{ other.y }), + cmp => cmp, + } + } +} +#[automatically_derived] +impl ::core::cmp::Ord for PackedPoint { + #[inline] + fn cmp(&self, other: &PackedPoint) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&{ self.x }, &{ other.x }) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ord::cmp(&{ self.y }, &{ other.y }), + cmp => cmp, + } + } +} + +// A large struct. Note: because this derives `Copy`, it gets the simple +// `clone` implemention that just does `*self`. struct Big { b1: u32, b2: u32, @@ -176,26 +265,20 @@ struct Big { impl ::core::clone::Clone for Big { #[inline] fn clone(&self) -> Big { - Big { - b1: ::core::clone::Clone::clone(&self.b1), - b2: ::core::clone::Clone::clone(&self.b2), - b3: ::core::clone::Clone::clone(&self.b3), - b4: ::core::clone::Clone::clone(&self.b4), - b5: ::core::clone::Clone::clone(&self.b5), - b6: ::core::clone::Clone::clone(&self.b6), - b7: ::core::clone::Clone::clone(&self.b7), - b8: ::core::clone::Clone::clone(&self.b8), - } + let _: ::core::clone::AssertParamIsClone; + *self } } #[automatically_derived] +impl ::core::marker::Copy for Big { } +#[automatically_derived] impl ::core::fmt::Debug for Big { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { let names: &'static _ = &["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"]; let values: &[&dyn ::core::fmt::Debug] = - &[&&self.b1, &&self.b2, &&self.b3, &&self.b4, &&self.b5, - &&self.b6, &&self.b7, &&self.b8]; + &[&self.b1, &self.b2, &self.b3, &self.b4, &self.b5, &self.b6, + &self.b7, &&self.b8]; ::core::fmt::Formatter::debug_struct_fields_finish(f, "Big", names, values) } @@ -336,6 +419,54 @@ impl ::core::cmp::Ord for Big { } } +// A struct that doesn't impl `Copy`, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +struct NonCopy(u32); +#[automatically_derived] +impl ::core::clone::Clone for NonCopy { + #[inline] + fn clone(&self) -> NonCopy { + NonCopy(::core::clone::Clone::clone(&self.0)) + } +} + +// A packed struct that doesn't impl `Copy`, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +#[repr(packed)] +struct PackedNonCopy(u32); +#[automatically_derived] +impl ::core::clone::Clone for PackedNonCopy { + #[inline] + fn clone(&self) -> PackedNonCopy { + PackedNonCopy(::core::clone::Clone::clone(&{ self.0 })) + } +} + +// A struct that impls `Copy` manually, which means it gets the non-simple +// `clone` implemention that clones the fields individually. +struct ManualCopy(u32); +#[automatically_derived] +impl ::core::clone::Clone for ManualCopy { + #[inline] + fn clone(&self) -> ManualCopy { + ManualCopy(::core::clone::Clone::clone(&self.0)) + } +} +impl Copy for ManualCopy {} + +// A packed struct that impls `Copy` manually, which means it gets the +// non-simple `clone` implemention that clones the fields individually. +#[repr(packed)] +struct PackedManualCopy(u32); +#[automatically_derived] +impl ::core::clone::Clone for PackedManualCopy { + #[inline] + fn clone(&self) -> PackedManualCopy { + PackedManualCopy(::core::clone::Clone::clone(&{ self.0 })) + } +} +impl Copy for PackedManualCopy {} + // A struct with an unsized field. Some derives are not usable in this case. struct Unsized([u32]); #[automatically_derived] @@ -385,138 +516,265 @@ impl ::core::cmp::Ord for Unsized { } } -// A packed tuple struct that impls `Copy`. +// A packed struct with an unsized `[u8]` field. This is currently allowed, but +// causes a warning and will be phased out at some point. #[repr(packed)] -struct PackedCopy(u32); +struct PackedUnsizedU8([u8]); #[automatically_derived] -impl ::core::clone::Clone for PackedCopy { +impl ::core::fmt::Debug for PackedUnsizedU8 { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_tuple_field1_finish(f, + "PackedUnsizedU8", &&self.0) + } +} +#[automatically_derived] +impl ::core::hash::Hash for PackedUnsizedU8 { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.0, state) + } +} + +trait Trait { + type A; +} + +// A generic struct involving an associated type. +struct Generic { + t: T, + ta: T::A, + u: U, +} +#[automatically_derived] +impl + ::core::clone::Clone for Generic where T::A: ::core::clone::Clone { #[inline] - fn clone(&self) -> PackedCopy { - let _: ::core::clone::AssertParamIsClone; - *self + fn clone(&self) -> Generic { + Generic { + t: ::core::clone::Clone::clone(&self.t), + ta: ::core::clone::Clone::clone(&self.ta), + u: ::core::clone::Clone::clone(&self.u), + } } } #[automatically_derived] -impl ::core::marker::Copy for PackedCopy { } +impl + ::core::marker::Copy for Generic where T::A: ::core::marker::Copy { +} #[automatically_derived] -impl ::core::fmt::Debug for PackedCopy { +impl ::core::fmt::Debug + for Generic where T::A: ::core::fmt::Debug { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_tuple_field1_finish(f, "PackedCopy", - &&{ self.0 }) + ::core::fmt::Formatter::debug_struct_field3_finish(f, "Generic", "t", + &self.t, "ta", &self.ta, "u", &&self.u) } } #[automatically_derived] -impl ::core::default::Default for PackedCopy { +impl + ::core::default::Default for Generic where + T::A: ::core::default::Default { #[inline] - fn default() -> PackedCopy { - PackedCopy(::core::default::Default::default()) + fn default() -> Generic { + Generic { + t: ::core::default::Default::default(), + ta: ::core::default::Default::default(), + u: ::core::default::Default::default(), + } } } #[automatically_derived] -impl ::core::hash::Hash for PackedCopy { +impl ::core::hash::Hash + for Generic where T::A: ::core::hash::Hash { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&{ self.0 }, state) + ::core::hash::Hash::hash(&self.t, state); + ::core::hash::Hash::hash(&self.ta, state); + ::core::hash::Hash::hash(&self.u, state) } } #[automatically_derived] -impl ::core::marker::StructuralPartialEq for PackedCopy { } +impl ::core::marker::StructuralPartialEq for Generic { } #[automatically_derived] -impl ::core::cmp::PartialEq for PackedCopy { +impl + ::core::cmp::PartialEq for Generic where + T::A: ::core::cmp::PartialEq { #[inline] - fn eq(&self, other: &PackedCopy) -> bool { { self.0 } == { other.0 } } + fn eq(&self, other: &Generic) -> bool { + self.t == other.t && self.ta == other.ta && self.u == other.u + } } #[automatically_derived] -impl ::core::marker::StructuralEq for PackedCopy { } +impl ::core::marker::StructuralEq for Generic { } #[automatically_derived] -impl ::core::cmp::Eq for PackedCopy { +impl ::core::cmp::Eq for + Generic where T::A: ::core::cmp::Eq { #[inline] #[doc(hidden)] #[no_coverage] fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; } } #[automatically_derived] -impl ::core::cmp::PartialOrd for PackedCopy { +impl + ::core::cmp::PartialOrd for Generic where + T::A: ::core::cmp::PartialOrd { #[inline] - fn partial_cmp(&self, other: &PackedCopy) + fn partial_cmp(&self, other: &Generic) -> ::core::option::Option<::core::cmp::Ordering> { - ::core::cmp::PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 }) + match ::core::cmp::PartialOrd::partial_cmp(&self.t, &other.t) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => + match ::core::cmp::PartialOrd::partial_cmp(&self.ta, + &other.ta) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => ::core::cmp::PartialOrd::partial_cmp(&self.u, &other.u), + cmp => cmp, + }, + cmp => cmp, + } } } #[automatically_derived] -impl ::core::cmp::Ord for PackedCopy { +impl ::core::cmp::Ord for + Generic where T::A: ::core::cmp::Ord { #[inline] - fn cmp(&self, other: &PackedCopy) -> ::core::cmp::Ordering { - ::core::cmp::Ord::cmp(&{ self.0 }, &{ other.0 }) + fn cmp(&self, other: &Generic) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.t, &other.t) { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&self.ta, &other.ta) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ord::cmp(&self.u, &other.u), + cmp => cmp, + }, + cmp => cmp, + } } } -// A packed tuple struct that does not impl `Copy`. Note that the alignment of -// the field must be 1 for this code to be valid. Otherwise it triggers an -// error "`#[derive]` can't be used on a `#[repr(packed)]` struct that does not -// derive Copy (error E0133)" at MIR building time. This is a weird case and -// it's possible that this struct is not supposed to work, but for now it does. +// A packed, generic tuple struct involving an associated type. Because it is +// packed, a `T: Copy` bound is added to all impls (and where clauses within +// them) except for `Default`. This is because we must access fields using +// copies (e.g. `&{self.0}`), instead of using direct references (e.g. +// `&self.0`) which may be misaligned in a packed struct. #[repr(packed)] -struct PackedNonCopy(u8); +struct PackedGeneric(T, T::A, U); #[automatically_derived] -impl ::core::clone::Clone for PackedNonCopy { +impl ::core::clone::Clone for + PackedGeneric where T::A: ::core::clone::Clone + + ::core::marker::Copy { #[inline] - fn clone(&self) -> PackedNonCopy { - PackedNonCopy(::core::clone::Clone::clone(&self.0)) + fn clone(&self) -> PackedGeneric { + PackedGeneric(::core::clone::Clone::clone(&{ self.0 }), + ::core::clone::Clone::clone(&{ self.1 }), + ::core::clone::Clone::clone(&{ self.2 })) } } #[automatically_derived] -impl ::core::fmt::Debug for PackedNonCopy { +impl + ::core::marker::Copy for PackedGeneric where + T::A: ::core::marker::Copy { +} +#[automatically_derived] +impl ::core::fmt::Debug for + PackedGeneric where T::A: ::core::fmt::Debug + ::core::marker::Copy + { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_tuple_field1_finish(f, "PackedNonCopy", - &&self.0) + ::core::fmt::Formatter::debug_tuple_field3_finish(f, "PackedGeneric", + &{ self.0 }, &{ self.1 }, &&{ self.2 }) } } #[automatically_derived] -impl ::core::default::Default for PackedNonCopy { +impl + ::core::default::Default for PackedGeneric where + T::A: ::core::default::Default { #[inline] - fn default() -> PackedNonCopy { - PackedNonCopy(::core::default::Default::default()) + fn default() -> PackedGeneric { + PackedGeneric(::core::default::Default::default(), + ::core::default::Default::default(), + ::core::default::Default::default()) } } #[automatically_derived] -impl ::core::hash::Hash for PackedNonCopy { +impl ::core::hash::Hash for + PackedGeneric where T::A: ::core::hash::Hash + ::core::marker::Copy + { fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.0, state) + ::core::hash::Hash::hash(&{ self.0 }, state); + ::core::hash::Hash::hash(&{ self.1 }, state); + ::core::hash::Hash::hash(&{ self.2 }, state) } } #[automatically_derived] -impl ::core::marker::StructuralPartialEq for PackedNonCopy { } +impl ::core::marker::StructuralPartialEq for PackedGeneric + { +} #[automatically_derived] -impl ::core::cmp::PartialEq for PackedNonCopy { +impl ::core::cmp::PartialEq + for PackedGeneric where T::A: ::core::cmp::PartialEq + + ::core::marker::Copy { #[inline] - fn eq(&self, other: &PackedNonCopy) -> bool { self.0 == other.0 } + fn eq(&self, other: &PackedGeneric) -> bool { + ({ self.0 }) == ({ other.0 }) && ({ self.1 }) == ({ other.1 }) && + ({ self.2 }) == ({ other.2 }) + } } #[automatically_derived] -impl ::core::marker::StructuralEq for PackedNonCopy { } +impl ::core::marker::StructuralEq for PackedGeneric { } #[automatically_derived] -impl ::core::cmp::Eq for PackedNonCopy { +impl ::core::cmp::Eq for PackedGeneric where + T::A: ::core::cmp::Eq + ::core::marker::Copy { #[inline] #[doc(hidden)] #[no_coverage] fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; } } #[automatically_derived] -impl ::core::cmp::PartialOrd for PackedNonCopy { +impl ::core::cmp::PartialOrd + for PackedGeneric where T::A: ::core::cmp::PartialOrd + + ::core::marker::Copy { #[inline] - fn partial_cmp(&self, other: &PackedNonCopy) + fn partial_cmp(&self, other: &PackedGeneric) -> ::core::option::Option<::core::cmp::Ordering> { - ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0) + match ::core::cmp::PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 }) + { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => + match ::core::cmp::PartialOrd::partial_cmp(&{ self.1 }, + &{ other.1 }) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => + ::core::cmp::PartialOrd::partial_cmp(&{ self.2 }, + &{ other.2 }), + cmp => cmp, + }, + cmp => cmp, + } } } #[automatically_derived] -impl ::core::cmp::Ord for PackedNonCopy { +impl ::core::cmp::Ord for PackedGeneric where + T::A: ::core::cmp::Ord + ::core::marker::Copy { #[inline] - fn cmp(&self, other: &PackedNonCopy) -> ::core::cmp::Ordering { - ::core::cmp::Ord::cmp(&self.0, &other.0) + fn cmp(&self, other: &PackedGeneric) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&{ self.0 }, &{ other.0 }) { + ::core::cmp::Ordering::Equal => + match ::core::cmp::Ord::cmp(&{ self.1 }, &{ other.1 }) { + ::core::cmp::Ordering::Equal => + ::core::cmp::Ord::cmp(&{ self.2 }, &{ other.2 }), + cmp => cmp, + }, + cmp => cmp, + } } } @@ -826,7 +1084,7 @@ impl ::core::fmt::Debug for Mixed { &__self_0), Mixed::S { d1: __self_0, d2: __self_1 } => ::core::fmt::Formatter::debug_struct_field2_finish(f, "S", - "d1", &__self_0, "d2", &__self_1), + "d1", __self_0, "d2", &__self_1), } } } @@ -889,23 +1147,20 @@ impl ::core::cmp::PartialOrd for Mixed { -> ::core::option::Option<::core::cmp::Ordering> { let __self_tag = ::core::intrinsics::discriminant_value(self); let __arg1_tag = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => - match (self, other) { - (Mixed::R(__self_0), Mixed::R(__arg1_0)) => - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { - d1: __arg1_0, d2: __arg1_1 }) => - match ::core::cmp::PartialOrd::partial_cmp(__self_0, - __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) - => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), - cmp => cmp, - }, - _ => - ::core::option::Option::Some(::core::cmp::Ordering::Equal), + match (self, other) { + (Mixed::R(__self_0), Mixed::R(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { + d1: __arg1_0, d2: __arg1_1 }) => + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, }, - cmp => cmp, + _ => + ::core::cmp::PartialOrd::partial_cmp(&__self_tag, + &__arg1_tag), } } } @@ -1019,35 +1274,152 @@ impl ::core::cmp::PartialOrd for Fielded { -> ::core::option::Option<::core::cmp::Ordering> { let __self_tag = ::core::intrinsics::discriminant_value(self); let __arg1_tag = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => + match (self, other) { + (Fielded::X(__self_0), Fielded::X(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => + ::core::cmp::PartialOrd::partial_cmp(&__self_tag, + &__arg1_tag), + } + } +} +#[automatically_derived] +impl ::core::cmp::Ord for Fielded { + #[inline] + fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering { + let __self_tag = ::core::intrinsics::discriminant_value(self); + let __arg1_tag = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) { + ::core::cmp::Ordering::Equal => match (self, other) { (Fielded::X(__self_0), Fielded::X(__arg1_0)) => - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ::core::cmp::Ord::cmp(__self_0, __arg1_0), (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ::core::cmp::Ord::cmp(__self_0, __arg1_0), (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ::core::cmp::Ord::cmp(__self_0, __arg1_0), _ => unsafe { ::core::intrinsics::unreachable() } }, cmp => cmp, } } } + +// A generic enum. Note that `Default` cannot be derived for this enum. +enum EnumGeneric { One(T), Two(U), } #[automatically_derived] -impl ::core::cmp::Ord for Fielded { +impl ::core::clone::Clone + for EnumGeneric { #[inline] - fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering { + fn clone(&self) -> EnumGeneric { + match self { + EnumGeneric::One(__self_0) => + EnumGeneric::One(::core::clone::Clone::clone(__self_0)), + EnumGeneric::Two(__self_0) => + EnumGeneric::Two(::core::clone::Clone::clone(__self_0)), + } + } +} +#[automatically_derived] +impl ::core::marker::Copy + for EnumGeneric { +} +#[automatically_derived] +impl ::core::fmt::Debug for + EnumGeneric { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + EnumGeneric::One(__self_0) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "One", + &__self_0), + EnumGeneric::Two(__self_0) => + ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Two", + &__self_0), + } + } +} +#[automatically_derived] +impl ::core::hash::Hash for + EnumGeneric { + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_tag = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_tag, state); + match self { + EnumGeneric::One(__self_0) => + ::core::hash::Hash::hash(__self_0, state), + EnumGeneric::Two(__self_0) => + ::core::hash::Hash::hash(__self_0, state), + } + } +} +#[automatically_derived] +impl ::core::marker::StructuralPartialEq for EnumGeneric { } +#[automatically_derived] +impl + ::core::cmp::PartialEq for EnumGeneric { + #[inline] + fn eq(&self, other: &EnumGeneric) -> bool { + let __self_tag = ::core::intrinsics::discriminant_value(self); + let __arg1_tag = ::core::intrinsics::discriminant_value(other); + __self_tag == __arg1_tag && + match (self, other) { + (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => + *__self_0 == *__arg1_0, + (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => + *__self_0 == *__arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } +} +#[automatically_derived] +impl ::core::marker::StructuralEq for EnumGeneric { } +#[automatically_derived] +impl ::core::cmp::Eq for + EnumGeneric { + #[inline] + #[doc(hidden)] + #[no_coverage] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } +} +#[automatically_derived] +impl + ::core::cmp::PartialOrd for EnumGeneric { + #[inline] + fn partial_cmp(&self, other: &EnumGeneric) + -> ::core::option::Option<::core::cmp::Ordering> { + let __self_tag = ::core::intrinsics::discriminant_value(self); + let __arg1_tag = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => + ::core::cmp::PartialOrd::partial_cmp(&__self_tag, + &__arg1_tag), + } + } +} +#[automatically_derived] +impl ::core::cmp::Ord for + EnumGeneric { + #[inline] + fn cmp(&self, other: &EnumGeneric) -> ::core::cmp::Ordering { let __self_tag = ::core::intrinsics::discriminant_value(self); let __arg1_tag = ::core::intrinsics::discriminant_value(other); match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) { ::core::cmp::Ordering::Equal => match (self, other) { - (Fielded::X(__self_0), Fielded::X(__arg1_0)) => + (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => - ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => + (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), _ => unsafe { ::core::intrinsics::unreachable() } }, diff --git a/tests/ui/destructure-trait-ref.stderr b/tests/ui/destructure-trait-ref.stderr index 18a889837..38d201888 100644 --- a/tests/ui/destructure-trait-ref.stderr +++ b/tests/ui/destructure-trait-ref.stderr @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | let &&x = &1isize as &dyn T; | ^^ ----------------- this expression has type `&dyn T` | | - | expected trait object `dyn T`, found reference + | expected `dyn T`, found `&_` | = note: expected trait object `dyn T` found reference `&_` @@ -38,7 +38,7 @@ error[E0308]: mismatched types LL | let &&&x = &(&1isize as &dyn T); | ^^ -------------------- this expression has type `&&dyn T` | | - | expected trait object `dyn T`, found reference + | expected `dyn T`, found `&_` | = note: expected trait object `dyn T` found reference `&_` @@ -54,7 +54,7 @@ error[E0308]: mismatched types LL | let box box x = Box::new(1isize) as Box; | ^^^^^ ------------------------------ this expression has type `Box` | | - | expected trait object `dyn T`, found struct `Box` + | expected `dyn T`, found `Box<_>` | = note: expected trait object `dyn T` found struct `Box<_>` diff --git a/tests/ui/destructuring-assignment/default-match-bindings-forbidden.stderr b/tests/ui/destructuring-assignment/default-match-bindings-forbidden.stderr index 950e0223e..b285ee1f3 100644 --- a/tests/ui/destructuring-assignment/default-match-bindings-forbidden.stderr +++ b/tests/ui/destructuring-assignment/default-match-bindings-forbidden.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | (x, y) = &(1, 2); | ^^^^^^ ------- this expression has type `&({integer}, {integer})` | | - | expected reference, found tuple + | expected `&({integer}, {integer})`, found `(_, _)` | = note: expected reference `&({integer}, {integer})` found tuple `(_, _)` diff --git a/tests/ui/diagnostic-flags/terminal_urls.rs b/tests/ui/diagnostic-flags/terminal_urls.rs new file mode 100644 index 000000000..1f04e2aad --- /dev/null +++ b/tests/ui/diagnostic-flags/terminal_urls.rs @@ -0,0 +1,4 @@ +// compile-flags: -Zterminal-urls=yes +fn main() { + let () = 4; //~ ERROR +} diff --git a/tests/ui/diagnostic-flags/terminal_urls.stderr b/tests/ui/diagnostic-flags/terminal_urls.stderr new file mode 100644 index 000000000..7f7e69c5d --- /dev/null +++ b/tests/ui/diagnostic-flags/terminal_urls.stderr @@ -0,0 +1,11 @@ +error[]8;;https://doc.rust-lang.org/error_codes/E0308.htmlE0308]8;;]: mismatched types + --> $DIR/terminal_urls.rs:3:9 + | +LL | let () = 4; + | ^^ - this expression has type `{integer}` + | | + | expected integer, found `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/diagnostic-width/long-E0308.stderr b/tests/ui/diagnostic-width/long-E0308.stderr index 1c99898bc..20b018b9f 100644 --- a/tests/ui/diagnostic-width/long-E0308.stderr +++ b/tests/ui/diagnostic-width/long-E0308.stderr @@ -16,7 +16,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok... LL | | Ok("") LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))))))))); - | |__________________________________^ expected struct `Atype`, found enum `Result` + | |__________________________________^ expected `Atype, ...>`, found `Result, ...>` | = note: expected struct `Atype, ...>` the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' @@ -32,7 +32,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))); - | |____________________________^ expected enum `Option`, found enum `Result` + | |____________________________^ expected `Option>`, found `Result, ...>` | = note: expected enum `Option>` the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' @@ -50,7 +50,7 @@ LL | | Atype< ... | LL | | i32 LL | | > = (); - | | - ^^ expected struct `Atype`, found `()` + | | - ^^ expected `Atype, ...>`, found `()` | |_____| | expected due to this | @@ -69,7 +69,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))); - | |____________________________^ expected `()`, found enum `Result` + | |____________________________^ expected `()`, found `Result, ...>` | = note: expected unit type `()` found enum `Result, ...>` diff --git a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr index 6ded03e45..a7ec19259 100644 --- a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr +++ b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/brackets-to-braces-single-element.rs:1:24 | LL | const A: [&str; 1] = { "hello" }; - | ^^^^^^^ expected array `[&'static str; 1]`, found `&str` + | ^^^^^^^ expected `[&str; 1]`, found `&str` | help: to create an array, use square brackets instead of curly braces | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/brackets-to-braces-single-element.rs:4:19 | LL | const B: &[u32] = &{ 1 }; - | ^^^^^^ expected slice `[u32]`, found integer + | ^^^^^^ expected `&[u32]`, found `&{integer}` | = note: expected reference `&'static [u32]` found reference `&{integer}` @@ -26,7 +26,7 @@ error[E0308]: mismatched types --> $DIR/brackets-to-braces-single-element.rs:7:27 | LL | const C: &&[u32; 1] = &&{ 1 }; - | ^ expected array `[u32; 1]`, found integer + | ^ expected `[u32; 1]`, found integer | help: to create an array, use square brackets instead of curly braces | diff --git a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr index 473468af6..5e48871bb 100644 --- a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr +++ b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match f { | - this expression has type `Foo` LL | Bar { x } => { - | ^^^^^^^^^ expected enum `Foo`, found struct `Bar` + | ^^^^^^^^^ expected `Foo`, found `Bar` | help: try wrapping the pattern in `Foo::Bar` | @@ -22,7 +22,7 @@ LL | match s { LL | S => { | ^ | | - | expected enum `Option`, found struct `S` + | expected `Option`, found `S` | `S` is interpreted as a unit struct, not a new binding | = note: expected enum `Option` @@ -47,7 +47,7 @@ LL | match s { LL | S => { | ^ | | - | expected enum `Result`, found struct `S` + | expected `Result`, found `S` | `S` is interpreted as a unit struct, not a new binding | = note: expected enum `Result` diff --git a/tests/ui/did_you_mean/compatible-variants.stderr b/tests/ui/did_you_mean/compatible-variants.stderr index fe81da198..7b88d93ea 100644 --- a/tests/ui/did_you_mean/compatible-variants.stderr +++ b/tests/ui/did_you_mean/compatible-variants.stderr @@ -7,7 +7,7 @@ LL | / while false { LL | | LL | | f(); LL | | } - | |_____^ expected enum `Option`, found `()` + | |_____^ expected `Option<()>`, found `()` | = note: expected enum `Option<()>` found unit type `()` @@ -26,7 +26,7 @@ error[E0308]: mismatched types LL | fn b() -> Result<(), ()> { | -------------- expected `Result<(), ()>` because of return type LL | f() - | ^^^ expected enum `Result`, found `()` + | ^^^ expected `Result<(), ()>`, found `()` | = note: expected enum `Result<(), ()>` found unit type `()` @@ -45,7 +45,7 @@ LL | / for _ in [1, 2] { LL | | LL | | f(); LL | | } - | |_____^ expected enum `Option`, found `()` + | |_____^ expected `Option<()>`, found `()` | = note: expected enum `Option<()>` found unit type `()` @@ -62,7 +62,7 @@ error[E0308]: `?` operator has incompatible types --> $DIR/compatible-variants.rs:35:5 | LL | c()? - | ^^^^ expected enum `Option`, found `()` + | ^^^^ expected `Option<()>`, found `()` | = note: `?` operator cannot convert from `()` to `Option<()>` = note: expected enum `Option<()>` @@ -85,7 +85,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:42:25 | LL | let _: Option<()> = while false {}; - | ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()` + | ---------- ^^^^^^^^^^^^^^ expected `Option<()>`, found `()` | | | expected due to this | @@ -100,7 +100,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:46:9 | LL | while false {} - | ^^^^^^^^^^^^^^ expected enum `Option`, found `()` + | ^^^^^^^^^^^^^^ expected `Option<()>`, found `()` | = note: expected enum `Option<()>` found unit type `()` @@ -117,7 +117,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:50:31 | LL | let _: Result = 1; - | ---------------- ^ expected enum `Result`, found integer + | ---------------- ^ expected `Result`, found integer | | | expected due to this | @@ -134,7 +134,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:53:26 | LL | let _: Option = 1; - | ----------- ^ expected enum `Option`, found integer + | ----------- ^ expected `Option`, found integer | | | expected due to this | @@ -149,7 +149,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:56:28 | LL | let _: Hey = 1; - | ------------- ^ expected enum `Hey`, found integer + | ------------- ^ expected `Hey`, found integer | | | expected due to this | @@ -166,7 +166,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:59:29 | LL | let _: Hey = false; - | -------------- ^^^^^ expected enum `Hey`, found `bool` + | -------------- ^^^^^ expected `Hey`, found `bool` | | | expected due to this | @@ -181,7 +181,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:63:19 | LL | let _ = Foo { bar }; - | ^^^ expected enum `Option`, found `i32` + | ^^^ expected `Option`, found `i32` | = note: expected enum `Option` found type `i32` @@ -194,7 +194,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:80:16 | LL | let a: A = B::Fst; - | - ^^^^^^ expected enum `A`, found enum `B` + | - ^^^^^^ expected `A`, found `B` | | | expected due to this | @@ -207,7 +207,7 @@ error[E0308]: mismatched types --> $DIR/compatible-variants.rs:86:17 | LL | let a: A2 = B::Fst; - | -- ^^^^^^ expected struct `A2`, found enum `B` + | -- ^^^^^^ expected `A2`, found `B` | | | expected due to this | diff --git a/tests/ui/did_you_mean/issue-42764.stderr b/tests/ui/did_you_mean/issue-42764.stderr index 6a7fd8fe2..3819a5a18 100644 --- a/tests/ui/did_you_mean/issue-42764.stderr +++ b/tests/ui/did_you_mean/issue-42764.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-42764.rs:11:43 | LL | this_function_expects_a_double_option(n); - | ------------------------------------- ^ expected enum `DoubleOption`, found `usize` + | ------------------------------------- ^ expected `DoubleOption<_>`, found `usize` | | | arguments to this function are incorrect | @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/issue-42764.rs:27:33 | LL | let _c = Context { wrapper: Payload{} }; - | ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload` + | ^^^^^^^^^ expected `Wrapper`, found `Payload` | help: try wrapping the expression in `Wrapper` | diff --git a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr index bfe1ed328..589b2c378 100644 --- a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr +++ b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr @@ -2,7 +2,12 @@ error: expected field pattern, found `...` --> $DIR/issue-46718-struct-pattern-dotdotdot.rs:11:55 | LL | PersonalityInventory { expressivity: exp, ... } => exp - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | PersonalityInventory { expressivity: exp, .. } => exp + | ~~ error: aborting due to previous error diff --git a/tests/ui/did_you_mean/println-typo.rs b/tests/ui/did_you_mean/println-typo.rs new file mode 100644 index 000000000..685b5e1f2 --- /dev/null +++ b/tests/ui/did_you_mean/println-typo.rs @@ -0,0 +1,6 @@ +// https://internals.rust-lang.org/t/18227 + +fn main() { + prinltn!(); //~ ERROR cannot find macro `prinltn` in this scope + //^ a macro with a similar name exists: `println` +} diff --git a/tests/ui/did_you_mean/println-typo.stderr b/tests/ui/did_you_mean/println-typo.stderr new file mode 100644 index 000000000..43b7b1894 --- /dev/null +++ b/tests/ui/did_you_mean/println-typo.stderr @@ -0,0 +1,11 @@ +error: cannot find macro `prinltn` in this scope + --> $DIR/println-typo.rs:4:5 + | +LL | prinltn!(); + | ^^^^^^^ help: a macro with a similar name exists: `println` + --> $SRC_DIR/std/src/macros.rs:LL:COL + | + = note: similarly named macro `println` defined here + +error: aborting due to previous error + diff --git a/tests/ui/did_you_mean/recursion_limit_deref.stderr b/tests/ui/did_you_mean/recursion_limit_deref.stderr index a6b5681a6..32fb628c4 100644 --- a/tests/ui/did_you_mean/recursion_limit_deref.stderr +++ b/tests/ui/did_you_mean/recursion_limit_deref.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types --> $DIR/recursion_limit_deref.rs:51:22 | LL | let x: &Bottom = &t; - | ------- ^^ expected struct `Bottom`, found struct `Top` + | ------- ^^ expected `&Bottom`, found `&Top` | | | expected due to this | diff --git a/tests/ui/disambiguate-identical-names.stderr b/tests/ui/disambiguate-identical-names.stderr index 87560c4c7..7d8293018 100644 --- a/tests/ui/disambiguate-identical-names.stderr +++ b/tests/ui/disambiguate-identical-names.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/disambiguate-identical-names.rs:13:10 | LL | test(&v); - | ---- ^^ expected struct `Vec`, found struct `HashMap` + | ---- ^^ expected `&Vec>`, found `&HashMap` | | | arguments to this function are incorrect | diff --git a/tests/ui/diverging-fn-tail-35849.stderr b/tests/ui/diverging-fn-tail-35849.stderr index 21361489a..f5b5a4ccc 100644 --- a/tests/ui/diverging-fn-tail-35849.stderr +++ b/tests/ui/diverging-fn-tail-35849.stderr @@ -5,7 +5,7 @@ LL | fn assert_sizeof() -> ! { | - expected `!` because of return type LL | unsafe { LL | ::std::mem::transmute::(panic!()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found array `[u8; 8]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `[u8; 8]` | = note: expected type `!` found array `[u8; 8]` diff --git a/tests/ui/drop/issue-2735-2.rs b/tests/ui/drop/issue-2735-2.rs new file mode 100644 index 000000000..70ebce9d3 --- /dev/null +++ b/tests/ui/drop/issue-2735-2.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-3 +struct defer<'a> { + b: &'a Cell, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + let _ = defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/tests/ui/drop/issue-2735-3.rs b/tests/ui/drop/issue-2735-3.rs new file mode 100644 index 000000000..233015378 --- /dev/null +++ b/tests/ui/drop/issue-2735-3.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-2 +struct defer<'a> { + b: &'a Cell, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/tests/ui/drop/issue-2735.rs b/tests/ui/drop/issue-2735.rs new file mode 100644 index 000000000..20d3949a9 --- /dev/null +++ b/tests/ui/drop/issue-2735.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +trait hax { + fn dummy(&self) { } +} +impl hax for A { } + +fn perform_hax(x: Box) -> Box { + Box::new(x) as Box +} + +fn deadcode() { + perform_hax(Box::new("deadcode".to_string())); +} + +pub fn main() { + perform_hax(Box::new(42)); +} diff --git a/tests/ui/dropck/drop-with-active-borrows-1.stderr b/tests/ui/dropck/drop-with-active-borrows-1.stderr index 8d6a7f372..4585b2297 100644 --- a/tests/ui/dropck/drop-with-active-borrows-1.stderr +++ b/tests/ui/dropck/drop-with-active-borrows-1.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/drop-with-active-borrows-1.rs:4:10 | +LL | let a = "".to_string(); + | - binding `a` declared here LL | let b: Vec<&str> = a.lines().collect(); | --------- borrow of `a` occurs here LL | drop(a); diff --git a/tests/ui/dropck/dropck-eyepatch-extern-crate.stderr b/tests/ui/dropck/dropck-eyepatch-extern-crate.stderr index 5d5340557..23d57634e 100644 --- a/tests/ui/dropck/dropck-eyepatch-extern-crate.stderr +++ b/tests/ui/dropck/dropck-eyepatch-extern-crate.stderr @@ -1,6 +1,9 @@ error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch-extern-crate.rs:46:23 | +LL | let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | dt = Dt("dt", &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch-extern-crate.rs:68:32 | +LL | let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | pt = Pt("pt", &c_long, &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/dropck/dropck-eyepatch-reorder.stderr b/tests/ui/dropck/dropck-eyepatch-reorder.stderr index 5055cdd8b..a5d5136b5 100644 --- a/tests/ui/dropck/dropck-eyepatch-reorder.stderr +++ b/tests/ui/dropck/dropck-eyepatch-reorder.stderr @@ -1,6 +1,9 @@ error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch-reorder.rs:64:23 | +LL | let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | dt = Dt("dt", &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch-reorder.rs:86:32 | +LL | let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | pt = Pt("pt", &c_long, &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/dropck/dropck-eyepatch.stderr b/tests/ui/dropck/dropck-eyepatch.stderr index 21295e6c6..dc3f8c05e 100644 --- a/tests/ui/dropck/dropck-eyepatch.stderr +++ b/tests/ui/dropck/dropck-eyepatch.stderr @@ -1,6 +1,9 @@ error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch.rs:88:23 | +LL | let (mut dt, mut dr, c_shortest): (Dt<_>, Dr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | dt = Dt("dt", &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `c_shortest` does not live long enough --> $DIR/dropck-eyepatch.rs:110:32 | +LL | let (mut pt, mut pr, c_shortest): (Pt<_, _>, Pr<_>, Cell<_>); + | ---------- binding `c_shortest` declared here +... LL | pt = Pt("pt", &c_long, &c_shortest); | ^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/dropck/dropck-union.stderr b/tests/ui/dropck/dropck-union.stderr index 854e29385..7d48e9fdc 100644 --- a/tests/ui/dropck/dropck-union.stderr +++ b/tests/ui/dropck/dropck-union.stderr @@ -1,6 +1,8 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:37:18 | +LL | let v : Wrap = Wrap::new(C(Cell::new(None))); + | - binding `v` declared here LL | v.0.set(Some(&v)); | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/dropck/dropck_trait_cycle_checked.stderr b/tests/ui/dropck/dropck_trait_cycle_checked.stderr index dc3fbed59..4d4f7b9df 100644 --- a/tests/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/tests/ui/dropck/dropck_trait_cycle_checked.stderr @@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` + | -- binding `o2` declared here -------- cast requires that `o2` is borrowed for `'static` LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... @@ -13,7 +13,7 @@ error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` + | -- binding `o3` declared here -------- cast requires that `o3` is borrowed for `'static` LL | o1.set0(&o2); LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough @@ -25,7 +25,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:113:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` + | -- binding `o2` declared here -------- cast requires that `o2` is borrowed for `'static` ... LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough @@ -37,7 +37,7 @@ error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o3` is borrowed for `'static` + | -- binding `o3` declared here -------- cast requires that `o3` is borrowed for `'static` ... LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough @@ -49,7 +49,7 @@ error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o1` is borrowed for `'static` + | -- binding `o1` declared here -------- cast requires that `o1` is borrowed for `'static` ... LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough @@ -61,7 +61,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -------- cast requires that `o2` is borrowed for `'static` + | -- binding `o2` declared here -------- cast requires that `o2` is borrowed for `'static` ... LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough diff --git a/tests/ui/dst/dst-bad-assign-3.rs b/tests/ui/dst/dst-bad-assign-3.rs index d05b3937c..d199864d9 100644 --- a/tests/ui/dst/dst-bad-assign-3.rs +++ b/tests/ui/dst/dst-bad-assign-3.rs @@ -32,7 +32,7 @@ pub fn main() { let z: Box = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected trait object `dyn ToBar`, found struct `Bar1` + //~| expected `dyn ToBar`, found `Bar1` //~| expected trait object `dyn ToBar` //~| found struct `Bar1` //~| ERROR the size for values of type diff --git a/tests/ui/dst/dst-bad-assign-3.stderr b/tests/ui/dst/dst-bad-assign-3.stderr index b326dbbbc..6dd3434fd 100644 --- a/tests/ui/dst/dst-bad-assign-3.stderr +++ b/tests/ui/dst/dst-bad-assign-3.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-assign-3.rs:33:12 | LL | f5.2 = Bar1 {f: 36}; - | ---- ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1` + | ---- ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1` | | | expected due to the type of this binding | diff --git a/tests/ui/dst/dst-bad-assign.rs b/tests/ui/dst/dst-bad-assign.rs index 496e01ae0..c55fb2c3e 100644 --- a/tests/ui/dst/dst-bad-assign.rs +++ b/tests/ui/dst/dst-bad-assign.rs @@ -34,7 +34,7 @@ pub fn main() { let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected trait object `dyn ToBar`, found struct `Bar1` + //~| expected `dyn ToBar`, found `Bar1` //~| expected trait object `dyn ToBar` //~| found struct `Bar1` //~| ERROR the size for values of type diff --git a/tests/ui/dst/dst-bad-assign.stderr b/tests/ui/dst/dst-bad-assign.stderr index 614f21387..d8d105787 100644 --- a/tests/ui/dst/dst-bad-assign.stderr +++ b/tests/ui/dst/dst-bad-assign.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-assign.rs:35:14 | LL | f5.ptr = Bar1 {f: 36}; - | ------ ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1` + | ------ ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1` | | | expected due to the type of this binding | diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr index 594acff85..ff77bd4ce 100644 --- a/tests/ui/dst/dst-bad-coerce1.stderr +++ b/tests/ui/dst/dst-bad-coerce1.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce1.rs:16:29 | LL | let f3: &Fat<[usize]> = f2; - | ------------- ^^ expected slice `[usize]`, found array `[isize; 3]` + | ------------- ^^ expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>` | | | expected due to this | @@ -21,7 +21,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce1.rs:28:27 | LL | let f3: &([usize],) = f2; - | ----------- ^^ expected slice `[usize]`, found array `[isize; 3]` + | ----------- ^^ expected `&([usize],)`, found `&([isize; 3],)` | | | expected due to this | diff --git a/tests/ui/dst/dst-bad-coerce3.stderr b/tests/ui/dst/dst-bad-coerce3.stderr index 957e98bbe..1254250bc 100644 --- a/tests/ui/dst/dst-bad-coerce3.stderr +++ b/tests/ui/dst/dst-bad-coerce3.stderr @@ -3,7 +3,9 @@ error[E0597]: `f1` does not live long enough | LL | fn baz<'a>() { | -- lifetime `'a` defined here -... +LL | // With a vec of ints. +LL | let f1 = Fat { ptr: [1, 2, 3] }; + | -- binding `f1` declared here LL | let f2: &Fat<[isize; 3]> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<[isize]> = f2; @@ -18,6 +20,8 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... +LL | let f1 = Fat { ptr: Foo }; + | -- binding `f1` declared here LL | let f2: &Fat = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat = f2; @@ -32,6 +36,8 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... +LL | let f1 = ([1, 2, 3],); + | -- binding `f1` declared here LL | let f2: &([isize; 3],) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a ([isize],) = f2; @@ -46,6 +52,8 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... +LL | let f1 = (Foo,); + | -- binding `f1` declared here LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a (dyn Bar,) = f2; diff --git a/tests/ui/dst/dst-bad-coerce4.rs b/tests/ui/dst/dst-bad-coerce4.rs index f63da60d2..9f297915e 100644 --- a/tests/ui/dst/dst-bad-coerce4.rs +++ b/tests/ui/dst/dst-bad-coerce4.rs @@ -11,7 +11,7 @@ pub fn main() { let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; let f2: &Fat<[isize; 3]> = f1; //~^ ERROR mismatched types - //~| expected array `[isize; 3]`, found slice `[isize]` + //~| expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` //~| expected reference `&Fat<[isize; 3]>` //~| found reference `&Fat<[isize]>` @@ -19,7 +19,7 @@ pub fn main() { let f1: &([isize],) = &([1, 2, 3],); let f2: &([isize; 3],) = f1; //~^ ERROR mismatched types - //~| expected array `[isize; 3]`, found slice `[isize]` + //~| expected `&([isize; 3],)`, found `&([isize],)` //~| expected reference `&([isize; 3],)` //~| found reference `&([isize],)` } diff --git a/tests/ui/dst/dst-bad-coerce4.stderr b/tests/ui/dst/dst-bad-coerce4.stderr index 4c9954f35..46e7dba81 100644 --- a/tests/ui/dst/dst-bad-coerce4.stderr +++ b/tests/ui/dst/dst-bad-coerce4.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce4.rs:12:32 | LL | let f2: &Fat<[isize; 3]> = f1; - | ---------------- ^^ expected array `[isize; 3]`, found slice `[isize]` + | ---------------- ^^ expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>` | | | expected due to this | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce4.rs:20:30 | LL | let f2: &([isize; 3],) = f1; - | -------------- ^^ expected array `[isize; 3]`, found slice `[isize]` + | -------------- ^^ expected `&([isize; 3],)`, found `&([isize],)` | | | expected due to this | diff --git a/tests/ui/dyn-star/align.over_aligned.stderr b/tests/ui/dyn-star/align.over_aligned.stderr index 62e28efab..0365d87a6 100644 --- a/tests/ui/dyn-star/align.over_aligned.stderr +++ b/tests/ui/dyn-star/align.over_aligned.stderr @@ -7,13 +7,13 @@ LL | #![feature(dyn_star)] = note: see issue #102425 for more information = note: `#[warn(incomplete_features)]` on by default -error[E0277]: `AlignedUsize` needs to be a pointer-sized type +error[E0277]: `AlignedUsize` needs to have the same alignment and size as a pointer --> $DIR/align.rs:15:13 | LL | let x = AlignedUsize(12) as dyn* Debug; - | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-sized type + | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-like type | - = help: the trait `PointerSized` is not implemented for `AlignedUsize` + = help: the trait `PointerLike` is not implemented for `AlignedUsize` error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/dyn-star/align.rs b/tests/ui/dyn-star/align.rs index fb41a05a0..6679997a9 100644 --- a/tests/ui/dyn-star/align.rs +++ b/tests/ui/dyn-star/align.rs @@ -13,5 +13,5 @@ struct AlignedUsize(usize); fn main() { let x = AlignedUsize(12) as dyn* Debug; - //[over_aligned]~^ ERROR `AlignedUsize` needs to be a pointer-sized type + //[over_aligned]~^ ERROR `AlignedUsize` needs to have the same alignment and size as a pointer } diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs index e19e36cc7..85749aa7b 100644 --- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs +++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs @@ -9,7 +9,7 @@ fn dyn_debug(_: (dyn* Debug + '_)) { fn polymorphic(t: &T) { dyn_debug(t); - //~^ ERROR `&T` needs to be a pointer-sized type + //~^ ERROR `&T` needs to have the same alignment and size as a pointer } fn main() {} diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr index 53ccbe43d..350630f79 100644 --- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr +++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr @@ -1,14 +1,14 @@ -error[E0277]: `&T` needs to be a pointer-sized type +error[E0277]: `&T` needs to have the same alignment and size as a pointer --> $DIR/check-size-at-cast-polymorphic-bad.rs:11:15 | LL | dyn_debug(t); - | ^ `&T` needs to be a pointer-sized type + | ^ `&T` needs to be a pointer-like type | - = help: the trait `PointerSized` is not implemented for `&T` + = help: the trait `PointerLike` is not implemented for `&T` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | fn polymorphic(t: &T) where &T: PointerSized { - | ++++++++++++++++++++++ +LL | fn polymorphic(t: &T) where &T: PointerLike { + | +++++++++++++++++++++ error: aborting due to previous error diff --git a/tests/ui/dyn-star/check-size-at-cast.rs b/tests/ui/dyn-star/check-size-at-cast.rs index 1f22f7983..17bc4f303 100644 --- a/tests/ui/dyn-star/check-size-at-cast.rs +++ b/tests/ui/dyn-star/check-size-at-cast.rs @@ -5,6 +5,6 @@ use std::fmt::Debug; fn main() { let i = [1, 2, 3, 4] as dyn* Debug; - //~^ ERROR `[i32; 4]` needs to be a pointer-sized type + //~^ ERROR `[i32; 4]` needs to have the same alignment and size as a pointer dbg!(i); } diff --git a/tests/ui/dyn-star/check-size-at-cast.stderr b/tests/ui/dyn-star/check-size-at-cast.stderr index af2a1ccf7..19700b406 100644 --- a/tests/ui/dyn-star/check-size-at-cast.stderr +++ b/tests/ui/dyn-star/check-size-at-cast.stderr @@ -1,10 +1,10 @@ -error[E0277]: `[i32; 4]` needs to be a pointer-sized type +error[E0277]: `[i32; 4]` needs to have the same alignment and size as a pointer --> $DIR/check-size-at-cast.rs:7:13 | LL | let i = [1, 2, 3, 4] as dyn* Debug; - | ^^^^^^^^^^^^ `[i32; 4]` needs to be a pointer-sized type + | ^^^^^^^^^^^^ `[i32; 4]` needs to be a pointer-like type | - = help: the trait `PointerSized` is not implemented for `[i32; 4]` + = help: the trait `PointerLike` is not implemented for `[i32; 4]` error: aborting due to previous error diff --git a/tests/ui/dyn-star/dyn-star-to-dyn.rs b/tests/ui/dyn-star/dyn-star-to-dyn.rs index a6d9df952..1d974b7ec 100644 --- a/tests/ui/dyn-star/dyn-star-to-dyn.rs +++ b/tests/ui/dyn-star/dyn-star-to-dyn.rs @@ -1,9 +1,17 @@ -// build-pass +// run-pass #![feature(dyn_star)] //~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes +use std::fmt::Debug; + fn main() { - let x: dyn* Send = &(); - let x = Box::new(x) as Box; + let x: dyn* Debug = &42; + let x = Box::new(x) as Box; + assert_eq!("42", format!("{x:?}")); + + // Also test opposite direction. + let x: Box = Box::new(42); + let x = &x as dyn* Debug; + assert_eq!("42", format!("{x:?}")); } diff --git a/tests/ui/dyn-star/llvm-old-style-ptrs.rs b/tests/ui/dyn-star/llvm-old-style-ptrs.rs new file mode 100644 index 000000000..d35519632 --- /dev/null +++ b/tests/ui/dyn-star/llvm-old-style-ptrs.rs @@ -0,0 +1,23 @@ +// run-pass +// compile-flags: -Copt-level=0 -Cllvm-args=-opaque-pointers=0 + +// (opaque-pointers flag is called force-opaque-pointers in LLVM 13...) +// min-llvm-version: 14.0 + +// This test can be removed once non-opaque pointers are gone from LLVM, maybe. + +#![feature(dyn_star, pointer_like_trait)] +#![allow(incomplete_features)] + +use std::fmt::Debug; +use std::marker::PointerLike; + +fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a { + t as _ +} + +fn main() { + println!("{:?}", make_dyn_star(Box::new(1i32))); + println!("{:?}", make_dyn_star(2usize)); + println!("{:?}", make_dyn_star((3usize,))); +} diff --git a/tests/ui/dyn-star/no-implicit-dyn-star.stderr b/tests/ui/dyn-star/no-implicit-dyn-star.stderr index a3f4d21ca..66e1b9a09 100644 --- a/tests/ui/dyn-star/no-implicit-dyn-star.stderr +++ b/tests/ui/dyn-star/no-implicit-dyn-star.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/no-implicit-dyn-star.rs:6:48 | LL | dyn_star_foreign::require_dyn_star_display(1usize); - | ------------------------------------------ ^^^^^^ expected trait object `dyn Display`, found `usize` + | ------------------------------------------ ^^^^^^ expected `dyn Display`, found `usize` | | | arguments to this function are incorrect | diff --git a/tests/ui/dyn-star/upcast.stderr b/tests/ui/dyn-star/upcast.stderr index 74ccd6a18..e60144fea 100644 --- a/tests/ui/dyn-star/upcast.stderr +++ b/tests/ui/dyn-star/upcast.stderr @@ -7,13 +7,13 @@ LL | #![feature(dyn_star, trait_upcasting)] = note: see issue #102425 for more information = note: `#[warn(incomplete_features)]` on by default -error[E0277]: `dyn* Foo` needs to be a pointer-sized type +error[E0277]: `dyn* Foo` needs to have the same alignment and size as a pointer --> $DIR/upcast.rs:30:23 | LL | let w: dyn* Bar = w; - | ^ `dyn* Foo` needs to be a pointer-sized type + | ^ `dyn* Foo` needs to be a pointer-like type | - = help: the trait `PointerSized` is not implemented for `dyn* Foo` + = help: the trait `PointerLike` is not implemented for `dyn* Foo` error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 0e580aede..4604ebeaa 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -100,7 +100,7 @@ help: a unit struct with a similar name exists LL | let xe1 = XEmpty2(); | ~~~~~~~ -error[E0599]: no variant or associated item named `Empty3` found for enum `XE` in the current scope +error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:25:19 | LL | let xe3 = XE::Empty3; @@ -109,7 +109,7 @@ LL | let xe3 = XE::Empty3; | variant or associated item not found in `XE` | help: there is a variant with a similar name: `XEmpty3` -error[E0599]: no variant or associated item named `Empty3` found for enum `XE` in the current scope +error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 | LL | let xe3 = XE::Empty3(); diff --git a/tests/ui/empty/issue-37026.stderr b/tests/ui/empty/issue-37026.stderr index 48a4a5bca..75c3ab13c 100644 --- a/tests/ui/empty/issue-37026.stderr +++ b/tests/ui/empty/issue-37026.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let empty_struct::XEmpty2 = (); | ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()` | | - | expected `()`, found struct `XEmpty2` + | expected `()`, found `XEmpty2` error[E0308]: mismatched types --> $DIR/issue-37026.rs:7:9 @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | let empty_struct::XEmpty6(..) = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()` | | - | expected `()`, found struct `XEmpty6` + | expected `()`, found `XEmpty6` error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr index 163737895..9b0cf0698 100644 --- a/tests/ui/error-codes/E0057.stderr +++ b/tests/ui/error-codes/E0057.stderr @@ -18,17 +18,16 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); - | ^ - argument of type `{integer}` unexpected + | ^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: closure defined here --> $DIR/E0057.rs:2:13 | LL | let f = |x| x * 3; | ^^^ -help: remove the extra argument - | -LL | let c = f(2); - | ~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0071.rs b/tests/ui/error-codes/E0071.rs index bd8469de7..678502ba3 100644 --- a/tests/ui/error-codes/E0071.rs +++ b/tests/ui/error-codes/E0071.rs @@ -3,5 +3,5 @@ type FooAlias = Foo; fn main() { let u = FooAlias { value: 0 }; - //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071] + //~^ ERROR expected struct, variant or union type, found `Foo` [E0071] } diff --git a/tests/ui/error-codes/E0071.stderr b/tests/ui/error-codes/E0071.stderr index ae312fc40..7bd4ddaf2 100644 --- a/tests/ui/error-codes/E0071.stderr +++ b/tests/ui/error-codes/E0071.stderr @@ -1,4 +1,4 @@ -error[E0071]: expected struct, variant or union type, found enum `Foo` +error[E0071]: expected struct, variant or union type, found `Foo` --> $DIR/E0071.rs:5:13 | LL | let u = FooAlias { value: 0 }; diff --git a/tests/ui/error-codes/E0107.rs b/tests/ui/error-codes/E0107.rs index d369fc2a5..fd23e7c00 100644 --- a/tests/ui/error-codes/E0107.rs +++ b/tests/ui/error-codes/E0107.rs @@ -11,39 +11,39 @@ enum Bar { struct Baz<'a, 'b, 'c> { buzz: Buzz<'a>, - //~^ ERROR this struct takes 2 lifetime arguments + //~^ ERROR struct takes 2 lifetime arguments //~| HELP add missing lifetime argument bar: Bar<'a>, - //~^ ERROR this enum takes 0 lifetime arguments + //~^ ERROR enum takes 0 lifetime arguments //~| HELP remove these generics foo2: Foo<'a, 'b, 'c>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove these lifetime arguments qux1: Qux<'a, 'b, i32>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove this lifetime argument qux2: Qux<'a, i32, 'b>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove this lifetime argument qux3: Qux<'a, 'b, 'c, i32>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove these lifetime arguments qux4: Qux<'a, i32, 'b, 'c>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove these lifetime arguments qux5: Qux<'a, 'b, i32, 'c>, - //~^ ERROR this struct takes 1 lifetime argument + //~^ ERROR struct takes 1 lifetime argument //~| HELP remove this lifetime argument quux: Quux<'a, i32, 'b>, - //~^ ERROR this struct takes 0 lifetime arguments + //~^ ERROR struct takes 0 lifetime arguments //~| HELP remove this lifetime argument } @@ -53,7 +53,7 @@ pub trait T { } fn trait_bound_generic>(_i: I) { - //~^ ERROR this trait takes 0 generic arguments + //~^ ERROR trait takes 0 generic arguments //~| HELP replace the generic bounds with the associated types } diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index 03430f8fa..3f540eb08 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/E0107.rs:13:11 | LL | buzz: Buzz<'a>, @@ -16,7 +16,7 @@ help: add missing lifetime argument LL | buzz: Buzz<'a, 'a>, | ++++ -error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/E0107.rs:17:10 | LL | bar: Bar<'a>, @@ -30,7 +30,7 @@ note: enum defined here, with 0 lifetime parameters LL | enum Bar { | ^^^ -error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:21:11 | LL | foo2: Foo<'a, 'b, 'c>, @@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Foo<'a>(&'a str); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:25:11 | LL | qux1: Qux<'a, 'b, i32>, @@ -58,7 +58,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Qux<'a, T>(&'a T); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:29:11 | LL | qux2: Qux<'a, i32, 'b>, @@ -72,7 +72,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Qux<'a, T>(&'a T); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:33:11 | LL | qux3: Qux<'a, 'b, 'c, i32>, @@ -86,7 +86,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Qux<'a, T>(&'a T); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:37:11 | LL | qux4: Qux<'a, i32, 'b, 'c>, @@ -100,7 +100,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Qux<'a, T>(&'a T); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:41:11 | LL | qux5: Qux<'a, 'b, i32, 'c>, @@ -114,7 +114,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Qux<'a, T>(&'a T); | ^^^ -- -error[E0107]: this struct takes 0 lifetime arguments but 2 lifetime arguments were supplied +error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/E0107.rs:45:11 | LL | quux: Quux<'a, i32, 'b>, @@ -128,7 +128,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct Quux(T); | ^^^^ -error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied +error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/E0107.rs:55:27 | LL | fn trait_bound_generic>(_i: I) { diff --git a/tests/ui/error-codes/E0116.stderr b/tests/ui/error-codes/E0116.stderr index a5ceeb4a5..8a0276867 100644 --- a/tests/ui/error-codes/E0116.stderr +++ b/tests/ui/error-codes/E0116.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/E0116.rs:1:1 | LL | impl Vec {} - | ^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead diff --git a/tests/ui/error-codes/E0118.stderr b/tests/ui/error-codes/E0118.stderr index 8c6fa7947..442f8a4f8 100644 --- a/tests/ui/error-codes/E0118.stderr +++ b/tests/ui/error-codes/E0118.stderr @@ -1,8 +1,8 @@ error[E0118]: no nominal type found for inherent implementation - --> $DIR/E0118.rs:1:9 + --> $DIR/E0118.rs:1:1 | LL | impl T { - | ^ impl requires a nominal type + | ^^^^^^^^^ impl requires a nominal type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/tests/ui/error-codes/E0208.rs b/tests/ui/error-codes/E0208.rs index c67d42889..74c138af4 100644 --- a/tests/ui/error-codes/E0208.rs +++ b/tests/ui/error-codes/E0208.rs @@ -1,7 +1,7 @@ #![feature(rustc_attrs)] #[rustc_variance] -struct Foo<'a, T> { //~ ERROR [-, o] +struct Foo<'a, T> { //~ ERROR [+, o] t: &'a mut T, } diff --git a/tests/ui/error-codes/E0208.stderr b/tests/ui/error-codes/E0208.stderr index dbbb41e79..2c7072a7e 100644 --- a/tests/ui/error-codes/E0208.stderr +++ b/tests/ui/error-codes/E0208.stderr @@ -1,4 +1,4 @@ -error: [-, o] +error: [+, o] --> $DIR/E0208.rs:4:1 | LL | struct Foo<'a, T> { diff --git a/tests/ui/error-codes/E0390.stderr b/tests/ui/error-codes/E0390.stderr index 0e5a9ca76..ec4b5758c 100644 --- a/tests/ui/error-codes/E0390.stderr +++ b/tests/ui/error-codes/E0390.stderr @@ -1,16 +1,16 @@ error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/E0390.rs:5:6 + --> $DIR/E0390.rs:5:1 | LL | impl *mut Foo {} - | ^^^^^^^^ + | ^^^^^^^^^^^^^ | = help: consider using an extension trait instead error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/E0390.rs:7:6 + --> $DIR/E0390.rs:7:1 | LL | impl fn(Foo) {} - | ^^^^^^^ + | ^^^^^^^^^^^^ | = help: consider using an extension trait instead diff --git a/tests/ui/error-codes/E0476.rs b/tests/ui/error-codes/E0476.rs new file mode 100644 index 000000000..d5e4b8d23 --- /dev/null +++ b/tests/ui/error-codes/E0476.rs @@ -0,0 +1,13 @@ +#![feature(coerce_unsized)] +#![feature(unsize)] + +use std::marker::Unsize; +use std::ops::CoerceUnsized; + +struct Wrapper(T); + +impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} +//~^ ERROR lifetime of the source pointer does not outlive lifetime bound of the object type [E0476] +//~^^ ERROR E0119 + +fn main() {} diff --git a/tests/ui/error-codes/E0476.stderr b/tests/ui/error-codes/E0476.stderr new file mode 100644 index 000000000..a4bb26532 --- /dev/null +++ b/tests/ui/error-codes/E0476.stderr @@ -0,0 +1,31 @@ +error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>` for type `&Wrapper<_>` + --> $DIR/E0476.rs:9:1 + | +LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T + where 'b: 'a, T: Unsize, T: ?Sized, U: ?Sized; + +error[E0476]: lifetime of the source pointer does not outlive lifetime bound of the object type + --> $DIR/E0476.rs:9:1 + | +LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: object type is valid for the lifetime `'a` as defined here + --> $DIR/E0476.rs:9:6 + | +LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} + | ^^ +note: source pointer is only valid for the lifetime `'b` as defined here + --> $DIR/E0476.rs:9:10 + | +LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper> for &'b Wrapper where S: Unsize {} + | ^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0476. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/error-codes/E0503.stderr b/tests/ui/error-codes/E0503.stderr index fafe363eb..2f02e3b1a 100644 --- a/tests/ui/error-codes/E0503.stderr +++ b/tests/ui/error-codes/E0503.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed --> $DIR/E0503.rs:4:16 | LL | let _borrow = &mut value; - | ---------- borrow of `value` occurs here + | ---------- `value` is borrowed here LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` LL | _borrow.use_mut(); diff --git a/tests/ui/error-codes/E0504.stderr b/tests/ui/error-codes/E0504.stderr index e677e8916..20e16a538 100644 --- a/tests/ui/error-codes/E0504.stderr +++ b/tests/ui/error-codes/E0504.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `fancy_num` because it is borrowed --> $DIR/E0504.rs:9:13 | +LL | let fancy_num = FancyNum { num: 5 }; + | --------- binding `fancy_num` declared here LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here LL | diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr index bd3f37f54..2ecb4a75c 100644 --- a/tests/ui/error-codes/E0505.stderr +++ b/tests/ui/error-codes/E0505.stderr @@ -1,6 +1,9 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/E0505.rs:9:13 | +LL | let x = Value{}; + | - binding `x` declared here +LL | { LL | let _ref_to_val: &Value = &x; | -- borrow of `x` occurs here LL | eat(x); diff --git a/tests/ui/error-codes/E0506.stderr b/tests/ui/error-codes/E0506.stderr index d70406b75..17ad7c611 100644 --- a/tests/ui/error-codes/E0506.stderr +++ b/tests/ui/error-codes/E0506.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed --> $DIR/E0506.rs:8:5 | LL | let fancy_ref = &fancy_num; - | ---------- borrow of `fancy_num` occurs here + | ---------- `fancy_num` is borrowed here LL | fancy_num = FancyNum { num: 6 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `fancy_num` is assigned to here but it was already borrowed LL | LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num); | ------------- borrow later used here diff --git a/tests/ui/error-codes/E0520.stderr b/tests/ui/error-codes/E0520.stderr index 12ecead13..06658a49b 100644 --- a/tests/ui/error-codes/E0520.stderr +++ b/tests/ui/error-codes/E0520.stderr @@ -15,7 +15,7 @@ LL | impl SpaceLlama for T { | ------------------------------- parent `impl` is here ... LL | default fn fly(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly` + | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `fly` | = note: to specialize, `fly` in the parent `impl` must be marked `default` diff --git a/tests/ui/error-codes/E0523.rs b/tests/ui/error-codes/E0523.rs new file mode 100644 index 000000000..47717fbd5 --- /dev/null +++ b/tests/ui/error-codes/E0523.rs @@ -0,0 +1,14 @@ +// aux-build:crateresolve1-1.rs +// aux-build:crateresolve1-2.rs +// aux-build:crateresolve1-3.rs + +// normalize-stderr-test: "\.nll/" -> "/" +// normalize-stderr-test: "\\\?\\" -> "" +// normalize-stderr-test: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib" + +// NOTE: This test is duplicated from `tests/ui/crate-loading/crateresolve1.rs`. + +extern crate crateresolve1; +//~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found + +fn main() {} diff --git a/tests/ui/error-codes/E0523.stderr b/tests/ui/error-codes/E0523.stderr new file mode 100644 index 000000000..8e3eb2159 --- /dev/null +++ b/tests/ui/error-codes/E0523.stderr @@ -0,0 +1,13 @@ +error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found + --> $DIR/E0523.rs:11:1 + | +LL | extern crate crateresolve1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: candidate #1: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-1.somelib + = note: candidate #2: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-2.somelib + = note: candidate #3: $TEST_BUILD_DIR/error-codes/E0523/auxiliary/libcrateresolve1-3.somelib + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0464`. diff --git a/tests/ui/error-codes/E0597.stderr b/tests/ui/error-codes/E0597.stderr index b4a1180ad..82e3481b6 100644 --- a/tests/ui/error-codes/E0597.stderr +++ b/tests/ui/error-codes/E0597.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/E0597.rs:8:16 | +LL | let y = 0; + | - binding `y` declared here LL | x.x = Some(&y); | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/error-codes/E0624.rs b/tests/ui/error-codes/E0624.rs index 4c68b70fb..45f72a565 100644 --- a/tests/ui/error-codes/E0624.rs +++ b/tests/ui/error-codes/E0624.rs @@ -8,5 +8,5 @@ mod inner { fn main() { let foo = inner::Foo; - foo.method(); //~ ERROR associated function `method` is private [E0624] + foo.method(); //~ ERROR method `method` is private [E0624] } diff --git a/tests/ui/error-codes/E0624.stderr b/tests/ui/error-codes/E0624.stderr index e59b8a8ae..23a8ea8a8 100644 --- a/tests/ui/error-codes/E0624.stderr +++ b/tests/ui/error-codes/E0624.stderr @@ -1,11 +1,11 @@ -error[E0624]: associated function `method` is private +error[E0624]: method `method` is private --> $DIR/E0624.rs:11:9 | LL | fn method(&self) {} - | ---------------- private associated function defined here + | ---------------- private method defined here ... LL | foo.method(); - | ^^^^^^ private associated function + | ^^^^^^ private method error: aborting due to previous error diff --git a/tests/ui/error-codes/E0789.rs b/tests/ui/error-codes/E0789.rs new file mode 100644 index 000000000..c0cbbcc9d --- /dev/null +++ b/tests/ui/error-codes/E0789.rs @@ -0,0 +1,12 @@ +// compile-flags: --crate-type lib + +#![feature(rustc_attrs)] +#![feature(staged_api)] +#![unstable(feature = "foo_module", reason = "...", issue = "123")] + +#[rustc_allowed_through_unstable_modules] +// #[stable(feature = "foo", since = "1.0")] +struct Foo; +//~^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute +//~^^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute +// FIXME: we shouldn't have two errors here, only occurs when using `-Zdeduplicate-diagnostics=no` diff --git a/tests/ui/error-codes/E0789.stderr b/tests/ui/error-codes/E0789.stderr new file mode 100644 index 000000000..faab92bae --- /dev/null +++ b/tests/ui/error-codes/E0789.stderr @@ -0,0 +1,15 @@ +error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute + --> $DIR/E0789.rs:9:1 + | +LL | struct Foo; + | ^^^^^^^^^^^ + +error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute + --> $DIR/E0789.rs:9:1 + | +LL | struct Foo; + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0789`. diff --git a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.rs b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.rs new file mode 100644 index 000000000..0fbd85143 --- /dev/null +++ b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.rs @@ -0,0 +1,102 @@ +trait T1 {} +trait T2 {} +trait T3 {} +trait T4 {} + +impl T1 for Wrapper {} + +impl T2 for i32 {} +impl T3 for i32 {} + +impl T2 for Burrito {} + +struct Wrapper { + value: W, +} + +struct Burrito { + filling: F, +} + +impl T1 for Option {} + +impl<'a, A: T1> T1 for &'a A {} + +fn want(_x: V) {} + +enum ExampleTuple { + ExampleTupleVariant(T), +} +use ExampleDifferentTupleVariantName as ExampleYetAnotherTupleVariantName; +use ExampleTuple as ExampleOtherTuple; +use ExampleTuple::ExampleTupleVariant as ExampleDifferentTupleVariantName; +use ExampleTuple::*; + +impl T1 for ExampleTuple where A: T3 {} + +enum ExampleStruct { + ExampleStructVariant { field: T }, +} +use ExampleDifferentStructVariantName as ExampleYetAnotherStructVariantName; +use ExampleStruct as ExampleOtherStruct; +use ExampleStruct::ExampleStructVariant as ExampleDifferentStructVariantName; +use ExampleStruct::*; + +impl T1 for ExampleStruct where A: T3 {} + +struct ExampleActuallyTupleStruct(T, i32); +use ExampleActuallyTupleStruct as ExampleActuallyTupleStructOther; + +impl T1 for ExampleActuallyTupleStruct where A: T3 {} + +fn example(q: Q) { + want(Wrapper { value: Burrito { filling: q } }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + want(Some(())); + //~^ ERROR `()` is not an iterator [E0277] + + want(Some(q)); + //~^ ERROR `Q` is not an iterator [E0277] + + want(&Some(q)); + //~^ ERROR `Q` is not an iterator [E0277] + + want(&ExampleTuple::ExampleTupleVariant(q)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleTupleVariant(q)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleOtherTuple::ExampleTupleVariant(q)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleDifferentTupleVariantName(q)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleYetAnotherTupleVariantName(q)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleStruct::ExampleStructVariant { field: q }); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleStructVariant { field: q }); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleOtherStruct::ExampleStructVariant { field: q }); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleDifferentStructVariantName { field: q }); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleYetAnotherStructVariantName { field: q }); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleActuallyTupleStruct(q, 0)); + //~^ ERROR `Q: T3` is not satisfied [E0277] + + want(&ExampleActuallyTupleStructOther(q, 0)); + //~^ ERROR `Q: T3` is not satisfied [E0277] +} + +fn main() {} diff --git a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr new file mode 100644 index 000000000..9228a047e --- /dev/null +++ b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr @@ -0,0 +1,402 @@ +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:53:46 + | +LL | want(Wrapper { value: Burrito { filling: q } }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `Burrito` to implement `T2` + --> $DIR/blame-trait-error.rs:11:13 + | +LL | impl T2 for Burrito {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error.rs:6:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: `()` is not an iterator + --> $DIR/blame-trait-error.rs:56:15 + | +LL | want(Some(())); + | ---- ^^ `()` is not an iterator + | | + | required by a bound introduced by this call + | + = help: the trait `Iterator` is not implemented for `()` + = help: the trait `T1` is implemented for `Option` +note: required for `Option<()>` to implement `T1` + --> $DIR/blame-trait-error.rs:21:20 + | +LL | impl T1 for Option {} + | -------- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` + +error[E0277]: `Q` is not an iterator + --> $DIR/blame-trait-error.rs:59:15 + | +LL | want(Some(q)); + | ---- ^ `Q` is not an iterator + | | + | required by a bound introduced by this call + | +note: required for `Option` to implement `T1` + --> $DIR/blame-trait-error.rs:21:20 + | +LL | impl T1 for Option {} + | -------- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | +++++++++++++++++++++ + +error[E0277]: `Q` is not an iterator + --> $DIR/blame-trait-error.rs:62:16 + | +LL | want(&Some(q)); + | ---- ^ `Q` is not an iterator + | | + | required by a bound introduced by this call + | +note: required for `Option` to implement `T1` + --> $DIR/blame-trait-error.rs:21:20 + | +LL | impl T1 for Option {} + | -------- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&Option` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | +++++++++++++++++++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:65:45 + | +LL | want(&ExampleTuple::ExampleTupleVariant(q)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleTuple` to implement `T1` + --> $DIR/blame-trait-error.rs:35:9 + | +LL | impl T1 for ExampleTuple where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleTuple` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:68:31 + | +LL | want(&ExampleTupleVariant(q)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleTuple` to implement `T1` + --> $DIR/blame-trait-error.rs:35:9 + | +LL | impl T1 for ExampleTuple where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleTuple` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:71:50 + | +LL | want(&ExampleOtherTuple::ExampleTupleVariant(q)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleTuple` to implement `T1` + --> $DIR/blame-trait-error.rs:35:9 + | +LL | impl T1 for ExampleTuple where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleTuple` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:74:44 + | +LL | want(&ExampleDifferentTupleVariantName(q)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleTuple` to implement `T1` + --> $DIR/blame-trait-error.rs:35:9 + | +LL | impl T1 for ExampleTuple where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleTuple` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:77:45 + | +LL | want(&ExampleYetAnotherTupleVariantName(q)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleTuple` to implement `T1` + --> $DIR/blame-trait-error.rs:35:9 + | +LL | impl T1 for ExampleTuple where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleTuple` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:80:56 + | +LL | want(&ExampleStruct::ExampleStructVariant { field: q }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `ExampleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:45:9 + | +LL | impl T1 for ExampleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:83:41 + | +LL | want(&ExampleStructVariant { field: q }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:45:9 + | +LL | impl T1 for ExampleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:86:61 + | +LL | want(&ExampleOtherStruct::ExampleStructVariant { field: q }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `ExampleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:45:9 + | +LL | impl T1 for ExampleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:89:54 + | +LL | want(&ExampleDifferentStructVariantName { field: q }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `ExampleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:45:9 + | +LL | impl T1 for ExampleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:92:55 + | +LL | want(&ExampleYetAnotherStructVariantName { field: q }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `ExampleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:45:9 + | +LL | impl T1 for ExampleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:95:38 + | +LL | want(&ExampleActuallyTupleStruct(q, 0)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleActuallyTupleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:50:9 + | +LL | impl T1 for ExampleActuallyTupleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleActuallyTupleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error.rs:98:43 + | +LL | want(&ExampleActuallyTupleStructOther(q, 0)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `ExampleActuallyTupleStruct` to implement `T1` + --> $DIR/blame-trait-error.rs:50:9 + | +LL | impl T1 for ExampleActuallyTupleStruct where A: T3 {} + | ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `&ExampleActuallyTupleStruct` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error.rs:25:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error: aborting due to 16 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.rs b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.rs new file mode 100644 index 000000000..6fea409ed --- /dev/null +++ b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.rs @@ -0,0 +1,137 @@ +// This test examines the error spans reported when a generic `impl` fails. +// For example, if a function wants an `Option` where `T: Copy` but you pass `Some(vec![1, 2])`, +// then we want to point at the `vec![1, 2]` and not the `Some( ... )` expression. + +trait T1 {} +trait T2 {} +trait T3 {} +trait T4 {} + +impl T2 for i32 {} +impl T3 for i32 {} + +struct Wrapper { + value: W, +} +impl T1 for Wrapper {} + +struct Burrito { + spicy: bool, + filling: F, +} +impl T2 for Burrito {} + +struct BurritoTuple(F); +impl T2 for BurritoTuple {} + +enum BurritoKinds { + SmallBurrito { spicy: bool, small_filling: G }, + LargeBurrito { spicy: bool, large_filling: G }, + MultiBurrito { first_filling: G, second_filling: G }, +} +impl T2 for BurritoKinds {} + +struct Taco(bool, H); +impl T2 for Taco {} + +enum TacoKinds { + OneTaco(bool, H), + TwoTacos(bool, H, H), +} +impl T2 for TacoKinds {} + +struct GenericBurrito { + spiciness: Spiciness, + filling: Filling, +} +impl T2 for GenericBurrito {} +struct NotSpicy; + +impl T2 for (A, B) {} +impl T1 for (A, B) {} + +fn want(_x: V) {} + +// Some more-complex examples: +type AliasBurrito = GenericBurrito; + +// The following example is fairly confusing. The idea is that we want to "misdirect" the location +// of the error. + +struct Two { + a: A, + b: B, +} + +impl T1 for Two, Z> {} + +struct DoubleWrapper { + item: Wrapper, +} + +impl T1 for DoubleWrapper {} + +impl<'a, T: T2> T1 for &'a T {} + +fn example(q: Q) { + // In each of the following examples, we expect the error span to point at the 'q' variable, + // since the missing constraint is `Q: T3`. + + // Verifies for struct: + want(Wrapper { value: Burrito { spicy: false, filling: q } }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for enum with named fields in variant: + want(Wrapper { value: BurritoKinds::SmallBurrito { spicy: true, small_filling: q } }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for tuple struct: + want(Wrapper { value: Taco(false, q) }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for tuple enum variant: + want(Wrapper { value: TacoKinds::OneTaco(false, q) }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for generic type with multiple parameters: + want(Wrapper { value: GenericBurrito { spiciness: NotSpicy, filling: q } }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for tuple: + want((3, q)); + //~^ ERROR the trait bound `Q: T2` is not satisfied [E0277] + + // Verifies for nested tuple: + want(Wrapper { value: (3, q) }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + // Verifies for nested tuple: + want(((3, q), 5)); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + want(DoubleWrapper { item: Wrapper { value: q } }); + //~^ ERROR the trait bound `Q: T1` is not satisfied [E0277] + + want(DoubleWrapper { item: Wrapper { value: DoubleWrapper { item: Wrapper { value: q } } } }); + //~^ ERROR the trait bound `Q: T1` is not satisfied [E0277] + + // Verifies for type alias to struct: + want(Wrapper { value: AliasBurrito { spiciness: q, filling: q } }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] + + want(Two { a: Two { a: (), b: q }, b: () }); + //~^ ERROR the trait bound `Q: T1` is not satisfied [E0277] + + // We *should* blame the 'q'. + // FIXME: Right now, the wrong field is blamed. + want( + Two { a: Two { a: (), b: Two { a: Two { a: (), b: q }, b: () } }, b: () }, + //~^ ERROR the trait bound `Q: T1` is not satisfied [E0277] + ); + + // Verifies for reference: + want(&Burrito { spicy: false, filling: q }); + //~^ ERROR the trait bound `Q: T3` is not satisfied [E0277] +} + +fn main() {} diff --git a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr new file mode 100644 index 000000000..b6a24e12b --- /dev/null +++ b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr @@ -0,0 +1,412 @@ +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:81:60 + | +LL | want(Wrapper { value: Burrito { spicy: false, filling: q } }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `Burrito` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:22:13 + | +LL | impl T2 for Burrito {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:85:84 + | +LL | want(Wrapper { value: BurritoKinds::SmallBurrito { spicy: true, small_filling: q } }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `BurritoKinds` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:32:13 + | +LL | impl T2 for BurritoKinds {} + | -- ^^ ^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:89:39 + | +LL | want(Wrapper { value: Taco(false, q) }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `Taco` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:35:13 + | +LL | impl T2 for Taco {} + | -- ^^ ^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:93:53 + | +LL | want(Wrapper { value: TacoKinds::OneTaco(false, q) }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `TacoKinds` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:41:13 + | +LL | impl T2 for TacoKinds {} + | -- ^^ ^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:97:74 + | +LL | want(Wrapper { value: GenericBurrito { spiciness: NotSpicy, filling: q } }); + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` + | +note: required for `GenericBurrito` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:47:16 + | +LL | impl T2 for GenericBurrito {} + | -- ^^ ^^^^^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T2` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:101:14 + | +LL | want((3, q)); + | ---- ^ the trait `T2` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `(i32, Q)` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:51:20 + | +LL | impl T1 for (A, B) {} + | -- ^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:105:31 + | +LL | want(Wrapper { value: (3, q) }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `(i32, Q)` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:50:20 + | +LL | impl T2 for (A, B) {} + | -- ^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper<(i32, Q)>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:109:15 + | +LL | want(((3, q), 5)); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `(i32, Q)` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:50:20 + | +LL | impl T2 for (A, B) {} + | -- ^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `((i32, Q), i32)` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:51:20 + | +LL | impl T1 for (A, B) {} + | -- ^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T1` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:112:49 + | +LL | want(DoubleWrapper { item: Wrapper { value: q } }); + | ---- ^ the trait `T1` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `DoubleWrapper` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:72:13 + | +LL | impl T1 for DoubleWrapper {} + | -- ^^ ^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T1` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:115:88 + | +LL | want(DoubleWrapper { item: Wrapper { value: DoubleWrapper { item: Wrapper { value: q } } } }); + | ---- required by a bound introduced by this call ^ the trait `T1` is not implemented for `Q` + | +note: required for `DoubleWrapper` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:72:13 + | +LL | impl T1 for DoubleWrapper {} + | -- ^^ ^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `DoubleWrapper>` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:119:27 + | +LL | want(Wrapper { value: AliasBurrito { spiciness: q, filling: q } }); + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `GenericBurrito` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:47:16 + | +LL | impl T2 for GenericBurrito {} + | -- ^^ ^^^^^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `Wrapper>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:16:13 + | +LL | impl T1 for Wrapper {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T1` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:122:35 + | +LL | want(Two { a: Two { a: (), b: q }, b: () }); + | ---- ^ the trait `T1` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `Two, ()>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:66:19 + | +LL | impl T1 for Two, Z> {} + | -- ^^ ^^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T1` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:128:59 + | +LL | want( + | ---- required by a bound introduced by this call +LL | Two { a: Two { a: (), b: Two { a: Two { a: (), b: q }, b: () } }, b: () }, + | ^ the trait `T1` is not implemented for `Q` + | +note: required for `Two, ()>` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:66:19 + | +LL | impl T1 for Two, Z> {} + | -- ^^ ^^^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: 1 redundant requirement hidden + = note: required for `Two, ()>>, ()>` to implement `T1` +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error[E0277]: the trait bound `Q: T3` is not satisfied + --> $DIR/blame-trait-error-spans-on-exprs.rs:133:44 + | +LL | want(&Burrito { spicy: false, filling: q }); + | ---- ^ the trait `T3` is not implemented for `Q` + | | + | required by a bound introduced by this call + | +note: required for `Burrito` to implement `T2` + --> $DIR/blame-trait-error-spans-on-exprs.rs:22:13 + | +LL | impl T2 for Burrito {} + | -- ^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required for `&Burrito` to implement `T1` + --> $DIR/blame-trait-error-spans-on-exprs.rs:74:17 + | +LL | impl<'a, T: T2> T1 for &'a T {} + | -- ^^ ^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `want` + --> $DIR/blame-trait-error-spans-on-exprs.rs:53:12 + | +LL | fn want(_x: V) {} + | ^^ required by this bound in `want` +help: consider restricting type parameter `Q` + | +LL | fn example(q: Q) { + | ++++ + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/explore-issue-38412.stderr b/tests/ui/explore-issue-38412.stderr index 08dadb4db..d8b485c9d 100644 --- a/tests/ui/explore-issue-38412.stderr +++ b/tests/ui/explore-issue-38412.stderr @@ -79,38 +79,38 @@ LL | r.unstable_undeclared(); = note: see issue #38412 for more information = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable -error[E0624]: associated function `pub_crate` is private +error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:48:7 | LL | r.pub_crate(); - | ^^^^^^^^^ private associated function + | ^^^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:114:9 | LL | pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } - | ------------------------------------- private associated function defined here + | ------------------------------------- private method defined here -error[E0624]: associated function `pub_mod` is private +error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:49:7 | LL | r.pub_mod(); - | ^^^^^^^ private associated function + | ^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:116:9 | LL | pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } - | ---------------------------------- private associated function defined here + | ---------------------------------- private method defined here -error[E0624]: associated function `private` is private +error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:50:7 | LL | r.private(); - | ^^^^^^^ private associated function + | ^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:118:9 | LL | fn private(&self) -> i32 { self.d_priv } - | ------------------------ private associated function defined here + | ------------------------ private method defined here error[E0658]: use of unstable library feature 'unstable_undeclared' --> $DIR/explore-issue-38412.rs:55:7 @@ -130,38 +130,38 @@ LL | t.unstable_undeclared(); = note: see issue #38412 for more information = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable -error[E0624]: associated function `pub_crate` is private +error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:61:7 | LL | t.pub_crate(); - | ^^^^^^^^^ private associated function + | ^^^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:129:9 | LL | pub(crate) fn pub_crate(&self) -> i32 { self.0 } - | ------------------------------------- private associated function defined here + | ------------------------------------- private method defined here -error[E0624]: associated function `pub_mod` is private +error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:62:7 | LL | t.pub_mod(); - | ^^^^^^^ private associated function + | ^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:130:9 | LL | pub(in m) fn pub_mod(&self) -> i32 { self.0 } - | ---------------------------------- private associated function defined here + | ---------------------------------- private method defined here -error[E0624]: associated function `private` is private +error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:63:7 | LL | t.private(); - | ^^^^^^^ private associated function + | ^^^^^^^ private method | ::: $DIR/auxiliary/pub-and-stability.rs:131:9 | LL | fn private(&self) -> i32 { self.0 } - | ------------------------ private associated function defined here + | ------------------------ private method defined here error: aborting due to 19 previous errors diff --git a/tests/ui/expr/malformed_closure/missing_braces_around_block.fixed b/tests/ui/expr/malformed_closure/missing_braces_around_block.fixed index c50b9a12b..a7a9db7d9 100644 --- a/tests/ui/expr/malformed_closure/missing_braces_around_block.fixed +++ b/tests/ui/expr/malformed_closure/missing_braces_around_block.fixed @@ -4,16 +4,23 @@ // If this recovery happens, then plenty of errors are emitted. Here, we expect // only one error. // -// This is part of issue #88065: +// This is part of the following issues: // https://github.com/rust-lang/rust/issues/88065 +// https://github.com/rust-lang/rust/issues/107959 // run-rustfix fn main() { + // Closure with multiple expressions delimited by semicolon. let num = 5; (1..num).reduce(|a, b| { //~^ ERROR: closure bodies that contain statements must be surrounded by braces println!("{}", a); a * b }).unwrap(); + + // Closure with a single expression ended by a semicolon. + let mut v = vec![1, 2, 3]; + v.iter_mut().for_each(|x| {*x = *x+1;}); + //~^ ERROR: closure bodies that contain statements must be surrounded by braces } diff --git a/tests/ui/expr/malformed_closure/missing_braces_around_block.rs b/tests/ui/expr/malformed_closure/missing_braces_around_block.rs index 58c81f3a6..b5690b2ec 100644 --- a/tests/ui/expr/malformed_closure/missing_braces_around_block.rs +++ b/tests/ui/expr/malformed_closure/missing_braces_around_block.rs @@ -4,16 +4,23 @@ // If this recovery happens, then plenty of errors are emitted. Here, we expect // only one error. // -// This is part of issue #88065: +// This is part of the following issues: // https://github.com/rust-lang/rust/issues/88065 +// https://github.com/rust-lang/rust/issues/107959 // run-rustfix fn main() { + // Closure with multiple expressions delimited by semicolon. let num = 5; (1..num).reduce(|a, b| //~^ ERROR: closure bodies that contain statements must be surrounded by braces println!("{}", a); a * b ).unwrap(); + + // Closure with a single expression ended by a semicolon. + let mut v = vec![1, 2, 3]; + v.iter_mut().for_each(|x|*x = *x+1;); + //~^ ERROR: closure bodies that contain statements must be surrounded by braces } diff --git a/tests/ui/expr/malformed_closure/missing_braces_around_block.stderr b/tests/ui/expr/malformed_closure/missing_braces_around_block.stderr index dac9a8cfc..039eef909 100644 --- a/tests/ui/expr/malformed_closure/missing_braces_around_block.stderr +++ b/tests/ui/expr/malformed_closure/missing_braces_around_block.stderr @@ -1,5 +1,5 @@ error: closure bodies that contain statements must be surrounded by braces - --> $DIR/missing_braces_around_block.rs:14:26 + --> $DIR/missing_braces_around_block.rs:16:26 | LL | (1..num).reduce(|a, b| | ^ @@ -8,14 +8,14 @@ LL | ).unwrap(); | ^ | note: statement found outside of a block - --> $DIR/missing_braces_around_block.rs:16:26 + --> $DIR/missing_braces_around_block.rs:18:26 | LL | println!("{}", a); | -----------------^ this `;` turns the preceding closure into a statement | | | this expression is a statement because of the trailing semicolon note: the closure body may be incorrectly delimited - --> $DIR/missing_braces_around_block.rs:14:21 + --> $DIR/missing_braces_around_block.rs:16:21 | LL | (1..num).reduce(|a, b| | _____________________^ @@ -34,5 +34,30 @@ LL | a * b LL ~ }).unwrap(); | -error: aborting due to previous error +error: closure bodies that contain statements must be surrounded by braces + --> $DIR/missing_braces_around_block.rs:24:29 + | +LL | v.iter_mut().for_each(|x|*x = *x+1;); + | ^ ^ + | +note: statement found outside of a block + --> $DIR/missing_braces_around_block.rs:24:39 + | +LL | v.iter_mut().for_each(|x|*x = *x+1;); + | ---------^ this `;` turns the preceding closure into a statement + | | + | this expression is a statement because of the trailing semicolon +note: the closure body may be incorrectly delimited + --> $DIR/missing_braces_around_block.rs:24:27 + | +LL | v.iter_mut().for_each(|x|*x = *x+1;); + | ^^^^^^^^^^^^ - ...but likely you meant the closure to end here + | | + | this is the parsed closure... +help: try adding braces + | +LL | v.iter_mut().for_each(|x| {*x = *x+1;}); + | + + + +error: aborting due to 2 previous errors diff --git a/tests/ui/extenv/extenv-not-defined-default.rs b/tests/ui/extenv/extenv-not-defined-default.rs index 30a06a254..1fb046c78 100644 --- a/tests/ui/extenv/extenv-not-defined-default.rs +++ b/tests/ui/extenv/extenv-not-defined-default.rs @@ -1,4 +1,4 @@ fn main() { - env!("__HOPEFULLY_NOT_DEFINED__"); - //~^ ERROR: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined + env!("CARGO__HOPEFULLY_NOT_DEFINED__"); + //~^ ERROR: environment variable `CARGO__HOPEFULLY_NOT_DEFINED__` not defined } diff --git a/tests/ui/extenv/extenv-not-defined-default.stderr b/tests/ui/extenv/extenv-not-defined-default.stderr index 884875dca..e3dce0005 100644 --- a/tests/ui/extenv/extenv-not-defined-default.stderr +++ b/tests/ui/extenv/extenv-not-defined-default.stderr @@ -1,9 +1,10 @@ -error: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined +error: environment variable `CARGO__HOPEFULLY_NOT_DEFINED__` not defined at compile time --> $DIR/extenv-not-defined-default.rs:2:5 | -LL | env!("__HOPEFULLY_NOT_DEFINED__"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | env!("CARGO__HOPEFULLY_NOT_DEFINED__"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO__HOPEFULLY_NOT_DEFINED__")` instead = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/tests/ui/extenv/issue-55897.stderr b/tests/ui/extenv/issue-55897.stderr index 92e8a44b5..5752a965e 100644 --- a/tests/ui/extenv/issue-55897.stderr +++ b/tests/ui/extenv/issue-55897.stderr @@ -1,9 +1,10 @@ -error: environment variable `NON_EXISTENT` not defined +error: environment variable `NON_EXISTENT` not defined at compile time --> $DIR/issue-55897.rs:11:22 | LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); | ^^^^^^^^^^^^^^^^^^^^ | + = help: Use `std::env::var("NON_EXISTENT")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: suffixes on string literals are invalid diff --git a/tests/ui/extern/extern-types-distinct-types.stderr b/tests/ui/extern/extern-types-distinct-types.stderr index ca25aa64e..3e6dc5cef 100644 --- a/tests/ui/extern/extern-types-distinct-types.stderr +++ b/tests/ui/extern/extern-types-distinct-types.stderr @@ -9,7 +9,7 @@ LL | type B; LL | fn foo(r: &A) -> &B { | -- expected `&B` because of return type LL | r - | ^ expected extern type `B`, found extern type `A` + | ^ expected `&B`, found `&A` | = note: expected reference `&B` found reference `&A` 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 4e0203274..49fb10e60 100644 --- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs +++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs @@ -1,6 +1,3 @@ -// compile-flags: -Zsave-analysis -// This is also a regression test for #69415 and the above flag is needed. - use std::mem::ManuallyDrop; trait Tr1 { type As1: Copy; } 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 5be1d97a0..4233a8af9 100644 --- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr @@ -1,5 +1,5 @@ error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:15:22 + --> $DIR/feature-gate-associated_type_bounds.rs:12:22 | LL | type A: Iterator; | ^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | type A: Iterator; = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:19:22 + --> $DIR/feature-gate-associated_type_bounds.rs:16:22 | LL | type B: Iterator; | ^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | type B: Iterator; = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:23:20 + --> $DIR/feature-gate-associated_type_bounds.rs:20:20 | LL | struct _St1> { | ^^^^^^^^ @@ -26,7 +26,7 @@ LL | struct _St1> { = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:30:18 + --> $DIR/feature-gate-associated_type_bounds.rs:27:18 | LL | enum _En1> { | ^^^^^^^^ @@ -35,7 +35,7 @@ LL | enum _En1> { = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:37:19 + --> $DIR/feature-gate-associated_type_bounds.rs:34:19 | LL | union _Un1> { | ^^^^^^^^ @@ -44,7 +44,7 @@ LL | union _Un1> { = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:44:37 + --> $DIR/feature-gate-associated_type_bounds.rs:41:37 | LL | type _TaWhere1 where T: Iterator = T; | ^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | type _TaWhere1 where T: Iterator = T; = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:47:22 + --> $DIR/feature-gate-associated_type_bounds.rs:44:22 | LL | fn _apit(_: impl Tr1) {} | ^^^^^^^^^ @@ -62,7 +62,7 @@ LL | fn _apit(_: impl Tr1) {} = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:49:26 + --> $DIR/feature-gate-associated_type_bounds.rs:46:26 | LL | fn _apit_dyn(_: &dyn Tr1) {} | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | fn _apit_dyn(_: &dyn Tr1) {} = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:52:24 + --> $DIR/feature-gate-associated_type_bounds.rs:49:24 | LL | fn _rpit() -> impl Tr1 { S1 } | ^^^^^^^^^ @@ -80,7 +80,7 @@ LL | fn _rpit() -> impl Tr1 { S1 } = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:55:31 + --> $DIR/feature-gate-associated_type_bounds.rs:52:31 | LL | fn _rpit_dyn() -> Box> { Box::new(S1) } | ^^^^^^^^^ @@ -89,7 +89,7 @@ LL | fn _rpit_dyn() -> Box> { Box::new(S1) } = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:58:23 + --> $DIR/feature-gate-associated_type_bounds.rs:55:23 | LL | const _cdef: impl Tr1 = S1; | ^^^^^^^^^ @@ -98,7 +98,7 @@ LL | const _cdef: impl Tr1 = S1; = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:64:24 + --> $DIR/feature-gate-associated_type_bounds.rs:61:24 | LL | static _sdef: impl Tr1 = S1; | ^^^^^^^^^ @@ -107,7 +107,7 @@ LL | static _sdef: impl Tr1 = S1; = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/feature-gate-associated_type_bounds.rs:71:21 + --> $DIR/feature-gate-associated_type_bounds.rs:68:21 | LL | let _: impl Tr1 = S1; | ^^^^^^^^^ @@ -115,26 +115,26 @@ LL | let _: impl Tr1 = S1; = note: see issue #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 type - --> $DIR/feature-gate-associated_type_bounds.rs:58:14 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types + --> $DIR/feature-gate-associated_type_bounds.rs:55:14 | LL | const _cdef: impl Tr1 = S1; | ^^^^^^^^^^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type - --> $DIR/feature-gate-associated_type_bounds.rs:64:15 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types + --> $DIR/feature-gate-associated_type_bounds.rs:61:15 | LL | static _sdef: impl Tr1 = S1; | ^^^^^^^^^^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding - --> $DIR/feature-gate-associated_type_bounds.rs:71:12 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings + --> $DIR/feature-gate-associated_type_bounds.rs:68:12 | LL | let _: impl Tr1 = S1; | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `<::A as Iterator>::Item: Copy` is not satisfied - --> $DIR/feature-gate-associated_type_bounds.rs:15:28 + --> $DIR/feature-gate-associated_type_bounds.rs:12:28 | LL | type A: Iterator; | ^^^^ the trait `Copy` is not implemented for `<::A as Iterator>::Item` diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.rs b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.rs new file mode 100644 index 000000000..83366ea02 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.rs @@ -0,0 +1,9 @@ +// Check that even though Cell: DispatchFromDyn it remains an invalid self parameter type + +use std::cell::Cell; + +trait Trait{ + fn cell(self: Cell<&Self>); //~ ERROR invalid `self` parameter type: Cell<&Self> +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr new file mode 100644 index 000000000..ce06ce916 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: Cell<&Self> + --> $DIR/feature-gate-dispatch-from-dyn-cell.rs:6:19 + | +LL | fn cell(self: Cell<&Self>); + | ^^^^^^^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0307`. diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs new file mode 100644 index 000000000..23857cbac --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.rs @@ -0,0 +1,35 @@ +// Check that a self parameter type requires a DispatchFromDyn impl to be object safe + +#![feature(arbitrary_self_types, unsize, coerce_unsized)] + +use std::{ + marker::Unsize, + ops::{CoerceUnsized, Deref}, +}; + +struct Ptr(Box); + +impl Deref for Ptr { + type Target = T; + + fn deref(&self) -> &T { + &*self.0 + } +} + +impl + ?Sized, U: ?Sized> CoerceUnsized> for Ptr {} +// Because this impl is missing the coercion below fails. +// impl + ?Sized, U: ?Sized> DispatchFromDyn> for Ptr {} + +trait Trait { + fn ptr(self: Ptr); +} +impl Trait for i32 { + fn ptr(self: Ptr) {} +} + +fn main() { + Ptr(Box::new(4)) as Ptr; + //~^ ERROR the trait `Trait` cannot be made into an object + //~^^ ERROR the trait `Trait` cannot be made into an object +} 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 new file mode 100644 index 000000000..d81eade8e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr @@ -0,0 +1,45 @@ +error[E0038]: the trait `Trait` cannot be made into an object + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:25 + | +LL | fn ptr(self: Ptr); + | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` +... +LL | Ptr(Box::new(4)) as Ptr; + | ^^^^^^^^^^^^^^ `Trait` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 + | +LL | trait Trait { + | ----- this trait cannot be made into an object... +LL | fn ptr(self: Ptr); + | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on + +error[E0038]: the trait `Trait` cannot be made into an object + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5 + | +LL | fn ptr(self: Ptr); + | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` +... +LL | Ptr(Box::new(4)) as Ptr; + | ^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 + | +LL | trait Trait { + | ----- this trait cannot be made into an object... +LL | fn ptr(self: Ptr); + | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on +note: required for `Ptr<{integer}>` to implement `CoerceUnsized>` + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:20:40 + | +LL | impl + ?Sized, U: ?Sized> CoerceUnsized> for Ptr {} + | --------- ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: required by cast to type `Ptr` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0038`. 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 760dcb615..c8c3e13d7 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 +error[E0562]: `impl Trait` only allowed in function and inherent method 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 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 +error[E0562]: `impl Trait` only allowed in function and inherent method 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-multiple_supertrait_upcastable.rs b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.rs new file mode 100644 index 000000000..0467dea62 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.rs @@ -0,0 +1,12 @@ +// check-pass + +#![deny(multiple_supertrait_upcastable)] +//~^ WARNING unknown lint: `multiple_supertrait_upcastable` +//~| WARNING unknown lint: `multiple_supertrait_upcastable` +//~| WARNING unknown lint: `multiple_supertrait_upcastable` +#![warn(multiple_supertrait_upcastable)] +//~^ WARNING unknown lint: `multiple_supertrait_upcastable` +//~| WARNING unknown lint: `multiple_supertrait_upcastable` +//~| WARNING unknown lint: `multiple_supertrait_upcastable` + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr new file mode 100644 index 000000000..1f725f354 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr @@ -0,0 +1,57 @@ +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1 + | +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: `#[warn(unknown_lints)]` on by default + +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1 + | +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 + +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1 + | +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 + +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1 + | +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 + +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1 + | +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 + +warning: unknown lint: `multiple_supertrait_upcastable` + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1 + | +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 + +warning: 6 warnings emitted + diff --git a/tests/ui/feature-gates/feature-gate-non_lifetime_binders.rs b/tests/ui/feature-gates/feature-gate-non_lifetime_binders.rs new file mode 100644 index 000000000..221e9133f --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-non_lifetime_binders.rs @@ -0,0 +1,4 @@ +fn foo() where for T:, {} +//~^ ERROR only lifetime parameters can be used in this context + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-non_lifetime_binders.stderr b/tests/ui/feature-gates/feature-gate-non_lifetime_binders.stderr new file mode 100644 index 000000000..01c8ee30c --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-non_lifetime_binders.stderr @@ -0,0 +1,12 @@ +error[E0658]: only lifetime parameters can be used in this context + --> $DIR/feature-gate-non_lifetime_binders.rs:1:20 + | +LL | fn foo() where for T:, {} + | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` 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-return_position_impl_trait_in_trait.stderr b/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr index aeabed4a6..0082b6faf 100644 --- 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 @@ -1,4 +1,4 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return +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; @@ -7,7 +7,7 @@ LL | fn bar() -> impl Sized; = note: see issue #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 +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; @@ -16,7 +16,7 @@ LL | fn baz() -> Box; = note: see issue #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 +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; diff --git a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr index 1b87ebd9f..d2ad372df 100644 --- a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -95,7 +95,7 @@ LL | fn unsized_local() where Dst: Sized { | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)` -note: required because it appears within the type `Dst<(dyn A + 'static)>` +note: required because it appears within the type `Dst` --> $DIR/feature-gate-trivial_bounds.rs:48:8 | LL | struct Dst { diff --git a/tests/ui/ffi_const.rs b/tests/ui/ffi_const.rs index 7aeb5a49a..aa20a4d4c 100644 --- a/tests/ui/ffi_const.rs +++ b/tests/ui/ffi_const.rs @@ -3,3 +3,13 @@ #[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions pub fn foo() {} + +#[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions +macro_rules! bar { + () => () +} + +extern "C" { + #[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions + static INT: i32; +} diff --git a/tests/ui/ffi_const.stderr b/tests/ui/ffi_const.stderr index bc3c12eaf..394b98f89 100644 --- a/tests/ui/ffi_const.stderr +++ b/tests/ui/ffi_const.stderr @@ -4,6 +4,18 @@ error[E0756]: `#[ffi_const]` may only be used on foreign functions LL | #[ffi_const] | ^^^^^^^^^^^^ -error: aborting due to previous error +error[E0756]: `#[ffi_const]` may only be used on foreign functions + --> $DIR/ffi_const.rs:7:1 + | +LL | #[ffi_const] + | ^^^^^^^^^^^^ + +error[E0756]: `#[ffi_const]` may only be used on foreign functions + --> $DIR/ffi_const.rs:13:5 + | +LL | #[ffi_const] + | ^^^^^^^^^^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0756`. diff --git a/tests/ui/ffi_pure.rs b/tests/ui/ffi_pure.rs index c37d34c87..6d2f3a614 100644 --- a/tests/ui/ffi_pure.rs +++ b/tests/ui/ffi_pure.rs @@ -3,3 +3,13 @@ #[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions pub fn foo() {} + +#[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions +macro_rules! bar { + () => () +} + +extern "C" { + #[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions + static INT: i32; +} diff --git a/tests/ui/ffi_pure.stderr b/tests/ui/ffi_pure.stderr index bc911c85d..8b61a4b60 100644 --- a/tests/ui/ffi_pure.stderr +++ b/tests/ui/ffi_pure.stderr @@ -4,6 +4,18 @@ error[E0755]: `#[ffi_pure]` may only be used on foreign functions LL | #[ffi_pure] | ^^^^^^^^^^^ -error: aborting due to previous error +error[E0755]: `#[ffi_pure]` may only be used on foreign functions + --> $DIR/ffi_pure.rs:7:1 + | +LL | #[ffi_pure] + | ^^^^^^^^^^^ + +error[E0755]: `#[ffi_pure]` may only be used on foreign functions + --> $DIR/ffi_pure.rs:13:5 + | +LL | #[ffi_pure] + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0755`. diff --git a/tests/ui/ffi_returns_twice.rs b/tests/ui/ffi_returns_twice.rs index 845e18df1..8195d0e48 100644 --- a/tests/ui/ffi_returns_twice.rs +++ b/tests/ui/ffi_returns_twice.rs @@ -3,3 +3,13 @@ #[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions pub fn foo() {} + +#[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions +macro_rules! bar { + () => () +} + +extern "C" { + #[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions + static INT: i32; +} diff --git a/tests/ui/ffi_returns_twice.stderr b/tests/ui/ffi_returns_twice.stderr index 2b7f5694f..0abe7613f 100644 --- a/tests/ui/ffi_returns_twice.stderr +++ b/tests/ui/ffi_returns_twice.stderr @@ -4,6 +4,18 @@ error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions LL | #[ffi_returns_twice] | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions + --> $DIR/ffi_returns_twice.rs:7:1 + | +LL | #[ffi_returns_twice] + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions + --> $DIR/ffi_returns_twice.rs:13:5 + | +LL | #[ffi_returns_twice] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0724`. diff --git a/tests/ui/fmt/format-string-wrong-order.rs b/tests/ui/fmt/format-string-wrong-order.rs new file mode 100644 index 000000000..0bad54023 --- /dev/null +++ b/tests/ui/fmt/format-string-wrong-order.rs @@ -0,0 +1,15 @@ +fn main() { + let bar = 3; + format!("{?:}", bar); + //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("{?:bar}"); + //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("{?:?}", bar); + //~^ ERROR invalid format string: expected format parameter to occur after `:` + format!("{??}", bar); + //~^ ERROR invalid format string: expected `'}'`, found `'?'` + format!("{?;bar}"); + //~^ ERROR invalid format string: expected `'}'`, found `'?'` + format!("{?:#?}", bar); + //~^ ERROR invalid format string: expected format parameter to occur after `:` +} diff --git a/tests/ui/fmt/format-string-wrong-order.stderr b/tests/ui/fmt/format-string-wrong-order.stderr new file mode 100644 index 000000000..461af354a --- /dev/null +++ b/tests/ui/fmt/format-string-wrong-order.stderr @@ -0,0 +1,54 @@ +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:3:15 + | +LL | format!("{?:}", bar); + | ^ expected `?` to occur after `:` in format string + | + = note: `?` comes after `:`, try `:?` instead + +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:5:15 + | +LL | format!("{?:bar}"); + | ^ expected `?` to occur after `:` in format string + | + = note: `?` comes after `:`, try `bar:?` instead + +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:7:15 + | +LL | format!("{?:?}", bar); + | ^ expected `?` to occur after `:` in format string + | + = note: `?` comes after `:`, try `:?` instead + +error: invalid format string: expected `'}'`, found `'?'` + --> $DIR/format-string-wrong-order.rs:9:15 + | +LL | format!("{??}", bar); + | -^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'?'` + --> $DIR/format-string-wrong-order.rs:11:15 + | +LL | format!("{?;bar}"); + | -^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected format parameter to occur after `:` + --> $DIR/format-string-wrong-order.rs:13:15 + | +LL | format!("{?:#?}", bar); + | ^ expected `?` to occur after `:` in format string + | + = note: `?` comes after `:`, try `:?` instead + +error: aborting due to 6 previous errors + diff --git a/tests/ui/fmt/ifmt-bad-arg.stderr b/tests/ui/fmt/ifmt-bad-arg.stderr index c2619d6df..d716bbe51 100644 --- a/tests/ui/fmt/ifmt-bad-arg.stderr +++ b/tests/ui/fmt/ifmt-bad-arg.stderr @@ -302,7 +302,7 @@ error[E0308]: mismatched types LL | println!("{} {:.*} {}", 1, 3.2, 4); | ^^^ | | - | expected `usize`, found floating-point number + | expected `&usize`, found `&{float}` | arguments to this function are incorrect | = note: expected reference `&usize` @@ -317,7 +317,7 @@ error[E0308]: mismatched types LL | println!("{} {:07$.*} {}", 1, 3.2, 4); | ^^^ | | - | expected `usize`, found floating-point number + | expected `&usize`, found `&{float}` | arguments to this function are incorrect | = note: expected reference `&usize` diff --git a/tests/ui/fmt/ifmt-unimpl.stderr b/tests/ui/fmt/ifmt-unimpl.stderr index be321c3c5..3480a2ec8 100644 --- a/tests/ui/fmt/ifmt-unimpl.stderr +++ b/tests/ui/fmt/ifmt-unimpl.stderr @@ -15,7 +15,7 @@ LL | format!("{:X}", "3"); NonZeroIsize and 21 others = note: required for `&str` to implement `UpperHex` -note: required by a bound in `ArgumentV1::<'a>::new_upper_hex` +note: required by a bound in `core::fmt::ArgumentV1::<'a>::new_upper_hex` --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `arg_new` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/fmt/issue-75307.rs b/tests/ui/fmt/issue-75307.rs new file mode 100644 index 000000000..cffa6bea8 --- /dev/null +++ b/tests/ui/fmt/issue-75307.rs @@ -0,0 +1,3 @@ +fn main() { + format!(r"{}{}{}", named_arg=1); //~ ERROR 3 positional arguments in format string, but there is 1 argument +} diff --git a/tests/ui/fmt/issue-75307.stderr b/tests/ui/fmt/issue-75307.stderr new file mode 100644 index 000000000..c5b0b11e7 --- /dev/null +++ b/tests/ui/fmt/issue-75307.stderr @@ -0,0 +1,8 @@ +error: 3 positional arguments in format string, but there is 1 argument + --> $DIR/issue-75307.rs:2:15 + | +LL | format!(r"{}{}{}", named_arg=1); + | ^^^^^^ - + +error: aborting due to previous error + diff --git a/tests/ui/fmt/respanned-literal-issue-106191.rs b/tests/ui/fmt/respanned-literal-issue-106191.rs index bb741c0ef..5a18983a3 100644 --- a/tests/ui/fmt/respanned-literal-issue-106191.rs +++ b/tests/ui/fmt/respanned-literal-issue-106191.rs @@ -3,7 +3,7 @@ // known-bug: #106191 // unset-rustc-env:RUST_BACKTRACE // had to be reverted -// error-pattern:internal compiler error +// error-pattern:unexpectedly panicked // failure-status:101 // dont-check-compiler-stderr diff --git a/tests/ui/fmt/send-sync.stderr b/tests/ui/fmt/send-sync.stderr index 3ed040c3a..d43f4f0d9 100644 --- a/tests/ui/fmt/send-sync.stderr +++ b/tests/ui/fmt/send-sync.stderr @@ -6,11 +6,11 @@ LL | send(format_args!("{:?}", c)); | | | required by a bound introduced by this call | - = help: within `[ArgumentV1<'_>]`, the trait `Sync` is not implemented for `core::fmt::Opaque` + = help: within `[core::fmt::ArgumentV1<'_>]`, the trait `Sync` is not implemented for `core::fmt::Opaque` = note: required because it appears within the type `&core::fmt::Opaque` = note: required because it appears within the type `ArgumentV1<'_>` = note: required because it appears within the type `[ArgumentV1<'_>]` - = note: required for `&[ArgumentV1<'_>]` to implement `Send` + = note: required for `&[core::fmt::ArgumentV1<'_>]` to implement `Send` = note: required because it appears within the type `Arguments<'_>` note: required by a bound in `send` --> $DIR/send-sync.rs:1:12 diff --git a/tests/ui/fn/fn-compare-mismatch.stderr b/tests/ui/fn/fn-compare-mismatch.stderr index df838cb11..b4e71e75f 100644 --- a/tests/ui/fn/fn-compare-mismatch.stderr +++ b/tests/ui/fn/fn-compare-mismatch.stderr @@ -19,6 +19,8 @@ LL | let x = f == g; | = note: expected fn item `fn() {f}` found fn item `fn() {g}` + = note: different fn items have unique types, even if their signatures are the same + = help: consider casting both fn items to fn pointers using `as fn()` error: aborting due to 2 previous errors diff --git a/tests/ui/fn/fn-item-type.rs b/tests/ui/fn/fn-item-type.rs index 1831e6cbf..c094a34b2 100644 --- a/tests/ui/fn/fn-item-type.rs +++ b/tests/ui/fn/fn-item-type.rs @@ -1,13 +1,22 @@ // Test that the types of distinct fn items are not compatible by // default. See also `run-pass/fn-item-type-*.rs`. -fn foo(x: isize) -> isize { x * 2 } -fn bar(x: isize) -> isize { x * 4 } +fn foo(x: isize) -> isize { + x * 2 +} +fn bar(x: isize) -> isize { + x * 4 +} -fn eq(x: T, y: T) { } +fn eq(x: T, y: T) {} -trait Foo { fn foo() { /* this is a default fn */ } } -impl Foo for T { /* `foo` is still default here */ } +trait Foo { + fn foo() { /* this is a default fn */ + } +} +impl Foo for T { + /* `foo` is still default here */ +} fn main() { eq(foo::, bar::); @@ -15,39 +24,28 @@ fn main() { //~| expected fn item `fn(_) -> _ {foo::}` //~| found fn item `fn(_) -> _ {bar::}` //~| expected fn item, found a different fn item - //~| different `fn` items always have unique types, even if their signatures are the same - //~| change the expected type to be function pointer - //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer + //~| different fn items have unique types, even if their signatures are the same eq(foo::, foo::); //~^ ERROR mismatched types //~| expected `u8`, found `i8` - //~| different `fn` items always have unique types, even if their signatures are the same - //~| change the expected type to be function pointer - //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer + //~| different fn items have unique types, even if their signatures are the same eq(bar::, bar::>); //~^ ERROR mismatched types //~| found fn item `fn(_) -> _ {bar::>}` - //~| expected struct `String`, found struct `Vec` - //~| different `fn` items always have unique types, even if their signatures are the same - //~| change the expected type to be function pointer - //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer + //~| expected `String`, found `Vec` // Make sure we distinguish between trait methods correctly. eq(::foo, ::foo); //~^ ERROR mismatched types //~| expected `u8`, found `u16` - //~| different `fn` items always have unique types, even if their signatures are the same - //~| change the expected type to be function pointer - //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer + //~| different fn items have unique types, even if their signatures are the same eq(foo::, bar:: as fn(isize) -> isize); //~^ ERROR mismatched types //~| found fn pointer `fn(_) -> _` //~| expected fn item, found fn pointer - //~| change the expected type to be function pointer - //~| if the expected type is due to type inference, cast the expected `fn` to a function pointer eq(foo:: as fn(isize) -> isize, bar::); // ok! } diff --git a/tests/ui/fn/fn-item-type.stderr b/tests/ui/fn/fn-item-type.stderr index f03a47d5c..da90b8b81 100644 --- a/tests/ui/fn/fn-item-type.stderr +++ b/tests/ui/fn/fn-item-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:13:19 + --> $DIR/fn-item-type.rs:22:19 | LL | eq(foo::, bar::); | -- ^^^^^^^^^ expected fn item, found a different fn item @@ -8,17 +8,16 @@ LL | eq(foo::, bar::); | = note: expected fn item `fn(_) -> _ {foo::}` found fn item `fn(_) -> _ {bar::}` - = note: different `fn` items always have unique types, even if their signatures are the same - = help: change the expected type to be function pointer `fn(isize) -> isize` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo:: as fn(isize) -> isize` + = note: different fn items have unique types, even if their signatures are the same note: function defined here - --> $DIR/fn-item-type.rs:7:4 + --> $DIR/fn-item-type.rs:11:4 | -LL | fn eq(x: T, y: T) { } +LL | fn eq(x: T, y: T) {} | ^^ ---- + = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:22:19 + --> $DIR/fn-item-type.rs:29:19 | LL | eq(foo::, foo::); | -- ^^^^^^^^^ expected `u8`, found `i8` @@ -27,36 +26,34 @@ LL | eq(foo::, foo::); | = note: expected fn item `fn(_) -> _ {foo::}` found fn item `fn(_) -> _ {foo::}` - = note: different `fn` items always have unique types, even if their signatures are the same - = help: change the expected type to be function pointer `fn(isize) -> isize` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo:: as fn(isize) -> isize` + = note: different fn items have unique types, even if their signatures are the same note: function defined here - --> $DIR/fn-item-type.rs:7:4 + --> $DIR/fn-item-type.rs:11:4 | -LL | fn eq(x: T, y: T) { } +LL | fn eq(x: T, y: T) {} | ^^ ---- + = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:29:23 + --> $DIR/fn-item-type.rs:34:23 | LL | eq(bar::, bar::>); - | -- ^^^^^^^^^^^^^^ expected struct `String`, found struct `Vec` + | -- ^^^^^^^^^^^^^^ expected `String`, found `Vec` | | | arguments to this function are incorrect | = note: expected fn item `fn(_) -> _ {bar::}` found fn item `fn(_) -> _ {bar::>}` - = note: different `fn` items always have unique types, even if their signatures are the same - = help: change the expected type to be function pointer `fn(isize) -> isize` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `bar:: as fn(isize) -> isize` + = note: different fn items have unique types, even if their signatures are the same note: function defined here - --> $DIR/fn-item-type.rs:7:4 + --> $DIR/fn-item-type.rs:11:4 | -LL | fn eq(x: T, y: T) { } +LL | fn eq(x: T, y: T) {} | ^^ ---- + = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:38:26 + --> $DIR/fn-item-type.rs:40:26 | LL | eq(::foo, ::foo); | -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16` @@ -65,14 +62,13 @@ LL | eq(::foo, ::foo); | = note: expected fn item `fn() {::foo}` found fn item `fn() {::foo}` - = note: different `fn` items always have unique types, even if their signatures are the same - = help: change the expected type to be function pointer `fn()` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `::foo as fn()` + = note: different fn items have unique types, even if their signatures are the same note: function defined here - --> $DIR/fn-item-type.rs:7:4 + --> $DIR/fn-item-type.rs:11:4 | -LL | fn eq(x: T, y: T) { } +LL | fn eq(x: T, y: T) {} | ^^ ---- + = help: consider casting both fn items to fn pointers using `as fn()` error[E0308]: mismatched types --> $DIR/fn-item-type.rs:45:19 @@ -84,12 +80,11 @@ LL | eq(foo::, bar:: as fn(isize) -> isize); | = note: expected fn item `fn(_) -> _ {foo::}` found fn pointer `fn(_) -> _` - = help: change the expected type to be function pointer `fn(isize) -> isize` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo:: as fn(isize) -> isize` + = help: consider casting the fn item to a fn pointer: `foo:: as fn(isize) -> isize` note: function defined here - --> $DIR/fn-item-type.rs:7:4 + --> $DIR/fn-item-type.rs:11:4 | -LL | fn eq(x: T, y: T) { } +LL | fn eq(x: T, y: T) {} | ^^ ---- error: aborting due to 5 previous errors diff --git a/tests/ui/fn/fn-pointer-mismatch.rs b/tests/ui/fn/fn-pointer-mismatch.rs new file mode 100644 index 000000000..0597478cb --- /dev/null +++ b/tests/ui/fn/fn-pointer-mismatch.rs @@ -0,0 +1,56 @@ +fn foo(x: u32) -> u32 { + x * 2 +} + +fn bar(x: u32) -> u32 { + x * 3 +} + +// original example from Issue #102608 +fn foobar(n: u32) -> u32 { + let g = if n % 2 == 0 { &foo } else { &bar }; + //~^ ERROR `if` and `else` have incompatible types + //~| different fn items have unique types, even if their signatures are the same + g(n) +} + +fn main() { + assert_eq!(foobar(7), 21); + assert_eq!(foobar(8), 16); + + // general mismatch of fn item types + let mut a = foo; + a = bar; + //~^ ERROR mismatched types + //~| expected fn item `fn(_) -> _ {foo}` + //~| found fn item `fn(_) -> _ {bar}` + //~| different fn items have unique types, even if their signatures are the same + + // display note even when boxed + let mut b = Box::new(foo); + b = Box::new(bar); + //~^ ERROR mismatched types + //~| different fn items have unique types, even if their signatures are the same + + // suggest removing reference + let c: fn(u32) -> u32 = &foo; + //~^ ERROR mismatched types + //~| expected fn pointer `fn(u32) -> u32` + //~| found reference `&fn(u32) -> u32 {foo}` + + // suggest using reference + let d: &fn(u32) -> u32 = foo; + //~^ ERROR mismatched types + //~| expected reference `&fn(u32) -> u32` + //~| found fn item `fn(u32) -> u32 {foo}` + + // suggest casting with reference + let e: &fn(u32) -> u32 = &foo; + //~^ ERROR mismatched types + //~| expected reference `&fn(u32) -> u32` + //~| found reference `&fn(u32) -> u32 {foo}` + + // OK + let mut z: fn(u32) -> u32 = foo as fn(u32) -> u32; + z = bar; +} diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr new file mode 100644 index 000000000..a674babcb --- /dev/null +++ b/tests/ui/fn/fn-pointer-mismatch.stderr @@ -0,0 +1,91 @@ +error[E0308]: `if` and `else` have incompatible types + --> $DIR/fn-pointer-mismatch.rs:11:43 + | +LL | let g = if n % 2 == 0 { &foo } else { &bar }; + | ---- ^^^^ expected `&fn(u32) -> u32 {foo}`, found `&fn(u32) -> u32 {bar}` + | | + | expected because of this + | + = note: expected reference `&fn(u32) -> u32 {foo}` + found reference `&fn(u32) -> u32 {bar}` + = note: different fn items have unique types, even if their signatures are the same + = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + +error[E0308]: mismatched types + --> $DIR/fn-pointer-mismatch.rs:23:9 + | +LL | let mut a = foo; + | --- expected due to this value +LL | a = bar; + | ^^^ expected fn item, found a different fn item + | + = note: expected fn item `fn(_) -> _ {foo}` + found fn item `fn(_) -> _ {bar}` + = note: different fn items have unique types, even if their signatures are the same + = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + +error[E0308]: mismatched types + --> $DIR/fn-pointer-mismatch.rs:31:18 + | +LL | b = Box::new(bar); + | -------- ^^^ expected fn item, found a different fn item + | | + | arguments to this function are incorrect + | + = note: expected fn item `fn(_) -> _ {foo}` + found fn item `fn(_) -> _ {bar}` + = note: different fn items have unique types, even if their signatures are the same +note: associated function defined here + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + = help: consider casting both fn items to fn pointers using `as fn(u32) -> u32` + +error[E0308]: mismatched types + --> $DIR/fn-pointer-mismatch.rs:36:29 + | +LL | let c: fn(u32) -> u32 = &foo; + | -------------- ^^^^ expected fn pointer, found `&fn(u32) -> u32 {foo}` + | | + | expected due to this + | + = note: expected fn pointer `fn(u32) -> u32` + found reference `&fn(u32) -> u32 {foo}` +help: consider removing the reference + | +LL | let c: fn(u32) -> u32 = foo; + | ~~~ + +error[E0308]: mismatched types + --> $DIR/fn-pointer-mismatch.rs:42:30 + | +LL | let d: &fn(u32) -> u32 = foo; + | --------------- ^^^ expected `&fn(u32) -> u32`, found fn item + | | + | expected due to this + | + = note: expected reference `&fn(u32) -> u32` + found fn item `fn(u32) -> u32 {foo}` +help: consider using a reference + | +LL | let d: &fn(u32) -> u32 = &foo; + | ~~~~ + +error[E0308]: mismatched types + --> $DIR/fn-pointer-mismatch.rs:48:30 + | +LL | let e: &fn(u32) -> u32 = &foo; + | --------------- ^^^^ expected `&fn(u32) -> u32`, found `&fn(u32) -> u32 {foo}` + | | + | expected due to this + | + = note: expected reference `&fn(u32) -> u32` + found reference `&fn(u32) -> u32 {foo}` + = note: fn items are distinct from fn pointers + = note: when the arguments and return types match, functions can be coerced to function pointers +help: consider casting to a fn pointer + | +LL | let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32); + | ~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/fn/fn-trait-formatting.stderr b/tests/ui/fn/fn-trait-formatting.stderr index 2a674d3c1..45d543bda 100644 --- a/tests/ui/fn/fn-trait-formatting.stderr +++ b/tests/ui/fn/fn-trait-formatting.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:6:17 | LL | let _: () = Box::new(|_: isize| {}) as Box; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 | LL | let _: () = Box::new(|_: isize, isize| {}) as Box; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 | LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box isize>` | | | expected due to this | diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr index fcbaa91d1..4df639232 100644 --- a/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr +++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-4.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/implied-bounds-unnorm-associated-type-4.rs:21:10 | +LL | let x = String::from("Hello World!"); + | - binding `x` declared here LL | let y = f(&x, ()); | -- borrow of `x` occurs here LL | drop(x); diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr index e35f46e44..d417f2883 100644 --- a/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr +++ b/tests/ui/fn/implied-bounds-unnorm-associated-type.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/implied-bounds-unnorm-associated-type.rs:20:10 | +LL | let x = String::from("Hello World!"); + | - binding `x` declared here LL | let y = f(&x, ()); | -- borrow of `x` occurs here LL | drop(x); diff --git a/tests/ui/fn/issue-3044.stderr b/tests/ui/fn/issue-3044.stderr index 2690ad711..219029e2a 100644 --- a/tests/ui/fn/issue-3044.stderr +++ b/tests/ui/fn/issue-3044.stderr @@ -7,7 +7,7 @@ LL | | LL | | }); | |______- an argument is missing | -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: provide the argument | diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.rs b/tests/ui/fn/signature-error-reporting-under-verbose.rs index d7a8c95e8..12ff113c9 100644 --- a/tests/ui/fn/signature-error-reporting-under-verbose.rs +++ b/tests/ui/fn/signature-error-reporting-under-verbose.rs @@ -9,7 +9,8 @@ fn needs_ptr(_: fn(i32, u32)) {} fn main() { needs_ptr(foo); //~^ ERROR mismatched types - //~| NOTE expected `u32`, found `i32` + //~| NOTE expected fn pointer, found fn item //~| NOTE expected fn pointer `fn(i32, u32)` //~| NOTE arguments to this function are incorrect + //~| NOTE when the arguments and return types match, functions can be coerced to function pointers } diff --git a/tests/ui/fn/signature-error-reporting-under-verbose.stderr b/tests/ui/fn/signature-error-reporting-under-verbose.stderr index 6260fc8dc..f4498db72 100644 --- a/tests/ui/fn/signature-error-reporting-under-verbose.stderr +++ b/tests/ui/fn/signature-error-reporting-under-verbose.stderr @@ -2,12 +2,13 @@ error[E0308]: mismatched types --> $DIR/signature-error-reporting-under-verbose.rs:10:15 | LL | needs_ptr(foo); - | --------- ^^^ expected `u32`, found `i32` + | --------- ^^^ expected fn pointer, found fn item | | | arguments to this function are incorrect | = note: expected fn pointer `fn(i32, u32)` found fn item `fn(i32, i32) {foo}` + = note: when the arguments and return types match, functions can be coerced to function pointers note: function defined here --> $DIR/signature-error-reporting-under-verbose.rs:5:4 | diff --git a/tests/ui/for/for-else-err.rs b/tests/ui/for/for-else-err.rs new file mode 100644 index 000000000..16252e980 --- /dev/null +++ b/tests/ui/for/for-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + for _ in 0..1 { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `for...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + } +} diff --git a/tests/ui/for/for-else-err.stderr b/tests/ui/for/for-else-err.stderr new file mode 100644 index 000000000..b330d1076 --- /dev/null +++ b/tests/ui/for/for-else-err.stderr @@ -0,0 +1,17 @@ +error: `for...else` loops are not supported + --> $DIR/for-else-err.rs:4:7 + | +LL | for _ in 0..1 { + | --- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | } + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/for/for-else-let-else-err.rs b/tests/ui/for/for-else-let-else-err.rs new file mode 100644 index 000000000..c0b96f972 --- /dev/null +++ b/tests/ui/for/for-else-let-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + let _ = for _ in 0..1 { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `for...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + }; +} diff --git a/tests/ui/for/for-else-let-else-err.stderr b/tests/ui/for/for-else-let-else-err.stderr new file mode 100644 index 000000000..a2396a8fb --- /dev/null +++ b/tests/ui/for/for-else-let-else-err.stderr @@ -0,0 +1,17 @@ +error: `for...else` loops are not supported + --> $DIR/for-else-let-else-err.rs:4:7 + | +LL | let _ = for _ in 0..1 { + | --- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name1.rs b/tests/ui/fully-qualified-type/fully-qualified-type-name1.rs index 229c174da..bbca22ad2 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name1.rs +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name1.rs @@ -6,5 +6,5 @@ fn main() { x = 5; //~^ ERROR mismatched types //~| NOTE expected enum `Option` - //~| NOTE expected enum `Option`, found integer + //~| NOTE expected `Option`, found integer } diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name1.stderr b/tests/ui/fully-qualified-type/fully-qualified-type-name1.stderr index 4750c5ccd..258a8d163 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name1.stderr +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name1.stderr @@ -6,7 +6,7 @@ LL | let x: LL | Option; | ------------- expected due to this type LL | x = 5; - | ^ expected enum `Option`, found integer + | ^ expected `Option`, found integer | = note: expected enum `Option` found type `{integer}` diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs b/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs index 94a9f4e56..f26d3be66 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name2.rs @@ -11,7 +11,7 @@ mod y { fn bar(x: x::Foo) -> y::Foo { return x; //~^ ERROR mismatched types - //~| expected enum `y::Foo`, found enum `x::Foo` + //~| expected `y::Foo`, found `x::Foo` } fn main() { diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name2.stderr b/tests/ui/fully-qualified-type/fully-qualified-type-name2.stderr index a8f23f81d..c7c084659 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name2.stderr +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name2.stderr @@ -4,15 +4,15 @@ error[E0308]: mismatched types LL | fn bar(x: x::Foo) -> y::Foo { | ------ expected `y::Foo` because of return type LL | return x; - | ^ expected enum `y::Foo`, found enum `x::Foo` + | ^ expected `y::Foo`, found `x::Foo` | - = note: enum `x::Foo` and enum `y::Foo` have similar names, but are actually distinct types -note: enum `x::Foo` is defined in module `crate::x` of the current crate + = note: `x::Foo` and `y::Foo` have similar names, but are actually distinct types +note: `x::Foo` is defined in module `crate::x` of the current crate --> $DIR/fully-qualified-type-name2.rs:4:5 | LL | pub enum Foo { } | ^^^^^^^^^^^^ -note: enum `y::Foo` is defined in module `crate::y` of the current crate +note: `y::Foo` is defined in module `crate::y` of the current crate --> $DIR/fully-qualified-type-name2.rs:8:5 | LL | pub enum Foo { } diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs b/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs index 2486ae009..41f07bab8 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name4.rs @@ -7,7 +7,7 @@ fn bar(x: usize) -> Option { //~^ ERROR mismatched types //~| expected enum `Option` //~| found type `usize` - //~| expected enum `Option`, found `usize` + //~| expected `Option`, found `usize` } fn main() { diff --git a/tests/ui/fully-qualified-type/fully-qualified-type-name4.stderr b/tests/ui/fully-qualified-type/fully-qualified-type-name4.stderr index 778b13f24..6b312202b 100644 --- a/tests/ui/fully-qualified-type/fully-qualified-type-name4.stderr +++ b/tests/ui/fully-qualified-type/fully-qualified-type-name4.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn bar(x: usize) -> Option { | ------------- expected `Option` because of return type LL | return x; - | ^ expected enum `Option`, found `usize` + | ^ expected `Option`, found `usize` | = note: expected enum `Option` found type `usize` diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr index 6f430687e..870f1805b 100644 --- a/tests/ui/function-pointer/unsized-ret.stderr +++ b/tests/ui/function-pointer/unsized-ret.stderr @@ -23,7 +23,7 @@ LL | foo:: fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&() | required by a bound introduced by this call | = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)` - = note: required because it appears within the type `for<'a> fn(&'a ()) -> (dyn Display + 'a)` + = note: required because it appears within the type `fn(&()) -> dyn Display` note: required by a bound in `foo` --> $DIR/unsized-ret.rs:5:11 | diff --git a/tests/ui/functions-closures/fn-help-with-err.stderr b/tests/ui/functions-closures/fn-help-with-err.stderr index 83a2b1f58..da081eb43 100644 --- a/tests/ui/functions-closures/fn-help-with-err.stderr +++ b/tests/ui/functions-closures/fn-help-with-err.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `oops` in this scope LL | let arc = std::sync::Arc::new(oops); | ^^^^ not found in this scope -error[E0599]: no method named `bar` found for struct `Arc<[closure@fn-help-with-err.rs:18:36]>` in the current scope +error[E0599]: no method named `bar` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:18:36: 18:38]>` in the current scope --> $DIR/fn-help-with-err.rs:19:10 | LL | arc2.bar(); diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/generator/addassign-yield.rs index 66f22bf31..7211367af 100644 --- a/tests/ui/generator/addassign-yield.rs +++ b/tests/ui/generator/addassign-yield.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // run-pass // Regression test for broken MIR error (#61442) // Due to the two possible evaluation orders for diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.drop_tracking.stderr new file mode 100644 index 000000000..165748d44 --- /dev/null +++ b/tests/ui/generator/auto-trait-regions.drop_tracking.stderr @@ -0,0 +1,47 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:24 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:35 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:34:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... + = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:54:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... + = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr b/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr new file mode 100644 index 000000000..165748d44 --- /dev/null +++ b/tests/ui/generator/auto-trait-regions.drop_tracking_mir.stderr @@ -0,0 +1,47 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:24 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:35 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:34:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... + = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:54:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... + = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr b/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr new file mode 100644 index 000000000..165748d44 --- /dev/null +++ b/tests/ui/generator/auto-trait-regions.no_drop_tracking.stderr @@ -0,0 +1,47 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:24 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error[E0716]: temporary value dropped while borrowed + --> $DIR/auto-trait-regions.rs:48:35 + | +LL | let a = A(&mut true, &mut true, No); + | ^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | assert_foo(a); + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:34:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... + = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` + +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:54:5 + | +LL | assert_foo(gen); + | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... + = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/generator/auto-trait-regions.rs index ea4b0d554..fd13e4131 100644 --- a/tests/ui/generator/auto-trait-regions.rs +++ b/tests/ui/generator/auto-trait-regions.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators)] #![feature(auto_traits)] #![feature(negative_impls)] diff --git a/tests/ui/generator/auto-trait-regions.stderr b/tests/ui/generator/auto-trait-regions.stderr index 0b1f34aeb..165748d44 100644 --- a/tests/ui/generator/auto-trait-regions.stderr +++ b/tests/ui/generator/auto-trait-regions.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/auto-trait-regions.rs:45:24 + --> $DIR/auto-trait-regions.rs:48:24 | LL | let a = A(&mut true, &mut true, No); | ^^^^ - temporary value is freed at the end of this statement @@ -12,7 +12,7 @@ LL | assert_foo(a); = note: consider using a `let` binding to create a longer lived value error[E0716]: temporary value dropped while borrowed - --> $DIR/auto-trait-regions.rs:45:35 + --> $DIR/auto-trait-regions.rs:48:35 | LL | let a = A(&mut true, &mut true, No); | ^^^^ - temporary value is freed at the end of this statement @@ -25,7 +25,7 @@ LL | assert_foo(a); = note: consider using a `let` binding to create a longer lived value error: implementation of `Foo` is not general enough - --> $DIR/auto-trait-regions.rs:31:5 + --> $DIR/auto-trait-regions.rs:34:5 | LL | assert_foo(gen); | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough @@ -34,7 +34,7 @@ LL | assert_foo(gen); = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` error: implementation of `Foo` is not general enough - --> $DIR/auto-trait-regions.rs:51:5 + --> $DIR/auto-trait-regions.rs:54:5 | LL | assert_foo(gen); | ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/tests/ui/generator/borrowing.drop_tracking.stderr b/tests/ui/generator/borrowing.drop_tracking.stderr new file mode 100644 index 000000000..96e3c327f --- /dev/null +++ b/tests/ui/generator/borrowing.drop_tracking.stderr @@ -0,0 +1,31 @@ +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:13:33 + | +LL | let _b = { + | -- borrow later stored here +LL | let a = 3; +LL | Pin::new(&mut || yield &a).resume(()) + | -- ^ borrowed value does not live long enough + | | + | value captured here by generator +LL | +LL | }; + | - `a` dropped here while still borrowed + +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:20:20 + | +LL | let _b = { + | -- borrow later stored here +LL | let a = 3; +LL | || { + | -- value captured here by generator +LL | yield &a + | ^ borrowed value does not live long enough +... +LL | }; + | - `a` dropped here while still borrowed + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/generator/borrowing.drop_tracking_mir.stderr b/tests/ui/generator/borrowing.drop_tracking_mir.stderr new file mode 100644 index 000000000..8fbad276d --- /dev/null +++ b/tests/ui/generator/borrowing.drop_tracking_mir.stderr @@ -0,0 +1,39 @@ +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:13:33 + | +LL | Pin::new(&mut || yield &a).resume(()) + | ----------^ + | | | + | | borrowed value does not live long enough + | value captured here by generator + | a temporary with access to the borrow is created here ... +LL | +LL | }; + | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator + | | + | `a` dropped here while still borrowed + | + = note: the temporary is part of an expression at the end of a block; + consider forcing this temporary to be dropped sooner, before the block's local variables are dropped +help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block + | +LL | let x = Pin::new(&mut || yield &a).resume(()); x + | +++++++ +++ + +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:20:20 + | +LL | let _b = { + | -- borrow later stored here +LL | let a = 3; +LL | || { + | -- value captured here by generator +LL | yield &a + | ^ borrowed value does not live long enough +... +LL | }; + | - `a` dropped here while still borrowed + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/generator/borrowing.no_drop_tracking.stderr b/tests/ui/generator/borrowing.no_drop_tracking.stderr new file mode 100644 index 000000000..96e3c327f --- /dev/null +++ b/tests/ui/generator/borrowing.no_drop_tracking.stderr @@ -0,0 +1,31 @@ +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:13:33 + | +LL | let _b = { + | -- borrow later stored here +LL | let a = 3; +LL | Pin::new(&mut || yield &a).resume(()) + | -- ^ borrowed value does not live long enough + | | + | value captured here by generator +LL | +LL | }; + | - `a` dropped here while still borrowed + +error[E0597]: `a` does not live long enough + --> $DIR/borrowing.rs:20:20 + | +LL | let _b = { + | -- borrow later stored here +LL | let a = 3; +LL | || { + | -- value captured here by generator +LL | yield &a + | ^ borrowed value does not live long enough +... +LL | }; + | - `a` dropped here while still borrowed + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/generator/borrowing.rs index d36592583..29f39437f 100644 --- a/tests/ui/generator/borrowing.rs +++ b/tests/ui/generator/borrowing.rs @@ -1,3 +1,7 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + #![feature(generators, generator_trait)] use std::ops::Generator; diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/generator/borrowing.stderr index 38e1ace8c..96e3c327f 100644 --- a/tests/ui/generator/borrowing.stderr +++ b/tests/ui/generator/borrowing.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:9:33 + --> $DIR/borrowing.rs:13:33 | LL | let _b = { | -- borrow later stored here @@ -13,7 +13,7 @@ LL | }; | - `a` dropped here while still borrowed error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:16:20 + --> $DIR/borrowing.rs:20:20 | LL | let _b = { | -- borrow later stored here diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr new file mode 100644 index 000000000..c07906ec3 --- /dev/null +++ b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking.stderr @@ -0,0 +1,128 @@ +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr new file mode 100644 index 000000000..35698a98d --- /dev/null +++ b/tests/ui/generator/drop-tracking-parent-expression.drop_tracking_mir.stderr @@ -0,0 +1,122 @@ +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr new file mode 100644 index 000000000..1a05bfe4f --- /dev/null +++ b/tests/ui/generator/drop-tracking-parent-expression.no_drop_tracking.stderr @@ -0,0 +1,334 @@ +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `copy::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `copy::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/drop-tracking-parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/drop-tracking-parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/drop-tracking-parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 8 previous errors + diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/generator/drop-tracking-parent-expression.rs index d40f1b8f6..ed9ac6d11 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.rs +++ b/tests/ui/generator/drop-tracking-parent-expression.rs @@ -1,4 +1,7 @@ -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + #![feature(generators, negative_impls, rustc_attrs)] macro_rules! type_combinations { @@ -18,13 +21,14 @@ macro_rules! type_combinations { let g = move || match drop($name::Client { ..$name::Client::default() }) { //~^ `significant_drop::Client` which is not `Send` //~| `insignificant_dtor::Client` which is not `Send` - //~| `derived_drop::Client` which is not `Send` + //[no_drop_tracking,drop_tracking]~| `derived_drop::Client` which is not `Send` _ => yield, }; assert_send(g); //~^ ERROR cannot be sent between threads //~| ERROR cannot be sent between threads //~| ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads } // Simple owned value. This works because the Client is considered moved into `drop`, @@ -34,6 +38,10 @@ macro_rules! type_combinations { _ => yield, }; assert_send(g); + //[no_drop_tracking]~^ ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads } )* } } diff --git a/tests/ui/generator/drop-tracking-parent-expression.stderr b/tests/ui/generator/drop-tracking-parent-expression.stderr deleted file mode 100644 index fbf5d6e07..000000000 --- a/tests/ui/generator/drop-tracking-parent-expression.stderr +++ /dev/null @@ -1,128 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 - | -LL | assert_send(g); - | ^ generator is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | - = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28]`, the trait `Send` is not implemented for `derived_drop::Client` -note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 - | -LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `derived_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 - | -LL | assert_send(g); - | ^ generator is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | - = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28]`, the trait `Send` is not implemented for `significant_drop::Client` -note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 - | -LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `significant_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 - | -LL | assert_send(g); - | ^ generator is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | - = help: within `[generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` -note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 - | -LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `insignificant_dtor::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs index 646365e43..cbc291701 100644 --- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs +++ b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs @@ -1,6 +1,8 @@ // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators)] diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/generator/dropck.stderr index 7bb188352..b9a3a124a 100644 --- a/tests/ui/generator/dropck.stderr +++ b/tests/ui/generator/dropck.stderr @@ -1,6 +1,9 @@ error[E0597]: `*cell` does not live long enough --> $DIR/dropck.rs:10:40 | +LL | let (mut gen, cell); + | ---- binding `cell` declared here +LL | cell = Box::new(RefCell::new(0)); LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut()))); | ^^^^^^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/generator/generator-yielding-or-returning-itself.stderr index 8f5d2429a..a26dbf3f2 100644 --- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/tests/ui/generator/generator-yielding-or-returning-itself.stderr @@ -19,7 +19,7 @@ note: required by a bound in `want_cyclic_generator_return` --> $DIR/generator-yielding-or-returning-itself.rs:10:36 | LL | pub fn want_cyclic_generator_return(_: T) - | ---------------------------- required by a bound in this + | ---------------------------- required by a bound in this function LL | where T: Generator | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` @@ -44,7 +44,7 @@ note: required by a bound in `want_cyclic_generator_yield` --> $DIR/generator-yielding-or-returning-itself.rs:23:24 | LL | pub fn want_cyclic_generator_yield(_: T) - | --------------------------- required by a bound in this + | --------------------------- required by a bound in this function LL | where T: Generator | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield` diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/generator/issue-102645.stderr index f6d244029..3f9a4c2f3 100644 --- a/tests/ui/generator/issue-102645.stderr +++ b/tests/ui/generator/issue-102645.stderr @@ -4,7 +4,7 @@ error[E0061]: this method takes 1 argument but 0 arguments were supplied LL | Pin::new(&mut b).resume(); | ^^^^^^-- an argument of type `()` is missing | -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/ops/generator.rs:LL:COL help: provide the argument | diff --git a/tests/ui/generator/issue-105084.drop_tracking_mir.stderr b/tests/ui/generator/issue-105084.drop_tracking_mir.stderr new file mode 100644 index 000000000..cfc0cf7cd --- /dev/null +++ b/tests/ui/generator/issue-105084.drop_tracking_mir.stderr @@ -0,0 +1,51 @@ +error[E0382]: borrow of moved value: `g` + --> $DIR/issue-105084.rs:44:14 + | +LL | let mut g = || { + | ----- move occurs because `g` has type `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, which does not implement the `Copy` trait +... +LL | let mut h = copy(g); + | - value moved here +... +LL | Pin::new(&mut g).resume(()); + | ^^^^^^ value borrowed here after move + | +note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary + --> $DIR/issue-105084.rs:17:21 + | +LL | fn copy(x: T) -> T { + | ---- ^ this parameter takes ownership of the value + | | + | in this function +help: consider cloning the value if the performance cost is acceptable + | +LL | let mut h = copy(g.clone()); + | ++++++++ + +error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `[generator@$DIR/issue-105084.rs:22:17: 22:19]` + --> $DIR/issue-105084.rs:38:17 + | +LL | let mut g = || { + | -- within this `[generator@$DIR/issue-105084.rs:22:17: 22:19]` +... +LL | let mut h = copy(g); + | ^^^^ within `[generator@$DIR/issue-105084.rs:22:17: 22:19]`, the trait `Copy` is not implemented for `Box<(i32, ())>` + | +note: generator does not implement `Copy` as this value is used across a yield + --> $DIR/issue-105084.rs:28:25 + | +LL | let t = box (5, yield); + | --------^^^^^- + | | | + | | yield occurs here, with `box (5, yield)` maybe used later + | has type `Box<(i32, ())>` which does not implement `Copy` +note: required by a bound in `copy` + --> $DIR/issue-105084.rs:17:12 + | +LL | fn copy(x: T) -> T { + | ^^^^ required by this bound in `copy` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0382. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs new file mode 100644 index 000000000..7c9a97b40 --- /dev/null +++ b/tests/ui/generator/issue-105084.rs @@ -0,0 +1,49 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// [no_drop_tracking] known-bug: #105084 +// [no_drop_tracking] check-pass +// [drop_tracking] known-bug: #105084 +// [drop_tracking] check-pass + +#![feature(generators)] +#![feature(generator_clone)] +#![feature(generator_trait)] +#![feature(box_syntax)] + +use std::ops::Generator; +use std::pin::Pin; + +fn copy(x: T) -> T { + x +} + +fn main() { + let mut g = || { + // This is desuraged as 4 stages: + // - allocate a `*mut u8` with `exchange_malloc`; + // - create a Box that is ignored for trait computations; + // - compute fields (and yields); + // - assign to `t`. + let t = box (5, yield); + drop(t); + }; + + // Allocate the temporary box. + Pin::new(&mut g).resume(()); + + // The temporary box is in generator locals. + // As it is not taken into account for trait computation, + // the generator is `Copy`. + let mut h = copy(g); + //[drop_tracking_mir]~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in + + // We now have 2 boxes with the same backing allocation: + // one inside `g` and one inside `h`. + // Proceed and drop `t` in `g`. + Pin::new(&mut g).resume(()); + //[drop_tracking_mir]~^ ERROR borrow of moved value: `g` + + // Proceed and drop `t` in `h` -> double free! + Pin::new(&mut h).resume(()); +} diff --git a/tests/ui/generator/issue-57017.no_drop_tracking.stderr b/tests/ui/generator/issue-57017.no_drop_tracking.stderr new file mode 100644 index 000000000..06d2d23b9 --- /dev/null +++ b/tests/ui/generator/issue-57017.no_drop_tracking.stderr @@ -0,0 +1,248 @@ +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:31:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: the trait `Sync` is not implemented for `copy::unsync::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:29:28 + | +LL | let g = move || match drop(&$name::unsync::Client::default()) { + | --------------------------------- has type `©::unsync::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later +LL | }; + | - `&$name::unsync::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:43:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `copy::unsend::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:41:28 + | +LL | let g = move || match drop($name::unsend::Client::default()) { + | -------------------------------- has type `copy::unsend::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later +LL | }; + | - `$name::unsend::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:31:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:29:28 + | +LL | let g = move || match drop(&$name::unsync::Client::default()) { + | --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later +LL | }; + | - `&$name::unsync::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:43:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:41:28 + | +LL | let g = move || match drop($name::unsend::Client::default()) { + | -------------------------------- has type `derived_drop::unsend::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later +LL | }; + | - `$name::unsend::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:31:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:29:28 + | +LL | let g = move || match drop(&$name::unsync::Client::default()) { + | --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later +LL | }; + | - `&$name::unsync::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/issue-57017.rs:43:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57017.rs:41:28 + | +LL | let g = move || match drop($name::unsend::Client::default()) { + | -------------------------------- has type `significant_drop::unsend::Client` which is not `Send` +LL | _status => yield, + | ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later +LL | }; + | - `$name::unsend::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; +LL | | significant_drop => { +... | +LL | | } +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/issue-57017.rs:51:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 6 previous errors + diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs index c0bde3b44..03b00ac99 100644 --- a/tests/ui/generator/issue-57017.rs +++ b/tests/ui/generator/issue-57017.rs @@ -1,5 +1,9 @@ -// build-pass -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// [drop_tracking] build-pass +// [drop_tracking_mir] build-pass + #![feature(generators, negative_impls)] macro_rules! type_combinations { @@ -25,6 +29,9 @@ macro_rules! type_combinations { _status => yield, }; assert_send(g); + //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely + //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely + //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely } // This tests that `Client` is properly considered to be dropped after moving it into the @@ -34,6 +41,9 @@ macro_rules! type_combinations { _status => yield, }; assert_send(g); + //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely + //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely + //[no_drop_tracking]~| ERROR generator cannot be sent between threads safely } )* } } diff --git a/tests/ui/generator/issue-57478.no_drop_tracking.stderr b/tests/ui/generator/issue-57478.no_drop_tracking.stderr new file mode 100644 index 000000000..612dd9c37 --- /dev/null +++ b/tests/ui/generator/issue-57478.no_drop_tracking.stderr @@ -0,0 +1,31 @@ +error: generator cannot be sent between threads safely + --> $DIR/issue-57478.rs:13:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let guard = Foo; +LL | | drop(guard); +LL | | yield; +LL | | }) + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/issue-57478.rs:13:17: 13:19]`, the trait `Send` is not implemented for `Foo` +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-57478.rs:17:9 + | +LL | let guard = Foo; + | ----- has type `Foo` which is not `Send` +LL | drop(guard); +LL | yield; + | ^^^^^ yield occurs here, with `guard` maybe used later +LL | }) + | - `guard` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/issue-57478.rs:21:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/generator/issue-57478.rs index 91407ea18..3c23b5992 100644 --- a/tests/ui/generator/issue-57478.rs +++ b/tests/ui/generator/issue-57478.rs @@ -1,5 +1,8 @@ -// check-pass -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// [drop_tracking] check-pass +// [drop_tracking_mir] check-pass #![feature(negative_impls, generators)] @@ -8,6 +11,7 @@ impl !Send for Foo {} fn main() { assert_send(|| { + //[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely let guard = Foo; drop(guard); yield; diff --git a/tests/ui/generator/issue-68112.drop_tracking.stderr b/tests/ui/generator/issue-68112.drop_tracking.stderr new file mode 100644 index 000000000..282eac1b6 --- /dev/null +++ b/tests/ui/generator/issue-68112.drop_tracking.stderr @@ -0,0 +1,66 @@ +error: generator cannot be sent between threads safely + --> $DIR/issue-68112.rs:43:18 + | +LL | require_send(send_gen); + | ^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-68112.rs:39:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `impl Generator>>` which is not `Send` +LL | +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +... +LL | }; + | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:67:18 + | +LL | require_send(send_gen); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:52:5 + | +LL | || { + | ^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:49:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:57:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Generator>>`, `()` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:63:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/issue-68112.drop_tracking_mir.stderr b/tests/ui/generator/issue-68112.drop_tracking_mir.stderr new file mode 100644 index 000000000..a83522b71 --- /dev/null +++ b/tests/ui/generator/issue-68112.drop_tracking_mir.stderr @@ -0,0 +1,61 @@ +error: generator cannot be sent between threads safely + --> $DIR/issue-68112.rs:43:5 + | +LL | require_send(send_gen); + | ^^^^^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-68112.rs:39:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `impl Generator>>` which is not `Send` +LL | +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:67:5 + | +LL | require_send(send_gen); + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:52:5 + | +LL | || { + | ^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:49:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:57:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Generator>>` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:63:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/issue-68112.no_drop_tracking.stderr b/tests/ui/generator/issue-68112.no_drop_tracking.stderr new file mode 100644 index 000000000..282eac1b6 --- /dev/null +++ b/tests/ui/generator/issue-68112.no_drop_tracking.stderr @@ -0,0 +1,66 @@ +error: generator cannot be sent between threads safely + --> $DIR/issue-68112.rs:43:18 + | +LL | require_send(send_gen); + | ^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/issue-68112.rs:39:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `impl Generator>>` which is not `Send` +LL | +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +... +LL | }; + | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:67:18 + | +LL | require_send(send_gen); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:52:5 + | +LL | || { + | ^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:49:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `impl Generator>>` + --> $DIR/issue-68112.rs:57:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Generator>>`, `()` +note: required because it's used within this generator + --> $DIR/issue-68112.rs:63:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:25:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs index 21026f45c..48b53b769 100644 --- a/tests/ui/generator/issue-68112.rs +++ b/tests/ui/generator/issue-68112.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators, generator_trait)] use std::{ @@ -8,7 +11,7 @@ use std::{ }; pub struct Ready(Option); -impl Generator<()> for Ready { +impl Generator<()> for Ready { type Return = T; type Yield = (); fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { @@ -36,10 +39,11 @@ fn test1() { yield; //~^ NOTE yield occurs here //~| NOTE value is used across a yield - }; //~ NOTE later dropped here + }; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here require_send(send_gen); //~^ ERROR generator cannot be sent between threads //~| NOTE not `Send` + //~| NOTE use `std::sync::RwLock` instead } pub fn make_gen2(t: T) -> impl Generator { @@ -64,8 +68,9 @@ fn test2() { //~^ ERROR `RefCell` cannot be shared between threads safely //~| NOTE `RefCell` cannot be shared between threads safely //~| NOTE required for - //~| NOTE required by a bound introduced by this call + //[no_drop_tracking,drop_tracking]~| NOTE required by a bound introduced by this call //~| NOTE captures the following types + //~| NOTE use `std::sync::RwLock` instead } fn main() {} diff --git a/tests/ui/generator/issue-68112.stderr b/tests/ui/generator/issue-68112.stderr deleted file mode 100644 index eb99d42c9..000000000 --- a/tests/ui/generator/issue-68112.stderr +++ /dev/null @@ -1,64 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/issue-68112.rs:40:18 - | -LL | require_send(send_gen); - | ^^^^^^^^ generator is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: generator 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>>` which is not `Send` -LL | -LL | yield; - | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later -... -LL | }; - | - `_non_send_gen` is later dropped here -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:22:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-68112.rs:63:18 - | -LL | require_send(send_gen); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required for `Arc>` to implement `Send` -note: required because it's used within this generator - --> $DIR/issue-68112.rs:48:5 - | -LL | || { - | ^^ -note: required because it appears within the type `impl Generator>>` - --> $DIR/issue-68112.rs:45:30 - | -LL | pub fn make_gen2(t: T) -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `impl Generator>>` - --> $DIR/issue-68112.rs:53:34 - | -LL | fn make_non_send_generator2() -> impl Generator>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `impl Generator>>`, `()` -note: required because it's used within this generator - --> $DIR/issue-68112.rs:59:20 - | -LL | let send_gen = || { - | ^^ -note: required by a bound in `require_send` - --> $DIR/issue-68112.rs:22:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/generator/issue-93161.rs index 92305609c..8d3f7c62f 100644 --- a/tests/ui/generator/issue-93161.rs +++ b/tests/ui/generator/issue-93161.rs @@ -1,6 +1,8 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2021 // run-pass -// compile-flags: -Zdrop-tracking #![feature(never_type)] diff --git a/tests/ui/generator/not-send-sync.drop_tracking.stderr b/tests/ui/generator/not-send-sync.drop_tracking.stderr new file mode 100644 index 000000000..718fd4224 --- /dev/null +++ b/tests/ui/generator/not-send-sync.drop_tracking.stderr @@ -0,0 +1,60 @@ +error: generator cannot be shared between threads safely + --> $DIR/not-send-sync.rs:17:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = NotSync; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Sync` + | + = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/not-send-sync.rs:20:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/not-send-sync.rs:14:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/not-send-sync.rs:24:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let a = NotSend; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/not-send-sync.rs:27:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/not-send-sync.rs:15:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr b/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr new file mode 100644 index 000000000..66f01ae37 --- /dev/null +++ b/tests/ui/generator/not-send-sync.drop_tracking_mir.stderr @@ -0,0 +1,42 @@ +error: generator cannot be shared between threads safely + --> $DIR/not-send-sync.rs:17:5 + | +LL | assert_sync(|| { + | ^^^^^^^^^^^ generator is not `Sync` + | + = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/not-send-sync.rs:20:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_sync` + --> $DIR/not-send-sync.rs:14:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/not-send-sync.rs:24:5 + | +LL | assert_send(|| { + | ^^^^^^^^^^^ generator is not `Send` + | + = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/not-send-sync.rs:27:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_send` + --> $DIR/not-send-sync.rs:15:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/not-send-sync.no_drop_tracking.stderr b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr new file mode 100644 index 000000000..718fd4224 --- /dev/null +++ b/tests/ui/generator/not-send-sync.no_drop_tracking.stderr @@ -0,0 +1,60 @@ +error: generator cannot be shared between threads safely + --> $DIR/not-send-sync.rs:17:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = NotSync; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Sync` + | + = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/not-send-sync.rs:20:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/not-send-sync.rs:14:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/not-send-sync.rs:24:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let a = NotSend; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/not-send-sync.rs:27:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/not-send-sync.rs:15:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs index 8ca5565fb..8794db452 100644 --- a/tests/ui/generator/not-send-sync.rs +++ b/tests/ui/generator/not-send-sync.rs @@ -1,6 +1,14 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators)] +#![feature(negative_impls)] -use std::cell::Cell; +struct NotSend; +struct NotSync; + +impl !Send for NotSend {} +impl !Sync for NotSync {} fn main() { fn assert_sync(_: T) {} @@ -8,14 +16,15 @@ fn main() { assert_sync(|| { //~^ ERROR: generator cannot be shared between threads safely - let a = Cell::new(2); + let a = NotSync; yield; + drop(a); }); - let a = Cell::new(2); assert_send(|| { - //~^ ERROR: E0277 - drop(&a); + //~^ ERROR: generator 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/generator/not-send-sync.stderr deleted file mode 100644 index a821c57b9..000000000 --- a/tests/ui/generator/not-send-sync.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:16:17 - | -LL | assert_send(|| { - | _____-----------_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | drop(&a); -LL | | yield; -LL | | }); - | |_____^ `Cell` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Cell` - = note: required for `&Cell` to implement `Send` -note: required because it's used within this generator - --> $DIR/not-send-sync.rs:16:17 - | -LL | assert_send(|| { - | ^^ -note: required by a bound in `assert_send` - --> $DIR/not-send-sync.rs:7:23 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be shared between threads safely - --> $DIR/not-send-sync.rs:9:17 - | -LL | assert_sync(|| { - | _________________^ -LL | | -LL | | let a = Cell::new(2); -LL | | yield; -LL | | }); - | |_____^ generator is not `Sync` - | - = help: within `[generator@$DIR/not-send-sync.rs:9:17: 9:19]`, the trait `Sync` is not implemented for `Cell` -note: generator is not `Sync` as this value is used across a yield - --> $DIR/not-send-sync.rs:12:9 - | -LL | let a = Cell::new(2); - | - has type `Cell` which is not `Sync` -LL | yield; - | ^^^^^ yield occurs here, with `a` maybe used later -LL | }); - | - `a` is later dropped here -note: required by a bound in `assert_sync` - --> $DIR/not-send-sync.rs:6:23 - | -LL | fn assert_sync(_: T) {} - | ^^^^ required by this bound in `assert_sync` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/parent-expression.drop_tracking.stderr b/tests/ui/generator/parent-expression.drop_tracking.stderr new file mode 100644 index 000000000..ef489088b --- /dev/null +++ b/tests/ui/generator/parent-expression.drop_tracking.stderr @@ -0,0 +1,128 @@ +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/generator/parent-expression.drop_tracking_mir.stderr b/tests/ui/generator/parent-expression.drop_tracking_mir.stderr new file mode 100644 index 000000000..bf8144564 --- /dev/null +++ b/tests/ui/generator/parent-expression.drop_tracking_mir.stderr @@ -0,0 +1,122 @@ +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:13 + | +LL | assert_send(g); + | ^^^^^^^^^^^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/generator/parent-expression.no_drop_tracking.stderr b/tests/ui/generator/parent-expression.no_drop_tracking.stderr new file mode 100644 index 000000000..2e1313a80 --- /dev/null +++ b/tests/ui/generator/parent-expression.no_drop_tracking.stderr @@ -0,0 +1,334 @@ +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `copy::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `copy::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `derived_drop::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `significant_drop::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:27:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:25:22 + | +LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +... +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: generator cannot be sent between threads safely + --> $DIR/parent-expression.rs:40:25 + | +LL | assert_send(g); + | ^ generator is not `Send` +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation + | + = help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: generator is not `Send` as this value is used across a yield + --> $DIR/parent-expression.rs:38:22 + | +LL | let g = move || match drop($name::Client::default()) { + | ------------------------ has type `insignificant_dtor::Client` which is not `Send` +LL | _ => yield, + | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later +LL | }; + | - `$name::Client::default()` is later dropped here +... +LL | / type_combinations!( +LL | | // OK +LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; +LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though +... | +LL | | }; +LL | | ); + | |_____- in this macro invocation +note: required by a bound in `assert_send` + --> $DIR/parent-expression.rs:49:19 + | +LL | fn assert_send(_thing: T) {} + | ^^^^ required by this bound in `assert_send` + = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 8 previous errors + diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/generator/parent-expression.rs new file mode 100644 index 000000000..239034e3d --- /dev/null +++ b/tests/ui/generator/parent-expression.rs @@ -0,0 +1,77 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + +#![feature(generators, negative_impls, rustc_attrs)] + +macro_rules! type_combinations { + ( + $( $name:ident => { $( $tt:tt )* } );* $(;)? + ) => { $( + mod $name { + $( $tt )* + + impl !Sync for Client {} + impl !Send for Client {} + } + + // Struct update syntax. This fails because the Client used in the update is considered + // dropped *after* the yield. + { + let g = move || match drop($name::Client { ..$name::Client::default() }) { + //~^ `significant_drop::Client` which is not `Send` + //~| `insignificant_dtor::Client` which is not `Send` + //~| `derived_drop::Client` which is not `Send` + _ => yield, + }; + assert_send(g); + //~^ ERROR cannot be sent between threads + //~| ERROR cannot be sent between threads + //~| ERROR cannot be sent between threads + //[no_drop_tracking]~^^^^ ERROR cannot be sent between threads + } + + // Simple owned value. This works because the Client is considered moved into `drop`, + // even though the temporary expression doesn't end until after the yield. + { + let g = move || match drop($name::Client::default()) { + _ => yield, + }; + assert_send(g); + //[no_drop_tracking]~^ ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads + //[no_drop_tracking]~| ERROR cannot be sent between threads + } + )* } +} + +fn assert_send(_thing: T) {} + +fn main() { + type_combinations!( + // OK + copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; + // NOT OK: MIR borrowck thinks that this is used after the yield, even though + // this has no `Drop` impl and only the drops of the fields are observable. + // FIXME: this should compile. + derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; + // NOT OK + significant_drop => { + #[derive(Default)] + pub struct Client; + impl Drop for Client { + fn drop(&mut self) {} + } + }; + // NOT OK (we need to agree with MIR borrowck) + insignificant_dtor => { + #[derive(Default)] + #[rustc_insignificant_dtor] + pub struct Client; + impl Drop for Client { + fn drop(&mut self) {} + } + }; + ); +} diff --git a/tests/ui/generator/partial-drop.drop_tracking.stderr b/tests/ui/generator/partial-drop.drop_tracking.stderr new file mode 100644 index 000000000..f1b25cb8c --- /dev/null +++ b/tests/ui/generator/partial-drop.drop_tracking.stderr @@ -0,0 +1,61 @@ +error: generator cannot be sent between threads safely + --> $DIR/partial-drop.rs:17:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let guard = Bar { foo: Foo, x: 42 }; +LL | | drop(guard.foo); +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo` +note: generator is not `Send` as this value is used across a yield + --> $DIR/partial-drop.rs:21:9 + | +LL | let guard = Bar { foo: Foo, x: 42 }; + | ----- has type `Bar` which is not `Send` +LL | drop(guard.foo); +LL | yield; + | ^^^^^ yield occurs here, with `guard` maybe used later +LL | }); + | - `guard` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/partial-drop.rs:33:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: generator cannot be sent between threads safely + --> $DIR/partial-drop.rs:24:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let guard = Bar { foo: Foo, x: 42 }; +LL | | let Bar { foo, x } = guard; +LL | | drop(foo); +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` +note: generator is not `Send` as this value is used across a yield + --> $DIR/partial-drop.rs:29:9 + | +LL | let guard = Bar { foo: Foo, x: 42 }; + | ----- has type `Bar` which is not `Send` +... +LL | yield; + | ^^^^^ yield occurs here, with `guard` maybe used later +LL | }); + | - `guard` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/partial-drop.rs:33:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/partial-drop.no_drop_tracking.stderr b/tests/ui/generator/partial-drop.no_drop_tracking.stderr new file mode 100644 index 000000000..91152b5ea --- /dev/null +++ b/tests/ui/generator/partial-drop.no_drop_tracking.stderr @@ -0,0 +1,61 @@ +error: generator cannot be sent between threads safely + --> $DIR/partial-drop.rs:17:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let guard = Bar { foo: Foo, x: 42 }; +LL | | drop(guard.foo); +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo` +note: generator is not `Send` as this value is used across a yield + --> $DIR/partial-drop.rs:21:9 + | +LL | let guard = Bar { foo: Foo, x: 42 }; + | ----- has type `Bar` which is not `Send` +LL | drop(guard.foo); +LL | yield; + | ^^^^^ yield occurs here, with `guard` maybe used later +LL | }); + | - `guard` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/partial-drop.rs:33:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: generator cannot be sent between threads safely + --> $DIR/partial-drop.rs:24:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let guard = Bar { foo: Foo, x: 42 }; +LL | | let Bar { foo, x } = guard; +LL | | drop(foo); +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` +note: generator is not `Send` as this value is used across a yield + --> $DIR/partial-drop.rs:29:9 + | +LL | let Bar { foo, x } = guard; + | --- has type `Foo` which is not `Send` +LL | drop(foo); +LL | yield; + | ^^^^^ yield occurs here, with `foo` maybe used later +LL | }); + | - `foo` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/partial-drop.rs:33:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/generator/partial-drop.rs index c872fb7f3..1d3ae075d 100644 --- a/tests/ui/generator/partial-drop.rs +++ b/tests/ui/generator/partial-drop.rs @@ -1,4 +1,7 @@ -// compile-flags: -Zdrop-tracking +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir +// [drop_tracking_mir] check-pass #![feature(negative_impls, generators)] @@ -12,26 +15,14 @@ struct Bar { fn main() { assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. + //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely let guard = Bar { foo: Foo, x: 42 }; drop(guard.foo); yield; }); assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. - let guard = Bar { foo: Foo, x: 42 }; - drop(guard); - guard.foo = Foo; - guard.x = 23; - yield; - }); - - assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. + //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely let guard = Bar { foo: Foo, x: 42 }; let Bar { foo, x } = guard; drop(foo); diff --git a/tests/ui/generator/partial-drop.stderr b/tests/ui/generator/partial-drop.stderr deleted file mode 100644 index 9baafe54e..000000000 --- a/tests/ui/generator/partial-drop.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:14:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -LL | | drop(guard.foo); -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `[generator@$DIR/partial-drop.rs:14:17: 14:19]`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:19:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -LL | drop(guard.foo); -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:22:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -... | -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `[generator@$DIR/partial-drop.rs:22:17: 22:19]`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:29:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -... -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:32:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -... | -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `[generator@$DIR/partial-drop.rs:32:17: 32:19]`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:38:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -... -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to 3 previous errors - diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr new file mode 100644 index 000000000..7d0a20169 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking.stderr @@ -0,0 +1,64 @@ +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-1.rs:40:18 + | +LL | require_send(send_gen); + | ^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-1.rs:38:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +LL | }; + | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/generator-print-verbose-1.rs:59:18 + | +LL | require_send(send_gen); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:45:5 + | +LL | || { + | ^^ +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` + --> $DIR/generator-print-verbose-1.rs:44:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + --> $DIR/generator-print-verbose-1.rs:50:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:55:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr new file mode 100644 index 000000000..c045b1441 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-1.drop_tracking_mir.stderr @@ -0,0 +1,60 @@ +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-1.rs:40:5 + | +LL | require_send(send_gen); + | ^^^^^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-1.rs:38:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/generator-print-verbose-1.rs:59:5 + | +LL | require_send(send_gen); + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:45:5 + | +LL | || { + | ^^ +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` + --> $DIR/generator-print-verbose-1.rs:44:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + --> $DIR/generator-print-verbose-1.rs:50:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:55:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr new file mode 100644 index 000000000..7d0a20169 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-1.no_drop_tracking.stderr @@ -0,0 +1,64 @@ +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-1.rs:40:18 + | +LL | require_send(send_gen); + | ^^^^^^^^ generator is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-1.rs:38:9 + | +LL | let _non_send_gen = make_non_send_generator(); + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later +LL | }; + | - `_non_send_gen` is later dropped here +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/generator-print-verbose-1.rs:59:18 + | +LL | require_send(send_gen); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc>` to implement `Send` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:45:5 + | +LL | || { + | ^^ +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` + --> $DIR/generator-print-verbose-1.rs:44:30 + | +LL | pub fn make_gen2(t: T) -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` + --> $DIR/generator-print-verbose-1.rs:50:34 + | +LL | fn make_non_send_generator2() -> impl Generator>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` +note: required because it's used within this generator + --> $DIR/generator-print-verbose-1.rs:55:20 + | +LL | let send_gen = || { + | ^^ +note: required by a bound in `require_send` + --> $DIR/generator-print-verbose-1.rs:29:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs index 89124ad72..c7052c7d1 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.rs +++ b/tests/ui/generator/print/generator-print-verbose-1.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // compile-flags: -Zverbose // Same as: tests/ui/generator/issue-68112.stderr @@ -12,7 +15,7 @@ use std::{ }; pub struct Ready(Option); -impl Generator<()> for Ready { +impl Generator<()> for Ready { type Return = T; type Yield = (); fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr deleted file mode 100644 index ebf35be58..000000000 --- a/tests/ui/generator/print/generator-print-verbose-1.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/generator-print-verbose-1.rs:37:18 - | -LL | require_send(send_gen); - | ^^^^^^^^ generator is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: generator is not `Send` as this value is used across a yield - --> $DIR/generator-print-verbose-1.rs:35:9 - | -LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` -LL | yield; - | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later -LL | }; - | - `_non_send_gen` is later dropped here -note: required by a bound in `require_send` - --> $DIR/generator-print-verbose-1.rs:26:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-1.rs:56:18 - | -LL | require_send(send_gen); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required for `Arc>` to implement `Send` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-1.rs:42:5 - | -LL | || { - | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [Arc>])` - --> $DIR/generator-print-verbose-1.rs:41:30 - | -LL | pub fn make_gen2(t: T) -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` - --> $DIR/generator-print-verbose-1.rs:47:34 - | -LL | fn make_non_send_generator2() -> impl Generator>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-1.rs:52:20 - | -LL | let send_gen = || { - | ^^ -note: required by a bound in `require_send` - --> $DIR/generator-print-verbose-1.rs:26:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr new file mode 100644 index 000000000..1f2e530f6 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking.stderr @@ -0,0 +1,60 @@ +error: generator cannot be shared between threads safely + --> $DIR/generator-print-verbose-2.rs:20:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = NotSync; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Sync` + | + = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:23:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/generator-print-verbose-2.rs:17:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-2.rs:27:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let a = NotSend; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:30:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/generator-print-verbose-2.rs:18:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr new file mode 100644 index 000000000..354369f19 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-2.drop_tracking_mir.stderr @@ -0,0 +1,42 @@ +error: generator cannot be shared between threads safely + --> $DIR/generator-print-verbose-2.rs:20:5 + | +LL | assert_sync(|| { + | ^^^^^^^^^^^ generator is not `Sync` + | + = help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:23:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_sync` + --> $DIR/generator-print-verbose-2.rs:17:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-2.rs:27:5 + | +LL | assert_send(|| { + | ^^^^^^^^^^^ generator is not `Send` + | + = help: within `[main::{closure#1} upvar_tys=() [main::{closure#1}]]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:30:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_send` + --> $DIR/generator-print-verbose-2.rs:18:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr new file mode 100644 index 000000000..1f2e530f6 --- /dev/null +++ b/tests/ui/generator/print/generator-print-verbose-2.no_drop_tracking.stderr @@ -0,0 +1,60 @@ +error: generator cannot be shared between threads safely + --> $DIR/generator-print-verbose-2.rs:20:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = NotSync; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Sync` + | + = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync` +note: generator is not `Sync` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:23:9 + | +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_sync` + --> $DIR/generator-print-verbose-2.rs:17:23 + | +LL | fn assert_sync(_: T) {} + | ^^^^ required by this bound in `assert_sync` + +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-2.rs:27:17 + | +LL | assert_send(|| { + | _________________^ +LL | | +LL | | let a = NotSend; +LL | | yield; +LL | | drop(a); +LL | | }); + | |_____^ generator is not `Send` + | + = help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:30:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +LL | drop(a); +LL | }); + | - `a` is later dropped here +note: required by a bound in `assert_send` + --> $DIR/generator-print-verbose-2.rs:18:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs index d914719cb..ab29db6e0 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.rs +++ b/tests/ui/generator/print/generator-print-verbose-2.rs @@ -1,9 +1,17 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // compile-flags: -Zverbose // Same as test/ui/generator/not-send-sync.rs #![feature(generators)] +#![feature(negative_impls)] -use std::cell::Cell; +struct NotSend; +struct NotSync; + +impl !Send for NotSend {} +impl !Sync for NotSync {} fn main() { fn assert_sync(_: T) {} @@ -11,14 +19,15 @@ fn main() { assert_sync(|| { //~^ ERROR: generator cannot be shared between threads safely - let a = Cell::new(2); + let a = NotSync; yield; + drop(a); }); - let a = Cell::new(2); assert_send(|| { - //~^ ERROR: E0277 - drop(&a); + //~^ ERROR: generator 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/generator/print/generator-print-verbose-2.stderr deleted file mode 100644 index 909e49c38..000000000 --- a/tests/ui/generator/print/generator-print-verbose-2.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:19:17 - | -LL | assert_send(|| { - | _____-----------_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | drop(&a); -LL | | yield; -LL | | }); - | |_____^ `Cell` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Cell` - = note: required for `&'_#4r Cell` to implement `Send` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-2.rs:19:17 - | -LL | assert_send(|| { - | ^^ -note: required by a bound in `assert_send` - --> $DIR/generator-print-verbose-2.rs:10:23 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:12:17 - | -LL | assert_sync(|| { - | _________________^ -LL | | -LL | | let a = Cell::new(2); -LL | | yield; -LL | | }); - | |_____^ generator is not `Sync` - | - = help: within `[main::{closure#0} upvar_tys=() {Cell, ()}]`, the trait `Sync` is not implemented for `Cell` -note: generator is not `Sync` as this value is used across a yield - --> $DIR/generator-print-verbose-2.rs:15:9 - | -LL | let a = Cell::new(2); - | - has type `Cell` which is not `Sync` -LL | yield; - | ^^^^^ yield occurs here, with `a` maybe used later -LL | }); - | - `a` is later dropped here -note: required by a bound in `assert_sync` - --> $DIR/generator-print-verbose-2.rs:9:23 - | -LL | fn assert_sync(_: T) {} - | ^^^^ required by this bound in `assert_sync` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking.stderr new file mode 100644 index 000000000..7122a951e --- /dev/null +++ b/tests/ui/generator/retain-resume-ref.drop_tracking.stderr @@ -0,0 +1,13 @@ +error[E0499]: cannot borrow `thing` as mutable more than once at a time + --> $DIR/retain-resume-ref.rs:27:25 + | +LL | gen.as_mut().resume(&mut thing); + | ---------- first mutable borrow occurs here +LL | gen.as_mut().resume(&mut thing); + | ------ ^^^^^^^^^^ second mutable borrow occurs here + | | + | first borrow later used by call + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr b/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr new file mode 100644 index 000000000..736ed1fb6 --- /dev/null +++ b/tests/ui/generator/retain-resume-ref.drop_tracking_mir.stderr @@ -0,0 +1,14 @@ +error[E0499]: cannot borrow `thing` as mutable more than once at a time + --> $DIR/retain-resume-ref.rs:27:25 + | +LL | gen.as_mut().resume(&mut thing); + | ---------- first mutable borrow occurs here +LL | gen.as_mut().resume(&mut thing); + | ^^^^^^^^^^ second mutable borrow occurs here +LL | +LL | } + | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr b/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr new file mode 100644 index 000000000..7122a951e --- /dev/null +++ b/tests/ui/generator/retain-resume-ref.no_drop_tracking.stderr @@ -0,0 +1,13 @@ +error[E0499]: cannot borrow `thing` as mutable more than once at a time + --> $DIR/retain-resume-ref.rs:27:25 + | +LL | gen.as_mut().resume(&mut thing); + | ---------- first mutable borrow occurs here +LL | gen.as_mut().resume(&mut thing); + | ------ ^^^^^^^^^^ second mutable borrow occurs here + | | + | first borrow later used by call + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/generator/retain-resume-ref.rs index 0606ea71c..0050d98d0 100644 --- a/tests/ui/generator/retain-resume-ref.rs +++ b/tests/ui/generator/retain-resume-ref.rs @@ -1,3 +1,7 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + //! This test ensures that a mutable reference cannot be passed as a resume argument twice. #![feature(generators, generator_trait)] diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/generator/retain-resume-ref.stderr index e33310d12..7122a951e 100644 --- a/tests/ui/generator/retain-resume-ref.stderr +++ b/tests/ui/generator/retain-resume-ref.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `thing` as mutable more than once at a time - --> $DIR/retain-resume-ref.rs:23:25 + --> $DIR/retain-resume-ref.rs:27:25 | LL | gen.as_mut().resume(&mut thing); | ---------- first mutable borrow occurs here diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/generator/static-mut-reference-across-yield.rs index 0fa6d9cdc..4784ff49b 100644 --- a/tests/ui/generator/static-mut-reference-across-yield.rs +++ b/tests/ui/generator/static-mut-reference-across-yield.rs @@ -1,6 +1,8 @@ // build-pass -// revisions: mir thir +// revisions: mir thir drop_tracking drop_tracking_mir // [thir]compile-flags: -Zthir-unsafeck +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators)] diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/generator/type-mismatch-signature-deduction.stderr index b98da1ed8..ef6d896f8 100644 --- a/tests/ui/generator/type-mismatch-signature-deduction.stderr +++ b/tests/ui/generator/type-mismatch-signature-deduction.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch-signature-deduction.rs:14:9 | LL | 5 - | ^ expected enum `Result`, found integer + | ^ expected `Result<{integer}, _>`, found integer | = note: expected enum `Result<{integer}, _>` found type `{integer}` @@ -22,7 +22,7 @@ error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature- --> $DIR/type-mismatch-signature-deduction.rs:5:13 | LL | fn foo() -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<{integer}, _>`, found `i32` | = note: expected enum `Result<{integer}, _>` found type `i32` diff --git a/tests/ui/generic-associated-types/bugs/issue-88460.stderr b/tests/ui/generic-associated-types/bugs/issue-88460.stderr index 6612c4b49..a2047f103 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88460.stderr @@ -11,7 +11,7 @@ note: required by a bound in `test` --> $DIR/issue-88460.rs:15:27 | LL | fn test(value: T) - | ---- required by a bound in this + | ---- required by a bound in this function ... LL | for<'a> T::Assoc<'a>: Marker, | ^^^^^^ required by this bound in `test` diff --git a/tests/ui/generic-associated-types/collections-project-default.stderr b/tests/ui/generic-associated-types/collections-project-default.stderr index 5701017dc..3c3ae24dd 100644 --- a/tests/ui/generic-associated-types/collections-project-default.stderr +++ b/tests/ui/generic-associated-types/collections-project-default.stderr @@ -5,10 +5,11 @@ LL | fn floatify_sibling(ints: &C) -> >::Sibling | ------------------------------------ expected `>::Sibling` because of return type ... LL | res - | ^^^ expected Collection::Sibling, found CollectionFamily::Member + | ^^^ expected `Collection::Sibling`, found `CollectionFamily::Member` | = note: expected associated type `>::Sibling` found associated type `<>::Family as CollectionFamily>::Member` + = note: an associated type was expected, but a different one was found error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr b/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr index 96c4330fe..3b65b32f4 100644 --- a/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr +++ b/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/constraint-assoc-type-suggestion.rs:10:23 | LL | let b: Vec = a; - | -------- ^ expected struct `Vec`, found associated type + | -------- ^ expected `Vec`, found associated type | | | expected due to this | diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index 9eb069637..5738dfa83 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -5,12 +5,12 @@ trait X { fn foo<'a>(arg: Box>) {} //~^ ERROR: lifetime in trait object type must be followed by `+` //~| ERROR: parenthesized generic arguments cannot be used - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument - //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 0 generic arguments but 1 generic argument + //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments fn bar<'a>(arg: Box>) {} //~^ ERROR: parenthesized generic arguments cannot be used - //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments fn main() {} diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 165779796..461853379 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -23,7 +23,7 @@ LL | fn bar<'a>(arg: Box>) {} | | | help: remove these parentheses -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} @@ -39,7 +39,7 @@ help: add missing lifetime argument LL | fn foo<'a>(arg: Box>) {} | +++ -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} @@ -53,7 +53,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box>) {} diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr index 1f9273a8c..5c8db617c 100644 --- a/tests/ui/generic-associated-types/issue-101020.stderr +++ b/tests/ui/generic-associated-types/issue-101020.stderr @@ -13,7 +13,7 @@ note: required by a bound in `LendingIterator::consume` --> $DIR/issue-101020.rs:9:33 | LL | fn consume(self, _f: F) - | ------- required by a bound in this + | ------- required by a bound in this associated function ... LL | for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume` 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 e8770aedf..f0212e985 100644 --- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -15,8 +15,8 @@ LL | type Item<'a>: std::ops::Deref; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` help: consider further restricting this bound | -LL | impl> UnsafeCopy for T { - | +++++++++++++++++++ +LL | impl> UnsafeCopy for T { + | ++++++++++++ error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/issue-74684-1.stderr b/tests/ui/generic-associated-types/issue-74684-1.stderr index cacc97307..b93ee3798 100644 --- a/tests/ui/generic-associated-types/issue-74684-1.stderr +++ b/tests/ui/generic-associated-types/issue-74684-1.stderr @@ -4,6 +4,7 @@ error[E0597]: `a` does not live long enough LL | fn bug<'a, T: ?Sized + Fun = [u8]>>(_ : Box) -> &'static T::F<'a> { | -- lifetime `'a` defined here LL | let a = [0; 1]; + | - binding `a` declared here LL | let _x = T::identity(&a); | ------------^^- | | | diff --git a/tests/ui/generic-associated-types/issue-79422.extended.stderr b/tests/ui/generic-associated-types/issue-79422.extended.stderr index d79de0ca6..04184fce9 100644 --- a/tests/ui/generic-associated-types/issue-79422.extended.stderr +++ b/tests/ui/generic-associated-types/issue-79422.extended.stderr @@ -14,11 +14,11 @@ help: add missing lifetime argument LL | as Box = dyn RefCont<'_, u8>>>; | ++++ -error[E0271]: type mismatch resolving ` as MapLike>::VRefCont<'_> == (dyn RefCont<'_, u8> + 'static)` +error[E0271]: type mismatch resolving ` as MapLike>::VRefCont<'_> == dyn RefCont<'_, u8>` --> $DIR/issue-79422.rs:44:13 | LL | let m = Box::new(std::collections::BTreeMap::::new()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as MapLike>::VRefCont<'_> == (dyn RefCont<'_, u8> + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as MapLike>::VRefCont<'_> == dyn RefCont<'_, u8>` | note: expected this to be `(dyn RefCont<'_, u8> + 'static)` --> $DIR/issue-79422.rs:28:25 diff --git a/tests/ui/generic-associated-types/issue-88360.fixed b/tests/ui/generic-associated-types/issue-88360.fixed new file mode 100644 index 000000000..3dea8bf7a --- /dev/null +++ b/tests/ui/generic-associated-types/issue-88360.fixed @@ -0,0 +1,20 @@ +// run-rustfix + +trait GatTrait { + type Gat<'a> where Self: 'a; + + fn test(&self) -> Self::Gat<'_>; +} + +trait SuperTrait +where + Self: 'static, + for<'a> Self: GatTrait = &'a T>, +{ + fn copy(&self) -> Self::Gat<'_> where T: Copy { + self.test() + //~^ mismatched types + } +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/issue-88360.rs b/tests/ui/generic-associated-types/issue-88360.rs index c02690618..4d4c7ea31 100644 --- a/tests/ui/generic-associated-types/issue-88360.rs +++ b/tests/ui/generic-associated-types/issue-88360.rs @@ -1,3 +1,5 @@ +// run-rustfix + trait GatTrait { type Gat<'a> where Self: 'a; diff --git a/tests/ui/generic-associated-types/issue-88360.stderr b/tests/ui/generic-associated-types/issue-88360.stderr index cd3750344..520aeff18 100644 --- a/tests/ui/generic-associated-types/issue-88360.stderr +++ b/tests/ui/generic-associated-types/issue-88360.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-88360.rs:13:9 + --> $DIR/issue-88360.rs:15:9 | LL | trait SuperTrait | - this type parameter @@ -7,13 +7,15 @@ LL | trait SuperTrait LL | fn copy(&self) -> Self::Gat<'_> where T: Copy { | ------------- expected `&T` because of return type LL | *self.test() - | ^^^^^^^^^^^^ - | | - | expected `&T`, found type parameter `T` - | help: consider borrowing here: `&*self.test()` + | ^^^^^^^^^^^^ expected `&T`, found type parameter `T` | = note: expected reference `&T` found type parameter `T` +help: consider removing deref here + | +LL - *self.test() +LL + self.test() + | error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs b/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs deleted file mode 100644 index 83655341d..000000000 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Test that the predicate printed in an unresolved method error prints the -// generics for a generic associated type. - -trait X { - type Y; -} - -trait M { - fn f(&self) {} -} - -impl = i32>> M for T {} -//~^ NOTE trait bound `::Y = i32` was not satisfied -//~| NOTE -//~| NOTE -//~| NOTE - -struct S; -//~^ NOTE method `f` not found for this -//~| NOTE doesn't satisfy `::Y = i32` -//~| NOTE doesn't satisfy `S: M` - -impl X for S { - type Y = bool; -} - -fn f(a: S) { - a.f(); - //~^ ERROR the method `f` exists for struct `S`, but its trait bounds were not satisfied - //~| NOTE method cannot be called on `S` due to unsatisfied trait bounds -} - -fn main() {} diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr deleted file mode 100644 index baef38f6b..000000000 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:28:7 - | -LL | struct S; - | -------- - | | - | method `f` not found for this struct - | doesn't satisfy `::Y = i32` - | doesn't satisfy `S: M` -... -LL | a.f(); - | ^ method cannot be called on `S` due to unsatisfied trait bounds - | -note: trait bound `::Y = i32` was not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:12:11 - | -LL | impl = i32>> M for T {} - | ^^^^^^^^^^^^ - - - | | - | unsatisfied trait bound introduced here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs new file mode 100644 index 000000000..83655341d --- /dev/null +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs @@ -0,0 +1,33 @@ +// Test that the predicate printed in an unresolved method error prints the +// generics for a generic associated type. + +trait X { + type Y; +} + +trait M { + fn f(&self) {} +} + +impl = i32>> M for T {} +//~^ NOTE trait bound `::Y = i32` was not satisfied +//~| NOTE +//~| NOTE +//~| NOTE + +struct S; +//~^ NOTE method `f` not found for this +//~| NOTE doesn't satisfy `::Y = i32` +//~| NOTE doesn't satisfy `S: M` + +impl X for S { + type Y = bool; +} + +fn f(a: S) { + a.f(); + //~^ ERROR the method `f` exists for struct `S`, but its trait bounds were not satisfied + //~| NOTE method cannot be called on `S` due to unsatisfied trait bounds +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr new file mode 100644 index 000000000..4246f8c06 --- /dev/null +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr @@ -0,0 +1,24 @@ +error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:28:7 + | +LL | struct S; + | -------- + | | + | method `f` not found for this struct + | doesn't satisfy `::Y = i32` + | doesn't satisfy `S: M` +... +LL | a.f(); + | ^ method cannot be called on `S` due to unsatisfied trait bounds + | +note: trait bound `::Y = i32` was not satisfied + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:12:11 + | +LL | impl = i32>> M for T {} + | ^^^^^^^^^^^^ - - + | | + | unsatisfied trait bound introduced here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/generic-associated-types/missing-bounds.fixed b/tests/ui/generic-associated-types/missing-bounds.fixed index ee758f19e..054adbffb 100644 --- a/tests/ui/generic-associated-types/missing-bounds.fixed +++ b/tests/ui/generic-associated-types/missing-bounds.fixed @@ -4,7 +4,7 @@ use std::ops::Add; struct A(B); -impl Add for A where B: Add + Add { +impl Add for A where B: Add { type Output = Self; fn add(self, rhs: Self) -> Self { @@ -14,7 +14,7 @@ impl Add for A where B: Add + Add { struct C(B); -impl> Add for C { +impl> Add for C { type Output = Self; fn add(self, rhs: Self) -> Self { @@ -34,7 +34,7 @@ impl> Add for D { struct E(B); -impl> Add for E where B: Add { +impl> Add for E where B: Add { //~^ ERROR equality constraints are not yet supported in `where` clauses type Output = Self; diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index 9f669b9a5..535edec57 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -37,8 +37,8 @@ LL | struct A(B); | ^ help: consider further restricting this bound | -LL | impl Add for A where B: Add + Add { - | +++++++++++++++++ +LL | impl Add for A where B: Add { + | ++++++++++++ error[E0308]: mismatched types --> $DIR/missing-bounds.rs:21:14 @@ -60,8 +60,8 @@ LL | struct C(B); | ^ help: consider further restricting this bound | -LL | impl> Add for C { - | +++++++++++++++++ +LL | impl> Add for C { + | ++++++++++++ error[E0369]: cannot add `B` to `B` --> $DIR/missing-bounds.rs:31:21 @@ -96,8 +96,8 @@ LL | struct E(B); | ^ help: consider further restricting this bound | -LL | impl> Add for E where ::Output = B { - | +++++++++++++++++ +LL | impl> Add for E where ::Output = B { + | ++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.rs b/tests/ui/generic-associated-types/missing_lifetime_args.rs index 78def8092..331511ba6 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.rs +++ b/tests/ui/generic-associated-types/missing_lifetime_args.rs @@ -12,9 +12,9 @@ fn foo<'c, 'd>(_arg: Box>) {} //~^ ERROR missing generics for associated type fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} -//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime +//~^ ERROR struct takes 3 lifetime arguments but 2 lifetime fn f<'a>(_arg: Foo<'a>) {} -//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime +//~^ ERROR struct takes 3 lifetime arguments but 1 lifetime fn main() {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.stderr b/tests/ui/generic-associated-types/missing_lifetime_args.stderr index 8f74b12c0..1a7a2e787 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_args.stderr @@ -14,7 +14,7 @@ help: add missing lifetime arguments LL | fn foo<'c, 'd>(_arg: Box = (&'c u32, &'d u32)>>) {} | ++++++++ -error[E0107]: this struct takes 3 lifetime arguments but 2 lifetime arguments were supplied +error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/missing_lifetime_args.rs:14:26 | LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} @@ -32,7 +32,7 @@ help: add missing lifetime argument LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} | ++++ -error[E0107]: this struct takes 3 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing_lifetime_args.rs:17:16 | LL | fn f<'a>(_arg: Foo<'a>) {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_const.rs b/tests/ui/generic-associated-types/missing_lifetime_const.rs index 8b174b9e9..6e395dfde 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_const.rs +++ b/tests/ui/generic-associated-types/missing_lifetime_const.rs @@ -4,7 +4,7 @@ trait Foo { fn foo() { let _: ::Assoc<3>; - //~^ ERROR this associated type + //~^ ERROR associated type } fn main() {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_const.stderr b/tests/ui/generic-associated-types/missing_lifetime_const.stderr index 62d2e9f49..41945aabf 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_const.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_const.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/missing_lifetime_const.rs:6:24 | LL | let _: ::Assoc<3>; diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.rs b/tests/ui/generic-associated-types/parameter_number_and_kind.rs index 8428e7763..ae2f7c00e 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.rs +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.rs @@ -9,10 +9,10 @@ trait Foo { // Test parameters in default values type FOk = Self::E<'static, T>; type FErr1 = Self::E<'static, 'static>; - //~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this associated type takes 1 + //~^ ERROR associated type takes 1 lifetime argument but 2 lifetime arguments were supplied + //~| ERROR associated type takes 1 type FErr2 = Self::E<'static, T, u32>; - //~^ ERROR this associated type takes 1 + //~^ ERROR associated type takes 1 } fn main() {} diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index c20b9669e..4523044b5 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; @@ -12,7 +12,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a` LL | type E<'a, T>; | ^ -- -error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; @@ -28,7 +28,7 @@ help: add missing generic argument LL | type FErr1 = Self::E<'static, 'static, T>; | +++ -error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: associated type takes 1 generic argument but 2 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2 = Self::E<'static, T, u32>; diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs index 1622b92aa..c58f9cf1d 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs @@ -4,8 +4,8 @@ trait X { const _: () = { fn f2<'a>(arg : Box = &'a ()>>) {} - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument + //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 0 generic arguments but 1 generic argument }; fn main() {} diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 0a09ec5dc..fab5b474d 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} @@ -14,7 +14,7 @@ help: add missing lifetime argument LL | fn f2<'a>(arg : Box = &'a ()>>) {} | +++ -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs deleted file mode 100644 index 1cc09aa6d..000000000 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs +++ /dev/null @@ -1,25 +0,0 @@ -pub trait X { - type Y<'a: 'static>; - //~^ WARNING unnecessary lifetime parameter -} - -impl X for () { - type Y<'a> = &'a (); -} - -struct B<'a, T: for<'r> X = &'r ()>> { - f: ::Y<'a>, - //~^ ERROR lifetime bound not satisfied -} - -struct C<'a, T: X> { - f: ::Y<'a>, - //~^ ERROR lifetime bound not satisfied -} - -struct D<'a> { - f: <() as X>::Y<'a>, - //~^ ERROR lifetime bound not satisfied -} - -fn main() {} diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr deleted file mode 100644 index fbd79879d..000000000 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr +++ /dev/null @@ -1,50 +0,0 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/unsatified-item-lifetime-bound.rs:2:12 - | -LL | type Y<'a: 'static>; - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:11:8 - | -LL | f: ::Y<'a>, - | ^^^^^^^^^^^^^^^ - | -note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:10:10 - | -LL | struct B<'a, T: for<'r> X = &'r ()>> { - | ^^ - = note: but lifetime parameter must outlive the static lifetime - -error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:16:8 - | -LL | f: ::Y<'a>, - | ^^^^^^^^^^^^^^^ - | -note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:15:10 - | -LL | struct C<'a, T: X> { - | ^^ - = note: but lifetime parameter must outlive the static lifetime - -error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:21:8 - | -LL | f: <() as X>::Y<'a>, - | ^^^^^^^^^^^^^^^^ - | -note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:20:10 - | -LL | struct D<'a> { - | ^^ - = note: but lifetime parameter must outlive the static lifetime - -error: aborting due to 3 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs new file mode 100644 index 000000000..060ee8821 --- /dev/null +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs @@ -0,0 +1,27 @@ +#![warn(unused_lifetimes)] + +pub trait X { + type Y<'a: 'static>; + //~^ WARNING unnecessary lifetime parameter +} + +impl X for () { + type Y<'a> = &'a (); +} + +struct B<'a, T: for<'r> X = &'r ()>> { + f: ::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +struct C<'a, T: X> { + f: ::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +struct D<'a> { + f: <() as X>::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr new file mode 100644 index 000000000..a69cd0028 --- /dev/null +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr @@ -0,0 +1,55 @@ +warning: unnecessary lifetime parameter `'a` + --> $DIR/unsatisfied-item-lifetime-bound.rs:4:12 + | +LL | type Y<'a: 'static>; + | ^^ + | + = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/unsatisfied-item-lifetime-bound.rs:1:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8 + | +LL | f: ::Y<'a>, + | ^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/unsatisfied-item-lifetime-bound.rs:12:10 + | +LL | struct B<'a, T: for<'r> X = &'r ()>> { + | ^^ + = note: but lifetime parameter must outlive the static lifetime + +error[E0478]: lifetime bound not satisfied + --> $DIR/unsatisfied-item-lifetime-bound.rs:18:8 + | +LL | f: ::Y<'a>, + | ^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/unsatisfied-item-lifetime-bound.rs:17: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 + | +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 + | +LL | struct D<'a> { + | ^^ + = note: but lifetime parameter must outlive the static lifetime + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generics/bad-mid-path-type-params.rs b/tests/ui/generics/bad-mid-path-type-params.rs index 23a5d1525..37d484cba 100644 --- a/tests/ui/generics/bad-mid-path-type-params.rs +++ b/tests/ui/generics/bad-mid-path-type-params.rs @@ -28,17 +28,17 @@ impl Trait for S2 { fn foo<'a>() { let _ = S::new::(1, 1.0); - //~^ ERROR this associated function takes 1 + //~^ ERROR associated function takes 1 let _ = S::<'a,isize>::new::(1, 1.0); - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied let _: S2 = Trait::new::(1, 1.0); - //~^ ERROR this associated function takes 1 + //~^ ERROR associated function takes 1 let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - //~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this associated function takes 1 + //~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR associated function takes 1 } fn main() {} diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index aee2b6015..71e15dd4c 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::(1, 1.0); @@ -12,7 +12,7 @@ note: associated function defined here, with 1 generic parameter: `U` LL | fn new(x: T, _: U) -> S { | ^^^ - -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::(1, 1.0); @@ -26,7 +26,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct S { | ^ -error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::(1, 1.0); @@ -40,7 +40,7 @@ note: associated function defined here, with 1 generic parameter: `U` LL | fn new(x: T, y: U) -> Self; | ^^^ - -error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); @@ -54,7 +54,7 @@ note: trait defined here, with 0 lifetime parameters LL | trait Trait { | ^^^^^ -error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); diff --git a/tests/ui/generics/generic-arg-mismatch-recover.rs b/tests/ui/generics/generic-arg-mismatch-recover.rs index 2cf7f1d65..947f33414 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.rs +++ b/tests/ui/generics/generic-arg-mismatch-recover.rs @@ -4,9 +4,9 @@ struct Bar<'a>(&'a ()); fn main() { Foo::<'static, 'static, ()>(&0); - //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied Bar::<'static, 'static, ()>(&()); - //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this struct takes 0 + //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied + //~| ERROR struct takes 0 } diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index 45fea925f..f549a7180 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); @@ -12,7 +12,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Foo<'a, T: 'a>(&'a T); | ^^^ -- -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); @@ -26,7 +26,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Bar<'a>(&'a ()); | ^^^ -- -error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); diff --git a/tests/ui/generics/generic-impl-less-params-with-defaults.rs b/tests/ui/generics/generic-impl-less-params-with-defaults.rs index 66afbb58a..6c0041156 100644 --- a/tests/ui/generics/generic-impl-less-params-with-defaults.rs +++ b/tests/ui/generics/generic-impl-less-params-with-defaults.rs @@ -9,5 +9,5 @@ impl Foo { fn main() { Foo::::new(); - //~^ ERROR this struct takes at least 2 generic arguments but 1 generic argument + //~^ ERROR struct takes at least 2 generic arguments but 1 generic argument } diff --git a/tests/ui/generics/generic-impl-less-params-with-defaults.stderr b/tests/ui/generics/generic-impl-less-params-with-defaults.stderr index cdbb57902..262561fa8 100644 --- a/tests/ui/generics/generic-impl-less-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-less-params-with-defaults.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/generic-impl-less-params-with-defaults.rs:11:5 | LL | Foo::::new(); diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.rs b/tests/ui/generics/generic-impl-more-params-with-defaults.rs index a28332374..be633ec46 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.rs +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.rs @@ -11,5 +11,5 @@ impl Vec { fn main() { Vec::::new(); - //~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments were supplied + //~^ ERROR struct takes at most 2 generic arguments but 3 generic arguments were supplied } diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index fe9b670da..2f4682c4e 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied +error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments were supplied --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::::new(); diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.rs b/tests/ui/generics/generic-type-more-params-with-defaults.rs index 3dab03297..b83fdb5c4 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.rs +++ b/tests/ui/generics/generic-type-more-params-with-defaults.rs @@ -7,5 +7,5 @@ struct Vec( fn main() { let _: Vec; - //~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments + //~^ ERROR struct takes at most 2 generic arguments but 3 generic arguments } diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index 7f0198f0e..4d01ba1f4 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied +error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments were supplied --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec; diff --git a/tests/ui/generics/generic-type-params-name-repr.rs b/tests/ui/generics/generic-type-params-name-repr.rs index 6e0beec66..d60856b89 100644 --- a/tests/ui/generics/generic-type-params-name-repr.rs +++ b/tests/ui/generics/generic-type-params-name-repr.rs @@ -12,40 +12,40 @@ fn main() { // Ensure that the printed type doesn't include the default type params... let _: Foo = (); //~^ ERROR mismatched types - //~| expected struct `Foo`, found `()` + //~| expected `Foo`, found `()` //~| expected struct `Foo` //~| found unit type `()` // ...even when they're present, but the same types as the defaults. let _: Foo = (); //~^ ERROR mismatched types - //~| expected struct `Foo`, found `()` + //~| expected `Foo`, found `()` //~| expected struct `Foo` //~| found unit type `()` // Including cases where the default is using previous type params. let _: HashMap = (); //~^ ERROR mismatched types - //~| expected struct `HashMap`, found `()` + //~| expected `HashMap`, found `()` //~| expected struct `HashMap` //~| found unit type `()` let _: HashMap> = (); //~^ ERROR mismatched types - //~| expected struct `HashMap`, found `()` + //~| expected `HashMap`, found `()` //~| expected struct `HashMap` //~| found unit type `()` // But not when there's a different type in between. let _: Foo = (); //~^ ERROR mismatched types - //~| expected struct `Foo`, found `()` + //~| expected `Foo`, found `()` //~| expected struct `Foo` //~| found unit type `()` // And don't print <> at all when there's just defaults. let _: Foo = (); //~^ ERROR mismatched types - //~| expected struct `Foo`, found `()` + //~| expected `Foo`, found `()` //~| expected struct `Foo` //~| found unit type `()` } diff --git a/tests/ui/generics/generic-type-params-name-repr.stderr b/tests/ui/generics/generic-type-params-name-repr.stderr index 4c3c00396..946f14cc1 100644 --- a/tests/ui/generics/generic-type-params-name-repr.stderr +++ b/tests/ui/generics/generic-type-params-name-repr.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:13:25 | LL | let _: Foo = (); - | ---------- ^^ expected struct `Foo`, found `()` + | ---------- ^^ expected `Foo`, found `()` | | | expected due to this | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:20:31 | LL | let _: Foo = (); - | ---------------- ^^ expected struct `Foo`, found `()` + | ---------------- ^^ expected `Foo`, found `()` | | | expected due to this | @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:27:37 | LL | let _: HashMap = (); - | ---------------------- ^^ expected struct `HashMap`, found `()` + | ---------------------- ^^ expected `HashMap`, found `()` | | | expected due to this | @@ -35,7 +35,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:32:51 | LL | let _: HashMap> = (); - | ------------------------------------ ^^ expected struct `HashMap`, found `()` + | ------------------------------------ ^^ expected `HashMap`, found `()` | | | expected due to this | @@ -46,7 +46,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:39:31 | LL | let _: Foo = (); - | ---------------- ^^ expected struct `Foo`, found `()` + | ---------------- ^^ expected `Foo`, found `()` | | | expected due to this | @@ -57,7 +57,7 @@ error[E0308]: mismatched types --> $DIR/generic-type-params-name-repr.rs:46:27 | LL | let _: Foo = (); - | ------------ ^^ expected struct `Foo`, found `()` + | ------------ ^^ expected `Foo`, found `()` | | | expected due to this | diff --git a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs index 9ea9fc71b..54b483f53 100644 --- a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs +++ b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.rs @@ -8,7 +8,6 @@ fn should_error() where T : Into<&u32> {} trait X<'a, K: 'a> { fn foo<'b, L: X<&'b Nested>>(); //~^ ERROR missing lifetime specifier [E0106] - //~| ERROR the type `&'b Nested` does not fulfill the required lifetime } fn bar<'b, L: X<&'b Nested>>(){} diff --git a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr index 9d859fddf..faf4c9eb8 100644 --- a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr +++ b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr @@ -29,7 +29,7 @@ LL | fn foo<'b, L: X<'lifetime, &'b Nested>>(); | ++++++++++ error[E0106]: missing lifetime specifier - --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:14:16 + --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:13:16 | LL | fn bar<'b, L: X<&'b Nested>>(){} | ^ expected named lifetime parameter @@ -39,19 +39,7 @@ help: consider using the `'b` lifetime LL | fn bar<'b, L: X<'b, &'b Nested>>(){} | +++ -error[E0477]: the type `&'b Nested` does not fulfill the required lifetime - --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:19 - | -LL | fn foo<'b, L: X<&'b Nested>>(); - | ^^^^^^^^^^^^^^^^ - | -note: type must satisfy the static lifetime as required by this binding - --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:8:16 - | -LL | trait X<'a, K: 'a> { - | ^^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0106, E0477, E0637. +Some errors have detailed explanations: E0106, E0637. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/generics/wrong-number-of-args.rs b/tests/ui/generics/wrong-number-of-args.rs index cd2f96a18..e4eaff21a 100644 --- a/tests/ui/generics/wrong-number-of-args.rs +++ b/tests/ui/generics/wrong-number-of-args.rs @@ -4,18 +4,18 @@ mod no_generics { type A = Ty; type B = Ty<'static>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics type C = Ty<'static, usize>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument - //~| ERROR this struct takes 0 generic arguments but 1 generic argument + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument + //~| ERROR struct takes 0 generic arguments but 1 generic argument //~| HELP remove this lifetime argument //~| HELP remove this generic argument type D = Ty<'static, usize, { 0 }>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument - //~| ERROR this struct takes 0 generic arguments but 2 generic arguments + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument + //~| ERROR struct takes 0 generic arguments but 2 generic arguments //~| HELP remove this lifetime argument //~| HELP remove these generic arguments } @@ -28,17 +28,17 @@ mod type_and_type { //~| HELP add missing type B = Ty; - //~^ ERROR this struct takes 2 generic arguments but 1 generic argument + //~^ ERROR struct takes 2 generic arguments but 1 generic argument //~| HELP add missing type C = Ty; type D = Ty; - //~^ ERROR this struct takes 2 generic arguments but 3 generic arguments + //~^ ERROR struct takes 2 generic arguments but 3 generic arguments //~| HELP remove this type E = Ty<>; - //~^ ERROR this struct takes 2 generic arguments but 0 generic arguments were supplied + //~^ ERROR struct takes 2 generic arguments but 0 generic arguments were supplied //~| HELP add missing } @@ -52,7 +52,7 @@ mod lifetime_and_type { //~| HELP consider introducing type B = Ty<'static>; - //~^ ERROR this struct takes 1 generic argument but 0 generic arguments + //~^ ERROR struct takes 1 generic argument but 0 generic arguments //~| HELP add missing type C = Ty; @@ -62,14 +62,14 @@ mod lifetime_and_type { type D = Ty<'static, usize>; type E = Ty<>; - //~^ ERROR this struct takes 1 generic argument but 0 generic arguments + //~^ ERROR struct takes 1 generic argument but 0 generic arguments //~| ERROR missing lifetime specifier //~| HELP consider introducing //~| HELP add missing type F = Ty<'static, usize, 'static, usize>; - //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments - //~| ERROR this struct takes 1 generic argument but 2 generic arguments + //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments + //~| ERROR struct takes 1 generic argument but 2 generic arguments //~| HELP remove this lifetime argument //~| HELP remove this generic argument } @@ -82,7 +82,7 @@ mod type_and_type_and_type { //~| HELP add missing type B = Ty; - //~^ ERROR this struct takes at least 2 + //~^ ERROR struct takes at least 2 //~| HELP add missing type C = Ty; @@ -90,11 +90,11 @@ mod type_and_type_and_type { type D = Ty; type E = Ty; - //~^ ERROR this struct takes at most 3 + //~^ ERROR struct takes at most 3 //~| HELP remove type F = Ty<>; - //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments + //~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments //~| HELP add missing } @@ -114,7 +114,7 @@ mod r#trait { } type A = Box>; - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| HELP remove type B = Box; @@ -123,7 +123,7 @@ mod r#trait { //~| HELP consider making the bound lifetime-generic type C = Box>; - //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied //~| HELP remove type D = Box; @@ -131,7 +131,7 @@ mod r#trait { //~| HELP add missing type E = Box>; - //~^ ERROR this trait takes 1 generic argument but 2 generic arguments + //~^ ERROR trait takes 1 generic argument but 2 generic arguments //~| HELP remove type F = Box>; @@ -140,7 +140,7 @@ mod r#trait { //~| HELP consider making the bound lifetime-generic type G = Box>; - //~^ ERROR this trait takes 1 generic argument but 0 generic arguments + //~^ ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing } @@ -151,7 +151,7 @@ mod associated_item { } type A = Box>; - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| HELP remove } @@ -166,14 +166,14 @@ mod associated_item { //~| HELP consider making the bound lifetime-generic type B = Box>; - //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied //~| HELP remove type C = Box>; //~^ ERROR missing lifetime specifier //~| HELP consider introducing //~| HELP consider making the bound lifetime-generic - //~| ERROR this trait takes 0 generic arguments but 1 generic argument + //~| ERROR trait takes 0 generic arguments but 1 generic argument //~| HELP remove } @@ -183,17 +183,17 @@ mod associated_item { } type A = Box>; - //~^ ERROR this trait takes 1 generic argument but 0 generic arguments + //~^ ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing type B = Box>; - //~^ ERROR this trait takes 1 generic argument but 2 generic arguments + //~^ ERROR trait takes 1 generic argument but 2 generic arguments //~| HELP remove type C = Box>; - //~^ ERROR this trait takes 1 generic argument but 0 generic arguments + //~^ ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing - //~| ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied //~| HELP remove } @@ -203,20 +203,20 @@ mod associated_item { } type A = Box>; - //~^ ERROR this trait takes 1 generic argument but 0 generic arguments + //~^ ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing //~| ERROR missing lifetime specifier //~| HELP consider introducing //~| HELP consider making the bound lifetime-generic type B = Box>; - //~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied + //~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied //~| HELP add missing type C = Box>; - //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied //~| HELP remove - //~| ERROR this trait takes 1 generic argument but 0 generic arguments + //~| ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing type D = Box>; @@ -228,21 +228,21 @@ mod associated_item { //~^ ERROR missing lifetime specifier //~| HELP consider introducing //~| HELP consider making the bound lifetime-generic - //~| ERROR this trait takes 1 generic argument but 2 generic arguments + //~| ERROR trait takes 1 generic argument but 2 generic arguments //~| HELP remove type F = Box>; - //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied //~| HELP remove type G = Box>; - //~^ ERROR this trait takes 1 generic argument but 2 generic arguments + //~^ ERROR trait takes 1 generic argument but 2 generic arguments //~| HELP remove type H = Box>; - //~^ ERROR this trait takes 1 lifetime argument but 2 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 2 lifetime arguments were supplied //~| HELP remove - //~| ERROR this trait takes 1 generic argument but 2 generic arguments + //~| ERROR trait takes 1 generic argument but 2 generic arguments //~| HELP remove } @@ -252,15 +252,15 @@ mod associated_item { } type A = Box>; - //~^ ERROR this trait takes 2 generic arguments but 0 generic arguments + //~^ ERROR trait takes 2 generic arguments but 0 generic arguments //~| HELP add missing type B = Box>; - //~^ ERROR this trait takes 2 generic arguments but 1 generic argument + //~^ ERROR trait takes 2 generic arguments but 1 generic argument //~| HELP add missing type C = Box>; - //~^ ERROR this trait takes 2 generic arguments but 3 generic arguments + //~^ ERROR trait takes 2 generic arguments but 3 generic arguments //~| HELP remove } @@ -275,7 +275,7 @@ mod associated_item { //~| HELP consider making the bound lifetime-generic type B = Box>; - //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| HELP add missing lifetime argument } @@ -288,17 +288,17 @@ mod associated_item { //~^ ERROR missing lifetime specifier //~| HELP consider introducing //~| HELP consider making the bound lifetime-generic - //~| ERROR this trait takes 1 generic argument but 0 generic arguments + //~| ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing type B = Box>; - //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| HELP add missing lifetime argument - //~| ERROR this trait takes 1 generic argument but 0 generic arguments + //~| ERROR trait takes 1 generic argument but 0 generic arguments //~| HELP add missing type C = Box>; - //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| HELP add missing lifetime argument } } @@ -312,21 +312,21 @@ mod stdlib { //~| HELP add missing type B = HashMap; - //~^ ERROR this struct takes at least + //~^ ERROR struct takes at least //~| HELP add missing type C = HashMap<'static>; - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics - //~| ERROR this struct takes at least 2 + //~| ERROR struct takes at least 2 //~| HELP add missing type D = HashMap; - //~^ ERROR this struct takes at most 3 + //~^ ERROR struct takes at most 3 //~| HELP remove this type E = HashMap<>; - //~^ ERROR this struct takes at least 2 generic arguments but 0 generic arguments + //~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments //~| HELP add missing } @@ -336,21 +336,21 @@ mod stdlib { //~| HELP add missing type B = Result; - //~^ ERROR this enum takes 2 generic arguments but 1 generic argument + //~^ ERROR enum takes 2 generic arguments but 1 generic argument //~| HELP add missing type C = Result<'static>; - //~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument + //~^ ERROR enum takes 0 lifetime arguments but 1 lifetime argument //~| HELP remove these generics - //~| ERROR this enum takes 2 generic arguments but 0 generic arguments + //~| ERROR enum takes 2 generic arguments but 0 generic arguments //~| HELP add missing type D = Result; - //~^ ERROR this enum takes 2 generic arguments but 3 generic arguments + //~^ ERROR enum takes 2 generic arguments but 3 generic arguments //~| HELP remove type E = Result<>; - //~^ ERROR this enum takes 2 generic arguments but 0 generic arguments + //~^ ERROR enum takes 2 generic arguments but 0 generic arguments //~| HELP add missing } } diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index 75e33f680..9006fb10b 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -167,7 +167,7 @@ help: consider introducing a named lifetime parameter LL | type A<'a> = Box>; | ++++ +++++++ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:6:14 | LL | type B = Ty<'static>; @@ -181,7 +181,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct Ty; | ^^ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; @@ -195,7 +195,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct Ty; | ^^ -error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; @@ -209,7 +209,7 @@ note: struct defined here, with 0 generic parameters LL | struct Ty; | ^^ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; @@ -223,7 +223,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct Ty; | ^^ -error[E0107]: this struct takes 0 generic arguments but 2 generic arguments were supplied +error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; @@ -253,7 +253,7 @@ help: add missing generic arguments LL | type A = Ty; | ++++++ -error[E0107]: this struct takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:30:14 | LL | type B = Ty; @@ -271,7 +271,7 @@ help: add missing generic argument LL | type B = Ty; | +++ -error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied +error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty; @@ -285,7 +285,7 @@ note: struct defined here, with 2 generic parameters: `A`, `B` LL | struct Ty; | ^^ - - -error[E0107]: this struct takes 2 generic arguments but 0 generic arguments were supplied +error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:40:14 | LL | type E = Ty<>; @@ -317,7 +317,7 @@ help: add missing generic argument LL | type A = Ty; | +++ -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:54:14 | LL | type B = Ty<'static>; @@ -333,7 +333,7 @@ help: add missing generic argument LL | type B = Ty<'static, T>; | +++ -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:64:14 | LL | type E = Ty<>; @@ -349,7 +349,7 @@ help: add missing generic argument LL | type E = Ty; | + -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; @@ -363,7 +363,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct Ty<'a, T>; | ^^ -- -error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; @@ -393,7 +393,7 @@ help: add missing generic arguments LL | type A = Ty; | ++++++ -error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:84:14 | LL | type B = Ty; @@ -411,7 +411,7 @@ help: add missing generic argument LL | type B = Ty; | +++ -error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied +error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:92:14 | LL | type E = Ty; @@ -425,7 +425,7 @@ note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` LL | struct Ty; | ^^ - - ---------------- -error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied +error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:96:14 | LL | type F = Ty<>; @@ -441,7 +441,7 @@ help: add missing generic arguments LL | type F = Ty; | ++++ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:116:22 | LL | type A = Box>; @@ -455,7 +455,7 @@ note: trait defined here, with 0 generic parameters LL | trait NonGeneric { | ^^^^^^^^^^ -error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:125:22 | LL | type C = Box>; @@ -485,7 +485,7 @@ help: add missing generic argument LL | type D = Box>; | +++ -error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:133:22 | LL | type E = Box>; @@ -499,7 +499,7 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericType { | ^^^^^^^^^^^ - -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:142:22 | LL | type G = Box>; @@ -515,7 +515,7 @@ help: add missing generic argument LL | type G = Box>; | + -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:153:26 | LL | type A = Box>; @@ -529,7 +529,7 @@ note: trait defined here, with 0 generic parameters LL | trait NonGenericAT { | ^^^^^^^^^^^^ -error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:168:26 | LL | type B = Box>; @@ -543,7 +543,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:172:26 | LL | type C = Box>; @@ -557,7 +557,7 @@ note: trait defined here, with 0 generic parameters LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:185:26 | LL | type A = Box>; @@ -573,7 +573,7 @@ help: add missing generic argument LL | type A = Box>; | ++ -error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:189:26 | LL | type B = Box>; @@ -587,7 +587,7 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ - -error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box>; @@ -601,7 +601,7 @@ note: trait defined here, with 0 lifetime parameters LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box>; @@ -617,7 +617,7 @@ help: add missing generic argument LL | type C = Box>; | +++ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:205:26 | LL | type A = Box>; @@ -633,7 +633,7 @@ help: add missing generic argument LL | type A = Box>; | ++ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:212:26 | LL | type B = Box>; @@ -649,7 +649,7 @@ help: add missing generic argument LL | type B = Box>; | +++ -error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box>; @@ -663,7 +663,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box>; @@ -679,7 +679,7 @@ help: add missing generic argument LL | type C = Box>; | +++ -error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:227:26 | LL | type E = Box>; @@ -693,7 +693,7 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:234:26 | LL | type F = Box>; @@ -707,7 +707,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:238:26 | LL | type G = Box>; @@ -721,7 +721,7 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; @@ -735,7 +735,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; @@ -749,7 +749,7 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0107]: this trait takes 2 generic arguments but 0 generic arguments were supplied +error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:254:26 | LL | type A = Box>; @@ -765,7 +765,7 @@ help: add missing generic arguments LL | type A = Box>; | +++++ -error[E0107]: this trait takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:258:26 | LL | type B = Box>; @@ -783,7 +783,7 @@ help: add missing generic argument LL | type B = Box>; | +++ -error[E0107]: this trait takes 2 generic arguments but 3 generic arguments were supplied +error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:262:26 | LL | type C = Box>; @@ -797,7 +797,7 @@ note: trait defined here, with 2 generic parameters: `A`, `B` LL | trait GenericTypeTypeAT { | ^^^^^^^^^^^^^^^^^ - - -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:277:26 | LL | type B = Box>; @@ -815,7 +815,7 @@ help: add missing lifetime argument LL | type B = Box>; | +++++++++ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:287:26 | LL | type A = Box>; @@ -831,7 +831,7 @@ help: add missing generic argument LL | type A = Box>; | ++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:294:26 | LL | type B = Box>; @@ -849,7 +849,7 @@ help: add missing lifetime argument LL | type B = Box>; | +++++++++ -error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:294:26 | LL | type B = Box>; @@ -865,7 +865,7 @@ help: add missing generic argument LL | type B = Box>; | +++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:300:26 | LL | type C = Box>; @@ -894,7 +894,7 @@ help: add missing generic arguments LL | type A = HashMap; | ++++++ -error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes at least 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:314:18 | LL | type B = HashMap; @@ -907,7 +907,7 @@ help: add missing generic argument LL | type B = HashMap; | +++ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; @@ -915,7 +915,7 @@ LL | type C = HashMap<'static>; | | | expected 0 lifetime arguments -error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied +error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; @@ -926,7 +926,7 @@ help: add missing generic arguments LL | type C = HashMap<'static, K, V>; | ++++++ -error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied +error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:324:18 | LL | type D = HashMap; @@ -934,7 +934,7 @@ LL | type D = HashMap; | | | expected at most 3 generic arguments -error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied +error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:328:18 | LL | type E = HashMap<>; @@ -956,7 +956,7 @@ help: add missing generic arguments LL | type A = Result; | ++++++ -error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:338:18 | LL | type B = Result; @@ -969,7 +969,7 @@ help: add missing generic argument LL | type B = Result; | +++ -error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; @@ -977,7 +977,7 @@ LL | type C = Result<'static>; | | | expected 0 lifetime arguments -error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied +error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; @@ -988,7 +988,7 @@ help: add missing generic arguments LL | type C = Result<'static, T, E>; | ++++++ -error[E0107]: this enum takes 2 generic arguments but 3 generic arguments were supplied +error[E0107]: enum takes 2 generic arguments but 3 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:348:18 | LL | type D = Result; @@ -996,7 +996,7 @@ LL | type D = Result; | | | expected 2 generic arguments -error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied +error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:352:18 | LL | type E = Result<>; diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr index 095a1c6af..6ce56ba4b 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99.., _] => {}, - | ^^ expected struct `Range`, found integer + | ^^ expected `Range<{integer}>`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr index 2ea3205dc..6f56ecd4c 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99..] => {}, - | ^^ expected struct `Range`, found integer + | ^^ expected `Range<{integer}>`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr index bbdf0c83f..b9b272c4c 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | ^ expected struct `Range`, found integer + | ^ expected `Range<{integer}>`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -17,7 +17,7 @@ LL | match [5..4, 99..105, 43..44] { LL | [..9, 99..100, _] => {}, | ^^ --- this is of type `{integer}` | | - | expected struct `Range`, found integer + | expected `Range<{integer}>`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | -- ^^^ expected struct `Range`, found integer + | -- ^^^ expected `Range<{integer}>`, found integer | | | this is of type `{integer}` | diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs new file mode 100644 index 000000000..30173b1b4 --- /dev/null +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.rs @@ -0,0 +1,9 @@ +fn main() { + let x = 42; + match x { + 0..=73 => {}, + 74..=> {}, + //~^ ERROR unexpected `>` after inclusive range + //~| NOTE this is parsed as an inclusive range `..=` + } +} diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr new file mode 100644 index 000000000..cb7f998df --- /dev/null +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-match-arrow.stderr @@ -0,0 +1,15 @@ +error: unexpected `>` after inclusive range + --> $DIR/half-open-range-pats-inclusive-match-arrow.rs:5:14 + | +LL | 74..=> {}, + | ---^ + | | + | this is parsed as an inclusive range `..=` + | +help: add a space between the pattern and `=>` + | +LL | 74.. => {}, + | + + +error: aborting due to previous error + diff --git a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr index c60842638..43e7f03b8 100644 --- a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr +++ b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match (0, 1) { | ------ this expression has type `({integer}, {integer})` LL | (PAT ..) => {} - | ^^^ expected tuple, found `u8` + | ^^^ expected `({integer}, {integer})`, found `u8` | = note: expected tuple `({integer}, {integer})` found type `u8` diff --git a/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr b/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr index 71e196c32..3662cbfb9 100644 --- a/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr +++ b/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr @@ -11,9 +11,9 @@ LL | | ), LL | | ) { | |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type LL | f - | ^ expected reference, found `u32` + | ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&...)))`, found `&dyn Fn(u32)` | - = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a ...) + 'a)) + 'a)) + 'a))` + = note: expected reference `&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&...)))))))))))` the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt' found reference `&dyn Fn(u32)` diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr index 8cda76b94..b1b8ffa8c 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr @@ -10,7 +10,7 @@ note: required by a bound in `want_bar_for_any_ccx` --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:32:15 | LL | fn want_bar_for_any_ccx(b: &B) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr index 88793a152..7f96909b6 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr @@ -10,7 +10,7 @@ note: required by a bound in `want_foo_for_any_tcx` --> $DIR/hrtb-higher-ranker-supertraits.rs:22:15 | LL | fn want_foo_for_any_tcx(f: &F) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where F : for<'tcx> Foo<'tcx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx` help: consider further restricting this bound @@ -30,7 +30,7 @@ note: required by a bound in `want_bar_for_any_ccx` --> $DIR/hrtb-higher-ranker-supertraits.rs:39:15 | LL | fn want_bar_for_any_ccx(b: &B) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr index 4886a3c8b..25af011e3 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/hrtb-identity-fn-borrows.rs:14:5 | LL | let y = f.call(&x); - | -- borrow of `x` occurs here + | -- `x` is borrowed here LL | x = 5; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed ... LL | drop(y); | - borrow later used here diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr index f31aa5546..765ea9f78 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr @@ -1,14 +1,21 @@ -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/hrtb-wrong-kind.rs:1:18 | LL | fn a() where for T: Copy {} | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable -error: only lifetime parameters can be used in this context +error[E0658]: only lifetime parameters can be used in this context --> $DIR/hrtb-wrong-kind.rs:4:24 | LL | fn b() where for [(); C]: Copy {} | ^ + | + = note: see issue #108185 for more information + = help: add `#![feature(non_lifetime_binders)]` 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/higher-rank-trait-bounds/issue-30786.rs b/tests/ui/higher-rank-trait-bounds/issue-30786.rs index e5f46f711..4a6399c8f 100644 --- a/tests/ui/higher-rank-trait-bounds/issue-30786.rs +++ b/tests/ui/higher-rank-trait-bounds/issue-30786.rs @@ -1,3 +1,5 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" + // rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:118:22 +error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:120:22 | LL | pub struct Map { | -------------------- @@ -8,19 +8,19 @@ LL | pub struct Map { | doesn't satisfy `_: StreamExt` ... LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Map: Stream` - `&'a mut &mut Map: Stream` - `&'a mut Map: Stream` - --> $DIR/issue-30786.rs:96:50 + `&'a mut &Map: Stream` + `&'a mut &mut Map: Stream` + `&'a mut Map: Stream` + --> $DIR/issue-30786.rs:98:50 | LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here -error[E0599]: the method `countx` exists for struct `Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:130:24 +error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, [closure@issue-30786.rs:131:30]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:132:24 | LL | pub struct Filter { | ----------------------- @@ -31,11 +31,12 @@ LL | pub struct Filter { LL | let count = filter.countx(); | ^^^^^^ method cannot be called due to unsatisfied trait bounds | + = note: the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/issue-30786/issue-30786.long-type-hash.txt' note: the following trait bounds were not satisfied: - `&'a mut &Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut &mut Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - --> $DIR/issue-30786.rs:96:50 + `&'a mut &Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream` + `&'a mut &mut Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream` + `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream` + --> $DIR/issue-30786.rs:98:50 | LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here diff --git a/tests/ui/higher-rank-trait-bounds/issue-39292.rs b/tests/ui/higher-rank-trait-bounds/issue-39292.rs new file mode 100644 index 000000000..968cf0891 --- /dev/null +++ b/tests/ui/higher-rank-trait-bounds/issue-39292.rs @@ -0,0 +1,17 @@ +// run-pass +// Regression test for issue #39292. The object vtable was being +// incorrectly left with a null pointer. + +trait Foo { + fn print<'a>(&'a self) where T: 'a { println!("foo"); } +} + +impl<'a> Foo<&'a ()> for () { } + +trait Bar: for<'a> Foo<&'a ()> { } + +impl Bar for () {} + +fn main() { + (&() as &dyn Bar).print(); // Segfault +} diff --git a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr index 810f7c28c..4d470ae70 100644 --- a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr +++ b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` +error[E0271]: type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` --> $DIR/issue-62203-hrtb-ice.rs:39:9 | LL | let v = Unit2.m( @@ -10,7 +10,7 @@ LL | | f: |x| { ... | LL | | }, LL | | }, - | |_________^ type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` + | |_________^ type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` | note: expected this to be `<_ as Ty<'_>>::V` --> $DIR/issue-62203-hrtb-ice.rs:21:14 @@ -25,7 +25,7 @@ note: required by a bound in `T1::m` --> $DIR/issue-62203-hrtb-ice.rs:27:51 | LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 - | - required by a bound in this + | - required by a bound in this associated function LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` @@ -42,7 +42,7 @@ LL | | f: |x| { ... | LL | | }, LL | | }, - | |_________^ expected struct `Unit3`, found struct `Unit4` + | |_________^ expected `Unit3`, found `Unit4` | note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to implement `for<'r> T0<'r, (&'r u8,)>` --> $DIR/issue-62203-hrtb-ice.rs:17:16 @@ -56,7 +56,7 @@ note: required by a bound in `T1::m` --> $DIR/issue-62203-hrtb-ice.rs:27:12 | LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 - | - required by a bound in this + | - required by a bound in this associated function LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr index 62d0128fd..edef6ccd3 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr @@ -15,7 +15,7 @@ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | LL | trait StackContext - | ------------ required by a bound in this + | ------------ required by a bound in this trait LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` @@ -37,7 +37,7 @@ note: required by a bound in `EthernetWorker` --> $DIR/issue-89118.rs:28:14 | LL | struct EthernetWorker(C) - | -------------- required by a bound in this + | -------------- required by a bound in this struct LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` @@ -59,7 +59,7 @@ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | LL | trait StackContext - | ------------ required by a bound in this + | ------------ required by a bound in this trait LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr index 6206b167b..5be33bccd 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr @@ -11,7 +11,7 @@ note: required by a bound in `upcast` --> $DIR/issue-90950.rs:27:42 | LL | fn upcast(x: Yoke) -> Yoke + 'static>> where - | ------ required by a bound in this + | ------ required by a bound in this function LL | Y: for<'a> Yokeable<'a>, LL | for<'a> >::Output: IsCovariant<'a> | ^^^^^^^^^^^^^^^ required by this bound in `upcast` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr index 51c964600..73388a725 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr @@ -8,7 +8,7 @@ note: required by a bound in `weird_bound` --> $DIR/norm-before-method-resolution.rs:18:40 | LL | fn weird_bound() -> X - | ----------- required by a bound in this + | ----------- required by a bound in this function ... LL | for<'a> >::Out: Copy | ^^^^ required by this bound in `weird_bound` diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index 0b23b1cc2..1c6a7b02f 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,2 +1,2 @@ -thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:518:5 +thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:525:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/impl-header-lifetime-elision/path-elided.stderr b/tests/ui/impl-header-lifetime-elision/path-elided.stderr index 0b7d3f1e8..18e4c618d 100644 --- a/tests/ui/impl-header-lifetime-elision/path-elided.stderr +++ b/tests/ui/impl-header-lifetime-elision/path-elided.stderr @@ -4,7 +4,6 @@ error[E0726]: implicit elided lifetime not allowed here LL | impl MyTrait for Foo { | ^^^ expected lifetime parameter | - = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | LL | impl MyTrait for Foo<'_> { diff --git a/tests/ui/impl-header-lifetime-elision/trait-elided.stderr b/tests/ui/impl-header-lifetime-elision/trait-elided.stderr index 412bba6be..74631a037 100644 --- a/tests/ui/impl-header-lifetime-elision/trait-elided.stderr +++ b/tests/ui/impl-header-lifetime-elision/trait-elided.stderr @@ -4,7 +4,6 @@ error[E0726]: implicit elided lifetime not allowed here LL | impl MyTrait for u32 {} | ^^^^^^^ expected lifetime parameter | - = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | LL | impl MyTrait<'_> for u32 {} diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr index feedfc40a..fd0358421 100644 --- a/tests/ui/impl-trait/auto-trait-leak.stderr +++ b/tests/ui/impl-trait/auto-trait-leak.stderr @@ -39,7 +39,7 @@ note: ...which requires type-checking `cycle1`... | LL | send(cycle2().clone()); | ^^^^ - = note: ...which requires evaluating trait selection obligation `impl core::clone::Clone: core::marker::Send`... + = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... note: ...which requires computing type of `cycle2::{opaque#0}`... --> $DIR/auto-trait-leak.rs:19:16 | @@ -80,7 +80,7 @@ note: ...which requires type-checking `cycle2`... | LL | send(cycle1().clone()); | ^^^^ - = note: ...which requires evaluating trait selection obligation `impl core::clone::Clone: core::marker::Send`... + = note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`... = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/auto-trait-leak.rs:1:1 diff --git a/tests/ui/impl-trait/bound-normalization-pass.rs b/tests/ui/impl-trait/bound-normalization-pass.rs index 51718079d..5613c1916 100644 --- a/tests/ui/impl-trait/bound-normalization-pass.rs +++ b/tests/ui/impl-trait/bound-normalization-pass.rs @@ -1,8 +1,6 @@ // check-pass // edition:2018 // revisions: default sa -//[sa] compile-flags: -Z save-analysis -//-^ To make this the regression test for #75962. #![feature(type_alias_impl_trait)] diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index 7f73d5e12..dc1e40ea5 100644 --- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35 | LL | fn fuz() -> (usize, Trait) { (42, Struct) } - | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct` + | ^^^^^^ expected `dyn Trait`, found `Struct` | = note: expected trait object `(dyn Trait + 'static)` found struct `Struct` @@ -16,14 +16,14 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) } | doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` - = note: required because it appears within the type `(usize, (dyn Trait + 'static))` + = note: required because it appears within the type `(usize, dyn Trait)` = note: the return type of a function must have a statically known size error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:39 | LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } - | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct` + | ^^^^^^ expected `dyn Trait`, found `Struct` | = note: expected trait object `(dyn Trait + 'static)` found struct `Struct` @@ -37,7 +37,7 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } | doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` - = note: required because it appears within the type `(usize, (dyn Trait + 'static))` + = note: required because it appears within the type `(usize, dyn Trait)` = note: the return type of a function must have a statically known size error[E0746]: return type cannot have an unboxed trait object @@ -110,7 +110,7 @@ LL | | Struct | | ------ expected because of this LL | | } else { LL | | 42 - | | ^^ expected struct `Struct`, found integer + | | ^^ expected `Struct`, found integer LL | | } | |_____- `if` and `else` have incompatible types @@ -144,7 +144,7 @@ LL | fn bam() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | return Struct; - | ^^^^^^ expected struct `Box`, found struct `Struct` + | ^^^^^^ expected `Box`, found `Struct` | = note: expected struct `Box<(dyn Trait + 'static)>` found struct `Struct` @@ -161,7 +161,7 @@ LL | fn bam() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ expected struct `Box`, found integer + | ^^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` @@ -178,7 +178,7 @@ LL | fn baq() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | return 0; - | ^ expected struct `Box`, found integer + | ^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` @@ -195,7 +195,7 @@ LL | fn baq() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ expected struct `Box`, found integer + | ^^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` @@ -212,7 +212,7 @@ LL | fn baz() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | Struct - | ^^^^^^ expected struct `Box`, found struct `Struct` + | ^^^^^^ expected `Box`, found `Struct` | = note: expected struct `Box<(dyn Trait + 'static)>` found struct `Struct` @@ -229,7 +229,7 @@ LL | fn baz() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ expected struct `Box`, found integer + | ^^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` @@ -246,7 +246,7 @@ LL | fn baw() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | 0 - | ^ expected struct `Box`, found integer + | ^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` @@ -263,7 +263,7 @@ LL | fn baw() -> Box { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ expected struct `Box`, found integer + | ^^ expected `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` diff --git a/tests/ui/impl-trait/equal-hidden-lifetimes.rs b/tests/ui/impl-trait/equal-hidden-lifetimes.rs index 79db88828..a6dbf3f08 100644 --- a/tests/ui/impl-trait/equal-hidden-lifetimes.rs +++ b/tests/ui/impl-trait/equal-hidden-lifetimes.rs @@ -5,7 +5,6 @@ // `'a == 'static` so `&'a i32` is fine as the return type fn equal_regions_static<'a: 'static>(x: &'a i32) -> impl Sized { - //~^ WARNING unnecessary lifetime parameter `'a` x } diff --git a/tests/ui/impl-trait/equal-hidden-lifetimes.stderr b/tests/ui/impl-trait/equal-hidden-lifetimes.stderr deleted file mode 100644 index 3e48aef55..000000000 --- a/tests/ui/impl-trait/equal-hidden-lifetimes.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/equal-hidden-lifetimes.rs:7:25 - | -LL | fn equal_regions_static<'a: 'static>(x: &'a i32) -> impl Sized { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: 1 warning emitted - diff --git a/tests/ui/impl-trait/equality2.stderr b/tests/ui/impl-trait/equality2.stderr index e399a6102..52f25d245 100644 --- a/tests/ui/impl-trait/equality2.stderr +++ b/tests/ui/impl-trait/equality2.stderr @@ -54,6 +54,7 @@ LL | x = (x.1, | = note: expected opaque type `impl Foo` (`u32`) found opaque type `impl Foo` (`i32`) + = note: distinct uses of `impl Trait` result in different opaque types error[E0308]: mismatched types --> $DIR/equality2.rs:41:10 @@ -69,6 +70,7 @@ LL | x.0); | = note: expected opaque type `impl Foo` (`i32`) found opaque type `impl Foo` (`u32`) + = note: distinct uses of `impl Trait` result in different opaque types error: aborting due to 4 previous errors; 1 warning emitted diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index c8b82783e..9c1011018 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/explicit-generic-args-for-impl.rs:4:5 | LL | foo::("".to_string()); diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr index 9d6db88d3..a26460c8e 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/not-enough-args.rs:4:5 | LL | f::<[u8]>("a", b"a"); diff --git a/tests/ui/impl-trait/feature-self-return-type.stderr b/tests/ui/impl-trait/feature-self-return-type.stderr index 601e53b76..b9b8d00ce 100644 --- a/tests/ui/impl-trait/feature-self-return-type.stderr +++ b/tests/ui/impl-trait/feature-self-return-type.stderr @@ -4,6 +4,7 @@ error[E0597]: `bar` does not live long enough LL | let x = { | - borrow later stored here LL | let bar = 22; + | --- binding `bar` declared here LL | Foo::new(&bar).into() | ^^^^ borrowed value does not live long enough LL | @@ -16,6 +17,7 @@ error[E0597]: `y` does not live long enough LL | let x = { | - borrow later stored here LL | let y = (); + | - binding `y` declared here LL | foo(&y) | ^^ borrowed value does not live long enough LL | @@ -28,6 +30,7 @@ error[E0597]: `y` does not live long enough LL | let x = { | - borrow later stored here LL | let y = (); + | - binding `y` declared here LL | foo(&y) | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/impl-trait/hidden-lifetimes.stderr b/tests/ui/impl-trait/hidden-lifetimes.stderr index 3cc47e1e8..bc8f559fd 100644 --- a/tests/ui/impl-trait/hidden-lifetimes.stderr +++ b/tests/ui/impl-trait/hidden-lifetimes.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not a --> $DIR/hidden-lifetimes.rs:29:5 | LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { - | -- hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here + | -- -------------- opaque type defined here + | | + | hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here LL | x | ^ | @@ -15,7 +17,9 @@ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not a --> $DIR/hidden-lifetimes.rs:46:5 | LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a { - | -- hidden type `Rc>` captures the lifetime `'b` as defined here + | -- -------------- opaque type defined here + | | + | hidden type `Rc>` captures the lifetime `'b` as defined here LL | x | ^ | diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr index 433b76b7a..d56e1273f 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.stderr @@ -1,6 +1,8 @@ error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds --> $DIR/impl-fn-hrtb-bounds-2.rs:5:9 | +LL | fn a() -> impl Fn(&u8) -> impl Debug { + | ---------- opaque type defined here LL | |x| x | --- ^ | | diff --git a/tests/ui/impl-trait/in-trait/deep-match.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr index 034ee5ea4..3eba419c0 100644 --- a/tests/ui/impl-trait/in-trait/deep-match.stderr +++ b/tests/ui/impl-trait/in-trait/deep-match.stderr @@ -4,7 +4,7 @@ error[E0053]: method `bar` has an incompatible return type for trait LL | fn bar() -> i32 { 0 } | ^^^ | | - | expected struct `Wrapper`, found `i32` + | expected `Wrapper<_>`, found `i32` | return type in trait | = note: expected struct `Wrapper<_>` 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 142b1bff1..cc3bdf0e5 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 @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | 42 | ^^- help: try using a conversion method: `.to_string()` | | - | expected struct `String`, found integer + | expected `String`, found integer error: aborting due to previous error 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 461247a3e..4742eb37d 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 @@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` --> $DIR/default-body-type-err.rs:7:22 | LL | fn lol(&self) -> impl Deref { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` LL | LL | &1i32 | ----- return type was inferred to be `&i32` here diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs new file mode 100644 index 000000000..8c50cc295 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs @@ -0,0 +1,17 @@ +// check-pass + +// This didn't work in the previous default RPITIT method hack attempt + +#![feature(return_position_impl_trait_in_trait)] +//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete + +trait Foo { + fn bar(x: bool) -> impl Sized { + if x { + let _: u32 = Self::bar(!x); + } + Default::default() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.stderr b/tests/ui/impl-trait/in-trait/default-method-constraint.stderr new file mode 100644 index 000000000..5e18605aa --- /dev/null +++ b/tests/ui/impl-trait/in-trait/default-method-constraint.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/default-method-constraint.rs:5:12 + | +LL | #![feature(return_position_impl_trait_in_trait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.stderr index 4dfd77222..3ec62020e 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.stderr @@ -24,16 +24,6 @@ LL | async fn owo(_: u8) {} | expected `()`, found `u8` | help: change the parameter type to match the trait: `()` | -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, found opaque type note: type in trait --> $DIR/method-signature-matches.rs:16:21 | diff --git a/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs b/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs new file mode 100644 index 000000000..dfce973d7 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/new-lowering-strategy/simple-trait.rs @@ -0,0 +1,11 @@ +// check-pass +// compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Foo { + fn foo() -> impl Sized; +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr index e10566017..c4fcaabe4 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr @@ -2,12 +2,12 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/signature-mismatch.rs:15:5 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; - | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + 'static` + | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` ... LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` | - = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + 'static` + = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '3` found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs index 9d27d3710..2fcffdf3f 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.rs +++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs @@ -15,6 +15,7 @@ where { fn bar(&self) -> U { //~^ ERROR method `bar` has an incompatible type for trait + //~| ERROR method with return-position `impl Trait` in trait cannot be specialized *self } } diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr index 37cfd7449..dc621d6b8 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr @@ -18,6 +18,14 @@ LL | fn bar(&self) -> impl Sized; = note: expected signature `fn(&U) -> impl Sized` found signature `fn(&U) -> U` -error: aborting due to previous error +error: method with return-position `impl Trait` in trait cannot be specialized + --> $DIR/specialization-broken.rs:16: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 + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/impl-trait/issue-102605.stderr b/tests/ui/impl-trait/issue-102605.stderr index d4aba9149..dfe18e43e 100644 --- a/tests/ui/impl-trait/issue-102605.stderr +++ b/tests/ui/impl-trait/issue-102605.stderr @@ -2,17 +2,15 @@ error[E0308]: mismatched types --> $DIR/issue-102605.rs:13:20 | LL | convert_result(foo()) - | -------------- ^^^^^ expected enum `Result`, found opaque type + | -------------- ^^^^^ expected `Result<(), _>`, found future | | | arguments to this function are incorrect | -note: while checking the return type of the `async fn` - --> $DIR/issue-102605.rs:3:19 +note: calling an async function returns a future + --> $DIR/issue-102605.rs:13:20 | -LL | async fn foo() -> Result<(), String> { - | ^^^^^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected enum `Result<(), _>` - found opaque type `impl Future>` +LL | convert_result(foo()) + | ^^^^^ note: function defined here --> $DIR/issue-102605.rs:7:4 | diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr new file mode 100644 index 000000000..477c964bd --- /dev/null +++ b/tests/ui/impl-trait/issue-55872-2.drop_tracking.stderr @@ -0,0 +1,8 @@ +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:17:9 + | +LL | async {} + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr b/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr new file mode 100644 index 000000000..c14bb5cc9 --- /dev/null +++ b/tests/ui/impl-trait/issue-55872-2.drop_tracking_mir.stderr @@ -0,0 +1,14 @@ +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:17:9 + | +LL | async {} + | ^^^^^^^^ + +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:17:9 + | +LL | async {} + | ^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr b/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr new file mode 100644 index 000000000..477c964bd --- /dev/null +++ b/tests/ui/impl-trait/issue-55872-2.no_drop_tracking.stderr @@ -0,0 +1,8 @@ +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:17:9 + | +LL | async {} + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/impl-trait/issue-55872-2.rs b/tests/ui/impl-trait/issue-55872-2.rs index 4443d3c4d..cbc7b5d62 100644 --- a/tests/ui/impl-trait/issue-55872-2.rs +++ b/tests/ui/impl-trait/issue-55872-2.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(type_alias_impl_trait)] @@ -13,6 +16,7 @@ impl Bar for S { fn foo() -> Self::E { async {} //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + //[drop_tracking_mir]~^^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias } } diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr index 11b8485c8..477c964bd 100644 --- a/tests/ui/impl-trait/issue-55872-2.stderr +++ b/tests/ui/impl-trait/issue-55872-2.stderr @@ -1,5 +1,5 @@ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-55872-2.rs:14:9 + --> $DIR/issue-55872-2.rs:17:9 | LL | async {} | ^^^^^^^^ diff --git a/tests/ui/impl-trait/issue-99914.stderr b/tests/ui/impl-trait/issue-99914.stderr index 074d5d58d..c86e9eadc 100644 --- a/tests/ui/impl-trait/issue-99914.stderr +++ b/tests/ui/impl-trait/issue-99914.stderr @@ -2,15 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-99914.rs:9:27 | LL | t.and_then(|t| -> _ { bar(t) }); - | ^^^^^^ expected enum `Result`, found opaque type + | ^^^^^^ expected `Result<_, Error>`, found future | -note: while checking the return type of the `async fn` - --> $DIR/issue-99914.rs:13:23 - | -LL | async fn bar(t: Okay) {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected enum `Result<_, Error>` - found opaque type `impl Future` help: try wrapping the expression in `Ok` | LL | t.and_then(|t| -> _ { Ok(bar(t)) }); diff --git a/tests/ui/impl-trait/issues/infinite-impl-trait-issue-38064.stderr b/tests/ui/impl-trait/issues/infinite-impl-trait-issue-38064.stderr index 16a1262ec..92a329062 100644 --- a/tests/ui/impl-trait/issues/infinite-impl-trait-issue-38064.stderr +++ b/tests/ui/impl-trait/issues/infinite-impl-trait-issue-38064.stderr @@ -8,13 +8,13 @@ LL | Foo(bar()) | ---------- returning here with type `Foo` ... LL | fn bar() -> impl Quux { - | --------- returning this opaque type `Foo` + | --------- returning this type `Foo` error[E0720]: cannot resolve opaque type --> $DIR/infinite-impl-trait-issue-38064.rs:14:13 | LL | fn foo() -> impl Quux { - | --------- returning this opaque type `Bar` + | --------- returning this type `Bar` ... LL | fn bar() -> impl Quux { | ^^^^^^^^^ recursive opaque type diff --git a/tests/ui/impl-trait/issues/issue-54600.stderr b/tests/ui/impl-trait/issues/issue-54600.stderr index 316566a57..7ef063af9 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/issue-54600.rs:4:19 | LL | let x: Option = Some(44_u32); diff --git a/tests/ui/impl-trait/issues/issue-54840.stderr b/tests/ui/impl-trait/issues/issue-54840.stderr index 8d82133ac..1d1316f0e 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method 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.stderr b/tests/ui/impl-trait/issues/issue-58504.stderr index 6656e9fc3..26ec2a4f9 100644 --- a/tests/ui/impl-trait/issues/issue-58504.stderr +++ b/tests/ui/impl-trait/issues/issue-58504.stderr @@ -1,4 +1,4 @@ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/issue-58504.rs:10:16 | LL | let gens: [impl Generator;2] = [ mk_gen(), mk_gen() ]; diff --git a/tests/ui/impl-trait/issues/issue-58956.stderr b/tests/ui/impl-trait/issues/issue-58956.stderr index 123fb4df4..2b4d0abdf 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 type +error[E0562]: `impl Trait` only allowed in function and inherent method 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/issue-58956.rs:9:17 | LL | let x: Wrap = Wrap(B); diff --git a/tests/ui/impl-trait/issues/issue-70971.stderr b/tests/ui/impl-trait/issues/issue-70971.stderr index 4dda4c22a..d066256bf 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method 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-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr index 5b05fb281..724f3c5d6 100644 --- a/tests/ui/impl-trait/issues/issue-74282.stderr +++ b/tests/ui/impl-trait/issues/issue-74282.stderr @@ -10,7 +10,7 @@ LL | Anonymous(|| { | | arguments to this struct are incorrect LL | | 3 LL | | }) - | |_____^ expected closure, found a different closure + | |_____^ expected opaque type, found closure | = note: expected opaque type `Closure` found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]` @@ -33,7 +33,7 @@ LL | | 3 LL | | }) | | ^- help: consider using a semicolon here: `;` | |______| - | expected `()`, found struct `Anonymous` + | expected `()`, found `Anonymous` error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/issues/issue-79099.stderr b/tests/ui/impl-trait/issues/issue-79099.stderr index 362c67daf..580250a62 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 = 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/issue-79099.rs:3:16 | LL | let f: impl core::future::Future = async { 1 }; 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 e635e554e..656bd0470 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 type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16 | LL | struct Foo(T); | ^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20 | LL | type Result = std::result::Result; diff --git a/tests/ui/impl-trait/issues/issue-84919.stderr b/tests/ui/impl-trait/issues/issue-84919.stderr index 5abe1bd87..36010fdef 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 binding +error[E0562]: `impl Trait` only allowed in function and inherent method 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.stderr b/tests/ui/impl-trait/issues/issue-86642.stderr index 0ec118d5b..b6f8a54f3 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 type +error[E0562]: `impl Trait` only allowed in function and inherent method 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-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr index 6c4aa3567..f3a773837 100644 --- a/tests/ui/impl-trait/issues/issue-86800.stderr +++ b/tests/ui/impl-trait/issues/issue-86800.stderr @@ -9,9 +9,7 @@ LL | type TransactionFuture<'__, O> = impl '__ + Future $DIR/issue-87295.rs:16:31 | LL | let _do_not_waste: Struct> = Struct::new(()); diff --git a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr index 908757080..5b0b1cc5e 100644 --- a/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr +++ b/tests/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr @@ -1,6 +1,9 @@ error[E0700]: hidden type for `E<'b, 'c>` captures lifetime that does not appear in bounds --> $DIR/error-handling-2.rs:22:5 | +LL | type E<'a, 'b> = impl Sized; + | ---------- opaque type defined here +LL | LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | -- hidden type `*mut &'a i32` captures the lifetime `'a` as defined here ... diff --git a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr index ec49a6179..68ac22a05 100644 --- a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr +++ b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Trait<'d, 'e>` captures lifetime that does n --> $DIR/ordinary-bounds-unrelated.rs:28:33 | LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> - | -- hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here + | -- ------------------ opaque type defined here + | | + | hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here ... LL | if condition() { a } else { b } | ^ diff --git a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr index c36f9bc69..493a9e66e 100644 --- a/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr +++ b/tests/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Trait<'a, 'b>` captures lifetime that does n --> $DIR/ordinary-bounds-unsuited.rs:31:33 | LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> - | -- hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here + | -- ------------------ opaque type defined here + | | + | hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here ... LL | if condition() { a } else { b } | ^ 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 9c81791fb..55e3cd950 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 @@ -2,8 +2,9 @@ error[E0700]: hidden type for `impl Copy` captures lifetime that does not appear --> $DIR/must_outlive_least_region_or_bound.rs:3:35 | LL | fn elided(x: &i32) -> impl Copy { x } - | ---- ^ - | | + | ---- --------- ^ + | | | + | | opaque type defined here | hidden type `&i32` captures the anonymous lifetime defined here | help: to declare that `impl Copy` captures `'_`, you can add an explicit `'_` lifetime bound @@ -15,8 +16,9 @@ error[E0700]: hidden type for `impl Copy` captures lifetime that does not appear --> $DIR/must_outlive_least_region_or_bound.rs:6:44 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } - | -- ^ - | | + | -- --------- ^ + | | | + | | opaque type defined here | hidden type `&'a i32` captures the lifetime `'a` as defined here | help: to declare that `impl Copy` captures `'a`, you can add an explicit `'a` lifetime bound @@ -100,7 +102,9 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not --> $DIR/must_outlive_least_region_or_bound.rs:38:5 | LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { - | -- hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13]` captures the lifetime `'b` as defined here + | -- ---------------- opaque type defined here + | | + | hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13]` captures the lifetime `'b` as defined here LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/nested-return-type2.rs b/tests/ui/impl-trait/nested-return-type2.rs index cc1f1f4ec..fe883ce6f 100644 --- a/tests/ui/impl-trait/nested-return-type2.rs +++ b/tests/ui/impl-trait/nested-return-type2.rs @@ -1,4 +1,7 @@ // check-pass +// compile-flags: -Zvalidate-mir + +// Using -Zvalidate-mir as a regression test for #107346. trait Duh {} diff --git a/tests/ui/impl-trait/nested-return-type2.stderr b/tests/ui/impl-trait/nested-return-type2.stderr index 3aed05ca1..09ad3bd05 100644 --- a/tests/ui/impl-trait/nested-return-type2.stderr +++ b/tests/ui/impl-trait/nested-return-type2.stderr @@ -1,5 +1,5 @@ warning: opaque type `impl Trait` does not satisfy its associated type bounds - --> $DIR/nested-return-type2.rs:25:24 + --> $DIR/nested-return-type2.rs:28:24 | LL | type Assoc: Duh; | --- this associated type bound is unsatisfied for `impl Send` diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr index e761a60e7..907822ebb 100644 --- a/tests/ui/impl-trait/nested-return-type4.stderr +++ b/tests/ui/impl-trait/nested-return-type4.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Future` captures lifeti --> $DIR/nested-return-type4.rs:4:5 | LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { - | -- hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here + | -- --------------------------------------------- opaque type defined here + | | + | hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here LL | async move { let _s = s; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr index 9a8f5a340..ffe84b8e8 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) -> impl Into { 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 +error[E0562]: `impl Trait` only allowed in function and inherent method 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) {} diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 548c89d0a..3c2c01dc2 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -145,7 +145,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it LL | pub trait Bar { | ^^^^^^^^^^^^^ -error[E0599]: no method named `method2` found for struct `Foo` in the current scope +error[E0599]: no method named `method2` found for struct `no_method_suggested_traits::Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:50:37 | LL | no_method_suggested_traits::Foo.method2(); @@ -158,7 +158,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it LL | pub trait Bar { | ^^^^^^^^^^^^^ -error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&Foo>>` in the current scope +error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&no_method_suggested_traits::Foo>>` in the current scope --> $DIR/no-method-suggested-traits.rs:52:71 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); @@ -171,7 +171,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it LL | pub trait Bar { | ^^^^^^^^^^^^^ -error[E0599]: no method named `method2` found for enum `Bar` in the current scope +error[E0599]: no method named `method2` found for enum `no_method_suggested_traits::Bar` in the current scope --> $DIR/no-method-suggested-traits.rs:54:40 | LL | no_method_suggested_traits::Bar::X.method2(); @@ -184,7 +184,7 @@ note: `foo::Bar` defines an item `method2`, perhaps you need to implement it LL | pub trait Bar { | ^^^^^^^^^^^^^ -error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&Bar>>` in the current scope +error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&no_method_suggested_traits::Bar>>` in the current scope --> $DIR/no-method-suggested-traits.rs:56:74 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); @@ -255,25 +255,25 @@ error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&usize>>` LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); | ^^^^^^^ method not found in `Rc<&mut Box<&usize>>` -error[E0599]: no method named `method3` found for struct `Foo` in the current scope +error[E0599]: no method named `method3` found for struct `no_method_suggested_traits::Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:71:37 | LL | no_method_suggested_traits::Foo.method3(); | ^^^^^^^ method not found in `Foo` -error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&Foo>>` in the current scope +error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&no_method_suggested_traits::Foo>>` in the current scope --> $DIR/no-method-suggested-traits.rs:72:71 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); | ^^^^^^^ method not found in `Rc<&mut Box<&Foo>>` -error[E0599]: no method named `method3` found for enum `Bar` in the current scope +error[E0599]: no method named `method3` found for enum `no_method_suggested_traits::Bar` in the current scope --> $DIR/no-method-suggested-traits.rs:74:40 | LL | no_method_suggested_traits::Bar::X.method3(); | ^^^^^^^ method not found in `Bar` -error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&Bar>>` in the current scope +error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&no_method_suggested_traits::Bar>>` in the current scope --> $DIR/no-method-suggested-traits.rs:75:74 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); diff --git a/tests/ui/impl-trait/normalize-tait-in-const.rs b/tests/ui/impl-trait/normalize-tait-in-const.rs index 020bcbb83..d2e34c00b 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.rs +++ b/tests/ui/impl-trait/normalize-tait-in-const.rs @@ -2,6 +2,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 #![feature(type_alias_impl_trait)] diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index b9fc8726f..84b009187 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -1,4 +1,4 @@ -error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize fn(&'a Alias<'b>) {foo} as std::ops::FnOnce<(&&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead +error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:LL:CC: Failed to normalize fn(&'a Alias<'b>) {foo} as std::ops::FnOnce<(&&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `BAR` diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr index d6f5a1ac2..e5147bcea 100644 --- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr +++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr @@ -5,7 +5,7 @@ LL | fn can() -> impl NotObjectSafe { | ------------------ expected `A` because of return type ... LL | B - | ^ expected struct `A`, found struct `B` + | ^ expected `A`, found `B` error[E0308]: mismatched types --> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:43:5 @@ -14,7 +14,7 @@ LL | fn cat() -> impl ObjectSafe { | --------------- expected `A` because of return type ... LL | B - | ^ expected struct `A`, found struct `B` + | ^ expected `A`, found `B` error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr new file mode 100644 index 000000000..43118ae38 --- /dev/null +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking.stderr @@ -0,0 +1,152 @@ +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:11:22 + | +LL | fn option(i: i32) -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | if i < 0 { None } else { Some((option(i - 1), i)) } + | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>` + | | + | returning here with type `Option<(impl Sized, i32)>` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:16:15 + | +LL | fn tuple() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (tuple(),) + | ---------- returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:21:15 + | +LL | fn array() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | [array()] + | --------- returning here with type `[impl Sized; 1]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:26:13 + | +LL | fn ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | &ptr() as *const _ + | ------------------ returning here with type `*const impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:31:16 + | +LL | fn fn_ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | fn_ptr as fn() -> _ + | ------------------- returning here with type `fn() -> impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:36:25 + | +LL | fn closure_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:44:29 + | +LL | fn closure_ref_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | &x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:52:21 + | +LL | fn closure_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || closure_sig() + | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:57:23 + | +LL | fn generator_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || generator_sig() + | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:62:27 + | +LL | fn generator_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | yield; +LL | | x; + | | - generator captures itself here +LL | | } + | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:71:35 + | +LL | fn substs_change() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (substs_change::<&T>(),) + | ------------------------ returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:76:24 + | +LL | fn generator_hold() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | / move || { +LL | | let x = generator_hold(); + | | - generator captures itself here +LL | | yield; +LL | | x; +LL | | } + | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:90:26 + | +LL | fn mutual_recursion() -> impl Sync { + | ^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion_b() + | -------------------- returning here with type `impl Sized` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ---------- returning this opaque type `impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:95:28 + | +LL | fn mutual_recursion() -> impl Sync { + | --------- returning this opaque type `impl Sync` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion() + | ------------------ returning here with type `impl Sync` + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr new file mode 100644 index 000000000..662c74bcd --- /dev/null +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.drop_tracking_mir.stderr @@ -0,0 +1,144 @@ +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:11:22 + | +LL | fn option(i: i32) -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | if i < 0 { None } else { Some((option(i - 1), i)) } + | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>` + | | + | returning here with type `Option<(impl Sized, i32)>` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:16:15 + | +LL | fn tuple() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (tuple(),) + | ---------- returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:21:15 + | +LL | fn array() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | [array()] + | --------- returning here with type `[impl Sized; 1]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:26:13 + | +LL | fn ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | &ptr() as *const _ + | ------------------ returning here with type `*const impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:31:16 + | +LL | fn fn_ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | fn_ptr as fn() -> _ + | ------------------- returning here with type `fn() -> impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:36:25 + | +LL | fn closure_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:44:29 + | +LL | fn closure_ref_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | &x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:52:21 + | +LL | fn closure_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || closure_sig() + | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:57:23 + | +LL | fn generator_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || generator_sig() + | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:62:27 + | +LL | fn generator_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | yield; +LL | | x; + | | - generator captures itself here +LL | | } + | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:71:35 + | +LL | fn substs_change() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (substs_change::<&T>(),) + | ------------------------ returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:76:24 + | +LL | fn generator_hold() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:90:26 + | +LL | fn mutual_recursion() -> impl Sync { + | ^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion_b() + | -------------------- returning here with type `impl Sized` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ---------- returning this opaque type `impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:95:28 + | +LL | fn mutual_recursion() -> impl Sync { + | --------- returning this opaque type `impl Sync` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion() + | ------------------ returning here with type `impl Sync` + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr new file mode 100644 index 000000000..43118ae38 --- /dev/null +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.no_drop_tracking.stderr @@ -0,0 +1,152 @@ +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:11:22 + | +LL | fn option(i: i32) -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | if i < 0 { None } else { Some((option(i - 1), i)) } + | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>` + | | + | returning here with type `Option<(impl Sized, i32)>` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:16:15 + | +LL | fn tuple() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (tuple(),) + | ---------- returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:21:15 + | +LL | fn array() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | [array()] + | --------- returning here with type `[impl Sized; 1]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:26:13 + | +LL | fn ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | &ptr() as *const _ + | ------------------ returning here with type `*const impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:31:16 + | +LL | fn fn_ptr() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | fn_ptr as fn() -> _ + | ------------------- returning here with type `fn() -> impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:36:25 + | +LL | fn closure_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:39:5: 39:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:44:29 + | +LL | fn closure_ref_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | &x; + | | - closure captures itself here +LL | | } + | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:47:5: 47:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:52:21 + | +LL | fn closure_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || closure_sig() + | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:54:5: 54:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:57:23 + | +LL | fn generator_sig() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | || generator_sig() + | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:59:5: 59:7]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:62:27 + | +LL | fn generator_capture() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | / move || { +LL | | yield; +LL | | x; + | | - generator captures itself here +LL | | } + | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:65:5: 65:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:71:35 + | +LL | fn substs_change() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | (substs_change::<&T>(),) + | ------------------------ returning here with type `(impl Sized,)` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:76:24 + | +LL | fn generator_hold() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | / move || { +LL | | let x = generator_hold(); + | | - generator captures itself here +LL | | yield; +LL | | x; +LL | | } + | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:90:26 + | +LL | fn mutual_recursion() -> impl Sync { + | ^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion_b() + | -------------------- returning here with type `impl Sized` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ---------- returning this opaque type `impl Sized` + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-impl-trait-type-indirect.rs:95:28 + | +LL | fn mutual_recursion() -> impl Sync { + | --------- returning this opaque type `impl Sync` +... +LL | fn mutual_recursion_b() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +LL | +LL | mutual_recursion() + | ------------------ returning here with type `impl Sync` + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs index ffc0cd9d1..630372e13 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs @@ -1,3 +1,7 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + // Test that impl trait does not allow creating recursive types that are // otherwise forbidden. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr deleted file mode 100644 index ebb231ae1..000000000 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr +++ /dev/null @@ -1,152 +0,0 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:7:22 - | -LL | fn option(i: i32) -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | if i < 0 { None } else { Some((option(i - 1), i)) } - | ---- ------------------------ returning here with type `Option<(impl Sized, i32)>` - | | - | returning here with type `Option<(impl Sized, i32)>` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:12:15 - | -LL | fn tuple() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | (tuple(),) - | ---------- returning here with type `(impl Sized,)` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:17:15 - | -LL | fn array() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | [array()] - | --------- returning here with type `[impl Sized; 1]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:22:13 - | -LL | fn ptr() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | &ptr() as *const _ - | ------------------ returning here with type `*const impl Sized` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:27:16 - | -LL | fn fn_ptr() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | fn_ptr as fn() -> _ - | ------------------- returning here with type `fn() -> impl Sized` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:32:25 - | -LL | fn closure_capture() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -... -LL | / move || { -LL | | x; - | | - closure captures itself here -LL | | } - | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 35:12]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:40:29 - | -LL | fn closure_ref_capture() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -... -LL | / move || { -LL | | &x; - | | - closure captures itself here -LL | | } - | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 43:12]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:48:21 - | -LL | fn closure_sig() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | || closure_sig() - | ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:7]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:53:23 - | -LL | fn generator_sig() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | || generator_sig() - | ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs: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 { - | ^^^^^^^^^^ recursive opaque type -... -LL | / move || { -LL | | yield; -LL | | x; - | | - generator captures itself here -LL | | } - | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:67:35 - | -LL | fn substs_change() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | (substs_change::<&T>(),) - | ------------------------ returning here with type `(impl Sized,)` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:72:24 - | -LL | fn generator_hold() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | / move || { -LL | | let x = generator_hold(); - | | - generator captures itself here -LL | | yield; -LL | | x; -LL | | } - | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 74:12]` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:86:26 - | -LL | fn mutual_recursion() -> impl Sync { - | ^^^^^^^^^ recursive opaque type -LL | -LL | mutual_recursion_b() - | -------------------- returning here with type `impl Sized` -... -LL | fn mutual_recursion_b() -> impl Sized { - | ---------- returning this opaque type `impl Sized` - -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-impl-trait-type-indirect.rs:91:28 - | -LL | fn mutual_recursion() -> impl Sync { - | --------- returning this opaque type `impl Sync` -... -LL | fn mutual_recursion_b() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | mutual_recursion() - | ------------------ returning here with type `impl Sync` - -error: aborting due to 14 previous errors - -For more information about this error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index c7c6ca440..f7aff4195 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -15,7 +15,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Foo, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected struct `Bar`, found opaque type + | expected `a::Bar`, found opaque type | help: change the parameter type to match the trait: `&(a::Bar, i32)` | = note: expected signature `fn(&a::Bar, &(a::Bar, i32)) -> _` @@ -38,7 +38,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected opaque type, found struct `Bar` + | expected opaque type, found `b::Bar` | help: change the parameter type to match the trait: `&(b::Foo, i32)` | = note: expected signature `fn(&b::Bar, &(b::Foo, i32)) -> _` diff --git a/tests/ui/impl-trait/region-escape-via-bound.stderr b/tests/ui/impl-trait/region-escape-via-bound.stderr index 44a790cb1..e4556bc21 100644 --- a/tests/ui/impl-trait/region-escape-via-bound.stderr +++ b/tests/ui/impl-trait/region-escape-via-bound.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Trait<'y>` captures lifetime that does not a --> $DIR/region-escape-via-bound.rs:17:5 | LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> - | -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here + | -- -------------- opaque type defined here + | | + | hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here ... LL | x | ^ diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index c451f8e37..488cb821c 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that --> $DIR/static-return-lifetime-infered.rs:7:9 | LL | fn iter_values_anon(&self) -> impl Iterator { - | ----- hidden type `Map, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here + | ----- ----------------------- opaque type defined here + | | + | hidden type `Map, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -15,7 +17,9 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that --> $DIR/static-return-lifetime-infered.rs:11:9 | LL | fn iter_values<'a>(&'a self) -> impl Iterator { - | -- hidden type `Map, [closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30]>` captures the lifetime `'a` as defined here + | -- ----------------------- opaque type defined here + | | + | hidden type `Map, [closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30]>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/universal-mismatched-type.stderr b/tests/ui/impl-trait/universal-mismatched-type.stderr index 817c573c0..a56e542d8 100644 --- a/tests/ui/impl-trait/universal-mismatched-type.stderr +++ b/tests/ui/impl-trait/universal-mismatched-type.stderr @@ -6,7 +6,7 @@ LL | fn foo(x: impl Debug) -> String { | | | this type parameter LL | x - | ^ expected struct `String`, found type parameter `impl Debug` + | ^ expected `String`, found type parameter `impl Debug` | = note: expected struct `String` found type parameter `impl Debug` diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index 3ad0a9f9d..1cae3f77c 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -43,109 +43,109 @@ LL | type InReturnInTypeAlias = fn() -> impl Debug; = note: see issue #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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params --> $DIR/where-allowed.rs:16: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types --> $DIR/where-allowed.rs:20: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params --> $DIR/where-allowed.rs:24: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types --> $DIR/where-allowed.rs:28: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:32: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types --> $DIR/where-allowed.rs:36: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:40: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:47: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types --> $DIR/where-allowed.rs:52: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:56: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 param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:64:38 | LL | fn in_Fn_parameter_in_generics (_: F) { panic!() } | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types --> $DIR/where-allowed.rs:68:40 | LL | fn in_Fn_return_in_generics impl Debug> (_: F) { panic!() } | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types --> $DIR/where-allowed.rs:81:32 | LL | struct InBraceStructField { x: impl Debug } | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in path +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types --> $DIR/where-allowed.rs:85:41 | LL | struct InAdtInBraceStructField { x: Vec } | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types --> $DIR/where-allowed.rs:89:27 | LL | struct InTupleStructField(impl Debug); | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types --> $DIR/where-allowed.rs:94:25 | LL | InBraceVariant { x: impl Debug }, | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types --> $DIR/where-allowed.rs:96:20 | LL | InTupleVariant(impl Debug), | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types --> $DIR/where-allowed.rs:107:23 | LL | fn in_return() -> impl Debug; @@ -154,7 +154,7 @@ LL | fn in_return() -> impl Debug; = note: see issue #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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types --> $DIR/where-allowed.rs:124:34 | LL | fn in_trait_impl_return() -> impl Debug { () } @@ -163,121 +163,121 @@ LL | fn in_trait_impl_return() -> impl Debug { () } = note: see issue #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` param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params --> $DIR/where-allowed.rs:137: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types --> $DIR/where-allowed.rs:140: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types --> $DIR/where-allowed.rs:156:39 | LL | type InReturnInTypeAlias = fn() -> impl Debug; | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits --> $DIR/where-allowed.rs:161:16 | LL | impl PartialEq for () { | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers --> $DIR/where-allowed.rs:166:24 | LL | impl PartialEq<()> for impl Debug { | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers --> $DIR/where-allowed.rs:171:6 | LL | impl impl Debug { | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers --> $DIR/where-allowed.rs:177:24 | LL | impl InInherentImplAdt { | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds --> $DIR/where-allowed.rs:183:11 | LL | where impl Debug: Debug | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds --> $DIR/where-allowed.rs:190:15 | LL | where Vec: Debug | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bound +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds --> $DIR/where-allowed.rs:197:24 | LL | where T: PartialEq | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait param +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params --> $DIR/where-allowed.rs:204: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types --> $DIR/where-allowed.rs:211:22 | LL | where T: Fn() -> impl Debug | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:217:40 | LL | struct InStructGenericParamDefault(T); | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:221:36 | LL | enum InEnumGenericParamDefault { Variant(T) } | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:225:38 | LL | trait InTraitGenericParamDefault {} | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:229:41 | LL | type InTypeAliasGenericParamDefault = T; | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:233:11 | LL | impl T {} | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults --> $DIR/where-allowed.rs:240:40 | LL | fn in_method_generic_param_default(_: T) {} | ^^^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/where-allowed.rs:246: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 +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types --> $DIR/where-allowed.rs:248:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; @@ -303,10 +303,10 @@ LL | fn in_method_generic_param_default(_: T) {} = note: for more information, see issue #36887 error[E0118]: no nominal type found for inherent implementation - --> $DIR/where-allowed.rs:233:23 + --> $DIR/where-allowed.rs:233:1 | LL | impl T {} - | ^ impl requires a nominal type + | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/tests/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr b/tests/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr index d0249e74f..307899297 100644 --- a/tests/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr +++ b/tests/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/assoc-ty-wf-used-to-get-assoc-ty.rs:24:31 | +LL | let x: u8 = 3; + | - binding `x` declared here LL | let _: &'static u8 = test(&x, &&3); | -----^^------ | | | diff --git a/tests/ui/implied-bounds/issue-100690.stderr b/tests/ui/implied-bounds/issue-100690.stderr index 3f6af70d8..dba035337 100644 --- a/tests/ui/implied-bounds/issue-100690.stderr +++ b/tests/ui/implied-bounds/issue-100690.stderr @@ -12,7 +12,7 @@ note: required by a bound in `real_dispatch` --> $DIR/issue-100690.rs:9:8 | LL | fn real_dispatch(f: F) -> Result<(), io::Error> - | ------------- required by a bound in this + | ------------- required by a bound in this function ... LL | F: FnOnce(&mut UIView) -> Result<(), io::Error> + Send + 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `real_dispatch` diff --git a/tests/ui/imports/import-prefix-macro-1.stderr b/tests/ui/imports/import-prefix-macro-1.stderr index 8868ee3ae..a6a5b1393 100644 --- a/tests/ui/imports/import-prefix-macro-1.stderr +++ b/tests/ui/imports/import-prefix-macro-1.stderr @@ -2,7 +2,7 @@ error: expected one of `::`, `;`, or `as`, found `{` --> $DIR/import-prefix-macro-1.rs:11:27 | LL | ($p: path) => (use $p {S, Z}); - | ^^^^^^ expected one of `::`, `;`, or `as` + | ^ expected one of `::`, `;`, or `as` ... LL | import! { a::b::c } | ------------------- in this macro invocation diff --git a/tests/ui/include-macros/mismatched-types.stderr b/tests/ui/include-macros/mismatched-types.stderr index a408877af..4f2880e2f 100644 --- a/tests/ui/include-macros/mismatched-types.stderr +++ b/tests/ui/include-macros/mismatched-types.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:2:20 | LL | let b: &[u8] = include_str!("file.txt"); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str` | | | expected due to this | @@ -14,7 +14,7 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:3:19 | LL | let s: &str = include_bytes!("file.txt"); - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `str`, found array `[u8; 0]` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `&[u8; 0]` | | | expected due to this | diff --git a/tests/ui/incoherent-inherent-impls/needs-has-incoherent-impls.stderr b/tests/ui/incoherent-inherent-impls/needs-has-incoherent-impls.stderr index 8f7082511..f5900afe2 100644 --- a/tests/ui/incoherent-inherent-impls/needs-has-incoherent-impls.stderr +++ b/tests/ui/incoherent-inherent-impls/needs-has-incoherent-impls.stderr @@ -1,114 +1,80 @@ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:5:1 | -LL | / impl extern_crate::StructWithAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::StructWithAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:7:5 | LL | fn foo() {} - | ^^^^^^^^^^^ + | ^^^^^^^^ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:13:1 | -LL | / impl extern_crate::StructNoAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::StructNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:13:1 | -LL | / impl extern_crate::StructNoAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::StructNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:17:1 | -LL | / impl extern_crate::StructNoAttr { -LL | | -LL | | #[rustc_allow_incoherent_impl] -LL | | fn bar() {} -LL | | } - | |_^ +LL | impl extern_crate::StructNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:17:1 | -LL | / impl extern_crate::StructNoAttr { -LL | | -LL | | #[rustc_allow_incoherent_impl] -LL | | fn bar() {} -LL | | } - | |_^ +LL | impl extern_crate::StructNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:22:1 | -LL | / impl extern_crate::EnumWithAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::EnumWithAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:24:5 | LL | fn foo() {} - | ^^^^^^^^^^^ + | ^^^^^^^^ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:30:1 | -LL | / impl extern_crate::EnumNoAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::EnumNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:30:1 | -LL | / impl extern_crate::EnumNoAttr { -LL | | -LL | | fn foo() {} -LL | | } - | |_^ +LL | impl extern_crate::EnumNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0390]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/needs-has-incoherent-impls.rs:34:1 | -LL | / impl extern_crate::EnumNoAttr { -LL | | -LL | | #[rustc_allow_incoherent_impl] -LL | | fn bar() {} -LL | | } - | |_^ +LL | impl extern_crate::EnumNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider moving this inherent impl into the crate defining the type if possible help: alternatively add `#[rustc_has_incoherent_inherent_impls]` to the type and `#[rustc_allow_incoherent_impl]` to the relevant impl items --> $DIR/needs-has-incoherent-impls.rs:34:1 | -LL | / impl extern_crate::EnumNoAttr { -LL | | -LL | | #[rustc_allow_incoherent_impl] -LL | | fn bar() {} -LL | | } - | |_^ +LL | impl extern_crate::EnumNoAttr { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr index b3f8b51d0..6dc1680cf 100644 --- a/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr +++ b/tests/ui/incoherent-inherent-impls/no-attr-empty-impl.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:4:1 | LL | impl extern_crate::StructWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead @@ -10,7 +10,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:7:1 | LL | impl extern_crate::StructNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead @@ -18,7 +18,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:10:1 | LL | impl extern_crate::EnumWithAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead @@ -26,15 +26,15 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/no-attr-empty-impl.rs:13:1 | LL | impl extern_crate::EnumNoAttr {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/no-attr-empty-impl.rs:16:6 + --> $DIR/no-attr-empty-impl.rs:16:1 | LL | impl f32 {} - | ^^^ + | ^^^^^^^^ | = help: consider using an extension trait instead diff --git a/tests/ui/inference/array-len-mismatch.rs b/tests/ui/inference/array-len-mismatch.rs new file mode 100644 index 000000000..149d06102 --- /dev/null +++ b/tests/ui/inference/array-len-mismatch.rs @@ -0,0 +1,12 @@ +fn returns_arr() -> [u8; 2] { + [1, 2] +} + +fn main() { + let wrong: [u8; 3] = [10, 20]; + //~^ ERROR mismatched types + //~^^ HELP consider specifying the actual array length + let wrong: [u8; 3] = returns_arr(); + //~^ ERROR mismatched types + //~^^ HELP consider specifying the actual array length +} diff --git a/tests/ui/inference/array-len-mismatch.stderr b/tests/ui/inference/array-len-mismatch.stderr new file mode 100644 index 000000000..7358e4783 --- /dev/null +++ b/tests/ui/inference/array-len-mismatch.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/array-len-mismatch.rs:6:26 + | +LL | let wrong: [u8; 3] = [10, 20]; + | ------- ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | | | + | | help: consider specifying the actual array length: `2` + | expected due to this + +error[E0308]: mismatched types + --> $DIR/array-len-mismatch.rs:9:26 + | +LL | let wrong: [u8; 3] = returns_arr(); + | ------- ^^^^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | | | + | | help: consider specifying the actual array length: `2` + | expected due to this + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/inference/deref-suggestion.stderr b/tests/ui/inference/deref-suggestion.stderr index 3db67cdb5..1626032ae 100644 --- a/tests/ui/inference/deref-suggestion.stderr +++ b/tests/ui/inference/deref-suggestion.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | foo(s); | --- ^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found `&String` + | | expected `String`, found `&String` | arguments to this function are incorrect | note: function defined here @@ -35,7 +35,7 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:30:9 | LL | foo(&"aaa".to_owned()); - | --- ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String` + | --- ^^^^^^^^^^^^^^^^^ expected `String`, found `&String` | | | arguments to this function are incorrect | @@ -54,7 +54,7 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:32:9 | LL | foo(&mut "aaa".to_owned()); - | --- ^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` + | --- ^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String` | | | arguments to this function are incorrect | diff --git a/tests/ui/inference/inference_unstable.rs b/tests/ui/inference/inference_unstable.rs index daf0cf042..ad7649959 100644 --- a/tests/ui/inference/inference_unstable.rs +++ b/tests/ui/inference/inference_unstable.rs @@ -14,16 +14,16 @@ use inference_unstable_itertools::IpuItertools; fn main() { assert_eq!('x'.ipu_flatten(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future +//~^ WARN a method with this name may be added to the standard library in the future //~| WARN once this associated item is added to the standard library, the ambiguity may cause an assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future +//~^ WARN a method with this name may be added to the standard library in the future //~| WARN once this associated item is added to the standard library, the ambiguity may cause an assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future +//~^ WARN a method with this name may be added to the standard library in the future //~| WARN once this associated item is added to the standard library, the ambiguity may cause an assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future +//~^ WARN a method with this name may be added to the standard library in the future //~| WARN once this associated item is added to the standard library, the ambiguity may cause an assert_eq!(char::C, 1); //~^ WARN an associated constant with this name may be added to the standard library in the future diff --git a/tests/ui/inference/inference_unstable.stderr b/tests/ui/inference/inference_unstable.stderr index ecbf2641b..c48aaf9f4 100644 --- a/tests/ui/inference/inference_unstable.stderr +++ b/tests/ui/inference/inference_unstable.stderr @@ -1,4 +1,4 @@ -warning: an associated function with this name may be added to the standard library in the future +warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:16:20 | LL | assert_eq!('x'.ipu_flatten(), 1); @@ -10,7 +10,7 @@ LL | assert_eq!('x'.ipu_flatten(), 1); = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten` = note: `#[warn(unstable_name_collisions)]` on by default -warning: an associated function with this name may be added to the standard library in the future +warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:19:20 | LL | assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); @@ -21,7 +21,7 @@ LL | assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_value_vs_by_ref(...)` to keep using the current method = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref` -warning: an associated function with this name may be added to the standard library in the future +warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:22:20 | LL | assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); @@ -32,7 +32,7 @@ LL | assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_ref_vs_by_ref_mut(...)` to keep using the current method = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut` -warning: an associated function with this name may be added to the standard library in the future +warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:25:40 | LL | assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1); diff --git a/tests/ui/inference/inference_unstable_featured.stderr b/tests/ui/inference/inference_unstable_featured.stderr index 4ddede29c..dc43abf52 100644 --- a/tests/ui/inference/inference_unstable_featured.stderr +++ b/tests/ui/inference/inference_unstable_featured.stderr @@ -6,11 +6,11 @@ LL | assert_eq!('x'.ipu_flatten(), 0); | = note: candidate #1 is defined in an impl of the trait `IpuIterator` for the type `char` = note: candidate #2 is defined in an impl of the trait `IpuItertools` for the type `char` -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | assert_eq!(IpuIterator::ipu_flatten(&'x'), 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | assert_eq!(IpuItertools::ipu_flatten(&'x'), 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/inference/issue-107090.rs b/tests/ui/inference/issue-107090.rs new file mode 100644 index 000000000..a22e12c6d --- /dev/null +++ b/tests/ui/inference/issue-107090.rs @@ -0,0 +1,25 @@ +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` + +trait Convert<'a, 'b>: Sized { + fn cast(&'a self) -> &'b Self; +} +impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + //~^ ERROR use of undeclared lifetime name + //~^^ ERROR use of undeclared lifetime name `'out` + fn cast(&'long self) -> &'short Foo<'short, 'out, T> { + //~^ ERROR use of undeclared lifetime name + self + } +} + +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 +} + +fn main() {} diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr new file mode 100644 index 000000000..6233b629a --- /dev/null +++ b/tests/ui/inference/issue-107090.stderr @@ -0,0 +1,84 @@ +error[E0261]: use of undeclared lifetime name `'short` + --> $DIR/issue-107090.rs:4:9 + | +LL | Foo<'short, 'out, T>: Convert<'a, 'b>; + | ^^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'short` lifetime + | +LL | for<'short> Foo<'short, 'out, T>: Convert<'a, 'b>; + | +++++++++++ +help: consider introducing lifetime `'short` here + | +LL | struct Foo<'short, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) + | +++++++ + +error[E0261]: use of undeclared lifetime name `'out` + --> $DIR/issue-107090.rs:4:17 + | +LL | Foo<'short, 'out, T>: Convert<'a, 'b>; + | ^^^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'out` lifetime + | +LL | for<'out> Foo<'short, 'out, T>: Convert<'a, 'b>; + | +++++++++ +help: consider introducing lifetime `'out` here + | +LL | struct Foo<'out, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) + | +++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/issue-107090.rs:11:47 + | +LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'b` here: `'b,` + +error[E0261]: use of undeclared lifetime name `'out` + --> $DIR/issue-107090.rs:11:67 + | +LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + | - help: consider introducing lifetime `'out` here: `'out,` ^^^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'out` + --> $DIR/issue-107090.rs:14:49 + | +LL | fn cast(&'long self) -> &'short Foo<'short, 'out, T> { + | ^^^^ undeclared lifetime + | +help: consider introducing lifetime `'out` here + | +LL | fn cast<'out>(&'long self) -> &'short Foo<'short, 'out, T> { + | ++++++ +help: consider introducing lifetime `'out` here + | +LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { + | +++++ + +error[E0261]: use of undeclared lifetime name `'short` + --> $DIR/issue-107090.rs:20:68 + | +LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { + | - ^^^^^^ undeclared lifetime + | | + | 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 + +Some errors have detailed explanations: E0261, E0308. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/inference/issue-71732.stderr b/tests/ui/inference/issue-71732.stderr index 01b37f2ac..e89e4dca6 100644 --- a/tests/ui/inference/issue-71732.stderr +++ b/tests/ui/inference/issue-71732.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | .get(&"key".into()) | ^^^ ------------- type must be known at this point | | - | cannot infer type of the type parameter `Q` declared on the associated function `get` + | cannot infer type of the type parameter `Q` declared on the method `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow for String; diff --git a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs new file mode 100644 index 000000000..7f6758f47 --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.rs @@ -0,0 +1,19 @@ +// ignore-tidy-linelength + +// Regression test for #107745. +// Previously need_type_info::update_infer_source will consider expressions originating from +// macro expressions as candiate "previous sources". This unfortunately can mean that +// for macros expansions such as `format!()` internal implementation details can leak, such as: +// +// ``` +// error[E0282]: type annotations needed +// --> src/main.rs:2:22 +// | +//2 | println!("{:?}", []); +// | ^^ cannot infer type of the type parameter `T` declared on the associated function `new_debug` +// ``` + +fn main() { + println!("{:?}", []); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr new file mode 100644 index 000000000..464655bbc --- /dev/null +++ b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-107745-avoid-expr-from-macro-expansion.rs:17:22 + | +LL | println!("{:?}", []); + | ^^ cannot infer type + | + = 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) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/inference/question-mark-type-infer.stderr b/tests/ui/inference/question-mark-type-infer.stderr index a9cb7e525..7a1e850d1 100644 --- a/tests/ui/inference/question-mark-type-infer.stderr +++ b/tests/ui/inference/question-mark-type-infer.stderr @@ -2,7 +2,7 @@ error[E0282]: 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 associated function `collect` + | ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect` | help: consider specifying the generic argument | diff --git a/tests/ui/infinite/auxiliary/alias.rs b/tests/ui/infinite/auxiliary/alias.rs new file mode 100644 index 000000000..59add7eb1 --- /dev/null +++ b/tests/ui/infinite/auxiliary/alias.rs @@ -0,0 +1,2 @@ +pub struct W(T); +pub type Wrapper = W; diff --git a/tests/ui/infinite/infinite-alias.rs b/tests/ui/infinite/infinite-alias.rs new file mode 100644 index 000000000..45356f359 --- /dev/null +++ b/tests/ui/infinite/infinite-alias.rs @@ -0,0 +1,9 @@ +// aux-build: alias.rs +// regression test for 108160 + +extern crate alias; + +use alias::Wrapper; +struct Rec(Wrapper); //~ ERROR recursive type `Rec` has infinite + +fn main() {} diff --git a/tests/ui/infinite/infinite-alias.stderr b/tests/ui/infinite/infinite-alias.stderr new file mode 100644 index 000000000..9d9265f8c --- /dev/null +++ b/tests/ui/infinite/infinite-alias.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Rec` has infinite size + --> $DIR/infinite-alias.rs:7:1 + | +LL | struct Rec(Wrapper); + | ^^^^^^^^^^ ------------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Rec(Box>); + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/inline-const/const-expr-lifetime-err.stderr b/tests/ui/inline-const/const-expr-lifetime-err.stderr index a23f7c9a7..443fcf89c 100644 --- a/tests/ui/inline-const/const-expr-lifetime-err.stderr +++ b/tests/ui/inline-const/const-expr-lifetime-err.stderr @@ -4,6 +4,7 @@ error[E0597]: `y` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let y = (); + | - binding `y` declared here LL | equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW }); | ------------------^^- | | | diff --git a/tests/ui/instrument-xray/flags-always-never-1.rs b/tests/ui/instrument-xray/flags-always-never-1.rs new file mode 100644 index 000000000..4dd43439e --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-1.rs @@ -0,0 +1,7 @@ +// Checks that `-Z instrument-xray` does not allow `always` and `never` simultaneously. +// +// needs-xray +// compile-flags: -Z instrument-xray=always,never +// error-pattern: incorrect value `always,never` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-always-never-1.stderr b/tests/ui/instrument-xray/flags-always-never-1.stderr new file mode 100644 index 000000000..e211c6f60 --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-1.stderr @@ -0,0 +1,2 @@ +error: incorrect value `always,never` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + diff --git a/tests/ui/instrument-xray/flags-always-never-2.rs b/tests/ui/instrument-xray/flags-always-never-2.rs new file mode 100644 index 000000000..7310aa0a0 --- /dev/null +++ b/tests/ui/instrument-xray/flags-always-never-2.rs @@ -0,0 +1,9 @@ +// Checks that `-Z instrument-xray` allows `always` and `never` sequentially. +// (The last specified setting wins, like `-Z instrument-xray=no` as well.) +// +// needs-xray +// compile-flags: -Z instrument-xray=always +// compile-flags: -Z instrument-xray=never +// check-pass + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-basic.rs b/tests/ui/instrument-xray/flags-basic.rs new file mode 100644 index 000000000..b97f0dd8a --- /dev/null +++ b/tests/ui/instrument-xray/flags-basic.rs @@ -0,0 +1,9 @@ +// Verifies basic `-Z instrument-xray` flags. +// +// needs-xray +// compile-flags: -Z instrument-xray +// compile-flags: -Z instrument-xray=skip-exit +// compile-flags: -Z instrument-xray=ignore-loops,instruction-threshold=300 +// check-pass + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-always.rs b/tests/ui/instrument-xray/flags-dupe-always.rs new file mode 100644 index 000000000..407f3e2aa --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-always.rs @@ -0,0 +1,7 @@ +// Checks that `-Z instrument-xray` does not allow duplicates. +// +// needs-xray +// compile-flags: -Z instrument-xray=always,always +// error-pattern: incorrect value `always,always` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-always.stderr b/tests/ui/instrument-xray/flags-dupe-always.stderr new file mode 100644 index 000000000..d1ac113fa --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-always.stderr @@ -0,0 +1,2 @@ +error: incorrect value `always,always` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + diff --git a/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs b/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs new file mode 100644 index 000000000..75b210a65 --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-ignore-loops.rs @@ -0,0 +1,7 @@ +// Checks that `-Z instrument-xray` does not allow duplicates. +// +// needs-xray +// compile-flags: -Z instrument-xray=ignore-loops,ignore-loops +// error-pattern: incorrect value `ignore-loops,ignore-loops` for unstable option `instrument-xray` + +fn main() {} diff --git a/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr b/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr new file mode 100644 index 000000000..52f6b3307 --- /dev/null +++ b/tests/ui/instrument-xray/flags-dupe-ignore-loops.stderr @@ -0,0 +1,2 @@ +error: incorrect value `ignore-loops,ignore-loops` for unstable option `instrument-xray` - either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit` was expected + diff --git a/tests/ui/instrument-xray/target-not-supported.rs b/tests/ui/instrument-xray/target-not-supported.rs new file mode 100644 index 000000000..e6bdd23e8 --- /dev/null +++ b/tests/ui/instrument-xray/target-not-supported.rs @@ -0,0 +1,9 @@ +// Verifies that `-Z instrument-xray` cannot be used with unsupported targets, +// +// needs-llvm-components: x86 +// compile-flags: -Z instrument-xray --target x86_64-apple-darwin +// error-pattern: error: XRay instrumentation is not supported for this target + +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/tests/ui/instrument-xray/target-not-supported.stderr b/tests/ui/instrument-xray/target-not-supported.stderr new file mode 100644 index 000000000..6e3b0c8a3 --- /dev/null +++ b/tests/ui/instrument-xray/target-not-supported.stderr @@ -0,0 +1,4 @@ +error: XRay instrumentation is not supported for this target + +error: aborting due to previous error + diff --git a/tests/ui/intrinsics/const-eval-select-bad.rs b/tests/ui/intrinsics/const-eval-select-bad.rs index fa14efad7..991d1450a 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.rs +++ b/tests/ui/intrinsics/const-eval-select-bad.rs @@ -30,7 +30,7 @@ fn baz(n: bool) -> i32 { const fn return_ty_mismatch() { const_eval_select((1,), foo, bar); - //~^ ERROR expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool` + //~^ ERROR expected `bar` to be a fn item that returns `i32`, but it returns `bool` } const fn args_ty_mismatch() { diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr index fd7d061b6..d4507a27a 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.stderr +++ b/tests/ui/intrinsics/const-eval-select-bad.stderr @@ -60,7 +60,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF); note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL -error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool` +error[E0271]: expected `bar` to be a fn item that returns `i32`, but it returns `bool` --> $DIR/const-eval-select-bad.rs:32:34 | LL | const_eval_select((1,), foo, bar); diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index c8b1ff1db..b99bb39d0 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -22,7 +22,9 @@ mod rusti { target_os = "netbsd", target_os = "openbsd", target_os = "solaris", - target_os = "vxworks"))] + target_os = "vxworks", + target_os = "nto", +))] mod m { #[cfg(target_arch = "x86")] pub fn main() { diff --git a/tests/ui/io-checks/inaccessbile-temp-dir.rs b/tests/ui/io-checks/inaccessbile-temp-dir.rs new file mode 100644 index 000000000..9c0aa0135 --- /dev/null +++ b/tests/ui/io-checks/inaccessbile-temp-dir.rs @@ -0,0 +1,39 @@ +// Issue #66530: We would ICE if someone compiled with `-o /dev/null`, +// because we would try to generate auxiliary files in `/dev/` (which +// at least the OS X file system rejects). +// +// An attempt to `-o` into a directory we cannot write into should indeed +// be an error; but not an ICE. +// +// However, some folks run tests as root, which can write `/dev/` and end +// up clobbering `/dev/null`. Instead we'll use a non-existent path, which +// also used to ICE, but even root can't magically write there. + +// compile-flags: -Z temps-dir=/does-not-exist/output + +// The error-pattern check occurs *before* normalization, and the error patterns +// are wildly different between build environments. So this is a cop-out (and we +// rely on the checking of the normalized stderr output as our actual +// "verification" of the diagnostic). + +// error-pattern: error + +// On Mac OS X, we get an error like the below +// normalize-stderr-test "failed to write bytecode to /does-not-exist/output.non_ice_error_on_worker_io_fail.*" -> "io error modifying /does-not-exist/" + +// On Linux, we get an error like the below +// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/" + +// ignore-windows - this is a unix-specific test +// ignore-emscripten - the file-system issues do not replicate here +// ignore-wasm - the file-system issues do not replicate here +// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu + +#![crate_type = "lib"] +#![cfg_attr(not(feature = "std"), no_std)] +pub mod task { + pub mod __internal { + use crate::task::Waker; + } + pub use core::task::Waker; +} diff --git a/tests/ui/io-checks/inaccessbile-temp-dir.stderr b/tests/ui/io-checks/inaccessbile-temp-dir.stderr new file mode 100644 index 000000000..2fc5f93ef --- /dev/null +++ b/tests/ui/io-checks/inaccessbile-temp-dir.stderr @@ -0,0 +1,4 @@ +error: failed to find or create the directory specified by `--temps-dir` + +error: aborting due to previous error + diff --git a/tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs b/tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs new file mode 100644 index 000000000..134e7d420 --- /dev/null +++ b/tests/ui/io-checks/non-ice-error-on-worker-io-fail.rs @@ -0,0 +1,40 @@ +// Issue #66530: We would ICE if someone compiled with `-o /dev/null`, +// because we would try to generate auxiliary files in `/dev/` (which +// at least the OS X file system rejects). +// +// An attempt to `-o` into a directory we cannot write into should indeed +// be an error; but not an ICE. +// +// However, some folks run tests as root, which can write `/dev/` and end +// up clobbering `/dev/null`. Instead we'll use a non-existent path, which +// also used to ICE, but even root can't magically write there. + +// compile-flags: -o /does-not-exist/output + +// The error-pattern check occurs *before* normalization, and the error patterns +// are wildly different between build environments. So this is a cop-out (and we +// rely on the checking of the normalized stderr output as our actual +// "verification" of the diagnostic). + +// error-pattern: error + +// On Mac OS X, we get an error like the below +// normalize-stderr-test "failed to write bytecode to /does-not-exist/output.non_ice_error_on_worker_io_fail.*" -> "io error modifying /does-not-exist/" + +// On Linux, we get an error like the below +// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/" + +// ignore-windows - this is a unix-specific test +// ignore-emscripten - the file-system issues do not replicate here +// ignore-wasm - the file-system issues do not replicate here +// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu + +#![crate_type="lib"] + +#![cfg_attr(not(feature = "std"), no_std)] +pub mod task { + pub mod __internal { + use crate::task::Waker; + } + pub use core::task::Waker; +} diff --git a/tests/ui/io-checks/non-ice-error-on-worker-io-fail.stderr b/tests/ui/io-checks/non-ice-error-on-worker-io-fail.stderr new file mode 100644 index 000000000..edadecf27 --- /dev/null +++ b/tests/ui/io-checks/non-ice-error-on-worker-io-fail.stderr @@ -0,0 +1,6 @@ +warning: ignoring --out-dir flag due to -o flag + +error: io error modifying /does-not-exist/ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/issues/issue-100605.stderr b/tests/ui/issues/issue-100605.stderr index 886e3cd6b..be30eef2a 100644 --- a/tests/ui/issues/issue-100605.stderr +++ b/tests/ui/issues/issue-100605.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-100605.rs:4:18 | LL | takes_option(&None); - | ------------ ^^^^^ expected enum `Option`, found `&Option<_>` + | ------------ ^^^^^ expected `Option<&String>`, found `&Option<_>` | | | arguments to this function are incorrect | @@ -29,7 +29,7 @@ error[E0308]: mismatched types LL | takes_option(&res); | ------------ ^^^^ | | | - | | expected enum `Option`, found `&Option` + | | expected `Option<&String>`, found `&Option` | | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `res.as_ref()` | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-102964.stderr b/tests/ui/issues/issue-102964.stderr index 450403909..c0766480a 100644 --- a/tests/ui/issues/issue-102964.stderr +++ b/tests/ui/issues/issue-102964.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-102964.rs:5:41 | LL | fn bar_function(function: Foo) -> RcFoo { - | ------------ ^^^^^^^^ expected struct `Rc`, found `()` + | ------------ ^^^^^^^^ expected `Rc<&dyn Fn(&T)>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/issues/issue-10412.stderr b/tests/ui/issues/issue-10412.stderr index 46b9fd541..26666782d 100644 --- a/tests/ui/issues/issue-10412.stderr +++ b/tests/ui/issues/issue-10412.stderr @@ -46,7 +46,6 @@ error[E0726]: implicit elided lifetime not allowed here LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ expected lifetime parameter | - = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | LL | impl<'self> Serializable<'_, str> for &'self str { diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/issues/issue-106755.rs new file mode 100644 index 000000000..46ece725f --- /dev/null +++ b/tests/ui/issues/issue-106755.rs @@ -0,0 +1,19 @@ +// compile-flags:-Ztranslate-lang=en_US + +#![feature(negative_impls)] +#![feature(marker_trait_attr)] + +#[marker] +trait MyTrait {} + +struct TestType(::std::marker::PhantomData); + +unsafe impl Send for TestType {} + +impl !Send for TestType {} //~ ERROR found both positive and negative implementation + +unsafe impl Send for TestType {} //~ ERROR conflicting implementations + +impl !Send for TestType {} + +fn main() {} diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/issues/issue-106755.stderr new file mode 100644 index 000000000..543970340 --- /dev/null +++ b/tests/ui/issues/issue-106755.stderr @@ -0,0 +1,22 @@ +error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: + --> $DIR/issue-106755.rs:13:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------------------ positive implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here + +error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` + --> $DIR/issue-106755.rs:15:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------------------ first implementation here +... +LL | unsafe impl Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0751. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-10764.stderr b/tests/ui/issues/issue-10764.stderr index 4d8a85a13..fcb45affe 100644 --- a/tests/ui/issues/issue-10764.stderr +++ b/tests/ui/issues/issue-10764.stderr @@ -8,6 +8,7 @@ LL | fn main() { f(bar) } | = note: expected fn pointer `fn()` found fn item `extern "C" fn() {bar}` + = note: when the arguments and return types match, functions can be coerced to function pointers note: function defined here --> $DIR/issue-10764.rs:1:4 | diff --git a/tests/ui/issues/issue-11374.stderr b/tests/ui/issues/issue-11374.stderr index ace77814a..6e1fb1540 100644 --- a/tests/ui/issues/issue-11374.stderr +++ b/tests/ui/issues/issue-11374.stderr @@ -4,13 +4,13 @@ error[E0308]: mismatched types LL | c.read_to(v); | ------- ^ | | | - | | expected `&mut [u8]`, found struct `Vec` + | | expected `&mut [u8]`, found `Vec<_>` | | help: consider mutably borrowing here: `&mut v` | arguments to this method are incorrect | = note: expected mutable reference `&mut [u8]` found struct `Vec<_>` -note: associated function defined here +note: method defined here --> $DIR/issue-11374.rs:13:12 | LL | pub fn read_to(&mut self, vec: &mut [u8]) { diff --git a/tests/ui/issues/issue-11844.stderr b/tests/ui/issues/issue-11844.stderr index 81cf918a1..9afd20977 100644 --- a/tests/ui/issues/issue-11844.stderr +++ b/tests/ui/issues/issue-11844.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match a { | - this expression has type `Option>` LL | Ok(a) => - | ^^^^^ expected enum `Option`, found enum `Result` + | ^^^^^ expected `Option>`, found `Result<_, _>` | = note: expected enum `Option>` found enum `Result<_, _>` diff --git a/tests/ui/issues/issue-13446.stderr b/tests/ui/issues/issue-13446.stderr index 30fb73dd3..139c34c88 100644 --- a/tests/ui/issues/issue-13446.stderr +++ b/tests/ui/issues/issue-13446.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-13446.rs:3:26 | LL | static VEC: [u32; 256] = vec![]; - | ^^^^^^ expected array `[u32; 256]`, found struct `Vec` + | ^^^^^^ expected `[u32; 256]`, found `Vec<_>` | = note: expected array `[u32; 256]` found struct `Vec<_>` diff --git a/tests/ui/issues/issue-13466.rs b/tests/ui/issues/issue-13466.rs index a420c7704..52d4d75d2 100644 --- a/tests/ui/issues/issue-13466.rs +++ b/tests/ui/issues/issue-13466.rs @@ -9,12 +9,12 @@ pub fn main() { //~^ ERROR mismatched types //~| expected enum `Option<{integer}>` //~| found enum `Result<_, _>` - //~| expected enum `Option`, found enum `Result` + //~| expected `Option<{integer}>`, found `Result<_, _>` Err(e) => panic!(e) //~^ ERROR mismatched types //~| expected enum `Option<{integer}>` //~| found enum `Result<_, _>` - //~| expected enum `Option`, found enum `Result` + //~| expected `Option<{integer}>`, found `Result<_, _>` }; } diff --git a/tests/ui/issues/issue-13466.stderr b/tests/ui/issues/issue-13466.stderr index c78466f4e..fd928e458 100644 --- a/tests/ui/issues/issue-13466.stderr +++ b/tests/ui/issues/issue-13466.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` LL | Ok(u) => u, - | ^^^^^ expected enum `Option`, found enum `Result` + | ^^^^^ expected `Option<{integer}>`, found `Result<_, _>` | = note: expected enum `Option<{integer}>` found enum `Result<_, _>` @@ -16,7 +16,7 @@ LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` ... LL | Err(e) => panic!(e) - | ^^^^^^ expected enum `Option`, found enum `Result` + | ^^^^^^ expected `Option<{integer}>`, found `Result<_, _>` | = note: expected enum `Option<{integer}>` found enum `Result<_, _>` diff --git a/tests/ui/issues/issue-14541.rs b/tests/ui/issues/issue-14541.rs index 555ec9f98..2ff1c1f88 100644 --- a/tests/ui/issues/issue-14541.rs +++ b/tests/ui/issues/issue-14541.rs @@ -4,7 +4,7 @@ struct Vec3 { y: f32, z: f32 } fn make(v: Vec2) { let Vec3 { y: _, z: _ } = v; //~^ ERROR mismatched types - //~| expected struct `Vec2`, found struct `Vec3` + //~| expected `Vec2`, found `Vec3` } fn main() { } diff --git a/tests/ui/issues/issue-14541.stderr b/tests/ui/issues/issue-14541.stderr index cf155f428..b80c68ce4 100644 --- a/tests/ui/issues/issue-14541.stderr +++ b/tests/ui/issues/issue-14541.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let Vec3 { y: _, z: _ } = v; | ^^^^^^^^^^^^^^^^^^^ - this expression has type `Vec2` | | - | expected struct `Vec2`, found struct `Vec3` + | expected `Vec2`, found `Vec3` error: aborting due to previous error diff --git a/tests/ui/issues/issue-15783.rs b/tests/ui/issues/issue-15783.rs index 0b1f4545e..ceb37a20e 100644 --- a/tests/ui/issues/issue-15783.rs +++ b/tests/ui/issues/issue-15783.rs @@ -9,6 +9,6 @@ fn main() { //~^ ERROR mismatched types //~| expected enum `Option<&[&str]>` //~| found enum `Option<&[&str; 1]>` - //~| expected slice `[&str]`, found array `[&str; 1]` + //~| expected `Option<&[&str]>`, found `Option<&[&str; 1]>` assert_eq!(msg, 3); } diff --git a/tests/ui/issues/issue-15783.stderr b/tests/ui/issues/issue-15783.stderr index 660dfe9ed..598ec7e60 100644 --- a/tests/ui/issues/issue-15783.stderr +++ b/tests/ui/issues/issue-15783.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-15783.rs:8:19 | LL | let msg = foo(x); - | --- ^ expected slice `[&str]`, found array `[&str; 1]` + | --- ^ expected `Option<&[&str]>`, found `Option<&[&str; 1]>` | | | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-15896.stderr b/tests/ui/issues/issue-15896.stderr index 038337f5a..ec0d74596 100644 --- a/tests/ui/issues/issue-15896.stderr +++ b/tests/ui/issues/issue-15896.stderr @@ -5,7 +5,7 @@ LL | let u = match e { | - this expression has type `E` LL | E::B( LL | Tau{t: x}, - | ^^^^^^^^^ expected enum `R`, found struct `Tau` + | ^^^^^^^^^ expected `R`, found `Tau` error: aborting due to previous error diff --git a/tests/ui/issues/issue-16338.stderr b/tests/ui/issues/issue-16338.stderr index 6878600b0..0f08485e5 100644 --- a/tests/ui/issues/issue-16338.stderr +++ b/tests/ui/issues/issue-16338.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let Slice { data: data, len: len } = "foo"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----- this expression has type `&str` | | - | expected `str`, found struct `Slice` + | expected `str`, found `Slice<_>` | = note: expected type `str` found struct `Slice<_>` diff --git a/tests/ui/issues/issue-16401.rs b/tests/ui/issues/issue-16401.rs index 332352ca7..19ae7da10 100644 --- a/tests/ui/issues/issue-16401.rs +++ b/tests/ui/issues/issue-16401.rs @@ -9,7 +9,7 @@ fn main() { //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Slice<_>` - //~| expected `()`, found struct `Slice` + //~| expected `()`, found `Slice<_>` _ => unreachable!() } } diff --git a/tests/ui/issues/issue-16401.stderr b/tests/ui/issues/issue-16401.stderr index f8ea09070..02f9f3ea8 100644 --- a/tests/ui/issues/issue-16401.stderr +++ b/tests/ui/issues/issue-16401.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match () { | -- this expression has type `()` LL | Slice { data: data, len: len } => (), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Slice` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Slice<_>` | = note: expected unit type `()` found struct `Slice<_>` diff --git a/tests/ui/issues/issue-16939.stderr b/tests/ui/issues/issue-16939.stderr index 766456454..6db29bc61 100644 --- a/tests/ui/issues/issue-16939.stderr +++ b/tests/ui/issues/issue-16939.stderr @@ -2,17 +2,16 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied --> $DIR/issue-16939.rs:5:9 | LL | |t| f(t); - | ^ - argument unexpected + | ^ - + | | + | unexpected argument + | help: remove the extra argument | note: callable defined here --> $DIR/issue-16939.rs:4:12 | LL | fn _foo (f: F) { | ^^^^ -help: remove the extra argument - | -LL | |t| f(); - | ~~ error: aborting due to previous error diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/issues/issue-16966.stderr index 60f5190db..8c92505b5 100644 --- a/tests/ui/issues/issue-16966.stderr +++ b/tests/ui/issues/issue-16966.stderr @@ -1,10 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/issue-16966.rs:2:5 + --> $DIR/issue-16966.rs:2:12 | LL | panic!(std::default::Default::default()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `M` declared on the function `begin_panic` - | - = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to previous error diff --git a/tests/ui/issues/issue-17337.stderr b/tests/ui/issues/issue-17337.stderr index 34c2eb05f..55e51e566 100644 --- a/tests/ui/issues/issue-17337.stderr +++ b/tests/ui/issues/issue-17337.stderr @@ -1,4 +1,4 @@ -error: use of deprecated associated function `Foo::foo`: text +error: use of deprecated method `Foo::foo`: text --> $DIR/issue-17337.rs:16:6 | LL | .foo(); diff --git a/tests/ui/issues/issue-18423.rs b/tests/ui/issues/issue-18423.rs index a81b32f05..675fd0411 100644 --- a/tests/ui/issues/issue-18423.rs +++ b/tests/ui/issues/issue-18423.rs @@ -2,7 +2,7 @@ struct Foo<'a> { x: Box<'a, isize> - //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied } fn main() { } diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index bbf793662..5d154dbbb 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> diff --git a/tests/ui/issues/issue-18446.stderr b/tests/ui/issues/issue-18446.stderr index 939cf0292..602b80c68 100644 --- a/tests/ui/issues/issue-18446.stderr +++ b/tests/ui/issues/issue-18446.stderr @@ -14,7 +14,7 @@ note: candidate #2 is defined in the trait `T` | LL | fn foo(&self); | ^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | T::foo(&x); | ~~~~~~~~~~ diff --git a/tests/ui/issues/issue-18819.stderr b/tests/ui/issues/issue-18819.stderr index 767fdd5ca..1fc974b60 100644 --- a/tests/ui/issues/issue-18819.stderr +++ b/tests/ui/issues/issue-18819.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 2 arguments but 1 argument was supplied LL | print_x(X); | ^^^^^^^--- an argument of type `&str` is missing | -note: expected reference, found struct `X` +note: expected `&dyn Foo`, found `X` --> $DIR/issue-18819.rs:16:13 | LL | print_x(X); diff --git a/tests/ui/issues/issue-19521.stderr b/tests/ui/issues/issue-19521.stderr index b6847cd75..13a12acb3 100644 --- a/tests/ui/issues/issue-19521.stderr +++ b/tests/ui/issues/issue-19521.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `homura` found for reference `&'static str` in the --> $DIR/issue-19521.rs:2:8 | LL | "".homura()(); - | ^^^^^^ method not found in `&'static str` + | ^^^^^^ method not found in `&str` error: aborting due to previous error diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr index 582216010..b1c156720 100644 --- a/tests/ui/issues/issue-20225.stderr +++ b/tests/ui/issues/issue-20225.stderr @@ -6,7 +6,7 @@ LL | impl<'a, T> Fn<(&'a T,)> for Foo { LL | extern "rust-call" fn call(&self, (_,): (T,)) {} | ^^^^ | | - | expected `&T`, found type parameter `T` + | expected `&'a T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | = note: expected signature `extern "rust-call" fn(&Foo, (&'a T,))` @@ -20,7 +20,7 @@ LL | impl<'a, T> FnMut<(&'a T,)> for Foo { LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} | ^^^^ | | - | expected `&T`, found type parameter `T` + | expected `&'a T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | = note: expected signature `extern "rust-call" fn(&mut Foo, (&'a T,))` @@ -35,7 +35,7 @@ LL | impl<'a, T> FnOnce<(&'a T,)> for Foo { LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} | ^^^^ | | - | expected `&T`, found type parameter `T` + | expected `&'a T`, found type parameter `T` | help: change the parameter type to match the trait: `(&'a T,)` | = note: expected signature `extern "rust-call" fn(Foo, (&'a T,))` diff --git a/tests/ui/issues/issue-21202.rs b/tests/ui/issues/issue-21202.rs index f62de7ce7..2c5f13944 100644 --- a/tests/ui/issues/issue-21202.rs +++ b/tests/ui/issues/issue-21202.rs @@ -8,7 +8,7 @@ mod B { use crate1::A::Foo; fn bar(f: Foo) { Foo::foo(&f); - //~^ ERROR: associated function `foo` is private + //~^ ERROR: method `foo` is private } } diff --git a/tests/ui/issues/issue-21202.stderr b/tests/ui/issues/issue-21202.stderr index 1d2816fed..e7c3f2f9a 100644 --- a/tests/ui/issues/issue-21202.stderr +++ b/tests/ui/issues/issue-21202.stderr @@ -1,13 +1,13 @@ -error[E0624]: associated function `foo` is private +error[E0624]: method `foo` is private --> $DIR/issue-21202.rs:10:14 | LL | Foo::foo(&f); - | ^^^ private associated function + | ^^^ private method | ::: $DIR/auxiliary/issue-21202.rs:4:9 | LL | fn foo(&self) { } - | ------------- private associated function defined here + | ------------- private method defined here error: aborting due to previous error diff --git a/tests/ui/issues/issue-21332.rs b/tests/ui/issues/issue-21332.rs index 6547f3a9b..4473d00fd 100644 --- a/tests/ui/issues/issue-21332.rs +++ b/tests/ui/issues/issue-21332.rs @@ -4,7 +4,7 @@ impl Iterator for S { type Item = i32; fn next(&mut self) -> Result { Ok(7) } //~^ ERROR method `next` has an incompatible type for trait - //~| expected enum `Option`, found enum `Result` + //~| expected `Option`, found `Result` } fn main() {} diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/issues/issue-21332.stderr index 0e1beebf2..825492880 100644 --- a/tests/ui/issues/issue-21332.stderr +++ b/tests/ui/issues/issue-21332.stderr @@ -4,7 +4,7 @@ error[E0053]: method `next` has an incompatible type for trait LL | fn next(&mut self) -> Result { Ok(7) } | ^^^^^^^^^^^^^^^^ | | - | expected enum `Option`, found enum `Result` + | expected `Option`, found `Result` | help: change the output type to match the trait: `Option` | = note: expected signature `fn(&mut S) -> Option` diff --git a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs b/tests/ui/issues/issue-22536-copy-mustnt-zero.rs deleted file mode 100644 index 017f36484..000000000 --- a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass -// Regression test for Issue #22536: If a type implements Copy, then -// moving it must not zero the original memory. - - -trait Resources { - type Buffer: Copy; - fn foo(&self) {} -} - -struct BufferHandle { - raw: ::Buffer, -} -impl Copy for BufferHandle {} -impl Clone for BufferHandle { - fn clone(&self) -> BufferHandle { *self } -} - -enum Res {} -impl Resources for Res { - type Buffer = u32; -} - -fn main() { - let b: BufferHandle = BufferHandle { raw: 1 }; - let c = b; - assert_eq!(c.raw, b.raw) -} diff --git a/tests/ui/issues/issue-23041.stderr b/tests/ui/issues/issue-23041.stderr index 6592b76a3..4271c67c3 100644 --- a/tests/ui/issues/issue-23041.stderr +++ b/tests/ui/issues/issue-23041.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-23041.rs:6:7 | LL | b.downcast_ref::_>(); - | ^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `downcast_ref` + | ^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `downcast_ref` | help: consider specifying the generic argument | diff --git a/tests/ui/issues/issue-24322.stderr b/tests/ui/issues/issue-24322.stderr index 1e4c8ac7c..954fd4928 100644 --- a/tests/ui/issues/issue-24322.stderr +++ b/tests/ui/issues/issue-24322.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-24322.rs:8:29 | LL | let x: &fn(&B) -> u32 = &B::func; - | -------------- ^^^^^^^^ expected fn pointer, found fn item + | -------------- ^^^^^^^^ expected `&fn(&B) -> u32`, found `&fn(&B) -> u32 {B::func}` | | | expected due to this | diff --git a/tests/ui/issues/issue-24819.rs b/tests/ui/issues/issue-24819.rs index 59c3f2cd1..fb4cfb7b2 100644 --- a/tests/ui/issues/issue-24819.rs +++ b/tests/ui/issues/issue-24819.rs @@ -4,7 +4,7 @@ fn main() { let mut v = Vec::new(); foo(&mut v); //~^ ERROR mismatched types - //~| expected struct `HashSet`, found struct `Vec` + //~| expected `&mut HashSet`, found `&mut Vec<_>` } fn foo(h: &mut HashSet) { diff --git a/tests/ui/issues/issue-24819.stderr b/tests/ui/issues/issue-24819.stderr index 982a11fef..8b4f1dbce 100644 --- a/tests/ui/issues/issue-24819.stderr +++ b/tests/ui/issues/issue-24819.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-24819.rs:5:9 | LL | foo(&mut v); - | --- ^^^^^^ expected struct `HashSet`, found struct `Vec` + | --- ^^^^^^ expected `&mut HashSet`, found `&mut Vec<_>` | | | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-26094.rs b/tests/ui/issues/issue-26094.rs index d3d670aa9..2742529ed 100644 --- a/tests/ui/issues/issue-26094.rs +++ b/tests/ui/issues/issue-26094.rs @@ -1,7 +1,7 @@ macro_rules! some_macro { - ($other: expr) => ({ - $other(None) //~ NOTE argument of type `Option<_>` unexpected - }) + ($other: expr) => {{ + $other(None) //~ NOTE unexpected argument of type `Option<_>` + }}; } fn some_function() {} //~ NOTE defined here @@ -9,5 +9,4 @@ fn some_function() {} //~ NOTE defined here fn main() { some_macro!(some_function); //~^ ERROR function takes 0 arguments but 1 argument was supplied - //~| NOTE in this expansion of some_macro! } diff --git a/tests/ui/issues/issue-26094.stderr b/tests/ui/issues/issue-26094.stderr index 881a6e538..ecdf48470 100644 --- a/tests/ui/issues/issue-26094.stderr +++ b/tests/ui/issues/issue-26094.stderr @@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/issue-26094.rs:10:17 | LL | $other(None) - | ---- argument of type `Option<_>` unexpected + | ---- unexpected argument of type `Option<_>` ... LL | some_macro!(some_function); | ^^^^^^^^^^^^^ @@ -12,10 +12,6 @@ note: function defined here | LL | fn some_function() {} | ^^^^^^^^^^^^^ -help: remove the extra argument - | -LL | some_function() - | ~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/issues/issue-27008.rs b/tests/ui/issues/issue-27008.rs index e04de33f6..adf8e779e 100644 --- a/tests/ui/issues/issue-27008.rs +++ b/tests/ui/issues/issue-27008.rs @@ -3,5 +3,5 @@ struct S; fn main() { let b = [0; S]; //~^ ERROR mismatched types - //~| expected `usize`, found struct `S` + //~| expected `usize`, found `S` } diff --git a/tests/ui/issues/issue-27008.stderr b/tests/ui/issues/issue-27008.stderr index 5b7e74c1c..9d18045aa 100644 --- a/tests/ui/issues/issue-27008.stderr +++ b/tests/ui/issues/issue-27008.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-27008.rs:4:17 | LL | let b = [0; S]; - | ^ expected `usize`, found struct `S` + | ^ expected `usize`, found `S` error: aborting due to previous error diff --git a/tests/ui/issues/issue-2735-2.rs b/tests/ui/issues/issue-2735-2.rs deleted file mode 100644 index 70ebce9d3..000000000 --- a/tests/ui/issues/issue-2735-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -// This test should behave exactly like issue-2735-3 -struct defer<'a> { - b: &'a Cell, -} - -impl<'a> Drop for defer<'a> { - fn drop(&mut self) { - self.b.set(true); - } -} - -fn defer(b: &Cell) -> defer { - defer { - b: b - } -} - -pub fn main() { - let dtor_ran = &Cell::new(false); - let _ = defer(dtor_ran); - assert!(dtor_ran.get()); -} diff --git a/tests/ui/issues/issue-2735-3.rs b/tests/ui/issues/issue-2735-3.rs deleted file mode 100644 index 233015378..000000000 --- a/tests/ui/issues/issue-2735-3.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -// This test should behave exactly like issue-2735-2 -struct defer<'a> { - b: &'a Cell, -} - -impl<'a> Drop for defer<'a> { - fn drop(&mut self) { - self.b.set(true); - } -} - -fn defer(b: &Cell) -> defer { - defer { - b: b - } -} - -pub fn main() { - let dtor_ran = &Cell::new(false); - defer(dtor_ran); - assert!(dtor_ran.get()); -} diff --git a/tests/ui/issues/issue-2735.rs b/tests/ui/issues/issue-2735.rs deleted file mode 100644 index 20d3949a9..000000000 --- a/tests/ui/issues/issue-2735.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -trait hax { - fn dummy(&self) { } -} -impl hax for A { } - -fn perform_hax(x: Box) -> Box { - Box::new(x) as Box -} - -fn deadcode() { - perform_hax(Box::new("deadcode".to_string())); -} - -pub fn main() { - perform_hax(Box::new(42)); -} diff --git a/tests/ui/issues/issue-27583.rs b/tests/ui/issues/issue-27583.rs deleted file mode 100644 index 84c94c7c9..000000000 --- a/tests/ui/issues/issue-27583.rs +++ /dev/null @@ -1,47 +0,0 @@ -// check-pass -// Regression test for issue #27583. Unclear how useful this will be -// going forward, since the issue in question was EXTREMELY sensitive -// to compiler internals (like the precise numbering of nodes), but -// what the hey. - -#![allow(warnings)] - -use std::cell::Cell; -use std::marker::PhantomData; - -pub trait Delegate<'tcx> { } - -pub struct InferCtxt<'a, 'tcx: 'a> { - x: PhantomData<&'a Cell<&'tcx ()>> -} - -pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> { - x: &'t InferCtxt<'a, 'tcx>, -} - -pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { - typer: &'t InferCtxt<'a, 'tcx>, - mc: MemCategorizationContext<'t, 'a, 'tcx>, - delegate: &'d mut (Delegate<'tcx>+'d), -} - -impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> { - pub fn new(delegate: &'d mut Delegate<'tcx>, - typer: &'t InferCtxt<'a, 'tcx>) - -> ExprUseVisitor<'d,'t,'a,'tcx> - { - ExprUseVisitor { - typer: typer, - mc: MemCategorizationContext::new(typer), - delegate: delegate, - } - } -} - -impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { - pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> { - MemCategorizationContext { x: typer } - } -} - -fn main() { } diff --git a/tests/ui/issues/issue-30123.stderr b/tests/ui/issues/issue-30123.stderr index 7808cbf8a..a00a1dbb8 100644 --- a/tests/ui/issues/issue-30123.stderr +++ b/tests/ui/issues/issue-30123.stderr @@ -1,4 +1,4 @@ -error[E0599]: no function or associated item named `new_undirected` found for struct `Graph` in the current scope +error[E0599]: no function or associated item named `new_undirected` found for struct `issue_30123_aux::Graph` in the current scope --> $DIR/issue-30123.rs:7:33 | LL | let ug = Graph::::new_undirected(); diff --git a/tests/ui/issues/issue-30438-c.rs b/tests/ui/issues/issue-30438-c.rs index 4cf634245..813c1d3e2 100644 --- a/tests/ui/issues/issue-30438-c.rs +++ b/tests/ui/issues/issue-30438-c.rs @@ -5,7 +5,6 @@ trait Trait { type Out; } struct Test<'a> { s: &'a str } fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y as Trait>::Out where 'z: 'static { - //~^ WARN unnecessary lifetime parameter `'z` let x = Test { s: "this cannot last" }; &x //~^ ERROR: cannot return reference to local variable `x` diff --git a/tests/ui/issues/issue-30438-c.stderr b/tests/ui/issues/issue-30438-c.stderr index a7a5c0500..7c0010880 100644 --- a/tests/ui/issues/issue-30438-c.stderr +++ b/tests/ui/issues/issue-30438-c.stderr @@ -1,17 +1,9 @@ -warning: unnecessary lifetime parameter `'z` - --> $DIR/issue-30438-c.rs:7:74 - | -LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y as Trait>::Out where 'z: 'static { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'z` - error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-30438-c.rs:10:5 + --> $DIR/issue-30438-c.rs:9:5 | LL | &x | ^^ returns a reference to data owned by the current function -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-32122-1.stderr b/tests/ui/issues/issue-32122-1.stderr index 10b0c0967..b4f5b1296 100644 --- a/tests/ui/issues/issue-32122-1.stderr +++ b/tests/ui/issues/issue-32122-1.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-32122-1.rs:16:24 | LL | let _: *const u8 = &a; - | --------- ^^ expected `u8`, found struct `Foo` + | --------- ^^ expected `*const u8`, found `&Foo` | | | expected due to this | diff --git a/tests/ui/issues/issue-32122-2.stderr b/tests/ui/issues/issue-32122-2.stderr index 5c3dade8e..02c335c15 100644 --- a/tests/ui/issues/issue-32122-2.stderr +++ b/tests/ui/issues/issue-32122-2.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-32122-2.rs:27:24 | LL | let _: *const u8 = &a; - | --------- ^^ expected `u8`, found struct `Emm` + | --------- ^^ expected `*const u8`, found `&Emm` | | | expected due to this | diff --git a/tests/ui/issues/issue-3214.rs b/tests/ui/issues/issue-3214.rs index 928a65938..e3c07bb3f 100644 --- a/tests/ui/issues/issue-3214.rs +++ b/tests/ui/issues/issue-3214.rs @@ -4,7 +4,7 @@ fn foo() { } impl Drop for Foo { - //~^ ERROR this struct takes 0 generic arguments but 1 generic argument + //~^ ERROR struct takes 0 generic arguments but 1 generic argument fn drop(&mut self) {} } } diff --git a/tests/ui/issues/issue-3214.stderr b/tests/ui/issues/issue-3214.stderr index aa0b5ce64..7a2d772f0 100644 --- a/tests/ui/issues/issue-3214.stderr +++ b/tests/ui/issues/issue-3214.stderr @@ -8,7 +8,7 @@ LL | struct Foo { LL | x: T, | ^ use of generic parameter from outer function -error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-3214.rs:6:22 | LL | impl Drop for Foo { diff --git a/tests/ui/issues/issue-33504.stderr b/tests/ui/issues/issue-33504.stderr index d9e7c3b16..a831cf585 100644 --- a/tests/ui/issues/issue-33504.stderr +++ b/tests/ui/issues/issue-33504.stderr @@ -7,7 +7,7 @@ LL | struct Test; LL | let Test = 1; | ^^^^ - this expression has type `{integer}` | | - | expected integer, found struct `Test` + | expected integer, found `Test` | `Test` is interpreted as a unit struct, not a new binding | help: introduce a new binding instead: `other_test` diff --git a/tests/ui/issues/issue-33903.rs b/tests/ui/issues/issue-33903.rs deleted file mode 100644 index 613aa121a..000000000 --- a/tests/ui/issues/issue-33903.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -#![allow(dead_code)] -// Issue 33903: -// Built-in indexing should be used even when the index is not -// trivially an integer -// Only built-in indexing can be used in constant expressions - -const FOO: i32 = [12, 34][0 + 1]; - -fn main() {} diff --git a/tests/ui/issues/issue-33941.stderr b/tests/ui/issues/issue-33941.stderr index 668eaabca..e7f4a4fa0 100644 --- a/tests/ui/issues/issue-33941.stderr +++ b/tests/ui/issues/issue-33941.stderr @@ -2,7 +2,7 @@ error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but --> $DIR/issue-33941.rs:6:36 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^ expected reference, found tuple + | ^^^^^^ expected `&_`, found `(&_, &_)` | = note: expected reference `&_` found tuple `(&_, &_)` @@ -20,7 +20,7 @@ error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&_, &_)`, found `&_` | = note: expected tuple `(&_, &_)` found reference `&_` @@ -31,7 +31,7 @@ error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&_, &_)`, found `&_` | = note: expected tuple `(&_, &_)` found reference `&_` diff --git a/tests/ui/issues/issue-35241.stderr b/tests/ui/issues/issue-35241.stderr index d600e934b..4a2c15511 100644 --- a/tests/ui/issues/issue-35241.stderr +++ b/tests/ui/issues/issue-35241.stderr @@ -5,7 +5,7 @@ LL | struct Foo(u32); | ---------- `Foo` defines a struct constructor here, which should be called LL | LL | fn test() -> Foo { Foo } - | --- ^^^ expected struct `Foo`, found struct constructor + | --- ^^^ expected `Foo`, found struct constructor | | | expected `Foo` because of return type | diff --git a/tests/ui/issues/issue-3680.rs b/tests/ui/issues/issue-3680.rs index 37c9000c0..a0e527981 100644 --- a/tests/ui/issues/issue-3680.rs +++ b/tests/ui/issues/issue-3680.rs @@ -4,6 +4,6 @@ fn main() { //~^ ERROR mismatched types //~| expected enum `Option<_>` //~| found enum `Result<_, _>` - //~| expected enum `Option`, found enum `Result` + //~| expected `Option<_>`, found `Result<_, _>` } } diff --git a/tests/ui/issues/issue-3680.stderr b/tests/ui/issues/issue-3680.stderr index 29ba44f13..0b0ae419e 100644 --- a/tests/ui/issues/issue-3680.stderr +++ b/tests/ui/issues/issue-3680.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match None { | ---- this expression has type `Option<_>` LL | Err(_) => () - | ^^^^^^ expected enum `Option`, found enum `Result` + | ^^^^^^ expected `Option<_>`, found `Result<_, _>` | = note: expected enum `Option<_>` found enum `Result<_, _>` diff --git a/tests/ui/issues/issue-3702-2.stderr b/tests/ui/issues/issue-3702-2.stderr index 1fd64ca90..0b94c3135 100644 --- a/tests/ui/issues/issue-3702-2.stderr +++ b/tests/ui/issues/issue-3702-2.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `Add` for the type `isize` | LL | fn to_int(&self) -> isize { *self } | ^^^^^^^^^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | ToPrimitive::to_int(&self) + other.to_int() | ~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | Add::to_int(&self) + other.to_int() | ~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/issues/issue-3763.rs b/tests/ui/issues/issue-3763.rs index 25ad6b319..893009a2c 100644 --- a/tests/ui/issues/issue-3763.rs +++ b/tests/ui/issues/issue-3763.rs @@ -1,5 +1,4 @@ -// compile-flags: -Zsave-analysis -// Also regression test for #69416 +// Regression test for #3763 mod my_mod { pub struct MyStruct { @@ -21,9 +20,9 @@ fn main() { let _woohoo = (Box::new(my_struct)).priv_field; //~^ ERROR field `priv_field` of struct `MyStruct` is private - (&my_struct).happyfun(); //~ ERROR associated function `happyfun` is private + (&my_struct).happyfun(); //~ ERROR method `happyfun` is private - (Box::new(my_struct)).happyfun(); //~ ERROR associated function `happyfun` is private + (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private let nope = my_struct.priv_field; //~^ ERROR field `priv_field` of struct `MyStruct` is private } diff --git a/tests/ui/issues/issue-3763.stderr b/tests/ui/issues/issue-3763.stderr index 6f4567546..d101e4c33 100644 --- a/tests/ui/issues/issue-3763.stderr +++ b/tests/ui/issues/issue-3763.stderr @@ -1,35 +1,35 @@ error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:18:32 + --> $DIR/issue-3763.rs:17:32 | LL | let _woohoo = (&my_struct).priv_field; | ^^^^^^^^^^ private field error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:21:41 + --> $DIR/issue-3763.rs:20:41 | LL | let _woohoo = (Box::new(my_struct)).priv_field; | ^^^^^^^^^^ private field -error[E0624]: associated function `happyfun` is private - --> $DIR/issue-3763.rs:24:18 +error[E0624]: method `happyfun` is private + --> $DIR/issue-3763.rs:23:18 | LL | fn happyfun(&self) {} - | ------------------ private associated function defined here + | ------------------ private method defined here ... LL | (&my_struct).happyfun(); - | ^^^^^^^^ private associated function + | ^^^^^^^^ private method -error[E0624]: associated function `happyfun` is private - --> $DIR/issue-3763.rs:26:27 +error[E0624]: method `happyfun` is private + --> $DIR/issue-3763.rs:25:27 | LL | fn happyfun(&self) {} - | ------------------ private associated function defined here + | ------------------ private method defined here ... LL | (Box::new(my_struct)).happyfun(); - | ^^^^^^^^ private associated function + | ^^^^^^^^ private method error[E0616]: field `priv_field` of struct `MyStruct` is private - --> $DIR/issue-3763.rs:27:26 + --> $DIR/issue-3763.rs:26:26 | LL | let nope = my_struct.priv_field; | ^^^^^^^^^^ private field diff --git a/tests/ui/issues/issue-38821.rs b/tests/ui/issues/issue-38821.rs deleted file mode 100644 index 6753860e9..000000000 --- a/tests/ui/issues/issue-38821.rs +++ /dev/null @@ -1,33 +0,0 @@ -pub struct Nullable(T); - -pub trait NotNull {} - -pub trait IntoNullable { - type Nullable; -} - -impl IntoNullable for T { - type Nullable = Nullable; -} - -impl IntoNullable for Nullable { - type Nullable = Nullable; -} - -pub trait Expression { - type SqlType; -} - -pub trait Column: Expression {} - -#[derive(Debug, Copy, Clone)] -//~^ ERROR the trait bound `::SqlType: NotNull` is not satisfied -pub enum ColumnInsertValue where - Col: Column, - Expr: Expression::Nullable>, -{ - Expression(Col, Expr), - Default(Col), -} - -fn main() {} diff --git a/tests/ui/issues/issue-38821.stderr b/tests/ui/issues/issue-38821.stderr deleted file mode 100644 index a52a9c138..000000000 --- a/tests/ui/issues/issue-38821.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:17 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting the associated type - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-39292.rs b/tests/ui/issues/issue-39292.rs deleted file mode 100644 index 968cf0891..000000000 --- a/tests/ui/issues/issue-39292.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass -// Regression test for issue #39292. The object vtable was being -// incorrectly left with a null pointer. - -trait Foo { - fn print<'a>(&'a self) where T: 'a { println!("foo"); } -} - -impl<'a> Foo<&'a ()> for () { } - -trait Bar: for<'a> Foo<&'a ()> { } - -impl Bar for () {} - -fn main() { - (&() as &dyn Bar).print(); // Segfault -} diff --git a/tests/ui/issues/issue-39970.rs b/tests/ui/issues/issue-39970.rs index f51e3b522..40d3ae30a 100644 --- a/tests/ui/issues/issue-39970.rs +++ b/tests/ui/issues/issue-39970.rs @@ -17,5 +17,5 @@ impl Visit for () where fn main() { <() as Visit>::visit(); - //~^ ERROR type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` + //~^ ERROR type mismatch resolving `<() as Array<'a>>::Element == ()` } diff --git a/tests/ui/issues/issue-39970.stderr b/tests/ui/issues/issue-39970.stderr index 0cabdf7f2..8344b88c3 100644 --- a/tests/ui/issues/issue-39970.stderr +++ b/tests/ui/issues/issue-39970.stderr @@ -1,8 +1,8 @@ -error[E0271]: type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` +error[E0271]: type mismatch resolving `<() as Array<'a>>::Element == ()` --> $DIR/issue-39970.rs:19:5 | LL | <() as Visit>::visit(); - | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` + | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Array<'a>>::Element == ()` | note: expected this to be `()` --> $DIR/issue-39970.rs:10:20 diff --git a/tests/ui/issues/issue-40003.rs b/tests/ui/issues/issue-40003.rs deleted file mode 100644 index 5e61361f9..000000000 --- a/tests/ui/issues/issue-40003.rs +++ /dev/null @@ -1,178 +0,0 @@ -// run-pass -#![allow(unused_must_use)] -fn main() { - if false { test(); } -} - -fn test() { - let rx = Err::, u32>(1).into_future(); - - rx.map(|l: Vec| stream::iter(l.into_iter().map(|i| Ok(i)))) - .flatten_stream() - .chunks(50) - .buffer_unordered(5); -} - -use future::{Future, IntoFuture}; -mod future { - use std::result; - - use {stream, Stream}; - - pub trait Future { - type Item; - type Error; - - fn map(self, _: F) -> Map - where F: FnOnce(Self::Item) -> U, - Self: Sized, - { - panic!() - } - - fn flatten_stream(self) -> FlattenStream - where ::Item: stream::Stream, - Self: Sized - { - panic!() - } - } - - pub trait IntoFuture { - type Future: Future; - type Item; - type Error; - fn into_future(self) -> Self::Future; - } - - impl IntoFuture for F { - type Future = F; - type Item = F::Item; - type Error = F::Error; - - fn into_future(self) -> F { - panic!() - } - } - - impl IntoFuture for result::Result { - type Future = FutureResult; - type Item = T; - type Error = E; - - fn into_future(self) -> FutureResult { - panic!() - } - } - - pub struct Map { - _a: (A, F), - } - - impl Future for Map - where A: Future, - F: FnOnce(A::Item) -> U, - { - type Item = U; - type Error = A::Error; - } - - pub struct FlattenStream { - _f: F, - } - - impl Stream for FlattenStream - where F: Future, - ::Item: Stream, - { - type Item = ::Item; - type Error = ::Error; - } - - pub struct FutureResult { - _inner: (T, E), - } - - impl Future for FutureResult { - type Item = T; - type Error = E; - } -} - -mod stream { - use IntoFuture; - - pub trait Stream { - type Item; - type Error; - - fn buffer_unordered(self, amt: usize) -> BufferUnordered - where Self::Item: IntoFuture::Error>, - Self: Sized - { - new(self, amt) - } - - fn chunks(self, _capacity: usize) -> Chunks - where Self: Sized - { - panic!() - } - } - - pub struct IterStream { - _iter: I, - } - - pub fn iter(_: J) -> IterStream - where J: IntoIterator>, - { - panic!() - } - - impl Stream for IterStream - where I: Iterator>, - { - type Item = T; - type Error = E; - } - - pub struct Chunks { - _stream: S - } - - impl Stream for Chunks - where S: Stream - { - type Item = Result::Item>, u32>; - type Error = ::Error; - } - - pub struct BufferUnordered { - _stream: S, - } - - enum Slot { - Next(#[allow(unused_tuple_struct_fields)] usize), - _Data { _a: T }, - } - - fn new(_s: S, _amt: usize) -> BufferUnordered - where S: Stream, - S::Item: IntoFuture::Error>, - { - (0..0).map(|_| { - Slot::Next::<::Future>(1) - }).collect::>(); - panic!() - } - - impl Stream for BufferUnordered - where S: Stream, - S::Item: IntoFuture::Error>, - { - type Item = ::Item; - type Error = ::Error; - } -} -use stream::Stream; diff --git a/tests/ui/issues/issue-40288.stderr b/tests/ui/issues/issue-40288.stderr index fb4ecab36..db5d06437 100644 --- a/tests/ui/issues/issue-40288.stderr +++ b/tests/ui/issues/issue-40288.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*refr` because it is borrowed --> $DIR/issue-40288.rs:16:5 | LL | save_ref(&*refr, &mut out); - | ------ borrow of `*refr` occurs here + | ------ `*refr` is borrowed here ... LL | *refr = 3; - | ^^^^^^^^^ assignment to borrowed `*refr` occurs here + | ^^^^^^^^^ `*refr` is assigned to here but it was already borrowed ... LL | println!("{:?}", out[0]); | ------ borrow later used here diff --git a/tests/ui/issues/issue-40749.stderr b/tests/ui/issues/issue-40749.stderr index fa239f744..afc39adec 100644 --- a/tests/ui/issues/issue-40749.stderr +++ b/tests/ui/issues/issue-40749.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-40749.rs:2:9 | LL | [0; ..10]; - | ^^^^ expected `usize`, found struct `RangeTo` + | ^^^^ expected `usize`, found `RangeTo<{integer}>` | = note: expected type `usize` found struct `RangeTo<{integer}>` diff --git a/tests/ui/issues/issue-43420-no-over-suggest.stderr b/tests/ui/issues/issue-43420-no-over-suggest.stderr index 58fd1121a..9b141e2bf 100644 --- a/tests/ui/issues/issue-43420-no-over-suggest.stderr +++ b/tests/ui/issues/issue-43420-no-over-suggest.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-43420-no-over-suggest.rs:8:9 | LL | foo(&a); - | --- ^^ expected slice `[u16]`, found struct `Vec` + | --- ^^ expected `&[u16]`, found `&Vec` | | | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-4517.rs b/tests/ui/issues/issue-4517.rs index caf85d44a..469304e2c 100644 --- a/tests/ui/issues/issue-4517.rs +++ b/tests/ui/issues/issue-4517.rs @@ -4,5 +4,5 @@ fn main() { let foo: [u8; 4] = [1; 4]; bar(foo); //~^ ERROR mismatched types - //~| expected `usize`, found array `[u8; 4]` + //~| expected `usize`, found `[u8; 4]` } diff --git a/tests/ui/issues/issue-4517.stderr b/tests/ui/issues/issue-4517.stderr index 70b4ca5ec..78ee336f1 100644 --- a/tests/ui/issues/issue-4517.stderr +++ b/tests/ui/issues/issue-4517.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-4517.rs:5:9 | LL | bar(foo); - | --- ^^^ expected `usize`, found array `[u8; 4]` + | --- ^^^ expected `usize`, found `[u8; 4]` | | | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-45697-1.stderr b/tests/ui/issues/issue-45697-1.stderr index 30c69f196..474313398 100644 --- a/tests/ui/issues/issue-45697-1.stderr +++ b/tests/ui/issues/issue-45697-1.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `y` occurs here + | ------ `y` is borrowed here LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` ... @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `*y.pointer` occurs here + | ------ `*y.pointer` is borrowed here LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here + | ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed ... LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/tests/ui/issues/issue-45697.stderr b/tests/ui/issues/issue-45697.stderr index 26749d36f..7986fd5c9 100644 --- a/tests/ui/issues/issue-45697.stderr +++ b/tests/ui/issues/issue-45697.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `y` occurs here + | ------ `y` is borrowed here LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` ... @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); - | ------ borrow of `*y.pointer` occurs here + | ------ `*y.pointer` is borrowed here LL | *y.pointer += 1; - | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here + | ^^^^^^^^^^^^^^^ `*y.pointer` is assigned to here but it was already borrowed ... LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/tests/ui/issues/issue-46471-1.stderr b/tests/ui/issues/issue-46471-1.stderr index b09f31729..2ae6e709d 100644 --- a/tests/ui/issues/issue-46471-1.stderr +++ b/tests/ui/issues/issue-46471-1.stderr @@ -1,11 +1,10 @@ error[E0597]: `z` does not live long enough --> $DIR/issue-46471-1.rs:4:9 | +LL | let mut z = 0; + | ----- binding `z` declared here LL | &mut z - | ^^^^^^ - | | - | borrowed value does not live long enough - | borrow later used here + | ^^^^^^ borrowed value does not live long enough LL | }; | - `z` dropped here while still borrowed diff --git a/tests/ui/issues/issue-47715.stderr b/tests/ui/issues/issue-47715.stderr index 0ee9388bf..dadea34b6 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 generic +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics --> $DIR/issue-47715.rs:9:37 | LL | struct Container> { | ^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics --> $DIR/issue-47715.rs:14:30 | LL | enum Enum> { | ^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics --> $DIR/issue-47715.rs:19:32 | LL | union Union + Copy> { | ^^^^^^^^ -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics --> $DIR/issue-47715.rs:24:30 | LL | type Type> = T; diff --git a/tests/ui/issues/issue-48179.rs b/tests/ui/issues/issue-48179.rs deleted file mode 100644 index f81203dc4..000000000 --- a/tests/ui/issues/issue-48179.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Regression test for #48132. This was failing due to problems around -// the projection caching and dropck type enumeration. - -// check-pass - -pub struct Container { - value: Option, -} - -impl Container { - pub fn new(iter: T) -> Self { - panic!() - } -} - -pub struct Wrapper<'a> { - content: &'a Content, -} - -impl<'a, 'de> Wrapper<'a> { - pub fn new(content: &'a Content) -> Self { - Wrapper { - content: content, - } - } -} - -pub struct Content; - -fn crash_it(content: Content) { - let items = vec![content]; - let map = items.iter().map(|ref o| Wrapper::new(o)); - - let mut map_visitor = Container::new(map); - -} - -fn main() {} diff --git a/tests/ui/issues/issue-48364.stderr b/tests/ui/issues/issue-48364.stderr index 60bbfc0c6..cac4af6a7 100644 --- a/tests/ui/issues/issue-48364.stderr +++ b/tests/ui/issues/issue-48364.stderr @@ -2,13 +2,13 @@ error[E0308]: mismatched types --> $DIR/issue-48364.rs:2:21 | LL | b"".starts_with(stringify!(foo)) - | ----------- ^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str` + | ----------- ^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str` | | | arguments to this method are incorrect | = note: expected reference `&[u8]` found reference `&'static str` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/slice/mod.rs:LL:COL = note: this error originates in the macro `stringify` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/issues/issue-4935.stderr b/tests/ui/issues/issue-4935.stderr index bb45fa083..e544e4244 100644 --- a/tests/ui/issues/issue-4935.stderr +++ b/tests/ui/issues/issue-4935.stderr @@ -2,17 +2,16 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/issue-4935.rs:5:13 | LL | fn main() { foo(5, 6) } - | ^^^ - argument of type `{integer}` unexpected + | ^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/issue-4935.rs:3:4 | LL | fn foo(a: usize) {} | ^^^ -------- -help: remove the extra argument - | -LL | fn main() { foo(5) } - | ~~~ error: aborting due to previous error diff --git a/tests/ui/issues/issue-4968.rs b/tests/ui/issues/issue-4968.rs index 634bd698d..c8df46dc2 100644 --- a/tests/ui/issues/issue-4968.rs +++ b/tests/ui/issues/issue-4968.rs @@ -6,5 +6,5 @@ fn main() { //~^ ERROR mismatched types //~| expected type `{integer}` //~| found tuple `(isize, isize)` - //~| expected integer, found tuple + //~| expected integer, found `(isize, isize)` } diff --git a/tests/ui/issues/issue-4968.stderr b/tests/ui/issues/issue-4968.stderr index bbaca4ed2..1ce033384 100644 --- a/tests/ui/issues/issue-4968.stderr +++ b/tests/ui/issues/issue-4968.stderr @@ -7,7 +7,7 @@ LL | fn main() { LL | match 42 { A => () } | -- ^ | | | - | | expected integer, found tuple + | | expected integer, found `(isize, isize)` | | `A` is interpreted as a constant, not a new binding | | help: introduce a new binding instead: `other_a` | this expression has type `{integer}` diff --git a/tests/ui/issues/issue-50576.rs b/tests/ui/issues/issue-50576.rs deleted file mode 100644 index e0c36b827..000000000 --- a/tests/ui/issues/issue-50576.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - |bool: [u8; break 'L]| 0; - //~^ ERROR [E0426] - //~| ERROR [E0268] - Vec::<[u8; break]>::new(); //~ ERROR [E0268] -} diff --git a/tests/ui/issues/issue-50576.stderr b/tests/ui/issues/issue-50576.stderr deleted file mode 100644 index 4ec22fde9..000000000 --- a/tests/ui/issues/issue-50576.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0426]: use of undeclared label `'L` - --> $DIR/issue-50576.rs:2:23 - | -LL | |bool: [u8; break 'L]| 0; - | ^^ undeclared label `'L` - -error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-50576.rs:2:17 - | -LL | |bool: [u8; break 'L]| 0; - | ^^^^^^^^ cannot `break` outside of a loop or labeled block - -error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-50576.rs:5:16 - | -LL | Vec::<[u8; break]>::new(); - | ^^^^^ cannot `break` outside of a loop or labeled block - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0268, E0426. -For more information about an error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-5100.rs b/tests/ui/issues/issue-5100.rs index 69ed4b0e4..53ebdec81 100644 --- a/tests/ui/issues/issue-5100.rs +++ b/tests/ui/issues/issue-5100.rs @@ -7,7 +7,7 @@ fn main() { match (true, false) { A::B => (), //~^ ERROR mismatched types -//~| expected tuple, found enum `A` +//~| expected `(bool, bool)`, found `A` //~| expected tuple `(bool, bool)` //~| found enum `A` _ => () @@ -39,7 +39,7 @@ fn main() { match (true, false) { &(true, false) => () //~^ ERROR mismatched types -//~| expected tuple, found reference +//~| expected `(bool, bool)`, found `&_` //~| expected tuple `(bool, bool)` //~| found reference `&_` } diff --git a/tests/ui/issues/issue-5100.stderr b/tests/ui/issues/issue-5100.stderr index c87a3e348..b1680aacd 100644 --- a/tests/ui/issues/issue-5100.stderr +++ b/tests/ui/issues/issue-5100.stderr @@ -7,7 +7,7 @@ LL | enum A { B, C } LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | A::B => (), - | ^^^^ expected tuple, found enum `A` + | ^^^^ expected `(bool, bool)`, found `A` | = note: expected tuple `(bool, bool)` found enum `A` @@ -40,7 +40,7 @@ error[E0308]: mismatched types LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | box (true, false) => () - | ^^^^^^^^^^^^^^^^^ expected tuple, found struct `Box` + | ^^^^^^^^^^^^^^^^^ expected `(bool, bool)`, found `Box<_>` | = note: expected tuple `(bool, bool)` found struct `Box<_>` @@ -51,7 +51,7 @@ error[E0308]: mismatched types LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | &(true, false) => () - | ^^^^^^^^^^^^^^ expected tuple, found reference + | ^^^^^^^^^^^^^^ expected `(bool, bool)`, found `&_` | = note: expected tuple `(bool, bool)` found reference `&_` diff --git a/tests/ui/issues/issue-51515.rs b/tests/ui/issues/issue-51515.rs index 797c1085d..84e09afac 100644 --- a/tests/ui/issues/issue-51515.rs +++ b/tests/ui/issues/issue-51515.rs @@ -5,6 +5,7 @@ fn main() { *foo = 32; //~^ ERROR cannot assign to `*foo`, which is behind a `&` reference let bar = foo; + //~^ HELP consider specifying this binding's type *bar = 64; //~^ ERROR cannot assign to `*bar`, which is behind a `&` reference } diff --git a/tests/ui/issues/issue-51515.stderr b/tests/ui/issues/issue-51515.stderr index c4e61e719..94e5c9f1b 100644 --- a/tests/ui/issues/issue-51515.stderr +++ b/tests/ui/issues/issue-51515.stderr @@ -10,12 +10,15 @@ LL | let foo = &mut 16; | ~~~~~~~ error[E0594]: cannot assign to `*bar`, which is behind a `&` reference - --> $DIR/issue-51515.rs:8:5 + --> $DIR/issue-51515.rs:9:5 | -LL | let bar = foo; - | --- consider changing this binding's type to be: `&mut i32` LL | *bar = 64; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written + | +help: consider specifying this binding's type + | +LL | let bar: &mut i32 = foo; + | ++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index cc0726bca..7180a3d24 100644 --- a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -2,7 +2,7 @@ error[E0308]: `?` operator has incompatible types --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 | LL | missing_discourses()? - | ^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `isize` + | ^^^^^^^^^^^^^^^^^^^^^ expected `Result`, found `isize` | = note: `?` operator cannot convert from `isize` to `Result` = note: expected enum `Result` diff --git a/tests/ui/issues/issue-52126-assign-op-invariance.stderr b/tests/ui/issues/issue-52126-assign-op-invariance.stderr index d45067577..2d3b48832 100644 --- a/tests/ui/issues/issue-52126-assign-op-invariance.stderr +++ b/tests/ui/issues/issue-52126-assign-op-invariance.stderr @@ -1,6 +1,8 @@ error[E0597]: `line` does not live long enough --> $DIR/issue-52126-assign-op-invariance.rs:34:28 | +LL | for line in vec!["123456789".to_string(), "12345678".to_string()] { + | ---- binding `line` declared here LL | let v: Vec<&str> = line.split_whitespace().collect(); | ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/issues/issue-53251.rs b/tests/ui/issues/issue-53251.rs index 240826a16..da3ba63ef 100644 --- a/tests/ui/issues/issue-53251.rs +++ b/tests/ui/issues/issue-53251.rs @@ -9,8 +9,8 @@ macro_rules! impl_add { $( fn $n() { S::f::(); - //~^ ERROR this associated function takes 0 generic - //~| ERROR this associated function takes 0 generic + //~^ ERROR associated function takes 0 generic + //~| ERROR associated function takes 0 generic } )* } diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index cee9a5deb..d5f14e8de 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); @@ -16,7 +16,7 @@ LL | fn f() {} | ^ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); diff --git a/tests/ui/issues/issue-53348.rs b/tests/ui/issues/issue-53348.rs index d2f8c77c0..66800d9e9 100644 --- a/tests/ui/issues/issue-53348.rs +++ b/tests/ui/issues/issue-53348.rs @@ -9,7 +9,7 @@ fn main() { for i in v { a = *i.to_string(); //~^ ERROR mismatched types - //~| NOTE expected struct `String`, found `str` + //~| NOTE expected `String`, found `str` v2.push(a); } } diff --git a/tests/ui/issues/issue-53348.stderr b/tests/ui/issues/issue-53348.stderr index 71d9f5b3d..e4cdb7e88 100644 --- a/tests/ui/issues/issue-53348.stderr +++ b/tests/ui/issues/issue-53348.stderr @@ -5,7 +5,7 @@ LL | let mut a = String::new(); | ------------- expected due to this value LL | for i in v { LL | a = *i.to_string(); - | ^^^^^^^^^^^^^^ expected struct `String`, found `str` + | ^^^^^^^^^^^^^^ expected `String`, found `str` error: aborting due to previous error diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/issues/issue-5358-1.rs index f5e32e78d..14ee962b7 100644 --- a/tests/ui/issues/issue-5358-1.rs +++ b/tests/ui/issues/issue-5358-1.rs @@ -5,7 +5,7 @@ fn main() { match S(Either::Left(5)) { Either::Right(_) => {} //~^ ERROR mismatched types - //~| expected struct `S`, found enum `Either` + //~| expected `S`, found `Either<_, _>` //~| expected struct `S` //~| found enum `Either<_, _>` _ => {} diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index 9d5b8d9d3..059462a36 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match S(Either::Left(5)) { | ------------------ this expression has type `S` LL | Either::Right(_) => {} - | ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either` + | ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>` | = note: expected struct `S` found enum `Either<_, _>` diff --git a/tests/ui/issues/issue-53712.rs b/tests/ui/issues/issue-53712.rs deleted file mode 100644 index 2353904d7..000000000 --- a/tests/ui/issues/issue-53712.rs +++ /dev/null @@ -1,9 +0,0 @@ -// issue #53712: make the error generated by using tuple indexing on an array more specific - -fn main() { - let arr = [10, 20, 30, 40, 50]; - arr.0; - //~^ ERROR no field `0` on type `[{integer}; 5]` [E0609] - //~| HELP instead of using tuple indexing, use array indexing - //~| SUGGESTION arr[0] -} diff --git a/tests/ui/issues/issue-53712.stderr b/tests/ui/issues/issue-53712.stderr deleted file mode 100644 index db85919af..000000000 --- a/tests/ui/issues/issue-53712.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0609]: no field `0` on type `[{integer}; 5]` - --> $DIR/issue-53712.rs:5:9 - | -LL | arr.0; - | ----^ - | | - | help: instead of using tuple indexing, use array indexing: `arr[0]` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-54582.rs b/tests/ui/issues/issue-54582.rs deleted file mode 100644 index 8c50cac67..000000000 --- a/tests/ui/issues/issue-54582.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass - -pub trait Stage: Sync {} - -pub enum Enum { - A, - B, -} - -impl Stage for Enum {} - -pub static ARRAY: [(&dyn Stage, &str); 1] = [ - (&Enum::A, ""), -]; - -fn main() {} diff --git a/tests/ui/issues/issue-56943.stderr b/tests/ui/issues/issue-56943.stderr index 74ed5ec0f..c394e620b 100644 --- a/tests/ui/issues/issue-56943.stderr +++ b/tests/ui/issues/issue-56943.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-56943.rs:6:29 | LL | let _: issue_56943::S = issue_56943::S2; - | -------------- ^^^^^^^^^^^^^^^ expected struct `S`, found struct `S2` + | -------------- ^^^^^^^^^^^^^^^ expected `S`, found `S2` | | | expected due to this diff --git a/tests/ui/issues/issue-57362-2.stderr b/tests/ui/issues/issue-57362-2.stderr index 7d08c4643..37beb587d 100644 --- a/tests/ui/issues/issue-57362-2.stderr +++ b/tests/ui/issues/issue-57362-2.stderr @@ -1,8 +1,8 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied +error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&())`, but its trait bounds were not satisfied --> $DIR/issue-57362-2.rs:22:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item cannot be called on `fn(&())` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `for<'a> fn(&'a ()): X` diff --git a/tests/ui/issues/issue-57741-1.stderr b/tests/ui/issues/issue-57741-1.stderr index 789a1f44d..76f03bab6 100644 --- a/tests/ui/issues/issue-57741-1.stderr +++ b/tests/ui/issues/issue-57741-1.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let y = match x { | - this expression has type `Box` LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^ expected struct `Box`, found enum `S` + | ^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | let y = match x { | - this expression has type `Box` LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S` + | ^^^^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` diff --git a/tests/ui/issues/issue-57741.stderr b/tests/ui/issues/issue-57741.stderr index cd277f20e..38014ecce 100644 --- a/tests/ui/issues/issue-57741.stderr +++ b/tests/ui/issues/issue-57741.stderr @@ -7,7 +7,7 @@ LL | let y = match x { | this expression has type `Box` | help: consider dereferencing the boxed value: `*x` LL | T::A(a) | T::B(a) => a, - | ^^^^^^^ expected struct `Box`, found enum `T` + | ^^^^^^^ expected `Box`, found `T` | = note: expected struct `Box` found enum `T` @@ -21,7 +21,7 @@ LL | let y = match x { | this expression has type `Box` | help: consider dereferencing the boxed value: `*x` LL | T::A(a) | T::B(a) => a, - | ^^^^^^^ expected struct `Box`, found enum `T` + | ^^^^^^^ expected `Box`, found `T` | = note: expected struct `Box` found enum `T` @@ -35,7 +35,7 @@ LL | let y = match x { | this expression has type `Box` | help: consider dereferencing the boxed value: `*x` LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^ expected struct `Box`, found enum `S` + | ^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` @@ -49,7 +49,7 @@ LL | let y = match x { | this expression has type `Box` | help: consider dereferencing the boxed value: `*x` LL | S::A { a } | S::B { b: a } => a, - | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S` + | ^^^^^^^^^^^^^ expected `Box`, found `S` | = note: expected struct `Box` found enum `S` diff --git a/tests/ui/issues/issue-59488.stderr b/tests/ui/issues/issue-59488.stderr index f9846b62a..d45beefa4 100644 --- a/tests/ui/issues/issue-59488.stderr +++ b/tests/ui/issues/issue-59488.stderr @@ -15,7 +15,7 @@ error[E0308]: mismatched types --> $DIR/issue-59488.rs:14:11 | LL | foo > 12; - | ^^ expected fn item, found integer + | ^^ expected fn item, found `i32` | = note: expected fn item `fn() -> i32 {foo}` found type `i32` @@ -37,7 +37,7 @@ error[E0308]: mismatched types --> $DIR/issue-59488.rs:18:11 | LL | bar > 13; - | ^^ expected fn item, found integer + | ^^ expected fn item, found `i64` | = note: expected fn item `fn(i64) -> i64 {bar}` found type `i64` diff --git a/tests/ui/issues/issue-60218.stderr b/tests/ui/issues/issue-60218.stderr index dd72b6515..563690c9a 100644 --- a/tests/ui/issues/issue-60218.stderr +++ b/tests/ui/issues/issue-60218.stderr @@ -10,7 +10,7 @@ note: required by a bound in `trigger_error` --> $DIR/issue-60218.rs:13:72 | LL | pub fn trigger_error(iterable: I, functor: F) - | ------------- required by a bound in this + | ------------- required by a bound in this function ... LL | for<'t> ::IntoIter, F> as Iterator>::Item: Foo, | ^^^ required by this bound in `trigger_error` diff --git a/tests/ui/issues/issue-60622.rs b/tests/ui/issues/issue-60622.rs index 8e230c615..7b9443eee 100644 --- a/tests/ui/issues/issue-60622.rs +++ b/tests/ui/issues/issue-60622.rs @@ -9,7 +9,7 @@ impl Borked { fn run_wild(b: &Borked) { b.a::<'_, T>(); //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - //~| ERROR this associated function takes 0 generic arguments but 1 generic argument + //~| ERROR method takes 0 generic arguments but 1 generic argument //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! } diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index ecf1ae758..43da27739 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -16,7 +16,7 @@ LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(late_bound_lifetime_arguments)]` implied by `#[deny(warnings)]` -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); @@ -24,7 +24,7 @@ LL | b.a::<'_, T>(); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/issue-60622.rs:6:8 | LL | fn a(&self) {} diff --git a/tests/ui/issues/issue-61106.stderr b/tests/ui/issues/issue-61106.stderr index 2bc092341..eff3e6e78 100644 --- a/tests/ui/issues/issue-61106.stderr +++ b/tests/ui/issues/issue-61106.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | foo(x.clone()); | --- ^^^^^^^^^ | | | - | | expected `&str`, found struct `String` + | | expected `&str`, found `String` | | help: consider borrowing here: `&x` | arguments to this function are incorrect | diff --git a/tests/ui/issues/issue-6458-4.stderr b/tests/ui/issues/issue-6458-4.stderr index 168ececac..66ccfdff2 100644 --- a/tests/ui/issues/issue-6458-4.stderr +++ b/tests/ui/issues/issue-6458-4.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-6458-4.rs:1:20 | LL | fn foo(b: bool) -> Result { - | --- ^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` + | --- ^^^^^^^^^^^^^^^^^^^ expected `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | Err("bar".to_string()); diff --git a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr index d0cb16995..4af3672ef 100644 --- a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr +++ b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn | LL | fn r#struct(&self) { | ^^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | async::r#struct(&r#fn {}); | ~~~~~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | await::r#struct(&r#fn {}); | ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr index a75c1c413..2b96a0fb5 100644 --- a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr +++ b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `r#await` for the type `r# | LL | fn r#struct(&self) { | ^^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | r#async::r#struct(&r#fn {}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | r#await::r#struct(&r#fn {}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr b/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr index 37e2c3bdd..6fde44eaf 100644 --- a/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr +++ b/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr @@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving ` as Deref>::Target == Rc --> $DIR/issue-67039-unsound-pin-partialeq.rs:25:29 | LL | let _ = Pin::new(Apple) == Rc::pin(Apple); - | ^^ expected struct `Apple`, found struct `Rc` + | ^^ expected `Apple`, found `Rc` | = note: expected struct `Apple` found struct `Rc` diff --git a/tests/ui/issues/issue-69306.stderr b/tests/ui/issues/issue-69306.stderr index 61ec5d318..570677298 100644 --- a/tests/ui/issues/issue-69306.stderr +++ b/tests/ui/issues/issue-69306.stderr @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | impl S0 { | - this type parameter LL | const C: S0 = Self(0); - | ^^^^^^^ expected `u8`, found type parameter `T` + | ^^^^^^^ expected `S0`, found `S0` | = note: expected struct `S0` found struct `S0` @@ -89,7 +89,7 @@ error[E0308]: mismatched types LL | impl S1 { | - this type parameter LL | const C: S1 = Self(0, 1); - | ^^^^^^^^^^ expected `u8`, found type parameter `T` + | ^^^^^^^^^^ expected `S1`, found `S1` | = note: expected struct `S1` found struct `S1` @@ -126,7 +126,7 @@ LL | fn map(x: U) -> S2 { | | | expected type parameter LL | Self(x) - | ^^^^^^^ expected type parameter `U`, found type parameter `T` + | ^^^^^^^ expected `S2`, found `S2` | = note: expected struct `S2` found struct `S2` diff --git a/tests/ui/issues/issue-69455.stderr b/tests/ui/issues/issue-69455.stderr index fc343bb54..d3e307fba 100644 --- a/tests/ui/issues/issue-69455.stderr +++ b/tests/ui/issues/issue-69455.stderr @@ -2,7 +2,7 @@ error[E0284]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | | | type must be known at this point | @@ -16,7 +16,7 @@ error[E0283]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | | | required by a bound introduced by this call | diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/issues/issue-69683.stderr index 193de1a35..c428ea9ea 100644 --- a/tests/ui/issues/issue-69683.stderr +++ b/tests/ui/issues/issue-69683.stderr @@ -31,7 +31,7 @@ LL | u8: Element, | ^^^^^^^^^^ required by this bound in `Foo::foo` LL | { LL | fn foo(self, x: >::Array); - | --- required by a bound in this + | --- required by a bound in this associated function help: try using a fully qualified path to specify the expected types | LL | >::foo(0u16, b); diff --git a/tests/ui/issues/issue-70093.rs b/tests/ui/issues/issue-70093.rs deleted file mode 100644 index 86459dc90..000000000 --- a/tests/ui/issues/issue-70093.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes -// ignore-windows - this will probably only work on unixish systems -// ignore-fuchsia - missing __libc_start_main for some reason (#84733) -// ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling - -#[link(name = "some-random-non-existent-library", kind = "static")] -extern "C" {} - -fn main() {} diff --git a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs b/tests/ui/issues/issue-70093/issue-70093-link-directives.rs new file mode 100644 index 000000000..83f9b16c4 --- /dev/null +++ b/tests/ui/issues/issue-70093/issue-70093-link-directives.rs @@ -0,0 +1,10 @@ +// run-pass +// compile-flags: -Zlink-directives=no +// ignore-windows - this will probably only work on unixish systems +// ignore-fuchsia - missing __libc_start_main for some reason (#84733) +// ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling + +#[link(name = "some-random-non-existent-library", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/ui/issues/issue-70093/issue-70093.rs b/tests/ui/issues/issue-70093/issue-70093.rs new file mode 100644 index 000000000..86459dc90 --- /dev/null +++ b/tests/ui/issues/issue-70093/issue-70093.rs @@ -0,0 +1,10 @@ +// run-pass +// compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes +// ignore-windows - this will probably only work on unixish systems +// ignore-fuchsia - missing __libc_start_main for some reason (#84733) +// ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling + +#[link(name = "some-random-non-existent-library", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/ui/issues/issue-7061.stderr b/tests/ui/issues/issue-7061.stderr index 27034378d..a209f8a42 100644 --- a/tests/ui/issues/issue-7061.stderr +++ b/tests/ui/issues/issue-7061.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-7061.rs:4:46 | LL | fn foo(&'a mut self) -> Box { self } - | -------------- ^^^^ expected struct `Box`, found `&mut BarStruct` + | -------------- ^^^^ expected `Box`, found `&mut BarStruct` | | | expected `Box` because of return type | diff --git a/tests/ui/issues/issue-7092.rs b/tests/ui/issues/issue-7092.rs index 85bfbf90d..c3c96c7d3 100644 --- a/tests/ui/issues/issue-7092.rs +++ b/tests/ui/issues/issue-7092.rs @@ -5,7 +5,7 @@ fn foo(x: Whatever) { match x { Some(field) => //~^ ERROR mismatched types -//~| expected enum `Whatever`, found enum `Option` +//~| expected `Whatever`, found `Option<_>` //~| expected enum `Whatever` //~| found enum `Option<_>` field.access(), diff --git a/tests/ui/issues/issue-7092.stderr b/tests/ui/issues/issue-7092.stderr index 59e8d75e2..e35379fd1 100644 --- a/tests/ui/issues/issue-7092.stderr +++ b/tests/ui/issues/issue-7092.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match x { | - this expression has type `Whatever` LL | Some(field) => - | ^^^^^^^^^^^ expected enum `Whatever`, found enum `Option` + | ^^^^^^^^^^^ expected `Whatever`, found `Option<_>` | = note: expected enum `Whatever` found enum `Option<_>` diff --git a/tests/ui/issues/issue-71676-1.stderr b/tests/ui/issues/issue-71676-1.stderr index 2104634eb..164641ff7 100644 --- a/tests/ui/issues/issue-71676-1.stderr +++ b/tests/ui/issues/issue-71676-1.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-71676-1.rs:43:24 | LL | let _: *const u8 = &a; - | --------- ^^ expected `u8`, found struct `Emm` + | --------- ^^ expected `*const u8`, found `&Emm` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/issue-71676-1.rs:49:24 | LL | let _: *const u8 = &mut a; - | --------- ^^^^^^ expected `u8`, found struct `Emm` + | --------- ^^^^^^ expected `*const u8`, found `&mut Emm` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/issue-71676-1.rs:52:22 | LL | let _: *mut u8 = &mut a; - | ------- ^^^^^^ expected `u8`, found struct `Emm` + | ------- ^^^^^^ expected `*mut u8`, found `&mut Emm` | | | expected due to this | diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr index 5dc8c2b60..aee73380f 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/issues/issue-7364.stderr @@ -5,6 +5,7 @@ LL | static boxed: Box> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Unique>` to implement `Sync` = note: required because it appears within the type `Box>` = note: shared static variables must have a type that implements `Sync` diff --git a/tests/ui/issues/issue-74236/main.stderr b/tests/ui/issues/issue-74236/main.stderr index 55e94ae72..5cd64e48a 100644 --- a/tests/ui/issues/issue-74236/main.stderr +++ b/tests/ui/issues/issue-74236/main.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let () = dep::Renamed; | ^^ ------------ this expression has type `Renamed` | | - | expected struct `Renamed`, found `()` + | expected `Renamed`, found `()` error: aborting due to previous error diff --git a/tests/ui/issues/issue-75307.rs b/tests/ui/issues/issue-75307.rs deleted file mode 100644 index cffa6bea8..000000000 --- a/tests/ui/issues/issue-75307.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - format!(r"{}{}{}", named_arg=1); //~ ERROR 3 positional arguments in format string, but there is 1 argument -} diff --git a/tests/ui/issues/issue-75307.stderr b/tests/ui/issues/issue-75307.stderr deleted file mode 100644 index c5b0b11e7..000000000 --- a/tests/ui/issues/issue-75307.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: 3 positional arguments in format string, but there is 1 argument - --> $DIR/issue-75307.rs:2:15 - | -LL | format!(r"{}{}{}", named_arg=1); - | ^^^^^^ - - -error: aborting due to previous error - diff --git a/tests/ui/issues/issue-75777.rs b/tests/ui/issues/issue-75777.rs deleted file mode 100644 index a1e438bc6..000000000 --- a/tests/ui/issues/issue-75777.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Regression test for #75777. -// Checks that a boxed future can be properly constructed. - -use std::future::{self, Future}; -use std::pin::Pin; - -type BoxFuture<'a, T> = Pin + 'a + Send>>; - -fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box BoxFuture<'a, A>> { - let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); - Box::new(move |_| fut) - //~^ ERROR: lifetime may not live long enough -} - -fn main() {} diff --git a/tests/ui/issues/issue-75777.stderr b/tests/ui/issues/issue-75777.stderr deleted file mode 100644 index 370cd72fd..000000000 --- a/tests/ui/issues/issue-75777.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-75777.rs:11:5 - | -LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box BoxFuture<'a, A>> { - | -- lifetime `'a` defined here -LL | let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); -LL | Box::new(move |_| fut) - | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr index 137498047..32d9105b2 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/issues/issue-76191.stderr @@ -9,7 +9,7 @@ LL | match n { LL | RANGE => {} | ^^^^^ | | - | expected `i32`, found struct `RangeInclusive` + | expected `i32`, found `RangeInclusive` | `RANGE` is interpreted as a constant, not a new binding | = note: expected type `i32` @@ -31,7 +31,7 @@ LL | match n { LL | RANGE2 => {} | ^^^^^^ | | - | expected `i32`, found struct `RangeInclusive` + | expected `i32`, found `RangeInclusive` | `RANGE2` is interpreted as a constant, not a new binding | = note: expected type `i32` diff --git a/tests/ui/issues/issue-7813.rs b/tests/ui/issues/issue-7813.rs deleted file mode 100644 index ce549bde6..000000000 --- a/tests/ui/issues/issue-7813.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let v = &[]; //~ ERROR type annotations needed - let it = v.iter(); -} diff --git a/tests/ui/issues/issue-7813.stderr b/tests/ui/issues/issue-7813.stderr deleted file mode 100644 index 2a747f679..000000000 --- a/tests/ui/issues/issue-7813.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed for `&[_; 0]` - --> $DIR/issue-7813.rs:2:9 - | -LL | let v = &[]; - | ^ --- type must be known at this point - | -help: consider giving `v` an explicit type, where the placeholders `_` are specified - | -LL | let v: &[_; 0] = &[]; - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/issues/issue-7867.rs index 3074052f1..e9fd10c66 100644 --- a/tests/ui/issues/issue-7867.rs +++ b/tests/ui/issues/issue-7867.rs @@ -6,7 +6,7 @@ fn main() { match (true, false) { A::B => (), //~^ ERROR mismatched types - //~| expected tuple, found enum `A` + //~| expected `(bool, bool)`, found `A` //~| expected tuple `(bool, bool)` //~| found enum `A` _ => () diff --git a/tests/ui/issues/issue-7867.stderr b/tests/ui/issues/issue-7867.stderr index 0d3121d60..4fb1af344 100644 --- a/tests/ui/issues/issue-7867.stderr +++ b/tests/ui/issues/issue-7867.stderr @@ -7,7 +7,7 @@ LL | enum A { B, C } LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | A::B => (), - | ^^^^ expected tuple, found enum `A` + | ^^^^ expected `(bool, bool)`, found `A` | = note: expected tuple `(bool, bool)` found enum `A` diff --git a/tests/ui/issues/issue-83924.fixed b/tests/ui/issues/issue-83924.fixed deleted file mode 100644 index aa40da12b..000000000 --- a/tests/ui/issues/issue-83924.fixed +++ /dev/null @@ -1,20 +0,0 @@ -// run-rustfix - -fn main() { - let mut values = vec![10, 11, 12]; - let v = &mut values; - - let mut max = 0; - - for n in &mut *v { - max = std::cmp::max(max, *n); - } - - println!("max is {}", max); - println!("Converting to percentages of maximum value..."); - for n in v { - //~^ ERROR: use of moved value: `v` [E0382] - *n = 100 * (*n) / max; - } - println!("values: {:#?}", values); -} diff --git a/tests/ui/issues/issue-83924.rs b/tests/ui/issues/issue-83924.rs deleted file mode 100644 index 22b80fe2f..000000000 --- a/tests/ui/issues/issue-83924.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-rustfix - -fn main() { - let mut values = vec![10, 11, 12]; - let v = &mut values; - - let mut max = 0; - - for n in v { - max = std::cmp::max(max, *n); - } - - println!("max is {}", max); - println!("Converting to percentages of maximum value..."); - for n in v { - //~^ ERROR: use of moved value: `v` [E0382] - *n = 100 * (*n) / max; - } - println!("values: {:#?}", values); -} diff --git a/tests/ui/issues/issue-83924.stderr b/tests/ui/issues/issue-83924.stderr deleted file mode 100644 index 572414df2..000000000 --- a/tests/ui/issues/issue-83924.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0382]: use of moved value: `v` - --> $DIR/issue-83924.rs:15:14 - | -LL | let v = &mut values; - | - move occurs because `v` has type `&mut Vec`, which does not implement the `Copy` trait -... -LL | for n in v { - | - `v` moved due to this implicit call to `.into_iter()` -... -LL | for n in v { - | ^ value used here after move - | -note: `into_iter` takes ownership of the receiver `self`, which moves `v` - --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL -help: consider creating a fresh reborrow of `v` here - | -LL | for n in &mut *v { - | ++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-92741.fixed b/tests/ui/issues/issue-92741.fixed new file mode 100644 index 000000000..d07aeb6c0 --- /dev/null +++ b/tests/ui/issues/issue-92741.fixed @@ -0,0 +1,13 @@ +// run-rustfix +fn main() {} +fn _foo() -> bool { + if true { true } else { false } +} + +fn _bar() -> bool { + if true { true } else { false } +} + +fn _baz() -> bool { + if true { true } else { false } +} diff --git a/tests/ui/issues/issue-92741.rs b/tests/ui/issues/issue-92741.rs new file mode 100644 index 000000000..413d5bf04 --- /dev/null +++ b/tests/ui/issues/issue-92741.rs @@ -0,0 +1,17 @@ +// run-rustfix +fn main() {} +fn _foo() -> bool { + & //~ ERROR 4:5: 6:36: mismatched types [E0308] + mut + if true { true } else { false } +} + +fn _bar() -> bool { + & //~ ERROR 10:5: 11:40: mismatched types [E0308] + mut if true { true } else { false } +} + +fn _baz() -> bool { + & mut //~ ERROR 15:5: 16:36: mismatched types [E0308] + if true { true } else { false } +} diff --git a/tests/ui/issues/issue-92741.stderr b/tests/ui/issues/issue-92741.stderr new file mode 100644 index 000000000..49315e7a8 --- /dev/null +++ b/tests/ui/issues/issue-92741.stderr @@ -0,0 +1,49 @@ +error[E0308]: mismatched types + --> $DIR/issue-92741.rs:4:5 + | +LL | fn _foo() -> bool { + | ---- expected `bool` because of return type +LL | / & +LL | | mut +LL | | if true { true } else { false } + | |___________________________________^ expected `bool`, found `&mut bool` + | +help: consider removing the borrow + | +LL - & +LL - mut + | + +error[E0308]: mismatched types + --> $DIR/issue-92741.rs:10:5 + | +LL | fn _bar() -> bool { + | ---- expected `bool` because of return type +LL | / & +LL | | mut if true { true } else { false } + | |_______________________________________^ expected `bool`, found `&mut bool` + | +help: consider removing the borrow + | +LL - & +LL - mut if true { true } else { false } +LL + if true { true } else { false } + | + +error[E0308]: mismatched types + --> $DIR/issue-92741.rs:15:5 + | +LL | fn _baz() -> bool { + | ---- expected `bool` because of return type +LL | / & mut +LL | | if true { true } else { false } + | |___________________________________^ expected `bool`, found `&mut bool` + | +help: consider removing the borrow + | +LL - & mut + | + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/json/json-bom-plus-crlf-multifile.stderr b/tests/ui/json/json-bom-plus-crlf-multifile.stderr index 02f3bc687..84040e805 100644 --- a/tests/ui/json/json-bom-plus-crlf-multifile.stderr +++ b/tests/ui/json/json-bom-plus-crlf-multifile.stderr @@ -24,7 +24,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":622,"byte_end":622,"line_start":17,"line_end":17,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":622,"byte_end":622,"line_start":17,"line_end":17,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -52,7 +52,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":682,"byte_end":682,"line_start":19,"line_end":19,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":682,"byte_end":682,"line_start":19,"line_end":19,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -80,7 +80,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":746,"byte_end":746,"line_start":23,"line_end":23,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":746,"byte_end":746,"line_start":23,"line_end":23,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -108,7 +108,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors "} diff --git a/tests/ui/json/json-bom-plus-crlf.stderr b/tests/ui/json/json-bom-plus-crlf.stderr index df6bd7286..b0f450e9e 100644 --- a/tests/ui/json/json-bom-plus-crlf.stderr +++ b/tests/ui/json/json-bom-plus-crlf.stderr @@ -24,7 +24,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":607,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":607,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -52,7 +52,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":667,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":667,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -80,7 +80,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":731,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":731,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -108,7 +108,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors "} diff --git a/tests/ui/kindck/kindck-send-object1.stderr b/tests/ui/kindck/kindck-send-object1.stderr index 11f597fee..19ef4f6fc 100644 --- a/tests/ui/kindck/kindck-send-object1.stderr +++ b/tests/ui/kindck/kindck-send-object1.stderr @@ -20,7 +20,7 @@ LL | assert_send::>(); | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` = note: required for `Unique<(dyn Dummy + 'a)>` to implement `Send` - = note: required because it appears within the type `Box<(dyn Dummy + 'a)>` + = note: required because it appears within the type `Box` note: required by a bound in `assert_send` --> $DIR/kindck-send-object1.rs:5:18 | diff --git a/tests/ui/kinds-of-primitive-impl.stderr b/tests/ui/kinds-of-primitive-impl.stderr index f4dbd1c40..21aac58f1 100644 --- a/tests/ui/kinds-of-primitive-impl.stderr +++ b/tests/ui/kinds-of-primitive-impl.stderr @@ -1,32 +1,32 @@ error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/kinds-of-primitive-impl.rs:1:6 + --> $DIR/kinds-of-primitive-impl.rs:1:1 | LL | impl u8 { - | ^^ + | ^^^^^^^ | = help: consider using an extension trait instead error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/kinds-of-primitive-impl.rs:6:6 + --> $DIR/kinds-of-primitive-impl.rs:6:1 | LL | impl str { - | ^^^ + | ^^^^^^^^ | = help: consider using an extension trait instead error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/kinds-of-primitive-impl.rs:12:6 + --> $DIR/kinds-of-primitive-impl.rs:12:1 | LL | impl char { - | ^^^^ + | ^^^^^^^^^ | = help: consider using an extension trait instead error[E0390]: cannot define inherent `impl` for primitive types - --> $DIR/kinds-of-primitive-impl.rs:21:6 + --> $DIR/kinds-of-primitive-impl.rs:21:1 | LL | impl &MyType { - | ^^^^^^^ + | ^^^^^^^^^^^^ | = help: consider using an extension trait instead = note: you could also try moving the reference to uses of `MyType` (such as `self`) within the implementation diff --git a/tests/ui/lang-items/bad-add-impl.rs b/tests/ui/lang-items/bad-add-impl.rs new file mode 100644 index 000000000..0c44edbe5 --- /dev/null +++ b/tests/ui/lang-items/bad-add-impl.rs @@ -0,0 +1,18 @@ +#![feature(no_core)] +#![feature(lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[lang = "add"] +trait Add { + const add: u32 = 1u32; +} + +impl Add for u32 {} + +fn main() { + 1u32 + 1u32; + //~^ ERROR cannot add `u32` to `u32` +} diff --git a/tests/ui/lang-items/bad-add-impl.stderr b/tests/ui/lang-items/bad-add-impl.stderr new file mode 100644 index 000000000..3143729f9 --- /dev/null +++ b/tests/ui/lang-items/bad-add-impl.stderr @@ -0,0 +1,11 @@ +error[E0369]: cannot add `u32` to `u32` + --> $DIR/bad-add-impl.rs:16:10 + | +LL | 1u32 + 1u32; + | ---- ^ ---- u32 + | | + | u32 + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr new file mode 100644 index 000000000..ff603111e --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:39:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:43:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr new file mode 100644 index 000000000..ff603111e --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:39:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:43:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr new file mode 100644 index 000000000..02e33c597 --- /dev/null +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr @@ -0,0 +1,18 @@ +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5 + | +LL | a(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: failed to find an overloaded call trait for closure call + --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5 + | +LL | b(); + | ^^^ + | + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs index 52bd8136d..757c6538d 100644 --- a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs +++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs @@ -1,27 +1,49 @@ -// Make sure that an error is reported if the `call` function of the -// `fn`/`fn_mut` lang item is grossly ill-formed. +// revisions: fn_once_bad_item fn_once_bad_sig fn_mut_bad_item fn_mut_bad_sig fn_bad_item fn_bad_sig #![feature(lang_items)] #![feature(no_core)] #![no_core] +#[lang = "sized"] +trait Sized {} + +#[cfg(any(fn_bad_item, fn_bad_sig))] #[lang = "fn"] trait MyFn { + #[cfg(fn_bad_sig)] + fn call(i: i32) -> i32 { 0 } + + #[cfg(fn_bad_item)] const call: i32 = 42; - //~^ ERROR: `call` trait item in `fn` lang item must be a function } +#[cfg(any(fn_mut_bad_item, fn_mut_bad_sig))] #[lang = "fn_mut"] trait MyFnMut { - fn call(i: i32, j: i32) -> i32 { i + j } - //~^ ERROR: first argument of `call` in `fn_mut` lang item must be a reference + #[cfg(fn_mut_bad_sig)] + fn call_mut(i: i32) -> i32 { 0 } + + #[cfg(fn_mut_bad_item)] + const call_mut: i32 = 42; +} + +#[cfg(any(fn_once_bad_item, fn_once_bad_sig))] +#[lang = "fn_once"] +trait MyFnOnce { + #[cfg(fn_once_bad_sig)] + fn call_once(i: i32) -> i32 { 0 } + + #[cfg(fn_once_bad_item)] + const call_once: i32 = 42; } fn main() { let a = || 42; a(); + //~^ ERROR failed to find an overloaded call trait for closure call let mut i = 0; - let mut b = || { i += 1; }; + let mut b = || { }; b(); + //~^ ERROR failed to find an overloaded call trait for closure call } diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr deleted file mode 100644 index 82bdae270..000000000 --- a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: `call` trait item in `fn` lang item must be a function - --> $DIR/fn-fn_mut-call-ill-formed.rs:10:5 - | -LL | const call: i32 = 42; - | ^^^^^^^^^^^^^^^^^^^^^ - -error: first argument of `call` in `fn_mut` lang item must be a reference - --> $DIR/fn-fn_mut-call-ill-formed.rs:16:16 - | -LL | fn call(i: i32, j: i32) -> i32 { i + j } - | ^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/lang-items/issue-86238.stderr b/tests/ui/lang-items/issue-86238.stderr index 767e6de22..c6e811a94 100644 --- a/tests/ui/lang-items/issue-86238.stderr +++ b/tests/ui/lang-items/issue-86238.stderr @@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call LL | one() | ^^^^^ | - = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions + = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods error: aborting due to previous error diff --git a/tests/ui/lang-items/lang-item-missing-generator.rs b/tests/ui/lang-items/lang-item-missing-generator.rs deleted file mode 100644 index 9b9aff38e..000000000 --- a/tests/ui/lang-items/lang-item-missing-generator.rs +++ /dev/null @@ -1,21 +0,0 @@ -// error-pattern: requires `generator` lang_item -#![feature(no_core, lang_items, unboxed_closures, tuple_trait)] -#![no_core] - -#[lang = "sized"] pub trait Sized { } - -#[lang = "tuple_trait"] pub trait Tuple { } - -#[lang = "fn_once"] -#[rustc_paren_sugar] -pub trait FnOnce { - type Output; - - extern "rust-call" fn call_once(self, args: Args) -> Self::Output; -} - -pub fn abc() -> impl FnOnce(f32) { - |_| {} -} - -fn main() {} diff --git a/tests/ui/lang-items/lang-item-missing-generator.stderr b/tests/ui/lang-items/lang-item-missing-generator.stderr deleted file mode 100644 index a24fdb5fb..000000000 --- a/tests/ui/lang-items/lang-item-missing-generator.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0635]: unknown feature `tuple_trait` - --> $DIR/lang-item-missing-generator.rs:2:51 - | -LL | #![feature(no_core, lang_items, unboxed_closures, tuple_trait)] - | ^^^^^^^^^^^ - -error: requires `generator` lang_item - --> $DIR/lang-item-missing-generator.rs:17:17 - | -LL | pub fn abc() -> impl FnOnce(f32) { - | ^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0635`. diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.rs b/tests/ui/late-bound-lifetimes/mismatched_arg_count.rs index 0b331e203..792563fd8 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.rs +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.rs @@ -7,6 +7,6 @@ trait Trait<'a> { type Alias<'a, T> = >::Assoc; fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} -//~^ error: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied +//~^ error: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied fn main() {} diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index 3704d9bb9..de58a014e 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -1,4 +1,4 @@ -error[E0107]: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/mismatched_arg_count.rs:9:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} diff --git a/tests/ui/layout/valid_range_oob.stderr b/tests/ui/layout/valid_range_oob.stderr index 7398f0164..a3a514fb8 100644 --- a/tests/ui/layout/valid_range_oob.stderr +++ b/tests/ui/layout/valid_range_oob.stderr @@ -1,4 +1,4 @@ -error: internal compiler error: unexpected panic +error: the compiler unexpectedly panicked. this is a bug. query stack during panic: #0 [layout_of] computing layout of `Foo` diff --git a/tests/ui/let-else/accidental-if.rs b/tests/ui/let-else/accidental-if.rs new file mode 100644 index 000000000..3fba63043 --- /dev/null +++ b/tests/ui/let-else/accidental-if.rs @@ -0,0 +1,6 @@ +fn main() { + let x = Some(123); + if let Some(y) = x else { //~ ERROR this `if` expression is missing a block + return; + }; +} diff --git a/tests/ui/let-else/accidental-if.stderr b/tests/ui/let-else/accidental-if.stderr new file mode 100644 index 000000000..57e525917 --- /dev/null +++ b/tests/ui/let-else/accidental-if.stderr @@ -0,0 +1,19 @@ +error: this `if` expression is missing a block after the condition + --> $DIR/accidental-if.rs:3:5 + | +LL | if let Some(y) = x else { + | ^^ + | +help: add a block here + --> $DIR/accidental-if.rs:3:23 + | +LL | if let Some(y) = x else { + | ^ +help: remove the `if` if you meant to write a `let...else` statement + | +LL - if let Some(y) = x else { +LL + let Some(y) = x else { + | + +error: aborting due to previous error + diff --git a/tests/ui/let-else/issue-94176.stderr b/tests/ui/let-else/issue-94176.stderr index 0cb97acee..6a015aced 100644 --- a/tests/ui/let-else/issue-94176.stderr +++ b/tests/ui/let-else/issue-94176.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-94176.rs:5:32 | LL | pub fn test(a: Option) -> Option { - | ---- ^^^^^^^^^^^ expected enum `Option`, found `()` + | ---- ^^^^^^^^^^^ expected `Option`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/let-else/let-else-brace-before-else.fixed b/tests/ui/let-else/let-else-brace-before-else.fixed index a75c770dd..2d85e3878 100644 --- a/tests/ui/let-else/let-else-brace-before-else.fixed +++ b/tests/ui/let-else/let-else-brace-before-else.fixed @@ -7,10 +7,6 @@ fn main() { //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed return; }; - let Some(1) = (loop { break Some(1) }) else { - //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed - return; - }; let 2 = 1 + (match 1 { n => n }) else { //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed return; diff --git a/tests/ui/let-else/let-else-brace-before-else.rs b/tests/ui/let-else/let-else-brace-before-else.rs index 5603b946f..5c3375b3f 100644 --- a/tests/ui/let-else/let-else-brace-before-else.rs +++ b/tests/ui/let-else/let-else-brace-before-else.rs @@ -7,10 +7,6 @@ fn main() { //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed return; }; - let Some(1) = loop { break Some(1) } else { - //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed - return; - }; let 2 = 1 + match 1 { n => n } else { //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed return; diff --git a/tests/ui/let-else/let-else-brace-before-else.stderr b/tests/ui/let-else/let-else-brace-before-else.stderr index cb01e4c18..ee53213d8 100644 --- a/tests/ui/let-else/let-else-brace-before-else.stderr +++ b/tests/ui/let-else/let-else-brace-before-else.stderr @@ -10,18 +10,7 @@ LL | let Some(1) = ({ Some(1) }) else { | + + error: right curly brace `}` before `else` in a `let...else` statement not allowed - --> $DIR/let-else-brace-before-else.rs:10:40 - | -LL | let Some(1) = loop { break Some(1) } else { - | ^ - | -help: wrap the expression in parentheses - | -LL | let Some(1) = (loop { break Some(1) }) else { - | + + - -error: right curly brace `}` before `else` in a `let...else` statement not allowed - --> $DIR/let-else-brace-before-else.rs:14:34 + --> $DIR/let-else-brace-before-else.rs:10:34 | LL | let 2 = 1 + match 1 { n => n } else { | ^ @@ -32,7 +21,7 @@ LL | let 2 = 1 + (match 1 { n => n }) else { | + + error: right curly brace `}` before `else` in a `let...else` statement not allowed - --> $DIR/let-else-brace-before-else.rs:18:40 + --> $DIR/let-else-brace-before-else.rs:14:40 | LL | let Some(1) = unsafe { unsafe_fn() } else { | ^ @@ -42,5 +31,5 @@ help: wrap the expression in parentheses LL | let Some(1) = (unsafe { unsafe_fn() }) else { | + + -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index bf78a079c..143b838ba 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let Bar::Present(z) = self else { | ^^^^^^^^^^^^^^^ ---- this expression has type `&mut Foo` | | - | expected struct `Foo`, found enum `Bar` + | expected `Foo`, found `Bar` error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | let Bar(z) = x; | ^^^^^^ - this expression has type `&mut irrefutable::Foo` | | - | expected struct `Foo`, found struct `Bar` + | expected `Foo`, found `Bar` error: aborting due to 2 previous errors diff --git a/tests/ui/let-else/let-else-non-diverging.stderr b/tests/ui/let-else/let-else-non-diverging.stderr index 78551fcc4..661d905cd 100644 --- a/tests/ui/let-else/let-else-non-diverging.stderr +++ b/tests/ui/let-else/let-else-non-diverging.stderr @@ -5,7 +5,7 @@ LL | let Some(x) = Some(1) else { | ________________________________^ LL | | Some(2) LL | | }; - | |_____^ expected `!`, found enum `Option` + | |_____^ expected `!`, found `Option<{integer}>` | = note: expected type `!` found enum `Option<{integer}>` @@ -32,7 +32,7 @@ error[E0308]: `else` clause of `let...else` does not diverge --> $DIR/let-else-non-diverging.rs:10:32 | LL | let Some(x) = Some(1) else { Some(2) }; - | ^^^^^^^^^^^ expected `!`, found enum `Option` + | ^^^^^^^^^^^ expected `!`, found `Option<{integer}>` | = note: expected type `!` found enum `Option<{integer}>` @@ -43,7 +43,7 @@ error[E0308]: `else` clause of `let...else` does not diverge --> $DIR/let-else-non-diverging.rs:15:32 | LL | let Some(x) = Some(1) else { foo::() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found enum `Uninhabited` + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `Uninhabited` | = note: expected type `!` found enum `Uninhabited` diff --git a/tests/ui/let-else/let-else-ref-bindings.stderr b/tests/ui/let-else/let-else-ref-bindings.stderr index 56b9e0733..ada1805e7 100644 --- a/tests/ui/let-else/let-else-ref-bindings.stderr +++ b/tests/ui/let-else/let-else-ref-bindings.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:16:38 | LL | let Some(ref a): Option<&[u8]> = some else { return }; - | ^^^^ expected `&[u8]`, found struct `Vec` + | ^^^^ expected `Option<&[u8]>`, found `Option>` | = note: expected enum `Option<&[u8]>` found enum `Option>` @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:20:38 | LL | let Some(ref a): Option<&[u8]> = &some else { return }; - | ^^^^^ expected enum `Option`, found `&Option>` + | ^^^^^ expected `Option<&[u8]>`, found `&Option>` | = note: expected enum `Option<&[u8]>` found reference `&Option>` @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:24:34 | LL | let Some(a): Option<&[u8]> = some else { return }; - | ------------- ^^^^ expected `&[u8]`, found struct `Vec` + | ------------- ^^^^ expected `Option<&[u8]>`, found `Option>` | | | expected due to this | @@ -31,7 +31,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:27:34 | LL | let Some(a): Option<&[u8]> = &some else { return }; - | ------------- ^^^^^ expected enum `Option`, found `&Option>` + | ------------- ^^^^^ expected `Option<&[u8]>`, found `&Option>` | | | expected due to this | @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:44:46 | LL | let Some(ref mut a): Option<&mut [u8]> = some else { return }; - | ^^^^ expected `&mut [u8]`, found struct `Vec` + | ^^^^ expected `Option<&mut [u8]>`, found `Option>` | = note: expected enum `Option<&mut [u8]>` found enum `Option>` @@ -51,7 +51,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:48:46 | LL | let Some(ref mut a): Option<&mut [u8]> = &mut some else { return }; - | ^^^^^^^^^ expected enum `Option`, found mutable reference + | ^^^^^^^^^ expected `Option<&mut [u8]>`, found `&mut Option>` | = note: expected enum `Option<&mut [u8]>` found mutable reference `&mut Option>` @@ -60,7 +60,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:52:38 | LL | let Some(a): Option<&mut [u8]> = some else { return }; - | ----------------- ^^^^ expected `&mut [u8]`, found struct `Vec` + | ----------------- ^^^^ expected `Option<&mut [u8]>`, found `Option>` | | | expected due to this | @@ -71,7 +71,7 @@ error[E0308]: mismatched types --> $DIR/let-else-ref-bindings.rs:55:38 | LL | let Some(a): Option<&mut [u8]> = &mut some else { return }; - | ----------------- ^^^^^^^^^ expected enum `Option`, found mutable reference + | ----------------- ^^^^^^^^^ expected `Option<&mut [u8]>`, found `&mut Option>` | | | expected due to this | diff --git a/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.fixed b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.fixed new file mode 100644 index 000000000..aa3bce294 --- /dev/null +++ b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.fixed @@ -0,0 +1,45 @@ +// run-rustfix + +trait Greeter0 { + fn greet(&self); +} + +trait Greeter1 { + fn greet(&self); +} + +type BoxedGreeter<'a> = (Box, Box); +//~^ HELP to declare that the trait object captures data from argument `self`, you can add a lifetime parameter `'a` in the type alias + +struct FixedGreeter<'a>(pub &'a str); + +impl Greeter0 for FixedGreeter<'_> { + fn greet(&self) { + println!("0 {}", self.0) + } +} + +impl Greeter1 for FixedGreeter<'_> { + fn greet(&self) { + println!("1 {}", self.0) + } +} + +struct Greetings(pub Vec); + +impl Greetings { + pub fn get(&self, i: usize) -> BoxedGreeter { + (Box::new(FixedGreeter(&self.0[i])), Box::new(FixedGreeter(&self.0[i]))) + //~^ ERROR lifetime may not live long enough + } +} + +fn main() { + let mut g = Greetings {0 : vec!()}; + g.0.push("a".to_string()); + g.0.push("b".to_string()); + g.get(0).0.greet(); + g.get(0).1.greet(); + g.get(1).0.greet(); + g.get(1).1.greet(); +} diff --git a/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs new file mode 100644 index 000000000..20c88ec69 --- /dev/null +++ b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs @@ -0,0 +1,45 @@ +// run-rustfix + +trait Greeter0 { + fn greet(&self); +} + +trait Greeter1 { + fn greet(&self); +} + +type BoxedGreeter = (Box, Box); +//~^ HELP to declare that the trait object captures data from argument `self`, you can add a lifetime parameter `'a` in the type alias + +struct FixedGreeter<'a>(pub &'a str); + +impl Greeter0 for FixedGreeter<'_> { + fn greet(&self) { + println!("0 {}", self.0) + } +} + +impl Greeter1 for FixedGreeter<'_> { + fn greet(&self) { + println!("1 {}", self.0) + } +} + +struct Greetings(pub Vec); + +impl Greetings { + pub fn get(&self, i: usize) -> BoxedGreeter { + (Box::new(FixedGreeter(&self.0[i])), Box::new(FixedGreeter(&self.0[i]))) + //~^ ERROR lifetime may not live long enough + } +} + +fn main() { + let mut g = Greetings {0 : vec!()}; + g.0.push("a".to_string()); + g.0.push("b".to_string()); + g.get(0).0.greet(); + g.get(0).1.greet(); + g.get(1).0.greet(); + g.get(1).1.greet(); +} diff --git a/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.stderr b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.stderr new file mode 100644 index 000000000..808d8bb90 --- /dev/null +++ b/tests/ui/lifetimes/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.stderr @@ -0,0 +1,15 @@ +error: lifetime may not live long enough + --> $DIR/issue-103582-hint-for-missing-lifetime-bound-on-trait-object-using-type-alias.rs:32:9 + | +LL | pub fn get(&self, i: usize) -> BoxedGreeter { + | - let's call the lifetime of this reference `'1` +LL | (Box::new(FixedGreeter(&self.0[i])), Box::new(FixedGreeter(&self.0[i]))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` + | +help: to declare that the trait object captures data from argument `self`, you can add a lifetime parameter `'a` in the type alias + | +LL | type BoxedGreeter<'a> = (Box, Box); + | ++++ ++++ ++++ + +error: aborting due to previous error + diff --git a/tests/ui/lifetimes/issue-104432-unused-lifetimes-in-expansion.rs b/tests/ui/lifetimes/issue-104432-unused-lifetimes-in-expansion.rs new file mode 100644 index 000000000..5d5429ec8 --- /dev/null +++ b/tests/ui/lifetimes/issue-104432-unused-lifetimes-in-expansion.rs @@ -0,0 +1,12 @@ +// check-pass + +#![deny(unused_lifetimes)] +trait Trait2 { + type As; +} + +// we should not warn about an unused lifetime about code generated from this proc macro here +#[derive(Clone)] +struct ShimMethod4(pub &'static dyn for<'s> Fn(&'s mut T::As)); + +pub fn main() {} diff --git a/tests/ui/lifetimes/issue-105227.stderr b/tests/ui/lifetimes/issue-105227.stderr index d21145937..b514db461 100644 --- a/tests/ui/lifetimes/issue-105227.stderr +++ b/tests/ui/lifetimes/issue-105227.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime tha --> $DIR/issue-105227.rs:7:5 | LL | fn chars0(v :(& str, &str)) -> impl Iterator { - | ----- hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here + | ----- -------------------------- opaque type defined here + | | + | hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here LL | LL | v.0.chars().chain(v.1.chars()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +18,9 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime tha --> $DIR/issue-105227.rs:13:5 | LL | fn chars1(v0 : & str, v1 : &str) -> impl Iterator { - | ----- hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here + | ----- -------------------------- opaque type defined here + | | + | hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here LL | LL | v0.chars().chain(v1.chars()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +35,10 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime tha | LL | fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> | ---- hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here -... +LL | +LL | (impl Iterator, &'b str) + | -------------------------- opaque type defined here +LL | { LL | (v0.chars().chain(v1.chars()), v2) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.rs b/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.rs new file mode 100644 index 000000000..f129035d0 --- /dev/null +++ b/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.rs @@ -0,0 +1,6 @@ +pub struct DefaultLifetime<'a, 'b = 'static> { + //~^ ERROR unexpected default lifetime parameter + _marker: std::marker::PhantomData<&'a &'b ()>, +} + +fn main(){} diff --git a/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.stderr b/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.stderr new file mode 100644 index 000000000..c235c3180 --- /dev/null +++ b/tests/ui/lifetimes/issue-107492-default-value-for-lifetime.stderr @@ -0,0 +1,8 @@ +error: unexpected default lifetime parameter + --> $DIR/issue-107492-default-value-for-lifetime.rs:1:35 + | +LL | pub struct DefaultLifetime<'a, 'b = 'static> { + | ^^^^^^^^^ lifetime parameters cannot have default values + +error: aborting due to previous error + diff --git a/tests/ui/lifetimes/issue-107988.rs b/tests/ui/lifetimes/issue-107988.rs new file mode 100644 index 000000000..92cb60a06 --- /dev/null +++ b/tests/ui/lifetimes/issue-107988.rs @@ -0,0 +1,13 @@ +pub trait TraitEngine<'tcx>: 'tcx {} + +pub trait TraitEngineExt<'tcx> { + fn register_predicate_obligations(&mut self); +} + +impl> TraitEngineExt<'tcx> for T { + //~^ ERROR use of undeclared lifetime name `'tcx` + //~| ERROR use of undeclared lifetime name `'tcx` + fn register_predicate_obligations(&mut self) {} +} + +fn main() {} diff --git a/tests/ui/lifetimes/issue-107988.stderr b/tests/ui/lifetimes/issue-107988.stderr new file mode 100644 index 000000000..c2d8c7050 --- /dev/null +++ b/tests/ui/lifetimes/issue-107988.stderr @@ -0,0 +1,27 @@ +error[E0261]: use of undeclared lifetime name `'tcx` + --> $DIR/issue-107988.rs:7:52 + | +LL | impl> TraitEngineExt<'tcx> for T { + | - ^^^^ undeclared lifetime + | | + | help: consider introducing lifetime `'tcx` here: `'tcx,` + +error[E0261]: use of undeclared lifetime name `'tcx` + --> $DIR/issue-107988.rs:7:30 + | +LL | impl> TraitEngineExt<'tcx> for T { + | ^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'tcx` lifetime + | +LL | impl TraitEngine<'tcx>> TraitEngineExt<'tcx> for T { + | +++++++++ +help: consider introducing lifetime `'tcx` here + | +LL | impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T { + | +++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/lifetimes/issue-17728.stderr b/tests/ui/lifetimes/issue-17728.stderr index 3b25902d7..535073d6e 100644 --- a/tests/ui/lifetimes/issue-17728.stderr +++ b/tests/ui/lifetimes/issue-17728.stderr @@ -9,7 +9,7 @@ LL | | "n" | "north" => RoomDirection::North, LL | | "down" => RoomDirection::Down, | | ------------------- this and all prior arms are found to be of type `RoomDirection` LL | | _ => None - | | ^^^^ expected enum `RoomDirection`, found enum `Option` + | | ^^^^ expected `RoomDirection`, found `Option<_>` LL | | } | |_____- `match` arms have incompatible types | diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index 98d39d614..30afcecf8 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -38,11 +38,11 @@ error[E0308]: mismatched types --> $DIR/issue-26638.rs:1:69 | LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ---- ^^^^^^^^^^^ expected `&str`, found enum `Option` + | ---- ^^^^^^^^^^^ expected `&str`, found `Option<&str>` | | - | expected `&'static str` because of return type + | expected `&str` because of return type | - = note: expected reference `&'static str` + = note: expected reference `&str` found enum `Option<&str>` error[E0061]: this function takes 1 argument but 0 arguments were supplied @@ -60,7 +60,7 @@ error[E0308]: mismatched types --> $DIR/issue-26638.rs:5:47 | LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } - | ---- ^^^^^^ expected `str`, found `u8` + | ---- ^^^^^^ expected `&str`, found `&u8` | | | expected `&'static str` because of return type | diff --git a/tests/ui/lifetimes/issue-69314.fixed b/tests/ui/lifetimes/issue-69314.fixed new file mode 100644 index 000000000..41116d4ea --- /dev/null +++ b/tests/ui/lifetimes/issue-69314.fixed @@ -0,0 +1,22 @@ +// run-rustfix +// edition:2021 +#![allow(dead_code, unused_mut, unused_variables)] +struct A {} +struct Msg<'a> { + s: &'a [i32], +} +impl A { + async fn g(buf: &[i32]) -> Msg<'_> { + Msg { s: &buf[0..1] } + } + async fn f() { + let mut buf = [0; 512]; + let m2 = &buf[..]; //~ ERROR `buf` does not live long enough + let m = Self::g(m2).await; + Self::f2(m).await; + } + async fn f2(m: Msg<'_>) {} + //~^ ERROR implicit elided lifetime not allowed here +} + +fn main() {} diff --git a/tests/ui/lifetimes/issue-69314.rs b/tests/ui/lifetimes/issue-69314.rs new file mode 100644 index 000000000..17445341e --- /dev/null +++ b/tests/ui/lifetimes/issue-69314.rs @@ -0,0 +1,22 @@ +// run-rustfix +// edition:2021 +#![allow(dead_code, unused_mut, unused_variables)] +struct A {} +struct Msg<'a> { + s: &'a [i32], +} +impl A { + async fn g(buf: &[i32]) -> Msg<'_> { + Msg { s: &buf[0..1] } + } + async fn f() { + let mut buf = [0; 512]; + let m2 = &buf[..]; //~ ERROR `buf` does not live long enough + let m = Self::g(m2).await; + Self::f2(m).await; + } + async fn f2(m: Msg) {} + //~^ ERROR implicit elided lifetime not allowed here +} + +fn main() {} diff --git a/tests/ui/lifetimes/issue-69314.stderr b/tests/ui/lifetimes/issue-69314.stderr new file mode 100644 index 000000000..7ae678928 --- /dev/null +++ b/tests/ui/lifetimes/issue-69314.stderr @@ -0,0 +1,26 @@ +error[E0726]: implicit elided lifetime not allowed here + --> $DIR/issue-69314.rs:18:20 + | +LL | async fn f2(m: Msg) {} + | ^^^ expected lifetime parameter + | +help: indicate the anonymous lifetime + | +LL | async fn f2(m: Msg<'_>) {} + | ++++ + +error[E0597]: `buf` does not live long enough + --> $DIR/issue-69314.rs:14:19 + | +LL | let m2 = &buf[..]; + | ^^^ borrowed value does not live long enough +LL | let m = Self::g(m2).await; + | ----------- argument requires that `buf` is borrowed for `'static` +LL | Self::f2(m).await; +LL | } + | - `buf` dropped here while still borrowed + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0597, E0726. +For more information about an error, try `rustc --explain E0597`. diff --git a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr index 99e1e7217..3602de8dd 100644 --- a/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr +++ b/tests/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr @@ -1,6 +1,8 @@ error[E0597]: `foo` does not live long enough --> $DIR/issue-90600-expected-return-static-indirect.rs:7:32 | +LL | fn inner(mut foo: &[u8]) { + | ------- binding `foo` declared here LL | let refcell = RefCell::new(&mut foo); | ^^^^^^^^ borrowed value does not live long enough LL | diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index 4bcd7cf95..6fd7f67d1 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -7,7 +7,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | lifetime `'a` defined here LL | LL | x - | ^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` + | ^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 34a64f8a6..2687266e0 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -7,7 +7,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | lifetime `'a` defined here LL | LL | if true { x } else { self } - | ^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` + | ^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 5601335d2..9ff5e42d7 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &i32) -> &i32 { | | | let's call the lifetime of this reference `'2` LL | x - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index e221902c4..e4c855e11 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | | | let's call the lifetime of this reference `'2` LL | if true { x } else { self } - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/lifetimes/unusual-rib-combinations.rs b/tests/ui/lifetimes/unusual-rib-combinations.rs index b4c86aab8..1c122f42e 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.rs +++ b/tests/ui/lifetimes/unusual-rib-combinations.rs @@ -23,6 +23,6 @@ fn c() {} // Elided lifetime in path in ConstGeneric fn d() {} //~^ ERROR missing lifetime specifier -//~| ERROR `S<'static>` is forbidden as the type of a const generic parameter +//~| ERROR `S<'_>` is forbidden as the type of a const generic parameter fn main() {} diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index 6d7b42506..68f4fce01 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -46,7 +46,7 @@ LL | fn a() -> [u8; foo::()] { = note: expected type `usize` found fn item `fn() {foo}` -error: `S<'static>` is forbidden as the type of a const generic parameter +error: `S<'_>` is forbidden as the type of a const generic parameter --> $DIR/unusual-rib-combinations.rs:24:15 | LL | fn d() {} diff --git a/tests/ui/lint/dead-code/in-closure.rs b/tests/ui/lint/dead-code/in-closure.rs new file mode 100644 index 000000000..c55634405 --- /dev/null +++ b/tests/ui/lint/dead-code/in-closure.rs @@ -0,0 +1,16 @@ +// edition: 2021 + +#![deny(dead_code)] + +pub fn foo() { + let closure = || { + fn a() {} //~ ERROR function `a` is never used + }; + closure() +} + +pub async fn async_foo() { + const A: usize = 1; //~ ERROR constant `A` is never used +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/in-closure.stderr b/tests/ui/lint/dead-code/in-closure.stderr new file mode 100644 index 000000000..deb276be7 --- /dev/null +++ b/tests/ui/lint/dead-code/in-closure.stderr @@ -0,0 +1,20 @@ +error: function `a` is never used + --> $DIR/in-closure.rs:7:12 + | +LL | fn a() {} + | ^ + | +note: the lint level is defined here + --> $DIR/in-closure.rs:3:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: constant `A` is never used + --> $DIR/in-closure.rs:13:11 + | +LL | const A: usize = 1; + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/dead-code/issue-85255.rs b/tests/ui/lint/dead-code/issue-85255.rs index 043f68137..1978bd4e8 100644 --- a/tests/ui/lint/dead-code/issue-85255.rs +++ b/tests/ui/lint/dead-code/issue-85255.rs @@ -11,8 +11,8 @@ struct Foo { struct Bar; impl Bar { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used } pub(crate) struct Foo1 { @@ -23,8 +23,8 @@ pub(crate) struct Foo1 { pub(crate) struct Bar1; impl Bar1 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used } pub(crate) struct Foo2 { @@ -35,8 +35,8 @@ pub(crate) struct Foo2 { pub(crate) struct Bar2; impl Bar2 { - fn a(&self) -> i32 { 5 } //~ WARNING: associated function `a` is never used - pub fn b(&self) -> i32 { 6 } //~ WARNING: associated function `b` is never used + fn a(&self) -> i32 { 5 } //~ WARNING: method `a` is never used + pub fn b(&self) -> i32 { 6 } //~ WARNING: method `b` is never used } diff --git a/tests/ui/lint/dead-code/issue-85255.stderr b/tests/ui/lint/dead-code/issue-85255.stderr index 3497b952f..58a19cf3c 100644 --- a/tests/ui/lint/dead-code/issue-85255.stderr +++ b/tests/ui/lint/dead-code/issue-85255.stderr @@ -34,37 +34,37 @@ LL | a: i32, LL | pub b: i32, | ^ -warning: associated function `a` is never used +warning: method `a` is never used --> $DIR/issue-85255.rs:14:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function `b` is never used +warning: method `b` is never used --> $DIR/issue-85255.rs:15:12 | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: associated function `a` is never used +warning: method `a` is never used --> $DIR/issue-85255.rs:26:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function `b` is never used +warning: method `b` is never used --> $DIR/issue-85255.rs:27:12 | LL | pub fn b(&self) -> i32 { 6 } | ^ -warning: associated function `a` is never used +warning: method `a` is never used --> $DIR/issue-85255.rs:38:8 | LL | fn a(&self) -> i32 { 5 } | ^ -warning: associated function `b` is never used +warning: method `b` is never used --> $DIR/issue-85255.rs:39:12 | LL | pub fn b(&self) -> i32 { 6 } diff --git a/tests/ui/lint/dead-code/lint-dead-code-3.rs b/tests/ui/lint/dead-code/lint-dead-code-3.rs index 293fcdbc5..20b568054 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-3.rs +++ b/tests/ui/lint/dead-code/lint-dead-code-3.rs @@ -13,7 +13,7 @@ extern "C" { struct Foo; //~ ERROR: struct `Foo` is never constructed impl Foo { - fn foo(&self) { //~ ERROR: associated function `foo` is never used + fn foo(&self) { //~ ERROR: method `foo` is never used bar() } } diff --git a/tests/ui/lint/dead-code/lint-dead-code-3.stderr b/tests/ui/lint/dead-code/lint-dead-code-3.stderr index 26fc13bae..797b7559c 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/tests/ui/lint/dead-code/lint-dead-code-3.stderr @@ -34,7 +34,7 @@ error: function `blah` is never used LL | fn blah() {} | ^^^^ -error: associated function `foo` is never used +error: method `foo` is never used --> $DIR/lint-dead-code-3.rs:16:8 | LL | fn foo(&self) { diff --git a/tests/ui/lint/invalid_value-polymorphic.rs b/tests/ui/lint/invalid_value-polymorphic.rs new file mode 100644 index 000000000..055173e98 --- /dev/null +++ b/tests/ui/lint/invalid_value-polymorphic.rs @@ -0,0 +1,8 @@ +// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstCombine +// build-pass + +#![feature(core_intrinsics)] + +pub fn generic() { + core::intrinsics::assert_mem_uninitialized_valid::<&T>(); +} diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr index 48fd4169d..57531b096 100644 --- a/tests/ui/lint/invalid_value.stderr +++ b/tests/ui/lint/invalid_value.stderr @@ -61,10 +61,7 @@ error: the type `!` does not permit zero-initialization --> $DIR/invalid_value.rs:65:23 | LL | let _val: ! = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: the `!` type has no valid value @@ -72,10 +69,7 @@ error: the type `!` does not permit being left uninitialized --> $DIR/invalid_value.rs:66:23 | LL | let _val: ! = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: the `!` type has no valid value @@ -83,10 +77,7 @@ error: the type `(i32, !)` does not permit zero-initialization --> $DIR/invalid_value.rs:68:30 | LL | let _val: (i32, !) = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: the `!` type has no valid value @@ -94,10 +85,7 @@ error: the type `(i32, !)` does not permit being left uninitialized --> $DIR/invalid_value.rs:69:30 | LL | let _val: (i32, !) = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | = note: integers must be initialized @@ -105,10 +93,7 @@ error: the type `Void` does not permit zero-initialization --> $DIR/invalid_value.rs:71:26 | LL | let _val: Void = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/invalid_value.rs:12:1 @@ -120,10 +105,7 @@ error: the type `Void` does not permit being left uninitialized --> $DIR/invalid_value.rs:72:26 | LL | let _val: Void = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/invalid_value.rs:12:1 @@ -405,10 +387,7 @@ error: the type `TwoUninhabited` does not permit zero-initialization --> $DIR/invalid_value.rs:104:36 | LL | let _val: TwoUninhabited = mem::zeroed(); - | ^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/invalid_value.rs:42:1 @@ -420,10 +399,7 @@ error: the type `TwoUninhabited` does not permit being left uninitialized --> $DIR/invalid_value.rs:105:36 | LL | let _val: TwoUninhabited = mem::uninitialized(); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/invalid_value.rs:42:1 diff --git a/tests/ui/lint/issue-104897.rs b/tests/ui/lint/issue-104897.rs index 5fbc658f1..2d298aff9 100644 --- a/tests/ui/lint/issue-104897.rs +++ b/tests/ui/lint/issue-104897.rs @@ -1,6 +1,5 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter -// error-pattern: format argument must be a string literal fn f(){(print!(á diff --git a/tests/ui/lint/issue-104897.stderr b/tests/ui/lint/issue-104897.stderr index 817a93c2f..728d51f34 100644 --- a/tests/ui/lint/issue-104897.stderr +++ b/tests/ui/lint/issue-104897.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-104897.rs:6:18 + --> $DIR/issue-104897.rs:5:18 | LL | fn f(){(print!(á | -- - ^ @@ -8,36 +8,5 @@ LL | fn f(){(print!(á | |unclosed delimiter | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-104897.rs:6:18 - | -LL | fn f(){(print!(á - | -- - ^ - | || | - | || unclosed delimiter - | |unclosed delimiter - | unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-104897.rs:6:18 - | -LL | fn f(){(print!(á - | -- - ^ - | || | - | || unclosed delimiter - | |unclosed delimiter - | unclosed delimiter - -error: format argument must be a string literal - --> $DIR/issue-104897.rs:6:16 - | -LL | fn f(){(print!(á - | ^ - | -help: you might be missing a string literal to format with - | -LL | fn f(){(print!("{}", á - | +++++ - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/lint/issue-106991.rs b/tests/ui/lint/issue-106991.rs new file mode 100644 index 000000000..e4d7f765b --- /dev/null +++ b/tests/ui/lint/issue-106991.rs @@ -0,0 +1,13 @@ +fn foo(items: &mut Vec) { + items.sort(); +} + +fn bar() -> impl Iterator { + //~^ ERROR expected `foo` to be a fn item that returns `i32`, but it returns `()` [E0271] + let mut x: Vec> = vec![vec![0, 2, 1], vec![5, 4, 3]]; + x.iter_mut().map(foo) +} + +fn main() { + bar(); +} diff --git a/tests/ui/lint/issue-106991.stderr b/tests/ui/lint/issue-106991.stderr new file mode 100644 index 000000000..7b43f0b2c --- /dev/null +++ b/tests/ui/lint/issue-106991.stderr @@ -0,0 +1,11 @@ +error[E0271]: expected `foo` to be a fn item that returns `i32`, but it returns `()` + --> $DIR/issue-106991.rs:5:13 + | +LL | fn bar() -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `i32` + | + = note: required for `Map>, for<'a> fn(&'a mut Vec) {foo}>` to implement `Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/lint/lint-missing-doc.rs b/tests/ui/lint/lint-missing-doc.rs index 229725791..4a234d265 100644 --- a/tests/ui/lint/lint-missing-doc.rs +++ b/tests/ui/lint/lint-missing-doc.rs @@ -50,8 +50,10 @@ trait B { } pub trait C { //~ ERROR: missing documentation for a trait - fn foo(&self); //~ ERROR: missing documentation for an associated function - fn foo_with_impl(&self) {} //~ ERROR: missing documentation for an associated function + fn foo(&self); //~ ERROR: missing documentation for a method + fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a method + fn foo_no_self(); //~ ERROR: missing documentation for an associated function + fn foo_no_self_with_impl() {} //~ ERROR: missing documentation for an associated function } #[allow(missing_docs)] diff --git a/tests/ui/lint/lint-missing-doc.stderr b/tests/ui/lint/lint-missing-doc.stderr index d68472d4b..733d062a0 100644 --- a/tests/ui/lint/lint-missing-doc.stderr +++ b/tests/ui/lint/lint-missing-doc.stderr @@ -40,101 +40,113 @@ error: missing documentation for a trait LL | pub trait C { | ^^^^^^^^^^^ -error: missing documentation for an associated function +error: missing documentation for a method --> $DIR/lint-missing-doc.rs:53:5 | LL | fn foo(&self); | ^^^^^^^^^^^^^^ -error: missing documentation for an associated function +error: missing documentation for a method --> $DIR/lint-missing-doc.rs:54:5 | LL | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ +error: missing documentation for an associated function + --> $DIR/lint-missing-doc.rs:55:5 + | +LL | fn foo_no_self(); + | ^^^^^^^^^^^^^^^^^ + +error: missing documentation for an associated function + --> $DIR/lint-missing-doc.rs:56:5 + | +LL | fn foo_no_self_with_impl() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: missing documentation for an associated type - --> $DIR/lint-missing-doc.rs:64:5 + --> $DIR/lint-missing-doc.rs:66:5 | LL | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/lint-missing-doc.rs:65:5 + --> $DIR/lint-missing-doc.rs:67:5 | LL | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated function - --> $DIR/lint-missing-doc.rs:81:5 + --> $DIR/lint-missing-doc.rs:83:5 | LL | pub fn foo() {} | ^^^^^^^^^^^^ error: missing documentation for an enum - --> $DIR/lint-missing-doc.rs:118:1 + --> $DIR/lint-missing-doc.rs:120:1 | LL | pub enum PubBaz { | ^^^^^^^^^^^^^^^ error: missing documentation for a variant - --> $DIR/lint-missing-doc.rs:119:5 + --> $DIR/lint-missing-doc.rs:121:5 | LL | PubBazA { | ^^^^^^^ error: missing documentation for a struct field - --> $DIR/lint-missing-doc.rs:120:9 + --> $DIR/lint-missing-doc.rs:122:9 | LL | a: isize, | ^^^^^^^^ error: missing documentation for a constant - --> $DIR/lint-missing-doc.rs:151:1 + --> $DIR/lint-missing-doc.rs:153:1 | LL | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/lint-missing-doc.rs:161:1 + --> $DIR/lint-missing-doc.rs:163:1 | LL | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:167:5 + --> $DIR/lint-missing-doc.rs:169:5 | LL | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:168:5 + --> $DIR/lint-missing-doc.rs:170:5 | LL | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:174:9 + --> $DIR/lint-missing-doc.rs:176:9 | LL | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:189:5 + --> $DIR/lint-missing-doc.rs:191:5 | LL | pub fn extern_fn_undocumented(f: f32) -> f32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/lint-missing-doc.rs:194:5 + --> $DIR/lint-missing-doc.rs:196:5 | LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a foreign type - --> $DIR/lint-missing-doc.rs:199:5 + --> $DIR/lint-missing-doc.rs:201:5 | LL | pub type ExternTyUndocumented; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 22 previous errors +error: aborting due to 24 previous errors diff --git a/tests/ui/lint/lint-stability-deprecated.rs b/tests/ui/lint/lint-stability-deprecated.rs index 74c35083e..a56a37228 100644 --- a/tests/ui/lint/lint-stability-deprecated.rs +++ b/tests/ui/lint/lint-stability-deprecated.rs @@ -22,40 +22,40 @@ mod cross_crate { let foo = MethodTester; deprecated(); //~ WARN use of deprecated function `lint_stability::deprecated` - foo.method_deprecated(); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated` - Foo::method_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated` - ::method_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated` - foo.trait_deprecated(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` + foo.method_deprecated(); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated` + Foo::method_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated` + ::method_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated` + foo.trait_deprecated(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` deprecated_text(); //~ WARN use of deprecated function `lint_stability::deprecated_text`: text - foo.method_deprecated_text(); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text - Foo::method_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text - ::method_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text + foo.method_deprecated_text(); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text + Foo::method_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text + ::method_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text + foo.trait_deprecated_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text deprecated_unstable(); //~ WARN use of deprecated function `lint_stability::deprecated_unstable` - foo.method_deprecated_unstable(); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable` - Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable` - ::method_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable` - foo.trait_deprecated_unstable(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` + foo.method_deprecated_unstable(); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable` + Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable` + ::method_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable` + foo.trait_deprecated_unstable(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` deprecated_unstable_text(); //~ WARN use of deprecated function `lint_stability::deprecated_unstable_text`: text - foo.method_deprecated_unstable_text(); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text - Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text - ::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text - foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text + foo.method_deprecated_unstable_text(); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text + Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text + ::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text + foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text unstable(); foo.method_unstable(); @@ -141,22 +141,22 @@ mod cross_crate { } fn test_method_param(foo: Foo) { - foo.trait_deprecated(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - foo.trait_deprecated_unstable(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text - ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text + foo.trait_deprecated(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + foo.trait_deprecated_unstable(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text + ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text foo.trait_unstable(); Trait::trait_unstable(&foo); ::trait_unstable(&foo); @@ -172,10 +172,10 @@ mod cross_crate { } fn test_method_object(foo: &dyn Trait) { - foo.trait_deprecated(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text - foo.trait_deprecated_unstable(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable` - foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text + foo.trait_deprecated(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text + foo.trait_deprecated_unstable(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable` + foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text foo.trait_unstable(); foo.trait_unstable_text(); foo.trait_stable(); @@ -328,22 +328,22 @@ mod this_crate { let foo = MethodTester; deprecated(); //~ WARN use of deprecated function `this_crate::deprecated` - foo.method_deprecated(); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated` - Foo::method_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated` - ::method_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated` - foo.trait_deprecated(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` + foo.method_deprecated(); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated` + Foo::method_deprecated(&foo); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated` + ::method_deprecated(&foo); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated` + foo.trait_deprecated(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` deprecated_text(); //~ WARN use of deprecated function `this_crate::deprecated_text`: text - foo.method_deprecated_text(); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - Foo::method_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - ::method_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.method_deprecated_text(); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + Foo::method_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + ::method_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text + foo.trait_deprecated_text(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text unstable(); foo.method_unstable(); @@ -402,14 +402,14 @@ mod this_crate { } fn test_method_param(foo: Foo) { - foo.trait_deprecated(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - Trait::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - ::trait_deprecated(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - ::trait_deprecated_text(&foo); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + Trait::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + ::trait_deprecated(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text + ::trait_deprecated_text(&foo); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text foo.trait_unstable(); Trait::trait_unstable(&foo); ::trait_unstable(&foo); @@ -425,8 +425,8 @@ mod this_crate { } fn test_method_object(foo: &dyn Trait) { - foo.trait_deprecated(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated` - foo.trait_deprecated_text(); //~ WARN use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text + foo.trait_deprecated(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated` + foo.trait_deprecated_text(); //~ WARN use of deprecated method `this_crate::Trait::trait_deprecated_text`: text foo.trait_unstable(); foo.trait_unstable_text(); foo.trait_stable(); diff --git a/tests/ui/lint/lint-stability-deprecated.stderr b/tests/ui/lint/lint-stability-deprecated.stderr index 9f1e7b281..19a4649e1 100644 --- a/tests/ui/lint/lint-stability-deprecated.stderr +++ b/tests/ui/lint/lint-stability-deprecated.stderr @@ -10,13 +10,13 @@ note: the lint level is defined here LL | #![warn(deprecated)] | ^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:29:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:31:25 | LL | ::trait_deprecated(&foo); @@ -28,17 +28,17 @@ warning: use of deprecated function `lint_stability::deprecated_text`: text LL | deprecated_text(); | ^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:38:16 | -LL | ... Trait::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:40:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated function `lint_stability::deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:42:9 @@ -46,13 +46,13 @@ warning: use of deprecated function `lint_stability::deprecated_unstable`: text LL | deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:47:16 | -LL | ... Trait::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_unstable(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:49:25 | LL | ... ::trait_deprecated_unstable(&foo); @@ -64,13 +64,13 @@ warning: use of deprecated function `lint_stability::deprecated_unstable_text`: LL | deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:56:16 | LL | ... Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:58:25 | LL | ... ::trait_deprecated_unstable_text(&foo); @@ -142,49 +142,49 @@ warning: use of deprecated function `lint_stability::deprecated_text`: text LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:145:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:147:25 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:149:16 | -LL | ... Trait::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:151:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:153:16 | -LL | ... Trait::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Trait::trait_deprecated_unstable(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:155:25 | LL | ... ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:157:16 | LL | ... Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:159:25 | LL | ... ::trait_deprecated_unstable_text(&foo); @@ -214,13 +214,13 @@ warning: use of deprecated function `this_crate::deprecated`: text LL | deprecated(); | ^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:335:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:337:25 | LL | ::trait_deprecated(&foo); @@ -232,17 +232,17 @@ warning: use of deprecated function `this_crate::deprecated_text`: text LL | deprecated_text(); | ^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:344:16 | LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:346:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated struct `this_crate::DeprecatedStruct`: text --> $DIR/lint-stability-deprecated.rs:384:17 @@ -268,29 +268,29 @@ warning: use of deprecated tuple struct `this_crate::DeprecatedTupleStruct`: tex LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:406:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:408:25 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:410:16 | LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:412:25 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated function `this_crate::test_fn_body::fn_in_body`: text --> $DIR/lint-stability-deprecated.rs:439:9 @@ -328,121 +328,121 @@ warning: use of deprecated associated type `lint_stability::TraitWithAssociatedT LL | TypeDeprecated = u16, | ^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:25:13 | LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:26:14 | LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:27:16 | LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:28:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:30:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:34:13 | -LL | ... foo.method_deprecated_text(); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | foo.method_deprecated_text(); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:35:14 | -LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Foo::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:36:16 | -LL | ... ::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | ::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:37:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:39:16 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:43:13 | -LL | ... foo.method_deprecated_unstable(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo.method_deprecated_unstable(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:44:14 | -LL | ... Foo::method_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Foo::method_deprecated_unstable(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:45:16 | LL | ... ::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:46:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:48:16 | -LL | ... ::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_unstable(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:52:13 | LL | ... foo.method_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:53:14 | LL | ... Foo::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::MethodTester::method_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::MethodTester::method_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:54:16 | LL | ... ::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:55:13 | LL | ... foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:57:16 | LL | ... ::trait_deprecated_unstable_text(&foo); @@ -460,133 +460,133 @@ warning: use of deprecated field `lint_stability::DeprecatedUnstableStruct::i`: LL | i: 0 | ^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:144:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:146:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:148:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:150:16 | -LL | ... ::trait_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:152:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:154:16 | -LL | ... ::trait_deprecated_unstable(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | ::trait_deprecated_unstable(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:156:13 | LL | ... foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:158:16 | LL | ... ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:175:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:176:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable`: text --> $DIR/lint-stability-deprecated.rs:177:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `lint_stability::Trait::trait_deprecated_unstable_text`: text +warning: use of deprecated method `lint_stability::Trait::trait_deprecated_unstable_text`: text --> $DIR/lint-stability-deprecated.rs:178:13 | LL | ... foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:331:13 | LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:332:14 | LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated`: text --> $DIR/lint-stability-deprecated.rs:333:16 | LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:334:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:336:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:340:13 | -LL | ... foo.method_deprecated_text(); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | foo.method_deprecated_text(); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:341:14 | -LL | ... Foo::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Foo::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::MethodTester::method_deprecated_text`: text +warning: use of deprecated method `this_crate::MethodTester::method_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:342:16 | -LL | ... ::method_deprecated_text(&foo); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | ::method_deprecated_text(&foo); + | ^^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:343:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:345:16 | LL | ::trait_deprecated_text(&foo); @@ -598,37 +598,37 @@ warning: use of deprecated field `this_crate::DeprecatedStruct::i`: text LL | i: 0 | ^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:405:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:407:16 | LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:409:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:411:16 | LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated`: text --> $DIR/lint-stability-deprecated.rs:428:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ -warning: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text +warning: use of deprecated method `this_crate::Trait::trait_deprecated_text`: text --> $DIR/lint-stability-deprecated.rs:429:13 | LL | foo.trait_deprecated_text(); diff --git a/tests/ui/lint/lint_map_unit_fn.rs b/tests/ui/lint/lint_map_unit_fn.rs new file mode 100644 index 000000000..dc1ecbf84 --- /dev/null +++ b/tests/ui/lint/lint_map_unit_fn.rs @@ -0,0 +1,20 @@ +#![deny(map_unit_fn)] + +fn foo(items: &mut Vec) { + items.sort(); +} + +fn main() { + let mut x: Vec> = vec![vec![0, 2, 1], vec![5, 4, 3]]; + x.iter_mut().map(foo); + //~^ ERROR `Iterator::map` call that discard the iterator's values + x.iter_mut().map(|items| { + //~^ ERROR `Iterator::map` call that discard the iterator's values + items.sort(); + }); + let f = |items: &mut Vec| { + items.sort(); + }; + x.iter_mut().map(f); + //~^ ERROR `Iterator::map` call that discard the iterator's values +} diff --git a/tests/ui/lint/lint_map_unit_fn.stderr b/tests/ui/lint/lint_map_unit_fn.stderr new file mode 100644 index 000000000..fbf689c54 --- /dev/null +++ b/tests/ui/lint/lint_map_unit_fn.stderr @@ -0,0 +1,66 @@ +error: `Iterator::map` call that discard the iterator's values + --> $DIR/lint_map_unit_fn.rs:9:18 + | +LL | fn foo(items: &mut Vec) { + | --------------------------- this function returns `()`, which is likely not what you wanted +... +LL | x.iter_mut().map(foo); + | ^^^^---^ + | | | + | | called `Iterator::map` with callable that returns `()` + | after this call to map, the resulting iterator is `impl Iterator`, which means the only information carried by the iterator is the number of items + | + = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated +note: the lint level is defined here + --> $DIR/lint_map_unit_fn.rs:1:9 + | +LL | #![deny(map_unit_fn)] + | ^^^^^^^^^^^ +help: you might have meant to use `Iterator::for_each` + | +LL | x.iter_mut().for_each(foo); + | ~~~~~~~~ + +error: `Iterator::map` call that discard the iterator's values + --> $DIR/lint_map_unit_fn.rs:11:18 + | +LL | x.iter_mut().map(|items| { + | ^ ------- + | | | + | ____________________|___this function returns `()`, which is likely not what you wanted + | | __________________| + | | | +LL | | | +LL | | | items.sort(); +LL | | | }); + | | | -^ after this call to map, the resulting iterator is `impl Iterator`, which means the only information carried by the iterator is the number of items + | | |_____|| + | |_______| + | called `Iterator::map` with callable that returns `()` + | + = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated +help: you might have meant to use `Iterator::for_each` + | +LL | x.iter_mut().for_each(|items| { + | ~~~~~~~~ + +error: `Iterator::map` call that discard the iterator's values + --> $DIR/lint_map_unit_fn.rs:18:18 + | +LL | let f = |items: &mut Vec| { + | --------------------- this function returns `()`, which is likely not what you wanted +... +LL | x.iter_mut().map(f); + | ^^^^-^ + | | | + | | called `Iterator::map` with callable that returns `()` + | after this call to map, the resulting iterator is `impl Iterator`, which means the only information carried by the iterator is the number of items + | + = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated +help: you might have meant to use `Iterator::for_each` + | +LL | x.iter_mut().for_each(f); + | ~~~~~~~~ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr new file mode 100644 index 000000000..262657da5 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr @@ -0,0 +1,21 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +LL | wheeee(&no).await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr new file mode 100644 index 000000000..262657da5 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr @@ -0,0 +1,21 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +LL | wheeee(&no).await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr new file mode 100644 index 000000000..7ed43d257 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr @@ -0,0 +1,33 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +LL | wheeee(&no).await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:20:13 + | +LL | wheeee(&no).await; + | ^^ ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/dedup.rs:20:13 + | +LL | wheeee(&no).await; + | ^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/dedup.rs b/tests/ui/lint/must_not_suspend/dedup.rs index 81a08579b..96bdb7715 100644 --- a/tests/ui/lint/must_not_suspend/dedup.rs +++ b/tests/ui/lint/must_not_suspend/dedup.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -13,7 +16,9 @@ async fn wheeee(t: T) { } async fn yes() { - wheeee(&No {}).await; //~ ERROR `No` held across + let no = No {}; //~ ERROR `No` held across + wheeee(&no).await; //[no_drop_tracking]~ ERROR `No` held across + drop(no); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/dedup.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr index f8978ba57..18880f5a7 100644 --- a/tests/ui/lint/must_not_suspend/dedup.stderr +++ b/tests/ui/lint/must_not_suspend/dedup.stderr @@ -1,16 +1,16 @@ error: `No` held across a suspend point, but should not be - --> $DIR/dedup.rs:16:13 + --> $DIR/dedup.rs:19:13 | LL | wheeee(&No {}).await; | ^^^^^ ------ the value is held across this suspend point | help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/dedup.rs:16:13 + --> $DIR/dedup.rs:19:13 | LL | wheeee(&No {}).await; | ^^^^^ note: the lint level is defined here - --> $DIR/dedup.rs:3:9 + --> $DIR/dedup.rs:6:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr index abf76711b..e3628ca5e 100644 --- a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr +++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr @@ -1,5 +1,5 @@ error: reference to `Umm` held across a suspend point, but should not be - --> $DIR/ref.rs:21:13 + --> $DIR/ref.rs:22:13 | LL | let guard = &mut self.u; | ^^^^^ @@ -8,17 +8,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:21:13 + --> $DIR/ref.rs:22:13 | LL | let guard = &mut self.u; | ^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/ref.rs:21:13 + --> $DIR/ref.rs:22:13 | LL | let guard = &mut self.u; | ^^^^^ note: the lint level is defined here - --> $DIR/ref.rs:6:9 + --> $DIR/ref.rs:7:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr new file mode 100644 index 000000000..e3628ca5e --- /dev/null +++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr @@ -0,0 +1,27 @@ +error: reference to `Umm` held across a suspend point, but should not be + --> $DIR/ref.rs:22:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/ref.rs:22:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/ref.rs:22:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:7:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr index 41ac09ea7..e9bfa08b5 100644 --- a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr +++ b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr @@ -1,5 +1,5 @@ error: `Umm` held across a suspend point, but should not be - --> $DIR/ref.rs:21:26 + --> $DIR/ref.rs:22:26 | LL | let guard = &mut self.u; | ^^^^^^ @@ -8,17 +8,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:21:26 + --> $DIR/ref.rs:22:26 | LL | let guard = &mut self.u; | ^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/ref.rs:21:26 + --> $DIR/ref.rs:22:26 | LL | let guard = &mut self.u; | ^^^^^^ note: the lint level is defined here - --> $DIR/ref.rs:6:9 + --> $DIR/ref.rs:7:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.rs b/tests/ui/lint/must_not_suspend/ref.rs index f6b23746f..d05dcb83a 100644 --- a/tests/ui/lint/must_not_suspend/ref.rs +++ b/tests/ui/lint/must_not_suspend/ref.rs @@ -1,7 +1,8 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -22,6 +23,7 @@ impl Bar { other().await; + let _g = &*guard; *guard = Umm { i: 2 } } } diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.rs b/tests/ui/lint/must_not_suspend/trait.rs index 6c911cb4b..cc3ae298d 100644 --- a/tests/ui/lint/must_not_suspend/trait.rs +++ b/tests/ui/lint/must_not_suspend/trait.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -22,6 +25,9 @@ pub async fn uhoh() { let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across other().await; + + drop(_guard1); + drop(_guard2); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/trait.stderr b/tests/ui/lint/must_not_suspend/trait.stderr index d64d25aae..6e62a228a 100644 --- a/tests/ui/lint/must_not_suspend/trait.stderr +++ b/tests/ui/lint/must_not_suspend/trait.stderr @@ -1,5 +1,5 @@ error: implementer of `Wow` held across a suspend point, but should not be - --> $DIR/trait.rs:21:9 + --> $DIR/trait.rs:24:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ @@ -8,18 +8,18 @@ LL | other().await; | ------ the value is held across this suspend point | help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/trait.rs:21:9 + --> $DIR/trait.rs:24:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ note: the lint level is defined here - --> $DIR/trait.rs:3:9 + --> $DIR/trait.rs:6:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ error: boxed `Wow` trait object held across a suspend point, but should not be - --> $DIR/trait.rs:22:9 + --> $DIR/trait.rs:25:9 | LL | let _guard2 = r#dyn(); | ^^^^^^^ @@ -28,7 +28,7 @@ LL | other().await; | ------ the value is held across this suspend point | help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/trait.rs:22:9 + --> $DIR/trait.rs:25:9 | LL | let _guard2 = r#dyn(); | ^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr b/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr index cca8cd9bd..294476107 100644 --- a/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr +++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/tuple-mismatch.rs:6:20 | LL | yield ((), ()); - | ^^ expected tuple, found `()` + | ^^ expected `((), ())`, found `()` | = note: expected tuple `((), ())` found unit type `()` diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.rs b/tests/ui/lint/must_not_suspend/unit.rs index d3a19f704..fbc51b366 100644 --- a/tests/ui/lint/must_not_suspend/unit.rs +++ b/tests/ui/lint/must_not_suspend/unit.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -7,7 +10,6 @@ struct Umm { i: i64 } - fn bar() -> Umm { Umm { i: 1 @@ -19,6 +21,7 @@ async fn other() {} pub async fn uhoh() { let _guard = bar(); //~ ERROR `Umm` held across other().await; + drop(_guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/unit.stderr b/tests/ui/lint/must_not_suspend/unit.stderr index c967dbac5..50ca292c2 100644 --- a/tests/ui/lint/must_not_suspend/unit.stderr +++ b/tests/ui/lint/must_not_suspend/unit.stderr @@ -1,5 +1,5 @@ error: `Umm` held across a suspend point, but should not be - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ @@ -7,17 +7,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ note: the lint level is defined here - --> $DIR/unit.rs:3:9 + --> $DIR/unit.rs:6:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.rs b/tests/ui/lint/must_not_suspend/warn.rs index 7fdea66a2..5a4863169 100644 --- a/tests/ui/lint/must_not_suspend/warn.rs +++ b/tests/ui/lint/must_not_suspend/warn.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 // run-pass #![feature(must_not_suspend)] @@ -20,6 +23,7 @@ async fn other() {} pub async fn uhoh() { let _guard = bar(); //~ WARNING `Umm` held across other().await; + drop(_guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/warn.stderr b/tests/ui/lint/must_not_suspend/warn.stderr index fe551c652..7a422891a 100644 --- a/tests/ui/lint/must_not_suspend/warn.stderr +++ b/tests/ui/lint/must_not_suspend/warn.stderr @@ -1,5 +1,5 @@ warning: `Umm` held across a suspend point, but should not be - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ @@ -7,17 +7,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ note: the lint level is defined here - --> $DIR/warn.rs:4:9 + --> $DIR/warn.rs:7:9 | LL | #![warn(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/reasons-forbidden.rs b/tests/ui/lint/reasons-forbidden.rs index 9c2edec4d..947099fdd 100644 --- a/tests/ui/lint/reasons-forbidden.rs +++ b/tests/ui/lint/reasons-forbidden.rs @@ -8,7 +8,7 @@ // // The test is much cleaner if we deduplicate, though. -// compile-flags: -Z deduplicate-diagnostics=yes +// compile-flags: -Z deduplicate-diagnostics=true #![forbid( unsafe_code, diff --git a/tests/ui/lint/unaligned_references.rs b/tests/ui/lint/unaligned_references.rs index e547f031a..0c9c79c08 100644 --- a/tests/ui/lint/unaligned_references.rs +++ b/tests/ui/lint/unaligned_references.rs @@ -1,5 +1,3 @@ -#![deny(unaligned_references)] - #[repr(packed)] pub struct Good { data: u64, @@ -15,25 +13,33 @@ pub struct Packed2 { z: u8, } +trait Foo { + fn evil(&self); +} + +// Test for #108122 +#[automatically_derived] +impl Foo for Packed2 { + fn evil(&self) { + unsafe { + &self.x; //~ ERROR reference to packed field + } + } +} + fn main() { unsafe { let good = Good { data: 0, ptr: &0, data2: [0, 0], aligned: [0; 32] }; let _ = &good.ptr; //~ ERROR reference to packed field - //~^ previously accepted let _ = &good.data; //~ ERROR reference to packed field - //~^ previously accepted // Error even when turned into raw pointer immediately. let _ = &good.data as *const _; //~ ERROR reference to packed field - //~^ previously accepted let _: *const _ = &good.data; //~ ERROR reference to packed field - //~^ previously accepted // Error on method call. let _ = good.data.clone(); //~ ERROR reference to packed field - //~^ previously accepted // Error for nested fields. let _ = &good.data2[0]; //~ ERROR reference to packed field - //~^ previously accepted let _ = &*good.ptr; // ok, behind a pointer let _ = &good.aligned; // ok, has align 1 @@ -43,9 +49,9 @@ fn main() { unsafe { let packed2 = Packed2 { x: 0, y: 0, z: 0 }; let _ = &packed2.x; //~ ERROR reference to packed field - //~^ previously accepted let _ = &packed2.y; // ok, has align 2 in packed(2) struct let _ = &packed2.z; // ok, has align 1 + packed2.evil(); } unsafe { @@ -80,24 +86,10 @@ fn main() { #[repr(packed)] struct Misalign(u8, T); - let m1 = Misalign( - 0, - Wrapper { - a: U16(10), - b: HasDrop, - }, - ); + let m1 = Misalign(0, Wrapper { a: U16(10), b: HasDrop }); let _ref = &m1.1.a; //~ ERROR reference to packed field - //~^ previously accepted - let m2 = Misalign( - 0, - Wrapper2 { - a: U16(10), - b: HasDrop, - }, - ); + let m2 = Misalign(0, Wrapper2 { a: U16(10), b: HasDrop }); let _ref = &m2.1.a; //~ ERROR reference to packed field - //~^ previously accepted } } diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr index 346f49b92..775dcac67 100644 --- a/tests/ui/lint/unaligned_references.stderr +++ b/tests/ui/lint/unaligned_references.stderr @@ -1,259 +1,93 @@ -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:22:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:25:13 | -LL | let _ = &good.ptr; - | ^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:24:17 - | -LL | let _ = &good.data; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:27:17 - | -LL | let _ = &good.data as *const _; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:29:27 - | -LL | let _: *const _ = &good.data; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:32:17 - | -LL | let _ = good.data.clone(); - | ^^^^^^^^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:35:17 - | -LL | let _ = &good.data2[0]; - | ^^^^^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:45:17 +LL | &self.x; + | ^^^^^^^ | -LL | let _ = &packed2.x; - | ^^^^^^^^^^ - | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:90:20 - | -LL | let _ref = &m1.1.a; - | ^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:100:20 - | -LL | let _ref = &m2.1.a; - | ^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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 9 previous errors - -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:22:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:34:17 | LL | let _ = &good.ptr; | ^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:24:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:35:17 | LL | let _ = &good.data; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:27:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:37:17 | LL | let _ = &good.data as *const _; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:29:27 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:38:27 | LL | let _: *const _ = &good.data; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:32:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:40:17 | LL | let _ = good.data.clone(); | ^^^^^^^^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:35:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:42:17 | LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:45:17 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:51:17 | LL | let _ = &packed2.x; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/unaligned_references.rs:90:20 | LL | let _ref = &m1.1.a; | ^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:100:20 +error[E0793]: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:93:20 | LL | let _ref = &m2.1.a; | ^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:9 - | -LL | #![deny(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ +error: aborting due to 10 previous errors + +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/lint/unaligned_references_external_macro.rs b/tests/ui/lint/unaligned_references_external_macro.rs index cb597c38e..b655a2a8f 100644 --- a/tests/ui/lint/unaligned_references_external_macro.rs +++ b/tests/ui/lint/unaligned_references_external_macro.rs @@ -3,7 +3,6 @@ extern crate unaligned_references_external_crate; unaligned_references_external_crate::mac! { //~ERROR reference to packed field is unaligned - //~^ previously accepted #[repr(packed)] pub struct X { pub field: u16 diff --git a/tests/ui/lint/unaligned_references_external_macro.stderr b/tests/ui/lint/unaligned_references_external_macro.stderr index c46ca6742..5b08f433e 100644 --- a/tests/ui/lint/unaligned_references_external_macro.stderr +++ b/tests/ui/lint/unaligned_references_external_macro.stderr @@ -1,8 +1,7 @@ -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/unaligned_references_external_macro.rs:5:1 | LL | / unaligned_references_external_crate::mac! { -LL | | LL | | #[repr(packed)] LL | | pub struct X { LL | | pub field: u16 @@ -10,52 +9,10 @@ LL | | } LL | | } | |_^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references_external_macro.rs:5:1 - | -LL | / unaligned_references_external_crate::mac! { -LL | | -LL | | #[repr(packed)] -LL | | pub struct X { -LL | | pub field: u16 -LL | | } -LL | | } - | |_^ = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/unaligned_references_external_macro.rs:5:1 - | -LL | / unaligned_references_external_crate::mac! { -LL | | -LL | | #[repr(packed)] -LL | | pub struct X { -LL | | pub field: u16 -LL | | } -LL | | } - | |_^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/unaligned_references_external_macro.rs:5:1 - | -LL | / unaligned_references_external_crate::mac! { -LL | | -LL | | #[repr(packed)] -LL | | pub struct X { -LL | | pub field: u16 -LL | | } -LL | | } - | |_^ - = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info) - +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/lint/unused/issue-103320-must-use-ops.rs b/tests/ui/lint/unused/issue-103320-must-use-ops.rs new file mode 100644 index 000000000..597d312fa --- /dev/null +++ b/tests/ui/lint/unused/issue-103320-must-use-ops.rs @@ -0,0 +1,27 @@ +// check-pass + +#![warn(unused_must_use)] +#![feature(never_type)] + +use std::ops::Add; +use std::ops::Sub; +use std::ops::Mul; +use std::ops::Div; +use std::ops::Rem; + +fn main() { + let x = 2_u32; + (x.add(4), x.sub(4), x.mul(4), x.div(4), x.rem(4)); + + x.add(4); //~ WARN unused return value of `add` that must be used + + x.sub(4); //~ WARN unused return value of `sub` that must be used + + x.mul(4); //~ WARN unused return value of `mul` that must be used + + x.div(4); //~ WARN unused return value of `div` that must be used + + x.rem(4); //~ WARN unused return value of `rem` that must be used + + println!("{}", x); +} diff --git a/tests/ui/lint/unused/issue-103320-must-use-ops.stderr b/tests/ui/lint/unused/issue-103320-must-use-ops.stderr new file mode 100644 index 000000000..57439ec6a --- /dev/null +++ b/tests/ui/lint/unused/issue-103320-must-use-ops.stderr @@ -0,0 +1,67 @@ +warning: unused return value of `add` that must be used + --> $DIR/issue-103320-must-use-ops.rs:16:5 + | +LL | x.add(4); + | ^^^^^^^^ + | + = note: this returns the result of the operation, without modifying the original +note: the lint level is defined here + --> $DIR/issue-103320-must-use-ops.rs:3:9 + | +LL | #![warn(unused_must_use)] + | ^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = x.add(4); + | +++++++ + +warning: unused return value of `sub` that must be used + --> $DIR/issue-103320-must-use-ops.rs:18:5 + | +LL | x.sub(4); + | ^^^^^^^^ + | + = note: this returns the result of the operation, without modifying the original +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = x.sub(4); + | +++++++ + +warning: unused return value of `mul` that must be used + --> $DIR/issue-103320-must-use-ops.rs:20:5 + | +LL | x.mul(4); + | ^^^^^^^^ + | + = note: this returns the result of the operation, without modifying the original +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = x.mul(4); + | +++++++ + +warning: unused return value of `div` that must be used + --> $DIR/issue-103320-must-use-ops.rs:22:5 + | +LL | x.div(4); + | ^^^^^^^^ + | + = note: this returns the result of the operation, without modifying the original +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = x.div(4); + | +++++++ + +warning: unused return value of `rem` that must be used + --> $DIR/issue-103320-must-use-ops.rs:24:5 + | +LL | x.rem(4); + | ^^^^^^^^ + | + = note: this returns the result of the operation, without modifying the original +help: use `let _ = ...` to ignore the resulting value + | +LL | let _ = x.rem(4); + | +++++++ + +warning: 5 warnings emitted + diff --git a/tests/ui/lint/unused/issue-96606.rs b/tests/ui/lint/unused/issue-96606.rs new file mode 100644 index 000000000..4e7c290fa --- /dev/null +++ b/tests/ui/lint/unused/issue-96606.rs @@ -0,0 +1,8 @@ +#[deny(unused)] +fn main() { + let arr = [0; 10]; + let _ = arr[(0)]; //~ ERROR unnecessary parentheses around index expression + let _ = arr[{0}]; //~ ERROR unnecessary braces around index expression + let _ = arr[1 + (0)]; + let _ = arr[{ let x = 0; x }]; +} diff --git a/tests/ui/lint/unused/issue-96606.stderr b/tests/ui/lint/unused/issue-96606.stderr new file mode 100644 index 000000000..e36277181 --- /dev/null +++ b/tests/ui/lint/unused/issue-96606.stderr @@ -0,0 +1,33 @@ +error: unnecessary parentheses around index expression + --> $DIR/issue-96606.rs:4:17 + | +LL | let _ = arr[(0)]; + | ^ ^ + | +note: the lint level is defined here + --> $DIR/issue-96606.rs:1:8 + | +LL | #[deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_parens)]` implied by `#[deny(unused)]` +help: remove these parentheses + | +LL - let _ = arr[(0)]; +LL + let _ = arr[0]; + | + +error: unnecessary braces around index expression + --> $DIR/issue-96606.rs:5:17 + | +LL | let _ = arr[{0}]; + | ^ ^ + | + = note: `#[deny(unused_braces)]` implied by `#[deny(unused)]` +help: remove these braces + | +LL - let _ = arr[{0}]; +LL + let _ = arr[0]; + | + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/unused_parens_multibyte_recovery.rs b/tests/ui/lint/unused_parens_multibyte_recovery.rs index 8fcfae22a..bc03faf3f 100644 --- a/tests/ui/lint/unused_parens_multibyte_recovery.rs +++ b/tests/ui/lint/unused_parens_multibyte_recovery.rs @@ -3,7 +3,6 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter -// error-pattern: format argument must be a string literal // // Verify that unused parens lint does not try to create a span // which points in the middle of a multibyte character. diff --git a/tests/ui/lint/unused_parens_multibyte_recovery.stderr b/tests/ui/lint/unused_parens_multibyte_recovery.stderr index a0302b17e..adbf27fcc 100644 --- a/tests/ui/lint/unused_parens_multibyte_recovery.stderr +++ b/tests/ui/lint/unused_parens_multibyte_recovery.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/unused_parens_multibyte_recovery.rs:11:17 + --> $DIR/unused_parens_multibyte_recovery.rs:10:17 | LL | fn f(){(print!(á | -- - ^ @@ -8,36 +8,5 @@ LL | fn f(){(print!(á | |unclosed delimiter | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/unused_parens_multibyte_recovery.rs:11:17 - | -LL | fn f(){(print!(á - | -- - ^ - | || | - | || unclosed delimiter - | |unclosed delimiter - | unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/unused_parens_multibyte_recovery.rs:11:17 - | -LL | fn f(){(print!(á - | -- - ^ - | || | - | || unclosed delimiter - | |unclosed delimiter - | unclosed delimiter - -error: format argument must be a string literal - --> $DIR/unused_parens_multibyte_recovery.rs:11:16 - | -LL | fn f(){(print!(á - | ^ - | -help: you might be missing a string literal to format with - | -LL | fn f(){(print!("{}", á - | +++++ - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/loops/issue-50576.rs b/tests/ui/loops/issue-50576.rs new file mode 100644 index 000000000..e0c36b827 --- /dev/null +++ b/tests/ui/loops/issue-50576.rs @@ -0,0 +1,6 @@ +fn main() { + |bool: [u8; break 'L]| 0; + //~^ ERROR [E0426] + //~| ERROR [E0268] + Vec::<[u8; break]>::new(); //~ ERROR [E0268] +} diff --git a/tests/ui/loops/issue-50576.stderr b/tests/ui/loops/issue-50576.stderr new file mode 100644 index 000000000..4ec22fde9 --- /dev/null +++ b/tests/ui/loops/issue-50576.stderr @@ -0,0 +1,22 @@ +error[E0426]: use of undeclared label `'L` + --> $DIR/issue-50576.rs:2:23 + | +LL | |bool: [u8; break 'L]| 0; + | ^^ undeclared label `'L` + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-50576.rs:2:17 + | +LL | |bool: [u8; break 'L]| 0; + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-50576.rs:5:16 + | +LL | Vec::<[u8; break]>::new(); + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0268, E0426. +For more information about an error, try `rustc --explain E0268`. diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr index ccb27c350..5525dbb90 100644 --- a/tests/ui/loops/loop-break-value.stderr +++ b/tests/ui/loops/loop-break-value.stderr @@ -167,7 +167,7 @@ error[E0308]: mismatched types --> $DIR/loop-break-value.rs:80:15 | LL | break (break, break); - | ^^^^^^^^^^^^^^ expected `()`, found tuple + | ^^^^^^^^^^^^^^ expected `()`, found `(!, !)` | = note: expected unit type `()` found tuple `(!, !)` diff --git a/tests/ui/loops/loop-else-break-with-value.rs b/tests/ui/loops/loop-else-break-with-value.rs new file mode 100644 index 000000000..670d8a145 --- /dev/null +++ b/tests/ui/loops/loop-else-break-with-value.rs @@ -0,0 +1,10 @@ +fn main() { + let Some(1) = loop { + //~^ NOTE `else` is attached to this loop + break Some(1) + } else { + //~^ ERROR `loop...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + return; + }; +} diff --git a/tests/ui/loops/loop-else-break-with-value.stderr b/tests/ui/loops/loop-else-break-with-value.stderr new file mode 100644 index 000000000..972e2d341 --- /dev/null +++ b/tests/ui/loops/loop-else-break-with-value.stderr @@ -0,0 +1,18 @@ +error: `loop...else` loops are not supported + --> $DIR/loop-else-break-with-value.rs:5:7 + | +LL | let Some(1) = loop { + | ---- `else` is attached to this loop +... +LL | } else { + | _______^ +LL | | +LL | | +LL | | return; +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/loops/loop-else-err.rs b/tests/ui/loops/loop-else-err.rs new file mode 100644 index 000000000..202a09c25 --- /dev/null +++ b/tests/ui/loops/loop-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + loop { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `loop...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + } +} diff --git a/tests/ui/loops/loop-else-err.stderr b/tests/ui/loops/loop-else-err.stderr new file mode 100644 index 000000000..c2c5c84cd --- /dev/null +++ b/tests/ui/loops/loop-else-err.stderr @@ -0,0 +1,17 @@ +error: `loop...else` loops are not supported + --> $DIR/loop-else-err.rs:4:7 + | +LL | loop { + | ---- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | } + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/loops/loop-else-let-else-err.rs b/tests/ui/loops/loop-else-let-else-err.rs new file mode 100644 index 000000000..e828ffef5 --- /dev/null +++ b/tests/ui/loops/loop-else-let-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + let _ = loop { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `loop...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + }; +} diff --git a/tests/ui/loops/loop-else-let-else-err.stderr b/tests/ui/loops/loop-else-let-else-err.stderr new file mode 100644 index 000000000..a57c784ff --- /dev/null +++ b/tests/ui/loops/loop-else-let-else-err.stderr @@ -0,0 +1,17 @@ +error: `loop...else` loops are not supported + --> $DIR/loop-else-let-else-err.rs:4:7 + | +LL | let _ = loop { + | ---- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/macros/format-args-temporaries-in-write.stderr b/tests/ui/macros/format-args-temporaries-in-write.stderr index 287cd7d67..520b2ce50 100644 --- a/tests/ui/macros/format-args-temporaries-in-write.stderr +++ b/tests/ui/macros/format-args-temporaries-in-write.stderr @@ -1,6 +1,8 @@ error[E0597]: `mutex` does not live long enough --> $DIR/format-args-temporaries-in-write.rs:41:27 | +LL | let mutex = Mutex; + | ----- binding `mutex` declared here LL | write!(Out, "{}", mutex.lock()) /* no semicolon */ | ^^^^^^^^^^^^ | | @@ -16,6 +18,8 @@ LL | }; error[E0597]: `mutex` does not live long enough --> $DIR/format-args-temporaries-in-write.rs:47:29 | +LL | let mutex = Mutex; + | ----- binding `mutex` declared here LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */ | ^^^^^^^^^^^^ | | diff --git a/tests/ui/macros/issue-102878.rs b/tests/ui/macros/issue-102878.rs index aac589193..bdd9c2569 100644 --- a/tests/ui/macros/issue-102878.rs +++ b/tests/ui/macros/issue-102878.rs @@ -1,9 +1,5 @@ macro_rules!test{($l:expr,$_:r)=>({const:y y)} //~^ ERROR mismatched closing delimiter: `)` -//~| ERROR invalid fragment specifier `r` -//~| ERROR expected identifier, found keyword `const` -//~| ERROR expected identifier, found keyword `const` -//~| ERROR expected identifier, found `:` fn s(){test!(1,i)} diff --git a/tests/ui/macros/issue-102878.stderr b/tests/ui/macros/issue-102878.stderr index e0b8855a3..034e3731b 100644 --- a/tests/ui/macros/issue-102878.stderr +++ b/tests/ui/macros/issue-102878.stderr @@ -7,54 +7,5 @@ LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)} | |unclosed delimiter | closing delimiter possibly meant for this -error: invalid fragment specifier `r` - --> $DIR/issue-102878.rs:1:27 - | -LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)} - | ^^^^ - | - = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` - -error: expected identifier, found keyword `const` - --> $DIR/issue-102878.rs:1:36 - | -LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)} - | ^^^^^ expected identifier, found keyword -... -LL | fn s(){test!(1,i)} - | ---------- in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) -help: escape `const` to use it as an identifier - | -LL | macro_rules!test{($l:expr,$_:r)=>({r#const:y y)} - | ++ - -error: expected identifier, found keyword `const` - --> $DIR/issue-102878.rs:1:36 - | -LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)} - | ^^^^^ expected identifier, found keyword -... -LL | fn s(){test!(1,i)} - | ---------- in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) -help: escape `const` to use it as an identifier - | -LL | macro_rules!test{($l:expr,$_:r)=>({r#const:y y)} - | ++ - -error: expected identifier, found `:` - --> $DIR/issue-102878.rs:1:41 - | -LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)} - | ^ expected identifier -... -LL | fn s(){test!(1,i)} - | ---------- in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error diff --git a/tests/ui/macros/macros-nonfatal-errors.stderr b/tests/ui/macros/macros-nonfatal-errors.stderr index d42f6c179..93fbc9c8a 100644 --- a/tests/ui/macros/macros-nonfatal-errors.stderr +++ b/tests/ui/macros/macros-nonfatal-errors.stderr @@ -150,18 +150,19 @@ error: expected string literal LL | env!(invalid); | ^^^^^^^ -error: expected string literal - --> $DIR/macros-nonfatal-errors.rs:105:10 +error: env! takes 1 or 2 arguments + --> $DIR/macros-nonfatal-errors.rs:105:5 | LL | env!(foo, abr, baz); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^ -error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined +error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined at compile time --> $DIR/macros-nonfatal-errors.rs:106:5 | LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: Use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: format argument must be a string literal diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout index 90f858f80..ad97f7a4a 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout @@ -25,8 +25,8 @@ fn arbitrary_consuming_method_for_demonstration_purposes() { { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem as usize\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem as usize\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -41,8 +41,8 @@ fn addr_of() { if ::core::intrinsics::unlikely(!&*__local_bind0) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: &elem\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: &elem\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -57,8 +57,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 == 1)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem == 1\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem == 1\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -70,8 +70,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 >= 1)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem >= 1\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem >= 1\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -83,8 +83,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 > 0)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem > 0\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem > 0\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -96,8 +96,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 < 3)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem < 3\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem < 3\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -109,8 +109,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 <= 3)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem <= 3\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem <= 3\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -122,8 +122,8 @@ fn binary() { if ::core::intrinsics::unlikely(!(*__local_bind0 != 3)) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem != 3\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: elem != 3\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; @@ -138,8 +138,8 @@ fn unary() { if ::core::intrinsics::unlikely(!**__local_bind0) { (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0); { - ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: *elem\nWith captures:\n elem = ", - "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)])) + ::std::rt::panic_fmt(format_args!("Assertion failed: *elem\nWith captures:\n elem = {0:?}\n", + __capture0)) } } }; diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 5cd217df6..fdc2a7666 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -626,7 +626,7 @@ fn test_item() { stringify_item!( impl ~const Struct {} ), - "impl Struct {}", // FIXME + "impl ~const Struct {}", ); // ItemKind::MacCall @@ -838,7 +838,7 @@ fn test_ty() { 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 Clone"); // FIXME + assert_eq!(stringify_ty!(dyn ~const Clone), "dyn ~const Clone"); assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send"); // TyKind::ImplTrait @@ -846,7 +846,7 @@ fn test_ty() { 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 Clone"); // FIXME + assert_eq!(stringify_ty!(impl ~const Clone), "impl ~const Clone"); assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send"); // TyKind::Paren diff --git a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.rs b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.rs new file mode 100644 index 000000000..4003ee37c --- /dev/null +++ b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.rs @@ -0,0 +1,7 @@ +// check that we don't generate a span that points beyond EOF + +// error-pattern: unclosed delimiter +// error-pattern: unclosed delimiter +// error-pattern: unclosed delimiter + +fn a(){{{ diff --git a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr new file mode 100644 index 000000000..89e0d982e --- /dev/null +++ b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr @@ -0,0 +1,12 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-107423-unused-delim-only-one-no-pair.rs:7:11 + | +LL | fn a(){{{ + | --- ^ + | ||| + | ||unclosed delimiter + | |unclosed delimiter + | unclosed delimiter + +error: aborting due to previous error + diff --git a/tests/ui/match/issue-12552.stderr b/tests/ui/match/issue-12552.stderr index 4b027eba2..195192fbd 100644 --- a/tests/ui/match/issue-12552.stderr +++ b/tests/ui/match/issue-12552.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match t { | - this expression has type `Result<_, {integer}>` LL | Some(k) => match k { - | ^^^^^^^ expected enum `Result`, found enum `Option` + | ^^^^^^^ expected `Result<_, {integer}>`, found `Option<_>` | = note: expected enum `Result<_, {integer}>` found enum `Option<_>` @@ -20,7 +20,7 @@ LL | match t { | - this expression has type `Result<_, {integer}>` ... LL | None => () - | ^^^^ expected enum `Result`, found enum `Option` + | ^^^^ expected `Result<_, {integer}>`, found `Option<_>` | = note: expected enum `Result<_, {integer}>` found enum `Option<_>` diff --git a/tests/ui/match/issue-74050-end-span.stderr b/tests/ui/match/issue-74050-end-span.stderr index 59c091e44..0b3425f2b 100644 --- a/tests/ui/match/issue-74050-end-span.stderr +++ b/tests/ui/match/issue-74050-end-span.stderr @@ -4,6 +4,7 @@ error[E0597]: `arg` does not live long enough LL | let _arg = match args.next() { | ---- borrow later stored here LL | Some(arg) => { + | --- binding `arg` declared here LL | match arg.to_str() { | ^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/match/issue-91058.stderr b/tests/ui/match/issue-91058.stderr index ec1d7e21f..12f37274b 100644 --- a/tests/ui/match/issue-91058.stderr +++ b/tests/ui/match/issue-91058.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match array { | ----- this expression has type `[S; 1]` LL | [()] => {} - | ^^ expected struct `S`, found `()` + | ^^ expected `S`, found `()` error: aborting due to previous error diff --git a/tests/ui/match/match-ref-mut-invariance.stderr b/tests/ui/match/match-ref-mut-invariance.stderr index 3b7e53cd5..b353d3514 100644 --- a/tests/ui/match/match-ref-mut-invariance.stderr +++ b/tests/ui/match/match-ref-mut-invariance.stderr @@ -6,7 +6,7 @@ LL | impl<'b> S<'b> { LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | -- lifetime `'a` defined here LL | match self.0 { ref mut x => x } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` = note: requirement occurs because of a mutable reference to `&i32` diff --git a/tests/ui/match/match-ref-mut-let-invariance.stderr b/tests/ui/match/match-ref-mut-let-invariance.stderr index f4d1cea67..bb0fcdb99 100644 --- a/tests/ui/match/match-ref-mut-let-invariance.stderr +++ b/tests/ui/match/match-ref-mut-let-invariance.stderr @@ -7,7 +7,7 @@ LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | -- lifetime `'a` defined here LL | let ref mut x = self.0; LL | x - | ^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | ^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` = note: requirement occurs because of a mutable reference to `&i32` diff --git a/tests/ui/match/match-struct.rs b/tests/ui/match/match-struct.rs index 7a54c54b9..4da7b436b 100644 --- a/tests/ui/match/match-struct.rs +++ b/tests/ui/match/match-struct.rs @@ -5,7 +5,7 @@ fn main() { match (S { a: 1 }) { E::C(_) => (), //~^ ERROR mismatched types - //~| expected struct `S`, found enum `E` + //~| expected `S`, found `E` _ => () } } diff --git a/tests/ui/match/match-struct.stderr b/tests/ui/match/match-struct.stderr index a475bd5e5..fdc6fd770 100644 --- a/tests/ui/match/match-struct.stderr +++ b/tests/ui/match/match-struct.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match (S { a: 1 }) { | ------------ this expression has type `S` LL | E::C(_) => (), - | ^^^^^^^ expected struct `S`, found enum `E` + | ^^^^^^^ expected `S`, found `E` error: aborting due to previous error diff --git a/tests/ui/match/match-tag-nullary.stderr b/tests/ui/match/match-tag-nullary.stderr index a6add31d1..aac873c76 100644 --- a/tests/ui/match/match-tag-nullary.stderr +++ b/tests/ui/match/match-tag-nullary.stderr @@ -5,7 +5,7 @@ LL | enum B { B } | - unit variant defined here LL | LL | fn main() { let x: A = A::A; match x { B::B => { } } } - | - ^^^^ expected enum `A`, found enum `B` + | - ^^^^ expected `A`, found `B` | | | this expression has type `A` diff --git a/tests/ui/match/match-tag-unary.stderr b/tests/ui/match/match-tag-unary.stderr index 31f77bdff..25e8152d8 100644 --- a/tests/ui/match/match-tag-unary.stderr +++ b/tests/ui/match/match-tag-unary.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/match-tag-unary.rs:4:43 | LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } - | - ^^^^^^^ expected enum `A`, found enum `B` + | - ^^^^^^^ expected `A`, found `B` | | | this expression has type `A` diff --git a/tests/ui/methods/assign-to-method.rs b/tests/ui/methods/assign-to-method.rs index 85beaee8d..71e40759c 100644 --- a/tests/ui/methods/assign-to-method.rs +++ b/tests/ui/methods/assign-to-method.rs @@ -1,5 +1,4 @@ -// compile-flags: -Zsave-analysis -// Also regression test for #69409 +// Regression test for #69409 struct Cat { meows : usize, diff --git a/tests/ui/methods/assign-to-method.stderr b/tests/ui/methods/assign-to-method.stderr index cafe9abae..a1fc57cae 100644 --- a/tests/ui/methods/assign-to-method.stderr +++ b/tests/ui/methods/assign-to-method.stderr @@ -1,5 +1,5 @@ error[E0615]: attempted to take value of method `speak` on type `Cat` - --> $DIR/assign-to-method.rs:22:10 + --> $DIR/assign-to-method.rs:21:10 | LL | nyan.speak = || println!("meow"); | ^^^^^ method, not a field @@ -7,7 +7,7 @@ LL | nyan.speak = || println!("meow"); = help: methods are immutable and cannot be assigned to error[E0615]: attempted to take value of method `speak` on type `Cat` - --> $DIR/assign-to-method.rs:23:10 + --> $DIR/assign-to-method.rs:22:10 | LL | nyan.speak += || println!("meow"); | ^^^^^ method, not a field diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index 769664254..19ccd2de6 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have associated items --> $DIR/issue-105732.rs:4:8 | LL | auto trait Foo { - | --- auto trait cannot have associated items + | --- auto traits cannot have associated items LL | fn g(&self); | ---^-------- help: remove these associated items diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr index 3e73b950a..a8afdeb84 100644 --- a/tests/ui/methods/issues/issue-61525.stderr +++ b/tests/ui/methods/issues/issue-61525.stderr @@ -21,13 +21,13 @@ error[E0308]: mismatched types --> $DIR/issue-61525.rs:14:33 | LL | 1.query::("") - | --------------------- ^^ expected trait object `dyn ToString`, found `&str` + | --------------------- ^^ expected `dyn ToString`, found `&str` | | | arguments to this method are incorrect | = note: expected trait object `dyn ToString` found reference `&'static str` -note: associated function defined here +note: method defined here --> $DIR/issue-61525.rs:2:8 | LL | fn query(self, q: Q); diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index 4d3c086ff..0466bb0a0 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -57,7 +57,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:28:8 | LL | if 1..(end + 1).is_empty() { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -77,7 +77,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:34:8 | LL | if 1..(end + 1).is_sorted() { - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -97,7 +97,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:40:21 | LL | let _res: i32 = 3..6.take(2).sum(); - | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Range` + | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found `Range<{integer}>` | | | expected due to this | @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:45:21 | LL | let _sum: i32 = 3..6.sum(); - | --- ^^^^^^^^^^ expected `i32`, found struct `Range` + | --- ^^^^^^^^^^ expected `i32`, found `Range<{integer}>` | | | expected due to this | @@ -158,7 +158,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:62:8 | LL | if 1..end.error_method() { - | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` diff --git a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr index 4b2597eed..5132d9277 100644 --- a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -10,11 +10,11 @@ note: candidate #2 is defined in an impl of the trait `Me2` for the type `usize` | LL | impl Me2 for usize { fn me(&self) -> usize { *self } } | ^^^^^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | fn main() { Me::me(&1_usize); } | ~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | fn main() { Me2::me(&1_usize); } | ~~~~~~~~~~~~~~~~~ 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 1feaa2c73..601e6bbb0 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in the trait `B` | LL | trait B { fn foo(&self); } | ^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | A::foo(t); | ~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | B::foo(t); | ~~~~~~~~~ diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr index f69b56892..313591433 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB` | LL | fn foo(self) {} | ^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | A::foo(AB {}); | ~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | B::foo(AB {}); | ~~~~~~~~~~~~~ diff --git a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr index e84dff8ba..df01966b3 100644 --- a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `usize` | LL | trait Bar { fn method(&self) {} } | ^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | Foo::method(&1_usize); | ~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | Bar::method(&1_usize); | ~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index 81269b73b..bd51378cf 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -2,17 +2,16 @@ error[E0061]: this method takes 0 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:13:7 | LL | x.zero(0) - | ^^^^ - argument of type `{integer}` unexpected + | ^^^^ - + | | + | unexpected argument of type `{integer}` + | help: remove the extra argument | -note: associated function defined here +note: method defined here --> $DIR/method-call-err-msg.rs:5:8 | LL | fn zero(self) -> Foo { self } | ^^^^ -help: remove the extra argument - | -LL | x.zero() - | ~~ error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/method-call-err-msg.rs:14:7 @@ -20,7 +19,7 @@ error[E0061]: this method takes 1 argument but 0 arguments were supplied LL | .one() | ^^^-- an argument of type `isize` is missing | -note: associated function defined here +note: method defined here --> $DIR/method-call-err-msg.rs:6:8 | LL | fn one(self, _: isize) -> Foo { self } @@ -36,7 +35,7 @@ error[E0061]: this method takes 2 arguments but 1 argument was supplied LL | .two(0); | ^^^--- an argument of type `isize` is missing | -note: associated function defined here +note: method defined here --> $DIR/method-call-err-msg.rs:7:8 | LL | fn two(self, _: isize, _: isize) -> Foo { self } @@ -49,14 +48,17 @@ LL | .two(0, /* isize */); error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 | -LL | pub struct Foo; - | -------------- - | | - | method `take` not found for this struct - | doesn't satisfy `Foo: Iterator` +LL | pub struct Foo; + | -------------- + | | + | method `take` not found for this struct + | doesn't satisfy `Foo: Iterator` ... -LL | .take() - | ^^^^ `Foo` is not an iterator +LL | / y.zero() +LL | | .take() + | | -^^^^ `Foo` is not an iterator + | |______| + | | = note: the following trait bounds were not satisfied: `Foo: Iterator` @@ -73,7 +75,7 @@ error[E0061]: this method takes 3 arguments but 0 arguments were supplied LL | y.three::(); | ^^^^^^^^^^^^^^-- three arguments of type `usize`, `usize`, and `usize` are missing | -note: associated function defined here +note: method defined here --> $DIR/method-call-err-msg.rs:8:8 | LL | fn three(self, _: T, _: T, _: T) -> Foo { self } diff --git a/tests/ui/methods/method-call-lifetime-args-fail.rs b/tests/ui/methods/method-call-lifetime-args-fail.rs index 6bf55844d..1f13de094 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.rs +++ b/tests/ui/methods/method-call-lifetime-args-fail.rs @@ -14,9 +14,9 @@ impl S { fn method_call() { S.early(); // OK S.early::<'static>(); - //~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument + //~^ ERROR method takes 2 lifetime arguments but 1 lifetime argument S.early::<'static, 'static, 'static>(); - //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied + //~^ ERROR method takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S.life_and_type::<'static>(); S.life_and_type::(); S.life_and_type::<'static, u8>(); @@ -61,9 +61,9 @@ fn ufcs() { S::early(S); // OK S::early::<'static>(S); - //~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument + //~^ ERROR method takes 2 lifetime arguments but 1 lifetime argument S::early::<'static, 'static, 'static>(S); - //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied + //~^ ERROR method takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S::life_and_type::<'static>(S); S::life_and_type::(S); S::life_and_type::<'static, u8>(S); diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 249b48ab1..34526256f 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: method takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/method-call-lifetime-args-fail.rs:16:7 | LL | S.early::<'static>(); @@ -6,7 +6,7 @@ LL | S.early::<'static>(); | | | expected 2 lifetime arguments | -note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` +note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } @@ -16,7 +16,7 @@ help: add missing lifetime argument LL | S.early::<'static, 'static>(); | +++++++++ -error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied +error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were supplied --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); @@ -24,7 +24,7 @@ LL | S.early::<'static, 'static, 'static>(); | | | expected 2 lifetime arguments | -note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` +note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } @@ -198,7 +198,7 @@ note: the late bound lifetime parameter is introduced here LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ -error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: method takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/method-call-lifetime-args-fail.rs:63:8 | LL | S::early::<'static>(S); @@ -206,7 +206,7 @@ LL | S::early::<'static>(S); | | | expected 2 lifetime arguments | -note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` +note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } @@ -216,7 +216,7 @@ help: add missing lifetime argument LL | S::early::<'static, 'static>(S); | +++++++++ -error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied +error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were supplied --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); @@ -224,7 +224,7 @@ LL | S::early::<'static, 'static, 'static>(S); | | | expected 2 lifetime arguments | -note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` +note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } 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 82addab94..4e83e4b77 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 @@ -44,15 +44,15 @@ note: candidate #3 is defined in the trait `FinalFoo` | LL | fn foo(&self) -> u8; | ^^^^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | let z = X::foo(x); | ~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | let z = NuisanceFoo::foo(x); | ~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #3 +help: disambiguate the method for candidate #3 | LL | let z = FinalFoo::foo(x); | ~~~~~~~~~~~~~~~~ diff --git a/tests/ui/methods/method-not-found-but-doc-alias.rs b/tests/ui/methods/method-not-found-but-doc-alias.rs new file mode 100644 index 000000000..9c6d10029 --- /dev/null +++ b/tests/ui/methods/method-not-found-but-doc-alias.rs @@ -0,0 +1,11 @@ +struct Foo; + +impl Foo { + #[doc(alias = "quux")] + fn bar(&self) {} +} + +fn main() { + Foo.quux(); + //~^ ERROR no method named `quux` found for struct `Foo` in the current scope +} diff --git a/tests/ui/methods/method-not-found-but-doc-alias.stderr b/tests/ui/methods/method-not-found-but-doc-alias.stderr new file mode 100644 index 000000000..5102a452f --- /dev/null +++ b/tests/ui/methods/method-not-found-but-doc-alias.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `quux` found for struct `Foo` in the current scope + --> $DIR/method-not-found-but-doc-alias.rs:9:9 + | +LL | struct Foo; + | ---------- method `quux` not found for this struct +... +LL | Foo.quux(); + | ^^^^ help: there is a method with a similar name: `bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/methods/method-self-arg-1.rs b/tests/ui/methods/method-self-arg-1.rs index f589f20d8..5912b4ec2 100644 --- a/tests/ui/methods/method-self-arg-1.rs +++ b/tests/ui/methods/method-self-arg-1.rs @@ -9,9 +9,9 @@ impl Foo { fn main() { let x = Foo; Foo::bar(x); //~ ERROR mismatched types - //~| expected `&Foo`, found struct `Foo` + //~| expected `&Foo`, found `Foo` Foo::bar(&42); //~ ERROR mismatched types - //~| expected struct `Foo`, found integer + //~| expected `&Foo`, found `&{integer}` //~| expected reference `&Foo` //~| found reference `&{integer}` } diff --git a/tests/ui/methods/method-self-arg-1.stderr b/tests/ui/methods/method-self-arg-1.stderr index 01fec6fca..9241a8be5 100644 --- a/tests/ui/methods/method-self-arg-1.stderr +++ b/tests/ui/methods/method-self-arg-1.stderr @@ -4,11 +4,11 @@ error[E0308]: mismatched types LL | Foo::bar(x); | -------- ^ | | | - | | expected `&Foo`, found struct `Foo` + | | expected `&Foo`, found `Foo` | | help: consider borrowing here: `&x` | arguments to this function are incorrect | -note: associated function defined here +note: method defined here --> $DIR/method-self-arg-1.rs:6:8 | LL | fn bar(&self) {} @@ -18,13 +18,13 @@ error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:13:14 | LL | Foo::bar(&42); - | -------- ^^^ expected struct `Foo`, found integer + | -------- ^^^ expected `&Foo`, found `&{integer}` | | | arguments to this function are incorrect | = note: expected reference `&Foo` found reference `&{integer}` -note: associated function defined here +note: method defined here --> $DIR/method-self-arg-1.rs:6:8 | LL | fn bar(&self) {} diff --git a/tests/ui/mir/field-projection-invariant.rs b/tests/ui/mir/field-projection-invariant.rs new file mode 100644 index 000000000..b5d6add04 --- /dev/null +++ b/tests/ui/mir/field-projection-invariant.rs @@ -0,0 +1,24 @@ +// build-pass +struct Inv<'a>(&'a mut &'a ()); +enum Foo { + Bar, + Var(T), +} +type Supertype = Foo fn(Inv<'a>, Inv<'a>)>; + +fn foo(x: Foo fn(Inv<'a>, Inv<'b>)>) { + match x { + Supertype::Bar => {} + Supertype::Var(x) => {} + } +} + +fn foo_nested(x: Foo fn(Inv<'a>, Inv<'b>)>>) { + match x { + Foo::Bar => {} + Foo::Var(Supertype::Bar) => {} + Foo::Var(Supertype::Var(x)) => {} + } +} + +fn main() {} diff --git a/tests/ui/mir/field-projection-mutating-context.rs b/tests/ui/mir/field-projection-mutating-context.rs new file mode 100644 index 000000000..a1002c088 --- /dev/null +++ b/tests/ui/mir/field-projection-mutating-context.rs @@ -0,0 +1,19 @@ +use std::sync::Mutex; + +static GLOBAL: Mutex<&'static str> = Mutex::new("global str"); + +struct Foo(T); // `T` is covariant. + +fn foo() { + let mut x: Foo fn(&'a str)> = Foo(|_| ()); + let Foo(ref mut y): Foo = x; + //~^ ERROR mismatched types + *y = |s| *GLOBAL.lock().unwrap() = s; + let string = String::from("i am shortlived"); + (x.0)(&string); +} + +fn main() { + foo(); + println!("{}", GLOBAL.lock().unwrap()); +} diff --git a/tests/ui/mir/field-projection-mutating-context.stderr b/tests/ui/mir/field-projection-mutating-context.stderr new file mode 100644 index 000000000..9b18b3427 --- /dev/null +++ b/tests/ui/mir/field-projection-mutating-context.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/field-projection-mutating-context.rs:9:13 + | +LL | let Foo(ref mut y): Foo = x; + | ^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'a> fn(&'a str)` + found fn pointer `fn(&str)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/mir/field-projection-mutating-context2.rs b/tests/ui/mir/field-projection-mutating-context2.rs new file mode 100644 index 000000000..dd9c44a16 --- /dev/null +++ b/tests/ui/mir/field-projection-mutating-context2.rs @@ -0,0 +1,17 @@ +use std::sync::Mutex; + +static GLOBAL: Mutex<&'static str> = Mutex::new("global str"); + +struct Foo(T); // `T` is covariant. + +fn foo<'a>(mut x: Foo, string: &'a str) { + let Foo(ref mut y): Foo = x; + //~^ ERROR lifetime may not live long enough + *y = |s| *GLOBAL.lock().unwrap() = s; + (x.0)(&string); +} + +fn main() { + foo(Foo(|_| ()), &String::from("i am shortlived")); + println!("{}", GLOBAL.lock().unwrap()); +} diff --git a/tests/ui/mir/field-projection-mutating-context2.stderr b/tests/ui/mir/field-projection-mutating-context2.stderr new file mode 100644 index 000000000..a7b66fe10 --- /dev/null +++ b/tests/ui/mir/field-projection-mutating-context2.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/field-projection-mutating-context2.rs:8:25 + | +LL | fn foo<'a>(mut x: Foo, string: &'a str) { + | -- lifetime `'a` defined here +LL | let Foo(ref mut y): Foo = x; + | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/mir/field-ty-ascription-enums.rs b/tests/ui/mir/field-ty-ascription-enums.rs new file mode 100644 index 000000000..179af6170 --- /dev/null +++ b/tests/ui/mir/field-ty-ascription-enums.rs @@ -0,0 +1,15 @@ +// build-pass + +enum Foo { + Var(T), +} // `T` is covariant. + +fn foo<'b>(x: Foo fn(&'a ())>) { + let Foo::Var(x): Foo = x; +} + +fn foo_nested<'b>(x: Foo fn(&'a ())>>) { + let Foo::Var(Foo::Var(x)): Foo> = x; +} + +fn main() {} diff --git a/tests/ui/mir/field-ty-ascription.rs b/tests/ui/mir/field-ty-ascription.rs new file mode 100644 index 000000000..178c7916b --- /dev/null +++ b/tests/ui/mir/field-ty-ascription.rs @@ -0,0 +1,37 @@ +// build-pass + +struct Foo(T); // `T` is covariant. + +struct Bar { + x: T, +} // `T` is covariant. + +fn bar<'b>(x: Bar fn(&'a ())>) { + let Bar { x }: Bar = x; +} + +fn bar_nested<'b>(x: Bar fn(&'a ())>>) { + let Bar { x: Bar { x } }: Bar> = x; +} + +fn bar_foo_nested<'b>(x: Bar fn(&'a ())>>) { + let Bar { x: Foo ( x ) }: Bar> = x; +} + +fn foo<'b>(x: Foo fn(&'a ())>) { + let Foo(y): Foo = x; +} + +fn foo_nested<'b>(x: Foo fn(&'a ())>>) { + let Foo(Foo(y)): Foo> = x; +} + +fn tuple<'b>(x: (u32, for<'a> fn(&'a ()))) { + let (_, y): (u32, fn(&'b ())) = x; +} + +fn tuple_nested<'b>(x: (u32, (u32, for<'a> fn(&'a ())))) { + let (_, (_, y)): (u32, (u32, fn(&'b ()))) = x; +} + +fn main() {} diff --git a/tests/ui/mir/issue-107678-projection-with-lifetime.rs b/tests/ui/mir/issue-107678-projection-with-lifetime.rs new file mode 100644 index 000000000..14a456878 --- /dev/null +++ b/tests/ui/mir/issue-107678-projection-with-lifetime.rs @@ -0,0 +1,20 @@ +// build-pass + +#![crate_type = "lib"] + +pub trait StreamOnce { + type Error; +} + +pub trait ResetStream: StreamOnce { + fn reset(&mut self) -> Result<(), Self::Error>; +} + +impl<'a> ResetStream for &'a str + where Self: StreamOnce +{ + #[inline] + fn reset(&mut self) -> Result<(), Self::Error> { + Ok(()) + } +} diff --git a/tests/ui/mir/issue-107691.rs b/tests/ui/mir/issue-107691.rs new file mode 100644 index 000000000..517a17208 --- /dev/null +++ b/tests/ui/mir/issue-107691.rs @@ -0,0 +1,42 @@ +// build-pass +// compile-flags: -C opt-level=3 + +#![crate_type = "lib"] + +pub trait Archive { + type Archived; + type Resolver; + + fn resolve(resolver: Self::Resolver, out: *mut Self::Archived); +} + +pub type Archived = ::Archived; +pub type Resolver = ::Resolver; + +pub struct Record<'a> { + _payload: &'a [u8], +} + +pub struct ArchivedRecord<'a> +where + &'a [u8]: Archive, +{ + _payload: Archived<&'a [u8]>, +} + +pub struct RecordResolver<'a> +where + &'a [u8]: Archive, +{ + _payload: Resolver<&'a [u8]>, +} + +impl<'a> Archive for Record<'a> +where + &'a [u8]: Archive, +{ + type Archived = ArchivedRecord<'a>; + type Resolver = RecordResolver<'a>; + + fn resolve(_resolver: Self::Resolver, _out: *mut Self::Archived) {} +} diff --git a/tests/ui/mir/issue-109743.rs b/tests/ui/mir/issue-109743.rs new file mode 100644 index 000000000..73f3405e3 --- /dev/null +++ b/tests/ui/mir/issue-109743.rs @@ -0,0 +1,51 @@ +// build-pass +// compile-flags: --crate-type=lib + +use std::marker::PhantomData; + +pub trait StreamOnce { + type Token; +} + +impl StreamOnce for &str { + type Token = (); +} + +pub trait Parser { + type PartialState: Default; + fn parse_mode(&self, _state: &Self::PartialState) {} + fn parse_mode_impl() {} +} + +pub fn parse_bool<'a>() -> impl Parser<&'a str> { + pub struct TokensCmp + where + Input: StreamOnce, + { + _cmp: C, + _marker: PhantomData, + } + + impl Parser for TokensCmp + where + C: FnMut(Input::Token), + Input: StreamOnce, + { + type PartialState = (); + } + + TokensCmp { _cmp: |_| (), _marker: PhantomData } +} + +pub struct ParseBool; + +impl<'a> Parser<&'a str> for ParseBool +where + &'a str: StreamOnce, +{ + type PartialState = (); + + fn parse_mode_impl() { + parse_bool().parse_mode(&Default::default()) + } +} diff --git a/tests/ui/mir/mir_codegen_ssa.rs b/tests/ui/mir/mir_codegen_ssa.rs new file mode 100644 index 000000000..5e2f10cef --- /dev/null +++ b/tests/ui/mir/mir_codegen_ssa.rs @@ -0,0 +1,19 @@ +// build-pass +// compile-flags: --crate-type=lib +#![feature(custom_mir, core_intrinsics)] +use std::intrinsics::mir::*; + +#[custom_mir(dialect = "runtime", phase = "optimized")] +pub fn f(a: u32) -> u32 { + mir!( + let x: u32; + { + // Previously code generation failed with ICE "use of .. before def ..." because the + // definition of x was incorrectly identified as dominating the use of x located in the + // same statement: + x = x + a; + RET = x; + Return() + } + ) +} diff --git a/tests/ui/mir/validate/storage-live.rs b/tests/ui/mir/validate/storage-live.rs new file mode 100644 index 000000000..ed3c26ed6 --- /dev/null +++ b/tests/ui/mir/validate/storage-live.rs @@ -0,0 +1,30 @@ +// compile-flags: -Zvalidate-mir -Ztreat-err-as-bug +// failure-status: 101 +// error-pattern: broken MIR in +// error-pattern: StorageLive(_1) which already has storage here +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +// normalize-stderr-test "storage_live\[....\]" -> "storage_live[HASH]" +// rustc-env:RUST_BACKTRACE=0 + +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; +use core::ptr::{addr_of, addr_of_mut}; + +#[custom_mir(dialect = "built")] +fn multiple_storage() { + mir!( + let a: usize; + { + StorageLive(a); + StorageLive(a); + Return() + } + ) +} + +fn main() { + multiple_storage() +} diff --git a/tests/ui/mir/validate/storage-live.stderr b/tests/ui/mir/validate/storage-live.stderr new file mode 100644 index 000000000..b586a8658 --- /dev/null +++ b/tests/ui/mir/validate/storage-live.stderr @@ -0,0 +1,13 @@ +error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:8 ~ storage_live[HASH]::multiple_storage), const_param_did: None }) (before pass CheckPackedRef) at bb0[1]: + StorageLive(_1) which already has storage here + --> $DIR/storage-live.rs:22:13 + | +LL | StorageLive(a); + | ^^^^^^^^^^^^^^ + +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [mir_const] preparing `multiple_storage` for borrow checking +#1 [mir_promoted] processing MIR for `multiple_storage` +end of query stack diff --git a/tests/ui/mismatched_types/abridged.stderr b/tests/ui/mismatched_types/abridged.stderr index ff1a836c9..6d2fb1ce9 100644 --- a/tests/ui/mismatched_types/abridged.stderr +++ b/tests/ui/mismatched_types/abridged.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn a() -> Foo { | --- expected `Foo` because of return type LL | Some(Foo { bar: 1 }) - | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option` + | ^^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Option` | = note: expected struct `Foo` found enum `Option` @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | fn a2() -> Foo { | --- expected `Foo` because of return type LL | Ok(Foo { bar: 1}) - | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result` + | ^^^^^^^^^^^^^^^^^ expected `Foo`, found `Result` | = note: expected struct `Foo` found enum `Result` @@ -26,7 +26,7 @@ error[E0308]: mismatched types LL | fn b() -> Option { | ----------- expected `Option` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo` + | ^^^^^^^^^^^^^^ expected `Option`, found `Foo` | = note: expected enum `Option` found struct `Foo` @@ -41,7 +41,7 @@ error[E0308]: mismatched types LL | fn c() -> Result { | ---------------- expected `Result` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo` + | ^^^^^^^^^^^^^^ expected `Result`, found `Foo` | = note: expected enum `Result` found struct `Foo` @@ -57,7 +57,7 @@ LL | fn d() -> X, String> { | ---------------------------- expected `X, String>` because of return type ... LL | x - | ^ expected struct `String`, found integer + | ^ expected `X, String>`, found `X, {integer}>` | = note: expected struct `X, String>` found struct `X, {integer}>` @@ -69,7 +69,7 @@ LL | fn e() -> X, String> { | ---------------------------- expected `X, String>` because of return type ... LL | x - | ^ expected struct `String`, found integer + | ^ expected `X, String>`, found `X, String>` | = note: expected struct `X, _>` found struct `X, _>` @@ -80,7 +80,7 @@ error[E0308]: mismatched types LL | fn f() -> String { | ------ expected `String` because of return type LL | 1+2 - | ^^^ expected struct `String`, found integer + | ^^^ expected `String`, found integer | help: try using a conversion method | @@ -93,7 +93,7 @@ error[E0308]: mismatched types LL | fn g() -> String { | ------ expected `String` because of return type LL | -2 - | ^^ expected struct `String`, found integer + | ^^ expected `String`, found integer | help: try using a conversion method | diff --git a/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr index 2f814445b..54abb50d6 100644 --- a/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr +++ b/tests/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -6,7 +6,7 @@ LL | | S | | - expected because of this LL | | } else { LL | | Y - | | ^ expected struct `S`, found struct `Y` + | | ^ expected `S`, found `Y` LL | | } | |_____- `if` and `else` have incompatible types @@ -17,7 +17,7 @@ LL | / match true { LL | | true => S, | | - this is found to be of type `S` LL | | false => Y, - | | ^ expected struct `S`, found struct `Y` + | | ^ expected `S`, found `Y` LL | | } | |_____- `match` arms have incompatible types diff --git a/tests/ui/mismatched_types/issue-106182.stderr b/tests/ui/mismatched_types/issue-106182.stderr index ac3ab8e98..96ab3a029 100644 --- a/tests/ui/mismatched_types/issue-106182.stderr +++ b/tests/ui/mismatched_types/issue-106182.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match x { | - this expression has type `&_S` LL | _S(& (mut _y), _v) => { - | ^^^^^^^^^^ expected `u32`, found reference + | ^^^^^^^^^^ expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` diff --git a/tests/ui/mismatched_types/issue-38371-unfixable.stderr b/tests/ui/mismatched_types/issue-38371-unfixable.stderr index 3c5e765ab..318285598 100644 --- a/tests/ui/mismatched_types/issue-38371-unfixable.stderr +++ b/tests/ui/mismatched_types/issue-38371-unfixable.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | fn bgh(&&bar: u32) {} | ^^^^^ --- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` diff --git a/tests/ui/mismatched_types/issue-38371.stderr b/tests/ui/mismatched_types/issue-38371.stderr index f43427f98..19335c446 100644 --- a/tests/ui/mismatched_types/issue-38371.stderr +++ b/tests/ui/mismatched_types/issue-38371.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn foo(&_a: Foo) {} | ^^^ --- expected due to this | | - | expected struct `Foo`, found reference + | expected `Foo`, found `&_` | = note: expected struct `Foo` found reference `&_` @@ -20,7 +20,7 @@ error[E0308]: mismatched types LL | fn agh(&&_a: &u32) {} | ^^^ ---- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` diff --git a/tests/ui/mismatched_types/issue-47706.stderr b/tests/ui/mismatched_types/issue-47706.stderr index d9d408844..69d6ee5cb 100644 --- a/tests/ui/mismatched_types/issue-47706.stderr +++ b/tests/ui/mismatched_types/issue-47706.stderr @@ -27,7 +27,7 @@ note: required by a bound in `foo` --> $DIR/issue-47706.rs:22:8 | LL | fn foo(f: F) - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | F: Fn(), | ^^^^ required by this bound in `foo` diff --git a/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr b/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr index 9ddea1629..b52318230 100644 --- a/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr +++ b/tests/ui/mismatched_types/issue-74918-missing-lifetime.stderr @@ -16,9 +16,9 @@ LL | fn next(&mut self) -> Option> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 mut ChunkingIterator) -> Option>` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | - = note: expected `fn(&'1 mut ChunkingIterator) -> Option>` + = note: expected `fn(&'1 mut ChunkingIterator) -> Option>` | - = note: expected signature `fn(&'1 mut ChunkingIterator) -> Option>` + = note: expected signature `fn(&'1 mut ChunkingIterator) -> Option>` found signature `fn(&'1 mut ChunkingIterator) -> Option>` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output diff --git a/tests/ui/mismatched_types/non_zero_assigned_something.stderr b/tests/ui/mismatched_types/non_zero_assigned_something.stderr index d4b2c902f..57db71f88 100644 --- a/tests/ui/mismatched_types/non_zero_assigned_something.stderr +++ b/tests/ui/mismatched_types/non_zero_assigned_something.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/non_zero_assigned_something.rs:2:35 | LL | let _: std::num::NonZeroU64 = 1; - | -------------------- ^ expected struct `NonZeroU64`, found integer + | -------------------- ^ expected `NonZeroU64`, found integer | | | expected due to this | @@ -15,7 +15,7 @@ error[E0308]: mismatched types --> $DIR/non_zero_assigned_something.rs:6:43 | LL | let _: Option = 1; - | ---------------------------- ^ expected enum `Option`, found integer + | ---------------------------- ^ expected `Option`, found integer | | | expected due to this | diff --git a/tests/ui/mismatched_types/normalize-fn-sig.stderr b/tests/ui/mismatched_types/normalize-fn-sig.stderr index 6c55f29c5..e3a064655 100644 --- a/tests/ui/mismatched_types/normalize-fn-sig.stderr +++ b/tests/ui/mismatched_types/normalize-fn-sig.stderr @@ -2,12 +2,13 @@ error[E0308]: mismatched types --> $DIR/normalize-fn-sig.rs:14:22 | LL | needs_i32_ref_fn(foo::<()>); - | ---------------- ^^^^^^^^^ expected `&i32`, found `i32` + | ---------------- ^^^^^^^^^ expected fn pointer, found fn item | | | arguments to this function are incorrect | = note: expected fn pointer `fn(&'static i32, i32)` found fn item `fn(i32, &'static i32) {foo::<()>}` + = note: when the arguments and return types match, functions can be coerced to function pointers note: function defined here --> $DIR/normalize-fn-sig.rs:11:4 | diff --git a/tests/ui/mismatched_types/overloaded-calls-bad.stderr b/tests/ui/mismatched_types/overloaded-calls-bad.stderr index 3a895acbd..cd483e7ad 100644 --- a/tests/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/tests/ui/mismatched_types/overloaded-calls-bad.stderr @@ -32,7 +32,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:37:15 | LL | let ans = s("burma", "shave"); - | ^ ------- ------- argument of type `&'static str` unexpected + | ^ ------- ------- unexpected argument of type `&'static str` | | | expected `isize`, found `&str` | @@ -43,8 +43,9 @@ LL | impl FnMut<(isize,)> for S { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the extra argument | -LL | let ans = s(/* isize */); - | ~~~~~~~~~~~~~ +LL - let ans = s("burma", "shave"); +LL + let ans = s(/* isize */); + | error[E0308]: mismatched types --> $DIR/overloaded-calls-bad.rs:40:7 diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr index 63eaa3930..62824004d 100644 --- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn _f0(&_a: u32) {} | ^^^ --- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -41,7 +41,7 @@ error[E0308]: mismatched types LL | fn _f2(&&_a: &u32) {} | ^^^ ---- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -57,7 +57,7 @@ error[E0308]: mismatched types LL | fn _f3(&mut &_a: &mut u32) {} | ^^^ -------- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -106,7 +106,7 @@ LL | let _: fn(u32) = |&_a| (); | ^-- | || | |expected due to this - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -145,7 +145,7 @@ LL | let _: fn(&u32) = |&&_a| (); | ^-- | || | |expected due to this - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -162,7 +162,7 @@ LL | let _: fn(&mut u32) = |&mut &_a| (); | ^-- | || | |expected due to this - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -212,7 +212,7 @@ error[E0308]: mismatched types LL | let _ = |&_a: u32| (); | ^^^ --- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -249,7 +249,7 @@ error[E0308]: mismatched types LL | let _ = |&&_a: &u32| (); | ^^^ ---- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` @@ -265,7 +265,7 @@ error[E0308]: mismatched types LL | let _ = |&mut &_a: &mut u32| (); | ^^^ -------- expected due to this | | - | expected `u32`, found reference + | expected `u32`, found `&_` | = note: expected type `u32` found reference `&_` diff --git a/tests/ui/mismatched_types/show_module.stderr b/tests/ui/mismatched_types/show_module.stderr index 5e48e0955..4bbeaaab9 100644 --- a/tests/ui/mismatched_types/show_module.stderr +++ b/tests/ui/mismatched_types/show_module.stderr @@ -4,15 +4,15 @@ error[E0308]: mismatched types LL | fn foo() -> Foo { | --- expected `baz::Foo` because of return type LL | meh::Foo - | ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo` + | ^^^^^^^^ expected `baz::Foo`, found `meh::Foo` | - = note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types -note: struct `meh::Foo` is defined in module `crate::meh` of the current crate + = note: `meh::Foo` and `baz::Foo` have similar names, but are actually distinct types +note: `meh::Foo` is defined in module `crate::meh` of the current crate --> $DIR/show_module.rs:8:5 | LL | pub struct Foo; | ^^^^^^^^^^^^^^ -note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate +note: `baz::Foo` is defined in module `crate::blah::baz` of the current crate --> $DIR/show_module.rs:3:9 | LL | pub struct Foo; diff --git a/tests/ui/mismatched_types/similar_paths.stderr b/tests/ui/mismatched_types/similar_paths.stderr index 46a383325..3e44fb759 100644 --- a/tests/ui/mismatched_types/similar_paths.stderr +++ b/tests/ui/mismatched_types/similar_paths.stderr @@ -4,12 +4,12 @@ error[E0308]: mismatched types LL | pub fn foo() -> Option { | ---------- expected `Option` because of return type LL | Some(42_u8) - | ^^^^^^^^^^^ expected enum `Option`, found enum `std::option::Option` + | ^^^^^^^^^^^ expected `Option`, found `std::option::Option` | - = note: enum `std::option::Option` and enum `Option` have similar names, but are actually distinct types -note: enum `std::option::Option` is defined in crate `core` + = note: `std::option::Option` and `Option` have similar names, but are actually distinct types +note: `std::option::Option` is defined in crate `core` --> $SRC_DIR/core/src/option.rs:LL:COL -note: enum `Option` is defined in the current crate +note: `Option` is defined in the current crate --> $DIR/similar_paths.rs:1:1 | LL | enum Option { diff --git a/tests/ui/mismatched_types/similar_paths_primitive.stderr b/tests/ui/mismatched_types/similar_paths_primitive.stderr index 8a2f73945..80e78a4e4 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.stderr +++ b/tests/ui/mismatched_types/similar_paths_primitive.stderr @@ -2,13 +2,13 @@ error[E0308]: mismatched types --> $DIR/similar_paths_primitive.rs:8:9 | LL | foo(true); - | --- ^^^^ expected struct `bool`, found `bool` + | --- ^^^^ expected `bool`, found a different `bool` | | | arguments to this function are incorrect | - = note: bool and struct `bool` have similar names, but are actually distinct types + = note: bool and `bool` have similar names, but are actually distinct types = note: bool is a primitive defined by the language -note: struct `bool` is defined in the current crate +note: `bool` is defined in the current crate --> $DIR/similar_paths_primitive.rs:3:1 | LL | struct bool; diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr index f58b9c3ec..40182a75a 100644 --- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr +++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -6,7 +6,7 @@ LL | | S | | - expected because of this LL | | } else { LL | | Y - | | ^ expected struct `S`, found struct `Y` + | | ^ expected `S`, found `Y` LL | | } | |_____- `if` and `else` have incompatible types | @@ -28,7 +28,7 @@ LL | / match true { LL | | true => S, | | - this is found to be of type `S` LL | | false => Y, - | | ^ expected struct `S`, found struct `Y` + | | ^ expected `S`, found `Y` LL | | } | |_____- `match` arms have incompatible types | diff --git a/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr b/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr index 35871afb5..c5d0eef10 100644 --- a/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr +++ b/tests/ui/mismatched_types/suggest-removing-tuple-struct-field.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-removing-tuple-struct-field.rs:11:13 | LL | some_fn(value.0); - | ------- ^^^^^^^ expected struct `MyWrapper`, found `u32` + | ------- ^^^^^^^ expected `MyWrapper`, found `u32` | | | arguments to this function are incorrect | @@ -21,7 +21,7 @@ error[E0308]: mismatched types --> $DIR/suggest-removing-tuple-struct-field.rs:12:13 | LL | some_fn(my_wrapper!(123).0); - | ------- ^^^^^^^^^^^^^^^^^^ expected struct `MyWrapper`, found `u32` + | ------- ^^^^^^^^^^^^^^^^^^ expected `MyWrapper`, found `u32` | | | arguments to this function are incorrect | diff --git a/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr b/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr index fdd92cbfc..e20a0aa0e 100644 --- a/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr +++ b/tests/ui/mismatched_types/wrap-suggestion-privacy.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/wrap-suggestion-privacy.rs:12:19 | LL | needs_wrapper(0); - | ------------- ^ expected struct `Wrapper`, found integer + | ------------- ^ expected `Wrapper`, found integer | | | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/wrap-suggestion-privacy.rs:17:20 | LL | needs_wrapping(0); - | -------------- ^ expected struct `Wrapping`, found integer + | -------------- ^ expected `Wrapping`, found integer | | | arguments to this function are incorrect | @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/wrap-suggestion-privacy.rs:22:17 | LL | needs_ready(Some(0)); - | ----------- ^^^^^^^ expected struct `Ready`, found enum `Option` + | ----------- ^^^^^^^ expected `Ready`, found `Option<{integer}>` | | | arguments to this function are incorrect | diff --git a/tests/ui/modules/issue-107649.rs b/tests/ui/modules/issue-107649.rs new file mode 100644 index 000000000..71b84cd30 --- /dev/null +++ b/tests/ui/modules/issue-107649.rs @@ -0,0 +1,106 @@ +// compile-flags: -Z ui-testing=no +#[path = "auxiliary/dummy_lib.rs"] +mod lib; + +/// The function needs to be long enough to +/// ensure `max_line_num_len` to be large enough +/// for no-ui-testing +fn main() { + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + (); + dbg!(lib::Dummy); //~ Error: `Dummy` doesn't implement `Debug` +} diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr new file mode 100644 index 000000000..1cea71f28 --- /dev/null +++ b/tests/ui/modules/issue-107649.stderr @@ -0,0 +1,18 @@ +error[E0277]: `Dummy` doesn't implement `Debug` + --> $DIR/issue-107649.rs:105:5 + | +105 | dbg!(lib::Dummy); + | ^^^^^^^^^^^^^^^^ `Dummy` cannot be formatted using `{:?}` + | + = help: the trait `Debug` is not implemented for `Dummy` + = note: add `#[derive(Debug)]` to `Dummy` or manually `impl Debug for Dummy` + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `Dummy` with `#[derive(Debug)]` + --> $DIR/auxiliary/dummy_lib.rs:2:1 + | +2 | #[derive(Debug)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/moves/issue-22536-copy-mustnt-zero.rs b/tests/ui/moves/issue-22536-copy-mustnt-zero.rs new file mode 100644 index 000000000..017f36484 --- /dev/null +++ b/tests/ui/moves/issue-22536-copy-mustnt-zero.rs @@ -0,0 +1,28 @@ +// run-pass +// Regression test for Issue #22536: If a type implements Copy, then +// moving it must not zero the original memory. + + +trait Resources { + type Buffer: Copy; + fn foo(&self) {} +} + +struct BufferHandle { + raw: ::Buffer, +} +impl Copy for BufferHandle {} +impl Clone for BufferHandle { + fn clone(&self) -> BufferHandle { *self } +} + +enum Res {} +impl Resources for Res { + type Buffer = u32; +} + +fn main() { + let b: BufferHandle = BufferHandle { raw: 1 }; + let c = b; + assert_eq!(c.raw, b.raw) +} diff --git a/tests/ui/moves/move-fn-self-receiver.stderr b/tests/ui/moves/move-fn-self-receiver.stderr index 7f69e5dcf..91d237b1d 100644 --- a/tests/ui/moves/move-fn-self-receiver.stderr +++ b/tests/ui/moves/move-fn-self-receiver.stderr @@ -75,6 +75,8 @@ LL | fn use_pin_box_self(self: Pin>) {} error[E0505]: cannot move out of `mut_foo` because it is borrowed --> $DIR/move-fn-self-receiver.rs:50:5 | +LL | let mut mut_foo = Foo; + | ----------- binding `mut_foo` declared here LL | let ret = mut_foo.use_mut_self(); | ---------------------- borrow of `mut_foo` occurs here LL | mut_foo; diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed new file mode 100644 index 000000000..0b9a3bae9 --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.fixed @@ -0,0 +1,11 @@ +// run-rustfix +use std::pin::Pin; + +fn foo(_: &mut ()) {} + +fn main() { + let mut uwu = (); + let mut r = Pin::new(&mut uwu); + foo(r.as_mut().get_mut()); + foo(r.get_mut()); //~ ERROR use of moved value +} diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs new file mode 100644 index 000000000..0e952b06e --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.rs @@ -0,0 +1,11 @@ +// run-rustfix +use std::pin::Pin; + +fn foo(_: &mut ()) {} + +fn main() { + let mut uwu = (); + let mut r = Pin::new(&mut uwu); + foo(r.get_mut()); + foo(r.get_mut()); //~ ERROR use of moved value +} diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr new file mode 100644 index 000000000..7e513b73c --- /dev/null +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr @@ -0,0 +1,20 @@ +error[E0382]: use of moved value: `r` + --> $DIR/pin-mut-reborrow-infer-var-issue-107419.rs:10:9 + | +LL | let mut r = Pin::new(&mut uwu); + | ----- move occurs because `r` has type `Pin<&mut ()>`, which does not implement the `Copy` trait +LL | foo(r.get_mut()); + | --------- `r` moved due to this method call +LL | foo(r.get_mut()); + | ^ value used here after move + | +note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which moves `r` + --> $SRC_DIR/core/src/pin.rs:LL:COL +help: consider reborrowing the `Pin` instead of moving it + | +LL | foo(r.as_mut().get_mut()); + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/mut/mut-cross-borrowing.stderr b/tests/ui/mut/mut-cross-borrowing.stderr index ee739d628..8401827e5 100644 --- a/tests/ui/mut/mut-cross-borrowing.stderr +++ b/tests/ui/mut/mut-cross-borrowing.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | f(x) | - ^ | | | - | | expected `&mut isize`, found struct `Box` + | | expected `&mut isize`, found `Box<{integer}>` | | help: consider mutably borrowing here: `&mut x` | arguments to this function are incorrect | diff --git a/tests/ui/mut/mut-pattern-internal-mutability.stderr b/tests/ui/mut/mut-pattern-internal-mutability.stderr index 6583546aa..5f2074edb 100644 --- a/tests/ui/mut/mut-pattern-internal-mutability.stderr +++ b/tests/ui/mut/mut-pattern-internal-mutability.stderr @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*foo` because it is borrowed --> $DIR/mut-pattern-internal-mutability.rs:13:5 | LL | let &mut ref x = foo; - | ----- borrow of `*foo` occurs here + | ----- `*foo` is borrowed here LL | *foo += 1; - | ^^^^^^^^^ assignment to borrowed `*foo` occurs here + | ^^^^^^^^^ `*foo` is assigned to here but it was already borrowed LL | drop(x); | - borrow later used here diff --git a/tests/ui/mutexguard-sync.rs b/tests/ui/mutexguard-sync.rs deleted file mode 100644 index b56418383..000000000 --- a/tests/ui/mutexguard-sync.rs +++ /dev/null @@ -1,13 +0,0 @@ -// MutexGuard> must not be Sync, that would be unsound. -use std::sync::Mutex; -use std::cell::Cell; - -fn test_sync(_t: T) {} - -fn main() -{ - let m = Mutex::new(Cell::new(0i32)); - let guard = m.lock().unwrap(); - test_sync(guard); - //~^ ERROR `Cell` cannot be shared between threads safely [E0277] -} diff --git a/tests/ui/mutexguard-sync.stderr b/tests/ui/mutexguard-sync.stderr deleted file mode 100644 index 3fbb2ddf1..000000000 --- a/tests/ui/mutexguard-sync.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/mutexguard-sync.rs:11:15 - | -LL | test_sync(guard); - | --------- ^^^^^ `Cell` cannot be shared between threads safely - | | - | required by a bound introduced by this call - | - = help: the trait `Sync` is not implemented for `Cell` - = note: required for `MutexGuard<'_, Cell>` to implement `Sync` -note: required by a bound in `test_sync` - --> $DIR/mutexguard-sync.rs:5:17 - | -LL | fn test_sync(_t: T) {} - | ^^^^ required by this bound in `test_sync` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs index 066048795..0ccd441cc 100644 --- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs +++ b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs @@ -1,8 +1,11 @@ -// compile-flags: -Zunstable-options --crate-type rlib +// gate-test-packed_bundled_libs + +// ignore-wasm32-bare +// compile-flags: --crate-type rlib +// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs // build-fail -// error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs -#[link(name = "mylib", kind = "static", modifiers = "+bundle,+whole-archive")] -extern "C" { } +#[link(name = "rust_test_helpers", kind = "static", modifiers = "+bundle,+whole-archive")] +extern "C" {} -fn main() { } +fn main() {} diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr index 246efb8d6..8a9fed740 100644 --- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr +++ b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr @@ -1,6 +1,4 @@ -error: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs +error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs -error: could not find native static library `mylib`, perhaps an -L flag is missing? - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs index 1d0768d99..18d4b52a3 100644 --- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs +++ b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.rs @@ -1,7 +1,8 @@ -// Mixing +bundle and +whole-archive is not allowed +// gate-test-packed_bundled_libs -// compile-flags: -l static:+bundle,+whole-archive=mylib -Zunstable-options --crate-type rlib +// ignore-wasm32-bare +// compile-flags: -l static:+bundle,+whole-archive=rust_test_helpers --crate-type rlib +// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs // build-fail -// error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs -fn main() { } +fn main() {} diff --git a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr index 246efb8d6..8a9fed740 100644 --- a/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr +++ b/tests/ui/native-library-link-flags/mix-bundle-and-whole-archive.stderr @@ -1,6 +1,4 @@ -error: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs +error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs -error: could not find native static library `mylib`, perhaps an -L flag is missing? - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/never_type/diverging-tuple-parts-39485.stderr b/tests/ui/never_type/diverging-tuple-parts-39485.stderr index 52d07ae17..ded13e270 100644 --- a/tests/ui/never_type/diverging-tuple-parts-39485.stderr +++ b/tests/ui/never_type/diverging-tuple-parts-39485.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:8:5 | LL | &panic!() - | ^^^^^^^^^ expected `()`, found reference + | ^^^^^^^^^ expected `()`, found `&_` | = note: expected unit type `()` found reference `&_` @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | fn f() -> isize { | ----- expected `isize` because of return type LL | (return 1, return 2) - | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple + | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `(!, !)` | = note: expected type `isize` found tuple `(!, !)` diff --git a/tests/ui/never_type/issue-10176.rs b/tests/ui/never_type/issue-10176.rs index 6277aa05e..5ac4359c5 100644 --- a/tests/ui/never_type/issue-10176.rs +++ b/tests/ui/never_type/issue-10176.rs @@ -3,7 +3,7 @@ fn f() -> isize { //~^ ERROR mismatched types //~| expected type `isize` //~| found tuple `(!, !)` -//~| expected `isize`, found tuple +//~| expected `isize`, found `(!, !)` } fn main() {} diff --git a/tests/ui/never_type/issue-10176.stderr b/tests/ui/never_type/issue-10176.stderr index cd5361ffa..3f381b9ae 100644 --- a/tests/ui/never_type/issue-10176.stderr +++ b/tests/ui/never_type/issue-10176.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn f() -> isize { | ----- expected `isize` because of return type LL | (return 1, return 2) - | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple + | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `(!, !)` | = note: expected type `isize` found tuple `(!, !)` diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index 33b7a9185..99dfce869 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -19,7 +19,7 @@ error[E0308]: mismatched types --> $DIR/issue-52443.rs:2:10 | LL | [(); & { loop { continue } } ]; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` | = note: expected type `usize` found reference `&_` diff --git a/tests/ui/never_type/issue-96335.stderr b/tests/ui/never_type/issue-96335.stderr index e148b983e..c3d80a425 100644 --- a/tests/ui/never_type/issue-96335.stderr +++ b/tests/ui/never_type/issue-96335.stderr @@ -19,7 +19,7 @@ error[E0308]: mismatched types LL | 0.....{loop{}1}; | ----^^^^^^^^^^^ | | | - | | expected integer, found struct `RangeTo` + | | expected integer, found `RangeTo<{integer}>` | arguments to this function are incorrect | = note: expected type `{integer}` diff --git a/tests/ui/nll/borrowed-local-error.stderr b/tests/ui/nll/borrowed-local-error.stderr index d629caa43..1cca4077d 100644 --- a/tests/ui/nll/borrowed-local-error.stderr +++ b/tests/ui/nll/borrowed-local-error.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | let x = gimme({ | ----- borrow later used by call LL | let v = (22,); + | - binding `v` declared here LL | &v | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/borrowed-match-issue-45045.stderr b/tests/ui/nll/borrowed-match-issue-45045.stderr index 9d4682667..33e3eb797 100644 --- a/tests/ui/nll/borrowed-match-issue-45045.stderr +++ b/tests/ui/nll/borrowed-match-issue-45045.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed --> $DIR/borrowed-match-issue-45045.rs:12:11 | LL | let f = &mut e; - | ------ borrow of `e` occurs here + | ------ `e` is borrowed here LL | let g = f; LL | match e { | ^ use of borrowed `e` diff --git a/tests/ui/nll/capture-ref-in-struct.stderr b/tests/ui/nll/capture-ref-in-struct.stderr index cdfe7f6db..84b7ecf2f 100644 --- a/tests/ui/nll/capture-ref-in-struct.stderr +++ b/tests/ui/nll/capture-ref-in-struct.stderr @@ -1,6 +1,9 @@ error[E0597]: `y` does not live long enough --> $DIR/capture-ref-in-struct.rs:18:16 | +LL | let y = 22; + | - binding `y` declared here +... LL | y: &y, | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/closure-access-spans.stderr b/tests/ui/nll/closure-access-spans.stderr index 0a09353b8..035dd5a56 100644 --- a/tests/ui/nll/closure-access-spans.stderr +++ b/tests/ui/nll/closure-access-spans.stderr @@ -38,7 +38,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/closure-access-spans.rs:23:13 | LL | let r = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | move || x; | ^ use of borrowed `x` LL | r.use_ref(); @@ -47,6 +47,8 @@ LL | r.use_ref(); error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/closure-access-spans.rs:29:5 | +LL | fn closure_move_capture_conflict(mut x: String) { + | ----- binding `x` declared here LL | let r = &x; | -- borrow of `x` occurs here LL | || x; diff --git a/tests/ui/nll/closure-borrow-spans.stderr b/tests/ui/nll/closure-borrow-spans.stderr index bada4e1b8..cf0df5834 100644 --- a/tests/ui/nll/closure-borrow-spans.stderr +++ b/tests/ui/nll/closure-borrow-spans.stderr @@ -40,9 +40,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let f = || x; | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here @@ -52,7 +52,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | let y = x; | ^ use of borrowed `x` LL | f.use_ref(); @@ -100,9 +100,9 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let f = || x = 0; | -- - borrow occurs due to use in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here @@ -160,9 +160,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed LL | let f = || *x = 0; | -- -- borrow occurs due to use in closure | | - | borrow of `*x` occurs here + | `*x` is borrowed here LL | *x = 1; - | ^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | f.use_ref(); | ----------- borrow later used here diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr index f67c312b9..5a8462d4d 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument.stderr @@ -21,6 +21,9 @@ LL | fn test() { error[E0597]: `y` does not live long enough --> $DIR/escape-argument.rs:27:25 | +LL | let y = 22; + | - binding `y` declared here +LL | let mut closure = expect_sig(|p, y| *p = y); LL | closure(&mut p, &y); | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 7991abeb7..721cd45de 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -53,6 +53,8 @@ LL | fn case2() { error[E0597]: `a` does not live long enough --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 | +LL | let a = 0; + | - binding `a` declared here LL | let cell = Cell::new(&a); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs b/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs new file mode 100644 index 000000000..d8772e868 --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-non-trivial-region.rs @@ -0,0 +1,19 @@ +// See #108639 for description. +// check-pass + +trait Trait { + type Item<'a>: 'a; +} + +fn assert_static(_: T) {} +fn relate(_: T, _: T) {} + +fn test_args() { + let closure = |a, b| { + relate(&a, b); + assert_static(a); + }; + closure(None::>, &None::>); +} + +fn main() {} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs b/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs new file mode 100644 index 000000000..fce6f2fee --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-opaque-1.rs @@ -0,0 +1,18 @@ +// Regression test for #107426. +// check-pass + +use std::marker::PhantomData; +#[derive(Clone, Copy)] +pub struct Scope<'a>(&'a PhantomData<&'a mut &'a ()>); +fn event<'a, F: FnMut() + 'a>(_: Scope<'a>, _: F) {} +fn make_fn<'a>(_: Scope<'a>) -> impl Fn() + Copy + 'a { + || {} +} + +fn foo(cx: Scope) { + let open_toggle = make_fn(cx); + + || event(cx, open_toggle); +} + +fn main() {} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs b/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs new file mode 100644 index 000000000..55905850f --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-opaque-2.rs @@ -0,0 +1,17 @@ +// Resgression test for #107516. +// check-pass + +fn iter1<'a: 'a>() -> impl Iterator { + None.into_iter() +} + +fn iter2<'a>() -> impl Iterator { + None.into_iter() +} + +struct Bivar<'a, I: Iterator + 'a>(I); + +fn main() { + let _ = || Bivar(iter1()); + let _ = || Bivar(iter2()); +} diff --git a/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs b/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs new file mode 100644 index 000000000..b5a95c170 --- /dev/null +++ b/tests/ui/nll/closure-requirements/type-test-subject-unnamed-region.rs @@ -0,0 +1,24 @@ +// See #108635 for description. +// check-pass + +trait Trait { + type Item<'a>: 'a; +} + +fn assert_static(_: T) {} + +fn test_args() { + let closure = |a, _b| assert_static(a); + + closure(None::>, &None::>); +} + +fn test_upvars() { + let upvars = (None::>, &None::>); + let _closure = || { + let (a, _b) = upvars; + assert_static(a); + }; +} + +fn main() {} diff --git a/tests/ui/nll/closure-use-spans.stderr b/tests/ui/nll/closure-use-spans.stderr index ad928f1bb..0e27e5f5f 100644 --- a/tests/ui/nll/closure-use-spans.stderr +++ b/tests/ui/nll/closure-use-spans.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:5:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | || *y; | -- borrow later captured here by closure @@ -12,9 +12,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:11:5 | LL | let y = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | || *y = 1; | -- borrow later captured here by closure @@ -22,9 +22,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-use-spans.rs:17:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here LL | x = 0; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | move || *y; | -- borrow later captured here by closure diff --git a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr index 65be3b37e..862c925b4 100644 --- a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr +++ b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy-proj.stderr @@ -1,6 +1,8 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy-proj.rs:9:18 | +LL | let s = 2; + | - binding `s` declared here LL | let a = (Foo(&s),); | ^^ borrowed value does not live long enough LL | drop(a.0); diff --git a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr index b811ba4fd..ebaf6d124 100644 --- a/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr +++ b/tests/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr @@ -1,6 +1,8 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:8:17 | +LL | let s = 2; + | - binding `s` declared here LL | let a = Foo(&s); | ^^ borrowed value does not live long enough LL | drop(a); diff --git a/tests/ui/nll/dont-print-desugared.stderr b/tests/ui/nll/dont-print-desugared.stderr index fad6121cb..289b246e6 100644 --- a/tests/ui/nll/dont-print-desugared.stderr +++ b/tests/ui/nll/dont-print-desugared.stderr @@ -10,6 +10,7 @@ error[E0597]: `y` does not live long enough LL | for ref mut d in v { | - a temporary with access to the borrow is created here ... LL | let y = (); + | - binding `y` declared here LL | *d = D(&y); | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/nll/drop-no-may-dangle.stderr b/tests/ui/nll/drop-no-may-dangle.stderr index cb2808809..0ddb7adbb 100644 --- a/tests/ui/nll/drop-no-may-dangle.stderr +++ b/tests/ui/nll/drop-no-may-dangle.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed --> $DIR/drop-no-may-dangle.rs:18:9 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[_]` occurs here + | ----- `v[_]` is borrowed here ... LL | v[0] += 1; - | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here + | ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed ... LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` @@ -14,10 +14,10 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed --> $DIR/drop-no-may-dangle.rs:21:5 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[_]` occurs here + | ----- `v[_]` is borrowed here ... LL | v[0] += 1; - | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here + | ^^^^^^^^^ `v[_]` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` diff --git a/tests/ui/nll/guarantor-issue-46974.stderr b/tests/ui/nll/guarantor-issue-46974.stderr index 8854dd8d6..7edc3dcc5 100644 --- a/tests/ui/nll/guarantor-issue-46974.stderr +++ b/tests/ui/nll/guarantor-issue-46974.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `*s` because it is borrowed --> $DIR/guarantor-issue-46974.rs:7:5 | LL | let t = &mut *s; // this borrow should last for the entire function - | ------- borrow of `*s` occurs here + | ------- `*s` is borrowed here LL | let x = &t.0; LL | *s = (2,); - | ^^^^^^^^^ assignment to borrowed `*s` occurs here + | ^^^^^^^^^ `*s` is assigned to here but it was already borrowed LL | *x | -- borrow later used here diff --git a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr index 45119018d..4a512560c 100644 --- a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr +++ b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | if { (|| { let bar = foo; bar.take() })(); false } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | if let Some(()) = { (|| { let bar = foo; bar.take() })(); None } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/nll/issue-27282-mutation-in-guard.stderr b/tests/ui/nll/issue-27282-mutation-in-guard.stderr index 1ba696593..0b5d72317 100644 --- a/tests/ui/nll/issue-27282-mutation-in-guard.stderr +++ b/tests/ui/nll/issue-27282-mutation-in-guard.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/nll/issue-27583.rs b/tests/ui/nll/issue-27583.rs new file mode 100644 index 000000000..84c94c7c9 --- /dev/null +++ b/tests/ui/nll/issue-27583.rs @@ -0,0 +1,47 @@ +// check-pass +// Regression test for issue #27583. Unclear how useful this will be +// going forward, since the issue in question was EXTREMELY sensitive +// to compiler internals (like the precise numbering of nodes), but +// what the hey. + +#![allow(warnings)] + +use std::cell::Cell; +use std::marker::PhantomData; + +pub trait Delegate<'tcx> { } + +pub struct InferCtxt<'a, 'tcx: 'a> { + x: PhantomData<&'a Cell<&'tcx ()>> +} + +pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> { + x: &'t InferCtxt<'a, 'tcx>, +} + +pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { + typer: &'t InferCtxt<'a, 'tcx>, + mc: MemCategorizationContext<'t, 'a, 'tcx>, + delegate: &'d mut (Delegate<'tcx>+'d), +} + +impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> { + pub fn new(delegate: &'d mut Delegate<'tcx>, + typer: &'t InferCtxt<'a, 'tcx>) + -> ExprUseVisitor<'d,'t,'a,'tcx> + { + ExprUseVisitor { + typer: typer, + mc: MemCategorizationContext::new(typer), + delegate: delegate, + } + } +} + +impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { + pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> { + MemCategorizationContext { x: typer } + } +} + +fn main() { } diff --git a/tests/ui/nll/issue-27868.stderr b/tests/ui/nll/issue-27868.stderr index e0b3b5494..204eda3d2 100644 --- a/tests/ui/nll/issue-27868.stderr +++ b/tests/ui/nll/issue-27868.stderr @@ -4,10 +4,10 @@ error[E0506]: cannot assign to `vecvec` because it is borrowed LL | vecvec[0] += { | ------ | | - | _____borrow of `vecvec` occurs here + | _____`vecvec` is borrowed here | | LL | | vecvec = vec![]; - | | ^^^^^^ assignment to borrowed `vecvec` occurs here + | | ^^^^^^ `vecvec` is assigned to here but it was already borrowed LL | | LL | | 0 LL | | }; diff --git a/tests/ui/nll/issue-46036.stderr b/tests/ui/nll/issue-46036.stderr index e6e95ee61..f337e2345 100644 --- a/tests/ui/nll/issue-46036.stderr +++ b/tests/ui/nll/issue-46036.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-46036.rs:8:24 | +LL | let a = 3; + | - binding `a` declared here LL | let foo = Foo { x: &a }; | ^^ | | diff --git a/tests/ui/nll/issue-48179.rs b/tests/ui/nll/issue-48179.rs new file mode 100644 index 000000000..f81203dc4 --- /dev/null +++ b/tests/ui/nll/issue-48179.rs @@ -0,0 +1,38 @@ +// Regression test for #48132. This was failing due to problems around +// the projection caching and dropck type enumeration. + +// check-pass + +pub struct Container { + value: Option, +} + +impl Container { + pub fn new(iter: T) -> Self { + panic!() + } +} + +pub struct Wrapper<'a> { + content: &'a Content, +} + +impl<'a, 'de> Wrapper<'a> { + pub fn new(content: &'a Content) -> Self { + Wrapper { + content: content, + } + } +} + +pub struct Content; + +fn crash_it(content: Content) { + let items = vec![content]; + let map = items.iter().map(|ref o| Wrapper::new(o)); + + let mut map_visitor = Container::new(map); + +} + +fn main() {} diff --git a/tests/ui/nll/issue-48803.stderr b/tests/ui/nll/issue-48803.stderr index 2f94039c0..e24606e0b 100644 --- a/tests/ui/nll/issue-48803.stderr +++ b/tests/ui/nll/issue-48803.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/issue-48803.rs:10:5 | LL | let y = &x; - | -- borrow of `x` occurs here + | -- `x` is borrowed here ... LL | x = "modified"; - | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^^^^^^^^^^^^^^ `x` is assigned to here but it was already borrowed LL | LL | println!("{}", w); // prints "modified" | - borrow later used here diff --git a/tests/ui/nll/issue-52057.rs b/tests/ui/nll/issue-52057.rs index 98f49fe8f..5991c1104 100644 --- a/tests/ui/nll/issue-52057.rs +++ b/tests/ui/nll/issue-52057.rs @@ -1,6 +1,6 @@ // Regression test for #52057. There is an implied bound -// that `I: 'a` where `'a` is the lifetime of `self` in `parse_first`; -// but to observe that, one must normalize first. +// that `I: 'x` where `'x` is the lifetime of the reference `&mut Self::Input` +// in `parse_first`; but to observe that, one must normalize first. // // run-pass diff --git a/tests/ui/nll/issue-52534-2.stderr b/tests/ui/nll/issue-52534-2.stderr index ac385e056..35d39bb6e 100644 --- a/tests/ui/nll/issue-52534-2.stderr +++ b/tests/ui/nll/issue-52534-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-52534-2.rs:6:13 | +LL | let x = 32; + | - binding `x` declared here LL | y = &x | ^^ borrowed value does not live long enough LL | diff --git a/tests/ui/nll/issue-52663-trait-object.stderr b/tests/ui/nll/issue-52663-trait-object.stderr index 5cedea6e6..338f64841 100644 --- a/tests/ui/nll/issue-52663-trait-object.stderr +++ b/tests/ui/nll/issue-52663-trait-object.stderr @@ -1,6 +1,8 @@ error[E0597]: `tmp0` does not live long enough --> $DIR/issue-52663-trait-object.rs:12:20 | +LL | let tmp0 = 3; + | ---- binding `tmp0` declared here LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough LL | Box::new(tmp1) as Box diff --git a/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index d8f43cbc9..4a32c777a 100644 --- a/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/tests/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -1,6 +1,9 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54382-use-span-of-tail-of-block.rs:7:29 | +LL | let mut _thing1 = D(Box::new("thing1")); + | ----------- binding `_thing1` declared here +... LL | D("other").next(&_thing1) | ----------------^^^^^^^^- | | | diff --git a/tests/ui/nll/issue-54556-niconii.stderr b/tests/ui/nll/issue-54556-niconii.stderr index a8e1edc54..d41d462f2 100644 --- a/tests/ui/nll/issue-54556-niconii.stderr +++ b/tests/ui/nll/issue-54556-niconii.stderr @@ -1,6 +1,9 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | +LL | let counter = Mutex; + | ------- binding `counter` declared here +LL | LL | if let Ok(_) = counter.lock() { } | ^^^^^^^^^^^^^^ | | diff --git a/tests/ui/nll/issue-54556-stephaneyfx.stderr b/tests/ui/nll/issue-54556-stephaneyfx.stderr index 036a7a0ab..f9e82cb00 100644 --- a/tests/ui/nll/issue-54556-stephaneyfx.stderr +++ b/tests/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,6 +1,8 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | +LL | let stmt = Statement; + | ---- binding `stmt` declared here LL | let rows = Rows(&stmt); | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() diff --git a/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index 92f5ffdf3..4eae9fdcd 100644 --- a/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,6 +1,9 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | +LL | let mut _thing1 = D(Box::new("thing1")); + | ----------- binding `_thing1` declared here +LL | // D("other").next(&_thing1).end() LL | D(&_thing1).end() | --^^^^^^^^- | | | diff --git a/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr b/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr index 25226e296..a2a7a8486 100644 --- a/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr +++ b/tests/ui/nll/issue-54556-used-vs-unused-tails.stderr @@ -2,11 +2,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55 | LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -17,11 +18,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -32,11 +34,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` - | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -47,11 +50,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -62,11 +66,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -77,11 +82,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped @@ -94,11 +100,12 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` - | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | | | - | | | `_t1` dropped here while still borrowed - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped @@ -111,12 +118,13 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` - | --^^^^- - - | | | | - | | | `_t1` dropped here while still borrowed - | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | @@ -127,12 +135,13 @@ error[E0597]: `_t1` does not live long enough --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` - | --^^^^- - - | | | | - | | | `_t1` dropped here while still borrowed - | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` - | | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... + | ------- --^^^^- - + | | | | | + | | | | `_t1` dropped here while still borrowed + | | | | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` + | | | borrowed value does not live long enough + | | a temporary with access to the borrow is created here ... + | binding `_t1` declared here | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped diff --git a/tests/ui/nll/issue-54556-wrap-it-up.stderr b/tests/ui/nll/issue-54556-wrap-it-up.stderr index 9f27fac15..adc419ae5 100644 --- a/tests/ui/nll/issue-54556-wrap-it-up.stderr +++ b/tests/ui/nll/issue-54556-wrap-it-up.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/issue-54556-wrap-it-up.rs:27:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/issue-55511.stderr b/tests/ui/nll/issue-55511.stderr index bf3e58e8c..ecb9ef0ae 100644 --- a/tests/ui/nll/issue-55511.stderr +++ b/tests/ui/nll/issue-55511.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-55511.rs:13:28 | +LL | let a = 22; + | - binding `a` declared here LL | let b = Some(Cell::new(&a)); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr index 6e96f40c0..d1e94bc70 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr @@ -1,8 +1,8 @@ -error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied +error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&())`, but its trait bounds were not satisfied --> $DIR/issue-57642-higher-ranked-subtype.rs:31:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds + | ^^^^^^ function or associated item cannot be called on `fn(&())` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `for<'a> fn(&'a ()): X` @@ -17,7 +17,7 @@ error[E0599]: no function or associated item named `make_f` found for fn pointer --> $DIR/issue-57642-higher-ranked-subtype.rs:35:25 | LL | let x = ::make_f(); - | ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())` + | ^^^^^^ function or associated item not found in `fn(&())` | = help: items from traits can only be used if the trait is implemented and in scope note: `Y` defines an item `make_f`, perhaps you need to implement it diff --git a/tests/ui/nll/issue-57989.stderr b/tests/ui/nll/issue-57989.stderr index 31f40d825..d5effd6f3 100644 --- a/tests/ui/nll/issue-57989.stderr +++ b/tests/ui/nll/issue-57989.stderr @@ -13,9 +13,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-57989.rs:5:5 | LL | let g = &x; - | -- borrow of `*x` occurs here + | -- `*x` is borrowed here LL | *x = 0; - | ^^^^^^ assignment to borrowed `*x` occurs here + | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | LL | g; | - borrow later used here diff --git a/tests/ui/nll/issue-68550.stderr b/tests/ui/nll/issue-68550.stderr index e234ebb04..851e36287 100644 --- a/tests/ui/nll/issue-68550.stderr +++ b/tests/ui/nll/issue-68550.stderr @@ -2,7 +2,9 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-68550.rs:12:20 | LL | fn run<'a, A>(x: A) - | -- lifetime `'a` defined here + | -- - binding `x` declared here + | | + | lifetime `'a` defined here ... LL | let _: &'a A = &x; | ----- ^^ borrowed value does not live long enough diff --git a/tests/ui/nll/issue-69114-static-mut-ty.stderr b/tests/ui/nll/issue-69114-static-mut-ty.stderr index 5e55cb502..1b41230d7 100644 --- a/tests/ui/nll/issue-69114-static-mut-ty.stderr +++ b/tests/ui/nll/issue-69114-static-mut-ty.stderr @@ -1,6 +1,9 @@ error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-mut-ty.rs:19:15 | +LL | let n = 42; + | - binding `n` declared here +LL | unsafe { LL | BAR = &n; | ------^^ | | | @@ -13,6 +16,9 @@ LL | } error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-mut-ty.rs:27:22 | +LL | let n = 42; + | - binding `n` declared here +LL | unsafe { LL | BAR_ELIDED = &n; | -------------^^ | | | diff --git a/tests/ui/nll/issue-69114-static-ty.stderr b/tests/ui/nll/issue-69114-static-ty.stderr index 0815e74b5..9215e850f 100644 --- a/tests/ui/nll/issue-69114-static-ty.stderr +++ b/tests/ui/nll/issue-69114-static-ty.stderr @@ -1,6 +1,8 @@ error[E0597]: `n` does not live long enough --> $DIR/issue-69114-static-ty.rs:7:9 | +LL | let n = 42; + | - binding `n` declared here LL | FOO(&n); | ----^^- | | | diff --git a/tests/ui/nll/issue-73159-rpit-static.stderr b/tests/ui/nll/issue-73159-rpit-static.stderr index 260b9b597..4d3a90153 100644 --- a/tests/ui/nll/issue-73159-rpit-static.stderr +++ b/tests/ui/nll/issue-73159-rpit-static.stderr @@ -4,6 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | impl<'a> Foo<'a> { | -- hidden type `Copied>` captures the lifetime `'a` as defined here LL | fn make_it(&self) -> impl Iterator { + | ------------------------ opaque type defined here LL | self.0.iter().copied() | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/nll/issue-75777.rs b/tests/ui/nll/issue-75777.rs new file mode 100644 index 000000000..a1e438bc6 --- /dev/null +++ b/tests/ui/nll/issue-75777.rs @@ -0,0 +1,15 @@ +// Regression test for #75777. +// Checks that a boxed future can be properly constructed. + +use std::future::{self, Future}; +use std::pin::Pin; + +type BoxFuture<'a, T> = Pin + 'a + Send>>; + +fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box BoxFuture<'a, A>> { + let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); + Box::new(move |_| fut) + //~^ ERROR: lifetime may not live long enough +} + +fn main() {} diff --git a/tests/ui/nll/issue-75777.stderr b/tests/ui/nll/issue-75777.stderr new file mode 100644 index 000000000..370cd72fd --- /dev/null +++ b/tests/ui/nll/issue-75777.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-75777.rs:11:5 + | +LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box BoxFuture<'a, A>> { + | -- lifetime `'a` defined here +LL | let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); +LL | Box::new(move |_| fut) + | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/nll/loan_ends_mid_block_pair.stderr b/tests/ui/nll/loan_ends_mid_block_pair.stderr index eb8442b31..58e378ab0 100644 --- a/tests/ui/nll/loan_ends_mid_block_pair.stderr +++ b/tests/ui/nll/loan_ends_mid_block_pair.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `data.0` because it is borrowed --> $DIR/loan_ends_mid_block_pair.rs:12:5 | LL | let c = &mut data.0; - | ----------- borrow of `data.0` occurs here + | ----------- `data.0` is borrowed here LL | capitalize(c); LL | data.0 = 'e'; - | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here + | ^^^^^^^^^^^^ `data.0` is assigned to here but it was already borrowed ... LL | capitalize(c); | - borrow later used here diff --git a/tests/ui/nll/local-outlives-static-via-hrtb.stderr b/tests/ui/nll/local-outlives-static-via-hrtb.stderr index f5c10f3dd..a6b3328b5 100644 --- a/tests/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/tests/ui/nll/local-outlives-static-via-hrtb.stderr @@ -1,6 +1,8 @@ error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:24:28 | +LL | let local = 0; + | ----- binding `local` declared here LL | assert_static_via_hrtb(&local); | -----------------------^^^^^^- | | | @@ -19,6 +21,9 @@ LL | fn assert_static_via_hrtb(_: G) where for<'a> G: Outlives<'a> {} error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:25:45 | +LL | let local = 0; + | ----- binding `local` declared here +LL | assert_static_via_hrtb(&local); LL | assert_static_via_hrtb_with_assoc_type(&&local); | ----------------------------------------^^^^^^- | | | diff --git a/tests/ui/nll/match-cfg-fake-edges2.stderr b/tests/ui/nll/match-cfg-fake-edges2.stderr index c6d15a936..36f2cd0b8 100644 --- a/tests/ui/nll/match-cfg-fake-edges2.stderr +++ b/tests/ui/nll/match-cfg-fake-edges2.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `y.1` because it was mutably borrowed --> $DIR/match-cfg-fake-edges2.rs:8:5 | LL | let r = &mut y.1; - | -------- borrow of `y.1` occurs here + | -------- `y.1` is borrowed here ... LL | match y { | ^^^^^^^ use of borrowed `y.1` diff --git a/tests/ui/nll/match-guards-always-borrow.stderr b/tests/ui/nll/match-guards-always-borrow.stderr index fa01d3a6f..afd853c40 100644 --- a/tests/ui/nll/match-guards-always-borrow.stderr +++ b/tests/ui/nll/match-guards-always-borrow.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -14,7 +14,7 @@ error[E0507]: cannot move out of `foo` in pattern guard LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | - | move out of `foo` occurs here + | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/tests/ui/nll/match-guards-partially-borrow.stderr b/tests/ui/nll/match-guards-partially-borrow.stderr index 60b8dee71..7bdcbcb9c 100644 --- a/tests/ui/nll/match-guards-partially-borrow.stderr +++ b/tests/ui/nll/match-guards-partially-borrow.stderr @@ -74,9 +74,9 @@ error[E0506]: cannot assign to `t` because it is borrowed --> $DIR/match-guards-partially-borrow.rs:225:13 | LL | s if { - | - borrow of `t` occurs here + | - `t` is borrowed here LL | t = !t; - | ^^^^^^ assignment to borrowed `t` occurs here + | ^^^^^^ `t` is assigned to here but it was already borrowed LL | false LL | } => (), // What value should `s` have in the arm? | - borrow later used here @@ -85,9 +85,9 @@ error[E0506]: cannot assign to `t` because it is borrowed --> $DIR/match-guards-partially-borrow.rs:235:13 | LL | s if let Some(()) = { - | - borrow of `t` occurs here + | - `t` is borrowed here LL | t = !t; - | ^^^^^^ assignment to borrowed `t` occurs here + | ^^^^^^ `t` is assigned to here but it was already borrowed LL | None LL | } => (), // What value should `s` have in the arm? | - borrow later used here diff --git a/tests/ui/nll/match-on-borrowed.stderr b/tests/ui/nll/match-on-borrowed.stderr index 32666529f..927348456 100644 --- a/tests/ui/nll/match-on-borrowed.stderr +++ b/tests/ui/nll/match-on-borrowed.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:47:11 | LL | E::V(ref mut x, _) => x, - | --------- borrow of `e.0` occurs here + | --------- `e.0` is borrowed here ... LL | match e { // Don't know that E uses a tag for its discriminant | ^ use of borrowed `e.0` @@ -14,7 +14,7 @@ error[E0503]: cannot use `*f` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:61:11 | LL | E::V(ref mut x, _) => x, - | --------- borrow of `f.0` occurs here + | --------- `f.0` is borrowed here ... LL | match f { // Don't know that E uses a tag for its discriminant | ^ use of borrowed `f.0` @@ -26,7 +26,7 @@ error[E0503]: cannot use `t` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:81:5 | LL | let x = &mut t; - | ------ borrow of `t` occurs here + | ------ `t` is borrowed here LL | match t { | ^^^^^^^ use of borrowed `t` ... diff --git a/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index 80e297807..55646b9dc 100644 --- a/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/tests/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:17:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr b/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr index 14074472e..c89f94a78 100644 --- a/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr +++ b/tests/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-with-fragment.rs:19:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index 91c0afc1d..90db13bc5 100644 --- a/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/tests/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:20:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | // FIXME ^ This currently errors and it should not. LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/tests/ui/nll/maybe-initialized-drop.stderr b/tests/ui/nll/maybe-initialized-drop.stderr index 9825ba461..15a53a09a 100644 --- a/tests/ui/nll/maybe-initialized-drop.stderr +++ b/tests/ui/nll/maybe-initialized-drop.stderr @@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/maybe-initialized-drop.rs:14:5 | LL | let wrap = Wrap { p: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x = 1; - | ^^^^^ assignment to borrowed `x` occurs here + | ^^^^^ `x` is assigned to here but it was already borrowed LL | } | - borrow might be used here, when `wrap` is dropped and runs the `Drop` code for type `Wrap` diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs new file mode 100644 index 000000000..52ea0f28d --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.rs @@ -0,0 +1,43 @@ +// ... continued from ./min-choice.rs + +// check-fail + +trait Cap<'a> {} +impl Cap<'_> for T {} + +fn type_test<'a, T: 'a>() -> &'a u8 { &0 } + +// Make sure we don't pick `'b`. +fn test_b<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'b, +{ + type_test::<'_, T>() // This should pass if we pick 'b. + //~^ ERROR the parameter type `T` may not live long enough +} + +// Make sure we don't pick `'c`. +fn test_c<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'c, +{ + type_test::<'_, T>() // This should pass if we pick 'c. + //~^ ERROR the parameter type `T` may not live long enough +} + +// We need to pick min_choice from `['b, 'c]`, but it's ambiguous which one to pick because +// they're incomparable. +fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, +{ + s + //~^ ERROR captures lifetime that does not appear in bounds +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr new file mode 100644 index 000000000..e0d476a33 --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr @@ -0,0 +1,42 @@ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/min-choice-reject-ambiguous.rs:17:5 + | +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... + | +LL | T: 'b + 'a, + | ++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/min-choice-reject-ambiguous.rs:28:5 + | +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... + | +LL | T: 'c + 'a, + | ++++ + +error[E0700]: hidden type for `impl Cap<'b> + Cap<'c>` captures lifetime that does not appear in bounds + --> $DIR/min-choice-reject-ambiguous.rs:39:5 + | +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + | -- ---------------------- opaque type defined here + | | + | hidden type `&'a u8` captures the lifetime `'a` as defined here +... +LL | s + | ^ + | +help: to declare that `impl Cap<'b> + Cap<'c>` captures `'a`, you can add an explicit `'a` lifetime bound + | +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + 'a + | ++++ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0309, E0700. +For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/nll/member-constraints/min-choice.rs b/tests/ui/nll/member-constraints/min-choice.rs new file mode 100644 index 000000000..14b4dae7a --- /dev/null +++ b/tests/ui/nll/member-constraints/min-choice.rs @@ -0,0 +1,34 @@ +// Assuming that the hidden type in these tests is `&'_#15r u8`, +// we have a member constraint: `'_#15r member ['static, 'a, 'b, 'c]`. +// +// Make sure we pick up the minimum non-ambiguous region among them. +// We will have to exclude `['b, 'c]` because they're incomparable, +// and then we should pick `'a` because we know `'static: 'a`. + +// check-pass + +trait Cap<'a> {} +impl Cap<'_> for T {} + +fn type_test<'a, T: 'a>() -> &'a u8 { &0 } + +// Basic test: make sure we don't bail out because 'b and 'c are incomparable. +fn basic<'a, 'b, 'c>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, +{ + &0 +} + +// Make sure we don't pick `'static`. +fn test_static<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c> +where + 'a: 'b, + 'a: 'c, + T: 'a, +{ + type_test::<'_, T>() // This will fail if we pick 'static +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs new file mode 100644 index 000000000..66ff828a8 --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs @@ -0,0 +1,33 @@ +// Nested impl-traits can impose different member constraints on the same region variable. + +// check-fail + +trait Cap<'a> {} +impl Cap<'_> for T {} + +// Assuming the hidden type is `[&'_#15r u8; 1]`, we have two distinct member constraints: +// - '_#15r member ['static, 'a, 'b] // from outer impl-trait +// - '_#15r member ['static, 'a, 'b] // from inner impl-trait +// To satisfy both we can choose 'a or 'b, so it's a failure due to ambiguity. +fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> +where + 's: 'a, + 's: 'b, +{ + [a] + //~^ E0700 + //~| E0700 +} + +// Same as the above but with late-bound regions. +fn fail_late_bound<'s, 'a, 'b>( + a: &'s u8, + _: &'a &'s u8, + _: &'b &'s u8, +) -> impl IntoIterator + Cap<'b>> { + [a] + //~^ E0700 + //~| E0700 +} + +fn main() {} diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr new file mode 100644 index 000000000..483b5822b --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr @@ -0,0 +1,83 @@ +error[E0700]: hidden type for `impl IntoIterator + Cap<'b>>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:17:5 + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> + | -- ------------------------------------------------ opaque type defined here + | | + | hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here +... +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> + 's + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b> + 's> + | ++++ + +error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:17:5 + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> + | -- ---------------------- opaque type defined here + | | + | hidden type `&'s u8` captures the lifetime `'s` as defined here +... +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> + 's + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b> + 's> + | ++++ + +error[E0700]: hidden type for `impl IntoIterator + Cap<'b>>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:28:5 + | +LL | fn fail_late_bound<'s, 'a, 'b>( + | -- hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here +... +LL | ) -> impl IntoIterator + Cap<'b>> { + | ------------------------------------------------ opaque type defined here +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator + Cap<'b>> + 's { + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator + Cap<'b> + 's> { + | ++++ + +error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds + --> $DIR/nested-impl-trait-fail.rs:28:5 + | +LL | fn fail_late_bound<'s, 'a, 'b>( + | -- hidden type `&'s u8` captures the lifetime `'s` as defined here +... +LL | ) -> impl IntoIterator + Cap<'b>> { + | ---------------------- opaque type defined here +LL | [a] + | ^^^ + | +help: to declare that `impl IntoIterator + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator + Cap<'b>> + 's { + | ++++ +help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | ) -> impl IntoIterator + Cap<'b> + 's> { + | ++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs b/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs new file mode 100644 index 000000000..15540cb46 --- /dev/null +++ b/tests/ui/nll/member-constraints/nested-impl-trait-pass.rs @@ -0,0 +1,29 @@ +// Nested impl-traits can impose different member constraints on the same region variable. + +// check-pass + +trait Cap<'a> {} +impl Cap<'_> for T {} + +// Assuming the hidden type is `[&'_#15r u8; 1]`, we have two distinct member constraints: +// - '_#15r member ['static, 'a, 'b] // from outer impl-trait +// - '_#15r member ['static, 'a] // from inner impl-trait +// To satisfy both we can only choose 'a. +fn pass_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator> + Cap<'b> +where + 's: 'a, + 's: 'b, +{ + [a] +} + +// Same as the above but with late-bound regions. +fn pass_late_bound<'s, 'a, 'b>( + a: &'s u8, + _: &'a &'s u8, + _: &'b &'s u8, +) -> impl IntoIterator> + Cap<'b> { + [a] +} + +fn main() {} diff --git a/tests/ui/nll/outlives-suggestion-simple.stderr b/tests/ui/nll/outlives-suggestion-simple.stderr index a8368c494..bcffd575a 100644 --- a/tests/ui/nll/outlives-suggestion-simple.stderr +++ b/tests/ui/nll/outlives-suggestion-simple.stderr @@ -73,7 +73,7 @@ LL | impl<'a> Bar<'a> { LL | pub fn get<'b>(&self) -> &'b usize { | -- lifetime `'b` defined here LL | self.x - | ^^^^^^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | ^^^^^^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` @@ -85,7 +85,7 @@ LL | impl<'a> Baz<'a> { LL | fn get<'b>(&'b self) -> &'a i32 { | -- lifetime `'b` defined here LL | self.x - | ^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | ^^^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | = help: consider adding the following bound: `'b: 'a` diff --git a/tests/ui/nll/polonius/polonius-smoke-test.stderr b/tests/ui/nll/polonius/polonius-smoke-test.stderr index fa1a6a9c9..534813b2d 100644 --- a/tests/ui/nll/polonius/polonius-smoke-test.stderr +++ b/tests/ui/nll/polonius/polonius-smoke-test.stderr @@ -8,7 +8,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/polonius-smoke-test.rs:12:13 | LL | let y = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | let z = x; | ^ use of borrowed `x` LL | let w = y; @@ -18,7 +18,9 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/polonius-smoke-test.rs:18:13 | LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { - | - let's call the lifetime of this reference `'1` + | - - let's call the lifetime of this reference `'1` + | | + | binding `x` declared here LL | let y = &mut *x; | ------- borrow of `*x` occurs here LL | let z = x; @@ -29,6 +31,8 @@ LL | y error[E0505]: cannot move out of `s` because it is borrowed --> $DIR/polonius-smoke-test.rs:42:5 | +LL | let s = &mut 1; + | - binding `s` declared here LL | let r = &mut *s; | ------- borrow of `*s` occurs here LL | let tmp = foo(&r); diff --git a/tests/ui/nll/promoted-bounds.stderr b/tests/ui/nll/promoted-bounds.stderr index df347f4e7..d111256b8 100644 --- a/tests/ui/nll/promoted-bounds.stderr +++ b/tests/ui/nll/promoted-bounds.stderr @@ -4,6 +4,7 @@ error[E0597]: `l` does not live long enough LL | let ptr = { | --- borrow later stored here LL | let l = 3; + | - binding `l` declared here LL | let b = &l; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/reference-carried-through-struct-field.stderr b/tests/ui/nll/reference-carried-through-struct-field.stderr index 56d878e43..5672b9cd7 100644 --- a/tests/ui/nll/reference-carried-through-struct-field.stderr +++ b/tests/ui/nll/reference-carried-through-struct-field.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/reference-carried-through-struct-field.rs:6:5 | LL | let wrapper = Wrap { w: &mut x }; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | x += 1; | ^^^^^^ use of borrowed `x` LL | *wrapper.w += 1; diff --git a/tests/ui/nll/relate_tys/var-appears-twice.stderr b/tests/ui/nll/relate_tys/var-appears-twice.stderr index d032ce6f2..ff6ea598f 100644 --- a/tests/ui/nll/relate_tys/var-appears-twice.stderr +++ b/tests/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,6 +1,9 @@ error[E0597]: `b` does not live long enough --> $DIR/var-appears-twice.rs:20:38 | +LL | let b = 44; + | - binding `b` declared here +... LL | let x: DoubleCell<_> = make_cell(&b); | ------------- ^^ borrowed value does not live long enough | | diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 7b9ed171d..7fcb68252 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::fo --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | -- hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here + | -- ------------ opaque type defined here + | | + | hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here LL | x | ^ | 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 dbda04c42..11ada59c0 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -110,7 +110,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where >::AssocType: '_#3r note: no external requirements --> $DIR/projection-one-region-closure.rs:62:1 diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 250c796e2..47d4f2e46 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -86,7 +86,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where >::AssocType: '_#3r note: no external requirements --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 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 90f049142..530dd8681 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 @@ -11,7 +11,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '_#4r = note: number of external vids: 5 - = note: where >::AssocType: '_#3r + = note: where >::AssocType: '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 @@ -23,14 +23,14 @@ LL | | T: Anything<'b, 'c>, | = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> -error[E0309]: the associated type `>::AssocType` may not live long enough +error[E0309]: the associated type `>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:38:39 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... - = note: ...so that the type `>::AssocType` will meet its required lifetime bounds + = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... + = note: ...so that the type `>::AssocType` will meet its required lifetime bounds note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -44,7 +44,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where >::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 @@ -57,14 +57,14 @@ LL | | 'a: 'a, | = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> -error[E0309]: the associated type `>::AssocType` may not live long enough +error[E0309]: the associated type `>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:48:39 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... - = note: ...so that the type `>::AssocType` will meet its required lifetime bounds + = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... + = note: ...so that the type `>::AssocType` will meet its required lifetime bounds note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 @@ -78,7 +78,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where >::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 @@ -103,7 +103,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where >::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 @@ -128,7 +128,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 5 - = note: where >::AssocType: '_#4r + = note: where >::AssocType: '_#4r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 @@ -154,7 +154,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '_#3r = note: number of external vids: 4 - = note: where >::AssocType: '_#2r + = note: where >::AssocType: '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 @@ -194,7 +194,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where >::AssocType: '_#3r + = note: where >::AssocType: '_#3r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 @@ -219,7 +219,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 3 - = note: where >::AssocType: '_#2r + = note: where >::AssocType: '_#2r note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 diff --git a/tests/ui/nll/user-annotations/adt-brace-enums.stderr b/tests/ui/nll/user-annotations/adt-brace-enums.stderr index 253e38251..9e94fd5a7 100644 --- a/tests/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-enums.rs:25:48 | +LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-brace-structs.stderr b/tests/ui/nll/user-annotations/adt-brace-structs.stderr index 8b9d1705d..cbb7f6a55 100644 --- a/tests/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/tests/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-structs.rs:23:37 | +LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'static u32> { t: &c }; | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr index 3326fa521..bca85a90d 100644 --- a/tests/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-nullary-enums.rs:33:41 | +LL | let c = 66; + | - binding `c` declared here LL | / combine( LL | | SomeEnum::SomeVariant(Cell::new(&c)), | | ^^ borrowed value does not live long enough @@ -15,7 +17,9 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let c = 66; + | - binding `c` declared here +LL | combine( LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-enums.stderr b/tests/ui/nll/user-annotations/adt-tuple-enums.stderr index 2fa704263..d2d85ec2b 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-enums.rs:28:43 | +LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'static u32>(&c); | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr index 9664fb9f5..b7bc2a10b 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-struct-calls.stderr @@ -1,6 +1,9 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct-calls.rs:27:7 | +LL | let c = 66; + | - binding `c` declared here +LL | let f = SomeStruct::<&'static u32>; LL | f(&c); | --^^- | | | @@ -14,7 +17,9 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let c = 66; + | - binding `c` declared here +LL | let f = SomeStruct::<&'a u32>; LL | f(&c); | --^^- | | | diff --git a/tests/ui/nll/user-annotations/adt-tuple-struct.stderr b/tests/ui/nll/user-annotations/adt-tuple-struct.stderr index 76b525225..97d39da26 100644 --- a/tests/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/tests/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct.rs:23:32 | +LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'static u32>(&c); | ^^ | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | SomeStruct::<&'a u32>(&c); | ^^ | | diff --git a/tests/ui/nll/user-annotations/cast_static_lifetime.stderr b/tests/ui/nll/user-annotations/cast_static_lifetime.stderr index 4599d04e7..3b9363c41 100644 --- a/tests/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/tests/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/cast_static_lifetime.rs:5:19 | +LL | let x = 22_u32; + | - binding `x` declared here LL | let y: &u32 = (&x) as &'static u32; | ^^^^---------------- | | diff --git a/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr index 12065a85a..f164255ef 100644 --- a/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ b/tests/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:23:9 | +LL | let x = (); + | - binding `x` declared here LL | FUN(&x); | ----^^- | | | @@ -13,6 +15,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:24:23 | +LL | let x = (); + | - binding `x` declared here +LL | FUN(&x); LL | A::ASSOCIATED_FUN(&x); | ------------------^^- | | | @@ -25,6 +30,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:25:28 | +LL | let x = (); + | - binding `x` declared here +... LL | B::ALSO_ASSOCIATED_FUN(&x); | -----------------------^^- | | | @@ -37,6 +45,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:26:31 | +LL | let x = (); + | - binding `x` declared here +... LL | <_>::TRAIT_ASSOCIATED_FUN(&x); | --------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/fns.stderr b/tests/ui/nll/user-annotations/fns.stderr index e0640da39..8b53e138d 100644 --- a/tests/ui/nll/user-annotations/fns.stderr +++ b/tests/ui/nll/user-annotations/fns.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/fns.rs:23:29 | +LL | let c = 66; + | - binding `c` declared here LL | some_fn::<&'static u32>(&c); | ------------------------^^- | | | @@ -15,6 +17,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; + | - binding `c` declared here LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-call.stderr b/tests/ui/nll/user-annotations/method-call.stderr index 10447e45a..3803cbf77 100644 --- a/tests/ui/nll/user-annotations/method-call.stderr +++ b/tests/ui/nll/user-annotations/method-call.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/method-call.rs:36:34 | +LL | let c = 66; + | - binding `c` declared here LL | a.method::<&'static u32>(b, &c); | -----------------------------^^- | | | @@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... +LL | let c = 66; + | - binding `c` declared here LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-1.stderr b/tests/ui/nll/user-annotations/method-ufcs-1.stderr index 962ddfd2b..c7c08c948 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,6 +1,9 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-1.rs:30:7 | +LL | let a = 22; + | - binding `a` declared here +... LL | x(&a, b, c); | --^^------- | | | @@ -14,6 +17,8 @@ error[E0597]: `a` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here +LL | let a = 22; + | - binding `a` declared here ... LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | -------------------------------^^------- diff --git a/tests/ui/nll/user-annotations/method-ufcs-2.stderr b/tests/ui/nll/user-annotations/method-ufcs-2.stderr index 63d59905e..b7861a3bd 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,6 +1,9 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-2.rs:30:7 | +LL | let a = 22; + | - binding `a` declared here +... LL | x(&a, b, c); | --^^------- | | | @@ -14,7 +17,10 @@ error[E0597]: `b` does not live long enough | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here -... +LL | let a = 22; +LL | let b = 44; + | - binding `b` declared here +LL | let c = 66; LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | ----------------------------------^^---- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-3.stderr b/tests/ui/nll/user-annotations/method-ufcs-3.stderr index e7851833e..8cb995a03 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/method-ufcs-3.rs:36:53 | +LL | let c = 66; + | - binding `c` declared here LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); | ------------------------------------------------^^- | | | @@ -15,6 +17,8 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... +LL | let c = 66; + | - binding `c` declared here LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr index 94861babd..fb26b8d09 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-1.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new(&v, 22); | -------------^^----- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr index 06f20d9b2..03b97447e 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-2.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new::<&'a u32>(&v, &v); | ------------------------^^----- | | | @@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = A::<'a>::new::<&'a u32>(&v, &v); | ----------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr index 4ad61dc81..69dd1d1aa 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-3.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = >::new(&v, 22); | -------------^^----- | | | diff --git a/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr b/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr index 0f83e99cd..66d82bb49 100644 --- a/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr +++ b/tests/ui/nll/user-annotations/method-ufcs-inherent-4.stderr @@ -4,6 +4,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = >::new::<&'a u32>(&v, &v); | ------------------------^^----- | | | @@ -19,6 +20,7 @@ error[E0597]: `v` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let v = 22; + | - binding `v` declared here LL | let x = >::new::<&'a u32>(&v, &v); | ----------------------------^^- | | | diff --git a/tests/ui/nll/user-annotations/normalization.stderr b/tests/ui/nll/user-annotations/normalization.stderr index 975cb4b66..acc3a1800 100644 --- a/tests/ui/nll/user-annotations/normalization.stderr +++ b/tests/ui/nll/user-annotations/normalization.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:10:31 | +LL | let a = 22; + | - binding `a` declared here LL | let _: <() as Foo>::Out = &a; | ---------------- ^^ borrowed value does not live long enough | | @@ -12,6 +14,8 @@ LL | } error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:13:40 | +LL | let a = 22; + | - binding `a` declared here LL | let _: <&'static () as Foo>::Out = &a; | ------------------------- ^^ borrowed value does not live long enough | | diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr index a97e7a9fd..3e7969e11 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr index 408d7c2a5..89a1e9545 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_struct.rs:5:28 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_brace_struct.rs:12:28 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr index 920c906f6..8efeecc77 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr index 3f01638d8..d7f1dac88 100644 --- a/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ b/tests/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_struct.rs:5:19 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough LL | @@ -12,6 +14,8 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/pattern_substs_on_tuple_struct.rs:12:19 | +LL | let y = 22; + | - binding `y` declared here LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/nll/user-annotations/patterns.stderr b/tests/ui/nll/user-annotations/patterns.stderr index de6f8f80f..8bb714f1d 100644 --- a/tests/ui/nll/user-annotations/patterns.stderr +++ b/tests/ui/nll/user-annotations/patterns.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:6:9 | +LL | let x = 22; + | - binding `x` declared here LL | let y: &'static u32; | ------------ type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -11,6 +13,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:14:9 | +LL | let x = 22; + | - binding `x` declared here LL | let (y, z): (&'static u32, &'static u32); | ---------------------------- type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -21,6 +25,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:20:13 | +LL | let x = 22; + | - binding `x` declared here LL | let y = &x; | ^^ borrowed value does not live long enough LL | let ref z: &'static u32 = y; @@ -32,6 +38,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:39:9 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: y }: Single<&'static u32>; | -------------------- type annotation requires that `x` is borrowed for `'static` LL | y = &x; @@ -42,6 +50,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:51:10 | +LL | let x = 22; + | - binding `x` declared here LL | let Single2 { value: mut _y }: Single2; | ------------------ type annotation requires that `x` is borrowed for `'static` LL | _y = &x; @@ -52,6 +62,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:56:27 | +LL | let x = 22; + | - binding `x` declared here LL | let y: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | @@ -62,6 +74,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:61:27 | +LL | let x = 22; + | - binding `x` declared here LL | let _: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | @@ -100,6 +114,8 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:75:40 | +LL | let x = 22; + | - binding `x` declared here LL | let (_, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | @@ -110,6 +126,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:80:40 | +LL | let x = 22; + | - binding `x` declared here LL | let (y, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | @@ -120,6 +138,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:85:69 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | @@ -130,6 +150,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:90:69 | +LL | let x = 22; + | - binding `x` declared here LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | @@ -140,6 +162,8 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:98:17 | +LL | let x = 22; + | - binding `x` declared here LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double { | -------------------- type annotation requires that `x` is borrowed for `'static` LL | value1: &x, diff --git a/tests/ui/nll/user-annotations/promoted-annotation.stderr b/tests/ui/nll/user-annotations/promoted-annotation.stderr index cb99a6a36..132a00ba4 100644 --- a/tests/ui/nll/user-annotations/promoted-annotation.stderr +++ b/tests/ui/nll/user-annotations/promoted-annotation.stderr @@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here LL | let x = 0; + | - binding `x` declared here LL | let f = &drop::<&'a i32>; | ---------------- assignment requires that `x` is borrowed for `'a` LL | f(&x); diff --git a/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index ccbf3c1d9..766877f88 100644 --- a/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/tests/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/type_ascription_static_lifetime.rs:6:33 | +LL | let x = 22_u32; + | - binding `x` declared here LL | let y: &u32 = type_ascribe!(&x, &'static u32); | --------------^^--------------- | | | diff --git a/tests/ui/noexporttypeexe.rs b/tests/ui/noexporttypeexe.rs index 964ac9a30..d473ad6c9 100644 --- a/tests/ui/noexporttypeexe.rs +++ b/tests/ui/noexporttypeexe.rs @@ -11,5 +11,5 @@ fn main() { //~^ ERROR mismatched types //~| expected type `isize` //~| found enum `Option` - //~| expected `isize`, found enum `Option` + //~| expected `isize`, found `Option` } diff --git a/tests/ui/noexporttypeexe.stderr b/tests/ui/noexporttypeexe.stderr index 7fc239613..26bafd31d 100644 --- a/tests/ui/noexporttypeexe.stderr +++ b/tests/ui/noexporttypeexe.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/noexporttypeexe.rs:10:18 | LL | let x: isize = noexporttypelib::foo(); - | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found enum `Option` + | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `Option` | | | expected due to this | diff --git a/tests/ui/non-ice-error-on-worker-io-fail.rs b/tests/ui/non-ice-error-on-worker-io-fail.rs deleted file mode 100644 index 134e7d420..000000000 --- a/tests/ui/non-ice-error-on-worker-io-fail.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Issue #66530: We would ICE if someone compiled with `-o /dev/null`, -// because we would try to generate auxiliary files in `/dev/` (which -// at least the OS X file system rejects). -// -// An attempt to `-o` into a directory we cannot write into should indeed -// be an error; but not an ICE. -// -// However, some folks run tests as root, which can write `/dev/` and end -// up clobbering `/dev/null`. Instead we'll use a non-existent path, which -// also used to ICE, but even root can't magically write there. - -// compile-flags: -o /does-not-exist/output - -// The error-pattern check occurs *before* normalization, and the error patterns -// are wildly different between build environments. So this is a cop-out (and we -// rely on the checking of the normalized stderr output as our actual -// "verification" of the diagnostic). - -// error-pattern: error - -// On Mac OS X, we get an error like the below -// normalize-stderr-test "failed to write bytecode to /does-not-exist/output.non_ice_error_on_worker_io_fail.*" -> "io error modifying /does-not-exist/" - -// On Linux, we get an error like the below -// normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /does-not-exist/" - -// ignore-windows - this is a unix-specific test -// ignore-emscripten - the file-system issues do not replicate here -// ignore-wasm - the file-system issues do not replicate here -// ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu - -#![crate_type="lib"] - -#![cfg_attr(not(feature = "std"), no_std)] -pub mod task { - pub mod __internal { - use crate::task::Waker; - } - pub use core::task::Waker; -} diff --git a/tests/ui/non-ice-error-on-worker-io-fail.stderr b/tests/ui/non-ice-error-on-worker-io-fail.stderr deleted file mode 100644 index edadecf27..000000000 --- a/tests/ui/non-ice-error-on-worker-io-fail.stderr +++ /dev/null @@ -1,6 +0,0 @@ -warning: ignoring --out-dir flag due to -o flag - -error: io error modifying /does-not-exist/ - -error: aborting due to previous error; 1 warning emitted - diff --git a/tests/ui/numbers-arithmetic/issue-105626.rs b/tests/ui/numbers-arithmetic/issue-105626.rs new file mode 100644 index 000000000..f97edd510 --- /dev/null +++ b/tests/ui/numbers-arithmetic/issue-105626.rs @@ -0,0 +1,17 @@ +// run-pass +// only-x86 +// min-system-llvm-version: 16 +// compile-flags: -Ctarget-feature=+sse2 + +use std::hint::black_box; + +fn main() { + let n: i64 = black_box(0x3fffffdfffffff); + let r = f32::from_bits(0x5a7fffff); + + assert_ne!((n as f64) as f32, n as f32); + + // FIXME: these assertions fail if only x87 is enabled + assert_eq!(n as i64 as f32, r); + assert_eq!(n as u64 as f32, r); +} diff --git a/tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs b/tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs index 79d78da33..0e487a700 100644 --- a/tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs +++ b/tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs @@ -1,5 +1,5 @@ // run-pass -// compile-flags: -C debug_assertions=yes +// compile-flags: -C debug_assertions=true // needs-unwind // ignore-emscripten dies with an LLVM error diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index a477425ed..2c8df3b61 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -20,7 +20,7 @@ error[E0599]: no method named `managed` found for struct `Box<(dyn Foo + 'static --> $DIR/object-pointer-types.rs:23:7 | LL | x.managed(); - | ^^^^^^^ method not found in `Box<(dyn Foo + 'static)>` + | ^^^^^^^ method not found in `Box` error: aborting due to 3 previous errors 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 f05b0cd65..40429fe75 100644 --- a/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr +++ b/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr @@ -1,5 +1,10 @@ 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: for<'a> GatTrait = 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 diff --git a/tests/ui/optimization-remark.rs b/tests/ui/optimization-remark.rs index d4b39c670..4f651b1dc 100644 --- a/tests/ui/optimization-remark.rs +++ b/tests/ui/optimization-remark.rs @@ -1,6 +1,5 @@ // build-pass // ignore-pass -// min-llvm-version: 14.0.0 // revisions: all inline merge1 merge2 // compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2 // diff --git a/tests/ui/or-patterns/already-bound-name.stderr b/tests/ui/or-patterns/already-bound-name.stderr index 368782c1e..795c46acb 100644 --- a/tests/ui/or-patterns/already-bound-name.stderr +++ b/tests/ui/or-patterns/already-bound-name.stderr @@ -88,7 +88,7 @@ error[E0308]: mismatched types LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1)); | - ^ ------- this expression has type `E>` | | | - | | expected integer, found enum `E` + | | expected integer, found `E<{integer}>` | first introduced with type `{integer}` here | = note: expected type `{integer}` diff --git a/tests/ui/or-patterns/nested-undelimited-precedence.stderr b/tests/ui/or-patterns/nested-undelimited-precedence.stderr index 2e25d8b3e..5a63e621f 100644 --- a/tests/ui/or-patterns/nested-undelimited-precedence.stderr +++ b/tests/ui/or-patterns/nested-undelimited-precedence.stderr @@ -42,7 +42,7 @@ error[E0308]: mismatched types LL | let &A(_) | B(_): F = A(3); | ^^^^^ - expected due to this | | - | expected enum `F`, found reference + | expected `F`, found `&_` | = note: expected enum `F` found reference `&_` @@ -53,7 +53,7 @@ error[E0308]: mismatched types LL | let &&A(_) | B(_): F = A(3); | ^^^^^^ - expected due to this | | - | expected enum `F`, found reference + | expected `F`, found `&_` | = note: expected enum `F` found reference `&_` @@ -64,7 +64,7 @@ error[E0308]: mismatched types LL | let &mut A(_) | B(_): F = A(3); | ^^^^^^^^^ - expected due to this | | - | expected enum `F`, found `&mut _` + | expected `F`, found `&mut _` | = note: expected enum `F` found mutable reference `&mut _` @@ -75,7 +75,7 @@ error[E0308]: mismatched types LL | let &&mut A(_) | B(_): F = A(3); | ^^^^^^^^^^ - expected due to this | | - | expected enum `F`, found reference + | expected `F`, found `&_` | = note: expected enum `F` found reference `&_` diff --git a/tests/ui/packed/issue-27060-rpass.rs b/tests/ui/packed/issue-27060-rpass.rs deleted file mode 100644 index d9159f666..000000000 --- a/tests/ui/packed/issue-27060-rpass.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass -#![allow(dead_code)] -#[repr(packed)] -pub struct Good { - data: &'static u32, - data2: [&'static u32; 2], - aligned: [u8; 32], -} - -// kill this test when that turns to a hard error -#[allow(unaligned_references)] -fn main() { - let good = Good { data: &0, data2: [&0, &0], aligned: [0; 32] }; - - let _ = &good.data; // ok - let _ = &good.data2[0]; // ok - - let _ = &good.data; - let _ = &good.data2[0]; - let _ = &*good.data; // ok, behind a pointer - let _ = &good.aligned; // ok, has align 1 - let _ = &good.aligned[2]; // ok, has align 1 -} diff --git a/tests/ui/packed/issue-27060-rpass.stderr b/tests/ui/packed/issue-27060-rpass.stderr deleted file mode 100644 index adf9ae9f5..000000000 --- a/tests/ui/packed/issue-27060-rpass.stderr +++ /dev/null @@ -1,68 +0,0 @@ -Future incompatibility report: Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/issue-27060-rpass.rs:15:13 - | -LL | let _ = &good.data; // ok - | ^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/issue-27060-rpass.rs:11:9 - | -LL | #[allow(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/issue-27060-rpass.rs:16:13 - | -LL | let _ = &good.data2[0]; // ok - | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/issue-27060-rpass.rs:11:9 - | -LL | #[allow(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/issue-27060-rpass.rs:18:13 - | -LL | let _ = &good.data; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/issue-27060-rpass.rs:11:9 - | -LL | #[allow(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/issue-27060-rpass.rs:19:13 - | -LL | let _ = &good.data2[0]; - | ^^^^^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/issue-27060-rpass.rs:11:9 - | -LL | #[allow(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - diff --git a/tests/ui/packed/issue-27060.rs b/tests/ui/packed/issue-27060.rs index 886a00239..a0e944caa 100644 --- a/tests/ui/packed/issue-27060.rs +++ b/tests/ui/packed/issue-27060.rs @@ -13,14 +13,10 @@ fn main() { }; let _ = &good.data; //~ ERROR reference to packed field - //~| hard error let _ = &good.data2[0]; //~ ERROR reference to packed field - //~| hard error let _ = &good.data; //~ ERROR reference to packed field - //~| hard error let _ = &good.data2[0]; //~ ERROR reference to packed field - //~| hard error let _ = &*good.data; // ok, behind a pointer let _ = &good.aligned; // ok, has align 1 let _ = &good.aligned[2]; // ok, has align 1 diff --git a/tests/ui/packed/issue-27060.stderr b/tests/ui/packed/issue-27060.stderr index 85e08fa02..b4753284f 100644 --- a/tests/ui/packed/issue-27060.stderr +++ b/tests/ui/packed/issue-27060.stderr @@ -1,99 +1,39 @@ -error: reference to packed field is unaligned +error[E0793]: reference to packed field is unaligned --> $DIR/issue-27060.rs:15:13 | LL | let _ = &good.data; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default -error: reference to packed field is unaligned - --> $DIR/issue-27060.rs:17:13 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-27060.rs:16:13 | LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/issue-27060.rs:20:13 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-27060.rs:18:13 | LL | let _ = &good.data; | ^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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: reference to packed field is unaligned - --> $DIR/issue-27060.rs:22:13 +error[E0793]: reference to packed field is unaligned + --> $DIR/issue-27060.rs:19:13 | LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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 4 previous errors -Future incompatibility report: Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-27060.rs:15:13 - | -LL | let _ = &good.data; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-27060.rs:17:13 - | -LL | let _ = &good.data2[0]; - | ^^^^^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-27060.rs:20:13 - | -LL | let _ = &good.data; - | ^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - -Future breakage diagnostic: -error: reference to packed field is unaligned - --> $DIR/issue-27060.rs:22:13 - | -LL | let _ = &good.data2[0]; - | ^^^^^^^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) - = note: `#[deny(unaligned_references)]` on by default - +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/packed/packed-struct-borrow-element-64bit.rs b/tests/ui/packed/packed-struct-borrow-element-64bit.rs index 00bddfe40..63315ea66 100644 --- a/tests/ui/packed/packed-struct-borrow-element-64bit.rs +++ b/tests/ui/packed/packed-struct-borrow-element-64bit.rs @@ -1,4 +1,3 @@ -// run-pass (note: this is spec-UB, but it works for now) // ignore-32bit (needs `usize` to be 8-aligned to reproduce all the errors below) #![allow(dead_code)] // ignore-emscripten weird assertion? @@ -9,10 +8,8 @@ struct Foo4C { baz: usize } -#[warn(unaligned_references)] pub fn main() { let foo = Foo4C { bar: 1, baz: 2 }; - let brw = &foo.baz; //~WARN reference to packed field is unaligned - //~^ previously accepted + let brw = &foo.baz; //~ERROR reference to packed field is unaligned assert_eq!(*brw, 2); } diff --git a/tests/ui/packed/packed-struct-borrow-element-64bit.stderr b/tests/ui/packed/packed-struct-borrow-element-64bit.stderr index fb2f5615c..32943b0f0 100644 --- a/tests/ui/packed/packed-struct-borrow-element-64bit.stderr +++ b/tests/ui/packed/packed-struct-borrow-element-64bit.stderr @@ -1,35 +1,12 @@ -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element-64bit.rs:15:15 +error[E0793]: reference to packed field is unaligned + --> $DIR/packed-struct-borrow-element-64bit.rs:13:15 | LL | let brw = &foo.baz; | ^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/packed-struct-borrow-element-64bit.rs:12:8 - | -LL | #[warn(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element-64bit.rs:15:15 - | -LL | let brw = &foo.baz; - | ^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/packed-struct-borrow-element-64bit.rs:12:8 - | -LL | #[warn(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ +error: aborting due to previous error +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/packed/packed-struct-borrow-element.rs b/tests/ui/packed/packed-struct-borrow-element.rs index a6ee90cef..6cbeca44b 100644 --- a/tests/ui/packed/packed-struct-borrow-element.rs +++ b/tests/ui/packed/packed-struct-borrow-element.rs @@ -1,4 +1,3 @@ -// run-pass (note: this is spec-UB, but it works for now) #![allow(dead_code)] // ignore-emscripten weird assertion? @@ -20,15 +19,12 @@ struct Foo4C { baz: usize } -#[warn(unaligned_references)] pub fn main() { let foo = Foo1 { bar: 1, baz: 2 }; - let brw = &foo.baz; //~WARN reference to packed field is unaligned - //~^ previously accepted + let brw = &foo.baz; //~ERROR reference to packed field is unaligned assert_eq!(*brw, 2); let foo = Foo2 { bar: 1, baz: 2 }; - let brw = &foo.baz; //~WARN reference to packed field is unaligned - //~^ previously accepted + let brw = &foo.baz; //~ERROR reference to packed field is unaligned assert_eq!(*brw, 2); } diff --git a/tests/ui/packed/packed-struct-borrow-element.stderr b/tests/ui/packed/packed-struct-borrow-element.stderr index 75d55c4f6..29d867fc5 100644 --- a/tests/ui/packed/packed-struct-borrow-element.stderr +++ b/tests/ui/packed/packed-struct-borrow-element.stderr @@ -1,63 +1,21 @@ -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element.rs:26:15 +error[E0793]: reference to packed field is unaligned + --> $DIR/packed-struct-borrow-element.rs:24:15 | LL | let brw = &foo.baz; | ^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/packed-struct-borrow-element.rs:23:8 - | -LL | #[warn(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element.rs:31:15 +error[E0793]: reference to packed field is unaligned + --> $DIR/packed-struct-borrow-element.rs:28:15 | LL | let brw = &foo.baz; | ^^^^^^^^ | - = 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 #82523 = note: fields of packed structs are not properly aligned, and 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) -warning: 2 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element.rs:26:15 - | -LL | let brw = &foo.baz; - | ^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/packed-struct-borrow-element.rs:23:8 - | -LL | #[warn(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - -Future breakage diagnostic: -warning: reference to packed field is unaligned - --> $DIR/packed-struct-borrow-element.rs:31:15 - | -LL | let brw = &foo.baz; - | ^^^^^^^^ - | - = 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 #82523 - = note: fields of packed structs are not properly aligned, and 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) -note: the lint level is defined here - --> $DIR/packed-struct-borrow-element.rs:23:8 - | -LL | #[warn(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0793`. diff --git a/tests/ui/panics/default-backtrace-ice.stderr b/tests/ui/panics/default-backtrace-ice.stderr index a0025d7e2..4bd4780e2 100644 --- a/tests/ui/panics/default-backtrace-ice.stderr +++ b/tests/ui/panics/default-backtrace-ice.stderr @@ -4,9 +4,7 @@ LL | fn main() { missing_ident; } stack backtrace: -error: internal compiler error: unexpected panic - - +error: the compiler unexpectedly panicked. this is a bug. @@ -15,4 +13,5 @@ error: internal compiler error: unexpected panic query stack during panic: +#0 [resolver_for_lowering] getting the resolver for lowering end of query stack diff --git a/tests/ui/parser/anon-enums-are-ambiguous.rs b/tests/ui/parser/anon-enums-are-ambiguous.rs new file mode 100644 index 000000000..b0173cf98 --- /dev/null +++ b/tests/ui/parser/anon-enums-are-ambiguous.rs @@ -0,0 +1,26 @@ +// check-pass + +macro_rules! test_expr { + ($expr:expr) => {}; +} + +macro_rules! test_ty { + ($a:ty | $b:ty) => {}; +} + +fn main() { + test_expr!(a as fn() -> B | C); + // Do not break the `|` operator. + + test_expr!(|_: fn() -> B| C | D); + // Do not break `-> Ret` in closure args. + + test_ty!(A | B); + // We can't support anon enums in arbitrary positions. + + test_ty!(fn() -> A | B); + // Don't break fn ptrs. + + test_ty!(impl Fn() -> A | B); + // Don't break parenthesized generics. +} diff --git a/tests/ui/parser/bastion-of-the-turbofish.rs b/tests/ui/parser/bastion-of-the-turbofish.rs index e12857008..7ceea676d 100644 --- a/tests/ui/parser/bastion-of-the-turbofish.rs +++ b/tests/ui/parser/bastion-of-the-turbofish.rs @@ -34,7 +34,7 @@ // See https://github.com/rust-lang/rust/pull/53562 // and https://github.com/rust-lang/rfcs/pull/2527 -// and https://twitter.com/garblefart/status/1393236602856611843 +// and https://web.archive.org/web/20211010063452/https://twitter.com/garblefart/status/1393236602856611843 // for context. fn main() { diff --git a/tests/ui/parser/deli-ident-issue-1.rs b/tests/ui/parser/deli-ident-issue-1.rs new file mode 100644 index 000000000..224ee6c09 --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-1.rs @@ -0,0 +1,22 @@ +#![feature(let_chains)] +trait Demo {} + +impl dyn Demo { + pub fn report(&self) -> u32 { + let sum = |a: u32, + b: u32, + c: u32| { + a + b + c + }; + sum(1, 2, 3) + } + + fn check(&self, val: Option, num: Option) { + if let Some(b) = val + && let Some(c) = num { + && b == c { + } + } +} + +fn main() { } //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/deli-ident-issue-1.stderr b/tests/ui/parser/deli-ident-issue-1.stderr new file mode 100644 index 000000000..eb5073e14 --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-1.stderr @@ -0,0 +1,17 @@ +error: this file contains an unclosed delimiter + --> $DIR/deli-ident-issue-1.rs:22:66 + | +LL | impl dyn Demo { + | - unclosed delimiter +... +LL | && let Some(c) = num { + | - this delimiter might not be properly closed... +... +LL | } + | - ...as it matches this but it has different indentation +... +LL | fn main() { } + | ^ + +error: aborting due to previous error + diff --git a/tests/ui/parser/deli-ident-issue-2.rs b/tests/ui/parser/deli-ident-issue-2.rs new file mode 100644 index 000000000..5394760df --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-2.rs @@ -0,0 +1,7 @@ +fn main() { + if 1 < 2 { + let _a = vec!]; //~ ERROR mismatched closing delimiter + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/deli-ident-issue-2.stderr b/tests/ui/parser/deli-ident-issue-2.stderr new file mode 100644 index 000000000..e0188cdfb --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-2.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `]` + --> $DIR/deli-ident-issue-2.rs:2:14 + | +LL | if 1 < 2 { + | ^ unclosed delimiter +LL | let _a = vec!]; + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/deli-ident-issue-2.rs:5:1 + | +LL | let _a = vec!]; + | - missing open `[` for this delimiter +LL | } +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/do-not-suggest-semicolon-before-array.rs b/tests/ui/parser/do-not-suggest-semicolon-before-array.rs index 7ebf3f6b0..7eff7f431 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-before-array.rs +++ b/tests/ui/parser/do-not-suggest-semicolon-before-array.rs @@ -2,7 +2,7 @@ fn foo() {} fn bar() -> [u8; 2] { foo() - [1, 3) //~ ERROR expected one of `.`, `?`, `]`, or an operator, found `,` + [1, 3) //~ ERROR mismatched closing delimiter } fn main() {} diff --git a/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr b/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr index a9dd52632..7b43c7700 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr +++ b/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr @@ -1,8 +1,8 @@ -error: expected one of `.`, `?`, `]`, or an operator, found `,` +error: mismatched closing delimiter: `)` --> $DIR/do-not-suggest-semicolon-before-array.rs:5:5 | LL | [1, 3) - | ^ ^ help: `]` may belong here + | ^ ^ mismatched closing delimiter | | | unclosed delimiter diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index 038fdfb2d..2d8bd19a7 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -209,8 +209,8 @@ note: ...which requires const checking `main::ff5`... | LL | const async unsafe extern "C" fn ff5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... + = note: ...which requires computing whether `main::ff5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::ff5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::ff5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 @@ -245,8 +245,8 @@ note: ...which requires const checking `main::` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... + = note: ...which requires computing whether `main::::ft5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::::ft5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::::ft5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 @@ -281,8 +281,8 @@ note: ...which requires const checking `main::` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... + = note: ...which requires computing whether `main::::fi5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::::fi5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::::fi5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issue-102806.stderr index 6872b8bc0..ba8174a82 100644 --- a/tests/ui/parser/issue-102806.stderr +++ b/tests/ui/parser/issue-102806.stderr @@ -32,7 +32,12 @@ error: expected field pattern, found `...` --> $DIR/issue-102806.rs:21:22 | LL | let V3 { z: val, ... } = v; - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | let V3 { z: val, .. } = v; + | ~~ error[E0063]: missing fields `x` and `y` in initializer of `V3` --> $DIR/issue-102806.rs:17:13 diff --git a/tests/ui/parser/issue-103451.rs b/tests/ui/parser/issue-103451.rs index 1fdb00148..be33213f3 100644 --- a/tests/ui/parser/issue-103451.rs +++ b/tests/ui/parser/issue-103451.rs @@ -1,5 +1,4 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected value, found struct `R` struct R { } struct S { x: [u8; R diff --git a/tests/ui/parser/issue-103451.stderr b/tests/ui/parser/issue-103451.stderr index eb3c92fb4..6aacd5012 100644 --- a/tests/ui/parser/issue-103451.stderr +++ b/tests/ui/parser/issue-103451.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-103451.rs:5:15 + --> $DIR/issue-103451.rs:4:15 | LL | struct S { | - unclosed delimiter @@ -8,25 +8,5 @@ LL | x: [u8; R | | | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-103451.rs:5:15 - | -LL | struct S { - | - unclosed delimiter -LL | x: [u8; R - | - ^ - | | - | unclosed delimiter - -error[E0423]: expected value, found struct `R` - --> $DIR/issue-103451.rs:5:13 - | -LL | struct R { } - | ------------ `R` defined here -LL | struct S { -LL | x: [u8; R - | ^ help: use struct literal syntax instead: `R {}` - -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/parser/issue-107705.rs b/tests/ui/parser/issue-107705.rs new file mode 100644 index 000000000..b80984fcd --- /dev/null +++ b/tests/ui/parser/issue-107705.rs @@ -0,0 +1,3 @@ +// compile-flags: -C debug-assertions + +fn f() {a(b:&, //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issue-107705.stderr b/tests/ui/parser/issue-107705.stderr new file mode 100644 index 000000000..d2d613461 --- /dev/null +++ b/tests/ui/parser/issue-107705.stderr @@ -0,0 +1,10 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-107705.rs:3:67 + | +LL | fn f() {a(b:&, + | - - unclosed delimiter ^ + | | + | unclosed delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-108495-dec.rs b/tests/ui/parser/issue-108495-dec.rs new file mode 100644 index 000000000..e0816f84e --- /dev/null +++ b/tests/ui/parser/issue-108495-dec.rs @@ -0,0 +1,39 @@ +fn test0() { + let mut i = 0; + let _ = i + i--; //~ ERROR Rust has no postfix decrement operator + // won't suggest since we can not handle the precedences +} + +fn test1() { + let mut i = 0; + let _ = i-- + i--; //~ ERROR Rust has no postfix decrement operator +} + +fn test2() { + let mut i = 0; + let _ = --i + i--; //~ ERROR Rust has no postfix decrement operator +} + +fn test3() { + let mut i = 0; + let _ = i-- + --i; //~ ERROR Rust has no postfix decrement operator +} + +fn test4() { + let mut i = 0; + let _ = (1 + 2 + i)--; //~ ERROR Rust has no postfix decrement operator +} + +fn test5() { + let mut i = 0; + let _ = (i-- + 1) + 2; //~ ERROR Rust has no postfix decrement operator +} + +fn test6(){ + let i=10; + while i != 0 { + i--; //~ ERROR Rust has no postfix decrement operator + } +} + +fn main() {} diff --git a/tests/ui/parser/issue-108495-dec.stderr b/tests/ui/parser/issue-108495-dec.stderr new file mode 100644 index 000000000..85b29038f --- /dev/null +++ b/tests/ui/parser/issue-108495-dec.stderr @@ -0,0 +1,69 @@ +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:3:18 + | +LL | let _ = i + i--; + | ^^ not a valid postfix operator + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:9:14 + | +LL | let _ = i-- + i--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = i; i -= 1; tmp } + i--; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:14:20 + | +LL | let _ = --i + i--; + | ^^ not a valid postfix operator + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:19:14 + | +LL | let _ = i-- + --i; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = i; i -= 1; tmp } + --i; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:24:24 + | +LL | let _ = (1 + 2 + i)--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; + | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:29:15 + | +LL | let _ = (i-- + 1) + 2; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:35:10 + | +LL | i--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | i -= 1; + | ~~~~ + +error: aborting due to 7 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issue-68987-unmatch-issue-1.rs new file mode 100644 index 000000000..30e7ef467 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-1.rs @@ -0,0 +1,12 @@ +// This file has unexpected closing delimiter, + +fn func(o: Option) { + match o { + Some(_x) => {} // Extra '}' + let _ = if true {}; + } + None => {} + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issue-68987-unmatch-issue-1.stderr new file mode 100644 index 000000000..2d873b461 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-1.stderr @@ -0,0 +1,16 @@ +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-1.rs:10:1 + | +LL | match o { + | - this delimiter might not be properly closed... +LL | Some(_x) => {} // Extra '}' + | -- block is empty, you might have not meant to close it +LL | let _ = if true {}; +LL | } + | - ...as it matches this but it has different indentation +... +LL | } + | ^ unexpected closing delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issue-68987-unmatch-issue-2.rs new file mode 100644 index 000000000..89aaa68ba --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-2.rs @@ -0,0 +1,14 @@ +// FIXME: this case need more work to fix +// currently the TokenTree matching ')' with '{', which is not user friendly for diagnostics +async fn obstest() -> Result<> { + let obs_connect = || -> Result<(), MyError) { //~ ERROR mismatched closing delimiter + async { + } + } + + if let Ok(version, scene_list) = obs_connect() { + + } else { + + } +} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issue-68987-unmatch-issue-2.stderr new file mode 100644 index 000000000..0ecb748a0 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-2.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-68987-unmatch-issue-2.rs:3:32 + | +LL | async fn obstest() -> Result<> { + | ^ unclosed delimiter +LL | let obs_connect = || -> Result<(), MyError) { + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-2.rs:14:1 + | +LL | let obs_connect = || -> Result<(), MyError) { + | - missing open `(` for this delimiter +... +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issue-68987-unmatch-issue-3.rs new file mode 100644 index 000000000..e98df8d7c --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-3.rs @@ -0,0 +1,8 @@ +// the `{` is closed with `)`, there is a missing `(` +fn f(i: u32, j: u32) { + let res = String::new(); + let mut cnt = i; + while cnt < j { + write!&mut res, " "); //~ ERROR mismatched closing delimiter + } +} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issue-68987-unmatch-issue-3.stderr new file mode 100644 index 000000000..dfc4407ed --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-3.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-68987-unmatch-issue-3.rs:5:19 + | +LL | while cnt < j { + | ^ unclosed delimiter +LL | write!&mut res, " "); + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-3.rs:8:1 + | +LL | write!&mut res, " "); + | - missing open `(` for this delimiter +LL | } +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue.rs b/tests/ui/parser/issue-68987-unmatch-issue.rs new file mode 100644 index 000000000..5a3620bf2 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue.rs @@ -0,0 +1,12 @@ +// This file has unexpected closing delimiter, + +fn func(o: Option) { + match o { + Some(_x) => // Missing '{' + let _ = if true {}; + } + None => {} + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issue-68987-unmatch-issue.stderr new file mode 100644 index 000000000..cabd13324 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue.stderr @@ -0,0 +1,16 @@ +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue.rs:10:1 + | +LL | match o { + | - this delimiter might not be properly closed... +LL | Some(_x) => // Missing '{' +LL | let _ = if true {}; + | -- block is empty, you might have not meant to close it +LL | } + | - ...as it matches this but it has different indentation +... +LL | } + | ^ unexpected closing delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-81804.rs b/tests/ui/parser/issue-81804.rs index 803bde11e..ebc4752a1 100644 --- a/tests/ui/parser/issue-81804.rs +++ b/tests/ui/parser/issue-81804.rs @@ -1,8 +1,5 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected pattern, found `=` -// error-pattern: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` -// error-pattern: expected item, found `]` fn main() {} diff --git a/tests/ui/parser/issue-81804.stderr b/tests/ui/parser/issue-81804.stderr index 19c4422c6..de3b33ecd 100644 --- a/tests/ui/parser/issue-81804.stderr +++ b/tests/ui/parser/issue-81804.stderr @@ -1,14 +1,13 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-81804.rs:9:11 +error: mismatched closing delimiter: `}` + --> $DIR/issue-81804.rs:6:8 | LL | fn p([=(} - | -- ^ - | || - | |unclosed delimiter - | unclosed delimiter + | ^^ mismatched closing delimiter + | | + | unclosed delimiter error: this file contains an unclosed delimiter - --> $DIR/issue-81804.rs:9:11 + --> $DIR/issue-81804.rs:6:11 | LL | fn p([=(} | -- ^ @@ -16,26 +15,5 @@ LL | fn p([=(} | |unclosed delimiter | unclosed delimiter -error: expected pattern, found `=` - --> $DIR/issue-81804.rs:9:7 - | -LL | fn p([=(} - | ^ expected pattern - -error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` - --> $DIR/issue-81804.rs:9:8 - | -LL | fn p([=(} - | ^ -^ - | | | - | | help: `)` may belong here - | unclosed delimiter - -error: expected item, found `]` - --> $DIR/issue-81804.rs:9:11 - | -LL | fn p([=(} - | ^ expected item - -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issue-81827.rs b/tests/ui/parser/issue-81827.rs index 7ec581594..91defd12a 100644 --- a/tests/ui/parser/issue-81827.rs +++ b/tests/ui/parser/issue-81827.rs @@ -1,6 +1,5 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: mismatched closing delimiter: `]` -// error-pattern: expected one of `)` or `,`, found `{` #![crate_name="0"] diff --git a/tests/ui/parser/issue-81827.stderr b/tests/ui/parser/issue-81827.stderr index 069de3391..63d135f73 100644 --- a/tests/ui/parser/issue-81827.stderr +++ b/tests/ui/parser/issue-81827.stderr @@ -1,23 +1,5 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-81827.rs:11:27 - | -LL | fn r()->i{0|{#[cfg(r(0{]0 - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-81827.rs:11:27 - | -LL | fn r()->i{0|{#[cfg(r(0{]0 - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - error: mismatched closing delimiter: `]` - --> $DIR/issue-81827.rs:11:23 + --> $DIR/issue-81827.rs:10:23 | LL | fn r()->i{0|{#[cfg(r(0{]0 | - ^^ mismatched closing delimiter @@ -25,11 +7,15 @@ LL | fn r()->i{0|{#[cfg(r(0{]0 | | unclosed delimiter | closing delimiter possibly meant for this -error: expected one of `)` or `,`, found `{` - --> $DIR/issue-81827.rs:11:23 +error: this file contains an unclosed delimiter + --> $DIR/issue-81827.rs:10:27 | LL | fn r()->i{0|{#[cfg(r(0{]0 - | ^ expected one of `)` or `,` + | - - - ^ + | | | | + | | | missing open `[` for this delimiter + | | unclosed delimiter + | unclosed delimiter -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-104367.rs b/tests/ui/parser/issues/issue-104367.rs new file mode 100644 index 000000000..861761b64 --- /dev/null +++ b/tests/ui/parser/issues/issue-104367.rs @@ -0,0 +1,6 @@ +#[derive(A)] +struct S { + d: [u32; { + #![cfg] { + #![w,) //~ ERROR mismatched closing delimiter + //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-104367.stderr b/tests/ui/parser/issues/issue-104367.stderr new file mode 100644 index 000000000..e6e765357 --- /dev/null +++ b/tests/ui/parser/issues/issue-104367.stderr @@ -0,0 +1,26 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-104367.rs:5:15 + | +LL | #![w,) + | ^ ^ mismatched closing delimiter + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-104367.rs:6:71 + | +LL | struct S { + | - unclosed delimiter +LL | d: [u32; { + | - - unclosed delimiter + | | + | unclosed delimiter +LL | #![cfg] { + | - unclosed delimiter +LL | #![w,) + | - missing open `(` for this delimiter +LL | + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-105209.rs b/tests/ui/parser/issues/issue-105209.rs new file mode 100644 index 000000000..6146b795d --- /dev/null +++ b/tests/ui/parser/issues/issue-105209.rs @@ -0,0 +1,3 @@ +// compile-flags: -Zunpretty=ast-tree +#![c={#![c[)x //~ ERROR mismatched closing delimiter + //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-105209.stderr b/tests/ui/parser/issues/issue-105209.stderr new file mode 100644 index 000000000..c75eafa18 --- /dev/null +++ b/tests/ui/parser/issues/issue-105209.stderr @@ -0,0 +1,22 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-105209.rs:2:11 + | +LL | #![c={#![c[)x + | ^^ mismatched closing delimiter + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-105209.rs:3:68 + | +LL | #![c={#![c[)x + | - - - - missing open `(` for this delimiter + | | | | + | | | unclosed delimiter + | | unclosed delimiter + | unclosed delimiter +LL | + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-10636-2.rs b/tests/ui/parser/issues/issue-10636-2.rs index 6fb63639d..80d8ef65a 100644 --- a/tests/ui/parser/issues/issue-10636-2.rs +++ b/tests/ui/parser/issues/issue-10636-2.rs @@ -1,11 +1,11 @@ +// error-pattern: mismatched closing delimiter: `}` // FIXME(31528) we emit a bunch of silly errors here due to continuing past the // first one. This would be easy-ish to address by better recovery in tokenisation. pub fn trace_option(option: Option) { option.map(|some| 42; - //~^ ERROR: expected one of + } -//~^ ERROR: expected expression, found `)` fn main() {} diff --git a/tests/ui/parser/issues/issue-10636-2.stderr b/tests/ui/parser/issues/issue-10636-2.stderr index d4f2da9e3..4cd4be180 100644 --- a/tests/ui/parser/issues/issue-10636-2.stderr +++ b/tests/ui/parser/issues/issue-10636-2.stderr @@ -1,16 +1,13 @@ -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/issue-10636-2.rs:5:15 +error: mismatched closing delimiter: `}` + --> $DIR/issue-10636-2.rs:6:15 | +LL | pub fn trace_option(option: Option) { + | - closing delimiter possibly meant for this LL | option.map(|some| 42; - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected expression, found `)` - --> $DIR/issue-10636-2.rs:8:1 - | + | ^ unclosed delimiter +... LL | } - | ^ expected expression + | ^ mismatched closing delimiter -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index 1f0c1ea4c..de02ea85b 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -21,8 +21,8 @@ LL | foo!(true); = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: if `bar` is a struct, use braces as delimiters | -LL | bar { } - | ~ +LL | bar { baz: $rest } + | ~ ~ help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs index 25699f9fe..a596a9f2d 100644 --- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs +++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs @@ -1,4 +1,5 @@ // Fixed in #66054. // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 2 previous errors +// error-pattern: this file contains an unclosed delimiter +// error-pattern: aborting due to previous error #[Ѕ \ No newline at end of file diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr index 8a44ee761..c79e8b4fb 100644 --- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr +++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr @@ -1,16 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 + --> $DIR/issue-58094-missing-right-square-bracket.rs:5:4 | LL | #[Ѕ | - ^ | | | unclosed delimiter -error: expected item after attributes - --> $DIR/issue-58094-missing-right-square-bracket.rs:4:1 - | -LL | #[Ѕ - | ^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-58856-1.rs b/tests/ui/parser/issues/issue-58856-1.rs index ea80eb871..799243d54 100644 --- a/tests/ui/parser/issues/issue-58856-1.rs +++ b/tests/ui/parser/issues/issue-58856-1.rs @@ -1,8 +1,5 @@ impl A { - //~^ ERROR cannot find type `A` in this scope fn b(self> - //~^ ERROR expected one of `)`, `,`, or `:`, found `>` - //~| ERROR expected one of `->`, `where`, or `{`, found `>` -} +} //~ ERROR mismatched closing delimiter fn main() {} diff --git a/tests/ui/parser/issues/issue-58856-1.stderr b/tests/ui/parser/issues/issue-58856-1.stderr index 96151f3fe..77ad8acbd 100644 --- a/tests/ui/parser/issues/issue-58856-1.stderr +++ b/tests/ui/parser/issues/issue-58856-1.stderr @@ -1,29 +1,12 @@ -error: expected one of `)`, `,`, or `:`, found `>` - --> $DIR/issue-58856-1.rs:3:9 - | -LL | fn b(self> - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected one of `->`, `where`, or `{`, found `>` - --> $DIR/issue-58856-1.rs:3:14 +error: mismatched closing delimiter: `}` + --> $DIR/issue-58856-1.rs:2:9 | LL | impl A { - | - while parsing this item list starting here -LL | + | - closing delimiter possibly meant for this LL | fn b(self> - | ^ expected one of `->`, `where`, or `{` -... + | ^ unclosed delimiter LL | } - | - the item list ends here - -error[E0412]: cannot find type `A` in this scope - --> $DIR/issue-58856-1.rs:1:6 - | -LL | impl A { - | ^ not found in this scope + | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/issues/issue-58856-2.rs b/tests/ui/parser/issues/issue-58856-2.rs index 9356d57b0..5edd72639 100644 --- a/tests/ui/parser/issues/issue-58856-2.rs +++ b/tests/ui/parser/issues/issue-58856-2.rs @@ -4,11 +4,8 @@ trait Howness {} impl Howness for () { fn how_are_you(&self -> Empty { - //~^ ERROR expected one of `)` or `,`, found `->` - //~| ERROR method `how_are_you` is not a member of trait `Howness` Empty } -} -//~^ ERROR non-item in item list +} //~ ERROR mismatched closing delimiter fn main() {} diff --git a/tests/ui/parser/issues/issue-58856-2.stderr b/tests/ui/parser/issues/issue-58856-2.stderr index 627dd3890..5fcf5bcc1 100644 --- a/tests/ui/parser/issues/issue-58856-2.stderr +++ b/tests/ui/parser/issues/issue-58856-2.stderr @@ -1,34 +1,13 @@ -error: expected one of `)` or `,`, found `->` +error: mismatched closing delimiter: `}` --> $DIR/issue-58856-2.rs:6:19 | -LL | fn how_are_you(&self -> Empty { - | ^ -^^ - | | | - | | help: `)` may belong here - | unclosed delimiter - -error: non-item in item list - --> $DIR/issue-58856-2.rs:11:1 - | LL | impl Howness for () { - | - item list starts here + | - closing delimiter possibly meant for this +LL | fn how_are_you(&self -> Empty { + | ^ unclosed delimiter ... LL | } - | ^ - | | - | non-item starts here - | item list ends here - -error[E0407]: method `how_are_you` is not a member of trait `Howness` - --> $DIR/issue-58856-2.rs:6:5 - | -LL | / fn how_are_you(&self -> Empty { -LL | | -LL | | -LL | | Empty -LL | | } - | |_____^ not a member of trait `Howness` + | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0407`. diff --git a/tests/ui/parser/issues/issue-60075.rs b/tests/ui/parser/issues/issue-60075.rs index e89d78ee8..3c36e4d3e 100644 --- a/tests/ui/parser/issues/issue-60075.rs +++ b/tests/ui/parser/issues/issue-60075.rs @@ -3,9 +3,6 @@ fn main() {} trait T { fn qux() -> Option { let _ = if true { - }); -//~^ ERROR non-item in item list -//~| ERROR mismatched closing delimiter: `)` -//~| ERROR expected one of `.`, `;` + }); //~ ERROR mismatched closing delimiter Some(4) } diff --git a/tests/ui/parser/issues/issue-60075.stderr b/tests/ui/parser/issues/issue-60075.stderr index 210ef700c..cd8f1231f 100644 --- a/tests/ui/parser/issues/issue-60075.stderr +++ b/tests/ui/parser/issues/issue-60075.stderr @@ -1,21 +1,3 @@ -error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}` - --> $DIR/issue-60075.rs:6:10 - | -LL | }); - | ^ expected one of `.`, `;`, `?`, `else`, or an operator - -error: non-item in item list - --> $DIR/issue-60075.rs:6:11 - | -LL | trait T { - | - item list starts here -... -LL | }); - | ^ non-item starts here -... -LL | } - | - item list ends here - error: mismatched closing delimiter: `)` --> $DIR/issue-60075.rs:4:31 | @@ -25,5 +7,5 @@ LL | let _ = if true { LL | }); | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62524.rs b/tests/ui/parser/issues/issue-62524.rs index 5259dfe2e..fa7c626f5 100644 --- a/tests/ui/parser/issues/issue-62524.rs +++ b/tests/ui/parser/issues/issue-62524.rs @@ -1,5 +1,5 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 3 previous errors +// error-pattern: aborting due to previous error #![allow(uncommon_codepoints)] y![ diff --git a/tests/ui/parser/issues/issue-62524.stderr b/tests/ui/parser/issues/issue-62524.stderr index 55eed0402..0cbaacd4c 100644 --- a/tests/ui/parser/issues/issue-62524.stderr +++ b/tests/ui/parser/issues/issue-62524.stderr @@ -6,28 +6,5 @@ LL | y![ LL | Ϥ, | ^ -error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-62524.rs:5:3 - | -LL | y![ - | ___^ -LL | | Ϥ, - | |__^ - | -help: change the delimiters to curly braces - | -LL | y! { /* items */ } - | ~~~~~~~~~~~~~~~ -help: add a semicolon - | -LL | Ϥ,; - | + - -error: cannot find macro `y` in this scope - --> $DIR/issue-62524.rs:5:1 - | -LL | y![ - | ^ - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62546.rs b/tests/ui/parser/issues/issue-62546.rs index f06b65058..bb30d68ea 100644 --- a/tests/ui/parser/issues/issue-62546.rs +++ b/tests/ui/parser/issues/issue-62546.rs @@ -1,3 +1 @@ -pub t(# -//~^ ERROR missing `fn` or `struct` for function or struct definition -//~ ERROR this file contains an unclosed delimiter +pub t(# //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-62546.stderr b/tests/ui/parser/issues/issue-62546.stderr index 32c61391e..80c1c7168 100644 --- a/tests/ui/parser/issues/issue-62546.stderr +++ b/tests/ui/parser/issues/issue-62546.stderr @@ -1,17 +1,8 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62546.rs:3:52 + --> $DIR/issue-62546.rs:1:60 | LL | pub t(# - | - unclosed delimiter -LL | -LL | - | ^ + | - unclosed delimiter ^ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/issue-62546.rs:1:4 - | -LL | pub t(# - | ---^- help: if you meant to call a macro, try: `t!` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62554.rs b/tests/ui/parser/issues/issue-62554.rs index cfd02183c..4b463a173 100644 --- a/tests/ui/parser/issues/issue-62554.rs +++ b/tests/ui/parser/issues/issue-62554.rs @@ -1,5 +1,4 @@ // error-pattern:this file contains an unclosed delimiter -// error-pattern:xpected `{`, found `macro_rules` fn main() {} diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr index 9e62572e3..4637c795a 100644 --- a/tests/ui/parser/issues/issue-62554.stderr +++ b/tests/ui/parser/issues/issue-62554.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 + --> $DIR/issue-62554.rs:5:89 | LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { | - - - - - ^ @@ -9,65 +9,5 @@ LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s | | | unclosed delimiter | unclosed delimiter unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: expected `{`, found `macro_rules` - --> $DIR/issue-62554.rs:6:23 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | ^^^^^^^^^^^ expected `{` - | -note: the `if` expression is missing a block after this condition - --> $DIR/issue-62554.rs:6:20 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | ^^ -help: try placing this code inside a block - | -LL | fn foo(u: u8) { if u8 { macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { } - | + + - -error: aborting due to 6 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62881.rs b/tests/ui/parser/issues/issue-62881.rs index b9204595f..cc80d4499 100644 --- a/tests/ui/parser/issues/issue-62881.rs +++ b/tests/ui/parser/issues/issue-62881.rs @@ -1,6 +1,3 @@ fn main() {} -fn f() -> isize { fn f() -> isize {} pub f< -//~^ ERROR missing `fn` or `struct` for function or struct definition -//~| ERROR mismatched types -//~ ERROR this file contains an unclosed delimiter +fn f() -> isize { fn f() -> isize {} pub f< //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-62881.stderr b/tests/ui/parser/issues/issue-62881.stderr index 87be69baa..e57cbd181 100644 --- a/tests/ui/parser/issues/issue-62881.stderr +++ b/tests/ui/parser/issues/issue-62881.stderr @@ -1,26 +1,8 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62881.rs:6:52 + --> $DIR/issue-62881.rs:3:96 | LL | fn f() -> isize { fn f() -> isize {} pub f< - | - unclosed delimiter -... -LL | - | ^ + | - unclosed delimiter ^ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/issue-62881.rs:3:41 - | -LL | fn f() -> isize { fn f() -> isize {} pub f< - | ^ - -error[E0308]: mismatched types - --> $DIR/issue-62881.rs:3:29 - | -LL | fn f() -> isize { fn f() -> isize {} pub f< - | - ^^^^^ expected `isize`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-62894.rs b/tests/ui/parser/issues/issue-62894.rs index b9c0bf834..4dfa406ea 100644 --- a/tests/ui/parser/issues/issue-62894.rs +++ b/tests/ui/parser/issues/issue-62894.rs @@ -1,6 +1,5 @@ // Regression test for #62894, shouldn't crash. // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected one of `(`, `[`, or `{`, found keyword `fn` fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! diff --git a/tests/ui/parser/issues/issue-62894.stderr b/tests/ui/parser/issues/issue-62894.stderr index 07a203bf4..700479076 100644 --- a/tests/ui/parser/issues/issue-62894.stderr +++ b/tests/ui/parser/issues/issue-62894.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 + --> $DIR/issue-62894.rs:6:14 | LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | - - - unclosed delimiter @@ -10,41 +10,5 @@ LL | LL | fn main() {} | ^ -error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -LL | -LL | fn main() {} - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -LL | -LL | fn main() {} - | ^ - -error: expected one of `(`, `[`, or `{`, found keyword `fn` - --> $DIR/issue-62894.rs:7:1 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - expected one of `(`, `[`, or `{` -LL | -LL | fn main() {} - | ^^ unexpected token - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: while parsing argument for this `expr` macro fragment - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62895.rs b/tests/ui/parser/issues/issue-62895.rs index 53f17405d..33511dee9 100644 --- a/tests/ui/parser/issues/issue-62895.rs +++ b/tests/ui/parser/issues/issue-62895.rs @@ -1,11 +1,11 @@ fn main() {} -fn v() -> isize { //~ ERROR mismatched types -mod _ { //~ ERROR expected identifier -pub fn g() -> isizee { //~ ERROR cannot find type `isizee` in this scope -mod _ { //~ ERROR expected identifier -pub g() -> is //~ ERROR missing `fn` for function definition -(), w20); +fn v() -> isize { +mod _ { +pub fn g() -> isizee { +mod _ { +pub g() -> is +(), w20); //~ ERROR mismatched closing delimiter } -(), w20); //~ ERROR expected item, found `;` +(), w20); //~ ERROR mismatched closing delimiter } diff --git a/tests/ui/parser/issues/issue-62895.stderr b/tests/ui/parser/issues/issue-62895.stderr index 2e7e500f4..0ad9ac63e 100644 --- a/tests/ui/parser/issues/issue-62895.stderr +++ b/tests/ui/parser/issues/issue-62895.stderr @@ -1,47 +1,20 @@ -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-62895.rs:4:5 +error: mismatched closing delimiter: `)` + --> $DIR/issue-62895.rs:6:7 | LL | mod _ { - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-62895.rs:6:5 - | -LL | mod _ { - | ^ expected identifier, found reserved identifier - -error: missing `fn` for function definition - --> $DIR/issue-62895.rs:7:4 - | + | ^ unclosed delimiter LL | pub g() -> is - | ^^^^ - | -help: add `fn` here to parse `g` as a public function - | -LL | pub fn g() -> is - | ++ - -error: expected item, found `;` - --> $DIR/issue-62895.rs:10:9 - | LL | (), w20); - | ^ help: remove this semicolon - -error[E0412]: cannot find type `isizee` in this scope - --> $DIR/issue-62895.rs:5:15 - | -LL | pub fn g() -> isizee { - | ^^^^^^ help: a builtin type with a similar name exists: `isize` + | ^ mismatched closing delimiter -error[E0308]: mismatched types - --> $DIR/issue-62895.rs:3:11 +error: mismatched closing delimiter: `)` + --> $DIR/issue-62895.rs:4:7 | -LL | fn v() -> isize { - | - ^^^^^ expected `isize`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression +LL | mod _ { + | ^ unclosed delimiter +... +LL | (), w20); + | ^ mismatched closing delimiter -error: aborting due to 6 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0412. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-62973.rs b/tests/ui/parser/issues/issue-62973.rs index 1c5d0c6f8..22d754577 100644 --- a/tests/ui/parser/issues/issue-62973.rs +++ b/tests/ui/parser/issues/issue-62973.rs @@ -1,5 +1,5 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 7 previous errors +// error-pattern: aborting due to 3 previous errors fn main() {} diff --git a/tests/ui/parser/issues/issue-62973.stderr b/tests/ui/parser/issues/issue-62973.stderr index 4737bc718..14411a8cb 100644 --- a/tests/ui/parser/issues/issue-62973.stderr +++ b/tests/ui/parser/issues/issue-62973.stderr @@ -1,68 +1,3 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | - - unclosed delimiter - | | - | unclosed delimiter -LL | -LL | - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | - - unclosed delimiter - | | - | unclosed delimiter -LL | -LL | - | ^ - -error: expected one of `,`, `:`, or `}`, found `{` - --> $DIR/issue-62973.rs:6:8 - | -LL | fn p() { match s { v, E { [) {) } - | ^ - ^ expected one of `,`, `:`, or `}` - | | | - | | while parsing this struct - | unclosed delimiter - | -help: `}` may belong here - | -LL | fn p() { match s { v, E} { [) {) } - | + -help: try naming a field - | -LL | fn p() { match s { v, E: E { [) {) } - | ++ - -error: struct literals are not allowed here - --> $DIR/issue-62973.rs:6:16 - | -LL | fn p() { match s { v, E { [) {) } - | ________________^ -LL | | -LL | | - | |_^ - | -help: surround the struct literal with parentheses - | -LL ~ fn p() { match (s { v, E { [) {) } -LL | -LL ~ ) - | - -error: expected one of `.`, `?`, `{`, or an operator, found `}` - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | ----- while parsing this `match` expression -LL | -LL | - | ^ expected one of `.`, `?`, `{`, or an operator - error: mismatched closing delimiter: `)` --> $DIR/issue-62973.rs:6:27 | @@ -79,5 +14,18 @@ LL | fn p() { match s { v, E { [) {) } | | | unclosed delimiter -error: aborting due to 7 previous errors +error: this file contains an unclosed delimiter + --> $DIR/issue-62973.rs:8:2 + | +LL | fn p() { match s { v, E { [) {) } + | - - - - missing open `(` for this delimiter + | | | | + | | | missing open `(` for this delimiter + | | unclosed delimiter + | unclosed delimiter +LL | +LL | + | ^ + +error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-63116.rs b/tests/ui/parser/issues/issue-63116.rs index 430bc1d71..6b9d9cdbe 100644 --- a/tests/ui/parser/issues/issue-63116.rs +++ b/tests/ui/parser/issues/issue-63116.rs @@ -1,3 +1,3 @@ // fixed by #66361 -// error-pattern: aborting due to 3 previous errors +// error-pattern: aborting due to 2 previous errors impl W $DIR/issue-63116.rs:3:18 - | -LL | impl W $DIR/issue-63116.rs:3:12 - | -LL | impl W $DIR/issue-63116.rs:3:14 | @@ -20,5 +6,14 @@ LL | impl W $DIR/issue-63116.rs:3:18 + | +LL | impl W $DIR/issue-63135.rs:3:16 - | -LL | fn i(n{...,f # - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: expected field pattern, found `...` - --> $DIR/issue-63135.rs:3:8 - | -LL | fn i(n{...,f # - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` - -error: expected `}`, found `,` - --> $DIR/issue-63135.rs:3:11 - | -LL | fn i(n{...,f # - | ---^ - | | | - | | expected `}` - | `..` must be at the end and cannot have a trailing comma - -error: expected one of `!` or `[`, found `}` - --> $DIR/issue-63135.rs:3:16 - | -LL | fn i(n{...,f # - | - ^ expected one of `!` or `[` - | | - | while parsing the fields for this pattern - -error: aborting due to 5 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs index aed428bfc..69a2dfe6c 100644 --- a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs +++ b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs @@ -9,6 +9,4 @@ // // ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`. -fn f() { |[](* } -//~^ ERROR expected one of `,` or `:`, found `(` -//~| ERROR expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` +fn f() { |[](* } //~ ERROR mismatched closing delimiter diff --git a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr index 6cbab855c..079fff37e 100644 --- a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr +++ b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr @@ -1,16 +1,11 @@ -error: expected one of `,` or `:`, found `(` +error: mismatched closing delimiter: `}` --> $DIR/issue-66357-unexpected-unreachable.rs:12:13 | LL | fn f() { |[](* } - | ^ expected one of `,` or `:` + | - ^ ^ mismatched closing delimiter + | | | + | | unclosed delimiter + | closing delimiter possibly meant for this -error: expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` - --> $DIR/issue-66357-unexpected-unreachable.rs:12:13 - | -LL | fn f() { |[](* } - | ^^ help: `)` may belong here - | | - | unclosed delimiter - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs index 87222ef4b..e712160fc 100644 --- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs +++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs @@ -4,9 +4,6 @@ mod a { enum Bug { V = [PhantomData; { [ () ].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` } } @@ -14,10 +11,6 @@ mod b { enum Bug { V = [Vec::new; { [].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR type annotations needed } } @@ -25,11 +18,6 @@ mod c { enum Bug { V = [Vec::new; { [0].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR type annotations needed - } } -fn main() {} +fn main() {} //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr index a00f37ed6..9f631edf6 100644 --- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -8,7 +8,7 @@ LL | V = [PhantomData; { [ () ].len() ].len() as isize, | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:12:24 | LL | V = [Vec::new; { [].len() ].len() as isize, | - ^ ^ mismatched closing delimiter @@ -17,7 +17,7 @@ LL | V = [Vec::new; { [].len() ].len() as isize, | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:19:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - ^ ^ mismatched closing delimiter @@ -25,104 +25,23 @@ LL | V = [Vec::new; { [0].len() ].len() as isize, | | unclosed delimiter | closing delimiter possibly meant for this -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 - | -LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 - | -LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 +error: this file contains an unclosed delimiter + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:23:65 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | + | - missing open `[` for this delimiter +... LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | + | - missing open `[` for this delimiter +... +LL | mod c { + | - unclosed delimiter +LL | enum Bug { LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:26 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | ^^ cannot infer type for type parameter `T` - -error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Vec` - | -help: consider specifying the generic argument - | -LL | V = [Vec::::new; { [0].len() ].len() as isize, - | +++++ + | - missing open `[` for this delimiter +... +LL | fn main() {} + | ^ -error: aborting due to 14 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/parser/issues/issue-68629.rs b/tests/ui/parser/issues/issue-68629.rs index 672a31f12..af89bb586 100644 Binary files a/tests/ui/parser/issues/issue-68629.rs and b/tests/ui/parser/issues/issue-68629.rs differ diff --git a/tests/ui/parser/issues/issue-68629.stderr b/tests/ui/parser/issues/issue-68629.stderr index 43a903e6c..2562baa1c 100644 Binary files a/tests/ui/parser/issues/issue-68629.stderr and b/tests/ui/parser/issues/issue-68629.stderr differ diff --git a/tests/ui/parser/issues/issue-69259.rs b/tests/ui/parser/issues/issue-69259.rs new file mode 100644 index 000000000..01fc2c085 --- /dev/null +++ b/tests/ui/parser/issues/issue-69259.rs @@ -0,0 +1,3 @@ +fn main() {} + +fn f) {} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-69259.stderr b/tests/ui/parser/issues/issue-69259.stderr new file mode 100644 index 000000000..604b7de33 --- /dev/null +++ b/tests/ui/parser/issues/issue-69259.stderr @@ -0,0 +1,8 @@ +error: unexpected closing delimiter: `)` + --> $DIR/issue-69259.rs:3:5 + | +LL | fn f) {} + | ^ unexpected closing delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr index 39bf113ef..46cbb056d 100644 --- a/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr +++ b/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr @@ -2,10 +2,10 @@ error: unexpected closing delimiter: `}` --> $DIR/issue-70583-block-is-empty-1.rs:20:1 | LL | fn struct_generic(x: Vec) { - | - this opening brace... + | - this delimiter might not be properly closed... ... LL | } - | - ...matches this closing brace + | - ...as it matches this but it has different indentation LL | } | ^ unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr index 5d37b2164..9ae94c701 100644 --- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr +++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr @@ -1,8 +1,12 @@ error: unexpected closing delimiter: `}` --> $DIR/issue-70583-block-is-empty-2.rs:14:1 | +LL | match self { + | - this delimiter might not be properly closed... LL | ErrorHandled::Reported => {}} - | -- block is empty, you might have not meant to close it + | --- ...as it matches this but it has different indentation + | | + | block is empty, you might have not meant to close it ... LL | } | ^ unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-84104.rs b/tests/ui/parser/issues/issue-84104.rs index 998949b94..962eb69bd 100644 --- a/tests/ui/parser/issues/issue-84104.rs +++ b/tests/ui/parser/issues/issue-84104.rs @@ -1,3 +1,2 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected one of #[i=i::<ښܖ< diff --git a/tests/ui/parser/issues/issue-84104.stderr b/tests/ui/parser/issues/issue-84104.stderr index aff31f2c9..7ad59f845 100644 --- a/tests/ui/parser/issues/issue-84104.stderr +++ b/tests/ui/parser/issues/issue-84104.stderr @@ -1,16 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-84104.rs:3:13 + --> $DIR/issue-84104.rs:2:13 | LL | #[i=i::<ښܖ< | - ^ | | | unclosed delimiter -error: expected one of `>`, a const expression, lifetime, or type, found `]` - --> $DIR/issue-84104.rs:3:13 - | -LL | #[i=i::<ښܖ< - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-84148-2.rs b/tests/ui/parser/issues/issue-84148-2.rs index 2f6a7facf..e677abde5 100644 --- a/tests/ui/parser/issues/issue-84148-2.rs +++ b/tests/ui/parser/issues/issue-84148-2.rs @@ -1,3 +1,2 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: invalid `?` in type fn f(t:for<>t? diff --git a/tests/ui/parser/issues/issue-84148-2.stderr b/tests/ui/parser/issues/issue-84148-2.stderr index 71d543f9b..20761180e 100644 --- a/tests/ui/parser/issues/issue-84148-2.stderr +++ b/tests/ui/parser/issues/issue-84148-2.stderr @@ -1,27 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-84148-2.rs:3:16 + --> $DIR/issue-84148-2.rs:2:16 | LL | fn f(t:for<>t? | - ^ | | | unclosed delimiter -error: invalid `?` in type - --> $DIR/issue-84148-2.rs:3:14 - | -LL | fn f(t:for<>t? - | ^ `?` is only allowed on expressions, not types - | -help: if you meant to express that the type might not contain a value, use the `Option` wrapper type - | -LL | fn f(t:Optiont> - | +++++++ ~ - -error: expected one of `->`, `where`, or `{`, found `` - --> $DIR/issue-84148-2.rs:3:16 - | -LL | fn f(t:for<>t? - | ^ expected one of `->`, `where`, or `{` - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs index 0b7b67496..e1ea38f27 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs @@ -68,7 +68,6 @@ fn main() { Foo:Bar::Baz => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here - //~| ERROR: failed to resolve: `Bar` is a variant, not a module } match myfoo { Foo::Bar => {} diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index 2050a16be..63b072ac4 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -2,89 +2,118 @@ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:17:12 | LL | Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | Foo::Bar => {} + | ~~ error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 | LL | qux::Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of 8 possible tokens - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Bar => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 | LL | qux:Foo::Baz => {} - | ^ + | ^-------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 | LL | qux: Foo::Baz if true => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 | LL | if let Foo:Bar = f() { - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | if let Foo::Bar = f() { + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:48:16 | LL | ref qux: Foo::Baz => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:57:16 | LL | mut qux: Foo::Baz => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:68:12 | LL | Foo:Bar::Baz => {} - | ^ + | ^-------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | Foo::Bar::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:75:12 + --> $DIR/issue-87086-colon-path-sep.rs:74:12 | LL | Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` - -error[E0433]: failed to resolve: `Bar` is a variant, not a module - --> $DIR/issue-87086-colon-path-sep.rs:68:13 | -LL | Foo:Bar::Baz => {} - | ^^^ `Bar` is a variant, not a module +help: maybe write a path separator here + | +LL | Foo::Bar => {} + | ~~ -error: aborting due to 10 previous errors +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/parser/issues/issue-87812-path.stderr b/tests/ui/parser/issues/issue-87812-path.stderr index f8ee05175..d045f4821 100644 --- a/tests/ui/parser/issues/issue-87812-path.stderr +++ b/tests/ui/parser/issues/issue-87812-path.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-87812-path.rs:3:24 | LL | let _: usize = $f; - | ----- ^^ expected `usize`, found struct `Baz` + | ----- ^^ expected `usize`, found `Baz` | | | expected due to this ... diff --git a/tests/ui/parser/issues/issue-88770.rs b/tests/ui/parser/issues/issue-88770.rs index bb69951c7..9341415b2 100644 --- a/tests/ui/parser/issues/issue-88770.rs +++ b/tests/ui/parser/issues/issue-88770.rs @@ -1,9 +1,6 @@ // Regression test for the ICE described in #88770. // error-pattern:this file contains an unclosed delimiter -// error-pattern:expected one of -// error-pattern:missing `in` in `for` loop -// error-pattern:expected one of `!`, `)`, `,`, `.`, `::`, `;`, `?`, `{`, or an operator, found `e` fn m(){print!("",(c for&g u diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr index 4e3a21613..836f44953 100644 --- a/tests/ui/parser/issues/issue-88770.stderr +++ b/tests/ui/parser/issues/issue-88770.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 + --> $DIR/issue-88770.rs:8:3 | LL | fn m(){print!("",(c for&g | - - - unclosed delimiter @@ -10,51 +10,5 @@ LL | fn m(){print!("",(c for&g LL | e | ^ -error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 - | -LL | fn m(){print!("",(c for&g - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -... -LL | e - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 - | -LL | fn m(){print!("",(c for&g - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -... -LL | e - | ^ - -error: missing `in` in `for` loop - --> $DIR/issue-88770.rs:8:26 - | -LL | fn m(){print!("",(c for&g - | __________________________^ -LL | | u - | |_ help: try adding `in` here - -error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `for` - --> $DIR/issue-88770.rs:8:21 - | -LL | fn m(){print!("",(c for&g - | ^^^ expected one of 8 possible tokens - -error: expected one of `!`, `)`, `,`, `.`, `::`, `;`, `?`, `{`, or an operator, found `e` - --> $DIR/issue-88770.rs:11:1 - | -LL | e - | - expected one of 9 possible tokens -LL | e - | ^ unexpected token - -error: aborting due to 6 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr b/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr index 967a3e6fd..34217e21a 100644 --- a/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,14 +1,3 @@ -error: unexpected closing delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 - | -LL | fn main() { - | - this opening brace... -... -LL | } - | - ...matches this closing brace -LL | } - | ^ unexpected closing delimiter - error: mismatched closing delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:2:10 | @@ -18,5 +7,16 @@ LL | bar, "baz", 1, 2.0 LL | } | ^ mismatched closing delimiter +error: unexpected closing delimiter: `}` + --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 + | +LL | fn main() { + | - this delimiter might not be properly closed... +... +LL | } + | - ...as it matches this but it has different indentation +LL | } + | ^ unexpected closing delimiter + error: aborting due to 2 previous errors diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index 37d55aa53..ee1c8e562 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -2,10 +2,14 @@ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:26:27 | LL | Some(Val::Foo) => 3; - | -- ^- help: use a comma to end a `match` arm expression: `,` - | | | - | | this statement is not surrounded by a body + | -- ^ this statement is not surrounded by a body + | | | while parsing the `match` arm starting here + | +help: replace `;` with `,` to end a `match` arm expression + | +LL | Some(Val::Foo) => 3, + | ~ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11 diff --git a/tests/ui/parser/mbe_missing_right_paren.rs b/tests/ui/parser/mbe_missing_right_paren.rs index 689176b3e..9a92e67da 100644 --- a/tests/ui/parser/mbe_missing_right_paren.rs +++ b/tests/ui/parser/mbe_missing_right_paren.rs @@ -1,3 +1,3 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 3 previous errors +// error-pattern: this file contains an unclosed delimiter macro_rules! abc(ؼ \ No newline at end of file diff --git a/tests/ui/parser/mbe_missing_right_paren.stderr b/tests/ui/parser/mbe_missing_right_paren.stderr index ccaf77d39..d2af94683 100644 --- a/tests/ui/parser/mbe_missing_right_paren.stderr +++ b/tests/ui/parser/mbe_missing_right_paren.stderr @@ -6,26 +6,5 @@ LL | macro_rules! abc(ؼ | | | unclosed delimiter -error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/mbe_missing_right_paren.rs:3:17 - | -LL | macro_rules! abc(ؼ - | ^^ - | -help: change the delimiters to curly braces - | -LL | macro_rules! abc { /* items */ } - | ~~~~~~~~~~~~~~~ -help: add a semicolon - | -LL | macro_rules! abc(ؼ; - | + - -error: unexpected end of macro invocation - --> $DIR/mbe_missing_right_paren.rs:3:19 - | -LL | macro_rules! abc(ؼ - | ^ missing tokens in macro arguments - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs index 8f46970b1..79de98d8b 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs @@ -1,13 +1,13 @@ fn main() {} -impl T for () { //~ ERROR cannot find trait `T` in this scope +impl T for () { fn foo(&self) {} -trait T { //~ ERROR trait is not supported in `trait`s or `impl`s +trait T { fn foo(&self); } -pub(crate) struct Bar(); //~ ERROR struct is not supported in `trait`s or `impl`s +pub(crate) struct Bar(); //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr index cc7cc0c55..d91a7f054 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr @@ -7,28 +7,5 @@ LL | impl T for () { LL | | ^ -error: trait is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-impl-trait.rs:7:1 - | -LL | trait T { - | ^^^^^^^ - | - = help: consider moving the trait out to a nearby module scope - -error: struct is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-impl-trait.rs:11:1 - | -LL | pub(crate) struct Bar(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the struct out to a nearby module scope - -error[E0405]: cannot find trait `T` in this scope - --> $DIR/missing-close-brace-in-impl-trait.rs:3:6 - | -LL | impl T for () { - | ^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs index 090a17b41..88bc72576 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs @@ -1,7 +1,7 @@ pub(crate) struct Bar { foo: T, -trait T { //~ ERROR expected identifier, found keyword `trait` +trait T { fn foo(&self); } diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr index ad1e90e43..d01d9ed60 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr @@ -7,14 +7,5 @@ LL | pub(crate) struct Bar { LL | fn main() {} | ^ -error: expected identifier, found keyword `trait` - --> $DIR/missing-close-brace-in-struct.rs:4:1 - | -LL | pub(crate) struct Bar { - | --- while parsing this struct -... -LL | trait T { - | ^^^^^ expected identifier, found keyword - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs index b6932deb5..a05d6aa8e 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs @@ -2,10 +2,9 @@ trait T { fn foo(&self); pub(crate) struct Bar(); -//~^ ERROR struct is not supported in `trait`s or `impl`s impl T for Bar { -//~^ ERROR implementation is not supported in `trait`s or `impl`s + fn foo(&self) {} } diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr index 7c6254356..7418dd64c 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/missing-close-brace-in-trait.rs:12:65 + --> $DIR/missing-close-brace-in-trait.rs:11:65 | LL | trait T { | - unclosed delimiter @@ -7,21 +7,5 @@ LL | trait T { LL | fn main() {} | ^ -error: struct is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-trait.rs:4:1 - | -LL | pub(crate) struct Bar(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the struct out to a nearby module scope - -error: implementation is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-trait.rs:7:1 - | -LL | impl T for Bar { - | ^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the implementation out to a nearby module scope - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs index da95c1bfa..a56cd1777 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs +++ b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs @@ -17,7 +17,7 @@ fn test2(arg1 : T1, arg2 : T2) { fn test3<'a>(arg : &'a u32) { let v : Vec<'a = vec![]; //~^ ERROR: expected one of - //~| ERROR: type annotations needed for `Vec` + //~| ERROR: type annotations needed for `Vec<_>` } fn main() {} diff --git a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr index bad241634..b2448774a 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr +++ b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr @@ -39,26 +39,26 @@ help: you might have meant to end the type parameters here LL | let v : Vec<'a> = vec![]; | + -error[E0282]: type annotations needed for `Vec` +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7 | LL | let v : Vec<(u32,_) = vec![]; | ^ | -help: consider giving `v` an explicit type, where the type for type parameter `T` is specified +help: consider giving `v` an explicit type, where the placeholders `_` are specified | -LL | let v: Vec : Vec<(u32,_) = vec![]; +LL | let v: Vec<_> : Vec<(u32,_) = vec![]; | ++++++++ -error[E0282]: type annotations needed for `Vec` +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7 | LL | let v : Vec<'a = vec![]; | ^ | -help: consider giving `v` an explicit type, where the type for type parameter `T` is specified +help: consider giving `v` an explicit type, where the placeholders `_` are specified | -LL | let v: Vec : Vec<'a = vec![]; +LL | let v: Vec<_> : Vec<'a = vec![]; | ++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/parser/missing-expression-in-for-loop.rs b/tests/ui/parser/missing-expression-in-for-loop.rs new file mode 100644 index 000000000..518a89a0e --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.rs @@ -0,0 +1,5 @@ +fn main() { + for i in { + //~^ ERROR missing expression to iterate on in `for` loop + } +} diff --git a/tests/ui/parser/missing-expression-in-for-loop.stderr b/tests/ui/parser/missing-expression-in-for-loop.stderr new file mode 100644 index 000000000..74a7c4224 --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.stderr @@ -0,0 +1,13 @@ +error: missing expression to iterate on in `for` loop + --> $DIR/missing-expression-in-for-loop.rs:2:14 + | +LL | for i in { + | ^ + | +help: try adding an expression to the `for` loop + | +LL | for i in /* expression */ { + | ++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/parser/missing_right_paren.rs b/tests/ui/parser/missing_right_paren.rs index 810dee957..e240f8c67 100644 --- a/tests/ui/parser/missing_right_paren.rs +++ b/tests/ui/parser/missing_right_paren.rs @@ -1,3 +1,4 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 4 previous errors +// error-pattern: this file contains an unclosed delimiter +// error-pattern: aborting due to previous error fn main((ؼ \ No newline at end of file diff --git a/tests/ui/parser/missing_right_paren.stderr b/tests/ui/parser/missing_right_paren.stderr index 3fe0d0f42..994ce4d85 100644 --- a/tests/ui/parser/missing_right_paren.stderr +++ b/tests/ui/parser/missing_right_paren.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/missing_right_paren.rs:3:11 + --> $DIR/missing_right_paren.rs:4:11 | LL | fn main((ؼ | -- ^ @@ -7,26 +7,5 @@ LL | fn main((ؼ | |unclosed delimiter | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | -- ^ - | || - | |unclosed delimiter - | unclosed delimiter - -error: expected one of `:` or `|`, found `)` - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | ^ expected one of `:` or `|` - -error: expected one of `->`, `where`, or `{`, found `` - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | ^ expected one of `->`, `where`, or `{` - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/parser-recovery-1.rs b/tests/ui/parser/parser-recovery-1.rs index 7e26b4f2b..5f729665c 100644 --- a/tests/ui/parser/parser-recovery-1.rs +++ b/tests/ui/parser/parser-recovery-1.rs @@ -3,11 +3,8 @@ trait Foo { fn bar() { let x = foo(); - //~^ ERROR cannot find function `foo` in this scope } fn main() { let x = y.; - //~^ ERROR unexpected token - //~| ERROR cannot find value `y` in this scope } //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/parser-recovery-1.stderr b/tests/ui/parser/parser-recovery-1.stderr index 0cb771ea3..7045b6f5b 100644 --- a/tests/ui/parser/parser-recovery-1.stderr +++ b/tests/ui/parser/parser-recovery-1.stderr @@ -1,35 +1,16 @@ error: this file contains an unclosed delimiter - --> $DIR/parser-recovery-1.rs:13:54 + --> $DIR/parser-recovery-1.rs:10:54 | LL | trait Foo { | - unclosed delimiter LL | fn bar() { | - this delimiter might not be properly closed... -... +LL | let x = foo(); LL | } | - ...as it matches this but it has different indentation ... LL | } | ^ -error: unexpected token: `;` - --> $DIR/parser-recovery-1.rs:10:15 - | -LL | let x = y.; - | ^ - -error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-1.rs:10:13 - | -LL | let x = y.; - | ^ not found in this scope - -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-1.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/parser-recovery-2.rs b/tests/ui/parser/parser-recovery-2.rs index 48b22afff..203d8aac6 100644 --- a/tests/ui/parser/parser-recovery-2.rs +++ b/tests/ui/parser/parser-recovery-2.rs @@ -2,11 +2,10 @@ trait Foo { fn bar() { - let x = foo(); //~ ERROR cannot find function `foo` in this scope + let x = foo(); ) //~ ERROR mismatched closing delimiter: `)` } fn main() { - let x = y.; //~ ERROR unexpected token - //~^ ERROR cannot find value `y` in this scope + let x = y.; } diff --git a/tests/ui/parser/parser-recovery-2.stderr b/tests/ui/parser/parser-recovery-2.stderr index 8829cf4c1..f396e5fde 100644 --- a/tests/ui/parser/parser-recovery-2.stderr +++ b/tests/ui/parser/parser-recovery-2.stderr @@ -1,9 +1,3 @@ -error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:10:15 - | -LL | let x = y.; - | ^ - error: mismatched closing delimiter: `)` --> $DIR/parser-recovery-2.rs:4:14 | @@ -13,18 +7,5 @@ LL | let x = foo(); LL | ) | ^ mismatched closing delimiter -error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-2.rs:10:13 - | -LL | let x = y.; - | ^ not found in this scope - -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-2.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/raw/too-many-hash.rs b/tests/ui/parser/raw/too-many-hash.rs new file mode 100644 index 000000000..f3d3b207f --- /dev/null +++ b/tests/ui/parser/raw/too-many-hash.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let s: &str = r################################################################################################################################################################################################################################################################"very raw"################################################################################################################################################################################################################################################################; + //~^ ERROR too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 +} diff --git a/tests/ui/parser/raw/too-many-hash.stderr b/tests/ui/parser/raw/too-many-hash.stderr new file mode 100644 index 000000000..29ec17842 --- /dev/null +++ b/tests/ui/parser/raw/too-many-hash.stderr @@ -0,0 +1,8 @@ +error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 + --> $DIR/too-many-hash.rs:4:19 + | +LL | ... = r################################################################################################################################################################################################################################################################"very raw"##############################################################################################################################################################################################################################################################... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/parser/recover-fn-ptr-with-generics.stderr b/tests/ui/parser/recover-fn-ptr-with-generics.stderr index 1da9c1857..069fcffe9 100644 --- a/tests/ui/parser/recover-fn-ptr-with-generics.stderr +++ b/tests/ui/parser/recover-fn-ptr-with-generics.stderr @@ -88,12 +88,6 @@ error: expected identifier, found `>` LL | type QuiteBroken = fn(); | ^ expected identifier -error: lifetime bounds cannot be used in this context - --> $DIR/recover-fn-ptr-with-generics.rs:22:26 - | -LL | let _: extern fn<'a: 'static>(); - | ^^^^^^^ - error[E0412]: cannot find type `T` in this scope --> $DIR/recover-fn-ptr-with-generics.rs:5:27 | @@ -106,6 +100,12 @@ error[E0412]: cannot find type `T` in this scope LL | type Identity = fn(T) -> T; | ^ not found in this scope +error: lifetime bounds cannot be used in this context + --> $DIR/recover-fn-ptr-with-generics.rs:22:26 + | +LL | let _: extern fn<'a: 'static>(); + | ^^^^^^^ + error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/recover-quantified-closure.rs b/tests/ui/parser/recover-quantified-closure.rs index df22f5e06..10af39b70 100644 --- a/tests/ui/parser/recover-quantified-closure.rs +++ b/tests/ui/parser/recover-quantified-closure.rs @@ -7,6 +7,6 @@ fn main() { enum Foo { Bar } fn foo(x: impl Iterator) { for ::Bar in x {} - //~^ ERROR expected one of `const`, `move`, `static`, `|` + //~^ ERROR expected one of `move`, `static`, `|` //~^^ ERROR `for<...>` binders for closures are experimental } diff --git a/tests/ui/parser/recover-quantified-closure.stderr b/tests/ui/parser/recover-quantified-closure.stderr index 9ec4d2c03..39eec80f6 100644 --- a/tests/ui/parser/recover-quantified-closure.stderr +++ b/tests/ui/parser/recover-quantified-closure.stderr @@ -1,8 +1,8 @@ -error: expected one of `const`, `move`, `static`, `|`, or `||`, found `::` +error: expected one of `move`, `static`, `|`, or `||`, found `::` --> $DIR/recover-quantified-closure.rs:9:14 | LL | for ::Bar in x {} - | ^^ expected one of `const`, `move`, `static`, `|`, or `||` + | ^^ expected one of `move`, `static`, `|`, or `||` error[E0658]: `for<...>` binders for closures are experimental --> $DIR/recover-quantified-closure.rs:2:5 diff --git a/tests/ui/parser/recover-range-pats.stderr b/tests/ui/parser/recover-range-pats.stderr index c54f13e01..5b69ca5cd 100644 --- a/tests/ui/parser/recover-range-pats.stderr +++ b/tests/ui/parser/recover-range-pats.stderr @@ -314,7 +314,7 @@ error[E0308]: mismatched types LL | if let X.. .0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` @@ -351,7 +351,7 @@ error[E0308]: mismatched types LL | if let X..=.0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` @@ -388,7 +388,7 @@ error[E0308]: mismatched types LL | if let X... .0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.fixed b/tests/ui/parser/suggest_misplaced_generics/enum.fixed new file mode 100644 index 000000000..3332118a1 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +enum Foo { Variant(T) } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the enum name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.rs b/tests/ui/parser/suggest_misplaced_generics/enum.rs new file mode 100644 index 000000000..5a2289c5c --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +enum Foo { Variant(T) } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the enum name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.stderr b/tests/ui/parser/suggest_misplaced_generics/enum.stderr new file mode 100644 index 000000000..5f5947627 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/enum.rs:5:5 + | +LL | enum Foo { Variant(T) } + | ^ expected identifier + | +help: place the generic parameter name after the enum name + | +LL - enum Foo { Variant(T) } +LL + enum Foo { Variant(T) } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs b/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs new file mode 100644 index 000000000..1dc182398 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs @@ -0,0 +1,9 @@ +// Issue: 103366 +// there is already an existing generic on f, so don't show a suggestion + +#[allow(unused)] +fn<'a, B: 'a + std::ops::Add> f(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr new file mode 100644 index 000000000..89716e6f1 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `<` + --> $DIR/existing_generics.rs:5:3 + | +LL | fn<'a, B: 'a + std::ops::Add> f(_x: B) { } + | ^ expected identifier + | + = help: place the generic parameter name after the fn name + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed new file mode 100644 index 000000000..84bf64bd6 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn f<'a, B: 'a + std::ops::Add>(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs new file mode 100644 index 000000000..d0684397e --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn<'a, B: 'a + std::ops::Add> f(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr new file mode 100644 index 000000000..061d0910a --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/fn-complex-generics.rs:5:3 + | +LL | fn<'a, B: 'a + std::ops::Add> f(_x: B) { } + | ^ expected identifier + | +help: place the generic parameter name after the fn name + | +LL - fn<'a, B: 'a + std::ops::Add> f(_x: B) { } +LL + fn f<'a, B: 'a + std::ops::Add>(_x: B) { } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs new file mode 100644 index 000000000..7fcb6a82c --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs @@ -0,0 +1,8 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// The generics fail to parse here, so don't make any suggestions/help + +#[allow(unused)] +fn<~>()> id(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr new file mode 100644 index 000000000..47e120169 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr @@ -0,0 +1,8 @@ +error: expected identifier, found `<` + --> $DIR/fn-invalid-generics.rs:5:3 + | +LL | fn<~>()> id(x: T) -> T { x } + | ^ expected identifier + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed b/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed new file mode 100644 index 000000000..cbfd5f2d3 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn id(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs b/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs new file mode 100644 index 000000000..b207cf70d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn id(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr new file mode 100644 index 000000000..e749f1a0d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/fn-simple.rs:5:3 + | +LL | fn id(x: T) -> T { x } + | ^ expected identifier + | +help: place the generic parameter name after the fn name + | +LL - fn id(x: T) -> T { x } +LL + fn id(x: T) -> T { x } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.fixed b/tests/ui/parser/suggest_misplaced_generics/struct.fixed new file mode 100644 index 000000000..fec05bdec --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +struct Foo { x: T } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the struct name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.rs b/tests/ui/parser/suggest_misplaced_generics/struct.rs new file mode 100644 index 000000000..6b80150d5 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +struct Foo { x: T } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the struct name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.stderr b/tests/ui/parser/suggest_misplaced_generics/struct.stderr new file mode 100644 index 000000000..2b6509070 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/struct.rs:5:7 + | +LL | struct Foo { x: T } + | ^ expected identifier + | +help: place the generic parameter name after the struct name + | +LL - struct Foo { x: T } +LL + struct Foo { x: T } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.fixed b/tests/ui/parser/suggest_misplaced_generics/trait.fixed new file mode 100644 index 000000000..a471a078a --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.fixed @@ -0,0 +1,11 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +trait Foo { + //~^ ERROR expected identifier, found `<` + //~| HELP place the generic parameter name after the trait name +} + + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.rs b/tests/ui/parser/suggest_misplaced_generics/trait.rs new file mode 100644 index 000000000..55355f451 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.rs @@ -0,0 +1,11 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +trait Foo { + //~^ ERROR expected identifier, found `<` + //~| HELP place the generic parameter name after the trait name +} + + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.stderr b/tests/ui/parser/suggest_misplaced_generics/trait.stderr new file mode 100644 index 000000000..ac86cfa46 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/trait.rs:5:6 + | +LL | trait Foo { + | ^ expected identifier + | +help: place the generic parameter name after the trait name + | +LL - trait Foo { +LL + trait Foo { + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/type.fixed b/tests/ui/parser/suggest_misplaced_generics/type.fixed new file mode 100644 index 000000000..a97b9e66d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +type Foo = T; +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the type name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/type.rs b/tests/ui/parser/suggest_misplaced_generics/type.rs new file mode 100644 index 000000000..17e200536 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +type Foo = T; +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the type name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/type.stderr b/tests/ui/parser/suggest_misplaced_generics/type.stderr new file mode 100644 index 000000000..22744f6cf --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/type.rs:5:5 + | +LL | type Foo = T; + | ^ expected identifier + | +help: place the generic parameter name after the type name + | +LL - type Foo = T; +LL + type Foo = T; + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/trait-object-delimiters.rs b/tests/ui/parser/trait-object-delimiters.rs index cc04ac052..c41cda187 100644 --- a/tests/ui/parser/trait-object-delimiters.rs +++ b/tests/ui/parser/trait-object-delimiters.rs @@ -5,6 +5,8 @@ fn foo1(_: &dyn Drop + AsRef) {} //~ ERROR ambiguous `+` in a type fn foo2(_: &dyn (Drop + AsRef)) {} //~ ERROR incorrect braces around trait bounds +fn foo2_no_space(_: &dyn(Drop + AsRef)) {} //~ ERROR incorrect braces around trait bounds + fn foo3(_: &dyn {Drop + AsRef}) {} //~ ERROR expected parameter name, found `{` //~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` //~| ERROR at least one trait is required for an object type diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr index 99c451545..ccce3a805 100644 --- a/tests/ui/parser/trait-object-delimiters.stderr +++ b/tests/ui/parser/trait-object-delimiters.stderr @@ -13,17 +13,29 @@ LL | fn foo2(_: &dyn (Drop + AsRef)) {} help: remove the parentheses | LL - fn foo2(_: &dyn (Drop + AsRef)) {} -LL + fn foo2(_: &dyn Drop + AsRef) {} +LL + fn foo2(_: &dyn Drop + AsRef) {} + | + +error: incorrect braces around trait bounds + --> $DIR/trait-object-delimiters.rs:8:25 + | +LL | fn foo2_no_space(_: &dyn(Drop + AsRef)) {} + | ^ ^ + | +help: remove the parentheses + | +LL - fn foo2_no_space(_: &dyn(Drop + AsRef)) {} +LL + fn foo2_no_space(_: &dyn Drop + AsRef) {} | error: expected parameter name, found `{` - --> $DIR/trait-object-delimiters.rs:8:17 + --> $DIR/trait-object-delimiters.rs:10:17 | LL | fn foo3(_: &dyn {Drop + AsRef}) {} | ^ expected parameter name error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` - --> $DIR/trait-object-delimiters.rs:8:17 + --> $DIR/trait-object-delimiters.rs:10:17 | LL | fn foo3(_: &dyn {Drop + AsRef}) {} | -^ expected one of 10 possible tokens @@ -31,13 +43,13 @@ LL | fn foo3(_: &dyn {Drop + AsRef}) {} | help: missing `,` error: expected identifier, found `<` - --> $DIR/trait-object-delimiters.rs:12:17 + --> $DIR/trait-object-delimiters.rs:14:17 | LL | fn foo4(_: &dyn >) {} | ^ expected identifier error: invalid `dyn` keyword - --> $DIR/trait-object-delimiters.rs:14:25 + --> $DIR/trait-object-delimiters.rs:16:25 | LL | fn foo5(_: &(dyn Drop + dyn AsRef)) {} | ^^^ help: remove this keyword @@ -56,13 +68,13 @@ LL | fn foo1(_: &dyn Drop + AsRef) {} = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit error[E0224]: at least one trait is required for an object type - --> $DIR/trait-object-delimiters.rs:8:13 + --> $DIR/trait-object-delimiters.rs:10:13 | LL | fn foo3(_: &dyn {Drop + AsRef}) {} | ^^^ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-object-delimiters.rs:14:29 + --> $DIR/trait-object-delimiters.rs:16:29 | LL | fn foo5(_: &(dyn Drop + dyn AsRef)) {} | ---- ^^^^^^^^^^ additional non-auto trait @@ -72,7 +84,7 @@ LL | fn foo5(_: &(dyn Drop + dyn AsRef)) {} = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0224, E0225. For more information about an error, try `rustc --explain E0224`. diff --git a/tests/ui/parser/type-ascription-in-pattern.rs b/tests/ui/parser/type-ascription-in-pattern.rs new file mode 100644 index 000000000..fec168afb --- /dev/null +++ b/tests/ui/parser/type-ascription-in-pattern.rs @@ -0,0 +1,16 @@ +fn foo(x: bool) -> i32 { + match x { + x: i32 => x, //~ ERROR expected + //~^ ERROR mismatched types + true => 42., + false => 0.333, + } +} + +fn main() { + match foo(true) { + 42: i32 => (), //~ ERROR expected + _: f64 => (), //~ ERROR expected + x: i32 => (), //~ ERROR expected + } +} diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr new file mode 100644 index 000000000..091907549 --- /dev/null +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -0,0 +1,54 @@ +error: expected one of `@` or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:3:10 + | +LL | x: i32 => x, + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `@` or `|` + | +help: maybe write a path separator here + | +LL | x::i32 => x, + | ~~ + +error: expected one of `...`, `..=`, `..`, or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:12:11 + | +LL | 42: i32 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `...`, `..=`, `..`, or `|` + +error: expected `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:13:10 + | +LL | _: f64 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected `|` + +error: expected one of `@` or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:14:10 + | +LL | x: i32 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `@` or `|` + | +help: maybe write a path separator here + | +LL | x::i32 => (), + | ~~ + +error[E0308]: mismatched types + --> $DIR/type-ascription-in-pattern.rs:3:19 + | +LL | fn foo(x: bool) -> i32 { + | --- expected `i32` because of return type +LL | match x { +LL | x: i32 => x, + | ^ expected `i32`, found `bool` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs index 6db1b66e9..4de83ee64 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.rs +++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs @@ -2,5 +2,4 @@ mod unclosed_delim_mod; fn main() { let _: usize = unclosed_delim_mod::new(); - //~^ ERROR mismatched types } diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.stderr b/tests/ui/parser/unclosed-delimiter-in-dep.stderr index 1366ef1bb..a46d020b9 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/tests/ui/parser/unclosed-delimiter-in-dep.stderr @@ -9,17 +9,5 @@ LL | } LL | } | ^ mismatched closing delimiter -error[E0308]: mismatched types - --> $DIR/unclosed-delimiter-in-dep.rs:4:20 - | -LL | let _: usize = unclosed_delim_mod::new(); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found enum `Result` - | | - | expected due to this - | - = note: expected type `usize` - found enum `Result` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/use-unclosed-brace.rs b/tests/ui/parser/use-unclosed-brace.rs index 41742f37f..fcfe95b26 100644 --- a/tests/ui/parser/use-unclosed-brace.rs +++ b/tests/ui/parser/use-unclosed-brace.rs @@ -1,6 +1,4 @@ -// error-pattern: expected one of `,`, `::`, `as`, or `}`, found `;` // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected item, found `}` use foo::{bar, baz; use std::fmt::Display; diff --git a/tests/ui/parser/use-unclosed-brace.stderr b/tests/ui/parser/use-unclosed-brace.stderr index 438fe9c47..ad5bb2de1 100644 --- a/tests/ui/parser/use-unclosed-brace.stderr +++ b/tests/ui/parser/use-unclosed-brace.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/use-unclosed-brace.rs:12:14 + --> $DIR/use-unclosed-brace.rs:10:14 | LL | use foo::{bar, baz; | - unclosed delimiter @@ -7,21 +7,5 @@ LL | use foo::{bar, baz; LL | fn main() {} | ^ -error: expected one of `,`, `::`, `as`, or `}`, found `;` - --> $DIR/use-unclosed-brace.rs:4:10 - | -LL | use foo::{bar, baz; - | ^ ^ - | | | - | | expected one of `,`, `::`, `as`, or `}` - | | help: `}` may belong here - | unclosed delimiter - -error: expected item, found `}` - --> $DIR/use-unclosed-brace.rs:12:14 - | -LL | fn main() {} - | ^ expected item - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index c8b45fd24..29cd6c45c 100644 --- a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -4,8 +4,8 @@ error: cannot move out of value because it is borrowed LL | Some(ref _y @ _z) => {} | ------^^^-- | | | - | | value moved into `_z` here - | value borrowed, by `_y`, here + | | value is moved into `_z` here + | value is borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:19:14 @@ -28,8 +28,8 @@ error: cannot move out of value because it is borrowed LL | Some(ref mut _y @ _z) => {} | ----------^^^-- | | | - | | value moved into `_z` here - | value borrowed, by `_y`, here + | | value is moved into `_z` here + | value is mutably borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:33:14 diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index f27df32cc..2c123b01e 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -4,8 +4,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ box b = Box::new(NC); | -----^^^^^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:34:9 @@ -13,8 +13,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ box ref mut b = Box::new(nc()); | -----^^^^^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:36:9 @@ -22,8 +22,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:38:9 @@ -31,8 +31,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:42:9 @@ -40,8 +40,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:48:9 @@ -49,8 +49,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ box ref b = Box::new(NC); | ---------^^^^^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:62:9 @@ -58,8 +58,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ box ref b => { | ---------^^^^^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:54:11 @@ -67,8 +67,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | fn f5(ref mut a @ box ref b: Box) { | ---------^^^^^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error[E0382]: borrow of moved value --> $DIR/borrowck-pat-at-and-box.rs:31:9 diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index 770bb8953..4f7fbc9e0 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -4,8 +4,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ b = U; | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:9 @@ -13,9 +13,9 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | value moved into `e` here - | | value moved into `c` here - | value borrowed, by `a`, here + | | | value is moved into `e` here + | | value is moved into `c` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:18 @@ -23,8 +23,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^----- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:33 @@ -32,8 +32,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^- | | | - | | value moved into `e` here - | value borrowed, by `d`, here + | | value is moved into `e` here + | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 @@ -41,9 +41,9 @@ error: cannot move out of value because it is borrowed LL | let ref mut a @ [b, mut c] = [U, U]; | ---------^^^^-^^-----^ | | | | - | | | value moved into `c` here - | | value moved into `b` here - | value borrowed, by `a`, here + | | | value is moved into `c` here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 @@ -51,8 +51,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ b = u(); | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:9 @@ -60,9 +60,9 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | value moved into `e` here - | | value moved into `c` here - | value borrowed, by `a`, here + | | | value is moved into `e` here + | | value is moved into `c` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 @@ -70,8 +70,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^----- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 @@ -79,8 +79,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^- | | | - | | value moved into `e` here - | value borrowed, by `d`, here + | | value is moved into `e` here + | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 @@ -88,9 +88,9 @@ error: cannot move out of value because it is borrowed LL | let ref mut a @ [b, mut c] = [u(), u()]; | ---------^^^^-^^-----^ | | | | - | | | value moved into `c` here - | | value moved into `b` here - | value borrowed, by `a`, here + | | | value is moved into `c` here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:47:9 @@ -98,8 +98,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some(b) => {} | -----^^^^^^^^-^ | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:9 @@ -107,9 +107,9 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ | | | | - | | | value moved into `e` here - | | value moved into `c` here - | value borrowed, by `a`, here + | | | value is moved into `e` here + | | value is moved into `c` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:23 @@ -117,8 +117,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^----- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:38 @@ -126,8 +126,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^- | | | - | | value moved into `e` here - | value borrowed, by `d`, here + | | value is moved into `e` here + | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:59:9 @@ -135,9 +135,9 @@ error: cannot move out of value because it is borrowed LL | ref mut a @ Some([b, mut c]) => {} | ---------^^^^^^^^^-^^-----^^ | | | | - | | | value moved into `c` here - | | value moved into `b` here - | value borrowed, by `a`, here + | | | value is moved into `c` here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:64:9 @@ -145,8 +145,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some(b) => {} | -----^^^^^^^^-^ | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:9 @@ -154,9 +154,9 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ | | | | - | | | value moved into `e` here - | | value moved into `c` here - | value borrowed, by `a`, here + | | | value is moved into `e` here + | | value is moved into `c` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 @@ -164,8 +164,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^----- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 @@ -173,8 +173,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^- | | | - | | value moved into `e` here - | value borrowed, by `d`, here + | | value is moved into `e` here + | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:78:9 @@ -182,9 +182,9 @@ error: cannot move out of value because it is borrowed LL | ref mut a @ Some([b, mut c]) => {} | ---------^^^^^^^^^-^^-----^^ | | | | - | | | value moved into `c` here - | | value moved into `b` here - | value borrowed, by `a`, here + | | | value is moved into `c` here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 @@ -192,8 +192,8 @@ error: cannot move out of value because it is borrowed LL | fn f1(ref a @ b: U) {} | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:11 @@ -201,9 +201,9 @@ error: cannot move out of value because it is borrowed LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | value moved into `e` here - | | value moved into `c` here - | value borrowed, by `a`, here + | | | value is moved into `e` here + | | value is moved into `c` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 @@ -211,8 +211,8 @@ error: cannot move out of value because it is borrowed LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^----- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 @@ -220,8 +220,8 @@ error: cannot move out of value because it is borrowed LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^- | | | - | | value moved into `e` here - | value borrowed, by `d`, here + | | value is moved into `e` here + | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 @@ -229,9 +229,9 @@ error: cannot move out of value because it is borrowed LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} | ---------^^^^-^^-----^ | | | | - | | | value moved into `c` here - | | value moved into `b` here - | value borrowed, by `a`, here + | | | value is moved into `c` here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 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 8546b4bb4..f51b50418 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 @@ -4,8 +4,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut z @ &mut Some(ref a) => { | ---------^^^^^^^^^^^^^-----^ | | | - | | immutable borrow, by `a`, occurs here - | mutable borrow, by `z`, occurs here + | | value is borrowed by `a` here + | value is mutably borrowed by `z` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9 @@ -13,9 +13,9 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | ---------^^^^-----------------^ | | | | - | | | another mutable borrow, by `c`, occurs here - | | also borrowed as immutable, by `b`, here - | first mutable borrow, by `a`, occurs here + | | | value is mutably borrowed by `c` here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22 @@ -23,8 +23,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | -----^^^--------- | | | - | | mutable borrow, by `c`, occurs here - | immutable borrow, by `b`, occurs here + | | value is mutably borrowed by `c` here + | value is borrowed by `b` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9 @@ -32,8 +32,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ ref mut b = U; | -----^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 @@ -41,8 +41,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ ref b = U; | ---------^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 @@ -50,9 +50,9 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow, by `c`, occurs here - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | | value is mutably borrowed by `c` here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9 @@ -60,9 +60,9 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ | | | | - | | | immutable borrow, by `c`, occurs here - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | | value is borrowed by `c` here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 @@ -70,8 +70,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ ref b = u(); | ---------^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 @@ -79,8 +79,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ ref mut b = u(); | -----^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9 @@ -88,8 +88,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ ref b = U; | ---------^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9 @@ -97,8 +97,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ ref mut b = U; | -----^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9 @@ -106,8 +106,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33 @@ -115,8 +115,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9 @@ -124,8 +124,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33 @@ -133,8 +133,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9 @@ -142,8 +142,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33 @@ -151,8 +151,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9 @@ -160,8 +160,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33 @@ -169,8 +169,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9 @@ -178,8 +178,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33 @@ -187,8 +187,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^^---------^ | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9 @@ -196,8 +196,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33 @@ -205,8 +205,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^^-----^ | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 @@ -214,9 +214,9 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow, by `c`, occurs here - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | | value is mutably borrowed by `c` here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 @@ -224,9 +224,9 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow, by `c`, occurs here - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | | value is mutably borrowed by `c` here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 @@ -234,9 +234,9 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow, by `c`, occurs here - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | | value is mutably borrowed by `c` here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9 @@ -244,9 +244,9 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ | | | | - | | | immutable borrow, by `c`, occurs here - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | | value is borrowed by `c` here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11 @@ -254,8 +254,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | fn f1(ref a @ ref mut b: U) {} | -----^^^--------- | | | - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11 @@ -263,8 +263,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable LL | fn f2(ref mut a @ ref b: U) {} | ---------^^^----- | | | - | | immutable borrow, by `b`, occurs here - | mutable borrow, by `a`, occurs here + | | value is borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11 @@ -272,8 +272,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} | -----^^^^^^^^^^^----------------^^^^^^^^ | | | - | | mutable borrow, by `mid`, occurs here - | immutable borrow, by `a`, occurs here + | | value is mutably borrowed by `mid` here + | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22 @@ -281,9 +281,9 @@ error: cannot borrow value as mutable because it is also borrowed as immutable LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} | -----^^^------------- | | | | - | | | also moved into `c` here - | | mutable borrow, by `b`, occurs here - | immutable borrow, by `a`, occurs here + | | | value is moved into `c` here + | | value is mutably borrowed by `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 @@ -291,8 +291,8 @@ error: cannot move out of value because it is borrowed LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} | ---------^^^- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is mutably borrowed by `b` here error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31 diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index ad4ce7952..a0cb04a06 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -4,8 +4,8 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 @@ -13,8 +13,8 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:33:9 @@ -22,8 +22,8 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:36:9 @@ -31,8 +31,8 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 @@ -40,8 +40,8 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:44:9 @@ -49,18 +49,18 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ( | ^-------- | | - | _________first mutable borrow, by `a`, occurs here + | _________value is mutably borrowed by `a` here | | LL | | LL | | ref mut b, - | | --------- another mutable borrow, by `b`, occurs here + | | --------- value is mutably borrowed by `b` here LL | | [ LL | | ref mut c, - | | --------- another mutable borrow, by `c`, occurs here + | | --------- value is mutably borrowed by `c` here LL | | ref mut d, - | | --------- another mutable borrow, by `d`, occurs here + | | --------- value is mutably borrowed by `d` here LL | | ref e, - | | ----- also borrowed as immutable, by `e`, here + | | ----- value is borrowed by `e` here LL | | ] LL | | ) = (U, [U, U, U]); | |_____^ @@ -71,18 +71,18 @@ error: cannot borrow value as mutable more than once at a time LL | let ref mut a @ ( | ^-------- | | - | _________first mutable borrow, by `a`, occurs here + | _________value is mutably borrowed by `a` here | | LL | | LL | | ref mut b, - | | --------- another mutable borrow, by `b`, occurs here + | | --------- value is mutably borrowed by `b` here LL | | [ LL | | ref mut c, - | | --------- another mutable borrow, by `c`, occurs here + | | --------- value is mutably borrowed by `c` here LL | | ref mut d, - | | --------- another mutable borrow, by `d`, occurs here + | | --------- value is mutably borrowed by `d` here LL | | ref e, - | | ----- also borrowed as immutable, by `e`, here + | | ----- value is borrowed by `e` here LL | | ] LL | | ) = (u(), [u(), u(), u()]); | |_________^ @@ -157,8 +157,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:76:37 @@ -166,8 +166,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9 @@ -175,8 +175,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37 @@ -184,8 +184,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:9 @@ -193,8 +193,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:37 @@ -202,8 +202,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:9 @@ -211,8 +211,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:37 @@ -220,8 +220,8 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:8:11 @@ -229,8 +229,8 @@ error: cannot borrow value as mutable more than once at a time LL | fn f1(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11 @@ -238,8 +238,8 @@ error: cannot borrow value as mutable more than once at a time LL | fn f2(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:13:9 @@ -247,13 +247,13 @@ error: cannot borrow value as mutable more than once at a time LL | ref mut a @ [ | ^-------- | | - | _________first mutable borrow, by `a`, occurs here + | _________value is mutably borrowed by `a` here | | LL | | LL | | [ref b @ .., _], - | | ---------- also borrowed as immutable, by `b`, here + | | ---------- value is borrowed by `b` here LL | | [_, ref mut mid @ ..], - | | ---------------- another mutable borrow, by `mid`, occurs here + | | ---------------- value is mutably borrowed by `mid` here LL | | .., LL | | [..], LL | | ] : [[U; 4]; 5] @@ -265,9 +265,9 @@ error: cannot borrow value as mutable more than once at a time LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} | ---------^^^------------- | | | | - | | | also moved into `c` here - | | another mutable borrow, by `b`, occurs here - | first mutable borrow, by `a`, occurs here + | | | value is moved into `c` here + | | value is mutably borrowed by `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 @@ -275,8 +275,8 @@ error: cannot move out of value because it is borrowed LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} | ---------^^^- | | | - | | value moved into `c` here - | value borrowed, by `b`, here + | | value is moved into `c` here + | value is mutably borrowed by `b` here error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 diff --git a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index 638bdd6db..73ebbf481 100644 --- a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -4,8 +4,8 @@ error: cannot move out of value because it is borrowed LL | let ref a @ b = NotCopy; | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 @@ -13,8 +13,8 @@ error: cannot move out of value because it is borrowed LL | let ref mut a @ b = NotCopy; | ---------^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:34:12 @@ -22,8 +22,8 @@ error: cannot move out of value because it is borrowed LL | Ok(ref a @ b) | Err(b @ ref a) => { | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:34:29 @@ -46,8 +46,8 @@ error: cannot move out of value because it is borrowed LL | ref a @ b => { | -----^^^- | | | - | | value moved into `b` here - | value borrowed, by `a`, here + | | value is moved into `b` here + | value is borrowed by `a` here error[E0382]: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 diff --git a/tests/ui/pattern/for-loop-bad-item.stderr b/tests/ui/pattern/for-loop-bad-item.stderr index f064a25a9..67c6d6f01 100644 --- a/tests/ui/pattern/for-loop-bad-item.stderr +++ b/tests/ui/pattern/for-loop-bad-item.stderr @@ -25,7 +25,7 @@ error[E0308]: mismatched types LL | for Some(Qux(_)) | None in [Some(""), None] { | ^^^^^^ ---------------- this is an iterator with items of type `Option<&str>` | | - | expected `str`, found struct `Qux` + | expected `str`, found `Qux` error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr b/tests/ui/pattern/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr index 75a231f6b..daab3a862 100644 --- a/tests/ui/pattern/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr +++ b/tests/ui/pattern/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let P() = U {}; | ^^^ ---- this expression has type `U` | | - | expected struct `U`, found struct `P` + | expected `U`, found `P<_>` | = note: expected struct `U` found struct `P<_>` diff --git a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr index 1b93267b3..c7c7c074f 100644 --- a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr +++ b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed --> $DIR/borrowck-move-ref-pattern.rs:8:24 | +LL | let mut arr = [U, U, U, U, U]; + | ------- binding `arr` declared here LL | let hold_all = &arr; | ---- borrow of `arr` occurs here LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; diff --git a/tests/ui/pattern/pat-struct-field-expr-has-type.stderr b/tests/ui/pattern/pat-struct-field-expr-has-type.stderr index 3a61d4293..029075293 100644 --- a/tests/ui/pattern/pat-struct-field-expr-has-type.stderr +++ b/tests/ui/pattern/pat-struct-field-expr-has-type.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match (S { f: 42 }) { | ------------- this expression has type `S` LL | S { f: Ok(_) } => {} - | ^^^^^ expected `u8`, found enum `Result` + | ^^^^^ expected `u8`, found `Result<_, _>` | = note: expected type `u8` found enum `Result<_, _>` diff --git a/tests/ui/pattern/pat-type-err-formal-param.stderr b/tests/ui/pattern/pat-type-err-formal-param.stderr index 206713a4b..4f482c52a 100644 --- a/tests/ui/pattern/pat-type-err-formal-param.stderr +++ b/tests/ui/pattern/pat-type-err-formal-param.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn foo(Tuple(_): String) {} | ^^^^^^^^ ------ expected due to this | | - | expected struct `String`, found struct `Tuple` + | expected `String`, found `Tuple` error: aborting due to previous error diff --git a/tests/ui/pattern/pat-type-err-let-stmt.stderr b/tests/ui/pattern/pat-type-err-let-stmt.stderr index 090bd6711..b68b69a78 100644 --- a/tests/ui/pattern/pat-type-err-let-stmt.stderr +++ b/tests/ui/pattern/pat-type-err-let-stmt.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/pat-type-err-let-stmt.rs:6:29 | LL | let Ok(0): Option = 42u8; - | ---------- ^^^^ expected enum `Option`, found `u8` + | ---------- ^^^^ expected `Option`, found `u8` | | | expected due to this | @@ -19,7 +19,7 @@ error[E0308]: mismatched types LL | let Ok(0): Option = 42u8; | ^^^^^ ---------- expected due to this | | - | expected enum `Option`, found enum `Result` + | expected `Option`, found `Result<_, _>` | = note: expected enum `Option` found enum `Result<_, _>` @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | let Ok(0): Option; | ^^^^^ ---------- expected due to this | | - | expected enum `Option`, found enum `Result` + | expected `Option`, found `Result<_, _>` | = note: expected enum `Option` found enum `Result<_, _>` @@ -41,7 +41,7 @@ error[E0308]: mismatched types LL | let Ok(0) = 42u8; | ^^^^^ ---- this expression has type `u8` | | - | expected `u8`, found enum `Result` + | expected `u8`, found `Result<_, _>` | = note: expected type `u8` found enum `Result<_, _>` diff --git a/tests/ui/pattern/pattern-error-continue.rs b/tests/ui/pattern/pattern-error-continue.rs index 0702a9986..bed949439 100644 --- a/tests/ui/pattern/pattern-error-continue.rs +++ b/tests/ui/pattern/pattern-error-continue.rs @@ -21,7 +21,7 @@ fn main() { match 'c' { S { .. } => (), //~^ ERROR mismatched types - //~| expected `char`, found struct `S` + //~| expected `char`, found `S` _ => () } diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index 4c2eff63a..e1349fb02 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -40,7 +40,7 @@ error[E0308]: mismatched types LL | match 'c' { | --- this expression has type `char` LL | S { .. } => (), - | ^^^^^^^^ expected `char`, found struct `S` + | ^^^^^^^^ expected `char`, found `S` error[E0308]: mismatched types --> $DIR/pattern-error-continue.rs:28:7 diff --git a/tests/ui/pattern/pattern-ident-path-generics.stderr b/tests/ui/pattern/pattern-ident-path-generics.stderr index 01b082bd3..62283dfe9 100644 --- a/tests/ui/pattern/pattern-ident-path-generics.stderr +++ b/tests/ui/pattern/pattern-ident-path-generics.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match Some("foo") { | ----------- this expression has type `Option<&str>` LL | None:: => {} - | ^^^^^^^^^^^^^ expected `&str`, found `isize` + | ^^^^^^^^^^^^^ expected `Option<&str>`, found `Option` | = note: expected enum `Option<&str>` found enum `Option` diff --git a/tests/ui/pattern/pattern-tyvar.stderr b/tests/ui/pattern/pattern-tyvar.stderr index f1e2a9d72..4eb002548 100644 --- a/tests/ui/pattern/pattern-tyvar.stderr +++ b/tests/ui/pattern/pattern-tyvar.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match t { | - this expression has type `Bar` LL | Bar::T1(_, Some::(x)) => { - | ^^^^^^^^^^^^^^^^ expected struct `Vec`, found `isize` + | ^^^^^^^^^^^^^^^^ expected `Option>`, found `Option` | = note: expected enum `Option>` found enum `Option` diff --git a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr b/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr index f5a5f1ab3..a8d0d6236 100644 --- a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr +++ b/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return-2.rs:9:41 | LL | let value: &bool = unsafe { &42 }; - | ^^^ expected `bool`, found integer + | ^^^ expected `&bool`, found `&{integer}` | = note: expected reference `&bool` found reference `&{integer}` diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout index 6e47bb493..8fe936efc 100644 --- a/tests/ui/print_type_sizes/async.stdout +++ b/tests/ui/print_type_sizes/async.stdout @@ -1,15 +1,15 @@ print-type-size type: `[async fn body@$DIR/async.rs:8:36: 11:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes -print-type-size variant `Suspend0`: 16385 bytes -print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes -print-type-size field `.arg`: 8192 bytes -print-type-size field `.__awaitee`: 1 bytes print-type-size variant `Unresumed`: 8192 bytes -print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 16385 bytes +print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size local `.arg`: 8192 bytes +print-type-size local `.__awaitee`: 1 bytes print-type-size variant `Returned`: 8192 bytes -print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Panicked`: 8192 bytes -print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout index 28d4a6e6c..7c58d6ce5 100644 --- a/tests/ui/print_type_sizes/generator.stdout +++ b/tests/ui/print_type_sizes/generator.stdout @@ -1,10 +1,10 @@ print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 8192 bytes -print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 8192 bytes +print-type-size upvar `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Returned`: 8192 bytes -print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Panicked`: 8192 bytes -print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes -print-type-size variant `Suspend0`: 8192 bytes -print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size upvar `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout index 7f8f4ccae..f2a11c7a3 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.stdout +++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout @@ -1,11 +1,11 @@ print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11: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 print-type-size padding: 3 bytes -print-type-size field `.w`: 4 bytes, alignment: 4 bytes +print-type-size local `.w`: 4 bytes, alignment: 4 bytes print-type-size variant `Suspend1`: 7 bytes print-type-size padding: 3 bytes -print-type-size field `.z`: 4 bytes, alignment: 4 bytes -print-type-size variant `Unresumed`: 0 bytes +print-type-size local `.z`: 4 bytes, alignment: 4 bytes print-type-size variant `Returned`: 0 bytes print-type-size variant `Panicked`: 0 bytes diff --git a/tests/ui/privacy/privacy1.rs b/tests/ui/privacy/privacy1.rs index 3c9fa983d..fcb2108ab 100644 --- a/tests/ui/privacy/privacy1.rs +++ b/tests/ui/privacy/privacy1.rs @@ -106,7 +106,7 @@ mod foo { //~^ ERROR: associated function `bar` is private ::bar::baz::A.foo2(); //~ ERROR: module `baz` is private ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private - //~^ ERROR: associated function `bar2` is private + //~^ ERROR: method `bar2` is private let _: isize = ::bar::B::foo(); //~ ERROR: trait `B` is private diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr index 70e6fcb7a..6ebed8ee0 100644 --- a/tests/ui/privacy/privacy1.stderr +++ b/tests/ui/privacy/privacy1.stderr @@ -190,14 +190,14 @@ LL | fn bar() {} LL | ::bar::baz::A::bar(); | ^^^ private associated function -error[E0624]: associated function `bar2` is private +error[E0624]: method `bar2` is private --> $DIR/privacy1.rs:108:23 | LL | fn bar2(&self) {} - | -------------- private associated function defined here + | -------------- private method defined here ... LL | ::bar::baz::A.bar2(); - | ^^^^ private associated function + | ^^^^ private method error: aborting due to 18 previous errors diff --git a/tests/ui/privacy/private-impl-method.rs b/tests/ui/privacy/private-impl-method.rs index f7be6726c..b5587920f 100644 --- a/tests/ui/privacy/private-impl-method.rs +++ b/tests/ui/privacy/private-impl-method.rs @@ -17,5 +17,5 @@ fn f() { fn main() { let s = a::Foo { x: 1 }; s.bar(); - s.foo(); //~ ERROR associated function `foo` is private + s.foo(); //~ ERROR method `foo` is private } diff --git a/tests/ui/privacy/private-impl-method.stderr b/tests/ui/privacy/private-impl-method.stderr index bb54dce7e..18e4531d1 100644 --- a/tests/ui/privacy/private-impl-method.stderr +++ b/tests/ui/privacy/private-impl-method.stderr @@ -1,11 +1,11 @@ -error[E0624]: associated function `foo` is private +error[E0624]: method `foo` is private --> $DIR/private-impl-method.rs:20:7 | LL | fn foo(&self) {} - | ------------- private associated function defined here + | ------------- private method defined here ... LL | s.foo(); - | ^^^ private associated function + | ^^^ private method error: aborting due to previous error diff --git a/tests/ui/privacy/private-in-public-ill-formed.stderr b/tests/ui/privacy/private-in-public-ill-formed.stderr index e7c94bc30..abc8538e5 100644 --- a/tests/ui/privacy/private-in-public-ill-formed.stderr +++ b/tests/ui/privacy/private-in-public-ill-formed.stderr @@ -1,16 +1,16 @@ error[E0118]: no nominal type found for inherent implementation - --> $DIR/private-in-public-ill-formed.rs:14:10 + --> $DIR/private-in-public-ill-formed.rs:14:5 | LL | impl ::AssocAlias { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type | = note: either implement a trait on it or create a newtype to wrap it instead error[E0118]: no nominal type found for inherent implementation - --> $DIR/private-in-public-ill-formed.rs:31:10 + --> $DIR/private-in-public-ill-formed.rs:31:5 | LL | impl ::AssocAlias { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/tests/ui/privacy/private-method-cross-crate.rs b/tests/ui/privacy/private-method-cross-crate.rs index ab3bbdfe4..4da44e068 100644 --- a/tests/ui/privacy/private-method-cross-crate.rs +++ b/tests/ui/privacy/private-method-cross-crate.rs @@ -4,5 +4,5 @@ use cci_class_5::kitties::cat; fn main() { let nyan : cat = cat(52, 99); - nyan.nap(); //~ ERROR associated function `nap` is private + nyan.nap(); //~ ERROR method `nap` is private } diff --git a/tests/ui/privacy/private-method-cross-crate.stderr b/tests/ui/privacy/private-method-cross-crate.stderr index 93f6a7f2f..e644440c8 100644 --- a/tests/ui/privacy/private-method-cross-crate.stderr +++ b/tests/ui/privacy/private-method-cross-crate.stderr @@ -1,13 +1,13 @@ -error[E0624]: associated function `nap` is private +error[E0624]: method `nap` is private --> $DIR/private-method-cross-crate.rs:7:8 | LL | nyan.nap(); - | ^^^ private associated function + | ^^^ private method | ::: $DIR/auxiliary/cci_class_5.rs:8:9 | LL | fn nap(&self) {} - | ------------- private associated function defined here + | ------------- private method defined here error: aborting due to previous error diff --git a/tests/ui/privacy/private-method-inherited.rs b/tests/ui/privacy/private-method-inherited.rs index 2f6454288..bc27027e8 100644 --- a/tests/ui/privacy/private-method-inherited.rs +++ b/tests/ui/privacy/private-method-inherited.rs @@ -10,5 +10,5 @@ mod a { fn main() { let x = a::Foo; - x.f(); //~ ERROR associated function `f` is private + x.f(); //~ ERROR method `f` is private } diff --git a/tests/ui/privacy/private-method-inherited.stderr b/tests/ui/privacy/private-method-inherited.stderr index 011a7fee4..0104a1b27 100644 --- a/tests/ui/privacy/private-method-inherited.stderr +++ b/tests/ui/privacy/private-method-inherited.stderr @@ -1,11 +1,11 @@ -error[E0624]: associated function `f` is private +error[E0624]: method `f` is private --> $DIR/private-method-inherited.rs:13:7 | LL | fn f(self) {} - | ---------- private associated function defined here + | ---------- private method defined here ... LL | x.f(); - | ^ private associated function + | ^ private method error: aborting due to previous error diff --git a/tests/ui/privacy/private-method.rs b/tests/ui/privacy/private-method.rs index 76a642cde..a9bea520e 100644 --- a/tests/ui/privacy/private-method.rs +++ b/tests/ui/privacy/private-method.rs @@ -19,5 +19,5 @@ mod kitties { fn main() { let nyan : kitties::Cat = kitties::cat(52, 99); - nyan.nap(); //~ ERROR associated function `nap` is private + nyan.nap(); //~ ERROR method `nap` is private } diff --git a/tests/ui/privacy/private-method.stderr b/tests/ui/privacy/private-method.stderr index 17c7179dc..42fec7622 100644 --- a/tests/ui/privacy/private-method.stderr +++ b/tests/ui/privacy/private-method.stderr @@ -1,11 +1,11 @@ -error[E0624]: associated function `nap` is private +error[E0624]: method `nap` is private --> $DIR/private-method.rs:22:8 | LL | fn nap(&self) {} - | ------------- private associated function defined here + | ------------- private method defined here ... LL | nyan.nap(); - | ^^^ private associated function + | ^^^ private method error: aborting due to previous error diff --git a/tests/ui/privacy/restricted/test.stderr b/tests/ui/privacy/restricted/test.stderr index 1acd221b4..76f19525d 100644 --- a/tests/ui/privacy/restricted/test.stderr +++ b/tests/ui/privacy/restricted/test.stderr @@ -54,14 +54,14 @@ error[E0616]: field `x` of struct `S` is private LL | S::default().x; | ^ private field -error[E0624]: associated function `f` is private +error[E0624]: method `f` is private --> $DIR/test.rs:32:18 | LL | pub(super) fn f(&self) {} - | ---------------------- private associated function defined here + | ---------------------- private method defined here ... LL | S::default().f(); - | ^ private associated function + | ^ private method error[E0624]: associated function `g` is private --> $DIR/test.rs:33:8 @@ -84,27 +84,27 @@ error[E0616]: field `z` of struct `Universe` is private LL | let _ = u.z; | ^ private field -error[E0624]: associated function `g` is private +error[E0624]: method `g` is private --> $DIR/test.rs:45:7 | LL | u.g(); - | ^ private associated function + | ^ private method | ::: $DIR/auxiliary/pub_restricted.rs:12:5 | LL | pub(crate) fn g(&self) {} - | ---------------------- private associated function defined here + | ---------------------- private method defined here -error[E0624]: associated function `h` is private +error[E0624]: method `h` is private --> $DIR/test.rs:46:7 | LL | u.h(); - | ^ private associated function + | ^ private method | ::: $DIR/auxiliary/pub_restricted.rs:13:5 | LL | pub(crate) fn h(&self) {} - | ---------------------- private associated function defined here + | ---------------------- private method defined here error: aborting due to 12 previous errors diff --git a/tests/ui/proc-macro/allowed-signatures.rs b/tests/ui/proc-macro/allowed-signatures.rs new file mode 100644 index 000000000..868508761 --- /dev/null +++ b/tests/ui/proc-macro/allowed-signatures.rs @@ -0,0 +1,26 @@ +// check-pass +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![allow(private_in_public)] +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub fn foo(t: T) -> TokenStream { + TokenStream::new() +} + +trait Project { + type Assoc; +} + +impl Project for () { + type Assoc = TokenStream; +} + +#[proc_macro] +pub fn uwu(_input: <() as Project>::Assoc) -> <() as Project>::Assoc { + TokenStream::new() +} diff --git a/tests/ui/proc-macro/break-token-spans.stderr b/tests/ui/proc-macro/break-token-spans.stderr index 0a0322b8a..e69cc3b8c 100644 --- a/tests/ui/proc-macro/break-token-spans.stderr +++ b/tests/ui/proc-macro/break-token-spans.stderr @@ -8,7 +8,7 @@ error[E0308]: mismatched types --> $DIR/break-token-spans.rs:14:32 | LL | let a: Option>= true; - | ------------------ ^^^^ expected enum `Option`, found `bool` + | ------------------ ^^^^ expected `Option>`, found `bool` | | | expected due to this | diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 6103acb7b..020128fa2 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -5,6 +5,9 @@ // ignore-wasm32 // ignore-sgx no support for proc-macro crate type // build-pass +// force-host +// no-prefer-dynamic + #![crate_type = "proc-macro"] // FIXME: This don't work when crate-type is specified by attribute diff --git a/tests/ui/proc-macro/issue-37788.stderr b/tests/ui/proc-macro/issue-37788.stderr index 345520d48..e437bb90b 100644 --- a/tests/ui/proc-macro/issue-37788.stderr +++ b/tests/ui/proc-macro/issue-37788.stderr @@ -7,7 +7,7 @@ LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs` LL | std::cell::Cell::new(0) | ^^^^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;` | | - | expected `()`, found struct `Cell` + | expected `()`, found `Cell<{integer}>` | = note: expected unit type `()` found struct `Cell<{integer}>` diff --git a/tests/ui/proc-macro/proc-macro-abi.rs b/tests/ui/proc-macro/proc-macro-abi.rs new file mode 100644 index 000000000..873660a5b --- /dev/null +++ b/tests/ui/proc-macro/proc-macro-abi.rs @@ -0,0 +1,31 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![allow(warnings)] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub extern "C" fn abi(a: TokenStream) -> TokenStream { + //~^ ERROR proc macro functions may not be `extern "C"` + a +} + +#[proc_macro] +pub extern "system" fn abi2(a: TokenStream) -> TokenStream { + //~^ ERROR proc macro functions may not be `extern "system"` + a +} + +#[proc_macro] +pub extern fn abi3(a: TokenStream) -> TokenStream { + //~^ ERROR proc macro functions may not be `extern "C"` + a +} + +#[proc_macro] +pub extern "Rust" fn abi4(a: TokenStream) -> TokenStream { + a +} diff --git a/tests/ui/proc-macro/proc-macro-abi.stderr b/tests/ui/proc-macro/proc-macro-abi.stderr new file mode 100644 index 000000000..9a781be09 --- /dev/null +++ b/tests/ui/proc-macro/proc-macro-abi.stderr @@ -0,0 +1,20 @@ +error: proc macro functions may not be `extern "C"` + --> $DIR/proc-macro-abi.rs:11:1 + | +LL | pub extern "C" fn abi(a: TokenStream) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: proc macro functions may not be `extern "system"` + --> $DIR/proc-macro-abi.rs:17:1 + | +LL | pub extern "system" fn abi2(a: TokenStream) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: proc macro functions may not be `extern "C"` + --> $DIR/proc-macro-abi.rs:23:1 + | +LL | pub extern fn abi3(a: TokenStream) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/proc-macro/resolved-located-at.stderr b/tests/ui/proc-macro/resolved-located-at.stderr index 422820e9d..0b4dbcba6 100644 --- a/tests/ui/proc-macro/resolved-located-at.stderr +++ b/tests/ui/proc-macro/resolved-located-at.stderr @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | resolve_located_at!(a b) - | ^ expected `()`, found struct `S` + | ^ expected `()`, found `S` | = note: this error originates in the macro `resolve_located_at` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/proc-macro/signature-proc-macro-attribute.rs b/tests/ui/proc-macro/signature-proc-macro-attribute.rs new file mode 100644 index 000000000..51abc8e7d --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro-attribute.rs @@ -0,0 +1,32 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn bad_input(input: String) -> TokenStream { + //~^ ERROR mismatched attribute proc macro signature + ::proc_macro::TokenStream::new() +} + +#[proc_macro_attribute] +pub fn bad_output(input: TokenStream) -> String { + //~^ ERROR mismatched attribute proc macro signature + //~| ERROR mismatched attribute proc macro signature + String::from("blah") +} + +#[proc_macro_attribute] +pub fn bad_everything(input: String) -> String { + //~^ ERROR mismatched attribute proc macro signature + //~| ERROR mismatched attribute proc macro signature + input +} + +#[proc_macro_attribute] +pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + //~^ ERROR mismatched attribute proc macro signature +} diff --git a/tests/ui/proc-macro/signature-proc-macro-attribute.stderr b/tests/ui/proc-macro/signature-proc-macro-attribute.stderr new file mode 100644 index 000000000..abf7a6f3c --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro-attribute.stderr @@ -0,0 +1,42 @@ +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:10:1 + | +LL | pub fn bad_input(input: String) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` + +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:16:42 + | +LL | pub fn bad_output(input: TokenStream) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream` + +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:16:1 + | +LL | pub fn bad_output(input: TokenStream) -> String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` + +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:23:41 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: attribute proc macros must have a signature of `fn(TokenStream, TokenStream) -> TokenStream` + +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:23:1 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attribute proc macro must have two arguments of type `proc_macro::TokenStream` + +error: mismatched attribute proc macro signature + --> $DIR/signature-proc-macro-attribute.rs:30:49 + | +LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + | ^^^^^^^^^ found unexpected argument + +error: aborting due to 6 previous errors + diff --git a/tests/ui/proc-macro/signature-proc-macro-derive.rs b/tests/ui/proc-macro/signature-proc-macro-derive.rs new file mode 100644 index 000000000..f2fd824b6 --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro-derive.rs @@ -0,0 +1,31 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Blah)] +pub fn bad_input(input: String) -> TokenStream { + //~^ ERROR mismatched derive proc macro signature + TokenStream::new() +} + +#[proc_macro_derive(Bleh)] +pub fn bad_output(input: TokenStream) -> String { + //~^ ERROR mismatched derive proc macro signature + String::from("blah") +} + +#[proc_macro_derive(Bluh)] +pub fn bad_everything(input: String) -> String { + //~^ ERROR mismatched derive proc macro signature + //~| ERROR mismatched derive proc macro signature + input +} + +#[proc_macro_derive(Blih)] +pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + //~^ ERROR mismatched derive proc macro signature +} diff --git a/tests/ui/proc-macro/signature-proc-macro-derive.stderr b/tests/ui/proc-macro/signature-proc-macro-derive.stderr new file mode 100644 index 000000000..a358ae277 --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro-derive.stderr @@ -0,0 +1,40 @@ +error: mismatched derive proc macro signature + --> $DIR/signature-proc-macro-derive.rs:10:25 + | +LL | pub fn bad_input(input: String) -> TokenStream { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature-proc-macro-derive.rs:16:42 + | +LL | pub fn bad_output(input: TokenStream) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature-proc-macro-derive.rs:22:41 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature-proc-macro-derive.rs:22:30 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature-proc-macro-derive.rs:29:33 + | +LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments + +error: aborting due to 5 previous errors + diff --git a/tests/ui/proc-macro/signature-proc-macro.rs b/tests/ui/proc-macro/signature-proc-macro.rs new file mode 100644 index 000000000..54770aacd --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro.rs @@ -0,0 +1,31 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub fn bad_input(input: String) -> TokenStream { + //~^ ERROR mismatched function-like proc macro signature + ::proc_macro::TokenStream::new() +} + +#[proc_macro] +pub fn bad_output(input: TokenStream) -> String { + //~^ ERROR mismatched function-like proc macro signature + String::from("blah") +} + +#[proc_macro] +pub fn bad_everything(input: String) -> String { + //~^ ERROR mismatched function-like proc macro signature + //~| ERROR mismatched function-like proc macro signature + input +} + +#[proc_macro] +pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + //~^ ERROR mismatched function-like proc macro signature +} diff --git a/tests/ui/proc-macro/signature-proc-macro.stderr b/tests/ui/proc-macro/signature-proc-macro.stderr new file mode 100644 index 000000000..4b14a54e6 --- /dev/null +++ b/tests/ui/proc-macro/signature-proc-macro.stderr @@ -0,0 +1,40 @@ +error: mismatched function-like proc macro signature + --> $DIR/signature-proc-macro.rs:10:25 + | +LL | pub fn bad_input(input: String) -> TokenStream { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched function-like proc macro signature + --> $DIR/signature-proc-macro.rs:16:42 + | +LL | pub fn bad_output(input: TokenStream) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched function-like proc macro signature + --> $DIR/signature-proc-macro.rs:22:41 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched function-like proc macro signature + --> $DIR/signature-proc-macro.rs:22:30 + | +LL | pub fn bad_everything(input: String) -> String { + | ^^^^^^ found std::string::String, expected type `proc_macro::TokenStream` + | + = note: function-like proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched function-like proc macro signature + --> $DIR/signature-proc-macro.rs:29:33 + | +LL | pub fn too_many(a: TokenStream, b: TokenStream, c: String) -> TokenStream { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ found unexpected arguments + +error: aborting due to 5 previous errors + diff --git a/tests/ui/proc-macro/signature.rs b/tests/ui/proc-macro/signature.rs index 230223825..11187aa31 100644 --- a/tests/ui/proc-macro/signature.rs +++ b/tests/ui/proc-macro/signature.rs @@ -8,6 +8,10 @@ extern crate proc_macro; #[proc_macro_derive(A)] pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { - //~^ ERROR: expected a `Fn<(proc_macro::TokenStream,)>` closure, found `unsafe extern "C" fn + //~^ ERROR: mismatched derive proc macro signature + //~| mismatched derive proc macro signature + //~| mismatched derive proc macro signature + //~| proc macro functions may not be `extern + //~| proc macro functions may not be `unsafe loop {} } diff --git a/tests/ui/proc-macro/signature.stderr b/tests/ui/proc-macro/signature.stderr index 79f2001da..3dbe3f22a 100644 --- a/tests/ui/proc-macro/signature.stderr +++ b/tests/ui/proc-macro/signature.stderr @@ -1,20 +1,36 @@ -error[E0277]: expected a `Fn<(proc_macro::TokenStream,)>` closure, found `unsafe extern "C" fn(i32, u32) -> u32 {foo}` +error: proc macro functions may not be `extern "C"` --> $DIR/signature.rs:10:1 | -LL | / pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { -LL | | -LL | | loop {} -LL | | } - | | ^ - | | | - | |_call the function in a closure: `|| unsafe { /* code */ }` - | required by a bound introduced by this call +LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: proc macro functions may not be `unsafe` + --> $DIR/signature.rs:10:1 + | +LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: mismatched derive proc macro signature + --> $DIR/signature.rs:10:49 + | +LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { + | ^^^ found u32, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature.rs:10:33 + | +LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { + | ^^^ found i32, expected type `proc_macro::TokenStream` + | + = note: derive proc macros must have a signature of `fn(TokenStream) -> TokenStream` + +error: mismatched derive proc macro signature + --> $DIR/signature.rs:10:38 | - = help: the trait `Fn<(proc_macro::TokenStream,)>` is not implemented for fn item `unsafe extern "C" fn(i32, u32) -> u32 {foo}` - = note: unsafe function cannot be called generically without an unsafe block -note: required by a bound in `ProcMacro::custom_derive` - --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL +LL | pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { + | ^^^^^^ found unexpected argument -error: aborting due to previous error +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/process/process-sigpipe.rs b/tests/ui/process/process-sigpipe.rs index 107eba45d..7ae14c6b8 100644 --- a/tests/ui/process/process-sigpipe.rs +++ b/tests/ui/process/process-sigpipe.rs @@ -15,6 +15,7 @@ // ignore-emscripten no threads support // ignore-vxworks no 'sh' // ignore-fuchsia no 'sh' +// ignore-nto no 'yes' use std::process; use std::thread; diff --git a/tests/ui/pub/pub-ident-fn-3.rs b/tests/ui/pub/pub-ident-fn-3.rs deleted file mode 100644 index fdbea7cf4..000000000 --- a/tests/ui/pub/pub-ident-fn-3.rs +++ /dev/null @@ -1,8 +0,0 @@ -// #60115 - -mod foo { - pub bar(); - //~^ ERROR missing `fn` or `struct` for function or struct definition -} - -fn main() {} diff --git a/tests/ui/pub/pub-ident-fn-3.stderr b/tests/ui/pub/pub-ident-fn-3.stderr deleted file mode 100644 index 6d3d4e592..000000000 --- a/tests/ui/pub/pub-ident-fn-3.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/pub-ident-fn-3.rs:4:8 - | -LL | pub bar(); - | ---^--- help: if you meant to call a macro, try: `bar!` - -error: aborting due to previous error - diff --git a/tests/ui/pub/pub-ident-fn-or-struct-2.rs b/tests/ui/pub/pub-ident-fn-or-struct-2.rs deleted file mode 100644 index 8f67cdd29..000000000 --- a/tests/ui/pub/pub-ident-fn-or-struct-2.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub S(); -//~^ ERROR missing `fn` or `struct` for function or struct definition - -fn main() {} diff --git a/tests/ui/pub/pub-ident-fn-or-struct-2.stderr b/tests/ui/pub/pub-ident-fn-or-struct-2.stderr deleted file mode 100644 index 047e66b18..000000000 --- a/tests/ui/pub/pub-ident-fn-or-struct-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/pub-ident-fn-or-struct-2.rs:1:4 - | -LL | pub S(); - | ---^- help: if you meant to call a macro, try: `S!` - -error: aborting due to previous error - diff --git a/tests/ui/pub/pub-ident-struct-2.rs b/tests/ui/pub/pub-ident-struct-2.rs new file mode 100644 index 000000000..50db4039d --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-2.rs @@ -0,0 +1,8 @@ +// #60115 + +mod foo { + pub bar(); + //~^ ERROR missing `struct` for struct definition +} + +fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-2.stderr b/tests/ui/pub/pub-ident-struct-2.stderr new file mode 100644 index 000000000..6969a376a --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-2.stderr @@ -0,0 +1,13 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct-2.rs:4:8 + | +LL | pub bar(); + | ^ + | +help: add `struct` here to parse `bar` as a public struct + | +LL | pub struct bar(); + | ++++++ + +error: aborting due to previous error + diff --git a/tests/ui/pub/pub-ident-struct-3.rs b/tests/ui/pub/pub-ident-struct-3.rs new file mode 100644 index 000000000..dfa6cf2ee --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-3.rs @@ -0,0 +1,4 @@ +pub S(); +//~^ ERROR missing `struct` for struct definition + +fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-3.stderr b/tests/ui/pub/pub-ident-struct-3.stderr new file mode 100644 index 000000000..d94198a6b --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-3.stderr @@ -0,0 +1,13 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct-3.rs:1:4 + | +LL | pub S(); + | ^ + | +help: add `struct` here to parse `S` as a public struct + | +LL | pub struct S(); + | ++++++ + +error: aborting due to previous error + diff --git a/tests/ui/pub/pub-ident-struct-4.fixed b/tests/ui/pub/pub-ident-struct-4.fixed new file mode 100644 index 000000000..b49fa678e --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-4.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +pub struct T(String); +//~^ ERROR missing `struct` for struct definition + +fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-4.rs b/tests/ui/pub/pub-ident-struct-4.rs new file mode 100644 index 000000000..20bc94b0a --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-4.rs @@ -0,0 +1,6 @@ +// run-rustfix + +pub T(String); +//~^ ERROR missing `struct` for struct definition + +fn main() {} diff --git a/tests/ui/pub/pub-ident-struct-4.stderr b/tests/ui/pub/pub-ident-struct-4.stderr new file mode 100644 index 000000000..90c7138e5 --- /dev/null +++ b/tests/ui/pub/pub-ident-struct-4.stderr @@ -0,0 +1,13 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct-4.rs:3:4 + | +LL | pub T(String); + | ^ + | +help: add `struct` here to parse `T` as a public struct + | +LL | pub struct T(String); + | ++++++ + +error: aborting due to previous error + diff --git a/tests/ui/query-system/no-query-in-printing-during-query-descr.rs b/tests/ui/query-system/no-query-in-printing-during-query-descr.rs new file mode 100644 index 000000000..45b7043e2 --- /dev/null +++ b/tests/ui/query-system/no-query-in-printing-during-query-descr.rs @@ -0,0 +1,6 @@ +fn a() -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + &a +} + +fn main() {} diff --git a/tests/ui/query-system/no-query-in-printing-during-query-descr.stderr b/tests/ui/query-system/no-query-in-printing-during-query-descr.stderr new file mode 100644 index 000000000..35e608b6b --- /dev/null +++ b/tests/ui/query-system/no-query-in-printing-during-query-descr.stderr @@ -0,0 +1,9 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/no-query-in-printing-during-query-descr.rs:1:11 + | +LL | fn a() -> _ { + | ^ not allowed in type signatures + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/range/issue-54505-no-literals.stderr b/tests/ui/range/issue-54505-no-literals.stderr index 070dc8445..d11298384 100644 --- a/tests/ui/range/issue-54505-no-literals.stderr +++ b/tests/ui/range/issue-54505-no-literals.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `Range` + | | expected `&_`, found `Range<{integer}>` | | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `Range` + | | expected `&_`, found `Range<{integer}>` | | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | @@ -40,7 +40,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::RangeFrom { start: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeFrom` + | | expected `&_`, found `RangeFrom<{integer}>` | | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` | arguments to this function are incorrect | @@ -58,7 +58,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::RangeFrom { start: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeFrom` + | | expected `&_`, found `RangeFrom<{integer}>` | | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` | arguments to this function are incorrect | @@ -76,7 +76,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::RangeFull {}); | ---------- ^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeFull` + | | expected `&_`, found `RangeFull` | | help: consider borrowing here: `&std::ops::RangeFull {}` | arguments to this function are incorrect | @@ -94,7 +94,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::RangeFull {}); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeFull` + | | expected `&_`, found `RangeFull` | | help: consider borrowing here: `&::std::ops::RangeFull {}` | arguments to this function are incorrect | @@ -112,7 +112,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::RangeInclusive::new(0, 1)); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeInclusive` + | | expected `&_`, found `RangeInclusive<{integer}>` | | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` | arguments to this function are incorrect | @@ -130,7 +130,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeInclusive` + | | expected `&_`, found `RangeInclusive<{integer}>` | | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` | arguments to this function are incorrect | @@ -148,7 +148,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::RangeTo { end: 5 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeTo` + | | expected `&_`, found `RangeTo<{integer}>` | | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` | arguments to this function are incorrect | @@ -166,7 +166,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::RangeTo { end: 5 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeTo` + | | expected `&_`, found `RangeTo<{integer}>` | | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` | arguments to this function are incorrect | @@ -184,7 +184,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::RangeToInclusive { end: 5 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeToInclusive` + | | expected `&_`, found `RangeToInclusive<{integer}>` | | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` | arguments to this function are incorrect | @@ -202,7 +202,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::RangeToInclusive { end: 5 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `RangeToInclusive` + | | expected `&_`, found `RangeToInclusive<{integer}>` | | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` | arguments to this function are incorrect | diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr index 9fb0e54a8..a6a9f89da 100644 --- a/tests/ui/range/issue-54505-no-std.stderr +++ b/tests/ui/range/issue-54505-no-std.stderr @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | take_range(0..1); | ---------- ^^^^ | | | - | | expected reference, found struct `Range` + | | expected `&_`, found `Range<{integer}>` | | help: consider borrowing here: `&(0..1)` | arguments to this function are incorrect | @@ -34,7 +34,7 @@ error[E0308]: mismatched types LL | take_range(1..); | ---------- ^^^ | | | - | | expected reference, found struct `RangeFrom` + | | expected `&_`, found `RangeFrom<{integer}>` | | help: consider borrowing here: `&(1..)` | arguments to this function are incorrect | @@ -52,7 +52,7 @@ error[E0308]: mismatched types LL | take_range(..); | ---------- ^^ | | | - | | expected reference, found struct `RangeFull` + | | expected `&_`, found `RangeFull` | | help: consider borrowing here: `&(..)` | arguments to this function are incorrect | @@ -70,7 +70,7 @@ error[E0308]: mismatched types LL | take_range(0..=1); | ---------- ^^^^^ | | | - | | expected reference, found struct `RangeInclusive` + | | expected `&_`, found `RangeInclusive<{integer}>` | | help: consider borrowing here: `&(0..=1)` | arguments to this function are incorrect | @@ -88,7 +88,7 @@ error[E0308]: mismatched types LL | take_range(..5); | ---------- ^^^ | | | - | | expected reference, found struct `RangeTo` + | | expected `&_`, found `RangeTo<{integer}>` | | help: consider borrowing here: `&(..5)` | arguments to this function are incorrect | @@ -106,7 +106,7 @@ error[E0308]: mismatched types LL | take_range(..=42); | ---------- ^^^^^ | | | - | | expected reference, found struct `RangeToInclusive` + | | expected `&_`, found `RangeToInclusive<{integer}>` | | help: consider borrowing here: `&(..=42)` | arguments to this function are incorrect | diff --git a/tests/ui/range/issue-54505.stderr b/tests/ui/range/issue-54505.stderr index 9eec16940..eda047b50 100644 --- a/tests/ui/range/issue-54505.stderr +++ b/tests/ui/range/issue-54505.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(0..1); | ---------- ^^^^ | | | - | | expected reference, found struct `Range` + | | expected `&_`, found `Range<{integer}>` | | help: consider borrowing here: `&(0..1)` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | take_range(1..); | ---------- ^^^ | | | - | | expected reference, found struct `RangeFrom` + | | expected `&_`, found `RangeFrom<{integer}>` | | help: consider borrowing here: `&(1..)` | arguments to this function are incorrect | @@ -40,7 +40,7 @@ error[E0308]: mismatched types LL | take_range(..); | ---------- ^^ | | | - | | expected reference, found struct `RangeFull` + | | expected `&_`, found `RangeFull` | | help: consider borrowing here: `&(..)` | arguments to this function are incorrect | @@ -58,7 +58,7 @@ error[E0308]: mismatched types LL | take_range(0..=1); | ---------- ^^^^^ | | | - | | expected reference, found struct `RangeInclusive` + | | expected `&_`, found `RangeInclusive<{integer}>` | | help: consider borrowing here: `&(0..=1)` | arguments to this function are incorrect | @@ -76,7 +76,7 @@ error[E0308]: mismatched types LL | take_range(..5); | ---------- ^^^ | | | - | | expected reference, found struct `RangeTo` + | | expected `&_`, found `RangeTo<{integer}>` | | help: consider borrowing here: `&(..5)` | arguments to this function are incorrect | @@ -94,7 +94,7 @@ error[E0308]: mismatched types LL | take_range(..=42); | ---------- ^^^^^ | | | - | | expected reference, found struct `RangeToInclusive` + | | expected `&_`, found `RangeToInclusive<{integer}>` | | help: consider borrowing here: `&(..=42)` | arguments to this function are incorrect | diff --git a/tests/ui/range/issue-73553-misinterp-range-literal.stderr b/tests/ui/range/issue-73553-misinterp-range-literal.stderr index d08d9b134..77595b367 100644 --- a/tests/ui/range/issue-73553-misinterp-range-literal.stderr +++ b/tests/ui/range/issue-73553-misinterp-range-literal.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | demo(tell(1)..tell(10)); | ---- ^^^^^^^^^^^^^^^^^ | | | - | | expected `&Range`, found struct `Range` + | | expected `&Range`, found `Range` | | help: consider borrowing here: `&(tell(1)..tell(10))` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | demo(1..10); | ---- ^^^^^ | | | - | | expected `&Range`, found struct `Range` + | | expected `&Range`, found `Range<{integer}>` | | help: consider borrowing here: `&(1..10)` | arguments to this function are incorrect | diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index dde8ad1b6..64683ae3a 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -9,9 +9,11 @@ LL | func(&mut iter.map(|x| x + 1)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>: Iterator` +error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:12:24: 12:27]>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) + = note: required for `&mut Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:12:24: 12:27]>` to implement `Iterator` + = note: 65 redundant requirements hidden = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `Iterator` = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt' diff --git a/tests/ui/recursion_limit/issue-105700.rs b/tests/ui/recursion_limit/issue-105700.rs new file mode 100644 index 000000000..e1fee4631 --- /dev/null +++ b/tests/ui/recursion_limit/issue-105700.rs @@ -0,0 +1,9 @@ +#![recursion_limit="4"] +#![invalid_attribute] +#![invalid_attribute] +#![invalid_attribute] +#![invalid_attribute] +#![invalid_attribute] +//~^ERROR recursion limit reached while expanding + +fn main() {} diff --git a/tests/ui/recursion_limit/issue-105700.stderr b/tests/ui/recursion_limit/issue-105700.stderr new file mode 100644 index 000000000..9b1114e9c --- /dev/null +++ b/tests/ui/recursion_limit/issue-105700.stderr @@ -0,0 +1,10 @@ +error: recursion limit reached while expanding `#[invalid_attribute]` + --> $DIR/issue-105700.rs:6:1 + | +LL | #![invalid_attribute] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`issue_105700`) + +error: aborting due to previous error + diff --git a/tests/ui/recursion_limit/issue-40003.rs b/tests/ui/recursion_limit/issue-40003.rs new file mode 100644 index 000000000..5e61361f9 --- /dev/null +++ b/tests/ui/recursion_limit/issue-40003.rs @@ -0,0 +1,178 @@ +// run-pass +#![allow(unused_must_use)] +fn main() { + if false { test(); } +} + +fn test() { + let rx = Err::, u32>(1).into_future(); + + rx.map(|l: Vec| stream::iter(l.into_iter().map(|i| Ok(i)))) + .flatten_stream() + .chunks(50) + .buffer_unordered(5); +} + +use future::{Future, IntoFuture}; +mod future { + use std::result; + + use {stream, Stream}; + + pub trait Future { + type Item; + type Error; + + fn map(self, _: F) -> Map + where F: FnOnce(Self::Item) -> U, + Self: Sized, + { + panic!() + } + + fn flatten_stream(self) -> FlattenStream + where ::Item: stream::Stream, + Self: Sized + { + panic!() + } + } + + pub trait IntoFuture { + type Future: Future; + type Item; + type Error; + fn into_future(self) -> Self::Future; + } + + impl IntoFuture for F { + type Future = F; + type Item = F::Item; + type Error = F::Error; + + fn into_future(self) -> F { + panic!() + } + } + + impl IntoFuture for result::Result { + type Future = FutureResult; + type Item = T; + type Error = E; + + fn into_future(self) -> FutureResult { + panic!() + } + } + + pub struct Map { + _a: (A, F), + } + + impl Future for Map + where A: Future, + F: FnOnce(A::Item) -> U, + { + type Item = U; + type Error = A::Error; + } + + pub struct FlattenStream { + _f: F, + } + + impl Stream for FlattenStream + where F: Future, + ::Item: Stream, + { + type Item = ::Item; + type Error = ::Error; + } + + pub struct FutureResult { + _inner: (T, E), + } + + impl Future for FutureResult { + type Item = T; + type Error = E; + } +} + +mod stream { + use IntoFuture; + + pub trait Stream { + type Item; + type Error; + + fn buffer_unordered(self, amt: usize) -> BufferUnordered + where Self::Item: IntoFuture::Error>, + Self: Sized + { + new(self, amt) + } + + fn chunks(self, _capacity: usize) -> Chunks + where Self: Sized + { + panic!() + } + } + + pub struct IterStream { + _iter: I, + } + + pub fn iter(_: J) -> IterStream + where J: IntoIterator>, + { + panic!() + } + + impl Stream for IterStream + where I: Iterator>, + { + type Item = T; + type Error = E; + } + + pub struct Chunks { + _stream: S + } + + impl Stream for Chunks + where S: Stream + { + type Item = Result::Item>, u32>; + type Error = ::Error; + } + + pub struct BufferUnordered { + _stream: S, + } + + enum Slot { + Next(#[allow(unused_tuple_struct_fields)] usize), + _Data { _a: T }, + } + + fn new(_s: S, _amt: usize) -> BufferUnordered + where S: Stream, + S::Item: IntoFuture::Error>, + { + (0..0).map(|_| { + Slot::Next::<::Future>(1) + }).collect::>(); + panic!() + } + + impl Stream for BufferUnordered + where S: Stream, + S::Item: IntoFuture::Error>, + { + type Item = ::Item; + type Error = ::Error; + } +} +use stream::Stream; diff --git a/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr b/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr index 6ea238f30..d76a83b02 100644 --- a/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr +++ b/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/do-not-suggest-adding-bound-to-opaque-type.rs:9:7 | +LL | let x = (); + | - binding `x` declared here LL | S(&x) | --^^- | | | diff --git a/tests/ui/regions/higher-ranked-implied.rs b/tests/ui/regions/higher-ranked-implied.rs new file mode 100644 index 000000000..103884c50 --- /dev/null +++ b/tests/ui/regions/higher-ranked-implied.rs @@ -0,0 +1,14 @@ +// FIXME: This test should pass as the first two fields add implied bounds that +// `'a` is equal to `'b` while the last one should simply use that fact. With +// the current implementation this errors. We have to be careful as implied bounds +// are only sound if they're also correctly checked. + +struct Inv(*mut T); // `T` is invariant. +type A = for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>); +type B = for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>); + +fn main() { + let x: A = |_, _, _| (); + let y: B = x; //~ ERROR mismatched types + let _: A = y; //~ ERROR mismatched types +} diff --git a/tests/ui/regions/higher-ranked-implied.stderr b/tests/ui/regions/higher-ranked-implied.stderr new file mode 100644 index 000000000..9d80eacd7 --- /dev/null +++ b/tests/ui/regions/higher-ranked-implied.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/higher-ranked-implied.rs:12:16 + | +LL | let y: B = x; + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>)` + found fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>)` + +error[E0308]: mismatched types + --> $DIR/higher-ranked-implied.rs:13:16 + | +LL | let _: A = y; + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>)` + found fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>)` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/regions/issue-102374.stderr b/tests/ui/regions/issue-102374.stderr index 157850693..af64b6867 100644 --- a/tests/ui/regions/issue-102374.stderr +++ b/tests/ui/regions/issue-102374.stderr @@ -7,7 +7,7 @@ LL | f | ^ expected `i32`, found fn pointer | = note: expected type `i32` - found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<...>)` + found fn pointer `fn(Cell<...>)` the full type name has been written to '$TEST_BUILD_DIR/regions/issue-102374/issue-102374.long-type-hash.txt' error: aborting due to previous error diff --git a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr index 3b62c7b61..bb5bc6f66 100644 --- a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr @@ -6,6 +6,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; | = note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)` found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}` + = note: when the arguments and return types match, functions can be coerced to function pointers error: aborting due to previous error diff --git a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr index 8a18a234b..dbe9e9b1a 100644 --- a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr @@ -6,6 +6,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | = note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b isize, &'c mut &'d isize, &'e mut &'f isize)` found fn item `for<'a, 'b, 'c> fn(&'a mut &isize, &'b mut &isize, &'c mut &isize) {a::<'_, '_, '_>}` + = note: when the arguments and return types match, functions can be coerced to function pointers error: aborting due to previous error diff --git a/tests/ui/regions/regions-addr-of-arg.stderr b/tests/ui/regions/regions-addr-of-arg.stderr index e77289287..99060a9c7 100644 --- a/tests/ui/regions/regions-addr-of-arg.stderr +++ b/tests/ui/regions/regions-addr-of-arg.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:30 | +LL | fn foo(a: isize) { + | - binding `a` declared here LL | let _p: &'static isize = &a; | -------------- ^^ borrowed value does not live long enough | | diff --git a/tests/ui/regions/regions-early-bound-error-method.stderr b/tests/ui/regions/regions-early-bound-error-method.stderr index 7f10c051f..a7746d898 100644 --- a/tests/ui/regions/regions-early-bound-error-method.stderr +++ b/tests/ui/regions/regions-early-bound-error-method.stderr @@ -6,7 +6,7 @@ LL | impl<'a> Box<'a> { LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { | -- lifetime `'b` defined here LL | g2.get() - | ^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | ^^^^^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` | = help: consider adding the following bound: `'b: 'a` diff --git a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr index 8d82ff958..766a3d033 100644 --- a/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr +++ b/tests/ui/regions/regions-fn-subtyping-return-static-fail.stderr @@ -8,6 +8,7 @@ LL | want_G(baz); | = note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S` found fn item `for<'a> fn(&'a S) -> &'a S {baz}` + = note: when the arguments and return types match, functions can be coerced to function pointers note: function defined here --> $DIR/regions-fn-subtyping-return-static-fail.rs:20:4 | diff --git a/tests/ui/regions/regions-free-region-ordering-caller1.stderr b/tests/ui/regions/regions-free-region-ordering-caller1.stderr index 8ef7e2253..c83cfc1c9 100644 --- a/tests/ui/regions/regions-free-region-ordering-caller1.stderr +++ b/tests/ui/regions/regions-free-region-ordering-caller1.stderr @@ -18,6 +18,8 @@ error[E0597]: `y` does not live long enough LL | fn call1<'a>(x: &'a usize) { | -- lifetime `'a` defined here ... +LL | let y: usize = 3; + | - binding `y` declared here LL | let z: &'a & usize = &(&y); | ----------- ^^^^ borrowed value does not live long enough | | diff --git a/tests/ui/regions/regions-free-region-ordering-incorrect.stderr b/tests/ui/regions/regions-free-region-ordering-incorrect.stderr index f7c75033c..d0ceaec3b 100644 --- a/tests/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/tests/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -9,7 +9,7 @@ LL | / match self.next { LL | | Some(ref next) => next.get(), LL | | None => &self.val LL | | } - | |_________^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | |_________^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` diff --git a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs index 7c2e1aeee..46462c432 100644 --- a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs +++ b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs @@ -8,6 +8,8 @@ // // 'a : 'b +#![warn(unused_lifetimes)] + fn test<'a,'b>(x: &'a i32) -> &'b i32 where 'a: 'static //~ WARN unnecessary lifetime parameter `'a` { diff --git a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr index 70ed418d5..9f03a6553 100644 --- a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr +++ b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr @@ -1,10 +1,15 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:12:11 + --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:14:11 | LL | where 'a: 'static | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:11:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/tests/ui/regions/regions-infer-proc-static-upvar.stderr b/tests/ui/regions/regions-infer-proc-static-upvar.stderr index 803d0d744..c8a33bbc5 100644 --- a/tests/ui/regions/regions-infer-proc-static-upvar.stderr +++ b/tests/ui/regions/regions-infer-proc-static-upvar.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:13 | +LL | let x = 3; + | - binding `x` declared here LL | let y = &x; | ^^ borrowed value does not live long enough LL | / foo(move|| { diff --git a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr index 17a901943..df0fd069e 100644 --- a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr @@ -6,6 +6,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; | = note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)` found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}` + = note: when the arguments and return types match, functions can be coerced to function pointers error: aborting due to previous error diff --git a/tests/ui/regions/regions-mock-codegen.rs b/tests/ui/regions/regions-mock-codegen.rs index 9d0ca76e4..d5c93f81f 100644 --- a/tests/ui/regions/regions-mock-codegen.rs +++ b/tests/ui/regions/regions-mock-codegen.rs @@ -22,15 +22,15 @@ struct Ccx { x: isize, } -fn allocate(_bcx: &arena) -> &Bcx<'_> { +fn allocate(_bcx: &arena) -> &mut Bcx<'_> { unsafe { let layout = Layout::new::(); let ptr = Global.allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout)); - &*(ptr.as_ptr() as *const _) + &mut *ptr.as_ptr().cast() } } -fn h<'a>(bcx: &'a Bcx<'a>) -> &'a Bcx<'a> { +fn h<'a>(bcx: &'a Bcx<'a>) -> &'a mut Bcx<'a> { return allocate(bcx.fcx.arena); } @@ -38,7 +38,7 @@ fn g(fcx: &Fcx) { let bcx = Bcx { fcx }; let bcx2 = h(&bcx); unsafe { - Global.deallocate(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::()); + Global.deallocate(NonNull::new_unchecked(bcx2 as *mut _ as *mut _), Layout::new::()); } } diff --git a/tests/ui/regions/regions-nested-fns.stderr b/tests/ui/regions/regions-nested-fns.stderr index bb2740310..ee43f9fa5 100644 --- a/tests/ui/regions/regions-nested-fns.stderr +++ b/tests/ui/regions/regions-nested-fns.stderr @@ -13,6 +13,8 @@ LL | ay = z; error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:5:18 | +LL | let y = 3; + | - binding `y` declared here LL | let mut ay = &y; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/regions/regions-pattern-typing-issue-19552.stderr b/tests/ui/regions/regions-pattern-typing-issue-19552.stderr index f77d94a24..18aec29ad 100644 --- a/tests/ui/regions/regions-pattern-typing-issue-19552.stderr +++ b/tests/ui/regions/regions-pattern-typing-issue-19552.stderr @@ -1,6 +1,8 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | +LL | let line = String::new(); + | ---- binding `line` declared here LL | match [&*line] { | ^^^^ borrowed value does not live long enough LL | [ word ] => { assert_static(word); } diff --git a/tests/ui/regions/regions-pattern-typing-issue-19997.stderr b/tests/ui/regions/regions-pattern-typing-issue-19997.stderr index ae60e3c0d..0abe77a86 100644 --- a/tests/ui/regions/regions-pattern-typing-issue-19997.stderr +++ b/tests/ui/regions/regions-pattern-typing-issue-19997.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `a1` because it is borrowed --> $DIR/regions-pattern-typing-issue-19997.rs:7:13 | LL | match (&a1,) { - | --- borrow of `a1` occurs here + | --- `a1` is borrowed here LL | (&ref b0,) => { LL | a1 = &f; - | ^^^^^^^ assignment to borrowed `a1` occurs here + | ^^^^^^^ `a1` is assigned to here but it was already borrowed LL | drop(b0); | -- borrow later used here diff --git a/tests/ui/regions/regions-static-bound-rpass.rs b/tests/ui/regions/regions-static-bound-rpass.rs index 25232b455..e2ebb394d 100644 --- a/tests/ui/regions/regions-static-bound-rpass.rs +++ b/tests/ui/regions/regions-static-bound-rpass.rs @@ -1,5 +1,7 @@ // run-pass +#![warn(unused_lifetimes)] + fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a () where 'a: 'static { t } //~^ WARN unnecessary lifetime parameter `'a` diff --git a/tests/ui/regions/regions-static-bound-rpass.stderr b/tests/ui/regions/regions-static-bound-rpass.stderr index 9355a409d..f0f3a4c52 100644 --- a/tests/ui/regions/regions-static-bound-rpass.stderr +++ b/tests/ui/regions/regions-static-bound-rpass.stderr @@ -1,13 +1,18 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound-rpass.rs:4:11 + --> $DIR/regions-static-bound-rpass.rs:6:11 | LL | where 'a: 'static { t } | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/regions-static-bound-rpass.rs:3:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound-rpass.rs:8:11 + --> $DIR/regions-static-bound-rpass.rs:10:11 | LL | where 'a: 'static { t } | ^^ @@ -15,7 +20,7 @@ LL | where 'a: 'static { t } = help: you can use the `'static` lifetime directly, in place of `'a` warning: unnecessary lifetime parameter `'b` - --> $DIR/regions-static-bound-rpass.rs:12:19 + --> $DIR/regions-static-bound-rpass.rs:14:19 | LL | where 'a: 'b, 'b: 'static { t } | ^^ diff --git a/tests/ui/regions/regions-static-bound.rs b/tests/ui/regions/regions-static-bound.rs index 4d2455470..e7aa8795f 100644 --- a/tests/ui/regions/regions-static-bound.rs +++ b/tests/ui/regions/regions-static-bound.rs @@ -1,6 +1,8 @@ -fn static_id<'a,'b>(t: &'a ()) -> &'static () - where 'a: 'static { t } -//~^ WARN unnecessary lifetime parameter `'a` +#![warn(unused_lifetimes)] + +fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } +//~^ WARN lifetime parameter `'b` never used +//~| WARN unnecessary lifetime parameter `'a` fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } diff --git a/tests/ui/regions/regions-static-bound.stderr b/tests/ui/regions/regions-static-bound.stderr index 2886ec3ea..b314e9fe8 100644 --- a/tests/ui/regions/regions-static-bound.stderr +++ b/tests/ui/regions/regions-static-bound.stderr @@ -1,13 +1,27 @@ +warning: lifetime parameter `'b` never used + --> $DIR/regions-static-bound.rs:3:17 + | +LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } + | -^^ + | | + | help: elide the unused lifetime + | +note: the lint level is defined here + --> $DIR/regions-static-bound.rs:1:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ + warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound.rs:2:11 + --> $DIR/regions-static-bound.rs:3:53 | -LL | where 'a: 'static { t } - | ^^ +LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } + | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` warning: unnecessary lifetime parameter `'b` - --> $DIR/regions-static-bound.rs:6:19 + --> $DIR/regions-static-bound.rs:8:19 | LL | where 'a: 'b, 'b: 'static { t } | ^^ @@ -15,7 +29,7 @@ LL | where 'a: 'b, 'b: 'static { t } = help: you can use the `'static` lifetime directly, in place of `'b` error: lifetime may not live long enough - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:12:5 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here @@ -23,7 +37,7 @@ LL | t | ^ returning this value requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:15:5 + --> $DIR/regions-static-bound.rs:17:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'1` @@ -36,7 +50,7 @@ LL | static_id(&u); | argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:17:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'2` @@ -49,6 +63,6 @@ LL | static_id_indirect(&v); | `v` escapes the function body here | argument requires that `'2` must outlive `'static` -error: aborting due to 3 previous errors; 2 warnings emitted +error: aborting due to 3 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/regions/resolve-re-error-ice.rs b/tests/ui/regions/resolve-re-error-ice.rs new file mode 100644 index 000000000..f37b27a82 --- /dev/null +++ b/tests/ui/regions/resolve-re-error-ice.rs @@ -0,0 +1,22 @@ +// check-pass + +// Allow this for now, can remove this UI test when this becomes a hard error. +#![allow(implied_bounds_entailment)] + +use std::collections::hash_map::{Keys, HashMap}; +use std::marker::PhantomData; + +trait MapAssertion<'a, K, V, R> { + fn key_set(&self) -> Subject, (), R>; +} + +struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); + +impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap, (), R> +{ + fn key_set(&self) -> Subject<'a, Keys, (), R> { + todo!() + } +} + +fn main() {} diff --git a/tests/ui/regions/resolve-re-error-ice.stderr b/tests/ui/regions/resolve-re-error-ice.stderr new file mode 100644 index 000000000..e7003e1c3 --- /dev/null +++ b/tests/ui/regions/resolve-re-error-ice.stderr @@ -0,0 +1,15 @@ +Future incompatibility report: Future breakage diagnostic: +warning: impl method assumes more implied bounds than the corresponding trait method + --> $DIR/resolve-re-error-ice.rs:17:16 + | +LL | fn key_set(&self) -> Subject<'a, Keys, (), R> { + | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `Subject<'_, std::collections::hash_map::Keys<'_, K, V>, (), R>` + | + = 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 #105572 +note: the lint level is defined here + --> $DIR/resolve-re-error-ice.rs:4:10 + | +LL | #![allow(implied_bounds_entailment)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/reify-intrinsic.stderr b/tests/ui/reify-intrinsic.stderr index f78f1d822..9f9034a30 100644 --- a/tests/ui/reify-intrinsic.stderr +++ b/tests/ui/reify-intrinsic.stderr @@ -8,6 +8,7 @@ LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr | = note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize` found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + = note: when the arguments and return types match, functions can be coerced to function pointers error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid --> $DIR/reify-intrinsic.rs:11:13 @@ -23,9 +24,7 @@ LL | std::intrinsics::unlikely, | = note: expected fn item `extern "rust-intrinsic" fn(_) -> _ {likely}` found fn item `extern "rust-intrinsic" fn(_) -> _ {unlikely}` - = note: different `fn` items always have unique types, even if their signatures are the same - = help: change the expected type to be function pointer `extern "rust-intrinsic" fn(bool) -> bool` - = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `likely as extern "rust-intrinsic" fn(bool) -> bool` + = note: different fn items have unique types, even if their signatures are the same error: aborting due to 3 previous errors diff --git a/tests/ui/repeat-expr/repeat_count.rs b/tests/ui/repeat-expr/repeat_count.rs index 96abff4ab..18610bc5b 100644 --- a/tests/ui/repeat-expr/repeat_count.rs +++ b/tests/ui/repeat-expr/repeat_count.rs @@ -30,5 +30,5 @@ fn main() { } let g = [0; G { g: () }]; //~^ ERROR mismatched types - //~| expected `usize`, found struct `G` + //~| expected `usize`, found `G` } diff --git a/tests/ui/repeat-expr/repeat_count.stderr b/tests/ui/repeat-expr/repeat_count.stderr index e222c141f..8a1ed8f3b 100644 --- a/tests/ui/repeat-expr/repeat_count.stderr +++ b/tests/ui/repeat-expr/repeat_count.stderr @@ -34,7 +34,7 @@ error[E0308]: mismatched types --> $DIR/repeat_count.rs:31:17 | LL | let g = [0; G { g: () }]; - | ^^^^^^^^^^^ expected `usize`, found struct `G` + | ^^^^^^^^^^^ expected `usize`, found `G` error[E0308]: mismatched types --> $DIR/repeat_count.rs:19:17 diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs new file mode 100644 index 000000000..2acfde4be --- /dev/null +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -0,0 +1,52 @@ +// build-pass +// revisions: avr msp430 +// +// [avr] needs-llvm-components: avr +// [avr] compile-flags: --target=avr-unknown-gnu-atmega328 --crate-type=rlib +// [msp430] needs-llvm-components: msp430 +// [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib +#![feature(no_core, lang_items, intrinsics, staged_api)] +#![no_core] +#![crate_type = "lib"] +#![stable(feature = "", since = "")] +#![allow(dead_code)] + +// Test that the repr(C) attribute doesn't break compilation +// Previous bad assumption was that 32-bit enum default width is fine on msp430, avr +// But the width of the C int on these platforms is 16 bits, and C enums <= C int range +// so we want no more than that, usually. This resulted in errors like +// "layout decided on a larger discriminant type (I32) than typeck (I16)" +#[repr(C)] +enum Foo { + Bar, +} + +extern "rust-intrinsic" { + #[stable(feature = "", since = "")] + #[rustc_const_stable(feature = "", since = "")] + #[rustc_safe_intrinsic] + fn size_of() -> usize; +} + +#[lang="sized"] +trait Sized {} +#[lang="copy"] +trait Copy {} + +const EXPECTED: usize = 2; +const ACTUAL: usize = size_of::(); +// Validate that the size is indeed 16 bits, to match this C static_assert: +/** +```c +#include +enum foo { + BAR +}; +int main(void) +{ + /* passes on msp430-elf-gcc */ + static_assert(sizeof(enum foo) == 2); +} +``` +*/ +const _: [(); EXPECTED] = [(); ACTUAL]; diff --git a/tests/ui/resolve/issue-108529.rs b/tests/ui/resolve/issue-108529.rs new file mode 100644 index 000000000..8e3aafab6 --- /dev/null +++ b/tests/ui/resolve/issue-108529.rs @@ -0,0 +1,8 @@ +#![allow(nonstandard_style)] +use f::f::f; //~ ERROR + +trait f { + extern "C" fn f(); +} + +fn main() {} diff --git a/tests/ui/resolve/issue-108529.stderr b/tests/ui/resolve/issue-108529.stderr new file mode 100644 index 000000000..cf4e4759c --- /dev/null +++ b/tests/ui/resolve/issue-108529.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `f::f` + --> $DIR/issue-108529.rs:2:8 + | +LL | use f::f::f; + | ^ expected type, found associated function `f` in `f` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/resolve/name-clash-nullary.stderr b/tests/ui/resolve/name-clash-nullary.stderr index 76c4b5914..fffd3027a 100644 --- a/tests/ui/resolve/name-clash-nullary.stderr +++ b/tests/ui/resolve/name-clash-nullary.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let None: isize = 42; | ^^^^ ----- expected due to this | | - | expected `isize`, found enum `Option` + | expected `isize`, found `Option<_>` | = note: expected type `isize` found enum `Option<_>` diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index a24fe4d23..3c051429f 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -267,7 +267,7 @@ LL | Fn(u8), | -- `Fn` defines an enum variant constructor here, which should be called ... LL | let _: Z = Z::Fn; - | - ^^^^^ expected enum `Z`, found enum constructor + | - ^^^^^ expected `Z`, found enum constructor | | | expected due to this | @@ -308,7 +308,7 @@ LL | Fn(u8), | -- `Fn` defines an enum variant constructor here, which should be called ... LL | let _: E = m::E::Fn; - | - ^^^^^^^^ expected enum `E`, found enum constructor + | - ^^^^^^^^ expected `E`, found enum constructor | | | expected due to this | @@ -349,7 +349,7 @@ LL | Fn(u8), | -- `Fn` defines an enum variant constructor here, which should be called ... LL | let _: E = E::Fn; - | - ^^^^^ expected enum `E`, found enum constructor + | - ^^^^^ expected `E`, found enum constructor | | | expected due to this | diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 773c9f6cd..023db303d 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -87,7 +87,7 @@ error[E0308]: mismatched types LL | match x { | - this expression has type `(E, E)` LL | (A, B) | (ref B, c) | (c, A) => () - | - ^^^^^ expected enum `E`, found `&E` + | - ^^^^^ expected `E`, found `&E` | | | first introduced with type `E` here | diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr index 964302e92..f803f9da2 100644 --- a/tests/ui/resolve/resolve-primitive-fallback.stderr +++ b/tests/ui/resolve/resolve-primitive-fallback.stderr @@ -24,14 +24,13 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/resolve-primitive-fallback.rs:3:5 | LL | std::mem::size_of(u16); - | ^^^^^^^^^^^^^^^^^ --- argument unexpected + | ^^^^^^^^^^^^^^^^^ --- + | | + | unexpected argument + | help: remove the extra argument | note: function defined here --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -help: remove the extra argument - | -LL | std::mem::size_of(); - | ~~ error: aborting due to 3 previous errors diff --git a/tests/ui/resolve/token-error-correct-2.rs b/tests/ui/resolve/token-error-correct-2.rs index f7c7d908c..a38755dae 100644 --- a/tests/ui/resolve/token-error-correct-2.rs +++ b/tests/ui/resolve/token-error-correct-2.rs @@ -2,6 +2,5 @@ fn main() { if foo { - //~^ ERROR: cannot find value `foo` ) //~ ERROR: mismatched closing delimiter: `)` } diff --git a/tests/ui/resolve/token-error-correct-2.stderr b/tests/ui/resolve/token-error-correct-2.stderr index cca9f2dc8..be5fb18a5 100644 --- a/tests/ui/resolve/token-error-correct-2.stderr +++ b/tests/ui/resolve/token-error-correct-2.stderr @@ -3,16 +3,8 @@ error: mismatched closing delimiter: `)` | LL | if foo { | ^ unclosed delimiter -LL | LL | ) | ^ mismatched closing delimiter -error[E0425]: cannot find value `foo` in this scope - --> $DIR/token-error-correct-2.rs:4:8 - | -LL | if foo { - | ^^^ not found in this scope - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/resolve/token-error-correct-3.rs b/tests/ui/resolve/token-error-correct-3.rs index 52934085f..2793f1b90 100644 --- a/tests/ui/resolve/token-error-correct-3.rs +++ b/tests/ui/resolve/token-error-correct-3.rs @@ -9,12 +9,9 @@ pub mod raw { callback: F) -> io::Result { if !is_directory(path.as_ref()) { - //~^ ERROR cannot find function `is_directory` callback(path.as_ref(); - //~^ ERROR expected one of fs::create_dir_all(path.as_ref()).map(|()| true) - } else { - //~^ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `)` + } else { //~ ERROR mismatched closing delimiter Ok(false); } diff --git a/tests/ui/resolve/token-error-correct-3.stderr b/tests/ui/resolve/token-error-correct-3.stderr index 77c87c784..79d1d4883 100644 --- a/tests/ui/resolve/token-error-correct-3.stderr +++ b/tests/ui/resolve/token-error-correct-3.stderr @@ -1,25 +1,13 @@ -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:13:21 +error: mismatched closing delimiter: `}` + --> $DIR/token-error-correct-3.rs:12:21 | +LL | if !is_directory(path.as_ref()) { + | - closing delimiter possibly meant for this LL | callback(path.as_ref(); - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:16:9 - | + | ^ unclosed delimiter LL | fs::create_dir_all(path.as_ref()).map(|()| true) - | - expected one of `.`, `;`, `?`, `}`, or an operator LL | } else { - | ^ unexpected token - -error[E0425]: cannot find function `is_directory` in this scope - --> $DIR/token-error-correct-3.rs:11:13 - | -LL | if !is_directory(path.as_ref()) { - | ^^^^^^^^^^^^ not found in this scope + | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/resolve/token-error-correct-4.fixed b/tests/ui/resolve/token-error-correct-4.fixed deleted file mode 100644 index 064b9e74e..000000000 --- a/tests/ui/resolve/token-error-correct-4.fixed +++ /dev/null @@ -1,10 +0,0 @@ -// run-rustfix -// Test that we do some basic error correction in the tokeniser and apply suggestions. - -fn setsuna(_: ()) {} - -fn kazusa() {} - -fn main() { - setsuna(kazusa()); //~ ERROR: expected one of -} //~ ERROR: expected expression diff --git a/tests/ui/resolve/token-error-correct-4.rs b/tests/ui/resolve/token-error-correct-4.rs index 5e31d71e7..49fad4bd9 100644 --- a/tests/ui/resolve/token-error-correct-4.rs +++ b/tests/ui/resolve/token-error-correct-4.rs @@ -1,4 +1,3 @@ -// run-rustfix // Test that we do some basic error correction in the tokeniser and apply suggestions. fn setsuna(_: ()) {} @@ -6,5 +5,5 @@ fn setsuna(_: ()) {} fn kazusa() {} fn main() { - setsuna(kazusa(); //~ ERROR: expected one of -} //~ ERROR: expected expression + setsuna(kazusa(); +} //~ ERROR mismatched closing delimiter diff --git a/tests/ui/resolve/token-error-correct-4.stderr b/tests/ui/resolve/token-error-correct-4.stderr index 81e5a1336..3ec97171f 100644 --- a/tests/ui/resolve/token-error-correct-4.stderr +++ b/tests/ui/resolve/token-error-correct-4.stderr @@ -1,16 +1,12 @@ -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-4.rs:9:12 +error: mismatched closing delimiter: `}` + --> $DIR/token-error-correct-4.rs:8:12 | +LL | fn main() { + | - closing delimiter possibly meant for this LL | setsuna(kazusa(); - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected expression, found `)` - --> $DIR/token-error-correct-4.rs:10:1 - | + | ^ unclosed delimiter LL | } - | ^ expected expression + | ^ mismatched closing delimiter -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/resolve/token-error-correct.rs b/tests/ui/resolve/token-error-correct.rs index 4f74df0bf..84ee90e36 100644 --- a/tests/ui/resolve/token-error-correct.rs +++ b/tests/ui/resolve/token-error-correct.rs @@ -2,7 +2,6 @@ fn main() { foo(bar(; - //~^ ERROR cannot find function `bar` in this scope } //~^ ERROR: mismatched closing delimiter: `}` diff --git a/tests/ui/resolve/token-error-correct.stderr b/tests/ui/resolve/token-error-correct.stderr index ca0c4c18a..35b2d0b32 100644 --- a/tests/ui/resolve/token-error-correct.stderr +++ b/tests/ui/resolve/token-error-correct.stderr @@ -5,16 +5,8 @@ LL | fn main() { | - closing delimiter possibly meant for this LL | foo(bar(; | ^ unclosed delimiter -LL | LL | } | ^ mismatched closing delimiter -error[E0425]: cannot find function `bar` in this scope - --> $DIR/token-error-correct.rs:4:9 - | -LL | foo(bar(; - | ^^^ not found in this scope - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/return/return-type.stderr b/tests/ui/return/return-type.stderr index 5af136e60..60d538eba 100644 --- a/tests/ui/return/return-type.stderr +++ b/tests/ui/return/return-type.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/return-type.rs:10:5 | LL | foo(4 as usize) - | ^^^^^^^^^^^^^^^ expected `()`, found struct `S` + | ^^^^^^^^^^^^^^^ expected `()`, found `S` | = note: expected unit type `()` found struct `S` diff --git a/tests/ui/return/tail-expr-as-potential-return.stderr b/tests/ui/return/tail-expr-as-potential-return.stderr index 9183b4599..ccb208fc6 100644 --- a/tests/ui/return/tail-expr-as-potential-return.stderr +++ b/tests/ui/return/tail-expr-as-potential-return.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | / if x { LL | | Err(42) - | | ^^^^^^^ expected `()`, found enum `Result` + | | ^^^^^^^ expected `()`, found `Result<_, {integer}>` LL | | //| HELP you might have meant to return this value LL | | } | |_____- expected this to be `()` @@ -35,7 +35,7 @@ error[E0308]: mismatched types | LL | / if x { LL | | Err(42) - | | ^^^^^^^ expected `()`, found enum `Result` + | | ^^^^^^^ expected `()`, found `Result<_, {integer}>` LL | | //| HELP you might have meant to return this value LL | | } | |_____- expected this to be `()` diff --git a/tests/ui/rfc-2005-default-binding-mode/const.stderr b/tests/ui/rfc-2005-default-binding-mode/const.stderr index 0f5671254..fc06de90a 100644 --- a/tests/ui/rfc-2005-default-binding-mode/const.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/const.stderr @@ -9,7 +9,7 @@ LL | match &f { LL | FOO => {}, | ^^^ | | - | expected `&Foo`, found struct `Foo` + | expected `&Foo`, found `Foo` | `FOO` is interpreted as a constant, not a new binding | help: introduce a new binding instead: `other_foo` diff --git a/tests/ui/rfc-2005-default-binding-mode/lit.stderr b/tests/ui/rfc-2005-default-binding-mode/lit.stderr index 11bc170cd..181f57899 100644 --- a/tests/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/tests/ui/rfc-2005-default-binding-mode/lit.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match &s { | -- this expression has type `&&str` LL | "abc" => true, - | ^^^^^ expected `&str`, found `str` + | ^^^^^ expected `&&str`, found `&str` | = note: expected reference `&&str` found reference `&'static str` @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | match &s { | -- this expression has type `&&[u8]` LL | b"abc" => true, - | ^^^^^^ expected `&[u8]`, found array `[u8; 3]` + | ^^^^^^ expected `&&[u8]`, found `&[u8; 3]` | = note: expected reference `&&[u8]` found reference `&'static [u8; 3]` diff --git a/tests/ui/rfc-2008-non-exhaustive/borrowck-non-exhaustive.stderr b/tests/ui/rfc-2008-non-exhaustive/borrowck-non-exhaustive.stderr index de730ce10..ad84ebe3a 100644 --- a/tests/ui/rfc-2008-non-exhaustive/borrowck-non-exhaustive.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/borrowck-non-exhaustive.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-non-exhaustive.rs:12:11 | LL | let y = &mut x; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | match x { | ^ use of borrowed `x` ... diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions.stderr index f8ed156b5..c209caab5 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found enum `UninhabitedEnum` + | ^ expected `A`, found `UninhabitedEnum` error[E0308]: mismatched types --> $DIR/coercions.rs:27:5 @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found struct `UninhabitedTupleStruct` + | ^ expected `A`, found `UninhabitedTupleStruct` error[E0308]: mismatched types --> $DIR/coercions.rs:31:5 @@ -20,7 +20,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found struct `UninhabitedStruct` + | ^ expected `A`, found `UninhabitedStruct` error[E0308]: mismatched types --> $DIR/coercions.rs:35:5 @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found enum `UninhabitedVariants` + | ^ expected `A`, found `UninhabitedVariants` error: aborting due to 4 previous errors diff --git a/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr b/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr index fd2c56974..289433edf 100644 --- a/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr +++ b/tests/ui/rfc-2008-non-exhaustive/uninhabited/coercions_same_crate.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found enum `UninhabitedEnum` + | ^ expected `A`, found `UninhabitedEnum` error[E0308]: mismatched types --> $DIR/coercions_same_crate.rs:34:5 @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found struct `UninhabitedTupleStruct` + | ^ expected `A`, found `UninhabitedTupleStruct` error[E0308]: mismatched types --> $DIR/coercions_same_crate.rs:38:5 @@ -20,7 +20,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found struct `UninhabitedStruct` + | ^ expected `A`, found `UninhabitedStruct` error[E0308]: mismatched types --> $DIR/coercions_same_crate.rs:42:5 @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A { | - expected `A` because of return type LL | x - | ^ expected struct `A`, found enum `UninhabitedVariants` + | ^ expected `A`, found `UninhabitedVariants` error: aborting due to 4 previous errors diff --git a/tests/ui/rfc-2091-track-caller/call-chain.rs b/tests/ui/rfc-2091-track-caller/call-chain.rs index 28b3f76c9..a8814ce28 100644 --- a/tests/ui/rfc-2091-track-caller/call-chain.rs +++ b/tests/ui/rfc-2091-track-caller/call-chain.rs @@ -1,6 +1,6 @@ // run-pass // revisions: default mir-opt -//[default] compile-flags: -Zinline-mir=no +//[default] compile-flags: -Zinline-mir=false //[mir-opt] compile-flags: -Zmir-opt-level=4 use std::panic::Location; diff --git a/tests/ui/rfc-2091-track-caller/error-with-main.stderr b/tests/ui/rfc-2091-track-caller/error-with-main.stderr index 7e2ec3524..6d6562dae 100644 --- a/tests/ui/rfc-2091-track-caller/error-with-main.stderr +++ b/tests/ui/rfc-2091-track-caller/error-with-main.stderr @@ -2,7 +2,7 @@ error: `main` function is not allowed to be `#[track_caller]` --> $DIR/error-with-main.rs:1:1 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ help: remove this annotation LL | fn main() { | --------- `main` function is not allowed to be `#[track_caller]` diff --git a/tests/ui/rfc-2294-if-let-guard/typeck.stderr b/tests/ui/rfc-2294-if-let-guard/typeck.stderr index dd1f4826f..4ce97a68a 100644 --- a/tests/ui/rfc-2294-if-let-guard/typeck.stderr +++ b/tests/ui/rfc-2294-if-let-guard/typeck.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | Ok(x) if let Err(_) = x => {}, | ^^^^^^ - this expression has type `Option` | | - | expected enum `Option`, found enum `Result` + | expected `Option`, found `Result<_, _>` | = note: expected enum `Option` found enum `Result<_, _>` @@ -15,7 +15,7 @@ error[E0308]: mismatched types LL | Ok(x) if let 0 = x => {}, | ^ - this expression has type `Option` | | - | expected enum `Option`, found integer + | expected `Option`, found integer | = note: expected enum `Option` found type `{integer}` diff --git a/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr index dd0dac95e..7639ae9f6 100644 --- a/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr +++ b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr @@ -12,7 +12,7 @@ error[E0754]: trying to load file for module `řųśť` with non-ascii identifie LL | mod řųśť; | ^^^^ | - = help: consider using `#[path]` attribute to specify filesystem path + = help: consider using the `#[path]` attribute to specify filesystem path error: aborting due to 2 previous errors diff --git a/tests/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/tests/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 3028f8dbd..81933173c 100644 --- a/tests/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/tests/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -1516,7 +1516,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:157:8 | LL | if true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1525,7 +1525,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:161:8 | LL | if ..(let 0 = 0) {} - | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo` + | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo` | = note: expected type `bool` found struct `RangeTo` @@ -1534,7 +1534,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:165:8 | LL | if (let 0 = 0).. {} - | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom` + | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom` | = note: expected type `bool` found struct `RangeFrom` @@ -1545,7 +1545,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1554,7 +1554,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:171:8 | LL | if let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1565,7 +1565,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1574,7 +1574,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:175:8 | LL | if let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1585,7 +1585,7 @@ error[E0308]: mismatched types LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `Range` + | expected fn pointer, found `Range<_>` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1607,7 +1607,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:182:8 | LL | if let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1618,7 +1618,7 @@ error[E0308]: mismatched types LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1639,7 +1639,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:190:8 | LL | if let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1710,7 +1710,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:249:11 | LL | while true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1719,7 +1719,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:253:11 | LL | while ..(let 0 = 0) {} - | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo` + | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo` | = note: expected type `bool` found struct `RangeTo` @@ -1728,7 +1728,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:257:11 | LL | while (let 0 = 0).. {} - | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom` + | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom` | = note: expected type `bool` found struct `RangeFrom` @@ -1739,7 +1739,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1748,7 +1748,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:263:11 | LL | while let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1759,7 +1759,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1768,7 +1768,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:267:11 | LL | while let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1779,7 +1779,7 @@ error[E0308]: mismatched types LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `Range` + | expected fn pointer, found `Range<_>` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1801,7 +1801,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:274:11 | LL | while let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1812,7 +1812,7 @@ error[E0308]: mismatched types LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1833,7 +1833,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:282:11 | LL | while let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1883,7 +1883,7 @@ error[E0308]: mismatched types LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `Range` + | expected `bool`, found `Range<_>` | = note: expected type `bool` found struct `std::ops::Range<_>` diff --git a/tests/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr b/tests/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr index 498a112fa..9bc3e7541 100644 --- a/tests/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr +++ b/tests/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr @@ -37,6 +37,11 @@ help: add a block here | LL | if let Some(n) = opt else { | ^ +help: remove the `if` if you meant to write a `let...else` statement + | +LL - if let Some(n) = opt else { +LL + let Some(n) = opt else { + | error: this `if` expression is missing a block after the condition --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5 @@ -101,7 +106,7 @@ error[E0308]: mismatched types --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19 | LL | let Some(n) = opt && n == 1 else { - | ^^^ expected `bool`, found enum `Option` + | ^^^ expected `bool`, found `Option` | = note: expected type `bool` found enum `Option` @@ -112,7 +117,7 @@ error[E0308]: mismatched types LL | let Some(n) = opt && n == 1 else { | ^^^^^^^ ------------- this expression has type `bool` | | - | expected `bool`, found enum `Option` + | expected `bool`, found `Option<_>` | = note: expected type `bool` found enum `Option<_>` @@ -121,7 +126,7 @@ error[E0308]: mismatched types --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19 | LL | let Some(n) = opt && let another = n else { - | ^^^ expected `bool`, found enum `Option` + | ^^^ expected `bool`, found `Option` | = note: expected type `bool` found enum `Option` @@ -132,7 +137,7 @@ error[E0308]: mismatched types LL | let Some(n) = opt && let another = n else { | ^^^^^^^ ---------------------- this expression has type `bool` | | - | expected `bool`, found enum `Option` + | expected `bool`, found `Option<_>` | = note: expected type `bool` found enum `Option<_>` diff --git a/tests/ui/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs b/tests/ui/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs new file mode 100644 index 000000000..2c99d8bf1 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/const-closure-parse-not-item.rs @@ -0,0 +1,10 @@ +// check-pass + +#![feature(const_trait_impl, const_closures)] +#![allow(incomplete_features)] + +const fn test() -> impl ~const Fn() { + const move || {} +} + +fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.rs b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.rs new file mode 100644 index 000000000..72edfbc97 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.rs @@ -0,0 +1,13 @@ +// check-pass + +#![feature(derive_const)] +#![feature(const_trait_impl)] + +#[derive_const(PartialEq)] +pub struct Reverse(T); + +const fn foo(a: Reverse, b: Reverse) -> bool { + a == b +} + +fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/do-not-const-check-override.rs b/tests/ui/rfc-2632-const-trait-impl/do-not-const-check-override.rs new file mode 100644 index 000000000..730e268c0 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/do-not-const-check-override.rs @@ -0,0 +1,19 @@ +// check-pass +#![feature(const_trait_impl, rustc_attrs)] + +#[const_trait] +trait Foo { + #[rustc_do_not_const_check] + fn into_iter(&self) { println!("FEAR ME!") } +} + + +impl const Foo for () { + fn into_iter(&self) { + // ^_^ + } +} + +const _: () = Foo::into_iter(&()); + +fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/do-not-const-check.rs b/tests/ui/rfc-2632-const-trait-impl/do-not-const-check.rs new file mode 100644 index 000000000..3c39c53de --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/do-not-const-check.rs @@ -0,0 +1,18 @@ +// check-pass +#![feature(const_trait_impl, rustc_attrs)] + +#[const_trait] +trait IntoIter { + fn into_iter(self); +} + +#[const_trait] +trait Hmm: Sized { + #[rustc_do_not_const_check] + fn chain(self, other: U) where U: IntoIter, + { + other.into_iter() + } +} + +fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs b/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs new file mode 100644 index 000000000..1726cf82e --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/function-pointer-does-not-require-const.rs @@ -0,0 +1,8 @@ +// check-pass + +type I32Cmp = fn(&i32, &i32) -> core::cmp::Ordering; +pub const fn min_by_i32() -> fn(i32, i32, I32Cmp) -> i32 { + core::cmp::min_by +} + +fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr index cf5815df5..b0ac5dc44 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr @@ -11,7 +11,13 @@ LL | let foo: fn() = foo; | = note: expected fn pointer `fn()` found fn item `fn() {foo}` + = note: fn items are distinct from fn pointers = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers + = note: when the arguments and return types match, functions can be coerced to function pointers +help: consider casting to a fn pointer + | +LL | let foo: fn() = foo as fn(); + | ~~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr index cf5815df5..b0ac5dc44 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr @@ -11,7 +11,13 @@ LL | let foo: fn() = foo; | = note: expected fn pointer `fn()` found fn item `fn() {foo}` + = note: fn items are distinct from fn pointers = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers + = note: when the arguments and return types match, functions can be coerced to function pointers +help: consider casting to a fn pointer + | +LL | let foo: fn() = foo as fn(); + | ~~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr index 2217b8c04..48e46d3d1 100644 --- a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr +++ b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.stderr @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/feature-gate.rs:22:11 | LL | ..m1 - | ^^ expected struct `State2`, found struct `State1` + | ^^ expected `Machine`, found `Machine` | = note: expected struct `Machine` found struct `Machine` diff --git a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr index 5957ea7c9..831731ba4 100644 --- a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr +++ b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-92010-trait-bound-not-satisfied.rs:8:43 | LL | fn y(&self, y: f64) -> Self { P{y, .. self.clone() } } - | ^^^^^^^^^^^^ expected struct `P`, found `&P` + | ^^^^^^^^^^^^ expected `P`, found `&P` | = note: expected struct `P` found reference `&P` diff --git a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.stderr b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.stderr index 5f93ad6e0..1c26eb880 100644 --- a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.stderr +++ b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.stderr @@ -1,6 +1,9 @@ error[E0597]: `s` does not live long enough --> $DIR/lifetime-update.rs:20:17 | +LL | let s = String::from("hello"); + | - binding `s` declared here +... LL | lt_str: &s, | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr index 6f31b1a96..f31b311c7 100644 --- a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr +++ b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/type-generic-update.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/type-generic-update.rs:46:11 | LL | ..m1 - | ^^ expected `i32`, found `f64` + | ^^ expected `Machine<'_, i32, f64>`, found `Machine<'_, f64, f64>` | = note: expected struct `Machine<'_, i32, _>` found struct `Machine<'_, f64, _>` @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/type-generic-update.rs:51:11 | LL | ..m1 - | ^^ expected `i32`, found `f64` + | ^^ expected `Machine<'_, i32, i32>`, found `Machine<'_, f64, f64>` | = note: expected struct `Machine<'_, i32, i32>` found struct `Machine<'_, f64, f64>` diff --git a/tests/ui/runtime/out-of-stack.rs b/tests/ui/runtime/out-of-stack.rs index 6873abc49..ff45ace78 100644 --- a/tests/ui/runtime/out-of-stack.rs +++ b/tests/ui/runtime/out-of-stack.rs @@ -6,6 +6,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-fuchsia must translate zircon signal to SIGABRT, FIXME (#58590) +// ignore-nto no stack overflow handler used (no alternate stack available) #![feature(core_intrinsics)] #![feature(rustc_private)] diff --git a/tests/ui/runtime/signal-alternate-stack-cleanup.rs b/tests/ui/runtime/signal-alternate-stack-cleanup.rs index 8a6d73895..37c602ae0 100644 --- a/tests/ui/runtime/signal-alternate-stack-cleanup.rs +++ b/tests/ui/runtime/signal-alternate-stack-cleanup.rs @@ -7,6 +7,7 @@ // ignore-windows // ignore-sgx no libc // ignore-vxworks no SIGWINCH in user space +// ignore-nto no SA_ONSTACK #![feature(rustc_private)] extern crate libc; diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs index 0b3de0df2..d2254acb3 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.rs @@ -365,4 +365,24 @@ mod unions { } } +// https://github.com/rust-lang/rust/issues/106870 +mod multiple_predicates_with_same_span { + macro_rules! m { + ($($name:ident)+) => { + struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); + //~^ ERROR: outlives requirements can be inferred + struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; + //~^ ERROR: outlives requirements can be inferred + struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; + //~^ ERROR: outlives requirements can be inferred + struct Interleaved<'a, $($name,)+>(&'a ($($name,)+)) + where + (): Sized, + $($name: 'a, $name: 'a, )+ //~ ERROR: outlives requirements can be inferred + $($name: 'a, $name: 'a, )+; + } + } + m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); +} + fn main() {} 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 251d74094..f5ec287d2 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -819,5 +819,61 @@ LL - union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { | -error: aborting due to 68 previous errors +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:372:38 + | +LL | struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); + | ^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:374:64 + | +LL | struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; + | ^^^^^^^^^^^^^^^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:376:86 + | +LL | struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; + | ^^^^^^^^^ help: remove these bounds +... +LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); + | --------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives-multispan.rs:381:19 + | +LL | $($name: 'a, $name: 'a, )+ + | ^^^^^^^^^ ^^^^^^^^^ +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 + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these bounds + | +LL ~ $(, , )+ +LL ~ $(, , )+; + | + +error: aborting due to 72 previous errors diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed index 13645244d..868bdf2e0 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.fixed +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.fixed @@ -791,5 +791,14 @@ struct StaticRef { field: &'static T } +struct TrailingCommaInWhereClause<'a, T, U> +where + T: 'a, + + //~^ ERROR outlives requirements can be inferred +{ + tee: T, + yoo: &'a U +} fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.rs b/tests/ui/rust-2018/edition-lint-infer-outlives.rs index d9486ba66..75783764a 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.rs +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.rs @@ -791,5 +791,14 @@ struct StaticRef { field: &'static T } +struct TrailingCommaInWhereClause<'a, T, U> +where + T: 'a, + U: 'a, + //~^ ERROR outlives requirements can be inferred +{ + tee: T, + yoo: &'a U +} fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr index faa9f21e3..e655fb484 100644 --- a/tests/ui/rust-2018/edition-lint-infer-outlives.stderr +++ b/tests/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -1,8 +1,8 @@ error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:26:31 + --> $DIR/edition-lint-infer-outlives.rs:797:5 | -LL | struct TeeOutlivesAy<'a, T: 'a> { - | ^^^^ help: remove this bound +LL | U: 'a, + | ^^^^^^ help: remove this bound | note: the lint level is defined here --> $DIR/edition-lint-infer-outlives.rs:4:9 @@ -10,6 +10,12 @@ note: the lint level is defined here LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: outlives requirements can be inferred + --> $DIR/edition-lint-infer-outlives.rs:26:31 + | +LL | struct TeeOutlivesAy<'a, T: 'a> { + | ^^^^ help: remove this bound + error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives.rs:31:40 | @@ -916,5 +922,5 @@ error: outlives requirements can be inferred LL | union BeeWhereOutlivesAyTeeWhereDebug<'a, 'b, T> where 'b: 'a, T: Debug { | ^^^^^^^^ help: remove this bound -error: aborting due to 152 previous errors +error: aborting due to 153 previous errors diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed index 832632268..15e0ccc52 100644 --- a/tests/ui/rust-2018/remove-extern-crate.fixed +++ b/tests/ui/rust-2018/remove-extern-crate.fixed @@ -23,6 +23,7 @@ extern crate alloc; fn main() { another_name::mem::drop(3); another::foo(); + with_visibility::foo(); remove_extern_crate::foo!(); bar!(); alloc::vec![5]; @@ -37,3 +38,12 @@ mod another { remove_extern_crate::foo!(); } } + +mod with_visibility { + pub use core; //~ WARNING `extern crate` is not idiomatic + + pub fn foo() { + core::mem::drop(4); + remove_extern_crate::foo!(); + } +} diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs index bbb84cd46..aec0bc7c3 100644 --- a/tests/ui/rust-2018/remove-extern-crate.rs +++ b/tests/ui/rust-2018/remove-extern-crate.rs @@ -23,6 +23,7 @@ extern crate alloc; fn main() { another_name::mem::drop(3); another::foo(); + with_visibility::foo(); remove_extern_crate::foo!(); bar!(); alloc::vec![5]; @@ -37,3 +38,12 @@ mod another { remove_extern_crate::foo!(); } } + +mod with_visibility { + pub extern crate core; //~ WARNING `extern crate` is not idiomatic + + pub fn foo() { + core::mem::drop(4); + remove_extern_crate::foo!(); + } +} diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr index bde4c1808..d07358e47 100644 --- a/tests/ui/rust-2018/remove-extern-crate.stderr +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -12,10 +12,26 @@ LL | #![warn(rust_2018_idioms)] = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` warning: `extern crate` is not idiomatic in the new edition - --> $DIR/remove-extern-crate.rs:32:5 + --> $DIR/remove-extern-crate.rs:33:5 | LL | extern crate core; - | ^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + | ^^^^^^^^^^^^^^^^^^ + | +help: convert it to a `use` + | +LL | use core; + | ~~~ + +warning: `extern crate` is not idiomatic in the new edition + --> $DIR/remove-extern-crate.rs:43:5 + | +LL | pub extern crate core; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: convert it to a `use` + | +LL | pub use core; + | ~~~ -warning: 2 warnings emitted +warning: 3 warnings emitted diff --git a/tests/ui/sanitize/cfg-kasan.rs b/tests/ui/sanitize/cfg-kasan.rs new file mode 100644 index 000000000..d721011f3 --- /dev/null +++ b/tests/ui/sanitize/cfg-kasan.rs @@ -0,0 +1,28 @@ +// Verifies that when compiling with -Zsanitizer=kernel-address, +// the `#[cfg(sanitize = "address")]` attribute is configured. + +// check-pass +// compile-flags: -Zsanitizer=kernel-address --cfg kernel_address +// revisions: aarch64 riscv64imac riscv64gc x86_64 +//[aarch64] compile-flags: --target aarch64-unknown-none +//[aarch64] needs-llvm-components: aarch64 +//[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf +//[riscv64imac] needs-llvm-components: riscv +//[riscv64imac] min-llvm-version: 16 +//[riscv64gc] compile-flags: --target riscv64gc-unknown-none-elf +//[riscv64gc] needs-llvm-components: riscv +//[riscv64gc] min-llvm-version: 16 +//[x86_64] compile-flags: --target x86_64-unknown-none +//[x86_64] needs-llvm-components: x86 + +#![crate_type = "rlib"] +#![feature(cfg_sanitize, no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +const _: fn() -> () = main; + +#[cfg(all(sanitize = "address", kernel_address))] +fn main() {} diff --git a/tests/ui/sanitize/memory-eager.rs b/tests/ui/sanitize/memory-eager.rs index 0018c2f75..0e992b4a5 100644 --- a/tests/ui/sanitize/memory-eager.rs +++ b/tests/ui/sanitize/memory-eager.rs @@ -1,6 +1,5 @@ // needs-sanitizer-support // needs-sanitizer-memory -// min-llvm-version: 14.0.0 // // revisions: unoptimized optimized // diff --git a/tests/ui/save-analysis/emit-notifications.polonius.stderr b/tests/ui/save-analysis/emit-notifications.polonius.stderr deleted file mode 100644 index a1a1b8c63..000000000 --- a/tests/ui/save-analysis/emit-notifications.polonius.stderr +++ /dev/null @@ -1,2 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications.polonius/save-analysis/libemit_notifications.json","emit":"save-analysis"} -{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications.polonius/libemit_notifications.rlib","emit":"link"} diff --git a/tests/ui/save-analysis/emit-notifications.rs b/tests/ui/save-analysis/emit-notifications.rs deleted file mode 100644 index 9179944a6..000000000 --- a/tests/ui/save-analysis/emit-notifications.rs +++ /dev/null @@ -1,7 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -// compile-flags: -Zsave-analysis --json artifacts -// compile-flags: --crate-type rlib --error-format=json -// ignore-pass -// ^-- needed because otherwise, the .stderr file changes with --pass check - -pub fn foo() {} diff --git a/tests/ui/save-analysis/emit-notifications.stderr b/tests/ui/save-analysis/emit-notifications.stderr deleted file mode 100644 index e16f60f8b..000000000 --- a/tests/ui/save-analysis/emit-notifications.stderr +++ /dev/null @@ -1,2 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications/save-analysis/libemit_notifications.json","emit":"save-analysis"} -{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications/libemit_notifications.rlib","emit":"link"} diff --git a/tests/ui/save-analysis/issue-26459.rs b/tests/ui/save-analysis/issue-26459.rs deleted file mode 100644 index 2ba05a0a4..000000000 --- a/tests/ui/save-analysis/issue-26459.rs +++ /dev/null @@ -1,8 +0,0 @@ -// compile-flags: -Zsave-analysis - -fn main() { - match 'a' { - char{ch} => true - //~^ ERROR expected struct, variant or union type, found builtin type `char` - }; -} diff --git a/tests/ui/save-analysis/issue-26459.stderr b/tests/ui/save-analysis/issue-26459.stderr deleted file mode 100644 index 9f594990c..000000000 --- a/tests/ui/save-analysis/issue-26459.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0574]: expected struct, variant or union type, found builtin type `char` - --> $DIR/issue-26459.rs:5:9 - | -LL | char{ch} => true - | ^^^^ not a struct, variant or union type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/save-analysis/issue-37323.rs b/tests/ui/save-analysis/issue-37323.rs deleted file mode 100644 index 55f5c5a95..000000000 --- a/tests/ui/save-analysis/issue-37323.rs +++ /dev/null @@ -1,20 +0,0 @@ -// check-pass -// compile-flags: -Zsave-analysis - -#![feature(rustc_attrs)] -#![allow(warnings)] - -#[derive(Debug)] -struct Point { -} - -struct NestedA<'a, 'b> { - x: &'a NestedB<'b> -} - -struct NestedB<'a> { - x: &'a i32, -} - -fn main() { -} diff --git a/tests/ui/save-analysis/issue-59134-0.rs b/tests/ui/save-analysis/issue-59134-0.rs deleted file mode 100644 index a0871ca18..000000000 --- a/tests/ui/save-analysis/issue-59134-0.rs +++ /dev/null @@ -1,12 +0,0 @@ -// compile-flags: -Zsave-analysis - -// Check that this doesn't ICE when processing associated const (field expr). - -pub fn f() { - trait Trait {} - impl dyn Trait { - const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus` - } -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-59134-0.stderr b/tests/ui/save-analysis/issue-59134-0.stderr deleted file mode 100644 index 4e9b2e6fd..000000000 --- a/tests/ui/save-analysis/issue-59134-0.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find value `bogus` in this scope - --> $DIR/issue-59134-0.rs:8:27 - | -LL | const FLAG: u32 = bogus.field; - | ^^^^^ 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/save-analysis/issue-59134-1.rs b/tests/ui/save-analysis/issue-59134-1.rs deleted file mode 100644 index 3cb629777..000000000 --- a/tests/ui/save-analysis/issue-59134-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// compile-flags: -Zsave-analysis - -// Check that this doesn't ICE when processing associated const (type). - -fn func() { - trait Trait { - type MyType; - const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus` - } -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-59134-1.stderr b/tests/ui/save-analysis/issue-59134-1.stderr deleted file mode 100644 index bdc335eaa..000000000 --- a/tests/ui/save-analysis/issue-59134-1.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find value `bogus` in this scope - --> $DIR/issue-59134-1.rs:8:37 - | -LL | const CONST: Self::MyType = bogus.field; - | ^^^^^ 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/save-analysis/issue-63663.rs b/tests/ui/save-analysis/issue-63663.rs deleted file mode 100644 index 92e85884f..000000000 --- a/tests/ui/save-analysis/issue-63663.rs +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass -// compile-flags: -Zsave-analysis - -pub trait Trait { - type Assoc; -} - -pub struct A; - -trait Generic {} -impl Generic for () {} - -// Don't ICE when resolving type paths in return type `impl Trait` -fn assoc_in_opaque_type_bounds() -> impl Generic {} - -// Check that this doesn't ICE when processing associated const in formal -// argument and return type of functions defined inside function/method scope. -pub fn func() { - fn _inner1(_: U::Assoc) {} - fn _inner2() -> U::Assoc { unimplemented!() } - - impl A { - fn _inner1(self, _: U::Assoc) {} - fn _inner2(self) -> U::Assoc { unimplemented!() } - } -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-64659.rs b/tests/ui/save-analysis/issue-64659.rs deleted file mode 100644 index a3d88a203..000000000 --- a/tests/ui/save-analysis/issue-64659.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -// compile-flags: -Zsave-analysis - -trait Trait { type Assoc; } - -fn main() { - struct Data { - x: T::Assoc, - } -} diff --git a/tests/ui/save-analysis/issue-65411.rs b/tests/ui/save-analysis/issue-65411.rs deleted file mode 100644 index 9e58b8da5..000000000 --- a/tests/ui/save-analysis/issue-65411.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass -// compile-flags: -Zsave-analysis - -trait Trait { type Assoc; } -trait GenericTrait {} -struct Wrapper { b: B } - -fn func() { - // Processing associated path in impl block definition inside a function - // body does not ICE - impl GenericTrait for Wrapper {} -} - - -fn main() {} diff --git a/tests/ui/save-analysis/issue-65590.rs b/tests/ui/save-analysis/issue-65590.rs deleted file mode 100644 index 27874f865..000000000 --- a/tests/ui/save-analysis/issue-65590.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass -// compile-flags: -Zsave-analysis -// edition:2018 - -// Async desugaring for return types in (associated) functions introduces a -// separate definition internally, which we need to take into account -// (or else we ICE). -trait Trait { type Assoc; } -struct Struct; - -async fn foobar() -> T::Assoc { - unimplemented!() -} - -impl Struct { - async fn foo(&self) -> T::Assoc { - unimplemented!() - } -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-68621.rs b/tests/ui/save-analysis/issue-68621.rs deleted file mode 100644 index 30479580f..000000000 --- a/tests/ui/save-analysis/issue-68621.rs +++ /dev/null @@ -1,17 +0,0 @@ -// compile-flags: -Zsave-analysis - -#![feature(type_alias_impl_trait)] - -trait Trait {} - -trait Service { - type Future: Trait; -} - -struct Struct; - -impl Service for Struct { - type Future = impl Trait; //~ ERROR: unconstrained opaque type -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-68621.stderr b/tests/ui/save-analysis/issue-68621.stderr deleted file mode 100644 index 4452ee791..000000000 --- a/tests/ui/save-analysis/issue-68621.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained opaque type - --> $DIR/issue-68621.rs:14:19 - | -LL | type Future = impl Trait; - | ^^^^^^^^^^ - | - = note: `Future` must be used in combination with a concrete type within the same impl - -error: aborting due to previous error - diff --git a/tests/ui/save-analysis/issue-72267.rs b/tests/ui/save-analysis/issue-72267.rs deleted file mode 100644 index eea0a7fea..000000000 --- a/tests/ui/save-analysis/issue-72267.rs +++ /dev/null @@ -1,7 +0,0 @@ -// compile-flags: -Z save-analysis - -fn main() { - let _: Box<(dyn ?Sized)>; - //~^ ERROR `?Trait` is not permitted in trait object types - //~| ERROR at least one trait is required for an object type -} diff --git a/tests/ui/save-analysis/issue-72267.stderr b/tests/ui/save-analysis/issue-72267.stderr deleted file mode 100644 index 76fc6c57c..000000000 --- a/tests/ui/save-analysis/issue-72267.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: `?Trait` is not permitted in trait object types - --> $DIR/issue-72267.rs:4:21 - | -LL | let _: Box<(dyn ?Sized)>; - | ^^^^^^ - -error[E0224]: at least one trait is required for an object type - --> $DIR/issue-72267.rs:4:17 - | -LL | let _: Box<(dyn ?Sized)>; - | ^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0224`. diff --git a/tests/ui/save-analysis/issue-73020.rs b/tests/ui/save-analysis/issue-73020.rs deleted file mode 100644 index 87ce09336..000000000 --- a/tests/ui/save-analysis/issue-73020.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -Zsave-analysis -use {self}; //~ ERROR E0431 - -fn main () { -} diff --git a/tests/ui/save-analysis/issue-73020.stderr b/tests/ui/save-analysis/issue-73020.stderr deleted file mode 100644 index 5bb3aae99..000000000 --- a/tests/ui/save-analysis/issue-73020.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0431]: `self` import can only appear in an import list with a non-empty prefix - --> $DIR/issue-73020.rs:2:6 - | -LL | use {self}; - | ^^^^ can only appear in an import list with a non-empty prefix - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0431`. diff --git a/tests/ui/save-analysis/issue-73022.rs b/tests/ui/save-analysis/issue-73022.rs deleted file mode 100644 index 9ad89a319..000000000 --- a/tests/ui/save-analysis/issue-73022.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-pass -// compile-flags: -Zsave-analysis -enum Enum2 { - Variant8 { _field: bool }, -} - -impl Enum2 { - fn new_variant8() -> Enum2 { - Self::Variant8 { _field: true } - } -} - -fn main() {} diff --git a/tests/ui/save-analysis/issue-89066.rs b/tests/ui/save-analysis/issue-89066.rs deleted file mode 100644 index c65e2d73f..000000000 --- a/tests/ui/save-analysis/issue-89066.rs +++ /dev/null @@ -1,28 +0,0 @@ -// compile-flags: -Zsave-analysis - -// Check that this does not ICE. -// Stolen from tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs - -#![feature(generic_arg_infer)] - -struct All<'a, T, const N: usize> { - v: &'a T, -} - -struct BadInfer<_>; -//~^ ERROR expected identifier -//~| ERROR parameter `_` is never used - -fn all_fn<'a, T, const N: usize>() {} - -fn bad_infer_fn<_>() {} -//~^ ERROR expected identifier - - -fn main() { - let a: All<_, _, _>; - //~^ ERROR this struct takes 2 generic arguments but 3 generic arguments were supplied - all_fn(); - let v: [u8; _]; - let v: [u8; 10] = [0; _]; -} diff --git a/tests/ui/save-analysis/issue-89066.stderr b/tests/ui/save-analysis/issue-89066.stderr deleted file mode 100644 index 5ef04936e..000000000 --- a/tests/ui/save-analysis/issue-89066.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-89066.rs:12:17 - | -LL | struct BadInfer<_>; - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-89066.rs:18:17 - | -LL | fn bad_infer_fn<_>() {} - | ^ expected identifier, found reserved identifier - -error[E0392]: parameter `_` is never used - --> $DIR/issue-89066.rs:12:17 - | -LL | struct BadInfer<_>; - | ^ unused parameter - | - = 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[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied - --> $DIR/issue-89066.rs:23: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/issue-89066.rs:8:8 - | -LL | struct All<'a, T, const N: usize> { - | ^^^ - -------------- - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0107, E0392. -For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr index eb3d3e4a6..944cdc5f5 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr @@ -2,8 +2,9 @@ error[E0700]: hidden type for `impl Clone` captures lifetime that does not appea --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:48 | LL | async fn f(self: Pin<&Self>) -> impl Clone { self } - | ----- ^^^^^^^^ - | | + | ----- ---------- ^^^^^^^^ + | | | + | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here | help: to declare that `impl Clone` captures `'_`, you can add an explicit `'_` lifetime bound diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr index 2c0b2a0d9..8a9b397ca 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr @@ -2,8 +2,9 @@ error[E0700]: hidden type for `impl Clone` captures lifetime that does not appea --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:6:44 | LL | fn f(self: Pin<&Self>) -> impl Clone { self } - | ----- ^^^^ - | | + | ----- ---------- ^^^^ + | | | + | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here | help: to declare that `impl Clone` captures `'_`, you can add an explicit `'_` lifetime bound diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr index 6180e1e0f..0b4c0a7fe 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr @@ -2,7 +2,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52 | LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } - | - - ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | - - ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` @@ -16,7 +16,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:75 | LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | - - ^^^^^^^^^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | - - ^^^^^^^^^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` @@ -30,7 +30,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64 | LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } - | -- - ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` + | -- - ^^^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` | | | | | let's call the lifetime of this reference `'1` | lifetime `'a` defined here diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr index fccee5d43..209dae9c1 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr @@ -2,7 +2,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:6:46 | LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } - | - - ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | - - ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` @@ -16,7 +16,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:9:69 | LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | - - ^^^^^^^^^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | - - ^^^^^^^^^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | | | | | let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'2` @@ -30,7 +30,7 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:15:58 | LL | fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } - | -- ---- has type `Pin<&'1 Foo>` ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` + | -- ---- has type `Pin<&'1 Foo>` ^^^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` | | | lifetime `'a` defined here diff --git a/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs b/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs index 65fec3bec..91aacedfc 100644 --- a/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs +++ b/tests/ui/self/arbitrary_self_types_pointers_and_wrappers.rs @@ -3,6 +3,7 @@ #![feature(rustc_attrs)] use std::{ + cell::Cell, ops::{Deref, CoerceUnsized, DispatchFromDyn}, marker::Unsize, }; @@ -20,6 +21,20 @@ impl Deref for Ptr { impl + ?Sized, U: ?Sized> CoerceUnsized> for Ptr {} impl + ?Sized, U: ?Sized> DispatchFromDyn> for Ptr {} + +struct CellPtr<'a, T: ?Sized>(Cell<&'a T>); + +impl<'a, T: ?Sized> Deref for CellPtr<'a, T> { + type Target = T; + + fn deref(&self) -> &T { + self.0.get() + } +} + +impl<'a, T: Unsize + ?Sized, U: ?Sized> CoerceUnsized> for CellPtr<'a, T> {} +impl<'a, T: Unsize + ?Sized, U: ?Sized> DispatchFromDyn> for CellPtr<'a, T> {} + struct Wrapper(T); impl Deref for Wrapper { @@ -42,6 +57,7 @@ trait Trait { fn ptr_wrapper(self: Ptr>) -> i32; fn wrapper_ptr(self: Wrapper>) -> i32; fn wrapper_ptr_wrapper(self: Wrapper>>) -> i32; + fn cell(self: CellPtr) -> i32; } impl Trait for i32 { @@ -54,6 +70,9 @@ impl Trait for i32 { fn wrapper_ptr_wrapper(self: Wrapper>>) -> i32 { ***self } + fn cell(self: CellPtr) -> i32 { + *self + } } fn main() { @@ -65,4 +84,7 @@ fn main() { let wpw = Wrapper(Ptr(Box::new(Wrapper(7)))) as Wrapper>>; assert_eq!(wpw.wrapper_ptr_wrapper(), 7); + + let c = CellPtr(Cell::new(&8)) as CellPtr; + assert_eq!(c.cell(), 8); } diff --git a/tests/ui/self/elision/lt-ref-self-async.stderr b/tests/ui/self/elision/lt-ref-self-async.stderr index 787afd4dc..29d60ed66 100644 --- a/tests/ui/self/elision/lt-ref-self-async.stderr +++ b/tests/ui/self/elision/lt-ref-self-async.stderr @@ -6,7 +6,7 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/lt-ref-self.stderr b/tests/ui/self/elision/lt-ref-self.stderr index 49af638e4..216737a2c 100644 --- a/tests/ui/self/elision/lt-ref-self.stderr +++ b/tests/ui/self/elision/lt-ref-self.stderr @@ -6,7 +6,7 @@ LL | fn ref_self(&self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | fn ref_Self(self: &Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | fn box_pin_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-mut-self-async.stderr b/tests/ui/self/elision/ref-mut-self-async.stderr index dff50aee9..62543ba53 100644 --- a/tests/ui/self/elision/ref-mut-self-async.stderr +++ b/tests/ui/self/elision/ref-mut-self-async.stderr @@ -6,7 +6,7 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-mut-self.stderr b/tests/ui/self/elision/ref-mut-self.stderr index ccf183016..12b64a3f6 100644 --- a/tests/ui/self/elision/ref-mut-self.stderr +++ b/tests/ui/self/elision/ref-mut-self.stderr @@ -6,7 +6,7 @@ LL | fn ref_self(&mut self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | fn ref_Self(self: &mut Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-mut-struct-async.stderr b/tests/ui/self/elision/ref-mut-struct-async.stderr index 5b7ad026f..f8fb2e4a1 100644 --- a/tests/ui/self/elision/ref-mut-struct-async.stderr +++ b/tests/ui/self/elision/ref-mut-struct-async.stderr @@ -6,7 +6,7 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-mut-struct.stderr b/tests/ui/self/elision/ref-mut-struct.stderr index b9c71e843..cde16ce8b 100644 --- a/tests/ui/self/elision/ref-mut-struct.stderr +++ b/tests/ui/self/elision/ref-mut-struct.stderr @@ -6,7 +6,7 @@ LL | fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-self-async.stderr b/tests/ui/self/elision/ref-self-async.stderr index 26ef9779b..010d281b0 100644 --- a/tests/ui/self/elision/ref-self-async.stderr +++ b/tests/ui/self/elision/ref-self-async.stderr @@ -6,7 +6,7 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -96,7 +96,7 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-self.stderr b/tests/ui/self/elision/ref-self.stderr index 32448f3a6..35693257c 100644 --- a/tests/ui/self/elision/ref-self.stderr +++ b/tests/ui/self/elision/ref-self.stderr @@ -6,7 +6,7 @@ LL | fn ref_self(&self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | fn ref_Self(self: &Self, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -81,7 +81,7 @@ LL | fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -96,7 +96,7 @@ LL | fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-struct-async.stderr b/tests/ui/self/elision/ref-struct-async.stderr index edb5c54ab..c9376d58f 100644 --- a/tests/ui/self/elision/ref-struct-async.stderr +++ b/tests/ui/self/elision/ref-struct-async.stderr @@ -6,7 +6,7 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/elision/ref-struct.stderr b/tests/ui/self/elision/ref-struct.stderr index 4492ed4aa..a3d3cebeb 100644 --- a/tests/ui/self/elision/ref-struct.stderr +++ b/tests/ui/self/elision/ref-struct.stderr @@ -6,7 +6,7 @@ LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -21,7 +21,7 @@ LL | fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -36,7 +36,7 @@ LL | fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -51,7 +51,7 @@ LL | fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | @@ -66,7 +66,7 @@ LL | fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { | | | let's call the lifetime of this reference `'2` LL | f - | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | diff --git a/tests/ui/self/issue-61882-2.stderr b/tests/ui/self/issue-61882-2.stderr index 0b8e134c9..6faa4477d 100644 --- a/tests/ui/self/issue-61882-2.stderr +++ b/tests/ui/self/issue-61882-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-61882-2.rs:6:14 | +LL | let x = 0; + | - binding `x` declared here LL | Self(&x); | ^^ | | diff --git a/tests/ui/self/issue-61882.stderr b/tests/ui/self/issue-61882.stderr index dd7194dc2..96f4e41de 100644 --- a/tests/ui/self/issue-61882.stderr +++ b/tests/ui/self/issue-61882.stderr @@ -16,7 +16,7 @@ error[E0308]: mismatched types --> $DIR/issue-61882.rs:4:22 | LL | const B: A = Self(0); - | ^^^^^^^ expected `u8`, found `bool` + | ^^^^^^^ expected `A`, found `A` | = note: expected struct `A` found struct `A` diff --git a/tests/ui/seq-args.rs b/tests/ui/seq-args.rs index a5ebeecd3..627dfcc31 100644 --- a/tests/ui/seq-args.rs +++ b/tests/ui/seq-args.rs @@ -2,12 +2,12 @@ fn main() { trait Seq { } impl Seq for Vec { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument /* ... */ } impl Seq for u32 { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument /* Treat the integer as a sequence of bits */ } } diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index c404d9574..a5b0f8e98 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:4:13 | LL | impl Seq for Vec { @@ -12,7 +12,7 @@ note: trait defined here, with 0 generic parameters LL | trait Seq { } | ^^^ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:9:10 | LL | impl Seq for u32 { diff --git a/tests/ui/simd/intrinsic/generic-cast-pass.rs b/tests/ui/simd/intrinsic/generic-cast-pass.rs index 15f232e2c..89436c83e 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pass.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pass.rs @@ -1,121 +1,59 @@ // run-pass -#![allow(unused_must_use)] // ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, platform_intrinsics, concat_idents, test)] -#![allow(non_camel_case_types)] - -extern crate test; - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i8x4(i8, i8, i8, i8); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct u32x4(u32, u32, u32, u32); -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct u8x4(u8, u8, u8, u8); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct f32x4(f32, f32, f32, f32); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct f64x4(f64, f64, f64, f64); - +#![feature(repr_simd, platform_intrinsics)] extern "platform-intrinsic" { fn simd_cast(x: T) -> U; } -const A: i32 = -1234567; -const B: i32 = 12345678; -const C: i32 = -123456789; -const D: i32 = 1234567890; +use std::cmp::{max, min}; -trait Foo { - fn is_float() -> bool { false } - fn in_range(x: i32) -> bool; -} -impl Foo for i32 { - fn in_range(_: i32) -> bool { true } -} -impl Foo for i8 { - fn in_range(x: i32) -> bool { -128 <= x && x < 128 } -} -impl Foo for u32 { - fn in_range(x: i32) -> bool { 0 <= x } -} -impl Foo for u8 { - fn in_range(x: i32) -> bool { 0 <= x && x < 128 } -} -impl Foo for f32 { - fn is_float() -> bool { true } - fn in_range(_: i32) -> bool { true } -} -impl Foo for f64 { - fn is_float() -> bool { true } - fn in_range(_: i32) -> bool { true } -} +#[derive(Copy, Clone)] +#[repr(simd)] +struct V([T; 2]); fn main() { - macro_rules! test { - ($from: ident, $to: ident) => {{ - // force the casts to actually happen, or else LLVM/rustc - // may fold them and get slightly different results. - let (a, b, c, d) = test::black_box((A as $from, B as $from, C as $from, D as $from)); - // the SIMD vectors are all FOOx4, so we can concat_idents - // so we don't have to pass in the extra args to the macro - let mut from = simd_cast(concat_idents!($from, x4)(a, b, c, d)); - let mut to = concat_idents!($to, x4)(a as $to, - b as $to, - c as $to, - d as $to); - // assist type inference, it needs to know what `from` is - // for the `if` statements. - to == from; + unsafe { + let u = V::([i16::MIN as u32, i16::MAX as u32]); + let i: V = simd_cast(u); + assert_eq!(i.0[0], u.0[0] as i16); + assert_eq!(i.0[1], u.0[1] as i16); + } - // there are platform differences for some out of range - // casts, so we just normalize such things: it's OK for - // "invalid" calculations to result in nonsense answers. - // (e.g., negative float to unsigned integer goes through a - // library routine on the default i686 platforms, and the - // implementation of that routine differs on e.g., Linux - // vs. macOS, resulting in different answers.) - if $from::is_float() { - if !$to::in_range(A) { from.0 = 0 as $to; to.0 = 0 as $to; } - if !$to::in_range(B) { from.1 = 0 as $to; to.1 = 0 as $to; } - if !$to::in_range(C) { from.2 = 0 as $to; to.2 = 0 as $to; } - if !$to::in_range(D) { from.3 = 0 as $to; to.3 = 0 as $to; } - } + unsafe { + let f = V::([i16::MIN as f32, i16::MAX as f32]); + let i: V = simd_cast(f); + assert_eq!(i.0[0], f.0[0] as i16); + assert_eq!(i.0[1], f.0[1] as i16); + } - assert!(to == from, - "{} -> {} ({:?} != {:?})", stringify!($from), stringify!($to), - from, to); - }} + unsafe { + let f = V::([u8::MIN as f32, u8::MAX as f32]); + let u: V = simd_cast(f); + assert_eq!(u.0[0], f.0[0] as u8); + assert_eq!(u.0[1], f.0[1] as u8); } - macro_rules! tests { - (: $($to: ident),*) => { () }; - // repeating the list twice is easier than writing a cartesian - // product macro - ($from: ident $(, $from_: ident)*: $($to: ident),*) => { - fn $from() { unsafe { $( test!($from, $to); )* } } - tests!($($from_),*: $($to),*) - }; - ($($types: ident),*) => {{ - tests!($($types),* : $($types),*); - $($types();)* - }} + + unsafe { + // We would like to do isize::MIN..=isize::MAX, but those values are not representable in + // an f64, so we clamp to the range of an i32 to prevent running into UB. + let f = V::([ + max(isize::MIN, i32::MIN as isize) as f64, + min(isize::MAX, i32::MAX as isize) as f64, + ]); + let i: V = simd_cast(f); + assert_eq!(i.0[0], f.0[0] as isize); + assert_eq!(i.0[1], f.0[1] as isize); } - // test various combinations, including truncation, - // signed/unsigned extension, and floating point casts. - tests!(i32, i8, u32, u8, f32); - tests!(i32, u32, f32, f64) + unsafe { + let f = V::([ + max(usize::MIN, u32::MIN as usize) as f64, + min(usize::MAX, u32::MAX as usize) as f64, + ]); + let u: V = simd_cast(f); + assert_eq!(u.0[0], f.0[0] as usize); + assert_eq!(u.0[1], f.0[1] as usize); + } } diff --git a/tests/ui/simd/intrinsic/generic-gather-pass.rs b/tests/ui/simd/intrinsic/generic-gather-pass.rs index 805caebe5..7d4b3dbd7 100644 --- a/tests/ui/simd/intrinsic/generic-gather-pass.rs +++ b/tests/ui/simd/intrinsic/generic-gather-pass.rs @@ -24,9 +24,9 @@ fn main() { // reading from *const unsafe { - let pointer = &x[0] as *const f32; + let pointer = x.as_ptr(); let pointers = x4( - pointer.offset(0) as *const f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) @@ -39,9 +39,9 @@ fn main() { // reading from *mut unsafe { - let pointer = &mut x[0] as *mut f32; + let pointer = x.as_mut_ptr(); let pointers = x4( - pointer.offset(0) as *mut f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) @@ -54,9 +54,9 @@ fn main() { // writing to *mut unsafe { - let pointer = &mut x[0] as *mut f32; + let pointer = x.as_mut_ptr(); let pointers = x4( - pointer.offset(0) as *mut f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) @@ -85,9 +85,9 @@ fn main() { // reading from *const unsafe { - let pointer = &y[0] as *const *const f32; + let pointer = y.as_ptr(); let pointers = x4( - pointer.offset(0) as *const *const f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) @@ -100,9 +100,9 @@ fn main() { // reading from *mut unsafe { - let pointer = &mut y[0] as *mut *const f32; + let pointer = y.as_mut_ptr(); let pointers = x4( - pointer.offset(0) as *mut *const f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) @@ -115,9 +115,9 @@ fn main() { // writing to *mut unsafe { - let pointer = &mut y[0] as *mut *const f32; + let pointer = y.as_mut_ptr(); let pointers = x4( - pointer.offset(0) as *mut *const f32, + pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6) diff --git a/tests/ui/simd/issue-89193.rs b/tests/ui/simd/issue-89193.rs index 79c4e6a31..cd24d6675 100644 --- a/tests/ui/simd/issue-89193.rs +++ b/tests/ui/simd/issue-89193.rs @@ -17,13 +17,14 @@ extern "platform-intrinsic" { fn main() { let x: [usize; 4] = [10, 11, 12, 13]; let default = x4(0_usize, 1, 2, 3); - let mask = x4(1_i32, 1, 1, 1); + let all_set = u8::MAX as i8; // aka -1 + let mask = x4(all_set, all_set, all_set, all_set); let expected = x4(10_usize, 11, 12, 13); unsafe { - let pointer = &x[0] as *const usize; + let pointer = x.as_ptr(); let pointers = x4( - pointer.offset(0) as *const usize, + pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3) @@ -38,9 +39,9 @@ fn main() { let expected = x4(10_isize, 11, 12, 13); unsafe { - let pointer = &x[0] as *const isize; + let pointer = x.as_ptr(); let pointers = x4( - pointer.offset(0) as *const isize, + pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3) diff --git a/tests/ui/single-use-lifetime/issue-107998.rs b/tests/ui/single-use-lifetime/issue-107998.rs new file mode 100644 index 000000000..f32688d20 --- /dev/null +++ b/tests/ui/single-use-lifetime/issue-107998.rs @@ -0,0 +1,9 @@ +#![deny(single_use_lifetimes)] + +fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { + //~^ ERROR function pointer types may not have generic parameters + //~| ERROR lifetime parameter `'a` only used once + f(&3) +} + +fn main() {} diff --git a/tests/ui/single-use-lifetime/issue-107998.stderr b/tests/ui/single-use-lifetime/issue-107998.stderr new file mode 100644 index 000000000..e870351de --- /dev/null +++ b/tests/ui/single-use-lifetime/issue-107998.stderr @@ -0,0 +1,30 @@ +error: function pointer types may not have generic parameters + --> $DIR/issue-107998.rs:3:18 + | +LL | fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { + | ^^^^ + | +help: consider moving the lifetime parameter to a `for` parameter list + | +LL - fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { +LL + fn with(f: &for<'a> fn(x: &'a i32) -> R) -> R { + | + +error: lifetime parameter `'a` only used once + --> $DIR/issue-107998.rs:3:19 + | +LL | fn with(f: &fn<'a>(x: &'a i32) -> R) -> R { + | ^^ --- + | | | + | | ...is used only here + | | help: elide the single-use lifetime + | this lifetime... + | +note: the lint level is defined here + --> $DIR/issue-107998.rs:1:9 + | +LL | #![deny(single_use_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/slightly-nice-generic-literal-messages.rs b/tests/ui/slightly-nice-generic-literal-messages.rs index a48598ce8..268009f65 100644 --- a/tests/ui/slightly-nice-generic-literal-messages.rs +++ b/tests/ui/slightly-nice-generic-literal-messages.rs @@ -8,7 +8,7 @@ fn main() { //~^ ERROR mismatched types //~| expected struct `Foo<{float}, _>` //~| found type `{integer}` - //~| expected struct `Foo`, found integer + //~| expected `Foo<{float}, _>`, found integer } } diff --git a/tests/ui/slightly-nice-generic-literal-messages.stderr b/tests/ui/slightly-nice-generic-literal-messages.stderr index 14f01f0eb..83ef522ab 100644 --- a/tests/ui/slightly-nice-generic-literal-messages.stderr +++ b/tests/ui/slightly-nice-generic-literal-messages.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match Foo(1.1, marker::PhantomData) { | ----------------------------- this expression has type `Foo<{float}, _>` LL | 1 => {} - | ^ expected struct `Foo`, found integer + | ^ expected `Foo<{float}, _>`, found integer | = note: expected struct `Foo<{float}, _>` found type `{integer}` diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 48b42bc78..9711dad80 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -47,6 +47,9 @@ LL | foo(f); error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16 | +LL | let mut f = move |g: Box, b: isize| { + | ----- binding `f` declared here +... LL | f(Box::new(|a| { | - ^^^ move out of `f` occurs here | | diff --git a/tests/ui/span/borrowck-let-suggestion-suffixes.rs b/tests/ui/span/borrowck-let-suggestion-suffixes.rs index 18abfb5c3..ad556f281 100644 --- a/tests/ui/span/borrowck-let-suggestion-suffixes.rs +++ b/tests/ui/span/borrowck-let-suggestion-suffixes.rs @@ -8,6 +8,7 @@ fn f() { { let young = ['y']; // statement 3 + //~^ NOTE binding `young` declared here v2.push(&young[0]); // statement 4 //~^ ERROR `young[_]` does not live long enough diff --git a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr index 2dc29a78d..545b235a5 100644 --- a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr +++ b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr @@ -1,6 +1,9 @@ error[E0597]: `young[_]` does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:12:17 + --> $DIR/borrowck-let-suggestion-suffixes.rs:13:17 | +LL | let young = ['y']; // statement 3 + | ----- binding `young` declared here +... LL | v2.push(&young[0]); // statement 4 | ^^^^^^^^^ borrowed value does not live long enough ... @@ -11,7 +14,7 @@ LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); | -- borrow later used here error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:19:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:20:14 | LL | v3.push(&id('x')); // statement 6 | ^^^^^^^ - temporary value is freed at the end of this statement @@ -28,7 +31,7 @@ LL ~ v3.push(&binding); // statement 6 | error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:29:18 + --> $DIR/borrowck-let-suggestion-suffixes.rs:30:18 | LL | v4.push(&id('y')); | ^^^^^^^ - temporary value is freed at the end of this statement @@ -41,7 +44,7 @@ LL | v4.use_ref(); = note: consider using a `let` binding to create a longer lived value error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:40:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:41:14 | LL | v5.push(&id('z')); | ^^^^^^^ - temporary value is freed at the end of this statement diff --git a/tests/ui/span/coerce-suggestions.stderr b/tests/ui/span/coerce-suggestions.stderr index db784d5fe..bb30f000e 100644 --- a/tests/ui/span/coerce-suggestions.stderr +++ b/tests/ui/span/coerce-suggestions.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); - | ----- ^^^^^^^^^^^^^ expected `usize`, found struct `String` + | ----- ^^^^^^^^^^^^^ expected `usize`, found `String` | | | expected due to this @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | let x: &str = String::new(); | ---- ^^^^^^^^^^^^^ | | | - | | expected `&str`, found struct `String` + | | expected `&str`, found `String` | | help: consider borrowing here: `&String::new()` | expected due to this @@ -63,7 +63,7 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:21:9 | LL | s = format!("foo"); - | ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String` + | ^^^^^^^^^^^^^^ expected `&mut String`, found `String` | = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/span/destructor-restrictions.stderr b/tests/ui/span/destructor-restrictions.stderr index 53c940462..281248626 100644 --- a/tests/ui/span/destructor-restrictions.stderr +++ b/tests/ui/span/destructor-restrictions.stderr @@ -1,6 +1,8 @@ error[E0597]: `*a` does not live long enough --> $DIR/destructor-restrictions.rs:8:10 | +LL | let a = Box::new(RefCell::new(4)); + | - binding `a` declared here LL | *a.borrow() + 1 | ^^^^^^^^^^ | | diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs index 4559da91e..f20024e75 100644 --- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs +++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs @@ -3,16 +3,10 @@ pub struct A {} impl A { - async fn create(path: impl AsRef) { //~ ERROR `async fn` is not permitted in Rust 2015 - //~^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] + async fn create(path: impl AsRef) { ; - crate(move || {} ).await //~ ERROR expected function, found module `crate` + crate(move || {} ).await } } -trait C{async fn new(val: T) {} //~ ERROR `async fn` is not permitted in Rust 2015 -//~^ ERROR functions in traits cannot be declared `async` -//~| ERROR cannot find type `T` in this scope -//~| WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] - -//~ ERROR this file contains an unclosed delimiter +trait C{async fn new(val: T) {} //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr index df1cafdb7..1ec8ca427 100644 --- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr +++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr @@ -1,95 +1,8 @@ error: this file contains an unclosed delimiter - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53 + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:12:85 | LL | trait C{async fn new(val: T) {} - | - unclosed delimiter -... -LL | - | ^ + | - unclosed delimiter ^ -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:5 - | -LL | async fn create(path: impl AsRef) { - | ^^^^^ 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/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 - | -LL | trait C{async fn new(val: T) {} - | ^^^^^ 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[E0412]: cannot find type `T` in this scope - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:27 - | -LL | pub struct A {} - | ------------ similarly named struct `A` defined here -... -LL | trait C{async fn new(val: T) {} - | ^ help: a struct with a similar name exists: `A` - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 - | -LL | trait C{async fn new(val: T) {} - | -----^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0423]: expected function, found module `crate` - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5 - | -LL | crate(move || {} ).await - | ^^^^^ not a function - -warning: changes to closure capture in Rust 2021 will affect drop order - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57 - | -LL | async fn create(path: impl AsRef) { - | _____________________----_____________________________-__^ - | | | | - | | | in Rust 2018, `path` is dropped here along with the closure, but in Rust 2021 `path` is not part of the closure - | | in Rust 2018, this causes the closure to capture `path`, but in Rust 2021, it has no effect -LL | | -LL | | ; -LL | | crate(move || {} ).await -LL | | } - | |_____^ - | - = note: for more information, see - = note: requested on the command line with `-W rust-2021-incompatible-closure-captures` -help: add a dummy let to cause `path` to be fully captured - | -LL | async fn create(path: impl AsRef) { let _ = &path; - | ++++++++++++++ - -warning: changes to closure capture in Rust 2021 will affect drop order - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30 - | -LL | trait C{async fn new(val: T) {} - | --- - ^^ - | | | - | | in Rust 2018, `val` is dropped here along with the closure, but in Rust 2021 `val` is not part of the closure - | in Rust 2018, this causes the closure to capture `val`, but in Rust 2021, it has no effect - | - = note: for more information, see -help: add a dummy let to cause `val` to be fully captured - | -LL | trait C{async fn new(val: T) { let _ = &val;} - | +++++++++++++ - -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to previous error -Some errors have detailed explanations: E0412, E0423, E0670, E0706. -For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/span/dropck-object-cycle.stderr b/tests/ui/span/dropck-object-cycle.stderr index 229d17e1c..097fb6219 100644 --- a/tests/ui/span/dropck-object-cycle.stderr +++ b/tests/ui/span/dropck-object-cycle.stderr @@ -1,6 +1,8 @@ error[E0597]: `*m` does not live long enough --> $DIR/dropck-object-cycle.rs:27:31 | +LL | let m : Box = make_val(); + | - binding `m` declared here LL | assert_eq!(object_invoke1(&*m), (4,5)); | ^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/dropck_arr_cycle_checked.stderr b/tests/ui/span/dropck_arr_cycle_checked.stderr index 068c779ae..23ebc8d59 100644 --- a/tests/ui/span/dropck_arr_cycle_checked.stderr +++ b/tests/ui/span/dropck_arr_cycle_checked.stderr @@ -1,6 +1,9 @@ error[E0597]: `b2` does not live long enough --> $DIR/dropck_arr_cycle_checked.rs:93:24 | +LL | let (b1, b2, b3); + | -- binding `b2` declared here +... LL | b1.a[0].v.set(Some(&b2)); | ^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `b3` does not live long enough --> $DIR/dropck_arr_cycle_checked.rs:95:24 | +LL | let (b1, b2, b3); + | -- binding `b3` declared here +... LL | b1.a[1].v.set(Some(&b3)); | ^^^ borrowed value does not live long enough ... @@ -29,6 +35,9 @@ LL | } error[E0597]: `b1` does not live long enough --> $DIR/dropck_arr_cycle_checked.rs:99:24 | +LL | let (b1, b2, b3); + | -- binding `b1` declared here +... LL | b3.a[0].v.set(Some(&b1)); | ^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/dropck_direct_cycle_with_drop.stderr b/tests/ui/span/dropck_direct_cycle_with_drop.stderr index 07ae138ac..1e75e3b2f 100644 --- a/tests/ui/span/dropck_direct_cycle_with_drop.stderr +++ b/tests/ui/span/dropck_direct_cycle_with_drop.stderr @@ -1,6 +1,8 @@ error[E0597]: `d2` does not live long enough --> $DIR/dropck_direct_cycle_with_drop.rs:36:19 | +LL | let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2"))); + | -- binding `d2` declared here LL | d1.p.set(Some(&d2)); | ^^^ borrowed value does not live long enough ... @@ -15,6 +17,9 @@ LL | } error[E0597]: `d1` does not live long enough --> $DIR/dropck_direct_cycle_with_drop.rs:38:19 | +LL | let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2"))); + | -- binding `d1` declared here +... LL | d2.p.set(Some(&d1)); | ^^^ borrowed value does not live long enough LL | diff --git a/tests/ui/span/dropck_misc_variants.stderr b/tests/ui/span/dropck_misc_variants.stderr index 76e90574c..24a2c9089 100644 --- a/tests/ui/span/dropck_misc_variants.stderr +++ b/tests/ui/span/dropck_misc_variants.stderr @@ -1,6 +1,9 @@ error[E0597]: `bomb` does not live long enough --> $DIR/dropck_misc_variants.rs:23:36 | +LL | let (_w, bomb); + | ---- binding `bomb` declared here +LL | bomb = vec![""]; LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); | ^^^^^ borrowed value does not live long enough LL | } @@ -14,6 +17,9 @@ LL | } error[E0597]: `v` does not live long enough --> $DIR/dropck_misc_variants.rs:31:27 | +LL | let (_w,v); + | - binding `v` declared here +... LL | let u = NoisyDrop(&v); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/dropck_vec_cycle_checked.stderr b/tests/ui/span/dropck_vec_cycle_checked.stderr index 7ff991c0c..5817439c0 100644 --- a/tests/ui/span/dropck_vec_cycle_checked.stderr +++ b/tests/ui/span/dropck_vec_cycle_checked.stderr @@ -1,6 +1,9 @@ error[E0597]: `c2` does not live long enough --> $DIR/dropck_vec_cycle_checked.rs:98:24 | +LL | let (mut c1, mut c2, mut c3); + | ------ binding `c2` declared here +... LL | c1.v[0].v.set(Some(&c2)); | ^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `c3` does not live long enough --> $DIR/dropck_vec_cycle_checked.rs:100:24 | +LL | let (mut c1, mut c2, mut c3); + | ------ binding `c3` declared here +... LL | c1.v[1].v.set(Some(&c3)); | ^^^ borrowed value does not live long enough ... @@ -29,6 +35,9 @@ LL | } error[E0597]: `c1` does not live long enough --> $DIR/dropck_vec_cycle_checked.rs:104:24 | +LL | let (mut c1, mut c2, mut c3); + | ------ binding `c1` declared here +... LL | c3.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue-107353.rs b/tests/ui/span/issue-107353.rs new file mode 100644 index 000000000..943f7f0eb --- /dev/null +++ b/tests/ui/span/issue-107353.rs @@ -0,0 +1,9 @@ +// ignore-tidy-linelength +// Verify that span interning correctly handles having a span of exactly MAX_LEN length. +// compile-flags: --crate-type=lib +// check-pass + +#![allow(dead_code)] +fn a<'a, T>() -> &'a T { +todo!()//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} diff --git a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr index 3c2022748..e1a377203 100644 --- a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr +++ b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr @@ -1,6 +1,8 @@ error[E0597]: `y` does not live long enough --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5 | +LL | let y = x; + | - binding `y` declared here LL | y.borrow().clone() | ^^^^^^^^^^ | | @@ -22,6 +24,8 @@ LL | let x = y.borrow().clone(); x error[E0597]: `y` does not live long enough --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9 | +LL | let y = x; + | - binding `y` declared here LL | y.borrow().clone() | ^^^^^^^^^^ | | diff --git a/tests/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr b/tests/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr index 809e60a8c..c3b6d7580 100644 --- a/tests/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr +++ b/tests/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr @@ -1,6 +1,9 @@ error[E0597]: `d1` does not live long enough --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18 | +LL | let (_d, d1); + | -- binding `d1` declared here +... LL | _d = D_Child(&d1); | ^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue-24805-dropck-trait-has-items.stderr b/tests/ui/span/issue-24805-dropck-trait-has-items.stderr index 2e2170669..e52c57d9a 100644 --- a/tests/ui/span/issue-24805-dropck-trait-has-items.stderr +++ b/tests/ui/span/issue-24805-dropck-trait-has-items.stderr @@ -1,6 +1,9 @@ error[E0597]: `d1` does not live long enough --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26 | +LL | let (_d, d1); + | -- binding `d1` declared here +LL | d1 = D_HasSelfMethod(1); LL | _d = D_HasSelfMethod(&d1); | ^^^ borrowed value does not live long enough LL | } @@ -14,6 +17,9 @@ LL | } error[E0597]: `d1` does not live long enough --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33 | +LL | let (_d, d1); + | -- binding `d1` declared here +LL | d1 = D_HasMethodWithSelfArg(1); LL | _d = D_HasMethodWithSelfArg(&d1); | ^^^ borrowed value does not live long enough LL | } @@ -27,6 +33,9 @@ LL | } error[E0597]: `d1` does not live long enough --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20 | +LL | let (_d, d1); + | -- binding `d1` declared here +LL | d1 = D_HasType(1); LL | _d = D_HasType(&d1); | ^^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/issue-24895-copy-clone-dropck.stderr b/tests/ui/span/issue-24895-copy-clone-dropck.stderr index 18a3dc9e6..83db4d509 100644 --- a/tests/ui/span/issue-24895-copy-clone-dropck.stderr +++ b/tests/ui/span/issue-24895-copy-clone-dropck.stderr @@ -1,6 +1,9 @@ error[E0597]: `d1` does not live long enough --> $DIR/issue-24895-copy-clone-dropck.rs:27:14 | +LL | let (d2, d1); + | -- binding `d1` declared here +LL | d1 = D(34, "d1"); LL | d2 = D(S(&d1, "inner"), "d2"); | ^^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/issue-25199.stderr b/tests/ui/span/issue-25199.stderr index d70a4afc1..1e0276f0c 100644 --- a/tests/ui/span/issue-25199.stderr +++ b/tests/ui/span/issue-25199.stderr @@ -1,6 +1,8 @@ error[E0597]: `container` does not live long enough --> $DIR/issue-25199.rs:70:27 | +LL | let container = Container::new(); + | --------- binding `container` declared here LL | let test = Test{test: &container}; | ^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue-26656.stderr b/tests/ui/span/issue-26656.stderr index 1e939c484..fea6e0012 100644 --- a/tests/ui/span/issue-26656.stderr +++ b/tests/ui/span/issue-26656.stderr @@ -1,6 +1,9 @@ error[E0597]: `ticking` does not live long enough --> $DIR/issue-26656.rs:40:35 | +LL | let (mut zook, ticking); + | ------- binding `ticking` declared here +... LL | zook.button = B::BigRedButton(&ticking); | ^^^^^^^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/issue-29106.stderr b/tests/ui/span/issue-29106.stderr index 71fbd60ee..28ee7acd9 100644 --- a/tests/ui/span/issue-29106.stderr +++ b/tests/ui/span/issue-29106.stderr @@ -1,6 +1,9 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-29106.rs:16:26 | +LL | let (y, x); + | - binding `x` declared here +LL | x = "alive".to_string(); LL | y = Arc::new(Foo(&x)); | ^^ borrowed value does not live long enough LL | } @@ -14,6 +17,9 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/issue-29106.rs:23:25 | +LL | let (y, x); + | - binding `x` declared here +LL | x = "alive".to_string(); LL | y = Rc::new(Foo(&x)); | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/issue-33884.stderr b/tests/ui/span/issue-33884.stderr index aee153085..8cece07cd 100644 --- a/tests/ui/span/issue-33884.stderr +++ b/tests/ui/span/issue-33884.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-33884.rs:6:22 | LL | stream.write_fmt(format!("message received")) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Arguments`, found struct `String` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Arguments<'_>`, found `String` | = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/span/issue-34264.stderr b/tests/ui/span/issue-34264.stderr index 15179954a..f0dea66f6 100644 --- a/tests/ui/span/issue-34264.stderr +++ b/tests/ui/span/issue-34264.stderr @@ -54,17 +54,16 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:7:5 | LL | foo(Some(42), 2, ""); - | ^^^ -- argument of type `&'static str` unexpected + | ^^^ ---- + | | | + | | unexpected argument of type `&'static str` + | help: remove the extra argument | note: function defined here --> $DIR/issue-34264.rs:1:4 | LL | fn foo(Option, String) {} | ^^^ ----------- ------ -help: remove the extra argument - | -LL | foo(Some(42), 2); - | ~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-34264.rs:8:13 @@ -84,17 +83,16 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:10:5 | LL | bar(1, 2, 3); - | ^^^ - argument of type `{integer}` unexpected + | ^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: function defined here --> $DIR/issue-34264.rs:3:4 | LL | fn bar(x, y: usize) {} | ^^^ - -------- -help: remove the extra argument - | -LL | bar(1, 2); - | ~~~~~~ error: aborting due to 6 previous errors diff --git a/tests/ui/span/issue-36537.stderr b/tests/ui/span/issue-36537.stderr index 79a0ebaeb..6c330c1a0 100644 --- a/tests/ui/span/issue-36537.stderr +++ b/tests/ui/span/issue-36537.stderr @@ -1,6 +1,8 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-36537.rs:5:13 | +LL | let a = 42; + | - binding `a` declared here LL | p = &a; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue-37767.stderr b/tests/ui/span/issue-37767.stderr index f7732847a..b612fdf16 100644 --- a/tests/ui/span/issue-37767.stderr +++ b/tests/ui/span/issue-37767.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in the trait `B` | LL | fn foo(&mut self) {} | ^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | A::foo(&a) | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | B::foo(&a) | ~~~~~~~~~~ @@ -39,11 +39,11 @@ note: candidate #2 is defined in the trait `D` | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | C::foo(&a) | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | D::foo(&a) | ~~~~~~~~~~ @@ -64,11 +64,11 @@ note: candidate #2 is defined in the trait `F` | LL | fn foo(self) {} | ^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | E::foo(a) | ~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | F::foo(a) | ~~~~~~~~~ diff --git a/tests/ui/span/issue-39018.stderr b/tests/ui/span/issue-39018.stderr index 5d4d692b2..771f21c45 100644 --- a/tests/ui/span/issue-39018.stderr +++ b/tests/ui/span/issue-39018.stderr @@ -80,7 +80,7 @@ error[E0308]: mismatched types LL | let _ = a + b; | ^ | | - | expected `&str`, found struct `String` + | expected `&str`, found `String` | help: consider borrowing here: `&b` error[E0369]: cannot add `String` to `&String` diff --git a/tests/ui/span/issue-40157.stderr b/tests/ui/span/issue-40157.stderr index 57f80214a..a0afd33f7 100644 --- a/tests/ui/span/issue-40157.stderr +++ b/tests/ui/span/issue-40157.stderr @@ -2,11 +2,10 @@ error[E0597]: `foo` does not live long enough --> $DIR/issue-40157.rs:2:53 | LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} - | ------------------------^^^^^^^^^^-- - | | | | - | | | `foo` dropped here while still borrowed - | | borrowed value does not live long enough - | borrow later used here + | --- ^^^^^^^^^^ - `foo` dropped here while still borrowed + | | | + | | borrowed value does not live long enough + | binding `foo` declared here error: aborting due to previous error diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr b/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr index 2b1789908..e01e1edab 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr +++ b/tests/ui/span/issue-42234-unknown-receiver-type.full.stderr @@ -15,7 +15,7 @@ error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 | LL | .sum::<_>() - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | help: consider specifying the generic argument | diff --git a/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr b/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr index d93d54e87..a4b652565 100644 --- a/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr +++ b/tests/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr @@ -15,7 +15,7 @@ error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 | LL | .sum::<_>() - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | help: consider specifying the generic argument | diff --git a/tests/ui/span/issue28498-reject-lifetime-param.stderr b/tests/ui/span/issue28498-reject-lifetime-param.stderr index 3119ddd03..94c450c7b 100644 --- a/tests/ui/span/issue28498-reject-lifetime-param.stderr +++ b/tests/ui/span/issue28498-reject-lifetime-param.stderr @@ -1,6 +1,9 @@ error[E0597]: `first_dropped` does not live long enough --> $DIR/issue28498-reject-lifetime-param.rs:32:19 | +LL | let (foo1, first_dropped); + | ------------- binding `first_dropped` declared here +... LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue28498-reject-passed-to-fn.stderr b/tests/ui/span/issue28498-reject-passed-to-fn.stderr index 60e8a648c..e133f75d5 100644 --- a/tests/ui/span/issue28498-reject-passed-to-fn.stderr +++ b/tests/ui/span/issue28498-reject-passed-to-fn.stderr @@ -1,6 +1,9 @@ error[E0597]: `first_dropped` does not live long enough --> $DIR/issue28498-reject-passed-to-fn.rs:34:19 | +LL | let (foo1, first_dropped); + | ------------- binding `first_dropped` declared here +... LL | foo1 = Foo(1, &first_dropped, Box::new(callback)); | ^^^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/issue28498-reject-trait-bound.stderr b/tests/ui/span/issue28498-reject-trait-bound.stderr index 22e4a8205..9ab3cdd13 100644 --- a/tests/ui/span/issue28498-reject-trait-bound.stderr +++ b/tests/ui/span/issue28498-reject-trait-bound.stderr @@ -1,6 +1,9 @@ error[E0597]: `first_dropped` does not live long enough --> $DIR/issue28498-reject-trait-bound.rs:34:19 | +LL | let (foo1, first_dropped); + | ------------- binding `first_dropped` declared here +... LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/missing-unit-argument.stderr b/tests/ui/span/missing-unit-argument.stderr index ef4d732b5..ff89f7753 100644 --- a/tests/ui/span/missing-unit-argument.stderr +++ b/tests/ui/span/missing-unit-argument.stderr @@ -65,7 +65,7 @@ error[E0061]: this method takes 1 argument but 0 arguments were supplied LL | S.baz(); | ^^^-- an argument of type `()` is missing | -note: associated function defined here +note: method defined here --> $DIR/missing-unit-argument.rs:6:8 | LL | fn baz(self, (): ()) { } @@ -81,7 +81,7 @@ error[E0061]: this method takes 1 argument but 0 arguments were supplied LL | S.generic::<()>(); | ^^^^^^^^^^^^^-- an argument of type `()` is missing | -note: associated function defined here +note: method defined here --> $DIR/missing-unit-argument.rs:7:8 | LL | fn generic(self, _: T) { } diff --git a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr index 4d976a7bb..be56f9489 100644 --- a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr +++ b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr @@ -1,6 +1,8 @@ error[E0597]: `b` does not live long enough --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15 | +LL | let b = m.borrow(); + | - binding `b` declared here LL | p = &*b; | ^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/range-2.stderr b/tests/ui/span/range-2.stderr index 8ca8156b0..d7084b00b 100644 --- a/tests/ui/span/range-2.stderr +++ b/tests/ui/span/range-2.stderr @@ -3,7 +3,9 @@ error[E0597]: `a` does not live long enough | LL | let r = { | - borrow later stored here -... +LL | let a = 42; + | - binding `a` declared here +LL | let b = 42; LL | &a..&b | ^^ borrowed value does not live long enough LL | }; @@ -14,7 +16,9 @@ error[E0597]: `b` does not live long enough | LL | let r = { | - borrow later stored here -... +LL | let a = 42; +LL | let b = 42; + | - binding `b` declared here LL | &a..&b | ^^ borrowed value does not live long enough LL | }; diff --git a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr index 0b985de60..fb3fad6ae 100644 --- a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr +++ b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr @@ -1,6 +1,8 @@ error[E0597]: `c` does not live long enough --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21 | +LL | let c = 1; + | - binding `c` declared here LL | let c_ref = &c; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/regions-close-over-type-parameter-2.stderr b/tests/ui/span/regions-close-over-type-parameter-2.stderr index 2e584d9a8..fed40a4fd 100644 --- a/tests/ui/span/regions-close-over-type-parameter-2.stderr +++ b/tests/ui/span/regions-close-over-type-parameter-2.stderr @@ -1,6 +1,8 @@ error[E0597]: `tmp0` does not live long enough --> $DIR/regions-close-over-type-parameter-2.rs:23:20 | +LL | let tmp0 = 3; + | ---- binding `tmp0` declared here LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough LL | repeater3(tmp1) diff --git a/tests/ui/span/regions-escape-loop-via-variable.stderr b/tests/ui/span/regions-escape-loop-via-variable.stderr index 42df66852..e5c7d8b26 100644 --- a/tests/ui/span/regions-escape-loop-via-variable.stderr +++ b/tests/ui/span/regions-escape-loop-via-variable.stderr @@ -2,7 +2,9 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-escape-loop-via-variable.rs:11:13 | LL | let x = 1 + *p; - | -- borrow later used here + | - -- borrow later used here + | | + | binding `x` declared here LL | p = &x; | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/regions-escape-loop-via-vec.stderr b/tests/ui/span/regions-escape-loop-via-vec.stderr index 2b6493077..532ac3606 100644 --- a/tests/ui/span/regions-escape-loop-via-vec.stderr +++ b/tests/ui/span/regions-escape-loop-via-vec.stderr @@ -2,7 +2,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/regions-escape-loop-via-vec.rs:5:11 | LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | while x < 10 { | ^ use of borrowed `x` LL | let mut z = x; @@ -13,7 +13,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/regions-escape-loop-via-vec.rs:6:21 | LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here LL | while x < 10 { LL | let mut z = x; | ^ use of borrowed `x` @@ -23,11 +23,10 @@ LL | _y.push(&mut z); error[E0597]: `z` does not live long enough --> $DIR/regions-escape-loop-via-vec.rs:7:17 | +LL | let mut z = x; + | ----- binding `z` declared here LL | _y.push(&mut z); - | --------^^^^^^- - | | | - | | borrowed value does not live long enough - | borrow later used here + | ^^^^^^ borrowed value does not live long enough ... LL | } | - `z` dropped here while still borrowed @@ -36,7 +35,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/regions-escape-loop-via-vec.rs:9:9 | LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here + | ------ `x` is borrowed here ... LL | _y.push(&mut z); | --------------- borrow later used here diff --git a/tests/ui/span/regions-infer-borrow-scope-within-loop.stderr b/tests/ui/span/regions-infer-borrow-scope-within-loop.stderr index fd67c65c4..47931db84 100644 --- a/tests/ui/span/regions-infer-borrow-scope-within-loop.stderr +++ b/tests/ui/span/regions-infer-borrow-scope-within-loop.stderr @@ -1,6 +1,9 @@ error[E0597]: `*x` does not live long enough --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:20 | +LL | let x = make_box(); + | - binding `x` declared here +... LL | y = borrow(&*x); | ^^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/send-is-not-static-ensures-scoping.stderr b/tests/ui/span/send-is-not-static-ensures-scoping.stderr index 65d10c130..bae0befca 100644 --- a/tests/ui/span/send-is-not-static-ensures-scoping.stderr +++ b/tests/ui/span/send-is-not-static-ensures-scoping.stderr @@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough LL | let bad = { | --- borrow later stored here LL | let x = 1; + | - binding `x` declared here LL | let y = &x; | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/send-is-not-static-std-sync-2.stderr b/tests/ui/span/send-is-not-static-std-sync-2.stderr index bcd07e116..b0267fa6f 100644 --- a/tests/ui/span/send-is-not-static-std-sync-2.stderr +++ b/tests/ui/span/send-is-not-static-std-sync-2.stderr @@ -4,6 +4,7 @@ error[E0597]: `x` does not live long enough LL | let lock = { | ---- borrow later stored here LL | let x = 1; + | - binding `x` declared here LL | Mutex::new(&x) | ^^ borrowed value does not live long enough LL | }; @@ -15,6 +16,7 @@ error[E0597]: `x` does not live long enough LL | let lock = { | ---- borrow later stored here LL | let x = 1; + | - binding `x` declared here LL | RwLock::new(&x) | ^^ borrowed value does not live long enough LL | }; @@ -25,7 +27,9 @@ error[E0597]: `x` does not live long enough | LL | let (_tx, rx) = { | --- borrow later used here -... +LL | let x = 1; + | - binding `x` declared here +LL | let (tx, rx) = mpsc::channel(); LL | let _ = tx.send(&x); | ^^ borrowed value does not live long enough LL | (tx, rx) diff --git a/tests/ui/span/send-is-not-static-std-sync.stderr b/tests/ui/span/send-is-not-static-std-sync.stderr index 5d493a3e4..7dfe94bca 100644 --- a/tests/ui/span/send-is-not-static-std-sync.stderr +++ b/tests/ui/span/send-is-not-static-std-sync.stderr @@ -1,6 +1,9 @@ error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/send-is-not-static-std-sync.rs:13:10 | +LL | let y = Box::new(1); + | - binding `y` declared here +LL | let lock = Mutex::new(&x); LL | *lock.lock().unwrap() = &*y; | --- borrow of `*y` occurs here LL | drop(y); @@ -12,6 +15,8 @@ LL | *lock.lock().unwrap() = &z; error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:16:33 | +LL | let z = 2; + | - binding `z` declared here LL | *lock.lock().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } @@ -23,6 +28,9 @@ LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/send-is-not-static-std-sync.rs:27:10 | +LL | let y = Box::new(1); + | - binding `y` declared here +LL | let lock = RwLock::new(&x); LL | *lock.write().unwrap() = &*y; | --- borrow of `*y` occurs here LL | drop(y); @@ -34,6 +42,8 @@ LL | *lock.write().unwrap() = &z; error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:30:34 | +LL | let z = 2; + | - binding `z` declared here LL | *lock.write().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } @@ -45,6 +55,9 @@ LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/send-is-not-static-std-sync.rs:43:10 | +LL | let y = Box::new(1); + | - binding `y` declared here +... LL | tx.send(&*y); | --- borrow of `*y` occurs here LL | drop(y); @@ -56,6 +69,8 @@ LL | tx.send(&z).unwrap(); error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:46:17 | +LL | let z = 2; + | - binding `z` declared here LL | tx.send(&z).unwrap(); | ^^ borrowed value does not live long enough LL | } diff --git a/tests/ui/span/type-annotations-needed-expr.stderr b/tests/ui/span/type-annotations-needed-expr.stderr index 9dff6c64d..65a90318a 100644 --- a/tests/ui/span/type-annotations-needed-expr.stderr +++ b/tests/ui/span/type-annotations-needed-expr.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/type-annotations-needed-expr.rs:2:39 | LL | let _ = (vec![1,2,3]).into_iter().sum() as f64; - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | help: consider specifying the generic argument | diff --git a/tests/ui/span/vec-must-not-hide-type-from-dropck.stderr b/tests/ui/span/vec-must-not-hide-type-from-dropck.stderr index f87c32d1a..f2fefca41 100644 --- a/tests/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ b/tests/ui/span/vec-must-not-hide-type-from-dropck.stderr @@ -1,6 +1,9 @@ error[E0597]: `c2` does not live long enough --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24 | +LL | let (mut c1, mut c2); + | ------ binding `c2` declared here +... LL | c1.v[0].v.set(Some(&c2)); | ^^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `c1` does not live long enough --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24 | +LL | let (mut c1, mut c2); + | ------ binding `c1` declared here +... LL | c2.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough LL | diff --git a/tests/ui/span/vec_refs_data_with_early_death.stderr b/tests/ui/span/vec_refs_data_with_early_death.stderr index 684e78453..73f27144a 100644 --- a/tests/ui/span/vec_refs_data_with_early_death.stderr +++ b/tests/ui/span/vec_refs_data_with_early_death.stderr @@ -1,6 +1,9 @@ error[E0597]: `x` does not live long enough --> $DIR/vec_refs_data_with_early_death.rs:17:12 | +LL | let x: i8 = 3; + | - binding `x` declared here +... LL | v.push(&x); | ^^ borrowed value does not live long enough ... @@ -15,6 +18,9 @@ LL | } error[E0597]: `y` does not live long enough --> $DIR/vec_refs_data_with_early_death.rs:19:12 | +LL | let y: i8 = 4; + | - binding `y` declared here +... LL | v.push(&y); | ^^ borrowed value does not live long enough ... diff --git a/tests/ui/span/wf-method-late-bound-regions.stderr b/tests/ui/span/wf-method-late-bound-regions.stderr index 6b0b00820..64c2d0f16 100644 --- a/tests/ui/span/wf-method-late-bound-regions.stderr +++ b/tests/ui/span/wf-method-late-bound-regions.stderr @@ -4,6 +4,7 @@ error[E0597]: `pointer` does not live long enough LL | let dangling = { | -------- borrow later stored here LL | let pointer = Box::new(42); + | ------- binding `pointer` declared here LL | f2.xmute(&pointer) | ^^^^^^^^ borrowed value does not live long enough LL | }; diff --git a/tests/ui/specialization/defaultimpl/specialization-no-default.stderr b/tests/ui/specialization/defaultimpl/specialization-no-default.stderr index 770be2af2..f9e62a99b 100644 --- a/tests/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -15,7 +15,7 @@ LL | impl Foo for T { | ----------------- parent `impl` is here ... LL | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | ^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -26,7 +26,7 @@ LL | impl Foo for T { | ----------------- parent `impl` is here ... LL | fn bar(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` + | ^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -37,7 +37,7 @@ LL | impl Bar for T { | ----------------- parent `impl` is here ... LL | type T = (); - | ^^^^^^^^^^^^ cannot specialize default item `T` + | ^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -48,7 +48,7 @@ LL | impl Baz for T { | ------------------------ parent `impl` is here ... LL | fn baz(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` + | ^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -59,7 +59,7 @@ LL | impl Redundant for T { | ------------------------------ parent `impl` is here ... LL | fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` + | ^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/tests/ui/specialization/issue-50452-fail.stderr b/tests/ui/specialization/issue-50452-fail.stderr index 5c136adc4..3fc29fff2 100644 --- a/tests/ui/specialization/issue-50452-fail.stderr +++ b/tests/ui/specialization/issue-50452-fail.stderr @@ -12,7 +12,7 @@ error[E0520]: `foo` specializes an item from a parent `impl`, but that item is n --> $DIR/issue-50452-fail.rs:10:5 | LL | fn foo() {} - | ^^^^^^^^^^^ cannot specialize default item `foo` + | ^^^^^^^^ cannot specialize default item `foo` ... LL | impl Foo for T { | ----------------- parent `impl` is here diff --git a/tests/ui/specialization/non-defaulted-item-fail.stderr b/tests/ui/specialization/non-defaulted-item-fail.stderr index faa14555a..9d62a353d 100644 --- a/tests/ui/specialization/non-defaulted-item-fail.stderr +++ b/tests/ui/specialization/non-defaulted-item-fail.stderr @@ -15,7 +15,7 @@ LL | impl Foo for Box { | ---------------------- parent `impl` is here ... LL | type Ty = Vec<()>; - | ^^^^^^^^^^^^^^^^^^ cannot specialize default item `Ty` + | ^^^^^^^ cannot specialize default item `Ty` | = note: to specialize, `Ty` in the parent `impl` must be marked `default` @@ -26,7 +26,7 @@ LL | impl Foo for Box { | ---------------------- parent `impl` is here ... LL | const CONST: u8 = 42; - | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `CONST` + | ^^^^^^^^^^^^^^^ cannot specialize default item `CONST` | = note: to specialize, `CONST` in the parent `impl` must be marked `default` @@ -37,7 +37,7 @@ LL | impl Foo for Box { | ---------------------- parent `impl` is here ... LL | fn foo(&self) -> bool { true } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -48,7 +48,7 @@ LL | impl Foo for Vec {} | ---------------------- parent `impl` is here ... LL | type Ty = Vec<()>; - | ^^^^^^^^^^^^^^^^^^ cannot specialize default item `Ty` + | ^^^^^^^ cannot specialize default item `Ty` | = note: to specialize, `Ty` in the parent `impl` must be marked `default` @@ -59,7 +59,7 @@ LL | impl Foo for Vec {} | ---------------------- parent `impl` is here ... LL | const CONST: u8 = 42; - | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `CONST` + | ^^^^^^^^^^^^^^^ cannot specialize default item `CONST` | = note: to specialize, `CONST` in the parent `impl` must be marked `default` @@ -70,7 +70,7 @@ LL | impl Foo for Vec {} | ---------------------- parent `impl` is here ... LL | fn foo(&self) -> bool { true } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | ^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` diff --git a/tests/ui/specialization/specialization-default-types.stderr b/tests/ui/specialization/specialization-default-types.stderr index 61a556a93..ecccf29a1 100644 --- a/tests/ui/specialization/specialization-default-types.stderr +++ b/tests/ui/specialization/specialization-default-types.stderr @@ -16,7 +16,7 @@ LL | default type Output = Box; LL | default fn generate(self) -> Self::Output { | ------------ expected `::Output` because of return type LL | Box::new(self) - | ^^^^^^^^^^^^^^ expected associated type, found struct `Box` + | ^^^^^^^^^^^^^^ expected associated type, found `Box` | = note: expected associated type `::Output` found struct `Box` @@ -27,7 +27,7 @@ error[E0308]: mismatched types LL | fn trouble(t: T) -> Box { | ------ expected `Box` because of return type LL | Example::generate(t) - | ^^^^^^^^^^^^^^^^^^^^ expected struct `Box`, found associated type + | ^^^^^^^^^^^^^^^^^^^^ expected `Box`, found associated type | = note: expected struct `Box` found associated type `::Output` diff --git a/tests/ui/specialization/specialization-no-default.stderr b/tests/ui/specialization/specialization-no-default.stderr index 842cec9c7..695a3f6cc 100644 --- a/tests/ui/specialization/specialization-no-default.stderr +++ b/tests/ui/specialization/specialization-no-default.stderr @@ -15,7 +15,7 @@ LL | impl Foo for T { | ----------------- parent `impl` is here ... LL | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | ^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -26,7 +26,7 @@ LL | impl Foo for T { | ----------------- parent `impl` is here ... LL | fn bar(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` + | ^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -37,7 +37,7 @@ LL | impl Bar for T { | ----------------- parent `impl` is here ... LL | type T = (); - | ^^^^^^^^^^^^ cannot specialize default item `T` + | ^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -48,7 +48,7 @@ LL | impl Baz for T { | ------------------------ parent `impl` is here ... LL | fn baz(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` + | ^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -59,7 +59,7 @@ LL | impl Redundant for T { | ------------------------------ parent `impl` is here ... LL | default fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/tests/ui/stability-attribute/unresolved_stability_lint.rs b/tests/ui/stability-attribute/unresolved_stability_lint.rs new file mode 100644 index 000000000..818d228bc --- /dev/null +++ b/tests/ui/stability-attribute/unresolved_stability_lint.rs @@ -0,0 +1,8 @@ +#![feature(staged_api)] +#![stable(feature = "uwu", since = "1.0.0")] + +#[unstable(feature = "foo", issue = "none")] +impl Foo for () {} +//~^ ERROR cannot find trait `Foo` in this scope + +fn main() {} diff --git a/tests/ui/stability-attribute/unresolved_stability_lint.stderr b/tests/ui/stability-attribute/unresolved_stability_lint.stderr new file mode 100644 index 000000000..11d6abcaf --- /dev/null +++ b/tests/ui/stability-attribute/unresolved_stability_lint.stderr @@ -0,0 +1,9 @@ +error[E0405]: cannot find trait `Foo` in this scope + --> $DIR/unresolved_stability_lint.rs:5:6 + | +LL | impl Foo for () {} + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/static/bad-const-type.rs b/tests/ui/static/bad-const-type.rs index 934ee353d..24fd67ecb 100644 --- a/tests/ui/static/bad-const-type.rs +++ b/tests/ui/static/bad-const-type.rs @@ -1,4 +1,4 @@ static i: String = 10; //~^ ERROR mismatched types -//~| expected struct `String`, found integer +//~| expected `String`, found integer fn main() { println!("{}", i); } diff --git a/tests/ui/static/bad-const-type.stderr b/tests/ui/static/bad-const-type.stderr index dcc1ee07c..2e930f459 100644 --- a/tests/ui/static/bad-const-type.stderr +++ b/tests/ui/static/bad-const-type.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | static i: String = 10; | ^^- help: try using a conversion method: `.to_string()` | | - | expected struct `String`, found integer + | expected `String`, found integer error: aborting due to previous error diff --git a/tests/ui/static/issue-5216.stderr b/tests/ui/static/issue-5216.stderr index 1afff28f0..99c8b1aa1 100644 --- a/tests/ui/static/issue-5216.stderr +++ b/tests/ui/static/issue-5216.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:3:21 | LL | pub static C: S = S(f); - | - ^ expected struct `Box`, found fn item + | - ^ expected `Box`, found fn item | | | arguments to this struct are incorrect | @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:8:19 | LL | pub static D: T = g; - | ^ expected struct `Box`, found fn item + | ^ expected `Box`, found fn item | = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>` found fn item `fn() {g}` diff --git a/tests/ui/static/static-lifetime-bound.rs b/tests/ui/static/static-lifetime-bound.rs index b5da91ec3..847fe87b2 100644 --- a/tests/ui/static/static-lifetime-bound.rs +++ b/tests/ui/static/static-lifetime-bound.rs @@ -1,4 +1,4 @@ -fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +fn f<'a: 'static>(_: &'a i32) {} fn main() { let x = 0; diff --git a/tests/ui/static/static-lifetime-bound.stderr b/tests/ui/static/static-lifetime-bound.stderr index ef07a8931..19e55a658 100644 --- a/tests/ui/static/static-lifetime-bound.stderr +++ b/tests/ui/static/static-lifetime-bound.stderr @@ -1,14 +1,8 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:1:6 - | -LL | fn f<'a: 'static>(_: &'a i32) {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | +LL | let x = 0; + | - binding `x` declared here LL | f(&x); | --^^- | | | @@ -17,6 +11,6 @@ LL | f(&x); LL | } | - `x` dropped here while still borrowed -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr index 67b478bdb..b68352b51 100644 --- a/tests/ui/static/static-reference-to-fn-1.stderr +++ b/tests/ui/static/static-reference-to-fn-1.stderr @@ -2,10 +2,16 @@ error[E0308]: mismatched types --> $DIR/static-reference-to-fn-1.rs:17:15 | LL | func: &foo, - | ^^^^ expected fn pointer, found fn item + | ^^^^ expected `&fn() -> Option`, found `&fn() -> Option {foo}` | = note: expected reference `&fn() -> Option` found reference `&fn() -> Option {foo}` + = note: fn items are distinct from fn pointers + = note: when the arguments and return types match, functions can be coerced to function pointers +help: consider casting to a fn pointer + | +LL | func: &(foo as fn() -> Option), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/statics/uninhabited-static.stderr b/tests/ui/statics/uninhabited-static.stderr index ef794bb36..437053a44 100644 --- a/tests/ui/statics/uninhabited-static.stderr +++ b/tests/ui/statics/uninhabited-static.stderr @@ -53,10 +53,7 @@ warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:12:31 | LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/uninhabited-static.rs:4:1 @@ -75,10 +72,7 @@ warning: the type `Void` does not permit zero-initialization --> $DIR/uninhabited-static.rs:16:32 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed | note: enums with no inhabited variants have no valid value --> $DIR/uninhabited-static.rs:4:1 diff --git a/tests/ui/stats/hir-stats.rs b/tests/ui/stats/hir-stats.rs index 0b89d0b16..9bb87026b 100644 --- a/tests/ui/stats/hir-stats.rs +++ b/tests/ui/stats/hir-stats.rs @@ -1,7 +1,11 @@ // check-pass // compile-flags: -Zhir-stats // only-x86_64 -// ignore-stage1 FIXME: remove after next bootstrap bump + +// Type layouts sometimes change. When that happens, until the next bootstrap +// bump occurs, stage1 and stage2 will give different outputs for this test. +// Add an `ignore-stage1` comment marker to work around that problem during +// that time. // The aim here is to include at least one of every different type of top-level // AST/HIR node reported by `-Zhir-stats`. diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr index 7d9ff2dfb..ee62d8f2d 100644 --- a/tests/ui/stats/hir-stats.stderr +++ b/tests/ui/stats/hir-stats.stderr @@ -1,119 +1,119 @@ ast-stats-1 PRE EXPANSION AST STATS ast-stats-1 Name Accumulated Size Count Item Size ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 ExprField 48 ( 0.6%) 1 48 -ast-stats-1 GenericArgs 56 ( 0.8%) 1 56 -ast-stats-1 - AngleBracketed 56 ( 0.8%) 1 -ast-stats-1 Crate 56 ( 0.8%) 1 56 -ast-stats-1 Attribute 64 ( 0.9%) 2 32 -ast-stats-1 - Normal 32 ( 0.4%) 1 -ast-stats-1 - DocComment 32 ( 0.4%) 1 -ast-stats-1 Local 72 ( 1.0%) 1 72 -ast-stats-1 WherePredicate 72 ( 1.0%) 1 72 -ast-stats-1 - BoundPredicate 72 ( 1.0%) 1 -ast-stats-1 Arm 96 ( 1.3%) 2 48 -ast-stats-1 ForeignItem 96 ( 1.3%) 1 96 -ast-stats-1 - Fn 96 ( 1.3%) 1 -ast-stats-1 FieldDef 160 ( 2.2%) 2 80 -ast-stats-1 Stmt 160 ( 2.2%) 5 32 -ast-stats-1 - Local 32 ( 0.4%) 1 -ast-stats-1 - MacCall 32 ( 0.4%) 1 -ast-stats-1 - Expr 96 ( 1.3%) 3 -ast-stats-1 Param 160 ( 2.2%) 4 40 -ast-stats-1 FnDecl 200 ( 2.7%) 5 40 -ast-stats-1 Variant 240 ( 3.2%) 2 120 -ast-stats-1 GenericBound 288 ( 3.9%) 4 72 -ast-stats-1 - Trait 288 ( 3.9%) 4 -ast-stats-1 Block 288 ( 3.9%) 6 48 -ast-stats-1 AssocItem 416 ( 5.6%) 4 104 -ast-stats-1 - Type 208 ( 2.8%) 2 -ast-stats-1 - Fn 208 ( 2.8%) 2 -ast-stats-1 GenericParam 480 ( 6.5%) 5 96 -ast-stats-1 Expr 576 ( 7.8%) 8 72 -ast-stats-1 - Path 72 ( 1.0%) 1 -ast-stats-1 - Match 72 ( 1.0%) 1 -ast-stats-1 - Struct 72 ( 1.0%) 1 -ast-stats-1 - Lit 144 ( 1.9%) 2 -ast-stats-1 - Block 216 ( 2.9%) 3 -ast-stats-1 Pat 616 ( 8.3%) 7 88 -ast-stats-1 - Struct 88 ( 1.2%) 1 -ast-stats-1 - Wild 88 ( 1.2%) 1 -ast-stats-1 - Ident 440 ( 5.9%) 5 -ast-stats-1 PathSegment 720 ( 9.7%) 30 24 -ast-stats-1 Ty 896 (12.1%) 14 64 -ast-stats-1 - Ptr 64 ( 0.9%) 1 -ast-stats-1 - Ref 64 ( 0.9%) 1 -ast-stats-1 - ImplicitSelf 128 ( 1.7%) 2 -ast-stats-1 - Path 640 ( 8.6%) 10 -ast-stats-1 Item 1_656 (22.3%) 9 184 -ast-stats-1 - Trait 184 ( 2.5%) 1 -ast-stats-1 - Enum 184 ( 2.5%) 1 -ast-stats-1 - ForeignMod 184 ( 2.5%) 1 -ast-stats-1 - Impl 184 ( 2.5%) 1 -ast-stats-1 - Fn 368 ( 5.0%) 2 -ast-stats-1 - Use 552 ( 7.4%) 3 +ast-stats-1 GenericArgs 40 ( 0.6%) 1 40 +ast-stats-1 - AngleBracketed 40 ( 0.6%) 1 +ast-stats-1 Crate 40 ( 0.6%) 1 40 +ast-stats-1 ExprField 48 ( 0.7%) 1 48 +ast-stats-1 WherePredicate 56 ( 0.9%) 1 56 +ast-stats-1 - BoundPredicate 56 ( 0.9%) 1 +ast-stats-1 Attribute 64 ( 1.0%) 2 32 +ast-stats-1 - Normal 32 ( 0.5%) 1 +ast-stats-1 - DocComment 32 ( 0.5%) 1 +ast-stats-1 Local 72 ( 1.1%) 1 72 +ast-stats-1 Arm 96 ( 1.5%) 2 48 +ast-stats-1 ForeignItem 96 ( 1.5%) 1 96 +ast-stats-1 - Fn 96 ( 1.5%) 1 +ast-stats-1 FnDecl 120 ( 1.8%) 5 24 +ast-stats-1 FieldDef 160 ( 2.4%) 2 80 +ast-stats-1 Stmt 160 ( 2.4%) 5 32 +ast-stats-1 - Local 32 ( 0.5%) 1 +ast-stats-1 - MacCall 32 ( 0.5%) 1 +ast-stats-1 - Expr 96 ( 1.5%) 3 +ast-stats-1 Param 160 ( 2.4%) 4 40 +ast-stats-1 Block 192 ( 2.9%) 6 32 +ast-stats-1 Variant 208 ( 3.2%) 2 104 +ast-stats-1 GenericBound 224 ( 3.4%) 4 56 +ast-stats-1 - Trait 224 ( 3.4%) 4 +ast-stats-1 AssocItem 416 ( 6.3%) 4 104 +ast-stats-1 - Type 208 ( 3.2%) 2 +ast-stats-1 - Fn 208 ( 3.2%) 2 +ast-stats-1 GenericParam 480 ( 7.3%) 5 96 +ast-stats-1 Pat 504 ( 7.7%) 7 72 +ast-stats-1 - Struct 72 ( 1.1%) 1 +ast-stats-1 - Wild 72 ( 1.1%) 1 +ast-stats-1 - Ident 360 ( 5.5%) 5 +ast-stats-1 Expr 576 ( 8.8%) 8 72 +ast-stats-1 - Path 72 ( 1.1%) 1 +ast-stats-1 - Match 72 ( 1.1%) 1 +ast-stats-1 - Struct 72 ( 1.1%) 1 +ast-stats-1 - Lit 144 ( 2.2%) 2 +ast-stats-1 - Block 216 ( 3.3%) 3 +ast-stats-1 PathSegment 720 (11.0%) 30 24 +ast-stats-1 Ty 896 (13.7%) 14 64 +ast-stats-1 - Ptr 64 ( 1.0%) 1 +ast-stats-1 - Ref 64 ( 1.0%) 1 +ast-stats-1 - ImplicitSelf 128 ( 2.0%) 2 +ast-stats-1 - Path 640 ( 9.8%) 10 +ast-stats-1 Item 1_224 (18.7%) 9 136 +ast-stats-1 - Trait 136 ( 2.1%) 1 +ast-stats-1 - Enum 136 ( 2.1%) 1 +ast-stats-1 - ForeignMod 136 ( 2.1%) 1 +ast-stats-1 - Impl 136 ( 2.1%) 1 +ast-stats-1 - Fn 272 ( 4.2%) 2 +ast-stats-1 - Use 408 ( 6.2%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 7_416 +ast-stats-1 Total 6_552 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 ExprField 48 ( 0.6%) 1 48 -ast-stats-2 GenericArgs 56 ( 0.7%) 1 56 -ast-stats-2 - AngleBracketed 56 ( 0.7%) 1 -ast-stats-2 Crate 56 ( 0.7%) 1 56 -ast-stats-2 Local 72 ( 0.9%) 1 72 -ast-stats-2 WherePredicate 72 ( 0.9%) 1 72 -ast-stats-2 - BoundPredicate 72 ( 0.9%) 1 -ast-stats-2 Arm 96 ( 1.2%) 2 48 -ast-stats-2 ForeignItem 96 ( 1.2%) 1 96 -ast-stats-2 - Fn 96 ( 1.2%) 1 -ast-stats-2 InlineAsm 120 ( 1.5%) 1 120 -ast-stats-2 Attribute 128 ( 1.6%) 4 32 +ast-stats-2 GenericArgs 40 ( 0.6%) 1 40 +ast-stats-2 - AngleBracketed 40 ( 0.6%) 1 +ast-stats-2 Crate 40 ( 0.6%) 1 40 +ast-stats-2 ExprField 48 ( 0.7%) 1 48 +ast-stats-2 WherePredicate 56 ( 0.8%) 1 56 +ast-stats-2 - BoundPredicate 56 ( 0.8%) 1 +ast-stats-2 Local 72 ( 1.0%) 1 72 +ast-stats-2 Arm 96 ( 1.3%) 2 48 +ast-stats-2 ForeignItem 96 ( 1.3%) 1 96 +ast-stats-2 - Fn 96 ( 1.3%) 1 +ast-stats-2 InlineAsm 120 ( 1.7%) 1 120 +ast-stats-2 FnDecl 120 ( 1.7%) 5 24 +ast-stats-2 Attribute 128 ( 1.8%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 -ast-stats-2 - Normal 96 ( 1.2%) 3 -ast-stats-2 FieldDef 160 ( 2.0%) 2 80 -ast-stats-2 Stmt 160 ( 2.0%) 5 32 +ast-stats-2 - Normal 96 ( 1.3%) 3 +ast-stats-2 FieldDef 160 ( 2.2%) 2 80 +ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Local 32 ( 0.4%) 1 ast-stats-2 - Semi 32 ( 0.4%) 1 -ast-stats-2 - Expr 96 ( 1.2%) 3 -ast-stats-2 Param 160 ( 2.0%) 4 40 -ast-stats-2 FnDecl 200 ( 2.5%) 5 40 -ast-stats-2 Variant 240 ( 3.0%) 2 120 -ast-stats-2 GenericBound 288 ( 3.6%) 4 72 -ast-stats-2 - Trait 288 ( 3.6%) 4 -ast-stats-2 Block 288 ( 3.6%) 6 48 -ast-stats-2 AssocItem 416 ( 5.1%) 4 104 -ast-stats-2 - Type 208 ( 2.6%) 2 -ast-stats-2 - Fn 208 ( 2.6%) 2 -ast-stats-2 GenericParam 480 ( 5.9%) 5 96 -ast-stats-2 Pat 616 ( 7.6%) 7 88 -ast-stats-2 - Struct 88 ( 1.1%) 1 -ast-stats-2 - Wild 88 ( 1.1%) 1 -ast-stats-2 - Ident 440 ( 5.4%) 5 -ast-stats-2 Expr 648 ( 8.0%) 9 72 -ast-stats-2 - Path 72 ( 0.9%) 1 -ast-stats-2 - Match 72 ( 0.9%) 1 -ast-stats-2 - Struct 72 ( 0.9%) 1 -ast-stats-2 - InlineAsm 72 ( 0.9%) 1 -ast-stats-2 - Lit 144 ( 1.8%) 2 -ast-stats-2 - Block 216 ( 2.7%) 3 -ast-stats-2 PathSegment 792 ( 9.8%) 33 24 -ast-stats-2 Ty 896 (11.0%) 14 64 -ast-stats-2 - Ptr 64 ( 0.8%) 1 -ast-stats-2 - Ref 64 ( 0.8%) 1 -ast-stats-2 - ImplicitSelf 128 ( 1.6%) 2 -ast-stats-2 - Path 640 ( 7.9%) 10 -ast-stats-2 Item 2_024 (25.0%) 11 184 -ast-stats-2 - Trait 184 ( 2.3%) 1 -ast-stats-2 - Enum 184 ( 2.3%) 1 -ast-stats-2 - ExternCrate 184 ( 2.3%) 1 -ast-stats-2 - ForeignMod 184 ( 2.3%) 1 -ast-stats-2 - Impl 184 ( 2.3%) 1 -ast-stats-2 - Fn 368 ( 4.5%) 2 -ast-stats-2 - Use 736 ( 9.1%) 4 +ast-stats-2 - Expr 96 ( 1.3%) 3 +ast-stats-2 Param 160 ( 2.2%) 4 40 +ast-stats-2 Block 192 ( 2.7%) 6 32 +ast-stats-2 Variant 208 ( 2.9%) 2 104 +ast-stats-2 GenericBound 224 ( 3.1%) 4 56 +ast-stats-2 - Trait 224 ( 3.1%) 4 +ast-stats-2 AssocItem 416 ( 5.8%) 4 104 +ast-stats-2 - Type 208 ( 2.9%) 2 +ast-stats-2 - Fn 208 ( 2.9%) 2 +ast-stats-2 GenericParam 480 ( 6.7%) 5 96 +ast-stats-2 Pat 504 ( 7.0%) 7 72 +ast-stats-2 - Struct 72 ( 1.0%) 1 +ast-stats-2 - Wild 72 ( 1.0%) 1 +ast-stats-2 - Ident 360 ( 5.0%) 5 +ast-stats-2 Expr 648 ( 9.1%) 9 72 +ast-stats-2 - Path 72 ( 1.0%) 1 +ast-stats-2 - Match 72 ( 1.0%) 1 +ast-stats-2 - Struct 72 ( 1.0%) 1 +ast-stats-2 - InlineAsm 72 ( 1.0%) 1 +ast-stats-2 - Lit 144 ( 2.0%) 2 +ast-stats-2 - Block 216 ( 3.0%) 3 +ast-stats-2 PathSegment 792 (11.1%) 33 24 +ast-stats-2 Ty 896 (12.5%) 14 64 +ast-stats-2 - Ptr 64 ( 0.9%) 1 +ast-stats-2 - Ref 64 ( 0.9%) 1 +ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 +ast-stats-2 - Path 640 ( 8.9%) 10 +ast-stats-2 Item 1_496 (20.9%) 11 136 +ast-stats-2 - Trait 136 ( 1.9%) 1 +ast-stats-2 - Enum 136 ( 1.9%) 1 +ast-stats-2 - ExternCrate 136 ( 1.9%) 1 +ast-stats-2 - ForeignMod 136 ( 1.9%) 1 +ast-stats-2 - Impl 136 ( 1.9%) 1 +ast-stats-2 - Fn 272 ( 3.8%) 2 +ast-stats-2 - Use 544 ( 7.6%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 8_112 +ast-stats-2 Total 7_152 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size diff --git a/tests/ui/stdlib-unit-tests/not-sync.stderr b/tests/ui/stdlib-unit-tests/not-sync.stderr index 1ee358ba8..4e34e10e3 100644 --- a/tests/ui/stdlib-unit-tests/not-sync.stderr +++ b/tests/ui/stdlib-unit-tests/not-sync.stderr @@ -5,6 +5,7 @@ LL | test::>(); | ^^^^^^^^^ `Cell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead note: required by a bound in `test` --> $DIR/not-sync.rs:5:12 | @@ -18,6 +19,7 @@ LL | test::>(); | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: required by a bound in `test` --> $DIR/not-sync.rs:5:12 | diff --git a/tests/ui/str/str-lit-type-mismatch.stderr b/tests/ui/str/str-lit-type-mismatch.stderr index 6b56cd6f3..5ae7df5a2 100644 --- a/tests/ui/str/str-lit-type-mismatch.stderr +++ b/tests/ui/str/str-lit-type-mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:2:20 | LL | let x: &[u8] = "foo"; - | ----- ^^^^^ expected slice `[u8]`, found `str` + | ----- ^^^^^ expected `&[u8]`, found `&str` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:3:23 | LL | let y: &[u8; 4] = "baaa"; - | -------- ^^^^^^ expected array `[u8; 4]`, found `str` + | -------- ^^^^^^ expected `&[u8; 4]`, found `&str` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:4:19 | LL | let z: &str = b"foo"; - | ---- ^^^^^^ expected `str`, found array `[u8; 3]` + | ---- ^^^^^^ expected `&str`, found `&[u8; 3]` | | | expected due to this | diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs index 40ede9705..f21c9b2c8 100644 --- a/tests/ui/structs-enums/rec-align-u64.rs +++ b/tests/ui/structs-enums/rec-align-u64.rs @@ -43,7 +43,9 @@ struct Outer { target_os = "netbsd", target_os = "openbsd", target_os = "solaris", - target_os = "vxworks"))] + target_os = "vxworks", + target_os = "nto", +))] mod m { #[cfg(target_arch = "x86")] pub mod m { diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs index c30b8a1e1..b569993c6 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.rs @@ -7,6 +7,5 @@ fn main() { let foo = Some(Foo::Other); if let Some(Foo::Bar {_}) = foo {} - //~^ ERROR expected identifier, found reserved identifier `_` - //~| ERROR pattern does not mention field `bar` [E0027] + //~^ ERROR expected field pattern, found `_` } diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr index 16f751444..2f3a150e5 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr @@ -1,24 +1,13 @@ -error: expected identifier, found reserved identifier `_` +error: expected field pattern, found `_` --> $DIR/struct-enum-ignoring-field-with-underscore.rs:9:27 | LL | if let Some(Foo::Bar {_}) = foo {} - | ^ expected identifier, found reserved identifier - -error[E0027]: pattern does not mention field `bar` - --> $DIR/struct-enum-ignoring-field-with-underscore.rs:9:17 - | -LL | if let Some(Foo::Bar {_}) = foo {} - | ^^^^^^^^^^^^ missing field `bar` - | -help: include the missing field in the pattern + | ^ | -LL | if let Some(Foo::Bar {_, bar }) = foo {} - | ~~~~~~~ -help: if you don't care about this missing field, you can explicitly ignore it +help: to omit remaining fields, use `..` | -LL | if let Some(Foo::Bar {_, .. }) = foo {} - | ~~~~~~ +LL | if let Some(Foo::Bar {..}) = foo {} + | ~~ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0027`. diff --git a/tests/ui/structs/struct-base-wrong-type.stderr b/tests/ui/structs/struct-base-wrong-type.stderr index b039ce2cc..1299af72b 100644 --- a/tests/ui/structs/struct-base-wrong-type.stderr +++ b/tests/ui/structs/struct-base-wrong-type.stderr @@ -2,25 +2,25 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:7:33 | LL | static foo: Foo = Foo { a: 2, ..bar }; - | ^^^ expected struct `Foo`, found struct `Bar` + | ^^^ expected `Foo`, found `Bar` error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:8:35 | LL | static foo_i: Foo = Foo { a: 2, ..4 }; - | ^ expected struct `Foo`, found integer + | ^ expected `Foo`, found integer error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:12:27 | LL | let f = Foo { a: 2, ..b }; - | ^ expected struct `Foo`, found struct `Bar` + | ^ expected `Foo`, found `Bar` error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:13:34 | LL | let f__isize = Foo { a: 2, ..4 }; - | ^ expected struct `Foo`, found integer + | ^ expected `Foo`, found integer error: aborting due to 4 previous errors diff --git a/tests/ui/structs/struct-path-associated-type.rs b/tests/ui/structs/struct-path-associated-type.rs index 2dd7174a9..74d9705d4 100644 --- a/tests/ui/structs/struct-path-associated-type.rs +++ b/tests/ui/structs/struct-path-associated-type.rs @@ -13,7 +13,7 @@ fn f() { //~^ ERROR expected struct, variant or union type, found associated type let z = T::A:: {}; //~^ ERROR expected struct, variant or union type, found associated type - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument was supplied + //~| ERROR associated type takes 0 generic arguments but 1 generic argument was supplied match S { T::A {} => {} //~^ ERROR expected struct, variant or union type, found associated type @@ -22,7 +22,7 @@ fn f() { fn g>() { let s = T::A {}; // OK - let z = T::A:: {}; //~ ERROR this associated type takes 0 generic arguments but 1 generic argument was supplied + let z = T::A:: {}; //~ ERROR associated type takes 0 generic arguments but 1 generic argument was supplied match S { T::A {} => {} // OK } diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index ca5f0b7e2..acfddaf37 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -4,7 +4,7 @@ error[E0071]: expected struct, variant or union type, found associated type LL | let s = T::A {}; | ^^^^ not a struct -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/struct-path-associated-type.rs:14:16 | LL | let z = T::A:: {}; @@ -30,7 +30,7 @@ error[E0071]: expected struct, variant or union type, found associated type LL | T::A {} => {} | ^^^^ not a struct -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/struct-path-associated-type.rs:25:16 | LL | let z = T::A:: {}; diff --git a/tests/ui/structs/struct-path-self-type-mismatch.stderr b/tests/ui/structs/struct-path-self-type-mismatch.stderr index b55a2cbf7..cddc13561 100644 --- a/tests/ui/structs/struct-path-self-type-mismatch.stderr +++ b/tests/ui/structs/struct-path-self-type-mismatch.stderr @@ -34,7 +34,7 @@ LL | | LL | | inner: u LL | | LL | | } - | |_________^ expected type parameter `U`, found type parameter `T` + | |_________^ expected `Foo`, found `Foo` | = note: expected struct `Foo` found struct `Foo` diff --git a/tests/ui/structs/struct-record-suggestion.stderr b/tests/ui/structs/struct-record-suggestion.stderr index 9b751d1b6..38274f8d9 100644 --- a/tests/ui/structs/struct-record-suggestion.stderr +++ b/tests/ui/structs/struct-record-suggestion.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/struct-record-suggestion.rs:23:20 | LL | let q = B { b: 1..Default::default() }; - | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `Range<{integer}>` | = note: expected type `u32` found struct `std::ops::Range<{integer}>` diff --git a/tests/ui/structs/structure-constructor-type-mismatch.rs b/tests/ui/structs/structure-constructor-type-mismatch.rs index a03ef590c..21cd9d08b 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.rs +++ b/tests/ui/structs/structure-constructor-type-mismatch.rs @@ -45,13 +45,13 @@ fn main() { y: 8, }; - let pt3 = PointF:: { //~ ERROR this type alias takes 0 generic arguments but 1 generic argument + let pt3 = PointF:: { //~ ERROR type alias takes 0 generic arguments but 1 generic argument x: 9, //~ ERROR mismatched types y: 10, //~ ERROR mismatched types }; match (Point { x: 1, y: 2 }) { - PointF:: { .. } => {} //~ ERROR this type alias takes 0 generic arguments but 1 generic argument + PointF:: { .. } => {} //~ ERROR type alias takes 0 generic arguments but 1 generic argument //~^ ERROR mismatched types } diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index 3d64fc601..63dda4593 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -52,7 +52,7 @@ LL | x: 7, | expected `f32`, found integer | help: use a float literal: `7.0` -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF:: { @@ -84,7 +84,7 @@ LL | y: 10, | expected `f32`, found integer | help: use a float literal: `10.0` -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF:: { .. } => {} @@ -104,7 +104,7 @@ error[E0308]: mismatched types LL | match (Point { x: 1, y: 2 }) { | ---------------------- this expression has type `Point<{integer}>` LL | PointF:: { .. } => {} - | ^^^^^^^^^^^^^^^^^^^^ expected integer, found `f32` + | ^^^^^^^^^^^^^^^^^^^^ expected `Point<{integer}>`, found `Point` | = note: expected struct `Point<{integer}>` found struct `Point` @@ -115,7 +115,7 @@ error[E0308]: mismatched types LL | match (Point { x: 1, y: 2 }) { | ---------------------- this expression has type `Point<{integer}>` LL | PointF { .. } => {} - | ^^^^^^^^^^^^^ expected integer, found `f32` + | ^^^^^^^^^^^^^ expected `Point<{integer}>`, found `Point` | = note: expected struct `Point<{integer}>` found struct `Point` @@ -126,7 +126,7 @@ error[E0308]: mismatched types LL | match (Pair { x: 1, y: 2 }) { | --------------------- this expression has type `Pair<{integer}, {integer}>` LL | PairF:: { .. } => {} - | ^^^^^^^^^^^^^^^^^^^ expected integer, found `f32` + | ^^^^^^^^^^^^^^^^^^^ expected `Pair<{integer}, {integer}>`, found `Pair` | = note: expected struct `Pair<{integer}, {integer}>` found struct `Pair` diff --git a/tests/ui/suggest-null-ptr.fixed b/tests/ui/suggest-null-ptr.fixed new file mode 100644 index 000000000..40f900c7d --- /dev/null +++ b/tests/ui/suggest-null-ptr.fixed @@ -0,0 +1,31 @@ +// run-rustfix + +// Suggest providing a std::ptr::null{,_mut}() to a function that takes in a raw +// pointer if a literal 0 was provided by the user. + +extern "C" { + fn foo(ptr: *const u8); + + fn foo_mut(ptr: *mut u8); + + fn usize(ptr: *const usize); + + fn usize_mut(ptr: *mut usize); +} + +fn main() { + unsafe { + foo(std::ptr::null()); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null()` + foo_mut(std::ptr::null_mut()); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + usize(std::ptr::null()); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null()` + usize_mut(std::ptr::null_mut()); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + } +} diff --git a/tests/ui/suggest-null-ptr.rs b/tests/ui/suggest-null-ptr.rs new file mode 100644 index 000000000..19b595bf7 --- /dev/null +++ b/tests/ui/suggest-null-ptr.rs @@ -0,0 +1,31 @@ +// run-rustfix + +// Suggest providing a std::ptr::null{,_mut}() to a function that takes in a raw +// pointer if a literal 0 was provided by the user. + +extern "C" { + fn foo(ptr: *const u8); + + fn foo_mut(ptr: *mut u8); + + fn usize(ptr: *const usize); + + fn usize_mut(ptr: *mut usize); +} + +fn main() { + unsafe { + foo(0); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null()` + foo_mut(0); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + usize(0); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null()` + usize_mut(0); + //~^ mismatched types [E0308] + //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + } +} diff --git a/tests/ui/suggest-null-ptr.stderr b/tests/ui/suggest-null-ptr.stderr new file mode 100644 index 000000000..66a79d074 --- /dev/null +++ b/tests/ui/suggest-null-ptr.stderr @@ -0,0 +1,83 @@ +error[E0308]: mismatched types + --> $DIR/suggest-null-ptr.rs:18:13 + | +LL | foo(0); + | --- ^ expected `*const u8`, found `usize` + | | + | arguments to this function are incorrect + | + = note: expected raw pointer `*const u8` + found type `usize` +note: function defined here + --> $DIR/suggest-null-ptr.rs:7:8 + | +LL | fn foo(ptr: *const u8); + | ^^^ +help: if you meant to create a null pointer, use `std::ptr::null()` + | +LL | foo(std::ptr::null()); + | ~~~~~~~~~~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/suggest-null-ptr.rs:21:17 + | +LL | foo_mut(0); + | ------- ^ expected `*mut u8`, found `usize` + | | + | arguments to this function are incorrect + | + = note: expected raw pointer `*mut u8` + found type `usize` +note: function defined here + --> $DIR/suggest-null-ptr.rs:9:8 + | +LL | fn foo_mut(ptr: *mut u8); + | ^^^^^^^ +help: if you meant to create a null pointer, use `std::ptr::null_mut()` + | +LL | foo_mut(std::ptr::null_mut()); + | ~~~~~~~~~~~~~~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/suggest-null-ptr.rs:24:15 + | +LL | usize(0); + | ----- ^ expected `*const usize`, found `usize` + | | + | arguments to this function are incorrect + | + = note: expected raw pointer `*const usize` + found type `usize` +note: function defined here + --> $DIR/suggest-null-ptr.rs:11:8 + | +LL | fn usize(ptr: *const usize); + | ^^^^^ +help: if you meant to create a null pointer, use `std::ptr::null()` + | +LL | usize(std::ptr::null()); + | ~~~~~~~~~~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/suggest-null-ptr.rs:27:19 + | +LL | usize_mut(0); + | --------- ^ expected `*mut usize`, found `usize` + | | + | arguments to this function are incorrect + | + = note: expected raw pointer `*mut usize` + found type `usize` +note: function defined here + --> $DIR/suggest-null-ptr.rs:13:8 + | +LL | fn usize_mut(ptr: *mut usize); + | ^^^^^^^^^ +help: if you meant to create a null pointer, use `std::ptr::null_mut()` + | +LL | usize_mut(std::ptr::null_mut()); + | ~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr index bc097bf6e..510b99bb5 100644 --- a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -2,9 +2,9 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:6:34 | LL | let _: Option<(i32, bool)> = Some(1, 2); - | ^^^^ - argument of type `{integer}` unexpected + | ^^^^ - unexpected argument of type `{integer}` | -note: expected tuple, found integer +note: expected `(i32, bool)`, found integer --> $DIR/args-instead-of-tuple-errors.rs:6:39 | LL | let _: Option<(i32, bool)> = Some(1, 2); @@ -22,16 +22,17 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: remove the extra argument | -LL | let _: Option<(i32, bool)> = Some(/* (i32, bool) */); - | ~~~~~~~~~~~~~~~~~~~ +LL - let _: Option<(i32, bool)> = Some(1, 2); +LL + let _: Option<(i32, bool)> = Some(/* (i32, bool) */); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:8:5 | LL | int_bool(1, 2); - | ^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^ - unexpected argument of type `{integer}` | -note: expected tuple, found integer +note: expected `(i32, bool)`, found integer --> $DIR/args-instead-of-tuple-errors.rs:8:14 | LL | int_bool(1, 2); @@ -45,8 +46,9 @@ LL | fn int_bool(_: (i32, bool)) { | ^^^^^^^^ -------------- help: remove the extra argument | -LL | int_bool(/* (i32, bool) */); - | ~~~~~~~~~~~~~~~~~~~ +LL - int_bool(1, 2); +LL + int_bool(/* (i32, bool) */); + | error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:11:28 @@ -65,7 +67,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 | LL | let _: Option<(i32,)> = Some(5_usize); - | ---- ^^^^^^^ expected tuple, found `usize` + | ---- ^^^^^^^ expected `(i32,)`, found `usize` | | | arguments to this enum variant are incorrect | @@ -85,7 +87,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:17:34 | LL | let _: Option<(i32,)> = Some((5_usize)); - | ---- ^^^^^^^^^ expected tuple, found `usize` + | ---- ^^^^^^^^^ expected `(i32,)`, found `usize` | | | arguments to this enum variant are incorrect | diff --git a/tests/ui/suggestions/args-instead-of-tuple.stderr b/tests/ui/suggestions/args-instead-of-tuple.stderr index 3ed9dbf4a..0bdf10b0d 100644 --- a/tests/ui/suggestions/args-instead-of-tuple.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple.stderr @@ -41,7 +41,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:14:34 | LL | let _: Option<(i32,)> = Some(3); - | ---- ^ expected tuple, found integer + | ---- ^ expected `(i32,)`, found integer | | | arguments to this enum variant are incorrect | @@ -58,7 +58,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:17:34 | LL | let _: Option<(i32,)> = Some((3)); - | ---- ^^^ expected tuple, found integer + | ---- ^^^ expected `(i32,)`, found integer | | | arguments to this enum variant are incorrect | diff --git a/tests/ui/suggestions/as-ref.stderr b/tests/ui/suggestions/as-ref.stderr index deafa9f48..0ee343ebf 100644 --- a/tests/ui/suggestions/as-ref.stderr +++ b/tests/ui/suggestions/as-ref.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:7:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:8:39 | LL | opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:10:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:11:37 | LL | opt.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -64,7 +64,7 @@ error[E0308]: mismatched types LL | let y: Option<&usize> = x; | -------------- ^ | | | - | | expected enum `Option`, found `&Option` + | | expected `Option<&usize>`, found `&Option` | | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `x.as_ref()` | expected due to this | @@ -75,7 +75,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:15:37 | LL | let y: Result<&usize, &usize> = x; - | ---------------------- ^ expected enum `Result`, found reference + | ---------------------- ^ expected `Result<&usize, &usize>`, found `&Result` | | | expected due to this | @@ -90,7 +90,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:19:36 | LL | let y: Result<&usize, usize> = x; - | --------------------- ^ expected enum `Result`, found reference + | --------------------- ^ expected `Result<&usize, usize>`, found `&Result` | | | expected due to this | @@ -101,7 +101,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:22:42 | LL | multiple_ref_opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -116,7 +116,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:23:52 | LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -131,7 +131,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:25:45 | LL | multiple_ref_result.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -146,7 +146,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:26:53 | LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` diff --git a/tests/ui/suggestions/assoc-const-without-self.rs b/tests/ui/suggestions/assoc-const-without-self.rs new file mode 100644 index 000000000..95070ec60 --- /dev/null +++ b/tests/ui/suggestions/assoc-const-without-self.rs @@ -0,0 +1,11 @@ +struct Foo; + +impl Foo { + const A_CONST: usize = 1; + + fn foo() -> usize { + A_CONST //~ ERROR cannot find value `A_CONST` in this scope + } +} + +fn main() {} diff --git a/tests/ui/suggestions/assoc-const-without-self.stderr b/tests/ui/suggestions/assoc-const-without-self.stderr new file mode 100644 index 000000000..88d72da70 --- /dev/null +++ b/tests/ui/suggestions/assoc-const-without-self.stderr @@ -0,0 +1,14 @@ +error[E0425]: cannot find value `A_CONST` in this scope + --> $DIR/assoc-const-without-self.rs:7:9 + | +LL | A_CONST + | ^^^^^^^ not found in this scope + | +help: consider using the associated constant + | +LL | Self::A_CONST + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr index afef38f12..211cb1584 100644 --- a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr +++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr @@ -36,7 +36,7 @@ LL | let y: i32 = i32::max - 42; | | | fn(i32, i32) -> i32 {::max} | -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let y: i32 = i32::max(/* i32 */, /* i32 */) - 42; | ++++++++++++++++++++++ diff --git a/tests/ui/suggestions/borrow-for-loop-head.stderr b/tests/ui/suggestions/borrow-for-loop-head.stderr index cbdb94877..0f179438a 100644 --- a/tests/ui/suggestions/borrow-for-loop-head.stderr +++ b/tests/ui/suggestions/borrow-for-loop-head.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/borrow-for-loop-head.rs:4:18 | +LL | let a = vec![1, 2, 3]; + | - binding `a` declared here LL | for i in &a { | -- borrow of `a` occurs here LL | for j in a { diff --git a/tests/ui/suggestions/boxed-variant-field.stderr b/tests/ui/suggestions/boxed-variant-field.stderr index 9ae36a06a..1adbc0540 100644 --- a/tests/ui/suggestions/boxed-variant-field.stderr +++ b/tests/ui/suggestions/boxed-variant-field.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/boxed-variant-field.rs:9:31 | LL | Ty::List(elem) => foo(elem), - | --- ^^^^ expected enum `Ty`, found struct `Box` + | --- ^^^^ expected `Ty`, found `Box` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/call-boxed.stderr b/tests/ui/suggestions/call-boxed.stderr index 9b619ac9a..9b31ee07c 100644 --- a/tests/ui/suggestions/call-boxed.stderr +++ b/tests/ui/suggestions/call-boxed.stderr @@ -6,7 +6,7 @@ LL | let mut x = 1i32; LL | let y = Box::new(|| 1); | -- the found closure LL | x = y; - | ^ expected `i32`, found struct `Box` + | ^ expected `i32`, found `Box<[closure@call-boxed.rs:3:22]>` | = note: expected type `i32` found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>` 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 965dbb967..11d9b8391 100644 --- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr +++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn foo(mut s: String) -> String { | ------ expected `String` because of return type LL | s.push_str("asdf") - | ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `()` + | ^^^^^^^^^^^^^^^^^^ expected `String`, found `()` | note: method `push_str` modifies its receiver in-place --> $DIR/chain-method-call-mutation-in-place.rs:3:7 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 26ab515d9..45593035b 100644 --- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr +++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr @@ -26,7 +26,7 @@ error[E0308]: mismatched types LL | fn wut(t: &Foo) -> Foo { | --- expected `Foo` because of return type LL | t.clone() - | ^^^^^^^^^ expected struct `Foo`, found `&Foo` + | ^^^^^^^^^ expected `Foo`, found `&Foo` | note: `Foo` does not implement `Clone`, so `&Foo` was cloned instead --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:9:5 diff --git a/tests/ui/suggestions/const-in-struct-pat.stderr b/tests/ui/suggestions/const-in-struct-pat.stderr index c8b93f3dc..f344ac06d 100644 --- a/tests/ui/suggestions/const-in-struct-pat.stderr +++ b/tests/ui/suggestions/const-in-struct-pat.stderr @@ -7,7 +7,7 @@ LL | struct foo; LL | let Thing { foo } = t; | ^^^ - this expression has type `Thing` | | - | expected struct `String`, found struct `foo` + | expected `String`, found `foo` | `foo` is interpreted as a unit struct, not a new binding | help: bind the struct field to a different name instead diff --git a/tests/ui/suggestions/constrain-suggest-ice.rs b/tests/ui/suggestions/constrain-suggest-ice.rs index 69b874bed..d6e5263ff 100644 --- a/tests/ui/suggestions/constrain-suggest-ice.rs +++ b/tests/ui/suggestions/constrain-suggest-ice.rs @@ -1,11 +1,9 @@ -struct Bug{ //~ ERROR parameter `S` is never used [E0392] +struct Bug{ A: [(); { - let x: [u8; Self::W] = [0; Self::W]; //~ ERROR generic `Self` types are currently not permitted in anonymous constants - //~^ ERROR generic `Self` types are currently not permitted in anonymous constants - //~^^ ERROR the size for values of type `S` cannot be known at compilation time [E0277] - F //~ ERROR cannot find value `F` in this scope [E0425] + let x: [u8; Self::W] = [0; Self::W]; + F } -} //~ ERROR mismatched closing delimiter: `}` +} //~^ ERROR mismatched closing delimiter: `}` fn main() {} diff --git a/tests/ui/suggestions/constrain-suggest-ice.stderr b/tests/ui/suggestions/constrain-suggest-ice.stderr index 2af7c2f69..9b92091de 100644 --- a/tests/ui/suggestions/constrain-suggest-ice.stderr +++ b/tests/ui/suggestions/constrain-suggest-ice.stderr @@ -9,64 +9,5 @@ LL | A: [(); { LL | } | ^ mismatched closing delimiter -error: mismatched closing delimiter: `}` - --> $DIR/constrain-suggest-ice.rs:2:8 - | -LL | struct Bug{ - | - closing delimiter possibly meant for this -LL | A: [(); { - | ^ unclosed delimiter -... -LL | } - | ^ mismatched closing delimiter - -error[E0425]: cannot find value `F` in this scope - --> $DIR/constrain-suggest-ice.rs:6:9 - | -LL | F - | ^ help: a local variable with a similar name exists: `x` - -error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/constrain-suggest-ice.rs:3:21 - | -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^ - -error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/constrain-suggest-ice.rs:3:36 - | -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^ - -error[E0277]: the size for values of type `S` cannot be known at compilation time - --> $DIR/constrain-suggest-ice.rs:3:36 - | -LL | struct Bug{ - | - this type parameter needs to be `std::marker::Sized` -LL | A: [(); { -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^^^^ doesn't have a size known at compile-time - | -note: required by a bound in `Bug` - --> $DIR/constrain-suggest-ice.rs:1:12 - | -LL | struct Bug{ - | ^ required by this bound in `Bug` -help: consider relaxing the implicit `Sized` restriction - | -LL | struct Bug{ - | ++++++++ - -error[E0392]: parameter `S` is never used - --> $DIR/constrain-suggest-ice.rs:1:12 - | -LL | struct Bug{ - | ^ unused parameter - | - = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData` - = help: if you intended `S` to be a const parameter, use `const S: usize` instead - -error: aborting due to 7 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0277, E0392, E0425. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/copied-and-cloned.stderr b/tests/ui/suggestions/copied-and-cloned.stderr index a6336281b..067808141 100644 --- a/tests/ui/suggestions/copied-and-cloned.stderr +++ b/tests/ui/suggestions/copied-and-cloned.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:7:26 | LL | expect::>(x); - | -------------------- ^ expected `()`, found `&()` + | -------------------- ^ expected `Option<()>`, found `Option<&()>` | | | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:11:30 | LL | expect::>(x); - | ------------------------ ^ expected `()`, found `&()` + | ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>` | | | arguments to this function are incorrect | @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:16:30 | LL | expect::>(x); - | ------------------------ ^ expected struct `String`, found `&String` + | ------------------------ ^ expected `Option`, found `Option<&String>` | | | arguments to this function are incorrect | @@ -62,7 +62,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:20:34 | LL | expect::>(x); - | ---------------------------- ^ expected struct `String`, found `&String` + | ---------------------------- ^ expected `Result`, found `Result<&String, _>` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr index 5dc4e6444..c6867270a 100644 --- a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr +++ b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | / intrinsic_match! { LL | | "abc" LL | | }; - | |_____^ expected `&str`, found struct `String` + | |_____^ expected `&str`, found `String` | = note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr index 67f4ac08d..866d3fab4 100644 --- a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr +++ b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/hidden-child.rs:9:26 | LL | let x: Option = 1i32; - | ----------- ^^^^ expected enum `Option`, found `i32` + | ----------- ^^^^ expected `Option`, found `i32` | | | expected due to this | diff --git a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr index d92b81279..f8029e452 100644 --- a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr +++ b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/hidden-parent.rs:6:26 | LL | let x: Option = 1i32; - | ----------- ^^^^ expected enum `Option`, found `i32` + | ----------- ^^^^ expected `Option`, found `i32` | | | expected due to this | diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index b1e04dab8..90ea06239 100644 --- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -5,7 +5,7 @@ LL | fn foo + Send + 'static>(x: F) -> BoxFuture<'static, | - this type parameter ----------------------- expected `Pin + 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 struct `Pin`, found type parameter `F` + | ^ expected `Pin>`, found type parameter `F` | = note: expected struct `Pin + Send + 'static)>>` found type parameter `F` @@ -20,7 +20,7 @@ error[E0308]: mismatched types LL | fn bar + Send + 'static>(x: F) -> BoxFuture<'static, i32> { | ----------------------- expected `Pin + Send + 'static)>>` because of return type LL | Box::new(x) - | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box` + | ^^^^^^^^^^^ expected `Pin>`, found `Box` | = note: expected struct `Pin + Send + 'static)>>` found struct `Box` @@ -32,7 +32,7 @@ error[E0308]: mismatched types LL | fn baz + Send + 'static>(x: F) -> BoxFuture<'static, i32> { | - this type parameter LL | Pin::new(x) - | -------- ^ expected struct `Box`, found type parameter `F` + | -------- ^ expected `Box + Send>`, found type parameter `F` | | | arguments to this function are incorrect | help: use `Box::pin` to pin and box this expression: `Box::pin` @@ -74,7 +74,7 @@ LL | | 42 LL | | } | | ^ | | | - | |_____expected struct `Pin`, found `async` block + | |_____expected `Pin>`, found `async` block | arguments to this function are incorrect | = note: expected struct `Pin + Send>>` diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index b9f0f788b..007bc6ecf 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -7,7 +7,7 @@ LL | Fst, LL | if let B::Fst = a {}; | ^^^^^^ - this expression has type `A` | | - | expected struct `A`, found enum `B` + | expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -24,7 +24,7 @@ LL | match a { | - this expression has type `A` ... LL | B::Fst => (), - | ^^^^^^ expected struct `A`, found enum `B` + | ^^^^^^ expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -41,7 +41,7 @@ LL | match a { | - this expression has type `A` ... LL | B::Snd => (), - | ^^^^^^ expected struct `A`, found enum `B` + | ^^^^^^ expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -55,7 +55,7 @@ LL | match foo { | --- this expression has type `Foo` LL | LL | 1u32 => (), - | ^^^^ expected union `Foo`, found `u32` + | ^^^^ expected `Foo`, found `u32` | help: you might have meant to use field `bar` whose type is `u32` | diff --git a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr index 4cbcd31fa..a137db8cd 100644 --- a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr +++ b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -23,7 +23,7 @@ LL | struct S(usize, usize); | -------- `S` defines a struct constructor here, which should be called ... LL | let _: S = S; - | - ^ expected struct `S`, found struct constructor + | - ^ expected `S`, found struct constructor | | | expected due to this | @@ -59,7 +59,7 @@ LL | struct V(); | -------- `V` defines a struct constructor here, which should be called ... LL | let _: V = V; - | - ^ expected struct `V`, found struct constructor + | - ^ expected `V`, found struct constructor | | | expected due to this | @@ -113,7 +113,7 @@ LL | A(usize), | - `A` defines an enum variant constructor here, which should be called ... LL | let _: E = E::A; - | - ^^^^ expected enum `E`, found enum constructor + | - ^^^^ expected `E`, found enum constructor | | | expected due to this | @@ -206,7 +206,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:41:20 | LL | fn ban(&self) -> usize { 42 } - | ---------------------- associated function `ban` defined here + | ---------------------- method `ban` defined here ... LL | let _: usize = X::ban; | ----- ^^^^^^ expected `usize`, found fn item @@ -215,7 +215,7 @@ LL | let _: usize = X::ban; | = note: expected type `usize` found fn item `for<'a> fn(&'a X) -> usize {::ban}` -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let _: usize = X::ban(/* &X */); | ++++++++++ @@ -224,7 +224,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:42:20 | LL | fn bal(&self) -> usize; - | ----------------------- associated function `bal` defined here + | ----------------------- method `bal` defined here ... LL | let _: usize = X::bal; | ----- ^^^^^^ expected `usize`, found fn item @@ -233,7 +233,7 @@ LL | let _: usize = X::bal; | = note: expected type `usize` found fn item `for<'a> fn(&'a X) -> usize {::bal}` -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let _: usize = X::bal(/* &X */); | ++++++++++ diff --git a/tests/ui/suggestions/format-borrow.stderr b/tests/ui/suggestions/format-borrow.stderr index 8ed2b9c9a..3ea0d208c 100644 --- a/tests/ui/suggestions/format-borrow.stderr +++ b/tests/ui/suggestions/format-borrow.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:2:21 | LL | let a: String = &String::from("a"); - | ------ ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String` + | ------ ^^^^^^^^^^^^^^^^^^ expected `String`, found `&String` | | | expected due to this | @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 | LL | let b: String = &format!("b"); - | ------ ^^^^^^^^^^^^^ expected struct `String`, found `&String` + | ------ ^^^^^^^^^^^^^ expected `String`, found `&String` | | | expected due to this | @@ -38,7 +38,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:6:21 | LL | let c: String = &mut format!("c"); - | ------ ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` + | ------ ^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String` | | | expected due to this | @@ -56,7 +56,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:8:21 | LL | let d: String = &mut (format!("d")); - | ------ ^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` + | ------ ^^^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String` | | | expected due to this | diff --git a/tests/ui/suggestions/if-then-neeing-semi.rs b/tests/ui/suggestions/if-then-neeing-semi.rs index b487f013d..a4eefb415 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.rs +++ b/tests/ui/suggestions/if-then-neeing-semi.rs @@ -15,18 +15,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = if true { @@ -35,8 +26,8 @@ async fn async_extra_semicolon_same() { //~^ HELP consider removing this semicolon } else { async_dummy() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -48,8 +39,8 @@ async fn async_extra_semicolon_different() { //~^ HELP consider removing this semicolon } else { async_dummy2() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -61,8 +52,7 @@ async fn async_different_futures() { //~| HELP consider `await`ing on both `Future`s } else { async_dummy2() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected opaque type, found a different opaque type - //~| NOTE expected opaque type `impl Future` + //~^ NOTE expected future, found a different future //~| NOTE distinct uses of `impl Trait` result in different opaque types }; } diff --git a/tests/ui/suggestions/if-then-neeing-semi.stderr b/tests/ui/suggestions/if-then-neeing-semi.stderr index d7c5818ab..6833e0bab 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.stderr +++ b/tests/ui/suggestions/if-then-neeing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:37:9 + --> $DIR/if-then-neeing-semi.rs:28:9 | LL | let _ = if true { | _____________- @@ -9,19 +9,17 @@ LL | | async_dummy(); LL | | LL | | } else { LL | | async_dummy() - | | ^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 +note: calling an async function returns a future + --> $DIR/if-then-neeing-semi.rs:28:9 | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` +LL | async_dummy() + | ^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | async_dummy().await @@ -33,7 +31,7 @@ LL + async_dummy() | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:50:9 + --> $DIR/if-then-neeing-semi.rs:41:9 | LL | let _ = if true { | _____________- @@ -43,19 +41,17 @@ LL | | async_dummy(); LL | | LL | | } else { LL | | async_dummy2() - | | ^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 +note: calling an async function returns a future + --> $DIR/if-then-neeing-semi.rs:41:9 | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` +LL | async_dummy2() + | ^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | async_dummy2().await @@ -69,7 +65,7 @@ LL ~ Box::new(async_dummy2()) | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:63:9 + --> $DIR/if-then-neeing-semi.rs:54:9 | LL | let _ = if true { | _____________- @@ -79,24 +75,12 @@ LL | | async_dummy() LL | | LL | | } else { LL | | async_dummy2() - | | ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type -... | + | | ^^^^^^^^^^^^^^ expected future, found a different future +LL | | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>) - found opaque type `impl Future` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index 864ab0535..fc5a52174 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -12,7 +12,7 @@ note: required by a bound in `foo` --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20 | LL | fn foo(_: X) - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for<'b> &'b X: Trait, | ^^^^^ required by this bound in `foo` diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr index 679ebd61e..da72c8ebf 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr @@ -17,7 +17,7 @@ note: the used `impl` has a `'static` requirement LL | impl MyTrait for dyn ObjectTrait { | ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement help: consider relaxing the implicit `'static` requirement | LL | impl MyTrait for dyn ObjectTrait + '_ { @@ -42,7 +42,7 @@ note: the used `impl` has a `'static` requirement LL | impl dyn ObjectTrait { | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement help: consider relaxing the implicit `'static` requirement | LL | impl dyn ObjectTrait + '_ { @@ -65,7 +65,7 @@ note: the used `impl` has a `'static` requirement --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:87:26 | LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement ... LL | impl MyTrait for dyn ObjectTrait {} | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement @@ -91,7 +91,7 @@ note: the used `impl` has a `'static` requirement --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:106:26 | LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement ... LL | impl MyTrait for dyn ObjectTrait {} | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement diff --git a/tests/ui/suggestions/into-convert.stderr b/tests/ui/suggestions/into-convert.stderr index d43104a21..704b280a9 100644 --- a/tests/ui/suggestions/into-convert.stderr +++ b/tests/ui/suggestions/into-convert.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:6:16 | LL | let x: A = B; - | - ^ expected struct `A`, found struct `B` + | - ^ expected `A`, found `B` | | | expected due to this | @@ -15,7 +15,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:10:24 | LL | let y: Arc = PathBuf::new(); - | --------- ^^^^^^^^^^^^^^ expected struct `Arc`, found struct `PathBuf` + | --------- ^^^^^^^^^^^^^^ expected `Arc`, found `PathBuf` | | | expected due to this | @@ -30,7 +30,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:14:24 | LL | let z: AtomicU32 = 1; - | --------- ^ expected struct `AtomicU32`, found integer + | --------- ^ expected `AtomicU32`, found integer | | | expected due to this | diff --git a/tests/ui/suggestions/issue-101065.stderr b/tests/ui/suggestions/issue-101065.stderr index 6f7ecd24c..9f77ead42 100644 --- a/tests/ui/suggestions/issue-101065.stderr +++ b/tests/ui/suggestions/issue-101065.stderr @@ -7,7 +7,7 @@ LL | | FakeResult::Ok(FakeResult::Ok(())) | | ---------------------------------- expected because of this LL | | } else { LL | | FakeResult::Ok(()) - | | ^^^^^^^^^^^^^^^^^^ expected enum `FakeResult`, found `()` + | | ^^^^^^^^^^^^^^^^^^ expected `FakeResult>`, found `FakeResult<()>` LL | | }; | |_____- `if` and `else` have incompatible types | diff --git a/tests/ui/suggestions/issue-101421.rs b/tests/ui/suggestions/issue-101421.rs index b615997d1..1407ebd27 100644 --- a/tests/ui/suggestions/issue-101421.rs +++ b/tests/ui/suggestions/issue-101421.rs @@ -8,5 +8,5 @@ impl Ice for () { fn main() { ().f::<()>(()); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied } diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index f8e1efb88..2656ab3db 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); @@ -6,7 +6,7 @@ LL | ().f::<()>(()); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); diff --git a/tests/ui/suggestions/issue-101465.stderr b/tests/ui/suggestions/issue-101465.stderr index e2ca77712..2aec3c863 100644 --- a/tests/ui/suggestions/issue-101465.stderr +++ b/tests/ui/suggestions/issue-101465.stderr @@ -5,7 +5,7 @@ LL | / match true { LL | | true => B, | | - this is found to be of type `B` LL | | false => C, - | | ^ expected struct `B`, found struct `C` + | | ^ expected `B`, found `C` LL | | LL | | } | |_____- `match` arms have incompatible types diff --git a/tests/ui/suggestions/issue-101984.stderr b/tests/ui/suggestions/issue-101984.stderr index 81758a700..151587d42 100644 --- a/tests/ui/suggestions/issue-101984.stderr +++ b/tests/ui/suggestions/issue-101984.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let (cmp, router) = self.router.at()?; | ^^^^^^^^^^^^^ ----------------- this expression has type `Match<&(for<'a> fn(&'a ()), Box)>` | | - | expected struct `Match`, found tuple + | expected `Match<&(fn(&()), Box)>`, found `(_, _)` | = note: expected struct `Match<&(for<'a> fn(&'a ()), Box)>` found tuple `(_, _)` diff --git a/tests/ui/suggestions/issue-102892.stderr b/tests/ui/suggestions/issue-102892.stderr index a3dbc7cb8..e64a89ffe 100644 --- a/tests/ui/suggestions/issue-102892.stderr +++ b/tests/ui/suggestions/issue-102892.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:15:26 | LL | let (a, b): (A, B) = &**arc; // suggests putting `&**arc` here too - | ------ ^^^^^^ expected tuple, found `&(A, B)` + | ------ ^^^^^^ expected `(A, B)`, found `&(A, B)` | | | expected due to this | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:20:32 | LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too - | ^^^^^^^^^^^^^^ expected tuple, found `&mut (A, B)` + | ^^^^^^^^^^^^^^ expected `(A, B)`, found `&mut (A, B)` | = note: expected tuple `(A, B)` found mutable reference `&mut (A, B)` @@ -40,7 +40,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:20:48 | LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too - | ^^^^^^^^^^ expected struct `A`, found `&A` + | ^^^^^^^^^^ expected `A`, found `&A` | help: consider removing the borrow | diff --git a/tests/ui/suggestions/issue-104287.rs b/tests/ui/suggestions/issue-104287.rs index e3fa22a8f..37b3339fa 100644 --- a/tests/ui/suggestions/issue-104287.rs +++ b/tests/ui/suggestions/issue-104287.rs @@ -8,6 +8,6 @@ impl S { fn main() { let x = S; foo::<()>(x); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| ERROR cannot find function `foo` in this scope } diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index 602a01828..ed59b2e7a 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); @@ -6,7 +6,7 @@ LL | foo::<()>(x); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/issue-104287.rs:6:8 | LL | fn foo(&self) {} diff --git a/tests/ui/suggestions/issue-104961.fixed b/tests/ui/suggestions/issue-104961.fixed new file mode 100644 index 000000000..520d638b1 --- /dev/null +++ b/tests/ui/suggestions/issue-104961.fixed @@ -0,0 +1,16 @@ +// run-rustfix + +fn foo(x: &str) -> bool { + x.starts_with(&("hi".to_string() + " you")) + //~^ 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` +} + +fn main() { + foo("hi you"); + foo2("hi"); +} diff --git a/tests/ui/suggestions/issue-104961.rs b/tests/ui/suggestions/issue-104961.rs new file mode 100644 index 000000000..aeb787abb --- /dev/null +++ b/tests/ui/suggestions/issue-104961.rs @@ -0,0 +1,16 @@ +// run-rustfix + +fn foo(x: &str) -> bool { + x.starts_with("hi".to_string() + " you") + //~^ 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` +} + +fn main() { + foo("hi you"); + foo2("hi"); +} diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr new file mode 100644 index 000000000..8cec6a3f8 --- /dev/null +++ b/tests/ui/suggestions/issue-104961.stderr @@ -0,0 +1,37 @@ +error[E0277]: expected a `FnMut<(char,)>` closure, found `String` + --> $DIR/issue-104961.rs:4:19 + | +LL | x.starts_with("hi".to_string() + " you") + | ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | | + | required by a bound introduced by this call + | + = note: the trait bound `String: Pattern<'_>` is not satisfied + = note: required for `String` to implement `Pattern<'_>` +note: required by a bound in `core::str::::starts_with` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL +help: consider borrowing here + | +LL | x.starts_with(&("hi".to_string() + " you")) + | ++ + + +error[E0277]: expected a `FnMut<(char,)>` closure, found `String` + --> $DIR/issue-104961.rs:9:19 + | +LL | x.starts_with("hi".to_string()) + | ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | | + | required by a bound introduced by this call + | + = note: the trait bound `String: Pattern<'_>` is not satisfied + = note: required for `String` to implement `Pattern<'_>` +note: required by a bound in `core::str::::starts_with` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL +help: consider borrowing here + | +LL | x.starts_with(&"hi".to_string()) + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/issue-105494.stderr b/tests/ui/suggestions/issue-105494.stderr index 5aa3f2af7..4cb4a399a 100644 --- a/tests/ui/suggestions/issue-105494.stderr +++ b/tests/ui/suggestions/issue-105494.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:2:19 | LL | let _v: i32 = (1 as i32).to_string(); - | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` + | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` | | | expected due to this | @@ -16,7 +16,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:5:19 | LL | let _v: i32 = (1 as i128).to_string(); - | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` + | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` | | | expected due to this @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:7:20 | LL | let _v: &str = "foo".to_string(); - | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found struct `String` + | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found `String` | | | expected due to this | @@ -41,7 +41,7 @@ LL | let mut path: String = "/usr".to_string(); | ------ expected due to this type ... LL | path = format!("{}/{}", path, folder).as_str(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str` | help: try removing the method call | diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr index 1e66fe3af..4e91dfc82 100644 --- a/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr +++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:11:9 | LL | foo(s); - | --- ^ expected struct `S`, found `&S` + | --- ^ expected `S`, found `&S` | | | arguments to this function are incorrect | @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:17:9 | LL | bar(t); - | --- ^ expected struct `T`, found `&T` + | --- ^ expected `T`, found `&T` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/issue-52820.stderr b/tests/ui/suggestions/issue-52820.stderr index 09269ed4e..a67d75014 100644 --- a/tests/ui/suggestions/issue-52820.stderr +++ b/tests/ui/suggestions/issue-52820.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-52820.rs:12:9 | LL | guts, - | ^^^^ expected struct `String`, found `&str` + | ^^^^ expected `String`, found `&str` | help: try using a conversion method | @@ -16,7 +16,7 @@ LL | brains: guts.clone(), | ^^^^^-----^^ | | | | | help: try using a conversion method: `to_string` - | expected struct `String`, found `&str` + | expected `String`, found `&str` error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-53692.stderr b/tests/ui/suggestions/issue-53692.stderr index 3a1b624f4..469a53841 100644 --- a/tests/ui/suggestions/issue-53692.stderr +++ b/tests/ui/suggestions/issue-53692.stderr @@ -5,7 +5,7 @@ LL | let items_clone: Vec = ref_items.clone(); | -------- ^^^^^^^^^^-----^^ | | | | | | | help: try using a conversion method: `to_vec` - | | expected struct `Vec`, found `&[i32]` + | | expected `Vec`, found `&[i32]` | expected due to this | = note: expected struct `Vec` @@ -18,7 +18,7 @@ LL | let string: String = s.clone(); | ------ ^^-----^^ | | | | | | | help: try using a conversion method: `to_string` - | | expected struct `String`, found `&str` + | | expected `String`, found `&str` | expected due to this error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-59819.stderr b/tests/ui/suggestions/issue-59819.stderr index 40e4c7b78..43acf9549 100644 --- a/tests/ui/suggestions/issue-59819.stderr +++ b/tests/ui/suggestions/issue-59819.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:28:18 | LL | let y: i32 = x; - | --- ^ expected `i32`, found struct `Foo` + | --- ^ expected `i32`, found `Foo` | | | expected due to this | @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | let g: String = f; | ------ ^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found struct `Bar` + | | expected `String`, found `Bar` | expected due to this error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr index fae474ced..6d0a0c7b3 100644 --- a/tests/ui/suggestions/issue-81839.stderr +++ b/tests/ui/suggestions/issue-81839.stderr @@ -10,17 +10,9 @@ LL | | cx.answer_str("hi"); | | this is found to be of type `()` LL | | } LL | | _ => cx.answer_str("hi"), - | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found future LL | | } | |_____- `match` arms have incompatible types - | -note: while checking the return type of the `async fn` - --> $DIR/auxiliary/issue-81839.rs:6:49 - | -LL | pub async fn answer_str(&self, _s: &str) -> Test { - | ^^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` error: aborting due to previous error diff --git a/tests/ui/suggestions/issue-83943.stderr b/tests/ui/suggestions/issue-83943.stderr index 885106e84..c73667f09 100644 --- a/tests/ui/suggestions/issue-83943.stderr +++ b/tests/ui/suggestions/issue-83943.stderr @@ -8,7 +8,7 @@ LL | | } else { LL | | "B" | | ^^^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found `&str` + | | expected `String`, found `&str` LL | | }; | |_____- `if` and `else` have incompatible types diff --git a/tests/ui/suggestions/issue-84973.stderr b/tests/ui/suggestions/issue-84973.stderr index ae2bf5aac..55c89884a 100644 --- a/tests/ui/suggestions/issue-84973.stderr +++ b/tests/ui/suggestions/issue-84973.stderr @@ -13,7 +13,7 @@ LL | G: SomeTrait, | ^^^^^^^^^ required by this bound in `Other::<'a, G>::new` LL | { LL | pub fn new(g: G) -> Self { - | --- required by a bound in this + | --- required by a bound in this associated function help: consider borrowing here | LL | let o = Other::new(&f); diff --git a/tests/ui/suggestions/issue-85347.rs b/tests/ui/suggestions/issue-85347.rs index 02b5fb618..04d4c47d8 100644 --- a/tests/ui/suggestions/issue-85347.rs +++ b/tests/ui/suggestions/issue-85347.rs @@ -1,7 +1,7 @@ use std::ops::Deref; trait Foo { type Bar<'a>: Deref::Bar>; - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied //~| ERROR associated type bindings are not allowed here //~| HELP add missing } diff --git a/tests/ui/suggestions/issue-85347.stderr b/tests/ui/suggestions/issue-85347.stderr index 17c1b7dc4..f330b3c1f 100644 --- a/tests/ui/suggestions/issue-85347.stderr +++ b/tests/ui/suggestions/issue-85347.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-85347.rs:3:42 | LL | type Bar<'a>: Deref::Bar>; diff --git a/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr b/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr index 8c9a41a20..da6f7641b 100644 --- a/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr +++ b/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:9:22 | LL | let _x: (i32,) = (5); - | ------ ^^^ expected tuple, found integer + | ------ ^^^ expected `(i32,)`, found integer | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:13:9 | LL | foo((Some(3))); - | --- ^^^^^^^^^ expected tuple, found enum `Option` + | --- ^^^^^^^^^ expected `(_,)`, found `Option<{integer}>` | | | arguments to this function are incorrect | @@ -37,7 +37,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:17:22 | LL | let _s = S { _s: ("abc".to_string()) }; - | ^^^^^^^^^^^^^^^^^^^ expected tuple, found struct `String` + | ^^^^^^^^^^^^^^^^^^^ expected `(String,)`, found `String` | = note: expected tuple `(String,)` found struct `String` diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index 93d8da226..be09dd895 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:17:16 | LL | let _ = A::foo::(); @@ -20,7 +20,7 @@ LL - let _ = A::foo::(); LL + let _ = A::foo(); | -error[E0107]: this associated function takes 0 generic arguments but 2 generic arguments were supplied +error[E0107]: associated function takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/issue-89064.rs:22:16 | LL | let _ = B::bar::(); @@ -42,7 +42,7 @@ LL - let _ = B::bar::(); LL + let _ = B::bar(); | -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::::foo::(); @@ -56,7 +56,7 @@ note: associated function defined here, with 0 generic parameters LL | fn foo() {} | ^^^ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:31:16 | LL | let _ = 42.into::>(); diff --git a/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr b/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr index 611f7d5dd..7d1da7d24 100644 --- a/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr +++ b/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-90213-expected-boxfuture-self-ice.rs:9:19 | LL | Self::foo(None) - | --------- ^^^^ expected struct `Box`, found enum `Option` + | --------- ^^^^ expected `Box>`, found `Option<_>` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs new file mode 100644 index 000000000..3bf6b7bb9 --- /dev/null +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs @@ -0,0 +1,28 @@ +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub struct Trader<'a> { + closure: Box, +} + +impl<'a> Trader<'a> { + pub fn new() -> Self { + Trader { + closure: Box::new(|_| {}), + } + } + pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { + //foo + } +} + +fn main() { + let closure = |trader : Trader| { + println!("Woooosh!"); + }; + + let mut trader = Trader::new(); + trader.set_closure(closure); + //~^ ERROR type mismatch in closure arguments +} diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr new file mode 100644 index 000000000..6820af1fd --- /dev/null +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr @@ -0,0 +1,26 @@ +error[E0631]: type mismatch in closure arguments + --> $DIR/late-bound-in-borrow-closure-sugg.rs:26:24 + | +LL | let closure = |trader : Trader| { + | ----------------- found signature defined here +... +LL | trader.set_closure(closure); + | ----------- ^^^^^^^ expected due to this + | | + | required by a bound introduced by this call + | + = note: expected closure signature `for<'a, 'b> fn(&'a mut Trader<'b>) -> _` + found closure signature `for<'a> fn(Trader<'a>) -> _` +note: required by a bound in `Trader::<'a>::set_closure` + --> $DIR/late-bound-in-borrow-closure-sugg.rs:15:50 + | +LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { + | ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure` +help: consider borrowing the argument + | +LL | let closure = |trader : &mut Trader| { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0631`. diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index c5c3f7b46..93cfa60b5 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -10,7 +10,9 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap --> $DIR/missing-lifetimes-in-signature.rs:19:5 | LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() - | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here + | ------ ------------- opaque type defined here + | | + | hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here ... LL | / move || { LL | | diff --git a/tests/ui/suggestions/match-ergonomics.stderr b/tests/ui/suggestions/match-ergonomics.stderr index aa2b407bf..a3e059e8a 100644 --- a/tests/ui/suggestions/match-ergonomics.stderr +++ b/tests/ui/suggestions/match-ergonomics.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match &x[..] { | ------ this expression has type `&[i32]` LL | [&v] => {}, - | ^^ expected `i32`, found reference + | ^^ expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` @@ -36,7 +36,7 @@ error[E0308]: mismatched types LL | match y { | - this expression has type `i32` LL | &v => {}, - | ^^ expected `i32`, found reference + | ^^ expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` @@ -52,7 +52,7 @@ error[E0308]: mismatched types LL | if let [&v] = &x[..] {} | ^^ ------ this expression has type `&[i32]` | | - | expected `i32`, found reference + | expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.rs b/tests/ui/suggestions/match-prev-arm-needing-semi.rs index 8c8abe047..11463c453 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.rs +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.rs @@ -13,18 +13,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = match true { //~ NOTE `match` arms have incompatible types @@ -33,8 +24,8 @@ async fn async_extra_semicolon_same() { //~^ HELP consider removing this semicolon } false => async_dummy(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -46,8 +37,8 @@ async fn async_extra_semicolon_different() { //~^ HELP consider removing this semicolon } false => async_dummy2(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -57,8 +48,7 @@ async fn async_different_futures() { true => async_dummy(), //~ NOTE this is found to be //~| HELP consider `await`ing on both `Future`s false => async_dummy2(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected opaque type, found a different opaque type - //~| NOTE expected opaque type `impl Future` + //~^ NOTE expected future, found a different future //~| NOTE distinct uses of `impl Trait` result in different opaque types }; } diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr index 8d735b71f..cf3cf45ef 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:35:18 + --> $DIR/match-prev-arm-needing-semi.rs:26:18 | LL | let _ = match true { | _____________- @@ -9,19 +9,17 @@ LL | | async_dummy(); LL | | LL | | } LL | | false => async_dummy(), - | | ^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 +note: calling an async function returns a future + --> $DIR/match-prev-arm-needing-semi.rs:26:18 | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` +LL | false => async_dummy(), + | ^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | false => async_dummy().await, @@ -33,7 +31,7 @@ LL + async_dummy() | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:48:18 + --> $DIR/match-prev-arm-needing-semi.rs:39:18 | LL | let _ = match true { | _____________- @@ -43,19 +41,17 @@ LL | | async_dummy(); LL | | LL | | } LL | | false => async_dummy2(), - | | ^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 +note: calling an async function returns a future + --> $DIR/match-prev-arm-needing-semi.rs:39:18 | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future` +LL | false => async_dummy2(), + | ^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | false => async_dummy2().await, @@ -69,7 +65,7 @@ LL ~ false => Box::new(async_dummy2()), | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:59:18 + --> $DIR/match-prev-arm-needing-semi.rs:50:18 | LL | let _ = match true { | _____________- @@ -77,24 +73,12 @@ LL | | true => async_dummy(), | | ------------- this is found to be of type `impl Future` LL | | LL | | false => async_dummy2(), - | | ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type -... | + | | ^^^^^^^^^^^^^^ expected future, found a different future +LL | | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>) - found opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr index 00aa7d18a..51ea5b35a 100644 --- a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr +++ b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr @@ -16,7 +16,7 @@ LL | / match c { LL | | "baz" => Box::new(Baz), | | ------------- this is found to be of type `Box` LL | | _ => Box::new(Bar), - | | ^^^^^^^^^^^^^ expected struct `Baz`, found struct `Bar` + | | ^^^^^^^^^^^^^ expected `Box`, found `Box` LL | | }; | |_____- `match` arms have incompatible types | @@ -39,7 +39,7 @@ error[E0308]: mismatched types --> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:23:22 | LL | fn wrong(c: &str) -> Box { - | ----- ^^^^^^^^^^^^ expected struct `Box`, found `()` + | ----- ^^^^^^^^^^^^ expected `Box`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/suggestions/method-access-to-range-literal-typo.stderr b/tests/ui/suggestions/method-access-to-range-literal-typo.stderr index f42140894..54a16b8ef 100644 --- a/tests/ui/suggestions/method-access-to-range-literal-typo.stderr +++ b/tests/ui/suggestions/method-access-to-range-literal-typo.stderr @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | fn method(&self) -> Option<&Vec> { | ---------------- expected `Option<&Vec>` because of return type LL | self.option..as_ref().map(|x| x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&Vec>`, found `Range>>` | = note: expected enum `Option<&Vec>` found struct `std::ops::Range>>` @@ -32,7 +32,7 @@ error[E0308]: mismatched types LL | fn method2(&self) -> Option<&u8> { | ----------- expected `Option<&u8>` because of return type LL | self.option..foo().get(0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&u8>`, found `Range>>` | = note: expected enum `Option<&u8>` found struct `std::ops::Range>>` diff --git a/tests/ui/suggestions/missing-lifetime-specifier.rs b/tests/ui/suggestions/missing-lifetime-specifier.rs index 24f5f782f..cb734e8ba 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.rs +++ b/tests/ui/suggestions/missing-lifetime-specifier.rs @@ -37,19 +37,19 @@ thread_local! { thread_local! { static e: RefCell>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR union takes 2 lifetime arguments but 1 lifetime argument + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied } thread_local! { static f: RefCell>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR missing lifetime //~| ERROR missing lifetime } diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr index 997bbb5e9..21d237838 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.stderr +++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr @@ -133,7 +133,7 @@ LL | | } | = help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); @@ -151,7 +151,7 @@ help: add missing lifetime argument LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); @@ -169,7 +169,7 @@ help: add missing lifetime argument LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); @@ -187,7 +187,7 @@ help: add missing lifetime argument LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); @@ -205,7 +205,7 @@ help: add missing lifetime argument LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); @@ -223,7 +223,7 @@ help: add missing lifetime argument LL | static e: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); @@ -241,7 +241,7 @@ help: add missing lifetime argument LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); @@ -259,7 +259,7 @@ help: add missing lifetime argument LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); @@ -277,7 +277,7 @@ help: add missing lifetime argument LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); @@ -295,7 +295,7 @@ help: add missing lifetime argument LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); diff --git a/tests/ui/suggestions/missing-type-param-used-in-param.stderr b/tests/ui/suggestions/missing-type-param-used-in-param.stderr index 4f7058a64..3116c5a0a 100644 --- a/tests/ui/suggestions/missing-type-param-used-in-param.stderr +++ b/tests/ui/suggestions/missing-type-param-used-in-param.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/missing-type-param-used-in-param.rs:6:5 | LL | two_type_params::(100); diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs index 2f540060a..4066cd3b1 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs @@ -12,7 +12,7 @@ impl Foo for i32 { fn main() { 1.bar::(0); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument //~| HELP remove these generics } diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr index 9557220f6..bfdb35947 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -1,10 +1,10 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/move-generic-to-trait-in-method-with-params.rs:14:7 | LL | 1.bar::(0); | ^^^ expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/move-generic-to-trait-in-method-with-params.rs:4:8 | LL | fn bar(&self, _: T); diff --git a/tests/ui/suggestions/mut-ref-reassignment.stderr b/tests/ui/suggestions/mut-ref-reassignment.stderr index b3cb6dd06..b86a04c7c 100644 --- a/tests/ui/suggestions/mut-ref-reassignment.stderr +++ b/tests/ui/suggestions/mut-ref-reassignment.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn suggestion(opt: &mut Option) { | ------------------- expected due to this parameter type LL | opt = None; - | ^^^^ expected mutable reference, found enum `Option` + | ^^^^ expected `&mut Option`, found `Option<_>` | = note: expected mutable reference `&mut Option` found enum `Option<_>` @@ -19,7 +19,7 @@ error[E0308]: mismatched types LL | fn no_suggestion(opt: &mut Result) { | ----------------------- expected due to this parameter type LL | opt = None - | ^^^^ expected mutable reference, found enum `Option` + | ^^^^ expected `&mut Result`, found `Option<_>` | = note: expected mutable reference `&mut Result` found enum `Option<_>` @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | fn suggestion2(opt: &mut Option) { | ------------------- expected due to this parameter type LL | opt = Some(String::new()) - | ^^^^^^^^^^^^^^^^^^^ expected mutable reference, found enum `Option` + | ^^^^^^^^^^^^^^^^^^^ expected `&mut Option`, found `Option` | = note: expected mutable reference `&mut Option` found enum `Option` @@ -45,7 +45,7 @@ error[E0308]: mismatched types LL | fn no_suggestion2(opt: &mut Option) { | ------------------- expected due to this parameter type LL | opt = Some(42) - | ^^^^^^^^ expected mutable reference, found enum `Option` + | ^^^^^^^^ expected `&mut Option`, found `Option<{integer}>` | = note: expected mutable reference `&mut Option` found enum `Option<{integer}>` diff --git a/tests/ui/suggestions/opaque-type-error.stderr b/tests/ui/suggestions/opaque-type-error.stderr index 133ffb058..5c90d3012 100644 --- a/tests/ui/suggestions/opaque-type-error.stderr +++ b/tests/ui/suggestions/opaque-type-error.stderr @@ -2,22 +2,20 @@ error[E0308]: `if` and `else` have incompatible types --> $DIR/opaque-type-error.rs:20:9 | LL | fn thing_one() -> impl Future> { - | ------------------------------------ the expected opaque type + | ------------------------------------ the expected future ... LL | fn thing_two() -> impl Future> { - | ------------------------------------ the found opaque type + | ------------------------------------ the found future ... LL | / if true { LL | | thing_one() | | ----------- expected because of this LL | | } else { LL | | thing_two() - | | ^^^^^^^^^^^ expected opaque type, found a different opaque type + | | ^^^^^^^^^^^ expected future, found a different future LL | | }.await | |_____- `if` and `else` have incompatible types | - = note: expected opaque type `impl Future>` (opaque type at <$DIR/opaque-type-error.rs:8:19>) - found opaque type `impl Future>` (opaque type at <$DIR/opaque-type-error.rs:12:19>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/option-content-move2.stderr b/tests/ui/suggestions/option-content-move2.stderr index 1d3dff3be..94acda73c 100644 --- a/tests/ui/suggestions/option-content-move2.stderr +++ b/tests/ui/suggestions/option-content-move2.stderr @@ -7,7 +7,7 @@ LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` here LL | move || { - | ^^^^^^^ move out of `var` occurs here + | ^^^^^^^ `var` is moved here LL | LL | var = Some(NotCopyable); | --- diff --git a/tests/ui/suggestions/option-to-bool.stderr b/tests/ui/suggestions/option-to-bool.stderr index 4050c7be8..e042f07da 100644 --- a/tests/ui/suggestions/option-to-bool.stderr +++ b/tests/ui/suggestions/option-to-bool.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/option-to-bool.rs:4:16 | LL | if true && x {} - | ---- ^ expected `bool`, found enum `Option` + | ---- ^ expected `bool`, found `Option` | | | expected because this is `bool` | diff --git a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr index 9588eedc9..fee83eb5c 100644 --- a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:10:20 | LL | let _: usize = S {}; - | ----- ^^^^ expected `usize`, found struct `S` + | ----- ^^^^ expected `usize`, found `S` | | | expected due to this @@ -30,7 +30,7 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:12:20 | LL | let _: usize = X {}; - | ----- ^^^^ expected `usize`, found struct `X` + | ----- ^^^^ expected `usize`, found `X` | | | expected due to this diff --git a/tests/ui/suggestions/recover-invalid-float-invalid.rs b/tests/ui/suggestions/recover-invalid-float-invalid.rs new file mode 100644 index 000000000..79430d8c0 --- /dev/null +++ b/tests/ui/suggestions/recover-invalid-float-invalid.rs @@ -0,0 +1,24 @@ +// Check that suggestions to add a zero to integers with a preceding dot only appear when the change +// will result in a valid floating point literal. + +fn main() {} + +fn a() { + _ = .3u32; + //~^ ERROR expected expression, found `.` +} + +fn b() { + _ = .0b0; + //~^ ERROR expected expression, found `.` +} + +fn c() { + _ = .0o07; + //~^ ERROR expected expression, found `.` +} + +fn d() { + _ = .0x0ABC; + //~^ ERROR expected expression, found `.` +} diff --git a/tests/ui/suggestions/recover-invalid-float-invalid.stderr b/tests/ui/suggestions/recover-invalid-float-invalid.stderr new file mode 100644 index 000000000..5764afc1a --- /dev/null +++ b/tests/ui/suggestions/recover-invalid-float-invalid.stderr @@ -0,0 +1,26 @@ +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:7:9 + | +LL | _ = .3u32; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:12:9 + | +LL | _ = .0b0; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:17:9 + | +LL | _ = .0o07; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:22:9 + | +LL | _ = .0x0ABC; + | ^ expected expression + +error: aborting due to 4 previous errors + diff --git a/tests/ui/suggestions/ref-pattern-binding.stderr b/tests/ui/suggestions/ref-pattern-binding.stderr index 10447ba70..7b1942593 100644 --- a/tests/ui/suggestions/ref-pattern-binding.stderr +++ b/tests/ui/suggestions/ref-pattern-binding.stderr @@ -19,8 +19,8 @@ error: cannot move out of value because it is borrowed LL | let ref _moved @ _from = String::from("foo"); | ----------^^^----- | | | - | | value moved into `_from` here - | value borrowed, by `_moved`, here + | | value is moved into `_from` here + | value is borrowed by `_moved` here error: cannot move out of value because it is borrowed --> $DIR/ref-pattern-binding.rs:15:9 @@ -28,8 +28,8 @@ error: cannot move out of value because it is borrowed LL | let ref _moved @ S { f } = S { f: String::from("foo") }; | ----------^^^^^^^-^^ | | | - | | value moved into `f` here - | value borrowed, by `_moved`, here + | | value is moved into `f` here + | value is borrowed by `_moved` here error: borrow of moved value --> $DIR/ref-pattern-binding.rs:18:9 diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.rs b/tests/ui/suggestions/restrict-existing-type-bounds.rs new file mode 100644 index 000000000..07712ce0d --- /dev/null +++ b/tests/ui/suggestions/restrict-existing-type-bounds.rs @@ -0,0 +1,30 @@ +pub trait TryAdd { + type Error; + type Output; + + fn try_add(self, rhs: Rhs) -> Result; +} + +impl TryAdd for Option { + type Error = ::Error; + type Output = Option<::Output>; + + fn try_add(self, rhs: Self) -> Result { + Ok(self) //~ ERROR mismatched types + } +} + +struct Other(A); + +struct X; + +impl> TryAdd for Other { + type Error = ::Error; + type Output = Other<::Output>; + + fn try_add(self, rhs: Self) -> Result { + Ok(self) //~ ERROR mismatched types + } +} + +fn main() {} diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr new file mode 100644 index 000000000..14a244b79 --- /dev/null +++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr @@ -0,0 +1,57 @@ +error[E0308]: mismatched types + --> $DIR/restrict-existing-type-bounds.rs:13:12 + | +LL | impl TryAdd for Option { + | - this type parameter +... +LL | Ok(self) + | -- ^^^^ expected `Option<::Output>`, found `Option` + | | + | arguments to this enum variant are incorrect + | + = note: expected enum `Option<::Output>` + found enum `Option` +help: the type constructed contains `Option` due to the type of the argument passed + --> $DIR/restrict-existing-type-bounds.rs:13:9 + | +LL | Ok(self) + | ^^^----^ + | | + | this argument influences the type of `Ok` +note: tuple variant defined here + --> $SRC_DIR/core/src/result.rs:LL:COL +help: consider further restricting this bound + | +LL | impl> TryAdd for Option { + | ++++++++++++ + +error[E0308]: mismatched types + --> $DIR/restrict-existing-type-bounds.rs:26:12 + | +LL | impl> TryAdd for Other { + | - this type parameter +... +LL | Ok(self) + | -- ^^^^ expected `Other<::Output>`, found `Other` + | | + | arguments to this enum variant are incorrect + | + = note: expected struct `Other<::Output>` + found struct `Other` +help: the type constructed contains `Other` due to the type of the argument passed + --> $DIR/restrict-existing-type-bounds.rs:26:9 + | +LL | Ok(self) + | ^^^----^ + | | + | this argument influences the type of `Ok` +note: tuple variant defined here + --> $SRC_DIR/core/src/result.rs:LL:COL +help: consider further restricting this bound + | +LL | impl> TryAdd for Other { + | ++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/return-bindings.stderr b/tests/ui/suggestions/return-bindings.stderr index c14fb3367..6f906c27b 100644 --- a/tests/ui/suggestions/return-bindings.stderr +++ b/tests/ui/suggestions/return-bindings.stderr @@ -18,7 +18,7 @@ LL | let s: String = if let Some(s) = opt_str { | ______________________________________________^ LL | | LL | | } else { - | |_____^ expected struct `String`, found `()` + | |_____^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -31,7 +31,7 @@ error[E0308]: mismatched types --> $DIR/return-bindings.rs:14:11 | LL | fn c() -> Option { - | - ^^^^^^^^^^^ expected enum `Option`, found `()` + | - ^^^^^^^^^^^ expected `Option`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | @@ -50,7 +50,7 @@ LL | let s: String = if let Some(s) = opt_str { | ______________________________________________^ LL | | LL | | } else { - | |_____^ expected struct `String`, found `()` + | |_____^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -67,7 +67,7 @@ LL | let s = if let Some(s) = opt_str { LL | | } else { | |_____- expected because of this LL | String::new() - | ^^^^^^^^^^^^^ expected `()`, found struct `String` + | ^^^^^^^^^^^^^ expected `()`, found `String` | help: consider returning the local binding `s` | @@ -80,7 +80,7 @@ error[E0308]: mismatched types --> $DIR/return-bindings.rs:37:20 | LL | Some(s) => {} - | ^^ expected struct `String`, found `()` + | ^^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -95,7 +95,7 @@ LL | let s = match opt_str { LL | | Some(s) => {} | | -- this is found to be of type `()` LL | | None => String::new(), - | | ^^^^^^^^^^^^^ expected `()`, found struct `String` + | | ^^^^^^^^^^^^^ expected `()`, found `String` LL | | LL | | }; | |_____- `match` arms have incompatible types diff --git a/tests/ui/suggestions/shadowed-lplace-method-2.stderr b/tests/ui/suggestions/shadowed-lplace-method-2.stderr index 94eef15f3..295636098 100644 --- a/tests/ui/suggestions/shadowed-lplace-method-2.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method-2.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/shadowed-lplace-method-2.rs:22:17 | LL | *x.foo(0) = (); - | --------- ^^ expected struct `X`, found `()` + | --------- ^^ expected `X`, found `()` | | | expected due to the type of this binding | diff --git a/tests/ui/suggestions/shadowed-lplace-method.stderr b/tests/ui/suggestions/shadowed-lplace-method.stderr index 91d0d1200..33824c4cb 100644 --- a/tests/ui/suggestions/shadowed-lplace-method.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/shadowed-lplace-method.rs:9:24 | LL | *rc.borrow_mut() = false; - | ---------------- ^^^^^ expected struct `Rc`, found `bool` + | ---------------- ^^^^^ expected `Rc>`, found `bool` | | | expected due to the type of this binding | diff --git a/tests/ui/suggestions/sugg-else-for-closure.stderr b/tests/ui/suggestions/sugg-else-for-closure.stderr index 7f05832bc..09553b93c 100644 --- a/tests/ui/suggestions/sugg-else-for-closure.stderr +++ b/tests/ui/suggestions/sugg-else-for-closure.stderr @@ -15,7 +15,7 @@ LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap()); | ^^^^^^^^^^^^-------------------------------^ | | | this argument influences the return type of `unwrap_or` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: try calling `unwrap_or_else` instead | diff --git a/tests/ui/suggestions/suggest-box.stderr b/tests/ui/suggestions/suggest-box.stderr index 2bdaa4e97..9a4e9fef4 100644 --- a/tests/ui/suggestions/suggest-box.stderr +++ b/tests/ui/suggestions/suggest-box.stderr @@ -8,7 +8,7 @@ LL | let _x: Box Result<(), ()>> = || { LL | | Err(())?; LL | | Ok(()) LL | | }; - | |_____^ expected struct `Box`, found closure + | |_____^ expected `Box Result<(), ()>>`, found closure | = note: expected struct `Box Result<(), ()>>` found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]` diff --git a/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs b/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs new file mode 100644 index 000000000..657dd9c22 --- /dev/null +++ b/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs @@ -0,0 +1,16 @@ +enum E { + One(i32, i32), +} + +fn main() { + let var = E::One; + if let E::One(var1, var2) = var { + //~^ ERROR mismatched types + //~| HELP use parentheses to construct this tuple variant + println!("{var1} {var2}"); + } + + let Some(x) = Some; + //~^ ERROR mismatched types + //~| HELP use parentheses to construct this tuple variant +} diff --git a/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr b/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr new file mode 100644 index 000000000..7338312ba --- /dev/null +++ b/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/suggest-call-on-pat-mismatch.rs:7:12 + | +LL | if let E::One(var1, var2) = var { + | ^^^^^^^^^^^^^^^^^^ --- this expression has type `fn(i32, i32) -> E {E::One}` + | | + | expected enum constructor, found `E` + | + = note: expected enum constructor `fn(i32, i32) -> E {E::One}` + found enum `E` +help: use parentheses to construct this tuple variant + | +LL | if let E::One(var1, var2) = var(/* i32 */, /* i32 */) { + | ++++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/suggest-call-on-pat-mismatch.rs:13:9 + | +LL | let Some(x) = Some; + | ^^^^^^^ ---- this expression has type `fn(_) -> Option<_> {Option::<_>::Some}` + | | + | expected enum constructor, found `Option<_>` + | + = note: expected enum constructor `fn(_) -> Option<_> {Option::<_>::Some}` + found enum `Option<_>` +help: use parentheses to construct this tuple variant + | +LL | let Some(x) = Some(/* value */); + | +++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed new file mode 100644 index 000000000..abb9ef917 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed @@ -0,0 +1,12 @@ +// run-rustfix + +#![allow(unused)] + +struct Wrapper(T); + +fn bar() -> Wrapper { Wrapper(foo) } +//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn foo() {} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs new file mode 100644 index 000000000..d2a79c386 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs @@ -0,0 +1,12 @@ +// run-rustfix + +#![allow(unused)] + +struct Wrapper(T); + +fn bar() -> _ { Wrapper(foo) } +//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn foo() {} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr new file mode 100644 index 000000000..347a03852 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr @@ -0,0 +1,12 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/suggest-fn-ptr-for-fn-item-in-fn-ret.rs:7:13 + | +LL | fn bar() -> _ { Wrapper(foo) } + | ^ + | | + | not allowed in type signatures + | help: replace with the correct return type: `Wrapper` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr b/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr index 9b6dba7e9..3fb3047d8 100644 --- a/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr +++ b/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28 | LL | let _: option::O<()> = (); - | ------------- ^^ expected enum `O`, found `()` + | ------------- ^^ expected `O<()>`, found `()` | | | expected due to this | diff --git a/tests/ui/suggestions/suggest-remove-deref.fixed b/tests/ui/suggestions/suggest-remove-deref.fixed new file mode 100644 index 000000000..4dc12da03 --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.fixed @@ -0,0 +1,28 @@ +// run-rustfix + +//issue #106496 + +struct S; + +trait X {} +impl X for S {} + +fn foo(_: &T) {} +fn test_foo() { + let hello = &S; + foo(hello); + //~^ ERROR mismatched types +} + +fn bar(_: &String) {} +fn test_bar() { + let v = String::from("hello"); + let s = &v; + bar(s); + //~^ ERROR mismatched types +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/tests/ui/suggestions/suggest-remove-deref.rs b/tests/ui/suggestions/suggest-remove-deref.rs new file mode 100644 index 000000000..c2d385cbd --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.rs @@ -0,0 +1,28 @@ +// run-rustfix + +//issue #106496 + +struct S; + +trait X {} +impl X for S {} + +fn foo(_: &T) {} +fn test_foo() { + let hello = &S; + foo(*hello); + //~^ ERROR mismatched types +} + +fn bar(_: &String) {} +fn test_bar() { + let v = String::from("hello"); + let s = &v; + bar(*s); + //~^ ERROR mismatched types +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/tests/ui/suggestions/suggest-remove-deref.stderr b/tests/ui/suggestions/suggest-remove-deref.stderr new file mode 100644 index 000000000..4253838eb --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.stderr @@ -0,0 +1,43 @@ +error[E0308]: mismatched types + --> $DIR/suggest-remove-deref.rs:13:9 + | +LL | foo(*hello); + | --- ^^^^^^ expected `&_`, found `S` + | | + | arguments to this function are incorrect + | + = note: expected reference `&_` + found struct `S` +note: function defined here + --> $DIR/suggest-remove-deref.rs:10:4 + | +LL | fn foo(_: &T) {} + | ^^^ ----- +help: consider removing deref here + | +LL - foo(*hello); +LL + foo(hello); + | + +error[E0308]: mismatched types + --> $DIR/suggest-remove-deref.rs:21:9 + | +LL | bar(*s); + | --- ^^ expected `&String`, found `String` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/suggest-remove-deref.rs:17:4 + | +LL | fn bar(_: &String) {} + | ^^^ ---------- +help: consider removing deref here + | +LL - bar(*s); +LL + bar(s); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs new file mode 100644 index 000000000..fbaf41245 --- /dev/null +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs @@ -0,0 +1,8 @@ +pub struct Bar(S); + +pub trait Foo {} + +impl Foo for Bar where for<'a> <&'a S>::Item: Foo {} +//~^ ERROR ambiguous associated type + +fn main() {} diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr new file mode 100644 index 000000000..0ca5b9b92 --- /dev/null +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr @@ -0,0 +1,9 @@ +error[E0223]: ambiguous associated type + --> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38 + | +LL | impl Foo for Bar where for<'a> <&'a S>::Item: Foo {} + | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/suggestions/suggest-using-chars.stderr b/tests/ui/suggestions/suggest-using-chars.stderr index 99bcfb08a..ba80ec6a2 100644 --- a/tests/ui/suggestions/suggest-using-chars.stderr +++ b/tests/ui/suggestions/suggest-using-chars.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `iter` found for reference `&'static str` in the c --> $DIR/suggest-using-chars.rs:2:19 | LL | let _ = "foo".iter(); - | ^^^^ method not found in `&'static str` + | ^^^^ method not found in `&str` | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | @@ -13,7 +13,7 @@ error[E0599]: no method named `foo` found for reference `&'static str` in the cu --> $DIR/suggest-using-chars.rs:3:19 | LL | let _ = "foo".foo(); - | ^^^ method not found in `&'static str` + | ^^^ method not found in `&str` error[E0599]: no method named `iter` found for struct `String` in the current scope --> $DIR/suggest-using-chars.rs:4:33 diff --git a/tests/ui/suggestions/trait-hidden-method.rs b/tests/ui/suggestions/trait-hidden-method.rs new file mode 100644 index 000000000..ae7ef47e1 --- /dev/null +++ b/tests/ui/suggestions/trait-hidden-method.rs @@ -0,0 +1,11 @@ +// #107983 - testing that `__iterator_get_unchecked` isn't suggested +// HELP included so that compiletest errors on the bad suggestion +pub fn i_can_has_iterator() -> impl Iterator { + //~^ ERROR expected `Box` + //~| HELP consider constraining the associated type + Box::new(1..=10) as Box + //~^ ERROR the value of the associated type `Item` + //~| HELP specify the associated type +} + +fn main() {} diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr new file mode 100644 index 000000000..a5a65d193 --- /dev/null +++ b/tests/ui/suggestions/trait-hidden-method.stderr @@ -0,0 +1,24 @@ +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/trait-hidden-method.rs:6:33 + | +LL | Box::new(1..=10) as Box + | ^^^^^^^^ help: specify the associated type: `Iterator` + +error[E0271]: expected `Box` to be an iterator that yields `u32`, but it yields `::Item` + --> $DIR/trait-hidden-method.rs:3:32 + | +LL | pub fn i_can_has_iterator() -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `u32` +... +LL | Box::new(1..=10) as Box + | ------------------------------------- return type was inferred to be `Box` here + | + = note: expected associated type `::Item` + found type `u32` + = help: consider constraining the associated type `::Item` to `u32` or calling a method that returns `::Item` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0191, E0271. +For more information about an error, try `rustc --explain E0191`. 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 f520d88c6..7deb9a434 100644 --- a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr +++ b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr @@ -90,7 +90,7 @@ LL | fn func(&self) -> Self::A; LL | fn funk(&self, _: Self::A); LL | fn funq(&self) -> Self::A {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq` -note: associated function defined here +note: method defined here --> $DIR/trait-with-missing-associated-type-restriction.rs:9:8 | LL | fn funk(&self, _: Self::A); diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index fcff02e09..4e3180e84 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -18,7 +18,7 @@ LL | let _: Vec = A::B; = note: see issue #52662 for more information = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable -error[E0107]: this struct takes at least 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 | LL | let _: Vec = A::B; diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.rs b/tests/ui/suggestions/type-mismatch-byte-literal.rs index 34199f8c3..80cd2ca7d 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.rs +++ b/tests/ui/suggestions/type-mismatch-byte-literal.rs @@ -12,7 +12,19 @@ fn main() { //~^ ERROR: mismatched types [E0308] //~| HELP: if you meant to write a byte literal, prefix with `b` + let _a: u8 = '\x20'; + //~^ ERROR: mismatched types [E0308] + //~| HELP: if you meant to write a byte literal, prefix with `b` + + // Do not issue the suggestion if the char literal is a Unicode escape + foo('\u{0080}'); + //~^ ERROR: mismatched types [E0308] + // Do not issue the suggestion if the char literal isn't ASCII let _t: u8 = '€'; //~^ ERROR: mismatched types [E0308] + + // Do not issue the suggestion if the char literal isn't ASCII + foo('\u{1f980}'); + //~^ ERROR: mismatched types [E0308] } diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index c9c2e7498..3d27149f0 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -30,13 +30,54 @@ LL | foo(b'#'); | ~~~~ error[E0308]: mismatched types - --> $DIR/type-mismatch-byte-literal.rs:16:18 + --> $DIR/type-mismatch-byte-literal.rs:15:18 + | +LL | let _a: u8 = '\x20'; + | -- ^^^^^^ expected `u8`, found `char` + | | + | expected due to this + | +help: if you meant to write a byte literal, prefix with `b` + | +LL | let _a: u8 = b'\x20'; + | ~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:20:9 + | +LL | foo('\u{0080}'); + | --- ^^^^^^^^^^ expected `u8`, found `char` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/type-mismatch-byte-literal.rs:4:4 + | +LL | fn foo(_t: u8) {} + | ^^^ ------ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:24:18 | LL | let _t: u8 = '€'; | -- ^^^ expected `u8`, found `char` | | | expected due to this -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:28:9 + | +LL | foo('\u{1f980}'); + | --- ^^^^^^^^^^^ expected `u8`, found `char` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/type-mismatch-byte-literal.rs:4:4 + | +LL | fn foo(_t: u8) {} + | ^^^ ------ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index 34eaa8322..8b48ee9f1 100644 --- a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18 | LL | let _: f64 = 0..10; - | --- ^^^^^ expected `f64`, found struct `Range` + | --- ^^^^^ expected `f64`, found `Range<{integer}>` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18 | LL | let _: f64 = 1..; - | --- ^^^ expected `f64`, found struct `RangeFrom` + | --- ^^^ expected `f64`, found `RangeFrom<{integer}>` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18 | LL | let _: f64 = ..10; - | --- ^^^^ expected `f64`, found struct `RangeTo` + | --- ^^^^ expected `f64`, found `RangeTo<{integer}>` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 | LL | let _: f64 = std::ops::Range { start: 0, end: 1 }; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `Range` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found `Range<{integer}>` | | | expected due to this | diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index 8b6e8cfd7..ed262fd39 100644 --- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -6,7 +6,7 @@ pub trait T { pub struct Foo { i: Box>, //~^ ERROR must be specified - //~| ERROR this trait takes 2 generic arguments but 4 generic arguments were supplied + //~| ERROR trait takes 2 generic arguments but 4 generic arguments were supplied } 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 75b919232..175a5fbba 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 @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 2 generic arguments but 4 generic arguments were supplied +error[E0107]: trait takes 2 generic arguments but 4 generic arguments were supplied --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 | LL | i: Box>, diff --git a/tests/ui/suppressed-error.rs b/tests/ui/suppressed-error.rs index 256ec1713..1e39be460 100644 --- a/tests/ui/suppressed-error.rs +++ b/tests/ui/suppressed-error.rs @@ -3,6 +3,6 @@ fn main() { //~^ ERROR mismatched types //~| expected unit type `()` //~| found tuple `(_, _)` -//~| expected `()`, found tuple +//~| expected `()`, found return x; } diff --git a/tests/ui/suppressed-error.stderr b/tests/ui/suppressed-error.stderr index c2874ae9a..11d70f8a4 100644 --- a/tests/ui/suppressed-error.stderr +++ b/tests/ui/suppressed-error.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let (x, y) = (); | ^^^^^^ -- this expression has type `()` | | - | expected `()`, found tuple + | expected `()`, found `(_, _)` | = note: expected unit type `()` found tuple `(_, _)` diff --git a/tests/ui/switched-expectations.stderr b/tests/ui/switched-expectations.stderr index 82fea0f14..744d8483b 100644 --- a/tests/ui/switched-expectations.stderr +++ b/tests/ui/switched-expectations.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/switched-expectations.rs:3:30 | LL | let ref string: String = var; - | ^^^ expected struct `String`, found `i32` + | ^^^ expected `String`, found `i32` error: aborting due to previous error diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr index 3ad4ed24c..fe490a600 100644 --- a/tests/ui/symbol-names/basic.legacy.stderr +++ b/tests/ui/symbol-names/basic.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN5basic4main17hcbad207c0eeb0b3bE) +error: symbol-name(_ZN5basic4main17he9f658e438f1cac0E) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic::main::hcbad207c0eeb0b3b) +error: demangling(basic::main::he9f658e438f1cac0) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr index 21bf21ee7..29b42f48d 100644 --- a/tests/ui/symbol-names/issue-60925.legacy.stderr +++ b/tests/ui/symbol-names/issue-60925.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h2f2efcf580c9b1eeE) +error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h13209029be24b923E) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(issue_60925::foo::Foo::foo::h2f2efcf580c9b1ee) +error: demangling(issue_60925::foo::Foo::foo::h13209029be24b923) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/tests/ui/sync/mutexguard-sync.rs b/tests/ui/sync/mutexguard-sync.rs new file mode 100644 index 000000000..b56418383 --- /dev/null +++ b/tests/ui/sync/mutexguard-sync.rs @@ -0,0 +1,13 @@ +// MutexGuard> must not be Sync, that would be unsound. +use std::sync::Mutex; +use std::cell::Cell; + +fn test_sync(_t: T) {} + +fn main() +{ + let m = Mutex::new(Cell::new(0i32)); + let guard = m.lock().unwrap(); + test_sync(guard); + //~^ ERROR `Cell` cannot be shared between threads safely [E0277] +} diff --git a/tests/ui/sync/mutexguard-sync.stderr b/tests/ui/sync/mutexguard-sync.stderr new file mode 100644 index 000000000..4dc557119 --- /dev/null +++ b/tests/ui/sync/mutexguard-sync.stderr @@ -0,0 +1,20 @@ +error[E0277]: `Cell` cannot be shared between threads safely + --> $DIR/mutexguard-sync.rs:11:15 + | +LL | test_sync(guard); + | --------- ^^^^^ `Cell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `Cell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead + = note: required for `MutexGuard<'_, Cell>` to implement `Sync` +note: required by a bound in `test_sync` + --> $DIR/mutexguard-sync.rs:5:17 + | +LL | fn test_sync(_t: T) {} + | ^^^^ required by this bound in `test_sync` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/sync/suggest-cell.rs b/tests/ui/sync/suggest-cell.rs new file mode 100644 index 000000000..3284eae7b --- /dev/null +++ b/tests/ui/sync/suggest-cell.rs @@ -0,0 +1,31 @@ +fn require_sync() {} +//~^ NOTE required by this bound in `require_sync` +//~| NOTE required by this bound in `require_sync` +//~| NOTE required by this bound in `require_sync` +//~| NOTE required by this bound in `require_sync` +//~| NOTE required by a bound in `require_sync` +//~| NOTE required by a bound in `require_sync` +//~| NOTE required by a bound in `require_sync` +//~| NOTE required by a bound in `require_sync` + +fn main() { + require_sync::>(); + //~^ ERROR `Cell<()>` cannot be shared between threads safely + //~| NOTE `Cell<()>` cannot be shared between threads safely + //~| NOTE if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` + + require_sync::>(); + //~^ ERROR `Cell` cannot be shared between threads safely + //~| NOTE `Cell` cannot be shared between threads safely + //~| NOTE if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU8` instead + + require_sync::>(); + //~^ ERROR `Cell` cannot be shared between threads safely + //~| NOTE `Cell` cannot be shared between threads safely + //~| NOTE if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead + + require_sync::>(); + //~^ ERROR `Cell` cannot be shared between threads safely + //~| NOTE `Cell` cannot be shared between threads safely + //~| NOTE if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicBool` instead +} diff --git a/tests/ui/sync/suggest-cell.stderr b/tests/ui/sync/suggest-cell.stderr new file mode 100644 index 000000000..c232c1ccd --- /dev/null +++ b/tests/ui/sync/suggest-cell.stderr @@ -0,0 +1,59 @@ +error[E0277]: `Cell<()>` cannot be shared between threads safely + --> $DIR/suggest-cell.rs:12:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^ `Cell<()>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Cell<()>` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` +note: required by a bound in `require_sync` + --> $DIR/suggest-cell.rs:1:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error[E0277]: `Cell` cannot be shared between threads safely + --> $DIR/suggest-cell.rs:17:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^ `Cell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Cell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicU8` instead +note: required by a bound in `require_sync` + --> $DIR/suggest-cell.rs:1:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error[E0277]: `Cell` cannot be shared between threads safely + --> $DIR/suggest-cell.rs:22:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^^ `Cell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Cell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead +note: required by a bound in `require_sync` + --> $DIR/suggest-cell.rs:1:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error[E0277]: `Cell` cannot be shared between threads safely + --> $DIR/suggest-cell.rs:27:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^^^ `Cell` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `Cell` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicBool` instead +note: required by a bound in `require_sync` + --> $DIR/suggest-cell.rs:1:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/sync/suggest-once-cell.rs b/tests/ui/sync/suggest-once-cell.rs new file mode 100644 index 000000000..82fca45b1 --- /dev/null +++ b/tests/ui/sync/suggest-once-cell.rs @@ -0,0 +1,12 @@ +#![feature(once_cell)] + +fn require_sync() {} +//~^ NOTE required by this bound in `require_sync` +//~| NOTE required by a bound in `require_sync` + +fn main() { + require_sync::>(); + //~^ ERROR `OnceCell<()>` cannot be shared between threads safely + //~| NOTE `OnceCell<()>` cannot be shared between threads safely + //~| NOTE use `std::sync::OnceLock` instead +} diff --git a/tests/ui/sync/suggest-once-cell.stderr b/tests/ui/sync/suggest-once-cell.stderr new file mode 100644 index 000000000..fadf05374 --- /dev/null +++ b/tests/ui/sync/suggest-once-cell.stderr @@ -0,0 +1,17 @@ +error[E0277]: `OnceCell<()>` cannot be shared between threads safely + --> $DIR/suggest-once-cell.rs:8:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^ `OnceCell<()>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `OnceCell<()>` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::OnceLock` instead +note: required by a bound in `require_sync` + --> $DIR/suggest-once-cell.rs:3:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/sync/suggest-ref-cell.rs b/tests/ui/sync/suggest-ref-cell.rs new file mode 100644 index 000000000..6b972ae09 --- /dev/null +++ b/tests/ui/sync/suggest-ref-cell.rs @@ -0,0 +1,12 @@ +#![feature(once_cell)] + +fn require_sync() {} +//~^ NOTE required by this bound in `require_sync` +//~| NOTE required by a bound in `require_sync` + +fn main() { + require_sync::>(); + //~^ ERROR `RefCell<()>` cannot be shared between threads safely + //~| NOTE `RefCell<()>` cannot be shared between threads safely + //~| NOTE use `std::sync::RwLock` instead +} diff --git a/tests/ui/sync/suggest-ref-cell.stderr b/tests/ui/sync/suggest-ref-cell.stderr new file mode 100644 index 000000000..9e8b8fcb4 --- /dev/null +++ b/tests/ui/sync/suggest-ref-cell.stderr @@ -0,0 +1,17 @@ +error[E0277]: `RefCell<()>` cannot be shared between threads safely + --> $DIR/suggest-ref-cell.rs:8:20 + | +LL | require_sync::>(); + | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<()>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell<()>` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead +note: required by a bound in `require_sync` + --> $DIR/suggest-ref-cell.rs:3:20 + | +LL | fn require_sync() {} + | ^^^^ required by this bound in `require_sync` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/tag-that-dare-not-speak-its-name.rs b/tests/ui/tag-that-dare-not-speak-its-name.rs index 36e22f0b5..0e76ec246 100644 --- a/tests/ui/tag-that-dare-not-speak-its-name.rs +++ b/tests/ui/tag-that-dare-not-speak-its-name.rs @@ -12,5 +12,5 @@ fn main() { //~^ ERROR mismatched types //~| expected type `char` //~| found enum `Option<_>` - //~| expected `char`, found enum `Option` + //~| expected `char`, found `Option<_>` } diff --git a/tests/ui/tag-that-dare-not-speak-its-name.stderr b/tests/ui/tag-that-dare-not-speak-its-name.stderr index 96bab1526..f53abe53b 100644 --- a/tests/ui/tag-that-dare-not-speak-its-name.stderr +++ b/tests/ui/tag-that-dare-not-speak-its-name.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 | LL | let x : char = last(y); - | ---- ^^^^^^^ expected `char`, found enum `Option` + | ---- ^^^^^^^ expected `char`, found `Option<_>` | | | expected due to this | diff --git a/tests/ui/terr-in-field.rs b/tests/ui/terr-in-field.rs index aa801fd0a..cfe350ef8 100644 --- a/tests/ui/terr-in-field.rs +++ b/tests/ui/terr-in-field.rs @@ -11,7 +11,7 @@ struct Bar { fn want_foo(f: Foo) {} fn have_bar(b: Bar) { want_foo(b); //~ ERROR mismatched types - //~| expected struct `Foo`, found struct `Bar` + //~| expected `Foo`, found `Bar` } fn main() {} diff --git a/tests/ui/terr-in-field.stderr b/tests/ui/terr-in-field.stderr index d2fda09c0..09df4b34b 100644 --- a/tests/ui/terr-in-field.stderr +++ b/tests/ui/terr-in-field.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/terr-in-field.rs:13:14 | LL | want_foo(b); - | -------- ^ expected struct `Foo`, found struct `Bar` + | -------- ^ expected `Foo`, found `Bar` | | | arguments to this function are incorrect | diff --git a/tests/ui/terr-sorts.stderr b/tests/ui/terr-sorts.stderr index 5a61a2fab..8f1975374 100644 --- a/tests/ui/terr-sorts.stderr +++ b/tests/ui/terr-sorts.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/terr-sorts.rs:10:14 | LL | want_foo(b); - | -------- ^ expected struct `Foo`, found struct `Box` + | -------- ^ expected `Foo`, found `Box` | | | arguments to this function are incorrect | diff --git a/tests/ui/thir-print/thir-flat.rs b/tests/ui/thir-print/thir-flat.rs new file mode 100644 index 000000000..8fa95ce62 --- /dev/null +++ b/tests/ui/thir-print/thir-flat.rs @@ -0,0 +1,4 @@ +// compile-flags: -Z unpretty=thir-flat +// check-pass + +pub fn main() {} diff --git a/tests/ui/thir-print/thir-flat.stdout b/tests/ui/thir-print/thir-flat.stdout new file mode 100644 index 000000000..910c0da27 --- /dev/null +++ b/tests/ui/thir-print/thir-flat.stdout @@ -0,0 +1,59 @@ +DefId(0:3 ~ thir_flat[45a6]::main): +Thir { + body_type: Fn( + ([]; c_variadic: false)->(), + ), + arms: [], + blocks: [ + Block { + targeted_by_break: false, + region_scope: Node(1), + opt_destruction_scope: None, + span: $DIR/thir-flat.rs:4:15: 4:17 (#0), + stmts: [], + expr: None, + safety_mode: Safe, + }, + ], + exprs: [ + Expr { + kind: Block { + block: b0, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat.rs:4:15: 4:17 (#0), + }, + Expr { + kind: Scope { + region_scope: Node(2), + lint_level: Explicit( + HirId(DefId(0:3 ~ thir_flat[45a6]::main).2), + ), + value: e0, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat.rs:4:15: 4:17 (#0), + }, + Expr { + kind: Scope { + region_scope: Destruction(2), + lint_level: Inherited, + value: e1, + }, + ty: (), + temp_lifetime: Some( + Node(2), + ), + span: $DIR/thir-flat.rs:4:15: 4:17 (#0), + }, + ], + stmts: [], + params: [], +} + diff --git a/tests/ui/thir-print/thir-tree-match.rs b/tests/ui/thir-print/thir-tree-match.rs new file mode 100644 index 000000000..a5511ec95 --- /dev/null +++ b/tests/ui/thir-print/thir-tree-match.rs @@ -0,0 +1,23 @@ +// check-pass +// compile-flags: -Zunpretty=thir-tree + +enum Bar { + First, + Second, + Third, +} + +enum Foo { + FooOne(Bar), + FooTwo, +} + +fn has_match(foo: Foo) -> bool { + match foo { + Foo::FooOne(Bar::First) => true, + Foo::FooOne(_) => false, + Foo::FooTwo => true, + } +} + +fn main() {} diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout new file mode 100644 index 000000000..d6174ec26 --- /dev/null +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -0,0 +1,342 @@ +DefId(0:16 ~ thir_tree_match[3c9a]::has_match): +params: [ + Param { + ty: Foo + ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0)) + self_kind: None + hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).1)) + param: Some( + Pat: { + ty: Foo + span: $DIR/thir-tree-match.rs:15:14: 15:17 (#0) + kind: PatKind { + Binding { + mutability: Not + name: "foo" + mode: ByValue + var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2)) + ty: Foo + is_primary: true + subpattern: None + } + } + } + ) + } +] +body: + Expr { + ty: bool + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) + kind: + Scope { + region_scope: Destruction(26) + lint_level: Inherited + value: + Expr { + ty: bool + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) + kind: + Scope { + region_scope: Node(26) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).26)) + value: + Expr { + ty: bool + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) + kind: + Block { + targeted_by_break: false + opt_destruction_scope: None + span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) + region_scope: Node(25) + safety_mode: Safe + stmts: [] + expr: + Expr { + ty: bool + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0) + kind: + Scope { + region_scope: Node(3) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).3)) + value: + Expr { + ty: bool + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0) + kind: + Match { + scrutinee: + Expr { + ty: Foo + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) + kind: + Scope { + region_scope: Node(4) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).4)) + value: + Expr { + ty: Foo + temp_lifetime: Some(Node(26)) + span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) + kind: + VarRef { + id: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).2)) + } + } + } + } + arms: [ + Arm { + pattern: + Pat: { + ty: Foo + span: $DIR/thir-tree-match.rs:17:9: 17:32 (#0) + kind: PatKind { + Variant { + adt_def: + AdtDef { + did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + flags: IS_ENUM + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + substs: [] + variant_index: 0 + subpatterns: [ + Pat: { + ty: Bar + span: $DIR/thir-tree-match.rs:17:21: 17:31 (#0) + kind: PatKind { + Variant { + adt_def: + AdtDef { + did: DefId(0:3 ~ thir_tree_match[3c9a]::Bar) + variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[3c9a]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[3c9a]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[3c9a]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[3c9a]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[3c9a]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[3c9a]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }] + flags: IS_ENUM + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3125160937860410723 } + substs: [] + variant_index: 0 + subpatterns: [] + } + } + } + ] + } + } + } + guard: None + body: + Expr { + ty: bool + temp_lifetime: Some(Node(13)) + span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) + kind: + Scope { + region_scope: Destruction(13) + lint_level: Inherited + value: + Expr { + ty: bool + temp_lifetime: Some(Node(13)) + span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) + kind: + Scope { + region_scope: Node(13) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).13)) + value: + Expr { + ty: bool + temp_lifetime: Some(Node(13)) + span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) + kind: + Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) }, neg: false) + + } + } + } + } + } + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).12)) + scope: Node(12) + span: $DIR/thir-tree-match.rs:17:9: 17:40 (#0) + } + Arm { + pattern: + Pat: { + ty: Foo + span: $DIR/thir-tree-match.rs:18:9: 18:23 (#0) + kind: PatKind { + Variant { + adt_def: + AdtDef { + did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + flags: IS_ENUM + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + substs: [] + variant_index: 0 + subpatterns: [ + Pat: { + ty: Bar + span: $DIR/thir-tree-match.rs:18:21: 18:22 (#0) + kind: PatKind { + Wild + } + } + ] + } + } + } + guard: None + body: + Expr { + ty: bool + temp_lifetime: Some(Node(19)) + span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) + kind: + Scope { + region_scope: Destruction(19) + lint_level: Inherited + value: + Expr { + ty: bool + temp_lifetime: Some(Node(19)) + span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) + kind: + Scope { + region_scope: Node(19) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).19)) + value: + Expr { + ty: bool + temp_lifetime: Some(Node(19)) + span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) + kind: + Literal( lit: Spanned { node: Bool(false), span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) }, neg: false) + + } + } + } + } + } + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).18)) + scope: Node(18) + span: $DIR/thir-tree-match.rs:18:9: 18:32 (#0) + } + Arm { + pattern: + Pat: { + ty: Foo + span: $DIR/thir-tree-match.rs:19:9: 19:20 (#0) + kind: PatKind { + Variant { + adt_def: + AdtDef { + did: DefId(0:10 ~ thir_tree_match[3c9a]::Foo) + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[3c9a]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[3c9a]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[3c9a]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[3c9a])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[3c9a]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[3c9a]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] + flags: IS_ENUM + repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 11573694388057581 } + substs: [] + variant_index: 1 + subpatterns: [] + } + } + } + guard: None + body: + Expr { + ty: bool + temp_lifetime: Some(Node(24)) + span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) + kind: + Scope { + region_scope: Destruction(24) + lint_level: Inherited + value: + Expr { + ty: bool + temp_lifetime: Some(Node(24)) + span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) + kind: + Scope { + region_scope: Node(24) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).24)) + value: + Expr { + ty: bool + temp_lifetime: Some(Node(24)) + span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) + kind: + Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) }, neg: false) + + } + } + } + } + } + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[3c9a]::has_match).23)) + scope: Node(23) + span: $DIR/thir-tree-match.rs:19:9: 19:28 (#0) + } + ] + } + } + } + } + } + } + } + } + } + } + + +DefId(0:17 ~ thir_tree_match[3c9a]::main): +params: [ +] +body: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) + kind: + Scope { + region_scope: Destruction(2) + lint_level: Inherited + value: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) + kind: + Scope { + region_scope: Node(2) + lint_level: Explicit(HirId(DefId(0:17 ~ thir_tree_match[3c9a]::main).2)) + value: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) + kind: + Block { + targeted_by_break: false + opt_destruction_scope: None + span: $DIR/thir-tree-match.rs:23:11: 23:13 (#0) + region_scope: Node(1) + safety_mode: Safe + stmts: [] + expr: [] + } + } + } + } + } + } + + diff --git a/tests/ui/thir-print/thir-tree.rs b/tests/ui/thir-print/thir-tree.rs new file mode 100644 index 000000000..32df7905a --- /dev/null +++ b/tests/ui/thir-print/thir-tree.rs @@ -0,0 +1,4 @@ +// compile-flags: -Z unpretty=thir-tree +// check-pass + +pub fn main() {} diff --git a/tests/ui/thir-print/thir-tree.stdout b/tests/ui/thir-print/thir-tree.stdout new file mode 100644 index 000000000..0a35d9fb7 --- /dev/null +++ b/tests/ui/thir-print/thir-tree.stdout @@ -0,0 +1,43 @@ +DefId(0:3 ~ thir_tree[8f1d]::main): +params: [ +] +body: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree.rs:4:15: 4:17 (#0) + kind: + Scope { + region_scope: Destruction(2) + lint_level: Inherited + value: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree.rs:4:15: 4:17 (#0) + kind: + Scope { + region_scope: Node(2) + lint_level: Explicit(HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2)) + value: + Expr { + ty: () + temp_lifetime: Some(Node(2)) + span: $DIR/thir-tree.rs:4:15: 4:17 (#0) + kind: + Block { + targeted_by_break: false + opt_destruction_scope: None + span: $DIR/thir-tree.rs:4:15: 4:17 (#0) + region_scope: Node(1) + safety_mode: Safe + stmts: [] + expr: [] + } + } + } + } + } + } + + diff --git a/tests/ui/thir-tree.rs b/tests/ui/thir-tree.rs deleted file mode 100644 index 32df7905a..000000000 --- a/tests/ui/thir-tree.rs +++ /dev/null @@ -1,4 +0,0 @@ -// compile-flags: -Z unpretty=thir-tree -// check-pass - -pub fn main() {} diff --git a/tests/ui/thir-tree.stdout b/tests/ui/thir-tree.stdout deleted file mode 100644 index 4b6915f77..000000000 --- a/tests/ui/thir-tree.stdout +++ /dev/null @@ -1,56 +0,0 @@ -DefId(0:3 ~ thir_tree[8f1d]::main): -Thir { - arms: [], - blocks: [ - Block { - targeted_by_break: false, - region_scope: Node(1), - opt_destruction_scope: None, - span: $DIR/thir-tree.rs:4:15: 4:17 (#0), - stmts: [], - expr: None, - safety_mode: Safe, - }, - ], - exprs: [ - Expr { - ty: (), - temp_lifetime: Some( - Node(2), - ), - span: $DIR/thir-tree.rs:4:15: 4:17 (#0), - kind: Block { - block: b0, - }, - }, - Expr { - ty: (), - temp_lifetime: Some( - Node(2), - ), - span: $DIR/thir-tree.rs:4:15: 4:17 (#0), - kind: Scope { - region_scope: Node(2), - lint_level: Explicit( - HirId(DefId(0:3 ~ thir_tree[8f1d]::main).2), - ), - value: e0, - }, - }, - Expr { - ty: (), - temp_lifetime: Some( - Node(2), - ), - span: $DIR/thir-tree.rs:4:15: 4:17 (#0), - kind: Scope { - region_scope: Destruction(2), - lint_level: Inherited, - value: e1, - }, - }, - ], - stmts: [], - params: [], -} - diff --git a/tests/ui/thread-local/tls.rs b/tests/ui/thread-local/tls.rs index fbd341388..f03bd3f99 100644 --- a/tests/ui/thread-local/tls.rs +++ b/tests/ui/thread-local/tls.rs @@ -1,6 +1,7 @@ // run-pass // ignore-emscripten no threads support // compile-flags: -O +// ignore-nto Doesn't work without emulated TLS enabled (in LLVM) #![feature(thread_local)] diff --git a/tests/ui/tool-attributes/auxiliary/p1.rs b/tests/ui/tool-attributes/auxiliary/p1.rs new file mode 100644 index 000000000..47195c7e9 --- /dev/null +++ b/tests/ui/tool-attributes/auxiliary/p1.rs @@ -0,0 +1,3 @@ +#![feature(rustc_attrs)] +#[rustc_diagnostic_item = "Foo"] +pub struct Foo {} diff --git a/tests/ui/tool-attributes/auxiliary/p2.rs b/tests/ui/tool-attributes/auxiliary/p2.rs new file mode 100644 index 000000000..47195c7e9 --- /dev/null +++ b/tests/ui/tool-attributes/auxiliary/p2.rs @@ -0,0 +1,3 @@ +#![feature(rustc_attrs)] +#[rustc_diagnostic_item = "Foo"] +pub struct Foo {} diff --git a/tests/ui/tool-attributes/duplicate-diagnostic.rs b/tests/ui/tool-attributes/duplicate-diagnostic.rs new file mode 100644 index 000000000..e2cf95087 --- /dev/null +++ b/tests/ui/tool-attributes/duplicate-diagnostic.rs @@ -0,0 +1,13 @@ +// aux-build: p1.rs +// aux-build: p2.rs + +// error-pattern: duplicate diagnostic item in crate `p2` +// error-pattern: note: the diagnostic item is first defined in crate `p1` + +#![feature(rustc_attrs)] +extern crate p1; +extern crate p2; + +#[rustc_diagnostic_item = "Foo"] +pub struct Foo {} //~ ERROR duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo` +fn main() {} diff --git a/tests/ui/tool-attributes/duplicate-diagnostic.stderr b/tests/ui/tool-attributes/duplicate-diagnostic.stderr new file mode 100644 index 000000000..26bd6a82e --- /dev/null +++ b/tests/ui/tool-attributes/duplicate-diagnostic.stderr @@ -0,0 +1,14 @@ +error: duplicate diagnostic item in crate `p2`: `Foo`. + | + = note: the diagnostic item is first defined in crate `p1`. + +error: duplicate diagnostic item in crate `duplicate_diagnostic`: `Foo`. + --> $DIR/duplicate-diagnostic.rs:12:1 + | +LL | pub struct Foo {} + | ^^^^^^^^^^^^^^ + | + = note: the diagnostic item is first defined in crate `p2`. + +error: aborting due to 2 previous errors + diff --git a/tests/ui/track-diagnostics/track4.stderr b/tests/ui/track-diagnostics/track4.stderr index c4668444c..9ebf222ee 100644 --- a/tests/ui/track-diagnostics/track4.stderr +++ b/tests/ui/track-diagnostics/track4.stderr @@ -3,7 +3,7 @@ error: missing `struct` for struct definition | LL | pub onion { | ^ --Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/diagnostics.rs:LL:CC +-Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/item.rs:LL:CC | help: add `struct` here to parse `onion` as a public struct | diff --git a/tests/ui/traits/alias/ambiguous.stderr b/tests/ui/traits/alias/ambiguous.stderr index 0fe1a7967..203bdc526 100644 --- a/tests/ui/traits/alias/ambiguous.stderr +++ b/tests/ui/traits/alias/ambiguous.stderr @@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `u8` | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 +help: disambiguate the method for candidate #1 | LL | A::foo(&t); | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 +help: disambiguate the method for candidate #2 | LL | B::foo(&t); | ~~~~~~~~~~ diff --git a/tests/ui/traits/alias/issue-107747-do-not-assemble-supertraits.rs b/tests/ui/traits/alias/issue-107747-do-not-assemble-supertraits.rs new file mode 100644 index 000000000..9b41a8096 --- /dev/null +++ b/tests/ui/traits/alias/issue-107747-do-not-assemble-supertraits.rs @@ -0,0 +1,21 @@ +// Regression test for #107747: methods from trait alias supertraits were brought into scope +// +// check-pass + +#![feature(trait_alias)] + +use std::fmt; + +trait Foo: fmt::Debug {} +trait Bar = Foo; + +#[derive(Debug)] +struct Qux(bool); + +impl fmt::Display for Qux { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} + +fn main() {} diff --git a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.rs b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.rs new file mode 100644 index 000000000..d254c0ae3 --- /dev/null +++ b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.rs @@ -0,0 +1,11 @@ +// Regression test for #108072: do not ICE upon unmet trait alias constraint + +#![feature(trait_alias)] + +trait IteratorAlias = Iterator; + +fn f(_: impl IteratorAlias) {} + +fn main() { + f(()) //~ `()` is not an iterator +} diff --git a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr new file mode 100644 index 000000000..39f974f96 --- /dev/null +++ b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr @@ -0,0 +1,19 @@ +error[E0277]: `()` is not an iterator + --> $DIR/issue-108072-unmet-trait-alias-bound.rs:10:7 + | +LL | f(()) + | - ^^ `()` is not an iterator + | | + | required by a bound introduced by this call + | + = help: the trait `Iterator` is not implemented for `()` + = note: required for `()` to implement `IteratorAlias` +note: required by a bound in `f` + --> $DIR/issue-108072-unmet-trait-alias-bound.rs:7:14 + | +LL | fn f(_: impl IteratorAlias) {} + | ^^^^^^^^^^^^^ required by this bound in `f` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs new file mode 100644 index 000000000..0b1f9ab57 --- /dev/null +++ b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs @@ -0,0 +1,15 @@ +// Regression test for #108132: do not ICE upon unmet trait alias constraint in generic impl + +#![feature(trait_alias)] + +trait IteratorAlias = Iterator; + +struct Foo(I); + +impl Foo { + fn f() {} +} + +fn main() { + Foo::<()>::f() //~ trait bounds were not satisfied +} diff --git a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr new file mode 100644 index 000000000..f1b259d5a --- /dev/null +++ b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr @@ -0,0 +1,25 @@ +error[E0599]: the function or associated item `f` exists for struct `Foo<()>`, but its trait bounds were not satisfied + --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:14:16 + | +LL | struct Foo(I); + | ------------- function or associated item `f` not found for this struct +... +LL | Foo::<()>::f() + | ^ function or associated item cannot be called on `Foo<()>` due to unsatisfied trait bounds + | +note: trait bound `(): Iterator` was not satisfied + --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:5:23 + | +LL | trait IteratorAlias = Iterator; + | ------------- ^^^^^^^^ unsatisfied trait bound introduced here +note: trait bound `(): IteratorAlias` was not satisfied + --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:9:9 + | +LL | impl Foo { + | ^^^^^^^^^^^^^ ------ + | | + | unsatisfied trait bound introduced here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/traits/alias/issue-60755.rs b/tests/ui/traits/alias/issue-60755.rs new file mode 100644 index 000000000..6b955a752 --- /dev/null +++ b/tests/ui/traits/alias/issue-60755.rs @@ -0,0 +1,12 @@ +// check-pass + +#![feature(trait_alias)] + +struct MyStruct {} +trait MyFn = Fn(&MyStruct); + +fn foo(_: impl MyFn) {} + +fn main() { + foo(|_| {}); +} diff --git a/tests/ui/traits/alias/self-in-generics.rs b/tests/ui/traits/alias/self-in-generics.rs index 0bb6335f9..dcb33b7a9 100644 --- a/tests/ui/traits/alias/self-in-generics.rs +++ b/tests/ui/traits/alias/self-in-generics.rs @@ -1,9 +1,5 @@ // astconv uses `FreshTy(0)` as a dummy `Self` type when instanciating trait objects. // This `FreshTy(0)` can leak into substs, causing ICEs in several places. -// Using `save-analysis` triggers type-checking `f` that would be normally skipped -// as `type_of` emitted an error. -// -// compile-flags: -Zsave-analysis #![feature(trait_alias)] diff --git a/tests/ui/traits/alias/self-in-generics.stderr b/tests/ui/traits/alias/self-in-generics.stderr index 110d60e6e..80af4e5aa 100644 --- a/tests/ui/traits/alias/self-in-generics.stderr +++ b/tests/ui/traits/alias/self-in-generics.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait alias `SelfInput` cannot be made into an object - --> $DIR/self-in-generics.rs:12:19 + --> $DIR/self-in-generics.rs:8:19 | LL | pub fn f(_f: &dyn SelfInput) {} | ^^^^^^^^^ diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-3.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-3.stderr index ade552c4b..c7af71a42 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-3.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-3.stderr @@ -1,6 +1,8 @@ error[E0597]: `s` does not live long enough --> $DIR/check-trait-object-bounds-3.rs:15:34 | +LL | let s = String::from("abcdef"); + | - binding `s` declared here LL | z = f::>(&s); | ---------------------^^- | | | diff --git a/tests/ui/traits/coercion-generic-regions.stderr b/tests/ui/traits/coercion-generic-regions.stderr index 5cfb64901..ae70202ab 100644 --- a/tests/ui/traits/coercion-generic-regions.stderr +++ b/tests/ui/traits/coercion-generic-regions.stderr @@ -1,6 +1,8 @@ error[E0597]: `person` does not live long enough --> $DIR/coercion-generic-regions.rs:17:24 | +LL | let person = "Fred".to_string(); + | ------ binding `person` declared here LL | let person: &str = &person; | ^^^^^^^ | | diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index 3ec288d13..dc967d512 100644 --- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -4,7 +4,7 @@ error[E0568]: auto traits cannot have super traits or lifetime bounds LL | auto trait Magic: Copy {} | -----^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits or lifetime bounds + | auto traits cannot have super traits or lifetime bounds error[E0277]: the trait bound `NoClone: Copy` is not satisfied --> $DIR/supertrait-auto-trait.rs:16:23 diff --git a/tests/ui/traits/issue-103563.rs b/tests/ui/traits/issue-103563.rs new file mode 100644 index 000000000..cd3eea09b --- /dev/null +++ b/tests/ui/traits/issue-103563.rs @@ -0,0 +1,75 @@ +// build-pass + +fn main() { + let mut log_service = LogService { inner: Inner }; + log_service.call(()); +} + +pub trait Service { + type Response; + + fn call(&mut self, req: Request) -> Self::Response; +} + +pub struct LogService { + inner: S, +} + +impl Service for LogService +where + S: Service, + U: Extension + 'static, + for<'a> U::Item<'a>: std::fmt::Debug, +{ + type Response = S::Response; + + fn call(&mut self, req: T) -> Self::Response { + self.inner.call(req) + } +} + +pub struct Inner; + +impl Service<()> for Inner { + type Response = Resp; + + fn call(&mut self, req: ()) -> Self::Response { + Resp::A(req) + } +} + +pub trait Extension { + type Item<'a>; + + fn touch(self, f: F) -> Self + where + for<'a> F: Fn(Self::Item<'a>); +} + +pub enum Resp { + A(()), +} + +impl Extension for Resp { + type Item<'a> = RespItem<'a>; + fn touch(self, _f: F) -> Self + where + for<'a> F: Fn(Self::Item<'a>), + { + match self { + Self::A(a) => Self::A(a), + } + } +} + +pub enum RespItem<'a> { + A(&'a ()), +} + +impl<'a> std::fmt::Debug for RespItem<'a> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::A(arg0) => f.debug_tuple("A").field(arg0).finish(), + } + } +} diff --git a/tests/ui/traits/issue-52893.stderr b/tests/ui/traits/issue-52893.stderr index a11867c03..db807a388 100644 --- a/tests/ui/traits/issue-52893.stderr +++ b/tests/ui/traits/issue-52893.stderr @@ -5,7 +5,7 @@ LL | impl AddClass for Class

| - this type parameter ... LL | builder.push(output); - | ---- ^^^^^^ expected type parameter `F`, found struct `Class` + | ---- ^^^^^^ expected type parameter `F`, found `Class

` | | | arguments to this method are incorrect | @@ -18,7 +18,7 @@ LL | builder.push(output); | ^^^^^^^^^^^^^------^ | | | this argument influences the return type of `push` -note: associated function defined here +note: method defined here --> $DIR/issue-52893.rs:11:8 | LL | fn push(self, other: T) -> Self::PushRes; diff --git a/tests/ui/traits/issue-68295.stderr b/tests/ui/traits/issue-68295.stderr index cb6e6e076..671a97666 100644 --- a/tests/ui/traits/issue-68295.stderr +++ b/tests/ui/traits/issue-68295.stderr @@ -5,7 +5,7 @@ LL | fn crash(input: Matrix) -> Matrix | ----------------- expected `Matrix` because of return type ... LL | input.into_owned() - | ^^^^^^^^^^^^^^^^^^ expected `u32`, found associated type + | ^^^^^^^^^^^^^^^^^^ expected `Matrix`, found `Matrix` | = note: expected struct `Matrix<_, _, u32>` found struct `Matrix<_, _, <() as Allocator>::Buffer>` diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index 0b57a8212..d4fea05fe 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | opts.get(opt.as_ref()); | ^^^ ------------ type must be known at this point | | - | cannot infer type of the type parameter `Q` declared on the associated function `get` + | cannot infer type of the type parameter `Q` declared on the method `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow for String; @@ -23,7 +23,7 @@ error[E0283]: type annotations needed LL | opts.get(opt.as_ref()); | ^^^ ------ type must be known at this point | | - | cannot infer type of the type parameter `Q` declared on the associated function `get` + | cannot infer type of the type parameter `Q` declared on the method `get` | = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`: - impl AsRef for String; @@ -43,7 +43,7 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( | | | required by a bound introduced by this call | - = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: + = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate: - impl From for u32; - impl From for u32; - impl From for u32; diff --git a/tests/ui/traits/item-privacy.rs b/tests/ui/traits/item-privacy.rs index 38d06b967..a3e1a22e7 100644 --- a/tests/ui/traits/item-privacy.rs +++ b/tests/ui/traits/item-privacy.rs @@ -69,7 +69,7 @@ fn check_method() { S.c(); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope let c = &S as &dyn C; - c.a(); //~ ERROR associated function `a` is private + c.a(); //~ ERROR method `a` is private c.b(); // OK c.c(); // OK @@ -81,7 +81,7 @@ fn check_method() { //~^ ERROR no function or associated item named `b` found S::c(&S); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope - ::a(&S); //~ ERROR associated function `a` is private + ::a(&S); //~ ERROR method `a` is private ::b(&S); // OK C::c(&S); // OK } diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 293cfbda8..04995b3a1 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -32,14 +32,14 @@ help: the following trait is implemented but not in scope; perhaps add a `use` f LL | use method::B; | -error[E0624]: associated function `a` is private +error[E0624]: method `a` is private --> $DIR/item-privacy.rs:72:7 | LL | fn a(&self) { } - | ----------- private associated function defined here + | ----------- private method defined here ... LL | c.a(); - | ^ private associated function + | ^ private method error[E0599]: no function or associated item named `a` found for struct `S` in the current scope --> $DIR/item-privacy.rs:78:8 @@ -72,14 +72,14 @@ help: the following trait is implemented but not in scope; perhaps add a `use` f LL | use method::B; | -error[E0624]: associated function `a` is private +error[E0624]: method `a` is private --> $DIR/item-privacy.rs:84:14 | LL | fn a(&self) { } - | ----------- private associated function defined here + | ----------- private method defined here ... LL | ::a(&S); - | ^ private associated function + | ^ private method error[E0599]: no associated item named `A` found for struct `S` in the current scope --> $DIR/item-privacy.rs:97:8 diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr index 8e991ec01..55656f21e 100644 --- a/tests/ui/traits/method-private.stderr +++ b/tests/ui/traits/method-private.stderr @@ -1,11 +1,11 @@ -error[E0624]: associated function `method` is private +error[E0624]: method `method` is private --> $DIR/method-private.rs:19:9 | LL | fn method(&self) {} - | ---------------- private associated function defined here + | ---------------- private method defined here ... LL | foo.method(); - | ^^^^^^ private associated function + | ^^^^^^ private method | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr index 6e6172eea..e927f26e9 100644 --- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -29,7 +29,7 @@ note: required by a bound in `test` --> $DIR/multidispatch-convert-ambig-dest.rs:21:11 | LL | fn test(_: T, _: U) - | ---- required by a bound in this + | ---- required by a bound in this function LL | where T : Convert | ^^^^^^^^^^ required by this bound in `test` help: consider specifying the generic arguments diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index ce690b749..b680ce7f9 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -101,10 +101,10 @@ LL | fn is_send(_: T) {} | ^^^^ required by this bound in `is_send` error[E0277]: `main::TestType` cannot be sent between threads safely - --> $DIR/negated-auto-traits-error.rs:66:13 + --> $DIR/negated-auto-traits-error.rs:66:20 | LL | is_sync(Outer2(TestType)); - | ------- ^^^^^^^^^^^^^^^^ `main::TestType` cannot be sent between threads safely + | ------- ^^^^^^^^ `main::TestType` cannot be sent between threads safely | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/negative-impls/no-items.stderr b/tests/ui/traits/negative-impls/no-items.stderr index 67b94bba1..040d9d145 100644 --- a/tests/ui/traits/negative-impls/no-items.stderr +++ b/tests/ui/traits/negative-impls/no-items.stderr @@ -2,7 +2,7 @@ error[E0749]: negative impls cannot have any items --> $DIR/no-items.rs:8:5 | LL | type Foo = i32; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs b/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs new file mode 100644 index 000000000..dc726ba51 --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs @@ -0,0 +1,29 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +// check that a goal such as `alias-eq(::Assoc, ::Assoc)` +// succeeds with a constraint that `?0 = bool` + +// FIXME(deferred_projection_equality): add a test that this is true during coherence + +trait TraitA {} + +trait TraitB { + type Assoc; +} + +impl TraitA for (T, T::Assoc) {} + +impl TraitB for i32 { + type Assoc = u32; +} + +fn needs_a() {} + +fn bar() { + needs_a::<(T, ::Assoc<_>)>(); +} + +fn main() { + bar::(); +} diff --git a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs new file mode 100644 index 000000000..fd5d0e3b1 --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs @@ -0,0 +1,45 @@ +// compile-flags: -Ztrait-solver=next + +// check that when computing `alias-eq(<() as Foo>::Assoc, <() as Foo>::Assoc)` +// we do not infer `?0 = u8` via the `for (): Foo` impl or `?0 = u16` by +// relating substs as either could be a valid solution. + +trait Foo { + type Assoc; +} + +impl Foo for () +where + (): Foo, +{ + type Assoc = <() as Foo>::Assoc; +} + +impl Foo for () { + type Assoc = u8; +} + +impl Foo for () { + type Assoc = u16; +} + +fn output() -> <() as Foo>::Assoc +where + (): Foo, +{ + todo!() +} + +fn incomplete() +where + (): Foo, +{ + // `<() as Foo>::Assoc == <() as Foo<_, STOP>>::Assoc` + let _: <() as Foo>::Assoc = output::<_, T>(); + //~^ error: type annotations needed + + // let _: <() as Foo>::Assoc = output::(); // OK + // let _: <() as Foo>::Assoc = output::(); // OK +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.stderr b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.stderr new file mode 100644 index 000000000..a6712332c --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/alias_eq_dont_use_normalizes_to_if_substs_eq.rs:38:41 + | +LL | let _: <() as Foo>::Assoc = output::<_, T>(); + | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `output` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/alias_eq_simple.rs b/tests/ui/traits/new-solver/alias_eq_simple.rs new file mode 100644 index 000000000..6792cf3ce --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_simple.rs @@ -0,0 +1,22 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +// test that the new solver can handle `alias-eq(::Assoc, u32)` + +trait TraitA {} + +trait TraitB { + type Assoc; +} + +impl TraitA for (T, T::Assoc) {} + +impl TraitB for i32 { + type Assoc = u32; +} + +fn needs_a() {} + +fn main() { + needs_a::<(i32, u32)>(); +} diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs new file mode 100644 index 000000000..d4cc380fa --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs @@ -0,0 +1,20 @@ +// compile-flags: -Ztrait-solver=next + +// check that a `alias-eq(::Assoc, ::Assoc)` goal fails. + +// FIXME(deferred_projection_equality): add a test that this is true during coherence + +trait TraitB { + type Assoc; +} + +fn needs_a() -> T::Assoc { + unimplemented!() +} + +fn bar() { + let _: <_ as TraitB>::Assoc = needs_a::(); + //~^ error: type annotations needed +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr new file mode 100644 index 000000000..d063d8fce --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/alias_eq_substs_eq_not_intercrate.rs:16:12 + | +LL | let _: <_ as TraitB>::Assoc = needs_a::(); + | ^^^^^^^^^^^^^^^^^^^^ cannot infer type for associated type `<_ as TraitB>::Assoc` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/new-solver/async.fail.stderr new file mode 100644 index 000000000..b395c23ae --- /dev/null +++ b/tests/ui/traits/new-solver/async.fail.stderr @@ -0,0 +1,17 @@ +error[E0271]: expected `[async block@$DIR/async.rs:12:17: 12:25]` to be a future that resolves to `i32`, but it resolves to `()` + --> $DIR/async.rs:12:17 + | +LL | needs_async(async {}); + | ----------- ^^^^^^^^ expected `i32`, found `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `needs_async` + --> $DIR/async.rs:8:31 + | +LL | fn needs_async(_: impl Future) {} + | ^^^^^^^^^^^^ required by this bound in `needs_async` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/new-solver/async.rs b/tests/ui/traits/new-solver/async.rs new file mode 100644 index 000000000..195cc35ca --- /dev/null +++ b/tests/ui/traits/new-solver/async.rs @@ -0,0 +1,19 @@ +// compile-flags: -Ztrait-solver=next +// edition: 2021 +// revisions: pass fail +//[pass] check-pass + +use std::future::Future; + +fn needs_async(_: impl Future) {} + +#[cfg(fail)] +fn main() { + needs_async(async {}); + //[fail]~^ ERROR to be a future that resolves to `i32`, but it resolves to `()` +} + +#[cfg(pass)] +fn main() { + needs_async(async { 1i32 }); +} diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs new file mode 100644 index 000000000..ba473653e --- /dev/null +++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs @@ -0,0 +1,17 @@ +// compile-flags: -Ztrait-solver=next + +#![feature(fn_traits)] +#![feature(unboxed_closures)] +#![feature(tuple_trait)] + +use std::ops::Fn; +use std::marker::Tuple; + +fn foo, T: Tuple>(f: Option, t: T) { + let y = (f.unwrap()).call(t); +} + +fn main() { + foo:: str, _>(None, ()); + //~^ expected a `Fn<_>` closure, found `fn() -> str` +} diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr new file mode 100644 index 000000000..f7551739b --- /dev/null +++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr @@ -0,0 +1,18 @@ +error[E0277]: expected a `Fn<_>` closure, found `fn() -> str` + --> $DIR/builtin-fn-must-return-sized.rs:15:27 + | +LL | foo:: str, _>(None, ()); + | --------------------- ^^^^ expected an `Fn<_>` closure, found `fn() -> str` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<_>` is not implemented for `fn() -> str` +note: required by a bound in `foo` + --> $DIR/builtin-fn-must-return-sized.rs:10:11 + | +LL | fn foo, T: Tuple>(f: Option, t: T) { + | ^^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/elaborate-item-bounds.rs b/tests/ui/traits/new-solver/elaborate-item-bounds.rs new file mode 100644 index 000000000..076aefcf8 --- /dev/null +++ b/tests/ui/traits/new-solver/elaborate-item-bounds.rs @@ -0,0 +1,12 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Foo { + type Bar: Bar; +} + +trait Bar: Baz {} + +trait Baz {} + +fn main() {} diff --git a/tests/ui/traits/new-solver/fn-trait-closure.rs b/tests/ui/traits/new-solver/fn-trait-closure.rs index c0ecf1c91..bd65737ee 100644 --- a/tests/ui/traits/new-solver/fn-trait-closure.rs +++ b/tests/ui/traits/new-solver/fn-trait-closure.rs @@ -1,12 +1,5 @@ // compile-flags: -Ztrait-solver=next -// known-bug: unknown -// failure-status: 101 -// dont-check-compiler-stderr - -// This test will fail until we fix `FulfillmentCtxt::relationships`. That's -// because we create a type variable for closure upvar types, which is not -// constrained until after we try to do fallback on diverging type variables. -// Thus, we will call that function, which is unimplemented. +// check-pass fn require_fn(_: impl Fn() -> i32) {} diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr new file mode 100644 index 000000000..d94d41e35 --- /dev/null +++ b/tests/ui/traits/new-solver/generator.fail.stderr @@ -0,0 +1,64 @@ +error[E0277]: the trait bound `[generator@$DIR/generator.rs:18:21: 18:23]: Generator` 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` 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) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator` + +error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator>::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) {} + | ^^^^^^^^^ required by this bound in `needs_generator` + +error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator>::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) {} + | ^^^^^^^^^^ 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 new file mode 100644 index 000000000..364373ca8 --- /dev/null +++ b/tests/ui/traits/new-solver/generator.rs @@ -0,0 +1,32 @@ +// 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) {} + +#[cfg(fail)] +fn main() { + needs_generator(|| { + //[fail]~^ ERROR Generator` is not satisfied + //[fail]~| ERROR as Generator>::Yield == B` + //[fail]~| ERROR as Generator>::Return == C` + yield (); + }); +} + +#[cfg(pass)] +fn main() { + needs_generator(|_: A| { + let _: A = yield B; + C + }) +} diff --git a/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs b/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs new file mode 100644 index 000000000..c886aeeda --- /dev/null +++ b/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs @@ -0,0 +1,17 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Trait<'a> { + type Item: for<'b> Trait2<'b>; +} + +trait Trait2<'a> {} +impl Trait2<'_> for () {} + +fn needs_trait(_: Box Trait<'a> + ?Sized>) {} + +fn foo(x: Box Trait<'a, Item = ()>>) { + needs_trait(x); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/more-object-bound.rs b/tests/ui/traits/new-solver/more-object-bound.rs new file mode 100644 index 000000000..712759ef0 --- /dev/null +++ b/tests/ui/traits/new-solver/more-object-bound.rs @@ -0,0 +1,27 @@ +// compile-flags: -Ztrait-solver=next +// From #80800 + +trait SuperTrait { + type A; + type B; +} + +trait Trait: SuperTrait::B> {} + +fn transmute(x: A) -> B { + foo::>(x) + //~^ ERROR type annotations needed: cannot satisfy `dyn Trait: Trait` +} + +fn foo(x: T::A) -> B +where + T: Trait, +{ + x +} + +static X: u8 = 0; +fn main() { + let x = transmute::<&u8, &[u8; 1_000_000]>(&X); + println!("{:?}", x[100_000]); +} diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/new-solver/more-object-bound.stderr new file mode 100644 index 000000000..208fdecb0 --- /dev/null +++ b/tests/ui/traits/new-solver/more-object-bound.stderr @@ -0,0 +1,19 @@ +error[E0283]: type annotations needed: cannot satisfy `dyn Trait: Trait` + --> $DIR/more-object-bound.rs:12:5 + | +LL | foo::>(x) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: cannot satisfy `dyn Trait: Trait` +note: required by a bound in `foo` + --> $DIR/more-object-bound.rs:18:8 + | +LL | fn foo(x: T::A) -> B + | --- required by a bound in this function +LL | where +LL | T: Trait, + | ^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs new file mode 100644 index 000000000..46343241b --- /dev/null +++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs @@ -0,0 +1,40 @@ +// [no_self_infer] check-pass +// compile-flags: -Ztrait-solver=next +// revisions: self_infer no_self_infer + +// checks that the new solver is smart enough to infer `?0 = U` when solving: +// `normalizes-to( as Trait>::Assoc, u8)` +// with `normalizes-to( as Trait>::Assoc, u8)` in the paramenv even when +// there is a separate `Vec: Trait` bound in the paramenv. +// +// FIXME(-Ztrait-solver=next) +// This could also compile for `normalizes-to(::Assoc, u8)` but +// we currently immediately consider a goal ambiguous if the self type is an +// inference variable. + +trait Trait { + type Assoc; +} + +fn foo>(x: T) {} + +#[cfg(self_infer)] +fn unconstrained() -> T { + todo!() +} + +#[cfg(no_self_infer)] +fn unconstrained() -> Vec { + todo!() +} + +fn bar() +where + Vec: Trait, + Vec: Trait, +{ + foo(unconstrained()) + //[self_infer]~^ ERROR type annotations needed +} + +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 new file mode 100644 index 000000000..062832012 --- /dev/null +++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr @@ -0,0 +1,14 @@ +error[E0282]: 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` + | +help: consider specifying the generic argument + | +LL | foo::(unconstrained()) + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/object-unsafety.rs b/tests/ui/traits/new-solver/object-unsafety.rs new file mode 100644 index 000000000..7bdd863a7 --- /dev/null +++ b/tests/ui/traits/new-solver/object-unsafety.rs @@ -0,0 +1,20 @@ +// compile-flags: -Ztrait-solver=next + +trait Setup { + type From: Copy; +} + +fn copy(from: &U::From) -> U::From { + *from +} + +pub fn copy_any(t: &T) -> T { + copy::>(t) + //~^ ERROR the trait bound `dyn Setup: Setup` is not satisfied +} + +fn main() { + let x = String::from("Hello, world"); + let y = copy_any(&x); + println!("{y}"); +} diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/new-solver/object-unsafety.stderr new file mode 100644 index 000000000..198ac623d --- /dev/null +++ b/tests/ui/traits/new-solver/object-unsafety.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `dyn Setup: Setup` is not satisfied + --> $DIR/object-unsafety.rs:12:12 + | +LL | copy::>(t) + | ^^^^^^^^^^^^^^^^^ the trait `Setup` is not implemented for `dyn Setup` + | +note: required by a bound in `copy` + --> $DIR/object-unsafety.rs:7:12 + | +LL | fn copy(from: &U::From) -> U::From { + | ^^^^^ required by this bound in `copy` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | pub fn copy_any(t: &T) -> T where dyn Setup: Setup { + | ++++++++++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs b/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs new file mode 100644 index 000000000..bdf999ec5 --- /dev/null +++ b/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs @@ -0,0 +1,25 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Foo { + type Assoc; +} + +trait Bar {} + +impl Foo for T { + type Assoc = i32; +} + +impl Bar for T where T: Foo {} + +fn require_bar() {} + +fn foo() { + // Unlike the classic solver, `::Assoc = _` will still project + // down to `i32` even though there's a param-env candidate here, since we + // don't assemble any param-env projection candidates for `T: Foo` alone. + require_bar::(); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/pointee.rs b/tests/ui/traits/new-solver/pointee.rs new file mode 100644 index 000000000..fa6ee2e2d --- /dev/null +++ b/tests/ui/traits/new-solver/pointee.rs @@ -0,0 +1,23 @@ +// compile-flags: -Ztrait-solver=next +// check-pass +#![feature(ptr_metadata)] + +use std::ptr::{DynMetadata, Pointee}; + +trait Trait {} +struct MyDst(T); + +fn works() { + let _: ::Metadata = (); + let _: <[T] as Pointee>::Metadata = 1_usize; + let _: ::Metadata = 1_usize; + let _: as Pointee>::Metadata = give::>>(); + let _: as Pointee>::Metadata = (); + let _: <((((([u8],),),),),) as Pointee>::Metadata = 1_usize; +} + +fn give() -> U { + loop {} +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/pointer-like.rs b/tests/ui/traits/new-solver/pointer-like.rs new file mode 100644 index 000000000..3745a075e --- /dev/null +++ b/tests/ui/traits/new-solver/pointer-like.rs @@ -0,0 +1,14 @@ +// compile-flags: -Ztrait-solver=next + +#![feature(pointer_like_trait)] + +use std::marker::PointerLike; + +fn require_(_: impl PointerLike) {} + +fn main() { + require_(1usize); + require_(1u16); + //~^ ERROR `u16` needs to have the same alignment and size as a pointer + require_(&1i16); +} diff --git a/tests/ui/traits/new-solver/pointer-like.stderr b/tests/ui/traits/new-solver/pointer-like.stderr new file mode 100644 index 000000000..f695e6418 --- /dev/null +++ b/tests/ui/traits/new-solver/pointer-like.stderr @@ -0,0 +1,24 @@ +error[E0277]: `u16` needs to have the same alignment and size as a pointer + --> $DIR/pointer-like.rs:11:14 + | +LL | require_(1u16); + | -------- ^^^^ the trait `PointerLike` is not implemented for `u16` + | | + | required by a bound introduced by this call + | + = note: the trait bound `u16: PointerLike` is not satisfied +note: required by a bound in `require_` + --> $DIR/pointer-like.rs:7:21 + | +LL | fn require_(_: impl PointerLike) {} + | ^^^^^^^^^^^ required by this bound in `require_` +help: consider borrowing here + | +LL | require_(&1u16); + | + +LL | require_(&mut 1u16); + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/pointer-sized.rs b/tests/ui/traits/new-solver/pointer-sized.rs deleted file mode 100644 index 15681cd13..000000000 --- a/tests/ui/traits/new-solver/pointer-sized.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(pointer_sized_trait)] - -use std::marker::PointerSized; - -fn require_pointer_sized(_: impl PointerSized) {} - -fn main() { - require_pointer_sized(1usize); - require_pointer_sized(1u16); - //~^ ERROR `u16` needs to be a pointer-sized type - require_pointer_sized(&1i16); -} diff --git a/tests/ui/traits/new-solver/pointer-sized.stderr b/tests/ui/traits/new-solver/pointer-sized.stderr deleted file mode 100644 index b250b1331..000000000 --- a/tests/ui/traits/new-solver/pointer-sized.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: `u16` needs to be a pointer-sized type - --> $DIR/pointer-sized.rs:9:27 - | -LL | require_pointer_sized(1u16); - | --------------------- ^^^^ the trait `PointerSized` is not implemented for `u16` - | | - | required by a bound introduced by this call - | - = note: the trait bound `u16: PointerSized` is not satisfied -note: required by a bound in `require_pointer_sized` - --> $DIR/pointer-sized.rs:5:34 - | -LL | fn require_pointer_sized(_: impl PointerSized) {} - | ^^^^^^^^^^^^ required by this bound in `require_pointer_sized` -help: consider borrowing here - | -LL | require_pointer_sized(&1u16); - | + -LL | require_pointer_sized(&mut 1u16); - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/provisional-result-done.rs b/tests/ui/traits/new-solver/provisional-result-done.rs new file mode 100644 index 000000000..589d34dd7 --- /dev/null +++ b/tests/ui/traits/new-solver/provisional-result-done.rs @@ -0,0 +1,33 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +// This tests checks that we update results in the provisional cache when +// we pop a goal from the stack. +#![feature(auto_traits)] +auto trait Coinductive {} +struct Foo(T); +struct Bar(T); + +impl Coinductive for Foo +where + Bar: Coinductive +{} + +impl Coinductive for Bar +where + Foo: Coinductive, + Bar: ConstrainInfer, +{} + +trait ConstrainInfer {} +impl ConstrainInfer for Bar {} +impl ConstrainInfer for Foo {} + +fn impls() -> T { todo!() } + +fn constrain(_: T) {} + +fn main() { + // This should constrain `_` to `u8`. + impls::>(); +} diff --git a/tests/ui/traits/new-solver/temporary-ambiguity.rs b/tests/ui/traits/new-solver/temporary-ambiguity.rs new file mode 100644 index 000000000..18ee05457 --- /dev/null +++ b/tests/ui/traits/new-solver/temporary-ambiguity.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +// Checks that we don't explode when we assemble >1 candidate for a goal. + +struct Wrapper(T); + +trait Foo {} + +impl Foo for Wrapper {} + +impl Foo for Wrapper<()> {} + +fn needs_foo(_: impl Foo) {} + +fn main() { + let mut x = Default::default(); + let w = Wrapper(x); + needs_foo(w); + x = 1; + drop(x); +} diff --git a/tests/ui/traits/new-solver/try-example.rs b/tests/ui/traits/new-solver/try-example.rs new file mode 100644 index 000000000..e826f3a00 --- /dev/null +++ b/tests/ui/traits/new-solver/try-example.rs @@ -0,0 +1,28 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +use std::error::Error; + +fn main() -> Result<(), Box> { + let x: i32 = parse()?; + Ok(()) +} + +trait Parse {} + +impl Parse for i32 {} + +#[derive(Debug)] +struct ParseError; + +impl std::fmt::Display for ParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "ParseError") + } +} + +impl Error for ParseError {} + +fn parse() -> Result { + todo!() +} diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs new file mode 100644 index 000000000..cde2059ca --- /dev/null +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs @@ -0,0 +1,30 @@ +// compile-flags: -Ztrait-solver=next + +// When we're solving `::Assoc = i32`, we actually first solve +// `::Assoc = _#1t`, then unify `_#1t` with `i32`. That goal +// with the inference variable is ambiguous when there are >1 param-env +// candidates. + +// We don't unify the RHS of a projection goal eagerly when solving, both +// for caching reasons and partly to make sure that we don't make the new +// trait solver smarter than it should be. + +// This is (as far as I can tell) a forwards-compatible decision, but if you +// make this test go from fail to pass, be sure you understand the implications! + +trait Foo { + type Assoc; +} + +trait Bar {} + +impl Bar for T where T: Foo {} + +fn needs_bar() {} + +fn foo + Foo>() { + needs_bar::(); + //~^ ERROR type annotations needed: cannot satisfy `T: Bar` +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr new file mode 100644 index 000000000..fa5e780ee --- /dev/null +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr @@ -0,0 +1,16 @@ +error[E0283]: type annotations needed: cannot satisfy `T: Bar` + --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:5 + | +LL | needs_bar::(); + | ^^^^^^^^^^^^^^ + | + = note: cannot satisfy `T: Bar` +note: required by a bound in `needs_bar` + --> $DIR/two-projection-param-candidates-are-ambiguous.rs:23:17 + | +LL | fn needs_bar() {} + | ^^^ required by this bound in `needs_bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs b/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs new file mode 100644 index 000000000..bcfc747eb --- /dev/null +++ b/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs @@ -0,0 +1,8 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +struct Foo(*mut ()); + +unsafe impl Sync for Foo {} + +fn main() {} diff --git a/tests/ui/traits/new-solver/unsize-good.rs b/tests/ui/traits/new-solver/unsize-good.rs new file mode 100644 index 000000000..87ed9cfd1 --- /dev/null +++ b/tests/ui/traits/new-solver/unsize-good.rs @@ -0,0 +1,25 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +#![feature(unsized_tuple_coercion)] + +trait Foo {} + +impl Foo for i32 {} + +fn main() { + // Unsizing via struct + let _: Box = Box::new(1i32); + + // Slice unsizing + let y = [1, 2, 3]; + let _: &[i32] = &y; + + // Tuple unsizing + let hi = (1i32,); + let _: &(dyn Foo,) = &hi; + + // Dropping auto traits + let a: &(dyn Foo + Send) = &1; + let _: &dyn Foo = a; +} diff --git a/tests/ui/traits/new-solver/upcast-right-substs.rs b/tests/ui/traits/new-solver/upcast-right-substs.rs new file mode 100644 index 000000000..c19c82acf --- /dev/null +++ b/tests/ui/traits/new-solver/upcast-right-substs.rs @@ -0,0 +1,14 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +#![feature(trait_upcasting)] + +trait Foo: Bar + Bar {} + +trait Bar {} + +fn main() { + let x: &dyn Foo = todo!(); + let y: &dyn Bar = x; + let z: &dyn Bar = x; +} diff --git a/tests/ui/traits/new-solver/upcast-wrong-substs.rs b/tests/ui/traits/new-solver/upcast-wrong-substs.rs new file mode 100644 index 000000000..f2d04d932 --- /dev/null +++ b/tests/ui/traits/new-solver/upcast-wrong-substs.rs @@ -0,0 +1,13 @@ +// compile-flags: -Ztrait-solver=next + +#![feature(trait_upcasting)] + +trait Foo: Bar + Bar {} + +trait Bar {} + +fn main() { + let x: &dyn Foo = todo!(); + let y: &dyn Bar = x; + //~^ ERROR mismatched types +} diff --git a/tests/ui/traits/new-solver/upcast-wrong-substs.stderr b/tests/ui/traits/new-solver/upcast-wrong-substs.stderr new file mode 100644 index 000000000..8623f395f --- /dev/null +++ b/tests/ui/traits/new-solver/upcast-wrong-substs.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/upcast-wrong-substs.rs:11:30 + | +LL | let y: &dyn Bar = x; + | --------------- ^ expected trait `Bar`, found trait `Foo` + | | + | expected due to this + | + = note: expected reference `&dyn Bar` + found reference `&dyn Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs new file mode 100644 index 000000000..dfc800c8e --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs @@ -0,0 +1,23 @@ +#![feature(non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe + +pub fn foo() +where + for V: Sized, +{ +} + +pub fn bar() +where + for V: IntoIterator, +{ +} + +fn main() { + foo(); + //~^ ERROR the size for values of type `V` cannot be known at compilation time + + bar(); + //~^ ERROR the size for values of type `V` cannot be known at compilation time + //~| ERROR `V` is not an iterator +} diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr new file mode 100644 index 000000000..ed9b57cb1 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr @@ -0,0 +1,62 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad-sized-cond.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the size for values of type `V` cannot be known at compilation time + --> $DIR/bad-sized-cond.rs:17:5 + | +LL | foo(); + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `V` +note: required by a bound in `foo` + --> $DIR/bad-sized-cond.rs:6:15 + | +LL | pub fn foo() + | --- required by a bound in this function +LL | where +LL | for V: Sized, + | ^^^^^ required by this bound in `foo` + +error[E0277]: the size for values of type `V` cannot be known at compilation time + --> $DIR/bad-sized-cond.rs:20:5 + | +LL | bar(); + | ^^^ doesn't have a size known at compile-time + | + = 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 + | +LL | pub fn bar() + | --- required by a bound in this function +LL | where +LL | for V: IntoIterator, + | ^^^^^^^^^^^^ required by this bound in `bar` + +error[E0277]: `V` is not an iterator + --> $DIR/bad-sized-cond.rs:20:5 + | +LL | bar(); + | ^^^ `V` is not an iterator + | + = 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 + | +LL | pub fn bar() + | --- required by a bound in this function +LL | where +LL | for V: IntoIterator, + | ^^^^^^^^^^^^ required by this bound in `bar` + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/basic.rs b/tests/ui/traits/non_lifetime_binders/basic.rs new file mode 100644 index 000000000..a797aae65 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/basic.rs @@ -0,0 +1,19 @@ +// check-pass +// Basic test that show's we can succesfully typeck a `for` where clause. + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Trait {} + +impl Trait for T {} + +fn foo() +where + for T: Trait, +{ +} + +fn main() { + foo(); +} diff --git a/tests/ui/traits/non_lifetime_binders/basic.stderr b/tests/ui/traits/non_lifetime_binders/basic.stderr new file mode 100644 index 000000000..0fd16c5d0 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/basic.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/basic.rs:4:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/fail.rs b/tests/ui/traits/non_lifetime_binders/fail.rs new file mode 100644 index 000000000..460f68907 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/fail.rs @@ -0,0 +1,23 @@ +// Error reporting for where `for T: Trait` doesn't hold + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Trait {} + +fn fail() +where + for T: Trait, +{} + +fn auto_trait() +where + for T: Send, +{} + +fn main() { + fail(); + //~^ ERROR the trait bound `T: Trait` is not satisfied + auto_trait(); + //~^ ERROR `T` cannot be sent between threads safely +} diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr new file mode 100644 index 000000000..7bd02550f --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/fail.stderr @@ -0,0 +1,43 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/fail.rs:3:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `T: Trait` is not satisfied + --> $DIR/fail.rs:19:5 + | +LL | fail(); + | ^^^^ the trait `Trait` is not implemented for `T` + | +note: required by a bound in `fail` + --> $DIR/fail.rs:10:15 + | +LL | fn fail() + | ---- required by a bound in this function +LL | where +LL | for T: Trait, + | ^^^^^ required by this bound in `fail` + +error[E0277]: `T` cannot be sent between threads safely + --> $DIR/fail.rs:21:5 + | +LL | auto_trait(); + | ^^^^^^^^^^ `T` cannot be sent between threads safely + | + = help: the trait `Send` is not implemented for `T` +note: required by a bound in `auto_trait` + --> $DIR/fail.rs:15:15 + | +LL | fn auto_trait() + | ---------- required by a bound in this function +LL | where +LL | for T: Send, + | ^^^^ required by this bound in `auto_trait` + +error: aborting due to 2 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs new file mode 100644 index 000000000..3903bfe9b --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs @@ -0,0 +1,11 @@ +#![feature(non_lifetime_binders, generic_const_exprs)] +//~^ WARN the feature `non_lifetime_binders` is incomplete +//~| WARN the feature `generic_const_exprs` is incomplete + +fn foo() -> usize +where + for [i32; { let _: T = todo!(); 0 }]:, + //~^ ERROR cannot capture late-bound type parameter in a constant +{} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr new file mode 100644 index 000000000..fafff02de --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr @@ -0,0 +1,27 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/late-bound-in-anon-ct.rs:1:12 + | +LL | #![feature(non_lifetime_binders, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/late-bound-in-anon-ct.rs:1:34 + | +LL | #![feature(non_lifetime_binders, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + +error: cannot capture late-bound type parameter in a constant + --> $DIR/late-bound-in-anon-ct.rs:7:27 + | +LL | for [i32; { let _: T = todo!(); 0 }]:, + | - ^ + | | + | parameter defined here + +error: aborting due to previous error; 2 warnings emitted + diff --git a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs new file mode 100644 index 000000000..9830241c3 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs @@ -0,0 +1,7 @@ +// check-pass +// compile-flags: --crate-type=lib + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +pub fn f() where for (T, U): Copy {} diff --git a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr new file mode 100644 index 000000000..667575b72 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.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/object-lifetime-default-for-late.rs:4:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/on-dyn.rs b/tests/ui/traits/non_lifetime_binders/on-dyn.rs new file mode 100644 index 000000000..8fb7dd276 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/on-dyn.rs @@ -0,0 +1,13 @@ +// Tests to make sure that we reject polymorphic dyn trait. + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Test {} + +fn foo() -> &'static dyn for Test { + //~^ ERROR late-bound type parameter not allowed on trait object types + todo!() +} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/on-dyn.stderr b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr new file mode 100644 index 000000000..95656f999 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/on-dyn.rs:3:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: late-bound type parameter not allowed on trait object types + --> $DIR/on-dyn.rs:8:30 + | +LL | fn foo() -> &'static dyn for Test { + | ^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/on-ptr.rs b/tests/ui/traits/non_lifetime_binders/on-ptr.rs new file mode 100644 index 000000000..0aaff52b6 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/on-ptr.rs @@ -0,0 +1,13 @@ +// Tests to make sure that we reject polymorphic fn ptrs. + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +fn foo() -> for fn(T) { + //~^ ERROR late-bound type parameter not allowed on function pointer types + todo!() +} + +fn main() { + foo()(1i32); +} diff --git a/tests/ui/traits/non_lifetime_binders/on-ptr.stderr b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr new file mode 100644 index 000000000..3b17f7697 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/on-ptr.rs:3:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: late-bound type parameter not allowed on function pointer types + --> $DIR/on-ptr.rs:6:17 + | +LL | fn foo() -> for fn(T) { + | ^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs new file mode 100644 index 000000000..5ff7089b9 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs @@ -0,0 +1,14 @@ +// edition:2021 +// check-pass + +// Checks that test_type_match code doesn't ICE when predicates have late-bound types + +#![feature(non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe to use + +async fn walk2<'a, T: 'a>(_: T) +where + for F: 'a, +{} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr new file mode 100644 index 000000000..3609bed28 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.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/type-match-with-late-bound.rs:6:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr index cbf093866..848b4e69a 100644 --- a/tests/ui/traits/object/enforce-supertrait-projection.stderr +++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr @@ -16,7 +16,7 @@ note: required by a bound in `foo` --> $DIR/enforce-supertrait-projection.rs:15:8 | LL | fn foo(x: T::A) -> B - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: Trait, | ^^^^^^^^^^^^ required by this bound in `foo` diff --git a/tests/ui/traits/object/vs-lifetime.rs b/tests/ui/traits/object/vs-lifetime.rs index 14ae67cff..d3e6c0b21 100644 --- a/tests/ui/traits/object/vs-lifetime.rs +++ b/tests/ui/traits/object/vs-lifetime.rs @@ -9,8 +9,8 @@ fn main() { let _: S<'static, dyn 'static +>; //~^ at least one trait is required for an object type let _: S<'static, 'static>; - //~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this struct takes 1 generic argument but 0 generic arguments were supplied + //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied + //~| ERROR struct takes 1 generic argument but 0 generic arguments were supplied let _: S; //~^ ERROR type provided when a lifetime was expected //~| ERROR at least one trait is required for an object type diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index 224465228..a69cd1408 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -4,7 +4,7 @@ error[E0224]: at least one trait is required for an object type LL | let _: S<'static, dyn 'static +>; | ^^^^^^^^^^^^^ -error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; @@ -18,7 +18,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` LL | struct S<'a, T>(&'a u8, T); | ^ -- -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; diff --git a/tests/ui/traits/suggest-deferences/issue-39029.stderr b/tests/ui/traits/suggest-deferences/issue-39029.stderr index 49e20c6a7..49105de3d 100644 --- a/tests/ui/traits/suggest-deferences/issue-39029.stderr +++ b/tests/ui/traits/suggest-deferences/issue-39029.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied - --> $DIR/issue-39029.rs:16:37 + --> $DIR/issue-39029.rs:16:38 | LL | let _errors = TcpListener::bind(&bad); - | ----------------- ^^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` + | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/test-2.rs b/tests/ui/traits/test-2.rs index 342928e88..ffb778a01 100644 --- a/tests/ui/traits/test-2.rs +++ b/tests/ui/traits/test-2.rs @@ -7,9 +7,9 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } fn main() { 10.dup::(); - //~^ ERROR this associated function takes 0 generic arguments but 1 + //~^ ERROR method takes 0 generic arguments but 1 10.blah::(); - //~^ ERROR this associated function takes 1 generic argument but 2 + //~^ ERROR method takes 1 generic argument but 2 (Box::new(10) as Box).dup(); //~^ ERROR E0038 //~| ERROR E0038 diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index eaa20b0b4..6c0e8b8af 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/test-2.rs:9:8 | LL | 10.dup::(); @@ -6,13 +6,13 @@ LL | 10.dup::(); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/test-2.rs:4:16 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^ -error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied --> $DIR/test-2.rs:11:8 | LL | 10.blah::(); @@ -20,7 +20,7 @@ LL | 10.blah::(); | | | expected 1 generic argument | -note: associated function defined here, with 1 generic parameter: `X` +note: method defined here, with 1 generic parameter: `X` --> $DIR/test-2.rs:4:39 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } diff --git a/tests/ui/traits/trait-or-new-type-instead.stderr b/tests/ui/traits/trait-or-new-type-instead.stderr index 4726b0668..6fd8a03fd 100644 --- a/tests/ui/traits/trait-or-new-type-instead.stderr +++ b/tests/ui/traits/trait-or-new-type-instead.stderr @@ -1,11 +1,8 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined --> $DIR/trait-or-new-type-instead.rs:1:1 | -LL | / impl Option { -LL | | -LL | | pub fn foo(&self) { } -LL | | } - | |_^ impl for type defined outside of crate. +LL | impl Option { + | ^^^^^^^^^^^^^^^^^ impl for type defined outside of crate. | = note: define and implement a trait or new type instead diff --git a/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.rs b/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.rs new file mode 100644 index 000000000..3c6ab86e4 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.rs @@ -0,0 +1,10 @@ +#![feature(multiple_supertrait_upcastable)] +#![deny(multiple_supertrait_upcastable)] + +trait A {} +trait B {} + +trait C: A + B {} +//~^ ERROR `C` is object-safe and has multiple supertraits + +fn main() {} diff --git a/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.stderr b/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.stderr new file mode 100644 index 000000000..ad80a009e --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple_supertrait_upcastable.stderr @@ -0,0 +1,14 @@ +error: `C` is object-safe and has multiple supertraits + --> $DIR/multiple_supertrait_upcastable.rs:7:1 + | +LL | trait C: A + B {} + | ^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/multiple_supertrait_upcastable.rs:2:9 + | +LL | #![deny(multiple_supertrait_upcastable)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/traits/unsend-future.rs b/tests/ui/traits/unsend-future.rs new file mode 100644 index 000000000..fbbc07b11 --- /dev/null +++ b/tests/ui/traits/unsend-future.rs @@ -0,0 +1,21 @@ +// edition:2021 + +// issue 108897 +trait Handler {} +impl Handler for F +where + Fut: Send, + F: FnOnce() -> Fut, +{} + +fn require_handler(h: H) {} + +async fn handler() { + let a = &1 as *const i32; + async {}.await; +} + +fn main() { + require_handler(handler) + //~^ ERROR future cannot be sent between threads safely +} diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr new file mode 100644 index 000000000..4aaa7c4a9 --- /dev/null +++ b/tests/ui/traits/unsend-future.stderr @@ -0,0 +1,24 @@ +error: future cannot be sent between threads safely + --> $DIR/unsend-future.rs:19:21 + | +LL | require_handler(handler) + | ^^^^^^^ future returned by `handler` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `*const i32` +note: future is not `Send` as this value is used across an await + --> $DIR/unsend-future.rs:15:13 + | +LL | let a = &1 as *const i32; + | - has type `*const i32` which is not `Send` +LL | async {}.await; + | ^^^^^^ await occurs here, with `a` maybe used later +LL | } + | - `a` is later dropped here +note: required by a bound in `require_handler` + --> $DIR/unsend-future.rs:11:23 + | +LL | fn require_handler(h: H) {} + | ^^^^^^^ required by this bound in `require_handler` + +error: aborting due to previous error + diff --git a/tests/ui/traits/vtable/issue-97381.stderr b/tests/ui/traits/vtable/issue-97381.stderr index c4f8294e2..89360c44e 100644 --- a/tests/ui/traits/vtable/issue-97381.stderr +++ b/tests/ui/traits/vtable/issue-97381.stderr @@ -1,6 +1,9 @@ error[E0505]: cannot move out of `v` because it is borrowed --> $DIR/issue-97381.rs:26:14 | +LL | let v = [1, 2, 3] + | - binding `v` declared here +... LL | let el = &v[0]; | - borrow of `v` occurs here LL | diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index 96a2fdc54..164e88ede 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_pad_variants.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_respect_endianness.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/issue-101739-1.rs:8:50 | LL | Dst: BikeshedIntrinsicFrom, - | ^^^^^^^^^^^^^^^^ expected struct `Assume`, found `bool` + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/issue-101739-2.rs b/tests/ui/transmutability/issue-101739-2.rs index 964a7e49e..e5a56ccc9 100644 --- a/tests/ui/transmutability/issue-101739-2.rs +++ b/tests/ui/transmutability/issue-101739-2.rs @@ -15,7 +15,7 @@ mod assert { const ASSUME_VISIBILITY: bool, >() where - Dst: BikeshedIntrinsicFrom< //~ ERROR this trait takes at most 3 generic arguments but 6 generic arguments were supplied + Dst: BikeshedIntrinsicFrom< //~ ERROR trait takes at most 3 generic arguments but 6 generic arguments were supplied Src, Context, ASSUME_ALIGNMENT, diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 1b3d20259..420a9f330 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes at most 3 generic arguments but 6 generic arguments were supplied +error[E0107]: trait takes at most 3 generic arguments but 6 generic arguments were supplied --> $DIR/issue-101739-2.rs:18:14 | LL | Dst: BikeshedIntrinsicFrom< diff --git a/tests/ui/transmutability/primitives/bool.stderr b/tests/ui/transmutability/primitives/bool.stderr index 214b5e150..22decf15e 100644 --- a/tests/ui/transmutability/primitives/bool.stderr +++ b/tests/ui/transmutability/primitives/bool.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/bool.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/primitives/numbers.stderr b/tests/ui/transmutability/primitives/numbers.stderr index 7cb7ca8e6..c04a0e82a 100644 --- a/tests/ui/transmutability/primitives/numbers.stderr +++ b/tests/ui/transmutability/primitives/numbers.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -41,7 +41,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -57,7 +57,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -73,7 +73,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -89,7 +89,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -105,7 +105,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -121,7 +121,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -137,7 +137,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -153,7 +153,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -169,7 +169,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -185,7 +185,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -201,7 +201,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -217,7 +217,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -233,7 +233,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -249,7 +249,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -265,7 +265,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -281,7 +281,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -297,7 +297,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -313,7 +313,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -329,7 +329,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -345,7 +345,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -361,7 +361,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -377,7 +377,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -393,7 +393,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -409,7 +409,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -425,7 +425,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -441,7 +441,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -457,7 +457,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -473,7 +473,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -489,7 +489,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -505,7 +505,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -521,7 +521,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -537,7 +537,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -553,7 +553,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -569,7 +569,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -585,7 +585,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -601,7 +601,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -617,7 +617,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -633,7 +633,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -649,7 +649,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -665,7 +665,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -681,7 +681,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -697,7 +697,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -713,7 +713,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -729,7 +729,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -745,7 +745,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -761,7 +761,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -777,7 +777,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -793,7 +793,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -809,7 +809,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -825,7 +825,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -841,7 +841,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -857,7 +857,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -873,7 +873,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -889,7 +889,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -905,7 +905,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/primitives/unit.stderr b/tests/ui/transmutability/primitives/unit.stderr index 8cabe44a0..988cd33b3 100644 --- a/tests/ui/transmutability/primitives/unit.stderr +++ b/tests/ui/transmutability/primitives/unit.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/unit.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/references.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_pad_variants.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_reject_contraction.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index 4323f9740..880e4cd89 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index e009888ae..501760b08 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr index d5d6d431b..afbba653b 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_field.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr index a1ca2ced5..f14b5d8b2 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_variant.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr index 4e648664d..01ae8bea2 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_field.rs:15:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr index bd72d64cc..20a680a74 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr @@ -21,7 +21,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:15:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmute/transmute-padding-ice.stderr b/tests/ui/transmute/transmute-padding-ice.stderr index c9233890f..87fd4fb66 100644 --- a/tests/ui/transmute/transmute-padding-ice.stderr +++ b/tests/ui/transmute/transmute-padding-ice.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/transmute-padding-ice.rs:11:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom< | ______________^ diff --git a/tests/ui/treat-err-as-bug/delay_span_bug.stderr b/tests/ui/treat-err-as-bug/delay_span_bug.stderr index e9457c8fa..22c617504 100644 --- a/tests/ui/treat-err-as-bug/delay_span_bug.stderr +++ b/tests/ui/treat-err-as-bug/delay_span_bug.stderr @@ -4,7 +4,7 @@ error: internal compiler error: delayed span bug triggered by #[rustc_error(dela LL | fn main() {} | ^^^^^^^^^ -error: internal compiler error: unexpected panic +error: the compiler unexpectedly panicked. this is a bug. query stack during panic: #0 [trigger_delay_span_bug] triggering a delay span bug diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr index 8f67571c2..3a56445a2 100644 --- a/tests/ui/treat-err-as-bug/err.stderr +++ b/tests/ui/treat-err-as-bug/err.stderr @@ -4,7 +4,7 @@ error[E0080]: could not evaluate static initializer LL | pub static C: u32 = 0 - 1; | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow -error: internal compiler error: unexpected panic +error: the compiler unexpectedly panicked. this is a bug. query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `C` diff --git a/tests/ui/try-block/try-block-bad-lifetime.stderr b/tests/ui/try-block/try-block-bad-lifetime.stderr index ea079e30d..28941cb0a 100644 --- a/tests/ui/try-block/try-block-bad-lifetime.stderr +++ b/tests/ui/try-block/try-block-bad-lifetime.stderr @@ -4,6 +4,7 @@ error[E0597]: `my_string` does not live long enough LL | let result: Result<(), &str> = try { | ------ borrow later stored here LL | let my_string = String::from(""); + | --------- binding `my_string` declared here LL | let my_str: & str = & my_string; | ^^^^^^^^^^^ borrowed value does not live long enough ... @@ -14,10 +15,10 @@ error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-bad-lifetime.rs:29:13 | LL | let k = &mut i; - | ------ borrow of `i` occurs here + | ------ `i` is borrowed here ... LL | i = 10; - | ^^^^^^ assignment to borrowed `i` occurs here + | ^^^^^^ `i` is assigned to here but it was already borrowed LL | }; LL | ::std::mem::drop(k); | - borrow later used here @@ -38,10 +39,10 @@ error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-bad-lifetime.rs:32:9 | LL | let k = &mut i; - | ------ borrow of `i` occurs here + | ------ `i` is borrowed here ... LL | i = 40; - | ^^^^^^ assignment to borrowed `i` occurs here + | ^^^^^^ `i` is assigned to here but it was already borrowed LL | LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; | - borrow later used here diff --git a/tests/ui/try-block/try-block-maybe-bad-lifetime.stderr b/tests/ui/try-block/try-block-maybe-bad-lifetime.stderr index f738b03ee..71c7e460c 100644 --- a/tests/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/tests/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -2,10 +2,10 @@ error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-maybe-bad-lifetime.rs:17:9 | LL | &i - | -- borrow of `i` occurs here + | -- `i` is borrowed here LL | }; LL | i = 0; - | ^^^^^ assignment to borrowed `i` occurs here + | ^^^^^ `i` is assigned to here but it was already borrowed LL | let _ = i; LL | do_something_with(x); | - borrow later used here @@ -32,10 +32,10 @@ error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 | LL | j = &i; - | -- borrow of `i` occurs here + | -- `i` is borrowed here LL | }; LL | i = 0; - | ^^^^^ assignment to borrowed `i` occurs here + | ^^^^^ `i` is assigned to here but it was already borrowed LL | let _ = i; LL | do_something_with(j); | - borrow later used here diff --git a/tests/ui/tuple/add-tuple-within-arguments.stderr b/tests/ui/tuple/add-tuple-within-arguments.stderr index 2e20a4cca..6849128ea 100644 --- a/tests/ui/tuple/add-tuple-within-arguments.stderr +++ b/tests/ui/tuple/add-tuple-within-arguments.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/add-tuple-within-arguments.rs:8:15 | LL | bar("hi", "hi", "hi"); - | --- ^^^^ expected tuple, found `&str` + | --- ^^^^ expected `(&str,)`, found `&str` | | | arguments to this function are incorrect | diff --git a/tests/ui/tuple/wrong_argument_ice-3.stderr b/tests/ui/tuple/wrong_argument_ice-3.stderr index 0a503e1fe..8b9dac6e2 100644 --- a/tests/ui/tuple/wrong_argument_ice-3.stderr +++ b/tests/ui/tuple/wrong_argument_ice-3.stderr @@ -2,21 +2,22 @@ error[E0061]: this method takes 1 argument but 2 arguments were supplied --> $DIR/wrong_argument_ice-3.rs:9:16 | LL | groups.push(new_group, vec![process]); - | ^^^^ ------------- argument of type `Vec<&Process>` unexpected + | ^^^^ ------------- unexpected argument of type `Vec<&Process>` | -note: expected tuple, found struct `Vec` +note: expected `(Vec, Vec)`, found `Vec` --> $DIR/wrong_argument_ice-3.rs:9:21 | LL | groups.push(new_group, vec![process]); | ^^^^^^^^^ = note: expected tuple `(Vec, Vec)` found struct `Vec` -note: associated function defined here +note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: remove the extra argument | -LL | groups.push(/* (Vec, Vec) */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - groups.push(new_group, vec![process]); +LL + groups.push(/* (Vec, Vec) */); + | error: aborting due to previous error diff --git a/tests/ui/tuple/wrong_argument_ice-4.stderr b/tests/ui/tuple/wrong_argument_ice-4.stderr index a2686ab94..d8569ebf6 100644 --- a/tests/ui/tuple/wrong_argument_ice-4.stderr +++ b/tests/ui/tuple/wrong_argument_ice-4.stderr @@ -6,17 +6,16 @@ LL | (|| {})(|| { LL | | LL | | let b = 1; LL | | }); - | |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]` unexpected + | | - + | | | + | |_____unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]` + | help: remove the extra argument | note: closure defined here --> $DIR/wrong_argument_ice-4.rs:2:6 | LL | (|| {})(|| { | ^^ -help: remove the extra argument - | -LL | (|| {})(); - | ~~ error: aborting due to previous error diff --git a/tests/ui/tuple/wrong_argument_ice.stderr b/tests/ui/tuple/wrong_argument_ice.stderr index f1b00ae0b..213ca8f88 100644 --- a/tests/ui/tuple/wrong_argument_ice.stderr +++ b/tests/ui/tuple/wrong_argument_ice.stderr @@ -4,7 +4,7 @@ error[E0061]: method takes 1 argument but 2 arguments were supplied LL | self.acc.push_back(self.current_provides, self.current_requires); | ^^^^^^^^^ | -note: associated function defined here +note: method defined here --> $SRC_DIR/alloc/src/collections/vec_deque/mod.rs:LL:COL help: wrap these arguments in parentheses to construct a tuple | diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs index 0031a4665..759a7fd7e 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs @@ -62,10 +62,10 @@ fn main() { AliasFixed::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed on this type [E0109] AliasFixed::<()>::TSVariant(()); - //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed on this type [E0109] - //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~| ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] // Struct variant @@ -80,10 +80,10 @@ fn main() { AliasFixed::SVariant::<()> { v: () }; //~^ ERROR type arguments are not allowed on this type [E0109] AliasFixed::<()>::SVariant { v: () }; - //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::SVariant::<()> { v: () }; //~^ ERROR type arguments are not allowed on this type [E0109] - //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~| ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] // Unit variant @@ -98,8 +98,8 @@ fn main() { AliasFixed::UVariant::<()>; //~^ ERROR type arguments are not allowed on this type [E0109] AliasFixed::<()>::UVariant; - //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~^ ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] AliasFixed::<()>::UVariant::<()>; //~^ ERROR type arguments are not allowed on this type [E0109] - //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] + //~| ERROR type alias takes 0 generic arguments but 1 generic argument was supplied [E0107] } 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 a922d7a5e..758ff31ff 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 @@ -304,7 +304,7 @@ LL | AliasFixed::TSVariant::<()>(()); | | | not allowed on this type -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); @@ -318,7 +318,7 @@ note: type alias defined here, with 0 generic parameters LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); @@ -395,7 +395,7 @@ LL - AliasFixed::SVariant::<()> { v: () }; LL + AliasFixed::<()>::SVariant { v: () }; | -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; @@ -409,7 +409,7 @@ note: type alias defined here, with 0 generic parameters LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; @@ -470,7 +470,7 @@ LL | AliasFixed::UVariant::<()>; | | | not allowed on this type -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; @@ -484,7 +484,7 @@ note: type alias defined here, with 0 generic parameters LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index eb58ee73c..db75a520c 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 | LL | let _: u8 = ::V; - | -- ^^^^^^^ expected `u8`, found enum `E2` + | -- ^^^^^^^ expected `u8`, found `E2` | | | expected due to this diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs index 83d22161e..7c3a3a844 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs @@ -6,9 +6,8 @@ type X<'a> = impl Into<&'static str> + From<&'a str>; fn f<'a: 'static>(t: &'a str) -> X<'a> { - //~^ WARNING unnecessary lifetime parameter t - //~^ ERROR non-defining opaque type use + //~^ ERROR expected generic lifetime parameter, found `'static` } fn extend_lt<'a>(o: &'a str) -> &'static str { diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr index 920eef11d..962dedde0 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr @@ -1,13 +1,5 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/bounds-are-checked.rs:8:6 - | -LL | fn f<'a: 'static>(t: &'a str) -> X<'a> { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -error: non-defining opaque type use in defining scope - --> $DIR/bounds-are-checked.rs:10:5 +error[E0792]: expected generic lifetime parameter, found `'static` + --> $DIR/bounds-are-checked.rs:9:5 | LL | type X<'a> = impl Into<&'static str> + From<&'a str>; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -15,5 +7,6 @@ LL | type X<'a> = impl Into<&'static str> + From<&'a str>; LL | t | ^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs index f5045d382..e7b8567b9 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs @@ -19,7 +19,7 @@ fn concrete_ty() -> OneTy { fn concrete_lifetime() -> OneLifetime<'static> { 6u32 - //~^ ERROR non-defining opaque type use in defining scope + //~^ ERROR expected generic lifetime parameter, found `'static` } fn concrete_const() -> OneConst<{ 123 }> { diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr index 564648630..966fe823f 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr @@ -7,7 +7,7 @@ LL | type OneTy = impl Debug; LL | 5u32 | ^^^^ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic lifetime parameter, found `'static` --> $DIR/generic_nondefining_use.rs:21:5 | LL | type OneLifetime<'a> = impl Debug; diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index d3e169a70..cdd8f6f19 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -4,7 +4,7 @@ fn main() { let y = 42; let x = wrong_generic(&y); let z: i32 = x; - //~^ ERROR expected generic type parameter, found `&'static i32 + //~^ ERROR expected generic type parameter, found `&i32` } type WrongGeneric = impl 'static; 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 19115fd28..fa79e51e9 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 @@ -4,7 +4,7 @@ error: at least one trait must be specified LL | type WrongGeneric = impl 'static; | ^^^^^^^^^^^^ -error[E0792]: expected generic type parameter, found `&'static i32` +error[E0792]: expected generic type parameter, found `&i32` --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | LL | let z: i32 = x; diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs index 07f825aea..6f9434255 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs @@ -4,7 +4,6 @@ mod test_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } @@ -13,14 +12,12 @@ mod test_higher_kinded_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } mod test_higher_kinded_lifetime_param2 { fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } 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 887620a4d..399775641 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 @@ -1,41 +1,17 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:6:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:15:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:22:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:8:43 + --> $DIR/implied_lifetime_wf_check3.rs:7:43 | LL | fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:17:46 + --> $DIR/implied_lifetime_wf_check3.rs:15:46 | LL | fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:24:21 + --> $DIR/implied_lifetime_wf_check3.rs:21:21 | LL | fn test<'a>() { assert_static::<'a>() } | -- ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` @@ -43,7 +19,7 @@ LL | fn test<'a>() { assert_static::<'a>() } | lifetime `'a` defined here error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:32:41 + --> $DIR/implied_lifetime_wf_check3.rs:29:41 | LL | fn test() where Ty: 'static { assert_static::() } | ^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds @@ -53,6 +29,6 @@ help: consider adding an explicit lifetime bound... LL | fn test() where Ty: 'static { assert_static::() } | +++++++++ -error: aborting due to 4 previous errors; 3 warnings emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr index 0ed8a703b..e52d5f9de 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr @@ -2,7 +2,9 @@ error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not app --> $DIR/imply_bounds_from_bounds_param.rs:24:5 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { - | -- hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here + | -- ------------ opaque type defined here + | | + | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here LL | <&'a mut i32 as Callable>::call(y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/type-alias-impl-trait/issue-63279.rs b/tests/ui/type-alias-impl-trait/issue-63279.rs index 97332e16d..0e46745c6 100644 --- a/tests/ui/type-alias-impl-trait/issue-63279.rs +++ b/tests/ui/type-alias-impl-trait/issue-63279.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zsave-analysis - #![feature(type_alias_impl_trait)] type Closure = impl FnOnce(); diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr index 110b8d1ee..a4f6359b9 100644 --- a/tests/ui/type-alias-impl-trait/issue-63279.stderr +++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `FnOnce<()>` closure, found `()` - --> $DIR/issue-63279.rs:7:11 + --> $DIR/issue-63279.rs:5:11 | LL | fn c() -> Closure { | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` @@ -8,7 +8,7 @@ LL | fn c() -> Closure { = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` error[E0277]: expected a `FnOnce<()>` closure, found `()` - --> $DIR/issue-63279.rs:9:11 + --> $DIR/issue-63279.rs:7:11 | LL | || -> Closure { || () } | ^^^^^^^ expected an `FnOnce<()>` closure, found `()` @@ -17,26 +17,26 @@ LL | || -> Closure { || () } = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` error[E0308]: mismatched types - --> $DIR/issue-63279.rs:9:21 + --> $DIR/issue-63279.rs:7:21 | LL | || -> Closure { || () } | ^^^^^ expected `()`, found closure | = note: expected unit type `()` - found closure `[closure@$DIR/issue-63279.rs:9:21: 9:23]` + found closure `[closure@$DIR/issue-63279.rs:7:21: 7:23]` help: use parentheses to call this closure | LL | || -> Closure { (|| ())() } | + +++ error[E0308]: mismatched types - --> $DIR/issue-63279.rs:9:5 + --> $DIR/issue-63279.rs:7:5 | LL | || -> Closure { || () } | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure | = note: expected unit type `()` - found closure `[closure@$DIR/issue-63279.rs:9:5: 9:18]` + found closure `[closure@$DIR/issue-63279.rs:7:5: 7:18]` help: use parentheses to call this closure | LL | (|| -> Closure { || () })() diff --git a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs index 72c22827f..b91cbce37 100644 --- a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs +++ b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zsave-analysis // check-pass #![feature(type_alias_impl_trait, rustc_attrs)] diff --git a/tests/ui/type-alias-impl-trait/issue-98604.rs b/tests/ui/type-alias-impl-trait/issue-98604.rs index 32c2f9ed5..d07fc9822 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.rs +++ b/tests/ui/type-alias-impl-trait/issue-98604.rs @@ -7,5 +7,5 @@ async fn test() {} #[allow(unused_must_use)] fn main() { Box::new(test) as AsyncFnPtr; - //~^ ERROR expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` + //~^ ERROR expected `test` to be a fn item that returns `Pin>>`, but it returns `impl Future } diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr index 92d01eb0d..fa16d3218 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr @@ -1,16 +1,9 @@ -error[E0271]: expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` +error[E0271]: expected `test` to be a fn item that returns `Pin>>`, but it returns `impl Future` --> $DIR/issue-98604.rs:9:5 | LL | Box::new(test) as AsyncFnPtr; - | ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type + | ^^^^^^^^^^^^^^ expected `Pin>>`, found future | -note: while checking the return type of the `async fn` - --> $DIR/issue-98604.rs:5:17 - | -LL | async fn test() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected struct `Pin + 'static)>>` - found opaque type `impl Future` = note: required for the cast from `fn() -> impl Future {test}` to the object type `dyn Fn() -> Pin + 'static)>>` error: aborting due to previous error diff --git a/tests/ui/type-alias-impl-trait/issue-98608.rs b/tests/ui/type-alias-impl-trait/issue-98608.rs index 1f89af045..5e026ea40 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.rs +++ b/tests/ui/type-alias-impl-trait/issue-98608.rs @@ -4,7 +4,7 @@ fn hi() -> impl Sized { fn main() { let b: Box Box> = Box::new(hi); - //~^ ERROR expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box`, but it returns `impl Sized` + //~^ ERROR expected `hi` to be a fn item that returns `Box`, but it returns `impl Sized` let boxed = b(); let null = *boxed; println!("{null:?}"); diff --git a/tests/ui/type-alias-impl-trait/issue-98608.stderr b/tests/ui/type-alias-impl-trait/issue-98608.stderr index 916a58451..506d40cb7 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98608.stderr @@ -1,11 +1,11 @@ -error[E0271]: expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box`, but it returns `impl Sized` +error[E0271]: expected `hi` to be a fn item that returns `Box`, but it returns `impl Sized` --> $DIR/issue-98608.rs:6:39 | LL | fn hi() -> impl Sized { | ---------- the found opaque type ... LL | let b: Box Box> = Box::new(hi); - | ^^^^^^^^^^^^ expected struct `Box`, found opaque type + | ^^^^^^^^^^^^ expected `Box`, found opaque type | = note: expected struct `Box` found opaque type `impl Sized` diff --git a/tests/ui/type-alias-impl-trait/match-unification.rs b/tests/ui/type-alias-impl-trait/match-unification.rs new file mode 100644 index 000000000..f5c2abc0e --- /dev/null +++ b/tests/ui/type-alias-impl-trait/match-unification.rs @@ -0,0 +1,14 @@ +use std::fmt::Debug; + +// check-pass + +fn bar() -> impl Debug {} + +fn baz(b: bool) -> Option { + match b { + true => baz(false), + false => Some(bar()), + } +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr index 65a0af0d2..d666e668d 100644 --- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr +++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr @@ -1,6 +1,8 @@ error[E0700]: hidden type for `Opaque<'a, T>` captures lifetime that does not appear in bounds --> $DIR/missing_lifetime_bound.rs:4:47 | +LL | type Opaque<'a, T> = impl Sized; + | ---------- opaque type defined here LL | fn defining<'a, T>(x: &'a i32) -> Opaque { x } | -- ^ | | 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 a31cf1a51..ff375b2ff 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 +error[E0562]: `impl Trait` only allowed in function and inherent method 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/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr index 7dc6efc4b..e90324334 100644 --- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr +++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr @@ -15,7 +15,7 @@ LL | type MyPrivate = impl Sized; LL | fn dont_define_this(_private: MyPrivate) {} | ^^^^^^^^^ | | - | expected struct `Private`, found opaque type + | expected `Private`, found opaque type | help: change the parameter type to match the trait: `Private` | note: type in trait diff --git a/tests/ui/type-inference/issue-30225.stderr b/tests/ui/type-inference/issue-30225.stderr index ccd05fa6b..72c33d16c 100644 --- a/tests/ui/type-inference/issue-30225.stderr +++ b/tests/ui/type-inference/issue-30225.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-30225.rs:31:9 | LL | u = v; // mark $0 and $1 in a subtype relationship - | ^ expected struct `A`, found struct `B` + | ^ expected `A`, found `B` error: aborting due to previous error diff --git a/tests/ui/type-inference/sort_by_key.stderr b/tests/ui/type-inference/sort_by_key.stderr index 0a48d5756..de7b4b248 100644 --- a/tests/ui/type-inference/sort_by_key.stderr +++ b/tests/ui/type-inference/sort_by_key.stderr @@ -2,7 +2,7 @@ error[E0282]: 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 associated function `sum` + | ^^^ cannot infer type of the type parameter `S` declared on the method `sum` | help: consider specifying the generic argument | diff --git a/tests/ui/type/issue-91268.rs b/tests/ui/type/issue-91268.rs index f1e16bc7b..274ea839e 100644 --- a/tests/ui/type/issue-91268.rs +++ b/tests/ui/type/issue-91268.rs @@ -1,8 +1,4 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: cannot find type `ţ` in this scope -// error-pattern: parenthesized type parameters may only be used with a `Fn` trait -// error-pattern: type arguments are not allowed on builtin type `u8` -// error-pattern: mismatched types // ignore-tidy-trailing-newlines // `ţ` must be the last character in this file, it cannot be followed by a newline fn main() { diff --git a/tests/ui/type/issue-91268.stderr b/tests/ui/type/issue-91268.stderr index 6c9ee9945..a3619d863 100644 --- a/tests/ui/type/issue-91268.stderr +++ b/tests/ui/type/issue-91268.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-91268.rs:9:12 + --> $DIR/issue-91268.rs:5:12 | LL | fn main() { | - unclosed delimiter @@ -8,56 +8,5 @@ LL | 0: u8(ţ | | | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-91268.rs:9:12 - | -LL | fn main() { - | - unclosed delimiter -LL | 0: u8(ţ - | - ^ - | | - | unclosed delimiter - -error[E0412]: cannot find type `ţ` in this scope - --> $DIR/issue-91268.rs:9:11 - | -LL | 0: u8(ţ - | ^ expecting a type here because of type ascription - -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-91268.rs:9:8 - | -LL | 0: u8(ţ - | ^^^^ only `Fn` traits may use parentheses - | -help: use angle brackets instead - | -LL | 0: u8<ţ> - | ~ + - -error[E0109]: type arguments are not allowed on builtin type `u8` - --> $DIR/issue-91268.rs:9:11 - | -LL | 0: u8(ţ - | -- ^ type argument not allowed - | | - | not allowed on builtin type `u8` - | -help: primitive type `u8` doesn't have generic parameters - | -LL - 0: u8(ţ -LL + 0: u8 - | - -error[E0308]: mismatched types - --> $DIR/issue-91268.rs:9:5 - | -LL | fn main() { - | - expected `()` because of default return type -LL | 0: u8(ţ - | ^^^^^^^ expected `()`, found `u8` - -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0109, E0214, E0308, E0412. -For more information about an error, try `rustc --explain E0109`. diff --git a/tests/ui/type/type-ascription-instead-of-initializer.stderr b/tests/ui/type/type-ascription-instead-of-initializer.stderr index ba8d15d0b..429501c27 100644 --- a/tests/ui/type/type-ascription-instead-of-initializer.stderr +++ b/tests/ui/type/type-ascription-instead-of-initializer.stderr @@ -11,14 +11,13 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | LL | let x: Vec::with_capacity(10, 20); - | ^^^^^^^^^^^^^^^^^^ -- argument of type `{integer}` unexpected + | ^^^^^^^^^^^^^^^^^^ ---- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -help: remove the extra argument - | -LL | let x: Vec::with_capacity(10); - | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-ascription-precedence.stderr b/tests/ui/type/type-ascription-precedence.stderr index edc5aeffd..d6d1e1d7d 100644 --- a/tests/ui/type/type-ascription-precedence.stderr +++ b/tests/ui/type/type-ascription-precedence.stderr @@ -2,13 +2,13 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:31:7 | LL | &(S: &S); - | ^ expected `&S`, found struct `S` + | ^ expected `&S`, found `S` error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:35:7 | LL | *(S: Z); - | ^ expected struct `Z`, found struct `S` + | ^ expected `Z`, found `S` error[E0614]: type `Z` cannot be dereferenced --> $DIR/type-ascription-precedence.rs:35:5 @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:40:7 | LL | -(S: Z); - | ^ expected struct `Z`, found struct `S` + | ^ expected `Z`, found `S` error[E0600]: cannot apply unary operator `-` to type `Z` --> $DIR/type-ascription-precedence.rs:40:5 @@ -40,19 +40,19 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:45:5 | LL | (S + Z): Z; - | ^^^^^^^ expected struct `Z`, found struct `S` + | ^^^^^^^ expected `Z`, found `S` error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:49:5 | LL | (S * Z): Z; - | ^^^^^^^ expected struct `Z`, found struct `S` + | ^^^^^^^ expected `Z`, found `S` error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:53:5 | LL | (S .. S): S; - | ^^^^^^^^ expected struct `S`, found struct `Range` + | ^^^^^^^^ expected `S`, found `Range` | = note: expected struct `S` found struct `std::ops::Range` diff --git a/tests/ui/type/type-ascription-soundness.stderr b/tests/ui/type/type-ascription-soundness.stderr index 522d5b2e3..778836a2e 100644 --- a/tests/ui/type/type-ascription-soundness.stderr +++ b/tests/ui/type/type-ascription-soundness.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:7:31 | LL | let ref x = type_ascribe!(arr, &[u8]); - | ^^^ expected slice `[u8]`, found array `[u8; 3]` + | ^^^ expected `&[u8]`, found `&[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:8:35 | LL | let ref mut x = type_ascribe!(arr, &[u8]); - | ^^^ expected slice `[u8]`, found array `[u8; 3]` + | ^^^ expected `&[u8]`, found `&[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:9:25 | LL | match type_ascribe!(arr, &[u8]) { - | ^^^ expected slice `[u8]`, found array `[u8; 3]` + | ^^^ expected `&[u8]`, found `&[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:12:30 | LL | let _len = type_ascribe!(arr, &[u8]).len(); - | ^^^ expected slice `[u8]`, found array `[u8; 3]` + | ^^^ expected `&[u8]`, found `&[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` diff --git a/tests/ui/type/type-check/assignment-in-if.stderr b/tests/ui/type/type-check/assignment-in-if.stderr index 9f4558ada..de133e559 100644 --- a/tests/ui/type/type-check/assignment-in-if.stderr +++ b/tests/ui/type/type-check/assignment-in-if.stderr @@ -67,6 +67,9 @@ LL | x == 5 error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:18 | +LL | if y = (Foo { foo: x }) { + | - here the type of `x` is inferred to be `usize` +... LL | if x == x && x = x && x == x { | ------ ^ expected `bool`, found `usize` | | @@ -75,6 +78,9 @@ LL | if x == x && x = x && x == x { error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:22 | +LL | if y = (Foo { foo: x }) { + | - here the type of `x` is inferred to be `usize` +... LL | if x == x && x = x && x == x { | ^ expected `bool`, found `usize` @@ -92,6 +98,9 @@ LL | if x == x && x == x && x == x { error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:28 | +LL | if y = (Foo { foo: x }) { + | - here the type of `x` is inferred to be `usize` +... LL | if x == x && x == x && x = x { | ---------------- ^ expected `bool`, found `usize` | | 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 b63d2a3b6..09c4b2053 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 @@ -1,12 +1,12 @@ -error[E0282]: type annotations needed for `Vec` +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/cannot_infer_local_or_vec.rs:2:9 | LL | let x = vec![]; | ^ | -help: consider giving `x` an explicit type, where the type for type parameter `T` is specified +help: consider giving `x` an explicit type, where the placeholders `_` are specified | -LL | let x: Vec = vec![]; +LL | let x: Vec<_> = vec![]; | ++++++++ error: aborting due to previous error diff --git a/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr index e544b3695..1fa253052 100644 --- a/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr +++ b/tests/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr @@ -1,12 +1,12 @@ -error[E0282]: type annotations needed for `(Vec,)` +error[E0282]: type annotations needed for `(Vec<_>,)` --> $DIR/cannot_infer_local_or_vec_in_tuples.rs:2:9 | LL | let (x, ) = (vec![], ); | ^^^^^ ---------- type must be known at this point | -help: consider giving this pattern a type, where the type for type parameter `T` is specified +help: consider giving this pattern a type, where the placeholders `_` are specified | -LL | let (x, ): (Vec,) = (vec![], ); +LL | let (x, ): (Vec<_>,) = (vec![], ); | +++++++++++ error: aborting due to previous error diff --git a/tests/ui/type/type-check/coerce-result-return-value-2.rs b/tests/ui/type/type-check/coerce-result-return-value-2.rs new file mode 100644 index 000000000..23bafa6c5 --- /dev/null +++ b/tests/ui/type/type-check/coerce-result-return-value-2.rs @@ -0,0 +1,24 @@ +struct A; +struct B; +impl From for B { + fn from(_: A) -> Self { B } +} +fn foo4(x: Result<(), A>) -> Result<(), B> { + match true { + true => x, //~ ERROR mismatched types + false => x, + } +} +fn foo5(x: Result<(), A>) -> Result<(), B> { + match true { + true => return x, //~ ERROR mismatched types + false => return x, + } +} +fn main() { + let _ = foo4(Ok(())); + let _ = foo5(Ok(())); + let _: Result<(), B> = { //~ ERROR mismatched types + Err(A); + }; +} diff --git a/tests/ui/type/type-check/coerce-result-return-value-2.stderr b/tests/ui/type/type-check/coerce-result-return-value-2.stderr new file mode 100644 index 000000000..b2c409e07 --- /dev/null +++ b/tests/ui/type/type-check/coerce-result-return-value-2.stderr @@ -0,0 +1,47 @@ +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value-2.rs:8:17 + | +LL | fn foo4(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +LL | match true { +LL | true => x, + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | true => Ok(x?), + | +++ ++ + +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value-2.rs:14:24 + | +LL | fn foo5(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +LL | match true { +LL | true => return x, + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | true => return Ok(x?), + | +++ ++ + +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value-2.rs:21:28 + | +LL | let _: Result<(), B> = { + | ____________________________^ +LL | | Err(A); +LL | | }; + | |_____^ expected `Result<(), B>`, found `()` + | + = note: expected enum `Result<(), B>` + found unit type `()` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/type-check/coerce-result-return-value.fixed b/tests/ui/type/type-check/coerce-result-return-value.fixed new file mode 100644 index 000000000..8a0540707 --- /dev/null +++ b/tests/ui/type/type-check/coerce-result-return-value.fixed @@ -0,0 +1,24 @@ +// run-rustfix +struct A; +struct B; +impl From for B { + fn from(_: A) -> Self { B } +} +fn foo1(x: Result<(), A>) -> Result<(), B> { + Ok(x?) //~ ERROR mismatched types +} +fn foo2(x: Result<(), A>) -> Result<(), B> { + return Ok(x?); //~ ERROR mismatched types +} +fn foo3(x: Result<(), A>) -> Result<(), B> { + if true { + Ok(x?) //~ ERROR mismatched types + } else { + Ok(x?) //~ ERROR mismatched types + } +} +fn main() { + let _ = foo1(Ok(())); + let _ = foo2(Ok(())); + let _ = foo3(Ok(())); +} diff --git a/tests/ui/type/type-check/coerce-result-return-value.rs b/tests/ui/type/type-check/coerce-result-return-value.rs new file mode 100644 index 000000000..442203add --- /dev/null +++ b/tests/ui/type/type-check/coerce-result-return-value.rs @@ -0,0 +1,24 @@ +// run-rustfix +struct A; +struct B; +impl From for B { + fn from(_: A) -> Self { B } +} +fn foo1(x: Result<(), A>) -> Result<(), B> { + x //~ ERROR mismatched types +} +fn foo2(x: Result<(), A>) -> Result<(), B> { + return x; //~ ERROR mismatched types +} +fn foo3(x: Result<(), A>) -> Result<(), B> { + if true { + x //~ ERROR mismatched types + } else { + x //~ ERROR mismatched types + } +} +fn main() { + let _ = foo1(Ok(())); + let _ = foo2(Ok(())); + let _ = foo3(Ok(())); +} diff --git a/tests/ui/type/type-check/coerce-result-return-value.stderr b/tests/ui/type/type-check/coerce-result-return-value.stderr new file mode 100644 index 000000000..adec2f612 --- /dev/null +++ b/tests/ui/type/type-check/coerce-result-return-value.stderr @@ -0,0 +1,65 @@ +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value.rs:8:5 + | +LL | fn foo1(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +LL | x + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | Ok(x?) + | +++ ++ + +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value.rs:11:12 + | +LL | fn foo2(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +LL | return x; + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | return Ok(x?); + | +++ ++ + +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value.rs:15:9 + | +LL | fn foo3(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +LL | if true { +LL | x + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | Ok(x?) + | +++ ++ + +error[E0308]: mismatched types + --> $DIR/coerce-result-return-value.rs:17:9 + | +LL | fn foo3(x: Result<(), A>) -> Result<(), B> { + | ------------- expected `Result<(), B>` because of return type +... +LL | x + | ^ expected `Result<(), B>`, found `Result<(), A>` + | + = note: expected enum `Result<_, B>` + found enum `Result<_, A>` +help: use `?` to coerce and return an appropriate `Err`, and wrap the resulting value in `Ok` so the expression remains of type `Result` + | +LL | Ok(x?) + | +++ ++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/type-check/point-at-inference-2.stderr b/tests/ui/type/type-check/point-at-inference-2.stderr index 1368aba0d..1d2777ad6 100644 --- a/tests/ui/type/type-check/point-at-inference-2.stderr +++ b/tests/ui/type/type-check/point-at-inference-2.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/point-at-inference-2.rs:5:9 | LL | bar(v); - | --- ^ expected `i32`, found `&{integer}` + | --- ^ expected `Vec`, found `Vec<&{integer}>` | | | arguments to this function are incorrect | @@ -17,8 +17,11 @@ LL | fn bar(_: Vec) {} error[E0308]: mismatched types --> $DIR/point-at-inference-2.rs:9:9 | +LL | baz(&v); + | - here the type of `v` is inferred to be `Vec<&i32>` +LL | baz(&v); LL | bar(v); - | --- ^ expected `i32`, found `&i32` + | --- ^ expected `Vec`, found `Vec<&i32>` | | | arguments to this function are incorrect | @@ -33,8 +36,10 @@ LL | fn bar(_: Vec) {} error[E0308]: mismatched types --> $DIR/point-at-inference-2.rs:12:9 | +LL | baz(&v); + | - here the type of `v` is inferred to be `Vec<&i32>` LL | bar(v); - | --- ^ expected `i32`, found `&i32` + | --- ^ expected `Vec`, found `Vec<&i32>` | | | arguments to this function are incorrect | diff --git a/tests/ui/type/type-check/point-at-inference-3.fixed b/tests/ui/type/type-check/point-at-inference-3.fixed index 44c057c0d..edd4adf8b 100644 --- a/tests/ui/type/type-check/point-at-inference-3.fixed +++ b/tests/ui/type/type-check/point-at-inference-3.fixed @@ -2,10 +2,11 @@ fn main() { let mut v = Vec::new(); v.push(0i32); + //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec` v.push(0); v.push(1i32); //~ ERROR mismatched types //~^ NOTE expected `i32`, found `u32` //~| NOTE arguments to this method are incorrect - //~| NOTE associated function defined here + //~| NOTE method defined here //~| HELP change the type of the numeric literal from `u32` to `i32` } diff --git a/tests/ui/type/type-check/point-at-inference-3.rs b/tests/ui/type/type-check/point-at-inference-3.rs index e7ae54384..49d7b5007 100644 --- a/tests/ui/type/type-check/point-at-inference-3.rs +++ b/tests/ui/type/type-check/point-at-inference-3.rs @@ -2,10 +2,11 @@ fn main() { let mut v = Vec::new(); v.push(0i32); + //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec` v.push(0); v.push(1u32); //~ ERROR mismatched types //~^ NOTE expected `i32`, found `u32` //~| NOTE arguments to this method are incorrect - //~| NOTE associated function defined here + //~| NOTE method defined here //~| HELP change the type of the numeric literal from `u32` to `i32` } diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr index d7936e39c..2c4907ed2 100644 --- a/tests/ui/type/type-check/point-at-inference-3.stderr +++ b/tests/ui/type/type-check/point-at-inference-3.stderr @@ -1,12 +1,15 @@ error[E0308]: mismatched types - --> $DIR/point-at-inference-3.rs:6:12 + --> $DIR/point-at-inference-3.rs:7:12 | +LL | v.push(0i32); + | ---- this is of type `i32`, which causes `v` to be inferred as `Vec` +... LL | v.push(1u32); | ---- ^^^^ expected `i32`, found `u32` | | | arguments to this method are incorrect | -note: associated function defined here +note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | diff --git a/tests/ui/type/type-check/point-at-inference-4.rs b/tests/ui/type/type-check/point-at-inference-4.rs new file mode 100644 index 000000000..aea9b2c6c --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-4.rs @@ -0,0 +1,21 @@ +struct S(Option<(A, B)>); + +impl S { + fn infer(&self, a: A, b: B) {} + //~^ NOTE method defined here + //~| NOTE + //~| NOTE +} + +fn main() { + let s = S(None); + s.infer(0i32); + //~^ ERROR this method takes 2 arguments but 1 argument was supplied + //~| NOTE an argument is missing + //~| HELP provide the argument + let t: S = s; + //~^ ERROR mismatched types + //~| NOTE expected `S`, found `S` + //~| NOTE expected due to this + //~| NOTE expected struct `S` +} diff --git a/tests/ui/type/type-check/point-at-inference-4.stderr b/tests/ui/type/type-check/point-at-inference-4.stderr new file mode 100644 index 000000000..28833d2ed --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference-4.stderr @@ -0,0 +1,31 @@ +error[E0061]: this method takes 2 arguments but 1 argument was supplied + --> $DIR/point-at-inference-4.rs:12:7 + | +LL | s.infer(0i32); + | ^^^^^------ an argument is missing + | +note: method defined here + --> $DIR/point-at-inference-4.rs:4:8 + | +LL | fn infer(&self, a: A, b: B) {} + | ^^^^^ ---- ---- +help: provide the argument + | +LL | s.infer(0i32, /* b */); + | ~~~~~~~~~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/point-at-inference-4.rs:16:24 + | +LL | let t: S = s; + | --------- ^ expected `S`, found `S` + | | + | expected due to this + | + = note: expected struct `S` + found struct `S` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/type/type-check/point-at-inference.fixed b/tests/ui/type/type-check/point-at-inference.fixed new file mode 100644 index 000000000..f41fbe59f --- /dev/null +++ b/tests/ui/type/type-check/point-at-inference.fixed @@ -0,0 +1,13 @@ +// run-rustfix +fn bar(_: Vec) {} +fn baz(_: &impl std::any::Any) {} +fn main() { + let v = vec![1, 2, 3, 4, 5]; + let mut foo = vec![]; + baz(&foo); + for i in &v { + foo.push(*i); + } + baz(&foo); + bar(foo); //~ ERROR E0308 +} diff --git a/tests/ui/type/type-check/point-at-inference.rs b/tests/ui/type/type-check/point-at-inference.rs index 5c46dd4ed..6419e42e7 100644 --- a/tests/ui/type/type-check/point-at-inference.rs +++ b/tests/ui/type/type-check/point-at-inference.rs @@ -1,3 +1,4 @@ +// run-rustfix fn bar(_: Vec) {} fn baz(_: &impl std::any::Any) {} fn main() { diff --git a/tests/ui/type/type-check/point-at-inference.stderr b/tests/ui/type/type-check/point-at-inference.stderr index 2e17e5c5f..a76b4f90c 100644 --- a/tests/ui/type/type-check/point-at-inference.stderr +++ b/tests/ui/type/type-check/point-at-inference.stderr @@ -1,18 +1,25 @@ error[E0308]: mismatched types - --> $DIR/point-at-inference.rs:11:9 + --> $DIR/point-at-inference.rs:12:9 | +LL | foo.push(i); + | - this is of type `&{integer}`, which causes `foo` to be inferred as `Vec<&{integer}>` +... LL | bar(foo); - | --- ^^^ expected `i32`, found `&{integer}` + | --- ^^^ expected `Vec`, found `Vec<&{integer}>` | | | arguments to this function are incorrect | = note: expected struct `Vec` found struct `Vec<&{integer}>` note: function defined here - --> $DIR/point-at-inference.rs:1:4 + --> $DIR/point-at-inference.rs:2:4 | LL | fn bar(_: Vec) {} | ^^^ ----------- +help: consider dereferencing the borrow + | +LL | foo.push(*i); + | + error: aborting due to previous error diff --git a/tests/ui/type/type-mismatch-same-crate-name.rs b/tests/ui/type/type-mismatch-same-crate-name.rs index c9cdc874c..2a59bd994 100644 --- a/tests/ui/type/type-mismatch-same-crate-name.rs +++ b/tests/ui/type/type-mismatch-same-crate-name.rs @@ -16,7 +16,7 @@ fn main() { a::try_foo(foo2); //~^ ERROR mismatched types //~| perhaps two different versions of crate `crate_a1` - //~| expected struct `main::a::Foo` + //~| expected `main::a::Foo`, found a different `main::a::Foo` a::try_bar(bar2); //~^ ERROR mismatched types //~| perhaps two different versions of crate `crate_a1` diff --git a/tests/ui/type/type-mismatch-same-crate-name.stderr b/tests/ui/type/type-mismatch-same-crate-name.stderr index fcafd315e..504812f58 100644 --- a/tests/ui/type/type-mismatch-same-crate-name.stderr +++ b/tests/ui/type/type-mismatch-same-crate-name.stderr @@ -2,17 +2,17 @@ error[E0308]: mismatched types --> $DIR/type-mismatch-same-crate-name.rs:16:20 | LL | a::try_foo(foo2); - | ---------- ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo` + | ---------- ^^^^ expected `main::a::Foo`, found a different `main::a::Foo` | | | arguments to this function are incorrect | - = note: struct `main::a::Foo` and struct `main::a::Foo` have similar names, but are actually distinct types -note: struct `main::a::Foo` is defined in crate `crate_a2` + = note: `main::a::Foo` and `main::a::Foo` have similar names, but are actually distinct types +note: `main::a::Foo` is defined in crate `crate_a2` --> $DIR/auxiliary/crate_a2.rs:1:1 | LL | pub struct Foo; | ^^^^^^^^^^^^^^ -note: struct `main::a::Foo` is defined in crate `crate_a1` +note: `main::a::Foo` is defined in crate `crate_a1` --> $DIR/auxiliary/crate_a1.rs:1:1 | LL | pub struct Foo; diff --git a/tests/ui/type/type-mismatch.stderr b/tests/ui/type/type-mismatch.stderr index 6c187bad0..67a1f8930 100644 --- a/tests/ui/type/type-mismatch.stderr +++ b/tests/ui/type/type-mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:17:17 | LL | want::(f); - | ----------- ^ expected struct `foo`, found `usize` + | ----------- ^ expected `foo`, found `usize` | | | arguments to this function are incorrect | @@ -16,7 +16,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:18:17 | LL | want::(f); - | ----------- ^ expected struct `bar`, found `usize` + | ----------- ^ expected `bar`, found `usize` | | | arguments to this function are incorrect | @@ -30,7 +30,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:19:24 | LL | want::>(f); - | ------------------ ^ expected struct `Foo`, found `usize` + | ------------------ ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -46,7 +46,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:20:27 | LL | want::>(f); - | --------------------- ^ expected struct `Foo`, found `usize` + | --------------------- ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -62,7 +62,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:21:22 | LL | want::>(f); - | ---------------- ^ expected struct `Foo`, found `usize` + | ---------------- ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -78,7 +78,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:22:25 | LL | want::>(f); - | ------------------- ^ expected struct `Foo`, found `usize` + | ------------------- ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -94,7 +94,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:23:22 | LL | want::>(f); - | ---------------- ^ expected struct `Foo`, found `usize` + | ---------------- ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -110,7 +110,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:24:25 | LL | want::>(f); - | ------------------- ^ expected struct `Foo`, found `usize` + | ------------------- ^ expected `Foo`, found `usize` | | | arguments to this function are incorrect | @@ -126,7 +126,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:28:19 | LL | want::(f); - | ------------- ^ expected `usize`, found struct `foo` + | ------------- ^ expected `usize`, found `foo` | | | arguments to this function are incorrect | @@ -140,7 +140,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:29:17 | LL | want::(f); - | ----------- ^ expected struct `bar`, found struct `foo` + | ----------- ^ expected `bar`, found `foo` | | | arguments to this function are incorrect | @@ -154,7 +154,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:30:24 | LL | want::>(f); - | ------------------ ^ expected struct `Foo`, found struct `foo` + | ------------------ ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -170,7 +170,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:31:27 | LL | want::>(f); - | --------------------- ^ expected struct `Foo`, found struct `foo` + | --------------------- ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -186,7 +186,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:32:22 | LL | want::>(f); - | ---------------- ^ expected struct `Foo`, found struct `foo` + | ---------------- ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -202,7 +202,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:33:25 | LL | want::>(f); - | ------------------- ^ expected struct `Foo`, found struct `foo` + | ------------------- ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -218,7 +218,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:34:22 | LL | want::>(f); - | ---------------- ^ expected struct `Foo`, found struct `foo` + | ---------------- ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -234,7 +234,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:35:25 | LL | want::>(f); - | ------------------- ^ expected struct `Foo`, found struct `foo` + | ------------------- ^ expected `Foo`, found `foo` | | | arguments to this function are incorrect | @@ -250,7 +250,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:39:19 | LL | want::(f); - | ------------- ^ expected `usize`, found struct `Foo` + | ------------- ^ expected `usize`, found `Foo` | | | arguments to this function are incorrect | @@ -266,7 +266,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:40:17 | LL | want::(f); - | ----------- ^ expected struct `foo`, found struct `Foo` + | ----------- ^ expected `foo`, found `Foo` | | | arguments to this function are incorrect | @@ -282,7 +282,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:41:17 | LL | want::(f); - | ----------- ^ expected struct `bar`, found struct `Foo` + | ----------- ^ expected `bar`, found `Foo` | | | arguments to this function are incorrect | @@ -298,7 +298,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:42:24 | LL | want::>(f); - | ------------------ ^ expected `usize`, found struct `foo` + | ------------------ ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -314,7 +314,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:43:27 | LL | want::>(f); - | --------------------- ^ expected `usize`, found struct `foo` + | --------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -330,7 +330,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:44:25 | LL | want::>(f); - | ------------------- ^ expected struct `B`, found struct `A` + | ------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -346,7 +346,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:45:22 | LL | want::>(f); - | ---------------- ^ expected struct `bar`, found struct `foo` + | ---------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -362,7 +362,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:46:25 | LL | want::>(f); - | ------------------- ^ expected struct `bar`, found struct `foo` + | ------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -380,7 +380,7 @@ error[E0308]: mismatched types LL | want::<&Foo>(f); | ----------------- ^ | | | - | | expected `&Foo`, found struct `Foo` + | | expected `&Foo`, found `Foo` | | help: consider borrowing here: `&f` | arguments to this function are incorrect | @@ -396,7 +396,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:48:26 | LL | want::<&Foo>(f); - | -------------------- ^ expected `&Foo`, found struct `Foo` + | -------------------- ^ expected `&Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -412,7 +412,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:52:19 | LL | want::(f); - | ------------- ^ expected `usize`, found struct `Foo` + | ------------- ^ expected `usize`, found `Foo` | | | arguments to this function are incorrect | @@ -428,7 +428,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:53:17 | LL | want::(f); - | ----------- ^ expected struct `foo`, found struct `Foo` + | ----------- ^ expected `foo`, found `Foo` | | | arguments to this function are incorrect | @@ -444,7 +444,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:54:17 | LL | want::(f); - | ----------- ^ expected struct `bar`, found struct `Foo` + | ----------- ^ expected `bar`, found `Foo` | | | arguments to this function are incorrect | @@ -460,7 +460,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:55:24 | LL | want::>(f); - | ------------------ ^ expected `usize`, found struct `foo` + | ------------------ ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -476,7 +476,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:56:27 | LL | want::>(f); - | --------------------- ^ expected `usize`, found struct `foo` + | --------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -492,7 +492,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:57:22 | LL | want::>(f); - | ---------------- ^ expected struct `A`, found struct `B` + | ---------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -508,7 +508,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:58:22 | LL | want::>(f); - | ---------------- ^ expected struct `bar`, found struct `foo` + | ---------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -524,7 +524,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:59:25 | LL | want::>(f); - | ------------------- ^ expected struct `bar`, found struct `foo` + | ------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -540,7 +540,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:60:23 | LL | want::<&Foo>(f); - | ----------------- ^ expected `&Foo`, found struct `Foo` + | ----------------- ^ expected `&Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -558,7 +558,7 @@ error[E0308]: mismatched types LL | want::<&Foo>(f); | -------------------- ^ | | | - | | expected `&Foo`, found struct `Foo` + | | expected `&Foo`, found `Foo` | | help: consider borrowing here: `&f` | arguments to this function are incorrect | @@ -574,7 +574,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:65:19 | LL | want::(f); - | ------------- ^ expected `usize`, found struct `Foo` + | ------------- ^ expected `usize`, found `Foo` | | | arguments to this function are incorrect | @@ -590,7 +590,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:66:17 | LL | want::(f); - | ----------- ^ expected struct `foo`, found struct `Foo` + | ----------- ^ expected `foo`, found `Foo` | | | arguments to this function are incorrect | @@ -606,7 +606,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:67:17 | LL | want::(f); - | ----------- ^ expected struct `bar`, found struct `Foo` + | ----------- ^ expected `bar`, found `Foo` | | | arguments to this function are incorrect | @@ -622,7 +622,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:68:24 | LL | want::>(f); - | ------------------ ^ expected `usize`, found struct `foo` + | ------------------ ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -638,7 +638,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:69:27 | LL | want::>(f); - | --------------------- ^ expected `usize`, found struct `foo` + | --------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -654,7 +654,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:70:22 | LL | want::>(f); - | ---------------- ^ expected struct `A`, found struct `B` + | ---------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -670,7 +670,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:71:25 | LL | want::>(f); - | ------------------- ^ expected struct `B`, found struct `A` + | ------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -686,7 +686,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:72:22 | LL | want::>(f); - | ---------------- ^ expected struct `bar`, found struct `foo` + | ---------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -702,7 +702,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:73:25 | LL | want::>(f); - | ------------------- ^ expected struct `bar`, found struct `foo` + | ------------------- ^ expected `Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -718,7 +718,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:74:23 | LL | want::<&Foo>(f); - | ----------------- ^ expected `&Foo`, found struct `Foo` + | ----------------- ^ expected `&Foo`, found `Foo` | | | arguments to this function are incorrect | @@ -734,7 +734,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:75:26 | LL | want::<&Foo>(f); - | -------------------- ^ expected `&Foo`, found struct `Foo` + | -------------------- ^ expected `&Foo`, found `Foo` | | | arguments to this function are incorrect | diff --git a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr index 4d012cb15..fbe6bfeeb 100644 --- a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr +++ b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr @@ -95,7 +95,7 @@ LL | let x: u16 = (S {}).method(0u32); | ^^^^^^^^^^^^^^----^ | | | this argument influences the return type of `method` -note: associated function defined here +note: method defined here --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:7:8 | LL | fn method(&self, x: T) -> T { diff --git a/tests/ui/typeck/assign-non-lval-derefmut.stderr b/tests/ui/typeck/assign-non-lval-derefmut.stderr index e394cf820..b26d16da0 100644 --- a/tests/ui/typeck/assign-non-lval-derefmut.stderr +++ b/tests/ui/typeck/assign-non-lval-derefmut.stderr @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | let mut y = x.lock().unwrap(); | ----------------- expected due to this value LL | y = 2; - | ^ expected struct `MutexGuard`, found integer + | ^ expected `MutexGuard<'_, usize>`, found integer | = note: expected struct `MutexGuard<'_, usize>` found type `{integer}` diff --git a/tests/ui/typeck/bad-type-in-vec-contains.rs b/tests/ui/typeck/bad-type-in-vec-contains.rs new file mode 100644 index 000000000..4433047b7 --- /dev/null +++ b/tests/ui/typeck/bad-type-in-vec-contains.rs @@ -0,0 +1,7 @@ +// The error message here still is pretty confusing. + +fn main() { + let primes = Vec::new(); + primes.contains(3); + //~^ ERROR mismatched types +} diff --git a/tests/ui/typeck/bad-type-in-vec-contains.stderr b/tests/ui/typeck/bad-type-in-vec-contains.stderr new file mode 100644 index 000000000..0e03388d2 --- /dev/null +++ b/tests/ui/typeck/bad-type-in-vec-contains.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/bad-type-in-vec-contains.rs:5:21 + | +LL | primes.contains(3); + | -------- ^ + | | | + | | expected `&_`, found integer + | | help: consider borrowing here: `&3` + | arguments to this method are incorrect + | here the type of `primes` is inferred to be `[_]` + | + = note: expected reference `&_` + found type `{integer}` +note: method defined here + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/bad-type-in-vec-push.rs b/tests/ui/typeck/bad-type-in-vec-push.rs new file mode 100644 index 000000000..a807f030c --- /dev/null +++ b/tests/ui/typeck/bad-type-in-vec-push.rs @@ -0,0 +1,20 @@ +// The error message here still is pretty confusing. + +fn main() { + let mut result = vec![1]; + // The type of `result` is constrained to be `Vec<{integer}>` here. + // But the logic we use to find what expression constrains a type + // is not sophisticated enough to know this. + + let mut vector = Vec::new(); + vector.sort(); + result.push(vector); + //~^ ERROR mismatched types + // So it thinks that the type of `result` is constrained here. +} + +fn example2() { + let mut x = vec![1]; + x.push(""); + //~^ ERROR mismatched types +} diff --git a/tests/ui/typeck/bad-type-in-vec-push.stderr b/tests/ui/typeck/bad-type-in-vec-push.stderr new file mode 100644 index 000000000..ae46050c9 --- /dev/null +++ b/tests/ui/typeck/bad-type-in-vec-push.stderr @@ -0,0 +1,29 @@ +error[E0308]: mismatched types + --> $DIR/bad-type-in-vec-push.rs:11:17 + | +LL | vector.sort(); + | ------ here the type of `vector` is inferred to be `Vec<_>` +LL | result.push(vector); + | ---- ^^^^^^ expected integer, found `Vec<_>` + | | + | arguments to this method are incorrect + | + = note: expected type `{integer}` + found struct `Vec<_>` +note: method defined here + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error[E0308]: mismatched types + --> $DIR/bad-type-in-vec-push.rs:18:12 + | +LL | x.push(""); + | ---- ^^ expected integer, found `&str` + | | + | arguments to this method are incorrect + | +note: method defined here + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/conversion-methods.stderr b/tests/ui/typeck/conversion-methods.stderr index 091502bdd..a9b5078cc 100644 --- a/tests/ui/typeck/conversion-methods.stderr +++ b/tests/ui/typeck/conversion-methods.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; | ------ ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found `&str` + | | expected `String`, found `&str` | expected due to this error[E0308]: mismatched types @@ -13,7 +13,7 @@ error[E0308]: mismatched types LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()` | | | - | | expected struct `PathBuf`, found `&Path` + | | expected `PathBuf`, found `&Path` | expected due to this error[E0308]: mismatched types @@ -22,14 +22,14 @@ error[E0308]: mismatched types LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here | ------ ^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found integer + | | expected `String`, found integer | expected due to this error[E0308]: mismatched types --> $DIR/conversion-methods.rs:12:47 | LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; - | ---------- ^^^^^^^^^^ expected struct `Vec`, found `&[{integer}; 3]` + | ---------- ^^^^^^^^^^ expected `Vec`, found `&[{integer}; 3]` | | | expected due to this | diff --git a/tests/ui/typeck/deref-multi.stderr b/tests/ui/typeck/deref-multi.stderr index bd6575c73..4346e273d 100644 --- a/tests/ui/typeck/deref-multi.stderr +++ b/tests/ui/typeck/deref-multi.stderr @@ -58,7 +58,7 @@ error[E0308]: mismatched types LL | fn d(x: std::sync::Mutex<&i32>) -> i32 { | --- expected `i32` because of return type LL | x.lock().unwrap() - | ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `MutexGuard` + | ^^^^^^^^^^^^^^^^^ expected `i32`, found `MutexGuard<'_, &i32>` | = note: expected type `i32` found struct `MutexGuard<'_, &i32>` diff --git a/tests/ui/typeck/explain_clone_autoref.rs b/tests/ui/typeck/explain_clone_autoref.rs index 9279e4c39..4d2157470 100644 --- a/tests/ui/typeck/explain_clone_autoref.rs +++ b/tests/ui/typeck/explain_clone_autoref.rs @@ -9,5 +9,5 @@ fn clone_thing(nc: &NotClone) -> NotClone { nc.clone() //~^ ERROR mismatched type //~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead - //~| NOTE expected struct `NotClone`, found `&NotClone` + //~| NOTE expected `NotClone`, found `&NotClone` } diff --git a/tests/ui/typeck/explain_clone_autoref.stderr b/tests/ui/typeck/explain_clone_autoref.stderr index ff36e18d2..4539da438 100644 --- a/tests/ui/typeck/explain_clone_autoref.stderr +++ b/tests/ui/typeck/explain_clone_autoref.stderr @@ -5,7 +5,7 @@ LL | fn clone_thing(nc: &NotClone) -> NotClone { | -------- expected `NotClone` because of return type LL | LL | nc.clone() - | ^^^^^^^^^^ expected struct `NotClone`, found `&NotClone` + | ^^^^^^^^^^ expected `NotClone`, found `&NotClone` | note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead --> $DIR/explain_clone_autoref.rs:9:5 diff --git a/tests/ui/typeck/issue-100246.stderr b/tests/ui/typeck/issue-100246.stderr index 8b77de94e..428a07920 100644 --- a/tests/ui/typeck/issue-100246.stderr +++ b/tests/ui/typeck/issue-100246.stderr @@ -2,7 +2,7 @@ error[E0308]: `?` operator has incompatible types --> $DIR/issue-100246.rs:28:24 | LL | let other: Other = downcast()?; - | ^^^^^^^^^^^ expected struct `Other`, found reference + | ^^^^^^^^^^^ expected `Other`, found `&_` | = note: `?` operator cannot convert from `&_` to `Other` = note: expected struct `Other` diff --git a/tests/ui/typeck/issue-104513-ice.stderr b/tests/ui/typeck/issue-104513-ice.stderr index 42cfe38ae..09187d786 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 = S; | ^^^^ not found in this scope -error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings --> $DIR/issue-104513-ice.rs:3:14 | LL | let _: S = S; diff --git a/tests/ui/typeck/issue-107087.rs b/tests/ui/typeck/issue-107087.rs new file mode 100644 index 000000000..135cdf19e --- /dev/null +++ b/tests/ui/typeck/issue-107087.rs @@ -0,0 +1,18 @@ +struct A(T); + +trait Foo { + type B; +} + +impl Foo for A { + type B = i32; +} + +impl Foo for A { + type B = i32; +} + +fn main() { + A::B::<>::C + //~^ ERROR ambiguous associated type +} diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr new file mode 100644 index 000000000..70f193208 --- /dev/null +++ b/tests/ui/typeck/issue-107087.stderr @@ -0,0 +1,9 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-107087.rs:16:5 + | +LL | A::B::<>::C + | ^^^^^^^^ help: use the fully-qualified path: ` as Foo>::B` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/typeck/issue-107775.rs b/tests/ui/typeck/issue-107775.rs new file mode 100644 index 000000000..6fbac2ee9 --- /dev/null +++ b/tests/ui/typeck/issue-107775.rs @@ -0,0 +1,40 @@ +// edition: 2021 + +use std::collections::HashMap; +use std::future::Future; +use std::pin::Pin; + +pub trait Trait { + fn do_something<'async_trait>(byte: u8) + -> + Pin + + Send + 'async_trait>>; +} + +pub struct Struct; + +impl Trait for Struct { + fn do_something<'async_trait>(byte: u8) + -> + Pin + + Send + 'async_trait>> { + Box::pin( + + async move { let byte = byte; let _: () = {}; }) + } +} + +pub struct Map { + map: HashMap Pin + Send>>>, +} + +impl Map { + pub fn new() -> Self { + let mut map = HashMap::new(); + map.insert(1, Struct::do_something); + Self { map } + //~^ ERROR mismatched types + } +} + +fn main() {} diff --git a/tests/ui/typeck/issue-107775.stderr b/tests/ui/typeck/issue-107775.stderr new file mode 100644 index 000000000..9ee9c022c --- /dev/null +++ b/tests/ui/typeck/issue-107775.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/issue-107775.rs:35:16 + | +LL | map.insert(1, Struct::do_something); + | - -------------------- this is of type `fn(u8) -> Pin + Send>> {::do_something::<'_>}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin + Send>> {::do_something::<'_>}>` + | | + | this is of type `{integer}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin + Send>> {::do_something::<'_>}>` +LL | Self { map } + | ^^^ expected `HashMap Pin<...>>`, found `HashMap<{integer}, ...>` + | + = note: expected struct `HashMap Pin + Send + 'static)>>>` + found struct `HashMap<{integer}, fn(_) -> Pin + Send>> {::do_something::<'_>}>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr index 876ac2c67..11d34f5b9 100644 --- a/tests/ui/typeck/issue-13853.stderr +++ b/tests/ui/typeck/issue-13853.stderr @@ -5,7 +5,7 @@ LL | fn nodes<'a, I: Iterator>(&self) -> I | - this type parameter - expected `I` because of return type ... LL | self.iter() - | ^^^^^^^^^^^ expected type parameter `I`, found struct `Iter` + | ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>` | = note: expected type parameter `I` found struct `std::slice::Iter<'_, N>` @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | iterate(graph); | ------- ^^^^^ | | | - | | expected reference, found struct `Vec` + | | expected `&_`, found `Vec` | | help: consider borrowing here: `&graph` | arguments to this function are incorrect | diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr index f3be99f9b..b622122f3 100644 --- a/tests/ui/typeck/issue-31173.stderr +++ b/tests/ui/typeck/issue-31173.stderr @@ -2,7 +2,7 @@ error[E0271]: expected `TakeWhile<&mut IntoIter, [closure@issue-31173.rs:7:2 --> $DIR/issue-31173.rs:11:10 | LL | .cloned() - | ^^^^^^ expected reference, found `u8` + | ^^^^^^ expected `&_`, found `u8` | = note: expected reference `&_` found type `u8` @@ -24,8 +24,17 @@ note: required by a bound in `cloned` error[E0599]: the method `collect` exists for struct `Cloned, [closure@issue-31173.rs:7:21]>>`, but its trait bounds were not satisfied --> $DIR/issue-31173.rs:12:10 | -LL | .collect(); - | ^^^^^^^ method cannot be called due to unsatisfied trait bounds +LL | let temp: Vec = it + | _________________________- +LL | | .take_while(|&x| { +LL | | found_e = true; +LL | | false +LL | | }) +LL | | .cloned() +LL | | .collect(); + | | -^^^^^^^ method cannot be called due to unsatisfied trait bounds + | |_________| + | --> $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL | = note: doesn't satisfy `<_ as Iterator>::Item = &_` diff --git a/tests/ui/typeck/issue-46112.stderr b/tests/ui/typeck/issue-46112.stderr index 8f5ff51fb..26fc21dda 100644 --- a/tests/ui/typeck/issue-46112.stderr +++ b/tests/ui/typeck/issue-46112.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-46112.rs:9:21 | LL | fn main() { test(Ok(())); } - | -- ^^ expected enum `Option`, found `()` + | -- ^^ expected `Option<()>`, found `()` | | | arguments to this enum variant are incorrect | diff --git a/tests/ui/typeck/issue-50687-ice-on-borrow.stderr b/tests/ui/typeck/issue-50687-ice-on-borrow.stderr index e6a0edac4..9e48ccefd 100644 --- a/tests/ui/typeck/issue-50687-ice-on-borrow.stderr +++ b/tests/ui/typeck/issue-50687-ice-on-borrow.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-50687-ice-on-borrow.rs:40:17 | LL | let _: () = Borrow::borrow(&owned); - | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found reference + | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&_` | | | expected due to this | diff --git a/tests/ui/typeck/issue-53712.rs b/tests/ui/typeck/issue-53712.rs new file mode 100644 index 000000000..2353904d7 --- /dev/null +++ b/tests/ui/typeck/issue-53712.rs @@ -0,0 +1,9 @@ +// issue #53712: make the error generated by using tuple indexing on an array more specific + +fn main() { + let arr = [10, 20, 30, 40, 50]; + arr.0; + //~^ ERROR no field `0` on type `[{integer}; 5]` [E0609] + //~| HELP instead of using tuple indexing, use array indexing + //~| SUGGESTION arr[0] +} diff --git a/tests/ui/typeck/issue-53712.stderr b/tests/ui/typeck/issue-53712.stderr new file mode 100644 index 000000000..db85919af --- /dev/null +++ b/tests/ui/typeck/issue-53712.stderr @@ -0,0 +1,11 @@ +error[E0609]: no field `0` on type `[{integer}; 5]` + --> $DIR/issue-53712.rs:5:9 + | +LL | arr.0; + | ----^ + | | + | help: instead of using tuple indexing, use array indexing: `arr[0]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. 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 b92a6f2ec..dc4bc5b5f 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 @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn ice(x: Box>) { | - help: try adding a return type: `-> (dyn Iterator + 'static)` LL | *x - | ^^ expected `()`, found trait object `dyn Iterator` + | ^^ expected `()`, found `dyn Iterator` | = note: expected unit type `()` found trait object `(dyn Iterator + 'static)` diff --git a/tests/ui/typeck/issue-67971.stderr b/tests/ui/typeck/issue-67971.stderr index 5d07f9cc7..d50ed9cf1 100644 --- a/tests/ui/typeck/issue-67971.stderr +++ b/tests/ui/typeck/issue-67971.stderr @@ -8,7 +8,7 @@ error[E0308]: mismatched types --> $DIR/issue-67971.rs:3:24 | LL | fn foo(ctx: &mut S) -> String { - | --- ^^^^^^ expected struct `String`, found `()` + | --- ^^^^^^ expected `String`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression diff --git a/tests/ui/typeck/issue-75883.rs b/tests/ui/typeck/issue-75883.rs index 885acc482..c50ea0a08 100644 --- a/tests/ui/typeck/issue-75883.rs +++ b/tests/ui/typeck/issue-75883.rs @@ -4,7 +4,7 @@ pub struct UI {} impl UI { pub fn run() -> Result<_> { - //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied + //~^ ERROR: enum takes 2 generic arguments but 1 generic argument was supplied //~| ERROR: the placeholder `_` is not allowed within types on item signatures for return types let mut ui = UI {}; ui.interact(); @@ -13,7 +13,7 @@ impl UI { } pub fn interact(&mut self) -> Result<_> { - //~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied + //~^ ERROR: enum takes 2 generic arguments but 1 generic argument was supplied //~| ERROR: the placeholder `_` is not allowed within types on item signatures for return types unimplemented!(); } diff --git a/tests/ui/typeck/issue-75883.stderr b/tests/ui/typeck/issue-75883.stderr index f5adcabe3..a1ed08406 100644 --- a/tests/ui/typeck/issue-75883.stderr +++ b/tests/ui/typeck/issue-75883.stderr @@ -1,4 +1,4 @@ -error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-75883.rs:6:21 | LL | pub fn run() -> Result<_> { @@ -11,7 +11,7 @@ help: add missing generic argument LL | pub fn run() -> Result<_, E> { | +++ -error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied --> $DIR/issue-75883.rs:15:35 | LL | pub fn interact(&mut self) -> Result<_> { diff --git a/tests/ui/typeck/issue-7813.rs b/tests/ui/typeck/issue-7813.rs new file mode 100644 index 000000000..ce549bde6 --- /dev/null +++ b/tests/ui/typeck/issue-7813.rs @@ -0,0 +1,4 @@ +fn main() { + let v = &[]; //~ ERROR type annotations needed + let it = v.iter(); +} diff --git a/tests/ui/typeck/issue-7813.stderr b/tests/ui/typeck/issue-7813.stderr new file mode 100644 index 000000000..2a747f679 --- /dev/null +++ b/tests/ui/typeck/issue-7813.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `&[_; 0]` + --> $DIR/issue-7813.rs:2:9 + | +LL | let v = &[]; + | ^ --- type must be known at this point + | +help: consider giving `v` an explicit type, where the placeholders `_` are specified + | +LL | let v: &[_; 0] = &[]; + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/typeck/issue-84160.stderr b/tests/ui/typeck/issue-84160.stderr index 24c188b3f..4d456ae84 100644 --- a/tests/ui/typeck/issue-84160.stderr +++ b/tests/ui/typeck/issue-84160.stderr @@ -5,7 +5,7 @@ LL | fn mismatched_types_with_reference(x: &u32) -> &u32 { | ---- expected `&u32` because of return type ... LL | return "test"; - | ^^^^^^ expected `u32`, found `str` + | ^^^^^^ expected `&u32`, found `&str` | = note: expected reference `&u32` found reference `&'static str` diff --git a/tests/ui/typeck/issue-84768.stderr b/tests/ui/typeck/issue-84768.stderr index 09f3aee2d..3d2d53f5c 100644 --- a/tests/ui/typeck/issue-84768.stderr +++ b/tests/ui/typeck/issue-84768.stderr @@ -8,7 +8,7 @@ error[E0308]: mismatched types --> $DIR/issue-84768.rs:7:42 | LL | ::call_once(f, 1) - | --------------------------------- ^ expected tuple, found integer + | --------------------------------- ^ expected `(&mut u8,)`, found integer | | | arguments to this function are incorrect | @@ -21,7 +21,7 @@ LL | ::call_once(f, 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^ | | | this argument influences the return type of `FnOnce` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-89856.fixed b/tests/ui/typeck/issue-89856.fixed new file mode 100644 index 000000000..3e1a006ef --- /dev/null +++ b/tests/ui/typeck/issue-89856.fixed @@ -0,0 +1,18 @@ +// run-rustfix + +fn take_str_maybe(_: Option<&str>) { } +fn main() { + let string = String::from("Hello, world"); + + let option: Option = Some(string.clone()); + take_str_maybe(option.as_deref()); + //~^ ERROR: mismatched types [E0308] + + let option_ref = Some(&string); + take_str_maybe(option_ref.map(|x| x.as_str())); + //~^ ERROR: mismatched types [E0308] + + let option_ref_ref = option_ref.as_ref(); + take_str_maybe(option_ref_ref.map(|x| x.as_str())); + //~^ ERROR: mismatched types [E0308] +} diff --git a/tests/ui/typeck/issue-89856.rs b/tests/ui/typeck/issue-89856.rs index b021e349e..cfe6e19b3 100644 --- a/tests/ui/typeck/issue-89856.rs +++ b/tests/ui/typeck/issue-89856.rs @@ -1,8 +1,18 @@ -fn take_str_maybe(x: Option<&str>) -> Option<&str> { None } +// run-rustfix +fn take_str_maybe(_: Option<&str>) { } fn main() { let string = String::from("Hello, world"); - let option = Some(&string); + + let option: Option = Some(string.clone()); take_str_maybe(option); //~^ ERROR: mismatched types [E0308] + + let option_ref = Some(&string); + take_str_maybe(option_ref); + //~^ ERROR: mismatched types [E0308] + + let option_ref_ref = option_ref.as_ref(); + take_str_maybe(option_ref_ref); + //~^ ERROR: mismatched types [E0308] } diff --git a/tests/ui/typeck/issue-89856.stderr b/tests/ui/typeck/issue-89856.stderr index 5fa1ae1a5..bd76f1724 100644 --- a/tests/ui/typeck/issue-89856.stderr +++ b/tests/ui/typeck/issue-89856.stderr @@ -1,23 +1,63 @@ error[E0308]: mismatched types - --> $DIR/issue-89856.rs:6:20 + --> $DIR/issue-89856.rs:8:20 | LL | take_str_maybe(option); - | -------------- ^^^^^^ expected `str`, found struct `String` + | -------------- ^^^^^^ expected `Option<&str>`, found `Option` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<&str>` + found enum `Option` +note: function defined here + --> $DIR/issue-89856.rs:3:4 + | +LL | fn take_str_maybe(_: Option<&str>) { } + | ^^^^^^^^^^^^^^ --------------- +help: try converting the passed type into a `&str` + | +LL | take_str_maybe(option.as_deref()); + | +++++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-89856.rs:12:20 + | +LL | take_str_maybe(option_ref); + | -------------- ^^^^^^^^^^ expected `Option<&str>`, found `Option<&String>` | | | arguments to this function are incorrect | = note: expected enum `Option<&str>` found enum `Option<&String>` note: function defined here - --> $DIR/issue-89856.rs:1:4 + --> $DIR/issue-89856.rs:3:4 + | +LL | fn take_str_maybe(_: Option<&str>) { } + | ^^^^^^^^^^^^^^ --------------- +help: try converting the passed type into a `&str` + | +LL | take_str_maybe(option_ref.map(|x| x.as_str())); + | ++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-89856.rs:16:20 + | +LL | take_str_maybe(option_ref_ref); + | -------------- ^^^^^^^^^^^^^^ expected `Option<&str>`, found `Option<&&String>` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<&str>` + found enum `Option<&&String>` +note: function defined here + --> $DIR/issue-89856.rs:3:4 | -LL | fn take_str_maybe(x: Option<&str>) -> Option<&str> { None } +LL | fn take_str_maybe(_: Option<&str>) { } | ^^^^^^^^^^^^^^ --------------- help: try converting the passed type into a `&str` | -LL | take_str_maybe(option.map(|x| &**x)); - | ++++++++++++++ +LL | take_str_maybe(option_ref_ref.map(|x| x.as_str())); + | ++++++++++++++++++++ -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs new file mode 100644 index 000000000..8ccb15ca4 --- /dev/null +++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.rs @@ -0,0 +1,21 @@ +// edition:2018 + +async fn hello() { //~ HELP try adding a return type + 0 + //~^ ERROR [E0308] +} + +async fn world() -> () { + 0 + //~^ ERROR [E0308] +} + +async fn suggest_await_in_async_fn_return() { + hello() + //~^ ERROR mismatched types [E0308] + //~| HELP consider `await`ing on the `Future` + //~| HELP consider using a semicolon here + //~| SUGGESTION .await +} + +fn main() {} diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr new file mode 100644 index 000000000..0d72ae118 --- /dev/null +++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr @@ -0,0 +1,39 @@ +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` +LL | 0 + | ^ expected `()`, found integer + +error[E0308]: mismatched types + --> $DIR/issue-90027-async-fn-return-suggestion.rs:9:5 + | +LL | async fn world() -> () { + | -- expected `()` because of return type +LL | 0 + | ^ expected `()`, found integer + +error[E0308]: mismatched types + --> $DIR/issue-90027-async-fn-return-suggestion.rs:14:5 + | +LL | hello() + | ^^^^^^^ expected `()`, found future + | +note: calling an async function returns a future + --> $DIR/issue-90027-async-fn-return-suggestion.rs:14:5 + | +LL | hello() + | ^^^^^^^ +help: consider `await`ing on the `Future` + | +LL | hello().await + | ++++++ +help: consider using a semicolon here + | +LL | hello(); + | + + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-91334.rs b/tests/ui/typeck/issue-91334.rs index bf9a5a626..29204276b 100644 --- a/tests/ui/typeck/issue-91334.rs +++ b/tests/ui/typeck/issue-91334.rs @@ -1,9 +1,6 @@ // Regression test for the ICE described in issue #91334. // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected one of -// error-pattern: mismatched closing delimiter -// error-pattern: mismatched types #![feature(generators)] diff --git a/tests/ui/typeck/issue-91334.stderr b/tests/ui/typeck/issue-91334.stderr index 8508f7a38..7cb30eea5 100644 --- a/tests/ui/typeck/issue-91334.stderr +++ b/tests/ui/typeck/issue-91334.stderr @@ -1,32 +1,5 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-91334.rs:10:23 - | -LL | fn f(){||yield(((){), - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-91334.rs:10:23 - | -LL | fn f(){||yield(((){), - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `{` - --> $DIR/issue-91334.rs:10:19 - | -LL | fn f(){||yield(((){), - | ^ - | | - | expected one of `)`, `,`, `.`, `?`, or an operator - | help: missing `,` - error: mismatched closing delimiter: `)` - --> $DIR/issue-91334.rs:10:19 + --> $DIR/issue-91334.rs:7:19 | LL | fn f(){||yield(((){), | - ^^ mismatched closing delimiter @@ -34,17 +7,15 @@ LL | fn f(){||yield(((){), | | unclosed delimiter | closing delimiter possibly meant for this -error[E0308]: mismatched types - --> $DIR/issue-91334.rs:10:8 +error: this file contains an unclosed delimiter + --> $DIR/issue-91334.rs:7:23 | LL | fn f(){||yield(((){), - | -^^^^^^^^^^^^^^^ expected `()`, found generator - | | - | help: a return type might be missing here: `-> _` - | - = note: expected unit type `()` - found generator `[generator@$DIR/issue-91334.rs:10:8: 10:10]` + | - - - ^ + | | | | + | | | missing open `(` for this delimiter + | | unclosed delimiter + | unclosed delimiter -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-91450-inner-ty-error.stderr b/tests/ui/typeck/issue-91450-inner-ty-error.stderr index 32f4c8f6f..7ca5446c2 100644 --- a/tests/ui/typeck/issue-91450-inner-ty-error.stderr +++ b/tests/ui/typeck/issue-91450-inner-ty-error.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-91450-inner-ty-error.rs:4:13 | LL | fn foo() -> Option<_> {} - | --- ^^^^^^^^^ expected enum `Option`, found `()` + | --- ^^^^^^^^^ expected `Option<_>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/typeck/issue-92481.rs b/tests/ui/typeck/issue-92481.rs index 0a6b1843d..f752400bb 100644 --- a/tests/ui/typeck/issue-92481.rs +++ b/tests/ui/typeck/issue-92481.rs @@ -2,13 +2,8 @@ #![crate_type="lib"] -fn r({) { - Ok { //~ ERROR mismatched types [E0308] +fn r({) { //~ ERROR mismatched closing delimiter + Ok { d..||_=m } } -//~^^^^^ ERROR expected parameter name, found `{` -//~| ERROR expected one of `,`, `:`, or `}`, found `..` -//~^^^^^ ERROR cannot find value `d` in this scope [E0425] -//~| ERROR cannot find value `m` in this scope [E0425] -//~| ERROR variant `Result<_, _>::Ok` has no field named `d` [E0559] diff --git a/tests/ui/typeck/issue-92481.stderr b/tests/ui/typeck/issue-92481.stderr index cd778a649..d87d3277d 100644 --- a/tests/ui/typeck/issue-92481.stderr +++ b/tests/ui/typeck/issue-92481.stderr @@ -1,60 +1,11 @@ -error: expected parameter name, found `{` +error: mismatched closing delimiter: `)` --> $DIR/issue-92481.rs:5:6 | LL | fn r({) { - | ^ expected parameter name + | -^^ mismatched closing delimiter + | || + | |unclosed delimiter + | closing delimiter possibly meant for this -error: expected one of `,`, `:`, or `}`, found `..` - --> $DIR/issue-92481.rs:5:6 - | -LL | fn r({) { - | ^ unclosed delimiter -LL | Ok { -LL | d..||_=m - | -^ - | | - | help: `}` may belong here - -error[E0425]: cannot find value `d` in this scope - --> $DIR/issue-92481.rs:7:9 - | -LL | d..||_=m - | ^ not found in this scope - -error[E0425]: cannot find value `m` in this scope - --> $DIR/issue-92481.rs:7:16 - | -LL | d..||_=m - | ^ not found in this scope - -error[E0559]: variant `Result<_, _>::Ok` has no field named `d` - --> $DIR/issue-92481.rs:7:9 - | -LL | d..||_=m - | ^ field does not exist - --> $SRC_DIR/core/src/result.rs:LL:COL - | - = note: `Result<_, _>::Ok` defined here - | -help: `Result<_, _>::Ok` is a tuple variant, use the appropriate syntax - | -LL | Result<_, _>::Ok(/* fields */) - | - -error[E0308]: mismatched types - --> $DIR/issue-92481.rs:6:5 - | -LL | fn r({) { - | - help: a return type might be missing here: `-> _` -LL | / Ok { -LL | | d..||_=m -LL | | } - | |_____^ expected `()`, found enum `Result` - | - = note: expected unit type `()` - found enum `Result<_, _>` - -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0308, E0425, E0559. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-96530.stderr b/tests/ui/typeck/issue-96530.stderr index 4b4568b1d..3a67ef026 100644 --- a/tests/ui/typeck/issue-96530.stderr +++ b/tests/ui/typeck/issue-96530.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-96530.rs:9:11 | LL | ..man.clone() - | ^^^^^^^^^^^ expected struct `Person`, found `&Person` + | ^^^^^^^^^^^ expected `Person`, found `&Person` error: aborting due to previous error diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs new file mode 100644 index 000000000..5ff567cd0 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.rs @@ -0,0 +1,6 @@ +// compile-flags: -Ztrait-solver=next +// known-bug: unknown + +fn main() { + (0u8 + 0u8) as char; +} diff --git a/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr new file mode 100644 index 000000000..6b09ccd52 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/cast-checks-handling-projections.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `char == ::Output` + --> $DIR/cast-checks-handling-projections.rs:5:5 + | +LL | (0u8 + 0u8) as char; + | ^^^^^^^^^^^ types differ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs new file mode 100644 index 000000000..019c6e81c --- /dev/null +++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs @@ -0,0 +1,24 @@ +// compile-flags: -Ztrait-solver=next +// known-bug: unknown + +trait Test { + type Assoc; +} + +fn transform(x: T) -> T::Assoc { + todo!() +} + +impl Test for i32 { + type Assoc = i32; +} + +impl Test for String { + type Assoc = String; +} + +fn main() { + let mut x = Default::default(); + x = transform(x); + x = 1i32; +} diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr new file mode 100644 index 000000000..57cbc65a1 --- /dev/null +++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/equating-projection-cyclically.rs:22:19 + | +LL | x = transform(x); + | ^ expected inferred type, found associated type + | + = note: expected type `_` + found associated type `<_ as Test>::Assoc` + = help: consider constraining the associated type `<_ as Test>::Assoc` to `_` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/remove-extra-argument.stderr b/tests/ui/typeck/remove-extra-argument.stderr index b734bcd4e..72ddebab4 100644 --- a/tests/ui/typeck/remove-extra-argument.stderr +++ b/tests/ui/typeck/remove-extra-argument.stderr @@ -2,17 +2,16 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/remove-extra-argument.rs:6:5 | LL | l(vec![], vec![]) - | ^ ------ argument of type `Vec<_>` unexpected + | ^ -------- + | | | + | | unexpected argument of type `Vec<_>` + | help: remove the extra argument | note: function defined here --> $DIR/remove-extra-argument.rs:3:4 | LL | fn l(_a: Vec) {} | ^ ----------- -help: remove the extra argument - | -LL | l(vec![]) - | ~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/typeck/return_type_containing_closure.rs b/tests/ui/typeck/return_type_containing_closure.rs index 29624e08a..8b826daee 100644 --- a/tests/ui/typeck/return_type_containing_closure.rs +++ b/tests/ui/typeck/return_type_containing_closure.rs @@ -2,7 +2,7 @@ fn foo() { //~ HELP a return type might be missing here vec!['a'].iter().map(|c| c) //~^ ERROR mismatched types [E0308] - //~| NOTE expected `()`, found struct `Map` + //~| NOTE expected `()`, found `Map, ...>` //~| NOTE expected unit type `()` //~| HELP consider using a semicolon here } diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr index 101aee395..f9a240963 100644 --- a/tests/ui/typeck/return_type_containing_closure.stderr +++ b/tests/ui/typeck/return_type_containing_closure.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/return_type_containing_closure.rs:3:5 | LL | vec!['a'].iter().map(|c| c) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Map` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map, ...>` | = note: expected unit type `()` found struct `Map, [closure@$DIR/return_type_containing_closure.rs:3:26: 3:29]>` diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr index fbced928a..57cbd1d20 100644 --- a/tests/ui/typeck/struct-enum-wrong-args.stderr +++ b/tests/ui/typeck/struct-enum-wrong-args.stderr @@ -2,29 +2,29 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:6:13 | LL | let _ = Some(3, 2); - | ^^^^ - argument of type `{integer}` unexpected + | ^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL -help: remove the extra argument - | -LL | let _ = Some(3); - | ~~~ error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:7:13 | LL | let _ = Ok(3, 6, 2); - | ^^ - - argument of type `{integer}` unexpected + | ^^ - - unexpected argument of type `{integer}` | | - | argument of type `{integer}` unexpected + | unexpected argument of type `{integer}` | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: remove the extra arguments | -LL | let _ = Ok(3); - | ~~~ +LL - let _ = Ok(3, 6, 2); +LL + let _ = Ok(3); + | error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:8:13 @@ -59,17 +59,16 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 | LL | let _ = Wrapper(5, 2); - | ^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:2:8 | LL | struct Wrapper(i32); | ^^^^^^^ -help: remove the extra argument - | -LL | let _ = Wrapper(5); - | ~~~ error[E0061]: this struct takes 2 arguments but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:11:13 @@ -107,17 +106,16 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 | LL | let _ = DoubleWrapper(5, 2, 7); - | ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^^^^^^ --- + | | | + | | unexpected argument of type `{integer}` + | help: remove the extra argument | note: tuple struct defined here --> $DIR/struct-enum-wrong-args.rs:3:8 | LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ -help: remove the extra argument - | -LL | let _ = DoubleWrapper(5, 2); - | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs index c463a8ad0..7ff9199f6 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -1,17 +1,17 @@ fn foo1, U>(x: T) {} -//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied +//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied trait Trait: Copy {} -//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied +//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied struct MyStruct1>; -//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied +//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied struct MyStruct2<'a, T: Copy<'a>>; -//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied +//~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} -//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied -//~| ERROR this trait takes 0 generic arguments but 1 generic argument was supplied +//~^ ERROR trait takes 0 lifetime arguments but 1 lifetime argument was supplied +//~| ERROR trait takes 0 generic arguments but 1 generic argument was supplied fn main() { } diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 331540d1e..a71fd9536 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1, U>(x: T) {} @@ -6,7 +6,7 @@ LL | fn foo1, U>(x: T) {} | | | expected 0 generic arguments -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} @@ -14,7 +14,7 @@ LL | trait Trait: Copy {} | | | expected 0 generic arguments -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:7:21 | LL | struct MyStruct1>; @@ -22,7 +22,7 @@ LL | struct MyStruct1>; | | | expected 0 generic arguments -error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:10:25 | LL | struct MyStruct2<'a, T: Copy<'a>>; @@ -30,7 +30,7 @@ LL | struct MyStruct2<'a, T: Copy<'a>>; | | | expected 0 lifetime arguments -error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} @@ -38,7 +38,7 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | | | expected 0 lifetime arguments -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} diff --git a/tests/ui/typeck/typeck_type_placeholder_item.rs b/tests/ui/typeck/typeck_type_placeholder_item.rs index b96c52713..a450dbb82 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.rs +++ b/tests/ui/typeck/typeck_type_placeholder_item.rs @@ -227,4 +227,6 @@ fn evens_squared(n: usize) -> _ { } const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); -//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants +//~^ ERROR the trait bound +//~| ERROR the trait bound +//~| ERROR the placeholder diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index bc02547c6..bc6c9fd07 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -437,17 +437,37 @@ LL | fn evens_squared(n: usize) -> _ { | not allowed in type signatures | help: replace with an appropriate return type: `impl Iterator` -error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/typeck_type_placeholder_item.rs:229:10 +error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied + --> $DIR/typeck_type_placeholder_item.rs:229:22 | LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); - | ^ not allowed in type signatures + | ^^^^^^ `std::ops::Range<{integer}>` is not an iterator + | + = help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>` +note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const` + --> $DIR/typeck_type_placeholder_item.rs:229:14 + | +LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); + | ^^^^^^^ + +error[E0277]: the trait bound `Filter, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>: Iterator` is not satisfied + --> $DIR/typeck_type_placeholder_item.rs:229:45 | -note: however, the inferred type `Map, [closure@typeck_type_placeholder_item.rs:229:29]>, [closure@typeck_type_placeholder_item.rs:229:49]>` cannot be named +LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); + | ^^^ `Filter, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>` is not an iterator + | + = help: the trait `~const Iterator` is not implemented for `Filter, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>` +note: the trait `Iterator` is implemented for `Filter, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>`, but that implementation is not `const` --> $DIR/typeck_type_placeholder_item.rs:229:14 | LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/typeck_type_placeholder_item.rs:229:10 + | +LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); + | ^ not allowed in type signatures error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:140:31 @@ -657,7 +677,7 @@ LL | const D: _ = 42; | not allowed in type signatures | help: replace with the correct type: `i32` -error: aborting due to 71 previous errors +error: aborting due to 73 previous errors -Some errors have detailed explanations: E0121, E0282, E0403. +Some errors have detailed explanations: E0121, E0277, E0282, E0403. For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs index 43e46c5b6..90b12ffdf 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.rs @@ -7,5 +7,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; - //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied + //~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied } diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index a89c6b85c..c4e4aed20 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs index 178b8b122..e361312dd 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.rs @@ -7,5 +7,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, usize> = Foo { r: &5 }; - //~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied + //~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied } diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index f30766bdf..302231777 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -1,4 +1,4 @@ -error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; diff --git a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs index 2f9cfcf8d..718b6deed 100644 --- a/tests/ui/typeck/typeck_type_placeholder_mismatch.rs +++ b/tests/ui/typeck/typeck_type_placeholder_mismatch.rs @@ -14,7 +14,7 @@ fn test1() { //~^ ERROR mismatched types //~| expected struct `Foo<_>` //~| found struct `Bar` - //~| expected struct `Foo`, found struct `Bar` + //~| expected `Foo<_>`, found `Bar` let y: Foo = x; } @@ -23,5 +23,5 @@ fn test2() { //~^ ERROR mismatched types //~| expected struct `Foo<_>` //~| found struct `Bar` - //~| expected struct `Foo`, found struct `Bar` + //~| expected `Foo<_>`, found `Bar` } diff --git a/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr b/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr index 867412a24..bf8e0bbb5 100644 --- a/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_mismatch.rs:13:21 | LL | let x: Foo<_> = Bar::(PhantomData); - | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar` | | | expected due to this | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_mismatch.rs:22:21 | LL | let x: Foo<_> = Bar::(PhantomData); - | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar` | | | expected due to this | diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.rs b/tests/ui/ufcs/ufcs-qpath-missing-params.rs index 766351634..6ab6580c0 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.rs +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.rs @@ -15,6 +15,6 @@ fn main() { //~^ ERROR missing generics for ::into_cow::("foo".to_string()); - //~^ ERROR this associated function takes 0 generic arguments but 1 + //~^ ERROR method takes 0 generic arguments but 1 //~| ERROR missing generics for } diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index d0ec47d61..233887121 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -30,7 +30,7 @@ help: add missing generic argument LL | >::into_cow::("foo".to_string()); | +++ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | ::into_cow::("foo".to_string()); @@ -38,7 +38,7 @@ LL | ::into_cow::("foo".to_string()); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/ufcs-qpath-missing-params.rs:4:8 | LL | fn into_cow(self) -> Cow<'a, B>; diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index e85144a31..96ac43216 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -28,7 +28,7 @@ LL | >::add(1u32, 2); | ^^^^^^^^^^^^^^^^^^^^^^^----^^^^ | | | this argument influences the return type of `Add` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | @@ -50,7 +50,7 @@ LL | >::add(1, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^----^ | | | this argument influences the return type of `Add` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-region.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-region.rs index 65f40075b..c575f5077 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-region.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-region.rs @@ -28,7 +28,7 @@ fn test<'a,'b>() { } fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { - //~^ ERROR this trait takes 1 lifetime argument but 0 lifetime arguments were supplied + //~^ ERROR trait takes 1 lifetime argument but 0 lifetime arguments were supplied // Here, the omitted lifetimes are expanded to distinct things. same_type(x, y) } diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-region.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-region.stderr index 016fc4dfb..881461781 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-region.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-region.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: trait takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/unboxed-closure-sugar-region.rs:30:51 | LL | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs index 462f6fb7b..14d5646b5 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs @@ -7,7 +7,7 @@ struct Bar { fn bar() { let x: Box = panic!(); //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait - //~| ERROR this struct takes 1 generic argument but 0 generic arguments + //~| ERROR struct takes 1 generic argument but 0 generic arguments } fn main() { } diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr index 29ea5735c..27b22c212 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr @@ -4,7 +4,7 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait LL | let x: Box = panic!(); | ^^^^^ only `Fn` traits may use parentheses -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 | LL | let x: Box = panic!(); diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs index bd61cbd80..657b29204 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs @@ -6,7 +6,7 @@ struct Bar { fn foo(b: Box) { //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait - //~| ERROR this struct takes 1 generic argument but 0 generic arguments + //~| ERROR struct takes 1 generic argument but 0 generic arguments } fn main() { } diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr index 427ba3414..94e42a66c 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr @@ -4,7 +4,7 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait LL | fn foo(b: Box) { | ^^^^^ only `Fn` traits may use parentheses -error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15 | LL | fn foo(b: Box) { diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index f26ad8e93..dd47ae73a 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -3,7 +3,7 @@ trait Three { fn dummy(&self) -> (A,B,C); } fn foo(_: &dyn Three()) -//~^ ERROR this trait takes 3 generic arguments but 1 generic argument +//~^ ERROR trait takes 3 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found {} diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index ebaacf0a6..5d7fe3fa5 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 3 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16 | LL | fn foo(_: &dyn Three()) diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index 4465b43a7..2c7e12f32 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -3,25 +3,25 @@ trait Zero { fn dummy(&self); } fn foo1(_: dyn Zero()) { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } fn foo2(_: dyn Zero) { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument } fn foo3(_: dyn Zero < usize >) { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument } fn foo4(_: dyn Zero(usize)) { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } fn foo5(_: dyn Zero ( usize )) { - //~^ ERROR this trait takes 0 generic arguments but 1 generic argument + //~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Zero` } diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 9601e64c1..50b90553a 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:16 | LL | fn foo1(_: dyn Zero()) { @@ -18,7 +18,7 @@ error[E0220]: associated type `Output` not found for `Zero` LL | fn foo1(_: dyn Zero()) { | ^^^^^^ associated type `Output` not found -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:16 | LL | fn foo2(_: dyn Zero) { @@ -32,7 +32,7 @@ note: trait defined here, with 0 generic parameters LL | trait Zero { fn dummy(&self); } | ^^^^ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:16 | LL | fn foo3(_: dyn Zero < usize >) { @@ -46,7 +46,7 @@ note: trait defined here, with 0 generic parameters LL | trait Zero { fn dummy(&self); } | ^^^^ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:16 | LL | fn foo4(_: dyn Zero(usize)) { @@ -66,7 +66,7 @@ error[E0220]: associated type `Output` not found for `Zero` LL | fn foo4(_: dyn Zero(usize)) { | ^^^^^^^^^^^ associated type `Output` not found -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:16 | LL | fn foo5(_: dyn Zero ( usize )) { diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs index 4bcf90552..ad60b0a0c 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs @@ -3,7 +3,7 @@ trait Trait {} fn f isize>(x: F) {} -//~^ ERROR this trait takes 0 generic arguments but 1 generic argument +//~^ ERROR trait takes 0 generic arguments but 1 generic argument //~| ERROR associated type `Output` not found for `Trait` fn main() {} diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 3ff05fb23..130b193d6 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f isize>(x: F) {} diff --git a/tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr index 21d6b4fde..98fe97c5c 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed LL | let f = || x += 1; | -- - borrow occurs due to use of `x` in closure | | - | borrow of `x` occurs here + | `x` is borrowed here LL | let _y = x; | ^ use of borrowed `x` LL | f; diff --git a/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index cbdb4dd0f..23aa18d71 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -16,14 +16,14 @@ error[E0506]: cannot assign to `factorial` because it is borrowed --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5 | LL | let f = |x: u32| -> u32 { - | --------------- borrow of `factorial` occurs here + | --------------- `factorial` is borrowed here LL | let g = factorial.as_ref().unwrap(); | --------- borrow occurs due to use in closure ... LL | factorial = Some(Box::new(f)); | ^^^^^^^^^ | | - | assignment to borrowed `factorial` occurs here + | `factorial` is assigned to here but it was already borrowed | borrow later used here error[E0597]: `factorial` does not live long enough @@ -47,12 +47,12 @@ LL | let mut factorial: Option u32 + 'static>> = None; | ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static` LL | LL | let f = |x: u32| -> u32 { - | --------------- borrow of `factorial` occurs here + | --------------- `factorial` is borrowed here LL | let g = factorial.as_ref().unwrap(); | --------- borrow occurs due to use in closure ... LL | factorial = Some(Box::new(f)); - | ^^^^^^^^^ assignment to borrowed `factorial` occurs here + | ^^^^^^^^^ `factorial` is assigned to here but it was already borrowed error: aborting due to 4 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 635ebbb71..846a44ce4 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -14,7 +14,7 @@ note: required by a bound in `foo` --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:4:14 | LL | fn foo(f: F) - | --- required by a bound in this + | --- required by a bound in this function LL | where F: Fn() | ^^^^ required by this bound in `foo` diff --git a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 99ec51783..482fd3cb4 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -1,4 +1,4 @@ -error[E0599]: no method named `call` found for closure `[closure@unboxed-closures-static-call-wrong-trait.rs:6:26]` in the current scope +error[E0599]: no method named `call` found for closure `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29]` in the current scope --> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10 | LL | mut_.call((0, )); diff --git a/tests/ui/uninhabited/issue-107505.rs b/tests/ui/uninhabited/issue-107505.rs new file mode 100644 index 000000000..61598541d --- /dev/null +++ b/tests/ui/uninhabited/issue-107505.rs @@ -0,0 +1,18 @@ +// compile-flags: --crate-type=lib +// check-pass + +// Make sure we don't pass inference variables to uninhabitedness checks in borrowck + +struct Command<'s> { + session: &'s (), + imp: std::convert::Infallible, +} + +fn command(_: &()) -> Command<'_> { + unreachable!() +} + +fn with_session<'s>(a: &std::process::Command, b: &'s ()) -> Command<'s> { + a.get_program(); + command(b) +} diff --git a/tests/ui/union/projection-as-union-type-error-2.rs b/tests/ui/union/projection-as-union-type-error-2.rs new file mode 100644 index 000000000..b88167b3b --- /dev/null +++ b/tests/ui/union/projection-as-union-type-error-2.rs @@ -0,0 +1,20 @@ +// Test to ensure that there is no ICE when normalizing a projection +// which is invalid (from ). + +#![crate_type = "lib"] + +trait Identity { + type Identity; +} +trait NotImplemented {} + +impl Identity for T { + type Identity = Self; +} + +type Foo = u8; + +union Bar { + a: ::Identity, //~ ERROR + b: u8, +} diff --git a/tests/ui/union/projection-as-union-type-error-2.stderr b/tests/ui/union/projection-as-union-type-error-2.stderr new file mode 100644 index 000000000..bab226f27 --- /dev/null +++ b/tests/ui/union/projection-as-union-type-error-2.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `u8: NotImplemented` is not satisfied + --> $DIR/projection-as-union-type-error-2.rs:18:8 + | +LL | a: ::Identity, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotImplemented` is not implemented for `u8` + | +note: required for `u8` to implement `Identity` + --> $DIR/projection-as-union-type-error-2.rs:11:25 + | +LL | impl Identity for T { + | -------------- ^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/projection-as-union-type-error.rs b/tests/ui/union/projection-as-union-type-error.rs new file mode 100644 index 000000000..17091c35f --- /dev/null +++ b/tests/ui/union/projection-as-union-type-error.rs @@ -0,0 +1,15 @@ +// Test to ensure that there is no ICE when normalizing a projection +// which is invalid (from ). + +#![crate_type = "lib"] + +pub trait Identity { + type Identity; +} + +pub type Foo = u8; + +pub union Bar { + a: ::Identity, //~ ERROR + b: u8, +} diff --git a/tests/ui/union/projection-as-union-type-error.stderr b/tests/ui/union/projection-as-union-type-error.stderr new file mode 100644 index 000000000..e4fbe9603 --- /dev/null +++ b/tests/ui/union/projection-as-union-type-error.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `u8: Identity` is not satisfied + --> $DIR/projection-as-union-type-error.rs:13:9 + | +LL | a: ::Identity, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Identity` is not implemented for `u8` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/projection-as-union-type.rs b/tests/ui/union/projection-as-union-type.rs new file mode 100644 index 000000000..143434c96 --- /dev/null +++ b/tests/ui/union/projection-as-union-type.rs @@ -0,0 +1,19 @@ +// Ensures that we can use projections as union field's type. +// check-pass + +#![crate_type = "lib"] + +pub trait Identity { + type Identity; +} + +impl Identity for T { + type Identity = Self; +} + +pub type Foo = u8; + +pub union Bar { + pub a: ::Identity, + pub b: u8, +} diff --git a/tests/ui/unop-move-semantics.stderr b/tests/ui/unop-move-semantics.stderr index 2a3ca1443..e47785c46 100644 --- a/tests/ui/unop-move-semantics.stderr +++ b/tests/ui/unop-move-semantics.stderr @@ -23,6 +23,8 @@ LL | fn move_then_borrow + Clone + Copy>(x: T) { error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/unop-move-semantics.rs:15:6 | +LL | fn move_borrowed>(x: T, mut y: T) { + | - binding `x` declared here LL | let m = &x; | -- borrow of `x` occurs here ... @@ -35,6 +37,9 @@ LL | use_mut(n); use_imm(m); error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/unop-move-semantics.rs:17:6 | +LL | fn move_borrowed>(x: T, mut y: T) { + | ----- binding `y` declared here +LL | let m = &x; LL | let n = &mut y; | ------ borrow of `y` occurs here ... diff --git a/tests/ui/unpretty/ast-const-trait-bound.rs b/tests/ui/unpretty/ast-const-trait-bound.rs new file mode 100644 index 000000000..dbcba7871 --- /dev/null +++ b/tests/ui/unpretty/ast-const-trait-bound.rs @@ -0,0 +1,4 @@ +// compile-flags: -Zunpretty=normal +// check-pass + +fn foo() where T: ~const Bar {} diff --git a/tests/ui/unpretty/ast-const-trait-bound.stdout b/tests/ui/unpretty/ast-const-trait-bound.stdout new file mode 100644 index 000000000..dbcba7871 --- /dev/null +++ b/tests/ui/unpretty/ast-const-trait-bound.stdout @@ -0,0 +1,4 @@ +// compile-flags: -Zunpretty=normal +// check-pass + +fn foo() where T: ~const Bar {} diff --git a/tests/ui/unsized-locals/suggest-borrow.stderr b/tests/ui/unsized-locals/suggest-borrow.stderr index 08745eab2..d456c16de 100644 --- a/tests/ui/unsized-locals/suggest-borrow.stderr +++ b/tests/ui/unsized-locals/suggest-borrow.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types LL | let x: &[u8] = vec!(1, 2, 3)[..]; | ----- ^^^^^^^^^^^^^^^^^ | | | - | | expected `&[u8]`, found slice `[{integer}]` + | | expected `&[u8]`, found `[{integer}]` | | help: consider borrowing here: `&vec!(1, 2, 3)[..]` | expected due to this @@ -26,7 +26,7 @@ error[E0308]: mismatched types --> $DIR/suggest-borrow.rs:4:19 | LL | let x: [u8] = &vec!(1, 2, 3)[..]; - | ---- ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]` + | ---- ^^^^^^^^^^^^^^^^^^ expected `[u8]`, found `&[{integer}]` | | | expected due to this | diff --git a/tests/ui/unsized/box-instead-of-dyn-fn.stderr b/tests/ui/unsized/box-instead-of-dyn-fn.stderr index c96c59afc..bfb7c3957 100644 --- a/tests/ui/unsized/box-instead-of-dyn-fn.stderr +++ b/tests/ui/unsized/box-instead-of-dyn-fn.stderr @@ -9,7 +9,7 @@ LL | | move || println!("{a}") | | expected because of this LL | | } else { LL | | Box::new(move || println!("{}", b)) - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found struct `Box` + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found `Box<[closure@box-instead-of-dyn-fn.rs:10:18]>` LL | | LL | | } | |_____- `if` and `else` have incompatible types diff --git a/tests/ui/unsized/issue-71659.stderr b/tests/ui/unsized/issue-71659.stderr index d7b95f557..b57b3015e 100644 --- a/tests/ui/unsized/issue-71659.stderr +++ b/tests/ui/unsized/issue-71659.stderr @@ -8,7 +8,7 @@ note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 | LL | fn cast(&self) -> &T - | ---- required by a bound in this + | ---- required by a bound in this associated function LL | where LL | Self: CastTo, | ^^^^^^^^^ required by this bound in `Cast::cast` diff --git a/tests/ui/unsized/param-mentioned-by-different-field.stderr b/tests/ui/unsized/param-mentioned-by-different-field.stderr index d18fa6456..b1ad0cb5b 100644 --- a/tests/ui/unsized/param-mentioned-by-different-field.stderr +++ b/tests/ui/unsized/param-mentioned-by-different-field.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/param-mentioned-by-different-field.rs:8:25 | LL | let y: &Foo<[u8]> = &x; - | ---------- ^^ expected slice `[u8]`, found array `[u8; 1]` + | ---------- ^^ expected `&Foo<[u8]>`, found `&Foo<[u8; 1]>` | | | expected due to this | diff --git a/tests/ui/unsized/unsized3-rpass.rs b/tests/ui/unsized/unsized3-rpass.rs index 4d5e89575..a3f92be6c 100644 --- a/tests/ui/unsized/unsized3-rpass.rs +++ b/tests/ui/unsized/unsized3-rpass.rs @@ -59,7 +59,7 @@ pub fn main() { } let data: Box> = Box::new(Foo_ { f: [1, 2, 3] }); - let x: &Foo = mem::transmute(slice::from_raw_parts(&*data, 3)); + let x: &Foo = mem::transmute(ptr::slice_from_raw_parts(&*data, 3)); assert_eq!(x.f.len(), 3); assert_eq!(x.f[0], 1); @@ -70,7 +70,7 @@ pub fn main() { let data: Box<_> = Box::new(Baz_ { f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }); - let x: &Baz = mem::transmute(slice::from_raw_parts(&*data, 5)); + let x: &Baz = mem::transmute(ptr::slice_from_raw_parts(&*data, 5)); assert_eq!(x.f1, 42); let chs: Vec = x.f2.chars().collect(); assert_eq!(chs.len(), 5); diff --git a/tests/ui/variance/variance-associated-types.rs b/tests/ui/variance/variance-associated-types.rs index 1165fb53c..ecb082182 100644 --- a/tests/ui/variance/variance-associated-types.rs +++ b/tests/ui/variance/variance-associated-types.rs @@ -10,7 +10,7 @@ trait Trait<'a> { } #[rustc_variance] -struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +] +struct Foo<'a, T : Trait<'a>> { //~ ERROR [+, +] field: (T, &'a ()) } diff --git a/tests/ui/variance/variance-associated-types.stderr b/tests/ui/variance/variance-associated-types.stderr index 51f17c7c2..70cb246f6 100644 --- a/tests/ui/variance/variance-associated-types.stderr +++ b/tests/ui/variance/variance-associated-types.stderr @@ -1,4 +1,4 @@ -error: [-, +] +error: [+, +] --> $DIR/variance-associated-types.rs:13:1 | LL | struct Foo<'a, T : Trait<'a>> { diff --git a/tests/ui/variance/variance-issue-20533.stderr b/tests/ui/variance/variance-issue-20533.stderr index 008e2a002..258f67db5 100644 --- a/tests/ui/variance/variance-issue-20533.stderr +++ b/tests/ui/variance/variance-issue-20533.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/variance-issue-20533.rs:28:14 | +LL | let a = AffineU32(1); + | - binding `a` declared here LL | let x = foo(&a); | -- borrow of `a` occurs here LL | drop(a); @@ -11,6 +13,8 @@ LL | drop(x); error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/variance-issue-20533.rs:34:14 | +LL | let a = AffineU32(1); + | - binding `a` declared here LL | let x = bar(&a); | -- borrow of `a` occurs here LL | drop(a); @@ -21,6 +25,8 @@ LL | drop(x); error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/variance-issue-20533.rs:40:14 | +LL | let a = AffineU32(1); + | - binding `a` declared here LL | let x = baz(&a); | -- borrow of `a` occurs here LL | drop(a); diff --git a/tests/ui/variance/variance-regions-direct.rs b/tests/ui/variance/variance-regions-direct.rs index 3f34e7655..39ea77a8a 100644 --- a/tests/ui/variance/variance-regions-direct.rs +++ b/tests/ui/variance/variance-regions-direct.rs @@ -6,7 +6,7 @@ // Regions that just appear in normal spots are contravariant: #[rustc_variance] -struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -] +struct Test2<'a, 'b, 'c> { //~ ERROR [+, +, +] x: &'a isize, y: &'b [isize], c: &'c str @@ -15,7 +15,7 @@ struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -] // Those same annotations in function arguments become covariant: #[rustc_variance] -struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +] +struct Test3<'a, 'b, 'c> { //~ ERROR [-, -, -] x: extern "Rust" fn(&'a isize), y: extern "Rust" fn(&'b [isize]), c: extern "Rust" fn(&'c str), @@ -24,7 +24,7 @@ struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +] // Mutability induces invariance: #[rustc_variance] -struct Test4<'a, 'b:'a> { //~ ERROR [-, o] +struct Test4<'a, 'b:'a> { //~ ERROR [+, o] x: &'a mut &'b isize, } @@ -32,7 +32,7 @@ struct Test4<'a, 'b:'a> { //~ ERROR [-, o] // contravariant context: #[rustc_variance] -struct Test5<'a, 'b:'a> { //~ ERROR [+, o] +struct Test5<'a, 'b:'a> { //~ ERROR [-, o] x: extern "Rust" fn(&'a mut &'b isize), } @@ -42,7 +42,7 @@ struct Test5<'a, 'b:'a> { //~ ERROR [+, o] // argument list occurs in an invariant context. #[rustc_variance] -struct Test6<'a, 'b:'a> { //~ ERROR [-, o] +struct Test6<'a, 'b:'a> { //~ ERROR [+, o] x: &'a mut extern "Rust" fn(&'b isize), } @@ -56,7 +56,7 @@ struct Test7<'a> { //~ ERROR [*] // Try enums too. #[rustc_variance] -enum Test8<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +enum Test8<'a, 'b, 'c:'b> { //~ ERROR [-, +, o] Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), Test8C(&'b mut &'c str), diff --git a/tests/ui/variance/variance-regions-direct.stderr b/tests/ui/variance/variance-regions-direct.stderr index eda02e9b0..c55730296 100644 --- a/tests/ui/variance/variance-regions-direct.stderr +++ b/tests/ui/variance/variance-regions-direct.stderr @@ -1,28 +1,28 @@ -error: [-, -, -] +error: [+, +, +] --> $DIR/variance-regions-direct.rs:9:1 | LL | struct Test2<'a, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, +, +] +error: [-, -, -] --> $DIR/variance-regions-direct.rs:18:1 | LL | struct Test3<'a, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: [-, o] +error: [+, o] --> $DIR/variance-regions-direct.rs:27:1 | LL | struct Test4<'a, 'b:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, o] +error: [-, o] --> $DIR/variance-regions-direct.rs:35:1 | LL | struct Test5<'a, 'b:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [-, o] +error: [+, o] --> $DIR/variance-regions-direct.rs:45:1 | LL | struct Test6<'a, 'b:'a> { @@ -34,7 +34,7 @@ error: [*] LL | struct Test7<'a> { | ^^^^^^^^^^^^^^^^ -error: [+, -, o] +error: [-, +, o] --> $DIR/variance-regions-direct.rs:59:1 | LL | enum Test8<'a, 'b, 'c:'b> { diff --git a/tests/ui/variance/variance-regions-indirect.rs b/tests/ui/variance/variance-regions-indirect.rs index f84f25ada..0d00535fe 100644 --- a/tests/ui/variance/variance-regions-indirect.rs +++ b/tests/ui/variance/variance-regions-indirect.rs @@ -5,14 +5,14 @@ #![feature(rustc_attrs)] #[rustc_variance] -enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [+, -, o, *] +enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [-, +, o, *] Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), Test8C(&'b mut &'c str), } #[rustc_variance] -struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, -, +] +struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, +, -] f: Base<'z, 'y, 'x, 'w> } @@ -22,12 +22,12 @@ struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] } #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here) -struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, -, *] +struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, +, *] f: Base<'a, 'b, 'a, 'c> } #[rustc_variance] // Combine + and * to yield + (just pay attention to 'a here) -struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [-, +, o] f: Base<'a, 'b, 'c, 'a> } diff --git a/tests/ui/variance/variance-regions-indirect.stderr b/tests/ui/variance/variance-regions-indirect.stderr index fa2f4d507..edf2626d5 100644 --- a/tests/ui/variance/variance-regions-indirect.stderr +++ b/tests/ui/variance/variance-regions-indirect.stderr @@ -1,10 +1,10 @@ -error: [+, -, o, *] +error: [-, +, o, *] --> $DIR/variance-regions-indirect.rs:8:1 | LL | enum Base<'a, 'b, 'c:'b, 'd> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, o, -, +] +error: [*, o, +, -] --> $DIR/variance-regions-indirect.rs:15:1 | LL | struct Derived1<'w, 'x:'y, 'y, 'z> { @@ -16,13 +16,13 @@ error: [o, o, *] LL | struct Derived2<'a, 'b:'a, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, -, *] +error: [o, +, *] --> $DIR/variance-regions-indirect.rs:25:1 | LL | struct Derived3<'a:'b, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, -, o] +error: [-, +, o] --> $DIR/variance-regions-indirect.rs:30:1 | LL | struct Derived4<'a, 'b, 'c:'b> { diff --git a/tests/ui/variance/variance-trait-object-bound.rs b/tests/ui/variance/variance-trait-object-bound.rs index ec3c973bc..11303c465 100644 --- a/tests/ui/variance/variance-trait-object-bound.rs +++ b/tests/ui/variance/variance-trait-object-bound.rs @@ -11,7 +11,7 @@ use std::mem; trait T { fn foo(&self); } #[rustc_variance] -struct TOption<'a> { //~ ERROR [-] +struct TOption<'a> { //~ ERROR [+] v: Option>, } diff --git a/tests/ui/variance/variance-trait-object-bound.stderr b/tests/ui/variance/variance-trait-object-bound.stderr index 7c46b553f..bfcc8d4a1 100644 --- a/tests/ui/variance/variance-trait-object-bound.stderr +++ b/tests/ui/variance/variance-trait-object-bound.stderr @@ -1,4 +1,4 @@ -error: [-] +error: [+] --> $DIR/variance-trait-object-bound.rs:14:1 | LL | struct TOption<'a> { diff --git a/tests/ui/variance/variance-types.rs b/tests/ui/variance/variance-types.rs index b9b6d9c9b..cfc03b754 100644 --- a/tests/ui/variance/variance-types.rs +++ b/tests/ui/variance/variance-types.rs @@ -7,7 +7,7 @@ use std::cell::Cell; // not considered bivariant. #[rustc_variance] -struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [-, o, o] +struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [+, o, o] t: &'a mut (A,B) } diff --git a/tests/ui/variance/variance-types.stderr b/tests/ui/variance/variance-types.stderr index 9f7f1d9b0..0fda4b803 100644 --- a/tests/ui/variance/variance-types.stderr +++ b/tests/ui/variance/variance-types.stderr @@ -1,4 +1,4 @@ -error: [-, o, o] +error: [+, o, o] --> $DIR/variance-types.rs:10:1 | LL | struct InvariantMut<'a,A:'a,B:'a> { diff --git a/tests/ui/wait-forked-but-failed-child.rs b/tests/ui/wait-forked-but-failed-child.rs index 674c26a43..82a1dd637 100644 --- a/tests/ui/wait-forked-but-failed-child.rs +++ b/tests/ui/wait-forked-but-failed-child.rs @@ -3,6 +3,7 @@ // ignore-sgx no processes // ignore-vxworks no 'ps' // ignore-fuchsia no 'ps' +// ignore-nto no 'ps' #![feature(rustc_private)] diff --git a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs index 4fcf8f403..0be5127dc 100644 --- a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs +++ b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs @@ -13,5 +13,5 @@ pub struct Ref<'a>(&'a u8); impl Trait for Ref {} //~ ERROR: implicit elided lifetime not allowed here extern "C" { - pub fn repro(_: Wrapper); //~ ERROR: incompatible lifetime on type + pub fn repro(_: Wrapper); } diff --git a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr index 94f6dc266..b10856571 100644 --- a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr +++ b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr @@ -4,34 +4,11 @@ error[E0726]: implicit elided lifetime not allowed here LL | impl Trait for Ref {} | ^^^ expected lifetime parameter | - = note: assuming a `'static` lifetime... help: indicate the anonymous lifetime | LL | impl Trait for Ref<'_> {} | ++++ -error: incompatible lifetime on type - --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:21 - | -LL | pub fn repro(_: Wrapper); - | ^^^^^^^^^^^^ - | -note: because this has an unmet lifetime requirement - --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:8:23 - | -LL | pub struct Wrapper(T); - | ^^^^^ introduces a `'static` lifetime requirement -note: the anonymous lifetime as defined here... - --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:29 - | -LL | pub fn repro(_: Wrapper); - | ^^^ -note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` - --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:13:1 - | -LL | impl Trait for Ref {} - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0726`. diff --git a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr index 96fc1d36b..d2b416309 100644 --- a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr +++ b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr @@ -5,7 +5,7 @@ LL | / match opt() { LL | | Some(()) => &S, | | -- this is found to be of type `&S` LL | | None => &R, - | | ^^ expected struct `S`, found struct `R` + | | ^^ expected `&S`, found `&R` LL | | } | |_____- `match` arms have incompatible types | diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr index 30248a7a3..191a8ca8e 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr @@ -8,7 +8,7 @@ note: required by a bound in `called` --> $DIR/higher-ranked-fn-type.rs:12:25 | LL | fn called() - | ------ required by a bound in this + | ------ required by a bound in this function LL | where LL | for<'b> fn(&'b ()): Foo, | ^^^ required by this bound in `called` diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr index 268cef6e2..f4c7acd5c 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr @@ -8,7 +8,7 @@ note: required by a bound in `called` --> $DIR/higher-ranked-fn-type.rs:12:25 | LL | fn called() - | ------ required by a bound in this + | ------ required by a bound in this function LL | where LL | for<'b> fn(&'b ()): Foo, | ^^^ required by this bound in `called` diff --git a/tests/ui/where-clauses/self-in-where-clause-allowed.rs b/tests/ui/where-clauses/self-in-where-clause-allowed.rs new file mode 100644 index 000000000..6cf5ed2e4 --- /dev/null +++ b/tests/ui/where-clauses/self-in-where-clause-allowed.rs @@ -0,0 +1,23 @@ +// check-fail + +#![feature(auto_traits)] +#![deny(where_clauses_object_safety)] + +auto trait AutoTrait {} + +trait Trait { + fn static_lifetime_bound(&self) where Self: 'static {} + + fn arg_lifetime_bound<'a>(&self, _arg: &'a ()) where Self: 'a {} + + fn autotrait_bound(&self) where Self: AutoTrait {} +} + +impl Trait for () {} + +fn main() { + let trait_object = &() as &dyn Trait; + trait_object.static_lifetime_bound(); + trait_object.arg_lifetime_bound(&()); + trait_object.autotrait_bound(); //~ ERROR: the trait bound `dyn Trait: AutoTrait` is not satisfied +} diff --git a/tests/ui/where-clauses/self-in-where-clause-allowed.stderr b/tests/ui/where-clauses/self-in-where-clause-allowed.stderr new file mode 100644 index 000000000..ea51f5084 --- /dev/null +++ b/tests/ui/where-clauses/self-in-where-clause-allowed.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `dyn Trait: AutoTrait` is not satisfied + --> $DIR/self-in-where-clause-allowed.rs:22:18 + | +LL | trait_object.autotrait_bound(); + | ^^^^^^^^^^^^^^^ the trait `AutoTrait` is not implemented for `dyn Trait` + | +note: required by a bound in `Trait::autotrait_bound` + --> $DIR/self-in-where-clause-allowed.rs:13:43 + | +LL | fn autotrait_bound(&self) where Self: AutoTrait {} + | ^^^^^^^^^ required by this bound in `Trait::autotrait_bound` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/while/while-else-err.rs b/tests/ui/while/while-else-err.rs new file mode 100644 index 000000000..36b60fbd4 --- /dev/null +++ b/tests/ui/while/while-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + while false { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `while...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + }; +} diff --git a/tests/ui/while/while-else-err.stderr b/tests/ui/while/while-else-err.stderr new file mode 100644 index 000000000..88f715d56 --- /dev/null +++ b/tests/ui/while/while-else-err.stderr @@ -0,0 +1,17 @@ +error: `while...else` loops are not supported + --> $DIR/while-else-err.rs:4:7 + | +LL | while false { + | ----- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/while/while-else-let-else-err.rs b/tests/ui/while/while-else-let-else-err.rs new file mode 100644 index 000000000..6d9909347 --- /dev/null +++ b/tests/ui/while/while-else-let-else-err.rs @@ -0,0 +1,8 @@ +fn main() { + let _ = while false { + //~^ NOTE `else` is attached to this loop + } else { + //~^ ERROR `while...else` loops are not supported + //~| NOTE consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + }; +} diff --git a/tests/ui/while/while-else-let-else-err.stderr b/tests/ui/while/while-else-let-else-err.stderr new file mode 100644 index 000000000..431d37c00 --- /dev/null +++ b/tests/ui/while/while-else-let-else-err.stderr @@ -0,0 +1,17 @@ +error: `while...else` loops are not supported + --> $DIR/while-else-let-else-err.rs:4:7 + | +LL | let _ = while false { + | ----- `else` is attached to this loop +LL | +LL | } else { + | _______^ +LL | | +LL | | +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: aborting due to previous error + diff --git a/tests/ui/wrong-mul-method-signature.stderr b/tests/ui/wrong-mul-method-signature.stderr index 504a6032b..25a92f5ec 100644 --- a/tests/ui/wrong-mul-method-signature.stderr +++ b/tests/ui/wrong-mul-method-signature.stderr @@ -16,7 +16,7 @@ error[E0053]: method `mul` has an incompatible type for trait LL | fn mul(self, s: f64) -> Vec2 { | ^^^ | | - | expected struct `Vec2`, found `f64` + | expected `Vec2`, found `f64` | help: change the parameter type to match the trait: `Vec2` | = note: expected signature `fn(Vec2, Vec2) -> f64` @@ -38,7 +38,7 @@ error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 | LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ----------------------- ^^^ expected struct `Vec2`, found floating-point number + | ----------------------- ^^^ expected `Vec2`, found floating-point number | | | expected because this is `Vec2` @@ -46,7 +46,7 @@ error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:19 | LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found `f64` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64` | | | expected due to this diff --git a/tests/ui/xc-private-method2.rs b/tests/ui/xc-private-method2.rs index 92946923f..f11b25108 100644 --- a/tests/ui/xc-private-method2.rs +++ b/tests/ui/xc-private-method2.rs @@ -4,8 +4,8 @@ extern crate xc_private_method_lib; fn main() { let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - //~^ ERROR associated function `meth_struct` is private + //~^ ERROR method `meth_struct` is private let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - //~^ ERROR associated function `meth_enum` is private + //~^ ERROR method `meth_enum` is private } diff --git a/tests/ui/xc-private-method2.stderr b/tests/ui/xc-private-method2.stderr index b569882f8..af0c3cfcb 100644 --- a/tests/ui/xc-private-method2.stderr +++ b/tests/ui/xc-private-method2.stderr @@ -1,24 +1,24 @@ -error[E0624]: associated function `meth_struct` is private +error[E0624]: method `meth_struct` is private --> $DIR/xc-private-method2.rs:6:52 | LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); - | ^^^^^^^^^^^ private associated function + | ^^^^^^^^^^^ private method | ::: $DIR/auxiliary/xc-private-method-lib.rs:12:5 | LL | fn meth_struct(&self) -> isize { - | ------------------------------ private associated function defined here + | ------------------------------ private method defined here -error[E0624]: associated function `meth_enum` is private +error[E0624]: method `meth_enum` is private --> $DIR/xc-private-method2.rs:9:55 | LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); - | ^^^^^^^^^ private associated function + | ^^^^^^^^^ private method | ::: $DIR/auxiliary/xc-private-method-lib.rs:27:5 | LL | fn meth_enum(&self) -> isize { - | ---------------------------- private associated function defined here + | ---------------------------- private method defined here error: aborting due to 2 previous errors -- cgit v1.2.3